|
1 | 1 | package de.shadowdara.videoconverter |
2 | 2 |
|
| 3 | +import de.shadowdara.daras_library.io.BrowserOpener.openFileInBrowser |
| 4 | +import de.shadowdara.daras_library.io.getCallerJarDirectory |
| 5 | +import de.shadowdara.daras_library.io.getJarDirectory |
3 | 6 | import java.awt.BorderLayout |
4 | 7 | import java.awt.Component |
5 | 8 | import java.awt.Dimension |
| 9 | +import java.io.File |
6 | 10 | import javax.swing.BorderFactory |
7 | 11 | import javax.swing.Box |
8 | 12 | import javax.swing.BoxLayout |
@@ -33,6 +37,54 @@ fun createUI(profileNames: Array<String>, config: Config) { |
33 | 37 | var selectedFiles: List<String> = emptyList() |
34 | 38 | var selectedExportFolder: String = "" |
35 | 39 |
|
| 40 | + // Info Button |
| 41 | + val openInfoButton = JButton("Open Profile Info") |
| 42 | + openInfoButton.alignmentX = Component.LEFT_ALIGNMENT |
| 43 | + |
| 44 | + openInfoButton.addActionListener { |
| 45 | + // Neues Fenster mit mehreren Buttons öffnen |
| 46 | + val infoFrame = JFrame("Info Window").apply { |
| 47 | + defaultCloseOperation = JFrame.DISPOSE_ON_CLOSE |
| 48 | + setSize(300, 300) |
| 49 | + setLocationRelativeTo(frame) |
| 50 | + } |
| 51 | + |
| 52 | + val panel = JPanel() |
| 53 | + panel.layout = BoxLayout(panel, BoxLayout.Y_AXIS) |
| 54 | + |
| 55 | + val button1 = JButton("Profile Info DE") |
| 56 | + val button2 = JButton("Profile Info EN") |
| 57 | + |
| 58 | + button1.addActionListener { |
| 59 | + extractInfo() |
| 60 | + |
| 61 | + val basePath: String = getCallerJarDirectory().toString() |
| 62 | + val relativePath: String = "profile-info/de.html" |
| 63 | + |
| 64 | + // Variante mit File → .path |
| 65 | + val filePath = File(basePath, relativePath).path |
| 66 | + openFileInBrowser(filePath) |
| 67 | + } |
| 68 | + |
| 69 | + button2.addActionListener { |
| 70 | + extractInfo() |
| 71 | + |
| 72 | + val basePath: String = getCallerJarDirectory().toString() |
| 73 | + val relativePath: String = "profile-info/en.html" |
| 74 | + |
| 75 | + // Variante mit File → .path |
| 76 | + val filePath = File(basePath, relativePath).path |
| 77 | + openFileInBrowser(filePath) |
| 78 | + } |
| 79 | + |
| 80 | + // Buttons zum Panel hinzufügen |
| 81 | + panel.add(button1) |
| 82 | + panel.add(button2) |
| 83 | + |
| 84 | + infoFrame.contentPane.add(panel) |
| 85 | + infoFrame.isVisible = true |
| 86 | + } |
| 87 | + |
36 | 88 | // Choose Files Button |
37 | 89 | val chooseFileButton = JButton("Choose Files") |
38 | 90 | chooseFileButton.alignmentX = Component.LEFT_ALIGNMENT |
@@ -125,6 +177,7 @@ fun createUI(profileNames: Array<String>, config: Config) { |
125 | 177 |
|
126 | 178 | // UI zusammenbauen |
127 | 179 | mainPanel.add(title) |
| 180 | + mainPanel.add(openInfoButton) |
128 | 181 | mainPanel.add(chooseFileButton) |
129 | 182 | mainPanel.add(chosenFilesLabel) |
130 | 183 | mainPanel.add(chooseExportFolderButton) |
|
0 commit comments