only:LogoHelper
This commit is contained in:
parent
f83fa61775
commit
a31f65e016
|
@ -11,6 +11,7 @@ import com.rusefi.maintenance.DriverInstall;
|
|||
import com.rusefi.maintenance.ExecHelper;
|
||||
import com.rusefi.maintenance.FirmwareFlasher;
|
||||
import com.rusefi.maintenance.ProgramSelector;
|
||||
import com.rusefi.ui.LogoHelper;
|
||||
import com.rusefi.ui.PcanConnectorUI;
|
||||
import com.rusefi.ui.util.HorizontalLine;
|
||||
import com.rusefi.ui.util.URLLabel;
|
||||
|
@ -18,7 +19,6 @@ import com.rusefi.ui.util.UiUtils;
|
|||
import com.rusefi.util.IoUtils;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.putgemin.VerticalFlowLayout;
|
||||
|
||||
import javax.swing.*;
|
||||
|
@ -46,10 +46,6 @@ import static javax.swing.JOptionPane.YES_NO_OPTION;
|
|||
public class StartupFrame {
|
||||
private static final Logging log = getLogging(Launcher.class);
|
||||
|
||||
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-2023";
|
||||
private static final String URI = "http://rusefi.com/?java_console";
|
||||
// private static final int RUSEFI_ORANGE = 0xff7d03;
|
||||
|
||||
private final JFrame frame;
|
||||
|
@ -205,10 +201,10 @@ public class StartupFrame {
|
|||
rightPanel.add(urlLabel);
|
||||
}
|
||||
|
||||
JLabel logo = createLogoLabel();
|
||||
JLabel logo = LogoHelper.createLogoLabel();
|
||||
if (logo != null)
|
||||
rightPanel.add(logo);
|
||||
rightPanel.add(new URLLabel(LINK_TEXT, URI));
|
||||
rightPanel.add(new URLLabel(LogoHelper.LINK_TEXT, LogoHelper.URI));
|
||||
rightPanel.add(new JLabel("Version " + Launcher.CONSOLE_VERSION));
|
||||
|
||||
JPanel content = new JPanel(new BorderLayout());
|
||||
|
@ -238,41 +234,11 @@ public class StartupFrame {
|
|||
}
|
||||
|
||||
public static void setFrameIcon(Frame frame) {
|
||||
ImageIcon icon = getBundleIcon();
|
||||
ImageIcon icon = LogoHelper.getBundleIcon();
|
||||
if (icon != null)
|
||||
frame.setIconImage(icon.getImage());
|
||||
}
|
||||
|
||||
public static JLabel createLogoLabel() {
|
||||
ImageIcon logoIcon = getBundleIcon();
|
||||
if (logoIcon == null)
|
||||
return null;
|
||||
JLabel logo = new JLabel(logoIcon);
|
||||
logo.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
|
||||
URLLabel.addUrlAction(logo, URLLabel.createUri(URI));
|
||||
logo.setCursor(new Cursor(Cursor.HAND_CURSOR));
|
||||
return logo;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static ImageIcon getBundleIcon() {
|
||||
String bundle = BundleUtil.readBundleFullNameNotNull();
|
||||
String logoName;
|
||||
// these should be about 213px wide
|
||||
if (bundle.contains("proteus")) {
|
||||
logoName = LOGO_PATH + "logo_proteus.png";
|
||||
} else if (bundle.contains("honda")) {
|
||||
logoName = LOGO_PATH + "logo_tutomo.png";
|
||||
} else if (bundle.contains("alphax")) {
|
||||
logoName = LOGO_PATH + "logo_alphax.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();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.rusefi.trigger;
|
||||
|
||||
import com.rusefi.StartupFrame;
|
||||
import com.rusefi.enums.trigger_type_e;
|
||||
import com.rusefi.ui.LogoHelper;
|
||||
import com.rusefi.ui.engine.UpDownImage;
|
||||
import com.rusefi.core.ui.FrameHelper;
|
||||
import com.rusefi.ui.util.UiUtils;
|
||||
|
@ -24,7 +24,7 @@ import java.util.List;
|
|||
*/
|
||||
public class TriggerImage {
|
||||
private static final String OUTPUT_FOLDER = "triggers";
|
||||
private static final String TOP_MESSAGE = StartupFrame.LINK_TEXT;
|
||||
private static final String TOP_MESSAGE = LogoHelper.LINK_TEXT;
|
||||
|
||||
private static final int WHEEL_BORDER = 20;
|
||||
private static final int WHEEL_DIAMETER = 500;
|
||||
|
@ -148,7 +148,7 @@ public class TriggerImage {
|
|||
triggerWheelInfo);
|
||||
|
||||
topPanel.add(firstWheelControl);
|
||||
topPanel.add(StartupFrame.createLogoLabel());
|
||||
topPanel.add(LogoHelper.createLogoLabel());
|
||||
|
||||
List<WaveState> waves = TriggerImage.convertSignalsToWaves(triggerWheelInfo.getSignals());
|
||||
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
package com.rusefi.ui;
|
||||
|
||||
import com.rusefi.core.io.BundleUtil;
|
||||
import com.rusefi.core.ui.AutoupdateUtil;
|
||||
import com.rusefi.ui.util.URLLabel;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
public class LogoHelper {
|
||||
public static final String LOGO_PATH = "/com/rusefi/";
|
||||
public static final String LINK_TEXT = "rusEFI (c) 2012-2023";
|
||||
private static final String LOGO = LOGO_PATH + "logo.png";
|
||||
public static final String URI = "http://rusefi.com/?java_console";
|
||||
|
||||
public static JLabel createLogoLabel() {
|
||||
ImageIcon logoIcon = getBundleIcon();
|
||||
if (logoIcon == null)
|
||||
return null;
|
||||
JLabel logo = new JLabel(logoIcon);
|
||||
logo.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 10));
|
||||
URLLabel.addUrlAction(logo, URLLabel.createUri(URI));
|
||||
logo.setCursor(new Cursor(Cursor.HAND_CURSOR));
|
||||
return logo;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static ImageIcon getBundleIcon() {
|
||||
String bundle = BundleUtil.readBundleFullNameNotNull();
|
||||
String logoName;
|
||||
// these should be about 213px wide
|
||||
if (bundle.contains("proteus")) {
|
||||
logoName = LOGO_PATH + "logo_proteus.png";
|
||||
} else if (bundle.contains("honda")) {
|
||||
logoName = LOGO_PATH + "logo_tutomo.png";
|
||||
} else if (bundle.contains("alphax")) {
|
||||
logoName = LOGO_PATH + "logo_alphax.png";
|
||||
} else if (bundle.contains(".mre")) {
|
||||
logoName = LOGO_PATH + "logo_mre.png";
|
||||
} else {
|
||||
logoName = LOGO;
|
||||
}
|
||||
return AutoupdateUtil.loadIcon(logoName);
|
||||
}
|
||||
}
|
|
@ -11,6 +11,7 @@ import com.rusefi.io.ConnectionStateListener;
|
|||
import com.rusefi.io.ConnectionStatusLogic;
|
||||
import com.rusefi.io.ConnectionWatchdog;
|
||||
import com.rusefi.io.LinkManager;
|
||||
import com.rusefi.ui.LogoHelper;
|
||||
import com.rusefi.ui.UIContext;
|
||||
import com.rusefi.core.ui.FrameHelper;
|
||||
import org.putgemin.VerticalFlowLayout;
|
||||
|
@ -19,7 +20,7 @@ import javax.swing.*;
|
|||
import java.awt.*;
|
||||
|
||||
import static com.devexperts.logging.Logging.getLogging;
|
||||
import static com.rusefi.StartupFrame.createLogoLabel;
|
||||
import static com.rusefi.ui.LogoHelper.createLogoLabel;
|
||||
|
||||
public class LightweightGUI {
|
||||
private static final Logging log = getLogging(LightweightGUI.class);
|
||||
|
@ -85,7 +86,7 @@ public class LightweightGUI {
|
|||
private static JPanel createLogoUrlPanel() {
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
|
||||
panel.add(new JLabel(StartupFrame.LINK_TEXT), BorderLayout.SOUTH);
|
||||
panel.add(new JLabel(LogoHelper.LINK_TEXT), BorderLayout.SOUTH);
|
||||
JLabel logo = createLogoLabel();
|
||||
if (logo != null) {
|
||||
panel.add(logo, BorderLayout.CENTER);
|
||||
|
|
Loading…
Reference in New Issue