Merge remote-tracking branch 'qm/status-on-icon' into update-splash

This commit is contained in:
Sir.Galahad 2021-07-27 19:46:34 -06:00
commit 3c47f6917a
7 changed files with 35 additions and 4 deletions

View File

@ -854,6 +854,7 @@ public class Controller extends Thread {
private void updateSysTray() { private void updateSysTray() {
if (NTP.getTime() == null) { if (NTP.getTime() == null) {
SysTray.getInstance().setToolTipText(Translator.INSTANCE.translate("SysTray", "SYNCHRONIZING_CLOCK")); SysTray.getInstance().setToolTipText(Translator.INSTANCE.translate("SysTray", "SYNCHRONIZING_CLOCK"));
SysTray.getInstance().setTrayIcon(1);
return; return;
} }
@ -867,14 +868,22 @@ public class Controller extends Thread {
String actionText; String actionText;
synchronized (this.syncLock) { synchronized (this.syncLock) {
if (this.isMintingPossible) if (this.isMintingPossible) {
actionText = Translator.INSTANCE.translate("SysTray", "MINTING_ENABLED"); actionText = Translator.INSTANCE.translate("SysTray", "MINTING_ENABLED");
else if (this.isSynchronizing) SysTray.getInstance().setTrayIcon(2);
}
else if (this.isSynchronizing) {
actionText = String.format("%s - %d%%", Translator.INSTANCE.translate("SysTray", "SYNCHRONIZING_BLOCKCHAIN"), this.syncPercent); actionText = String.format("%s - %d%%", Translator.INSTANCE.translate("SysTray", "SYNCHRONIZING_BLOCKCHAIN"), this.syncPercent);
else if (numberOfPeers < Settings.getInstance().getMinBlockchainPeers()) SysTray.getInstance().setTrayIcon(3);
}
else if (numberOfPeers < Settings.getInstance().getMinBlockchainPeers()) {
actionText = Translator.INSTANCE.translate("SysTray", "CONNECTING"); actionText = Translator.INSTANCE.translate("SysTray", "CONNECTING");
else SysTray.getInstance().setTrayIcon(3);
}
else {
actionText = Translator.INSTANCE.translate("SysTray", "MINTING_DISABLED"); actionText = Translator.INSTANCE.translate("SysTray", "MINTING_DISABLED");
SysTray.getInstance().setTrayIcon(4);
}
} }
String tooltip = String.format("%s - %d %s - %s %d", actionText, numberOfPeers, connectionsText, heightText, height) + "\n" + String.format("Build version: %s", this.buildVersion); String tooltip = String.format("%s - %d %s - %s %d", actionText, numberOfPeers, connectionsText, heightText, height) + "\n" + String.format("Build version: %s", this.buildVersion);

View File

@ -48,6 +48,9 @@ public class SplashFrame {
List<Image> icons = new ArrayList<>(); List<Image> icons = new ArrayList<>();
icons.add(Gui.loadImage("icons/icon16.png")); icons.add(Gui.loadImage("icons/icon16.png"));
icons.add(Gui.loadImage("icons/icon32.png")); icons.add(Gui.loadImage("icons/icon32.png"));
icons.add(Gui.loadImage("icons/icon32c.png"));
icons.add(Gui.loadImage("icons/icon32m.png"));
icons.add(Gui.loadImage("icons/icon32n.png"));
icons.add(Gui.loadImage("icons/icon64.png")); icons.add(Gui.loadImage("icons/icon64.png"));
icons.add(Gui.loadImage("icons/icon128.png")); icons.add(Gui.loadImage("icons/icon128.png"));
this.splashDialog.setIconImages(icons); this.splashDialog.setIconImages(icons);

View File

@ -289,6 +289,25 @@ public class SysTray {
this.trayIcon.setToolTip(text); this.trayIcon.setToolTip(text);
} }
public void setTrayIcon(int iconid) {
if (trayIcon != null) {
switch (iconid) {
case 1:
this.trayIcon.setImage(Gui.loadImage("icons/icon32c.png"));
break;
case 2:
this.trayIcon.setImage(Gui.loadImage("icons/icon32m.png"));
break;
case 3:
this.trayIcon.setImage(Gui.loadImage("icons/icon32n.png"));
break;
case 4:
this.trayIcon.setImage(Gui.loadImage("icons/icon32.png"));
break;
}
}
}
public void dispose() { public void dispose() {
if (trayIcon != null) if (trayIcon != null)
SystemTray.getSystemTray().remove(this.trayIcon); SystemTray.getSystemTray().remove(this.trayIcon);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 694 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 987 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 762 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 676 B