Merge pull request #55 from DrewMPeacock/update-splash

Update Qortal node graphics.
This commit is contained in:
CalDescent 2021-07-30 08:30:15 +01:00 committed by GitHub
commit fb8a4d0a41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 54 additions and 23 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

@ -1,15 +1,11 @@
package org.qortal.gui; package org.qortal.gui;
import java.awt.BorderLayout; import java.awt.*;
import java.awt.Image;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import javax.swing.JDialog; import javax.swing.*;
import javax.swing.JPanel;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@ -19,46 +15,53 @@ public class SplashFrame {
protected static final Logger LOGGER = LogManager.getLogger(SplashFrame.class); protected static final Logger LOGGER = LogManager.getLogger(SplashFrame.class);
private static SplashFrame instance; private static SplashFrame instance;
private JDialog splashDialog; private JFrame splashDialog;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public static class SplashPanel extends JPanel { public static class SplashPanel extends JPanel {
private BufferedImage image; private BufferedImage image;
private String defaultSplash = "Qlogo_512.png";
public SplashPanel() { public SplashPanel() {
image = Gui.loadImage("splash.png"); image = Gui.loadImage(defaultSplash);
this.setPreferredSize(new Dimension(image.getWidth(), image.getHeight()));
this.setLayout(new BorderLayout()); setOpaque(false);
setLayout(new GridBagLayout());
} }
@Override @Override
protected void paintComponent(Graphics g) { protected void paintComponent(Graphics g) {
super.paintComponent(g); super.paintComponent(g);
g.drawImage(image, 0, 0, null); g.drawImage(image, 0, 0, getWidth(), getHeight(), this);
}
@Override
public Dimension getPreferredSize() {
return new Dimension(500, 500);
} }
} }
private SplashFrame() { private SplashFrame() {
this.splashDialog = new JDialog(); this.splashDialog = new JFrame();
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);
this.splashDialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE); this.splashDialog.getContentPane().add(new SplashPanel());
this.splashDialog.setTitle("qortal"); this.splashDialog.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
this.splashDialog.setContentPane(new SplashPanel());
this.splashDialog.setUndecorated(true); this.splashDialog.setUndecorated(true);
this.splashDialog.setModal(false);
this.splashDialog.pack(); this.splashDialog.pack();
this.splashDialog.setLocationRelativeTo(null); this.splashDialog.setLocationRelativeTo(null);
this.splashDialog.toFront(); this.splashDialog.setBackground(new Color(0,0,0,0));
this.splashDialog.setVisible(true); this.splashDialog.setVisible(true);
this.splashDialog.repaint();
} }
public static SplashFrame getInstance() { public static SplashFrame getInstance() {

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.

After

Width:  |  Height:  |  Size: 62 KiB

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

0
src/main/resources/images/splash.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 77 KiB