too much usability? Show Device Manager icon
This commit is contained in:
parent
464f5f698d
commit
b24b1b4619
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
|
@ -46,7 +46,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
|
||||||
* @see EngineSnifferPanel
|
* @see EngineSnifferPanel
|
||||||
*/
|
*/
|
||||||
public class Launcher {
|
public class Launcher {
|
||||||
public static final int CONSOLE_VERSION = 20190713;
|
public static final int CONSOLE_VERSION = 20190714;
|
||||||
public static final boolean SHOW_STIMULATOR = false;
|
public static final boolean SHOW_STIMULATOR = false;
|
||||||
public static final String INPUT_FILES_PATH = "..";
|
public static final String INPUT_FILES_PATH = "..";
|
||||||
private static final String TAB_INDEX = "main_tab";
|
private static final String TAB_INDEX = "main_tab";
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.rusefi.io.serial.PortHolder;
|
||||||
import com.rusefi.io.tcp.TcpConnector;
|
import com.rusefi.io.tcp.TcpConnector;
|
||||||
import com.rusefi.maintenance.DriverInstall;
|
import com.rusefi.maintenance.DriverInstall;
|
||||||
import com.rusefi.maintenance.EraseChip;
|
import com.rusefi.maintenance.EraseChip;
|
||||||
|
import com.rusefi.maintenance.ExecHelper;
|
||||||
import com.rusefi.maintenance.FirmwareFlasher;
|
import com.rusefi.maintenance.FirmwareFlasher;
|
||||||
import com.rusefi.ui.util.HorizontalLine;
|
import com.rusefi.ui.util.HorizontalLine;
|
||||||
import com.rusefi.ui.util.URLLabel;
|
import com.rusefi.ui.util.URLLabel;
|
||||||
|
@ -21,6 +22,7 @@ import java.awt.event.ActionListener;
|
||||||
import java.awt.event.WindowAdapter;
|
import java.awt.event.WindowAdapter;
|
||||||
import java.awt.event.WindowEvent;
|
import java.awt.event.WindowEvent;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -32,8 +34,8 @@ import static com.rusefi.ui.util.UiUtils.setToolTip;
|
||||||
* This frame is used on startup to select the port we would be using
|
* This frame is used on startup to select the port we would be using
|
||||||
*
|
*
|
||||||
* @author Andrey Belomutskiy
|
* @author Andrey Belomutskiy
|
||||||
* <p/>
|
* <p/>
|
||||||
* 2/14/14
|
* 2/14/14
|
||||||
* @see SimulatorHelper
|
* @see SimulatorHelper
|
||||||
* @see FirmwareFlasher
|
* @see FirmwareFlasher
|
||||||
*/
|
*/
|
||||||
|
@ -106,6 +108,7 @@ public class StartupFrame {
|
||||||
connectPanel.add(comboSpeeds);
|
connectPanel.add(comboSpeeds);
|
||||||
|
|
||||||
final JButton connect = new JButton("Connect");
|
final JButton connect = new JButton("Connect");
|
||||||
|
connect.setBackground(new Color(0xff7d03)); // custom orange
|
||||||
setToolTip(connect, "Connect to real hardware");
|
setToolTip(connect, "Connect to real hardware");
|
||||||
connectPanel.add(connect);
|
connectPanel.add(connect);
|
||||||
connect.addActionListener(new ActionListener() {
|
connect.addActionListener(new ActionListener() {
|
||||||
|
@ -120,8 +123,12 @@ public class StartupFrame {
|
||||||
leftPanel.add(realHardwarePanel);
|
leftPanel.add(realHardwarePanel);
|
||||||
leftPanel.add(miscPanel);
|
leftPanel.add(miscPanel);
|
||||||
|
|
||||||
if (FileLog.isWindows())
|
if (FileLog.isWindows()) {
|
||||||
realHardwarePanel.add(DriverInstall.createButton());
|
JPanel topButtons = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 0));
|
||||||
|
topButtons.add(createShowDeviceManagerButton());
|
||||||
|
topButtons.add(DriverInstall.createButton());
|
||||||
|
realHardwarePanel.add(topButtons);
|
||||||
|
}
|
||||||
realHardwarePanel.add(connectPanel);
|
realHardwarePanel.add(connectPanel);
|
||||||
realHardwarePanel.add(noPortsMessage);
|
realHardwarePanel.add(noPortsMessage);
|
||||||
installMessage(noPortsMessage, "Check you cables. Check your drivers. Do you want to start simulator maybe?");
|
installMessage(noPortsMessage, "Check you cables. Check your drivers. Do you want to start simulator maybe?");
|
||||||
|
@ -177,6 +184,20 @@ public class StartupFrame {
|
||||||
UiUtils.centerWindow(frame);
|
UiUtils.centerWindow(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Component createShowDeviceManagerButton() {
|
||||||
|
JButton showDeviceManager = new JButton(UiUtils.loadIcon("DeviceManager.png"));
|
||||||
|
showDeviceManager.setMargin(new Insets(0, 0, 0, 0));
|
||||||
|
showDeviceManager.setToolTipText("Show Device Manager");
|
||||||
|
showDeviceManager.addActionListener(event -> {
|
||||||
|
try {
|
||||||
|
Runtime.getRuntime().exec(ExecHelper.getBatchCommand("devmgmt.msc"));
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new IllegalStateException(ex);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return showDeviceManager;
|
||||||
|
}
|
||||||
|
|
||||||
private void installMessage(JComponent component, String s) {
|
private void installMessage(JComponent component, String s) {
|
||||||
component.setToolTipText(s);
|
component.setToolTipText(s);
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ public class DriverInstall {
|
||||||
wnd);
|
wnd);
|
||||||
|
|
||||||
String batch = isWindows7orBelow() ? WINDOWS7_BATCH : WINDOWS8_BATCH;
|
String batch = isWindows7orBelow() ? WINDOWS7_BATCH : WINDOWS8_BATCH;
|
||||||
ExecHelper.executeCommand(UNPACKED_FOLDER, "cmd /c start " + batch, batch, wnd);
|
ExecHelper.executeCommand(UNPACKED_FOLDER, ExecHelper.getBatchCommand(batch), batch, wnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isWindows7orBelow() {
|
private static boolean isWindows7orBelow() {
|
||||||
|
|
|
@ -73,4 +73,9 @@ public class ExecHelper {
|
||||||
thread.setDaemon(true);
|
thread.setDaemon(true);
|
||||||
thread.start();
|
thread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public static String getBatchCommand(String batch) {
|
||||||
|
return "cmd /c start " + batch;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue