TS plugin
This commit is contained in:
parent
5fbdab17af
commit
8a362ac2f9
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue