diff --git a/java_console/shared_ui/src/com/rusefi/ui/util/URLLabel.java b/java_console/shared_ui/src/com/rusefi/ui/util/URLLabel.java index 449652bbbe..13bf9bb5cb 100644 --- a/java_console/shared_ui/src/com/rusefi/ui/util/URLLabel.java +++ b/java_console/shared_ui/src/com/rusefi/ui/util/URLLabel.java @@ -15,6 +15,10 @@ public class URLLabel extends JLabel { setup(text, uri); } + public URLLabel(String uri) { + this(uri, uri); + } + public URLLabel(String text, String uri) { setup(text, createUri(uri)); } diff --git a/java_tools/ts_plugin/src/com/rusefi/ts_plugin/LogUplodSelector.java b/java_tools/ts_plugin/src/com/rusefi/ts_plugin/LogUplodSelector.java new file mode 100644 index 0000000000..166b0b3fea --- /dev/null +++ b/java_tools/ts_plugin/src/com/rusefi/ts_plugin/LogUplodSelector.java @@ -0,0 +1,38 @@ +package com.rusefi.ts_plugin; + +import com.rusefi.ui.util.FrameHelper; +import org.putgemin.VerticalFlowLayout; + +import javax.swing.*; +import javax.swing.filechooser.FileSystemView; +import java.io.File; + +public class LogUplodSelector { + private JPanel content = new JPanel(new VerticalFlowLayout()); + + public static void main(String[] args) { + new FrameHelper().showFrame(new LogUplodSelector().getContent()); + } + + + public LogUplodSelector() { + + // https://stackoverflow.com/questions/9677692/getting-my-documents-path-in-java + String projectName = "dev"; + String folder = FileSystemView.getFileSystemView().getDefaultDirectory().getPath() + File.separator + "TunerStudioProjects" + + File.separator + projectName + File.separator + "DataLogs"; + + + for (String fileName : new File(folder).list((dir, name) -> name.endsWith(".mlg"))) { + System.out.println(fileName); + + + } + + } + + private JComponent getContent() { + return content; + } + +} diff --git a/java_tools/ts_plugin/src/com/rusefi/ts_plugin/PluginEntry.java b/java_tools/ts_plugin/src/com/rusefi/ts_plugin/PluginEntry.java index fdbfd271c4..3e5b69ad93 100644 --- a/java_tools/ts_plugin/src/com/rusefi/ts_plugin/PluginEntry.java +++ b/java_tools/ts_plugin/src/com/rusefi/ts_plugin/PluginEntry.java @@ -10,6 +10,7 @@ import com.rusefi.tune.xml.Constant; import com.rusefi.tune.xml.Msq; import com.rusefi.ui.AuthTokenPanel; import com.rusefi.ui.storage.PersistentConfiguration; +import com.rusefi.ui.util.URLLabel; import org.putgemin.VerticalFlowLayout; import javax.swing.*; @@ -27,6 +28,7 @@ import java.util.jar.Manifest; */ public class PluginEntry implements TsPluginBody { public static final String BUILT_DATE = "Built-Date"; + public static final String REO = "https://rusefi.com/online/"; private final AuthTokenPanel tokenPanel = new AuthTokenPanel(); private final JComponent content = new JPanel(new VerticalFlowLayout()); @@ -40,7 +42,13 @@ public class PluginEntry implements TsPluginBody { tokenPanel.showError(content); return; } - Msq tune = writeCurrentTune(ControllerAccess.getInstance()); + String configurationName = getConfigurationName(); + if (configurationName == null) { + JOptionPane.showMessageDialog(content, "No project opened"); + return; + } + + Msq tune = writeCurrentTune(ControllerAccess.getInstance(), configurationName); Online.uploadTune(tune, tokenPanel, content); } }); @@ -48,6 +56,7 @@ public class PluginEntry implements TsPluginBody { content.add(upload); content.add(new JLabel(Updater.LOGO)); content.add(tokenPanel.getContent()); + content.add(new URLLabel(REO)); } @Override @@ -94,9 +103,8 @@ public class PluginEntry implements TsPluginBody { return Double.toString(scalarValue); } - private static Msq writeCurrentTune(ControllerAccess controllerAccess) { + private static Msq writeCurrentTune(ControllerAccess controllerAccess, String configurationName) { Msq msq = new Msq(); - String configurationName = getConfigurationName(); ControllerParameterServer controllerParameterServer = controllerAccess.getControllerParameterServer(); Msq tsTune = TsTuneReader.readTsTune(configurationName);