From 9cd540f358ee8057df7aea78a6d2e53230a1a6e1 Mon Sep 17 00:00:00 2001 From: "Christian F." Date: Fri, 1 Nov 2024 10:01:27 +0100 Subject: [PATCH] - subtitle dialog code refactor --- .../subripmerge/MergeSubripVideoDialog.java | 20 +++++++++++++++++-- .../subripmerge/MergeSubripVideoDialog.jfd | 2 ++ 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/main/java/mediathek/gui/dialog/subripmerge/MergeSubripVideoDialog.java b/src/main/java/mediathek/gui/dialog/subripmerge/MergeSubripVideoDialog.java index 7440e0cdd..98b7ee279 100644 --- a/src/main/java/mediathek/gui/dialog/subripmerge/MergeSubripVideoDialog.java +++ b/src/main/java/mediathek/gui/dialog/subripmerge/MergeSubripVideoDialog.java @@ -56,6 +56,7 @@ public MergeSubripVideoDialog(Window owner) { btnMerge.setEnabled(false); fillLanguageComboBox(); + cbLanguage.setSelectedItem(getLanguageText(LanguageCode.de)); btnCancel.addActionListener(_ -> dispose()); @@ -79,6 +80,9 @@ public MergeSubripVideoDialog(Window owner) { if (file != null) { tfVideoFilePath.setText(file.getAbsolutePath()); } + else { + tfVideoFilePath.setText(""); + } }); btnSelectVideoOutputPath.addActionListener(_ -> { @@ -86,6 +90,9 @@ public MergeSubripVideoDialog(Window owner) { if (file != null) { tfVideoOutputPath.setText(file.getAbsolutePath()); } + else { + tfVideoOutputPath.setText(""); + } }); btnMerge.addActionListener(_ -> { @@ -176,11 +183,14 @@ private void shutdownMergeProcess() { btnCancel.setEnabled(true); } + private String getLanguageText(LanguageCode code) { + return String.format("%s [%s]", code.nativeName(), code.getISO3Language()); + } + public void fillLanguageComboBox() { List languages = new ArrayList<>(); for (var item : LanguageCode.values()) { - var entry = String.format("%s [%s]", item.nativeName(), item.getISO3Language()); - languages.add(entry); + languages.add(getLanguageText(item)); } cbLanguage.setModel(new DefaultComboBoxModel<>(languages.toArray(new String[0]))); } @@ -225,6 +235,9 @@ private void initComponents() { label1.setText("Untertitel-Datei:"); //NON-NLS label1.setHorizontalAlignment(SwingConstants.RIGHT); + //---- tfSubripFilePath ---- + tfSubripFilePath.setToolTipText("Pfad zur Untertiteldatei im Subrip Text Format (.srt)"); //NON-NLS + //---- btnSelectInputSubrip ---- btnSelectInputSubrip.setText("..."); //NON-NLS @@ -232,6 +245,9 @@ private void initComponents() { label2.setText("Video-Datei:"); //NON-NLS label2.setHorizontalAlignment(SwingConstants.RIGHT); + //---- tfVideoFilePath ---- + tfVideoFilePath.setToolTipText("Pfad zu einer von ffmpeg unterst\u00fctzten Videodatei als Eingabemedium"); //NON-NLS + //---- btnSelectInputVideo ---- btnSelectInputVideo.setText("..."); //NON-NLS diff --git a/src/main/java/mediathek/gui/dialog/subripmerge/MergeSubripVideoDialog.jfd b/src/main/java/mediathek/gui/dialog/subripmerge/MergeSubripVideoDialog.jfd index 4b6e0cb73..d8167f788 100644 --- a/src/main/java/mediathek/gui/dialog/subripmerge/MergeSubripVideoDialog.jfd +++ b/src/main/java/mediathek/gui/dialog/subripmerge/MergeSubripVideoDialog.jfd @@ -32,6 +32,7 @@ new FormModel { } ) add( new FormComponent( "javax.swing.JTextField" ) { name: "tfSubripFilePath" + "toolTipText": "Pfad zur Untertiteldatei im Subrip Text Format (.srt)" } ) add( new FormComponent( "javax.swing.JButton" ) { name: "btnSelectInputSubrip" @@ -47,6 +48,7 @@ new FormModel { } ) add( new FormComponent( "javax.swing.JTextField" ) { name: "tfVideoFilePath" + "toolTipText": "Pfad zu einer von ffmpeg unterstützten Videodatei als Eingabemedium" } ) add( new FormComponent( "javax.swing.JButton" ) { name: "btnSelectInputVideo"