|
@@ -26,6 +26,7 @@ import javax.swing.JComboBox;
|
|
|
import javax.swing.JFileChooser;
|
|
import javax.swing.JFileChooser;
|
|
|
import javax.swing.JFrame;
|
|
import javax.swing.JFrame;
|
|
|
import javax.swing.JLabel;
|
|
import javax.swing.JLabel;
|
|
|
|
|
+import javax.swing.JOptionPane;
|
|
|
import javax.swing.JPanel;
|
|
import javax.swing.JPanel;
|
|
|
import javax.swing.JRadioButton;
|
|
import javax.swing.JRadioButton;
|
|
|
import javax.swing.JScrollPane;
|
|
import javax.swing.JScrollPane;
|
|
@@ -42,6 +43,7 @@ public class ToolUI {
|
|
|
private final int WIDTH = 800;
|
|
private final int WIDTH = 800;
|
|
|
private final int HEIGHT = 600;
|
|
private final int HEIGHT = 600;
|
|
|
|
|
|
|
|
|
|
+ private final JFrame frame = new JFrame("VAP tool");
|
|
|
private final ButtonGroup group = new ButtonGroup();
|
|
private final ButtonGroup group = new ButtonGroup();
|
|
|
private final JRadioButton btnH265 = new JRadioButton("h265");
|
|
private final JRadioButton btnH265 = new JRadioButton("h265");
|
|
|
private final JRadioButton btnH264 = new JRadioButton("h264");
|
|
private final JRadioButton btnH264 = new JRadioButton("h264");
|
|
@@ -57,16 +59,32 @@ public class ToolUI {
|
|
|
|
|
|
|
|
private final VapxUI vapxUI = new VapxUI();
|
|
private final VapxUI vapxUI = new VapxUI();
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- public void run() {
|
|
|
|
|
|
|
+ public ToolUI() {
|
|
|
TLog.logger = new TLog.ITLog() {
|
|
TLog.logger = new TLog.ITLog() {
|
|
|
@Override
|
|
@Override
|
|
|
public void i(String tag, String msg) {
|
|
public void i(String tag, String msg) {
|
|
|
log(tag, msg);
|
|
log(tag, msg);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void e(String tag, String msg) {
|
|
|
|
|
+ log(tag, "Error:" + msg);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void w(String tag, String msg) {
|
|
|
|
|
+ log(tag, "Warning:" + msg);
|
|
|
|
|
+ }
|
|
|
};
|
|
};
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ public void run() {
|
|
|
createUI();
|
|
createUI();
|
|
|
|
|
+ loadProperties();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ private void loadProperties() {
|
|
|
try {
|
|
try {
|
|
|
File file = new File(PROPERTIES_FILE);
|
|
File file = new File(PROPERTIES_FILE);
|
|
|
if (!file.exists()) {
|
|
if (!file.exists()) {
|
|
@@ -85,11 +103,10 @@ public class ToolUI {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
- TLog.i(TAG, "ERROR -> " + e.getMessage());
|
|
|
|
|
|
|
+ TLog.e(TAG, e.getMessage());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
private void runTool() {
|
|
private void runTool() {
|
|
|
txtAreaLog.setText("");
|
|
txtAreaLog.setText("");
|
|
|
new Thread(new Runnable() {
|
|
new Thread(new Runnable() {
|
|
@@ -98,7 +115,7 @@ public class ToolUI {
|
|
|
try {
|
|
try {
|
|
|
runAnimTool();
|
|
runAnimTool();
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
- TLog.i(TAG, "ERROR -> " + e.getMessage());
|
|
|
|
|
|
|
+ TLog.e(TAG, e.getMessage());
|
|
|
btnCreate.setEnabled(true);
|
|
btnCreate.setEnabled(true);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -136,6 +153,11 @@ public class ToolUI {
|
|
|
labelOutInfo.setText((Math.min(p, 99)) + "%");
|
|
labelOutInfo.setText((Math.min(p, 99)) + "%");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onWarning(String msg) {
|
|
|
|
|
+ JOptionPane.showMessageDialog(frame, msg, "Warning", JOptionPane.WARNING_MESSAGE);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public void onError() {
|
|
public void onError() {
|
|
|
btnCreate.setEnabled(true);
|
|
btnCreate.setEnabled(true);
|
|
@@ -149,7 +171,7 @@ public class ToolUI {
|
|
|
setProperties(commonArg);
|
|
setProperties(commonArg);
|
|
|
Desktop.getDesktop().open(new File(commonArg.outputPath));
|
|
Desktop.getDesktop().open(new File(commonArg.outputPath));
|
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
|
- TLog.i(TAG, "ERROR -> " + e.getMessage());
|
|
|
|
|
|
|
+ TLog.e(TAG, e.getMessage());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
@@ -159,7 +181,6 @@ public class ToolUI {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void createUI() {
|
|
private void createUI() {
|
|
|
- JFrame frame = new JFrame("VAP tool");
|
|
|
|
|
frame.setSize(WIDTH, HEIGHT);
|
|
frame.setSize(WIDTH, HEIGHT);
|
|
|
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
|
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
|
|
|
|
|
|
@@ -281,7 +302,7 @@ public class ToolUI {
|
|
|
try {
|
|
try {
|
|
|
Desktop.getDesktop().open(new File(path));
|
|
Desktop.getDesktop().open(new File(path));
|
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
|
- TLog.i(TAG, "ERROR -> " + e.getMessage());
|
|
|
|
|
|
|
+ TLog.e(TAG, e.getMessage());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
@@ -361,7 +382,7 @@ public class ToolUI {
|
|
|
commonArg.enableH265 = Boolean.TRUE.toString().equals(enableH265);
|
|
commonArg.enableH265 = Boolean.TRUE.toString().equals(enableH265);
|
|
|
commonArg.inputPath = inputPath;
|
|
commonArg.inputPath = inputPath;
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
- TLog.i(TAG, "getProperties error:" + e.getMessage());
|
|
|
|
|
|
|
+ TLog.e(TAG, "getProperties error:" + e.getMessage());
|
|
|
}
|
|
}
|
|
|
return commonArg;
|
|
return commonArg;
|
|
|
}
|
|
}
|