runelite-client: add version to title
This commit is contained in:
@@ -112,6 +112,12 @@
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package net.runelite.client;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.eventbus.EventBus;
|
||||
import com.google.common.eventbus.SubscriberExceptionContext;
|
||||
import com.google.gson.Gson;
|
||||
@@ -79,6 +80,7 @@ public class RuneLite
|
||||
private static RuneLite runelite;
|
||||
private static TrayIcon trayIcon;
|
||||
|
||||
private final RuneliteProperties properties = new RuneliteProperties();
|
||||
private ClientUI gui;
|
||||
private PluginManager pluginManager;
|
||||
private final MenuManager menuManager = new MenuManager(this);
|
||||
@@ -139,6 +141,7 @@ public class RuneLite
|
||||
}
|
||||
|
||||
gui = new ClientUI();
|
||||
setTitle(null);
|
||||
|
||||
setupTrayIcon();
|
||||
});
|
||||
@@ -164,6 +167,18 @@ public class RuneLite
|
||||
loadSession();
|
||||
}
|
||||
|
||||
public void setTitle(String extra)
|
||||
{
|
||||
if (!Strings.isNullOrEmpty(extra))
|
||||
{
|
||||
gui.setTitle("RuneLite " + properties.getVersion() + " " + extra);
|
||||
}
|
||||
else
|
||||
{
|
||||
gui.setTitle("RuneLite " + properties.getVersion());
|
||||
}
|
||||
}
|
||||
|
||||
private void setupTrayIcon()
|
||||
{
|
||||
if (!SystemTray.isSupported())
|
||||
@@ -318,6 +333,11 @@ public class RuneLite
|
||||
return runelite;
|
||||
}
|
||||
|
||||
public RuneliteProperties getProperties()
|
||||
{
|
||||
return properties;
|
||||
}
|
||||
|
||||
public ClientUI getGui()
|
||||
{
|
||||
return gui;
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.runelite.client;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class RuneliteProperties
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(RuneliteProperties.class);
|
||||
|
||||
private static final String RUNELITE_VERSION = "runelite.version";
|
||||
|
||||
private final Properties properties = new Properties();
|
||||
|
||||
public RuneliteProperties()
|
||||
{
|
||||
InputStream in = getClass().getResourceAsStream("runelite.properties");
|
||||
try
|
||||
{
|
||||
properties.load(in);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
logger.warn("unable to load propertries", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public String getVersion()
|
||||
{
|
||||
return properties.getProperty(RUNELITE_VERSION);
|
||||
}
|
||||
}
|
||||
@@ -167,7 +167,6 @@ public class AccountPlugin extends Plugin
|
||||
{
|
||||
logger.debug("Now logged in as {}", loginResponse.getUsername());
|
||||
|
||||
//runelite.getGui().setTitle("RuneLite (" + loginResponse.getUsername() + ")");
|
||||
AccountSession session = runelite.getAccountSession();
|
||||
session.setUsername(loginResponse.getUsername());
|
||||
|
||||
@@ -191,7 +190,7 @@ public class AccountPlugin extends Plugin
|
||||
|
||||
logger.debug("Session opened as {}", session.getUsername());
|
||||
|
||||
runelite.getGui().setTitle("RuneLite (" + session.getUsername() + ")");
|
||||
runelite.setTitle("(" + session.getUsername() + ")");
|
||||
|
||||
replaceLoginWithLogout();
|
||||
}
|
||||
@@ -207,7 +206,7 @@ public class AccountPlugin extends Plugin
|
||||
@Subscribe
|
||||
public void onSessionClose(SessionClose sessionClose)
|
||||
{
|
||||
runelite.getGui().setTitle("RuneLite");
|
||||
runelite.setTitle(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
runelite.version=${project.version}
|
||||
|
||||
Reference in New Issue
Block a user