From 23c1243dbf744dca449f21509a3951201d5b4d0f Mon Sep 17 00:00:00 2001 From: rusefi Date: Sun, 14 Jul 2019 11:09:51 -0400 Subject: [PATCH] hiding weird panes --- java_console/ui/src/com/rusefi/Launcher.java | 19 ++++++++++++------- .../ui/src/com/rusefi/PaneSettings.java | 18 ++++++++++++++++++ .../ui/src/com/rusefi/StimulationInputs.java | 3 +-- .../ui/src/com/rusefi/ui/GaugesPanel.java | 3 ++- 4 files changed, 33 insertions(+), 10 deletions(-) create mode 100644 java_console/ui/src/com/rusefi/PaneSettings.java diff --git a/java_console/ui/src/com/rusefi/Launcher.java b/java_console/ui/src/com/rusefi/Launcher.java index a77a67db6a..04efe7b225 100644 --- a/java_console/ui/src/com/rusefi/Launcher.java +++ b/java_console/ui/src/com/rusefi/Launcher.java @@ -47,7 +47,6 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig; */ public class Launcher { public static final int CONSOLE_VERSION = 20190714; - public static final boolean SHOW_STIMULATOR = false; public static final String INPUT_FILES_PATH = ".."; private static final String TAB_INDEX = "main_tab"; protected static final String PORT_KEY = "port"; @@ -98,6 +97,7 @@ public class Launcher { private final SettingsTab settingsTab = new SettingsTab(); private final LogDownloader logsManager = new LogDownloader(); private final FuelTunePane fuelTunePane; + private final PaneSettings paneSettings; /** * @see StartupFrame @@ -141,6 +141,8 @@ public class Launcher { } }); + paneSettings = new PaneSettings(getConfig().getRoot().getChild("panes")); + engineSnifferPanel = new EngineSnifferPanel(getConfig().getRoot().getChild("digital_sniffer")); if (!LinkManager.isLogViewerMode(port)) engineSnifferPanel.setOutpinListener(LinkManager.engineState); @@ -154,7 +156,7 @@ public class Launcher { GaugesPanel.DetachedRepository.INSTANCE.init(getConfig().getRoot().getChild("detached")); GaugesPanel.DetachedRepository.INSTANCE.load(); if (!LinkManager.isLogViewer()) - tabbedPane.addTab("Gauges", new GaugesPanel(getConfig().getRoot().getChild("gauges")).getContent()); + tabbedPane.addTab("Gauges", new GaugesPanel(getConfig().getRoot().getChild("gauges"), paneSettings).getContent()); if (!LinkManager.isLogViewer()) { MessagesPane messagesPane = new MessagesPane(getConfig().getRoot().getChild("messages")); @@ -162,7 +164,8 @@ public class Launcher { } if (!LinkManager.isLogViewer()) { tabbedPane.add("Bench Test", new BenchTestPane().getContent()); - tabbedPane.add("ETB", new ETBPane().getContent()); + if (paneSettings.showEtbPane) + tabbedPane.add("ETB", new ETBPane().getContent()); tabbedPane.add("Presets", new PresetsPane().getContent()); } @@ -176,7 +179,7 @@ public class Launcher { // tabbedPane.addTab("LE controls", new FlexibleControls().getPanel()); // tabbedPane.addTab("ADC", new AdcPanel(new BooleanInputsModel()).createAdcPanel()); - if (SHOW_STIMULATOR && !LinkManager.isSimulationMode && !LinkManager.isLogViewerMode(port)) { + if (paneSettings.showStimulatorPane && !LinkManager.isSimulationMode && !LinkManager.isLogViewerMode(port)) { // todo: rethink this UI? special command line key to enable it? EcuStimulator stimulator = EcuStimulator.getInstance(); tabbedPane.add("ECU stimulation", stimulator.getPanel()); @@ -193,12 +196,14 @@ public class Launcher { if (!LinkManager.isLogViewer() && false) // todo: fix it & better name? tabbedPane.add("Logs Manager", logsManager.getContent()); fuelTunePane = new FuelTunePane(getConfig().getRoot().getChild("fueltune")); - if (true) + if (paneSettings.showFuelTunePane) tabbedPane.add("Fuel Tune", fuelTunePane.getContent()); - if (!LinkManager.isLogViewer()) - tabbedPane.add("Trigger Shape", new AverageAnglePanel().getPanel()); + if (!LinkManager.isLogViewer()) { + if (paneSettings.showTriggerShapePane) + tabbedPane.add("Trigger Shape", new AverageAnglePanel().getPanel()); + } if (!LinkManager.isLogViewerMode(port)) { int selectedIndex = getConfig().getRoot().getIntProperty(TAB_INDEX, 2); diff --git a/java_console/ui/src/com/rusefi/PaneSettings.java b/java_console/ui/src/com/rusefi/PaneSettings.java new file mode 100644 index 0000000000..38414d9c12 --- /dev/null +++ b/java_console/ui/src/com/rusefi/PaneSettings.java @@ -0,0 +1,18 @@ +package com.rusefi; + +import com.rusefi.ui.storage.Node; + +public class PaneSettings { + private static final String SHOW_ETB = "show_etb_pane"; + private static final String SHOW_FUEL_TUNE = "show_fuel_tune_pane"; + public boolean showEtbPane; + public boolean showFuelTunePane; + public boolean showTriggerShapePane; + public boolean showStimulatorPane; + + + public PaneSettings(Node config) { + showEtbPane = config.getBoolProperty(SHOW_ETB, false); + showFuelTunePane = config.getBoolProperty(SHOW_FUEL_TUNE, false); + } +} diff --git a/java_console/ui/src/com/rusefi/StimulationInputs.java b/java_console/ui/src/com/rusefi/StimulationInputs.java index 64fd97f2da..291800bc5b 100644 --- a/java_console/ui/src/com/rusefi/StimulationInputs.java +++ b/java_console/ui/src/com/rusefi/StimulationInputs.java @@ -39,8 +39,7 @@ public class StimulationInputs { content.add(UiUtils.wrap(elResistance2)); JButton button = ecuStimulator.createButton(); - if (Launcher.SHOW_STIMULATOR) - content.add(UiUtils.wrap(button)); + content.add(UiUtils.wrap(button)); } public double getEngineLoadMin() { diff --git a/java_console/ui/src/com/rusefi/ui/GaugesPanel.java b/java_console/ui/src/com/rusefi/ui/GaugesPanel.java index aab44c315e..61adf3cb8a 100644 --- a/java_console/ui/src/com/rusefi/ui/GaugesPanel.java +++ b/java_console/ui/src/com/rusefi/ui/GaugesPanel.java @@ -1,6 +1,7 @@ package com.rusefi.ui; import com.rusefi.FileLog; +import com.rusefi.PaneSettings; import com.rusefi.core.Sensor; import com.rusefi.ui.storage.Node; import com.rusefi.ui.util.UiUtils; @@ -74,7 +75,7 @@ public class GaugesPanel { private final JPanel messagesPanel = new JPanel(new BorderLayout()); private final JSplitPane middleSplitPanel; - public GaugesPanel(final Node config) { + public GaugesPanel(final Node config, PaneSettings paneSettings) { gauges = new GaugesGrid(3, 5); this.config = config; showRpmPanel = config.getBoolProperty(SHOW_RPM, true);