Bells & whistles: board-specific image into console splash screen #3498

This commit is contained in:
rusefillc 2021-11-17 22:26:24 -05:00
parent 59a0f643d4
commit 9ec38c7cdd
4 changed files with 24 additions and 4 deletions

1
.gitignore vendored
View File

@ -3,6 +3,7 @@ build/
build_kinetis/
pinouts
workarea
bundle_name.txt
out/
logs/
blbuild/

View File

@ -4,6 +4,7 @@ import com.rusefi.shared.ConnectionAndMeta;
import com.rusefi.shared.FileUtil;
import com.rusefi.ui.storage.PersistentConfiguration;
import com.rusefi.ui.util.FrameHelper;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
@ -188,6 +189,7 @@ public class Autoupdate {
return doUpdate.get();
}
@Nullable
public static String readBundleFullName() {
try {
BufferedReader r = new BufferedReader(new FileReader(BUNDLE_NAME_FILE));

View File

@ -6,7 +6,7 @@ import java.net.URL;
import java.util.concurrent.atomic.AtomicReference;
public class rusEFIVersion {
public static final int CONSOLE_VERSION = 20211116;
public static final int CONSOLE_VERSION = 20211117;
public static AtomicReference<String> firmwareVersion = new AtomicReference<>("N/A");
public static long classBuildTimeMillis() {

View File

@ -12,6 +12,7 @@ import com.rusefi.ui.util.URLLabel;
import com.rusefi.ui.util.UiUtils;
import net.miginfocom.swing.MigLayout;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.putgemin.VerticalFlowLayout;
import javax.swing.*;
@ -37,7 +38,8 @@ import static javax.swing.JOptionPane.YES_NO_OPTION;
* @see FirmwareFlasher
*/
public class StartupFrame {
private static final String LOGO = "/com/rusefi/logo.png";
public static final String LOGO_PATH = "/com/rusefi/";
private static final String LOGO = LOGO_PATH + "logo.png";
public static final String LINK_TEXT = "rusEFI (c) 2012-2021";
private static final String URI = "http://rusefi.com/?java_console";
// private static final int RUSEFI_ORANGE = 0xff7d03;
@ -221,13 +223,13 @@ public class StartupFrame {
}
public static void setFrameIcon(Frame frame) {
ImageIcon icon = AutoupdateUtil.loadIcon(LOGO);
ImageIcon icon = getBundleIcon();
if (icon != null)
frame.setIconImage(icon.getImage());
}
public static JLabel createLogoLabel() {
ImageIcon logoIcon = AutoupdateUtil.loadIcon(LOGO);
ImageIcon logoIcon = getBundleIcon();
if (logoIcon == null)
return null;
JLabel logo = new JLabel(logoIcon);
@ -237,6 +239,21 @@ public class StartupFrame {
return logo;
}
@Nullable
private static ImageIcon getBundleIcon() {
String bundle = Autoupdate.readBundleFullName();
bundle = bundle == null ? "" : bundle;
String logoName;
if (bundle.contains("proteus")) {
logoName = LOGO_PATH + "logo_proteus.png";
} else if (bundle.contains("_mre")) {
logoName = LOGO_PATH + "logo_mre.png";
} else {
logoName = LOGO;
}
return AutoupdateUtil.loadIcon(logoName);
}
private void connectButtonAction(JComboBox<String> comboSpeeds) {
BaudRateHolder.INSTANCE.baudRate = Integer.parseInt((String) comboSpeeds.getSelectedItem());
String selectedPort = comboPorts.getSelectedItem().toString();