Skip to content

Commit a0506b5

Browse files
committed
- move filter management buttons into split menu button
1 parent 05c7dbd commit a0506b5

File tree

5 files changed

+71
-77
lines changed

5 files changed

+71
-77
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- **BUGFIX:** Filterdialog im Dark Mode ändert nicht mehr die Größe.
1212
- **BUGFIX:** Das Erzeugen von (leeren) Infodateien für Livestreams über das Kontextmenü ist nun nicht mehr möglich.
1313
- **BUGFIX:** Die Online-Suche nach Thema ist nun für Livestreams deaktiviert.
14+
- **BUGFIX:** *Aktuellen Filter zurücksetzen* fragt nun zur Sicherheit ab ob man auch wirklich zurücksetzen möchte.
1415
- **FEATURE (macOS/Windows/Linux GNOME):** Auf unterstützten Systemen nimmt MV nun das aktuelle Erscheinungsbild des Betriebssystem an, wenn es unter *Einstellungen/Allgemein/Erscheinungsbild des Betriebssystem verwenden* konfiguriert wurde.
1516
- **FEATURE:** Lokale Filmduplikate können nach Anwahl eines Ursprungsfilmes über das Kontextmenü *"Duplikate entfernen..."* gesucht und permanent aus der Liste entfernt werden. *WICHTIG:* Etwaige Duplikat-Markierungen bleiben bis zum Neustart ggf. erhalten da keine listenweite Duplikaterkennung nach einer Löschung gestartet wird.
1617
- **FEATURE:** Thema und Sender werden nun in den Filtern gespeichert. Vielen Dank an @MarkusJannek
@@ -21,6 +22,7 @@
2122
- **FEATURE:** Die Senderliste kann über das Kontextmenü vertikal umgebrochen werden, um mehr Informationen darzustellen. Die Einstellung wird gespeichert und bei jedem Start wiederhergestellt.
2223
- **FEATURE:** Filter können bei der Neuanlage direkt mit einem Namen versehen werden.
2324
- **FEATURE:** Thema-ComboBox kann entweder über den Mülleimer-Button zurückgesetzt werden oder über das Kontextmenü
25+
- **FEATURE:** Die verschiedenen Buttons zur Filterverwaltung wurden nun in einem Menübutton zusammengeführt um den Platzbedarf zu reduzieren.
2426

2527
# **14.2.0**
2628
- **(macOS):** Dies ist die letzte Version, die mit macOS 10.15 Catalina lauffähig ist. Zukünftig wird mindestens macOS 11 vorausgesetzt.

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
<commons-io.version>2.11.0</commons-io.version>
108108
<commons-lang3.version>3.17.0</commons-lang3.version>
109109
<controlsfx.version>11.2.2</controlsfx.version>
110-
<flatlaf.version>3.5.4</flatlaf.version>
110+
<flatlaf.version>3.6</flatlaf.version>
111111
<glazedlists.version>1.11.0</glazedlists.version>
112112
<guava.version>33.4.8-jre</guava.version>
113113
<icu4j.version>76.1</icu4j.version>

src/main/java/mediathek/gui/tabs/tab_film/filter/SwingFilterDialog.java

Lines changed: 59 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import ca.odell.glazedlists.FilterList;
2828
import ca.odell.glazedlists.swing.GlazedListsSwing;
2929
import com.jidesoft.swing.CheckBoxList;
30+
import com.jidesoft.swing.JideSplitButton;
3031
import mediathek.config.Daten;
3132
import mediathek.config.Konstanten;
3233
import mediathek.controller.SenderFilmlistLoadApprover;
@@ -78,6 +79,10 @@ public class SwingFilterDialog extends JDialog {
7879
* The "base" thema list
7980
*/
8081
private final EventList<String> sourceThemaList = new BasicEventList<>();
82+
private final RenameFilterAction renameFilterAction = new RenameFilterAction();
83+
private final DeleteCurrentFilterAction deleteCurrentFilterAction = new DeleteCurrentFilterAction();
84+
private final AddNewFilterAction addNewFilterAction = new AddNewFilterAction();
85+
private final ResetCurrentFilterAction resetCurrentFilterAction = new ResetCurrentFilterAction();
8186

8287
public SwingFilterDialog(@NotNull Window owner, @NotNull FilterSelectionComboBoxModel model,
8388
@NotNull JToggleButton filterToggleButton,
@@ -89,6 +94,9 @@ public SwingFilterDialog(@NotNull Window owner, @NotNull FilterSelectionComboBox
8994

9095
initComponents();
9196

97+
btnSplit.setIcon(SVGIconUtilities.createSVGIcon("icons/fontawesome/ellipsis-vertical.svg"));
98+
populateSplitButton();
99+
92100
ToggleVisibilityKeyHandler handler = new ToggleVisibilityKeyHandler(this);
93101
handler.installHandler(filterToggleButton.getAction());
94102

@@ -110,11 +118,16 @@ public SwingFilterDialog(@NotNull Window owner, @NotNull FilterSelectionComboBox
110118
Daten.getInstance().getFilmeLaden().addAdListener(new FilmeLadenListener());
111119
}
112120

121+
private void populateSplitButton() {
122+
btnSplit.add(renameFilterAction);
123+
btnSplit.add(addNewFilterAction);
124+
btnSplit.add(deleteCurrentFilterAction);
125+
btnSplit.addSeparator();
126+
btnSplit.add(resetCurrentFilterAction);
127+
}
128+
113129
private void setupButtons() {
114-
btnRenameFilter.setAction(new RenameFilterAction());
115-
setupDeleteCurrentFilterButton();
116-
setupResetCurrentFilterButton();
117-
btnAddNewFilter.setAction(new AddNewFilterAction());
130+
checkDeleteCurrentFilterButtonState();
118131
btnResetThema.setAction(new ResetThemaAction());
119132
}
120133

@@ -262,7 +275,7 @@ private void setupZeitraumSpinner() {
262275
}
263276

264277
private void checkDeleteCurrentFilterButtonState() {
265-
btnDeleteCurrentFilter.setEnabled(filterConfig.getAvailableFilterCount() > 1);
278+
deleteCurrentFilterAction.setEnabled(filterConfig.getAvailableFilterCount() > 1);
266279
}
267280

268281
private void restoreConfigSettings() {
@@ -285,25 +298,14 @@ private void restoreConfigSettings() {
285298
spZeitraum.restoreFilterConfig(filterConfig);
286299
}
287300

288-
private void setupResetCurrentFilterButton() {
289-
btnResetCurrentFilter.setIcon(SVGIconUtilities.createSVGIcon("icons/fontawesome/recycle.svg"));
290-
btnResetCurrentFilter.addActionListener(e -> {
291-
filterConfig.clearCurrentFilter();
292-
restoreConfigSettings();
293-
});
294-
}
295-
296-
private void setupDeleteCurrentFilterButton() {
297-
checkDeleteCurrentFilterButtonState();
298-
btnDeleteCurrentFilter.setAction(new DeleteCurrentFilterAction());
299-
}
300-
301301
private void enableControls(boolean enable) {
302302
cboxFilterSelection.setEnabled(enable);
303303

304-
btnRenameFilter.setEnabled(enable);
305-
btnAddNewFilter.setEnabled(enable);
306-
btnResetCurrentFilter.setEnabled(enable);
304+
btnSplit.setEnabled(enable);
305+
renameFilterAction.setEnabled(enable);
306+
addNewFilterAction.setEnabled(enable);
307+
resetCurrentFilterAction.setEnabled(enable);
308+
307309
btnResetThema.setEnabled(enable);
308310

309311
cbShowNewOnly.setEnabled(enable);
@@ -349,7 +351,7 @@ private void handleTableModelChangeEvent(TableModelChangeEvent e) {
349351
enableControls(enable);
350352

351353
if (e.active) {
352-
btnDeleteCurrentFilter.setEnabled(false);
354+
deleteCurrentFilterAction.setEnabled(false);
353355
} else {
354356
checkDeleteCurrentFilterButtonState();
355357
}
@@ -397,6 +399,25 @@ public void installHandler(Action action) {
397399
}
398400
}
399401

402+
private class ResetCurrentFilterAction extends AbstractAction {
403+
public ResetCurrentFilterAction() {
404+
putValue(Action.SMALL_ICON, SVGIconUtilities.createSVGIcon("icons/fontawesome/recycle.svg"));
405+
putValue(Action.SHORT_DESCRIPTION, "Aktuellen Filter zurücksetzen");
406+
putValue(Action.NAME, "Aktuellen Filter zurücksetzen"+"...");
407+
}
408+
409+
@Override
410+
public void actionPerformed(ActionEvent e) {
411+
var result = JOptionPane.showConfirmDialog(MediathekGui.ui(),
412+
"Sind Sie sicher dass Sie den Filter zurücksetzen möchten?", "Filter zurücksetzen",
413+
JOptionPane.YES_NO_OPTION);
414+
if (result == JOptionPane.YES_OPTION) {
415+
filterConfig.clearCurrentFilter();
416+
restoreConfigSettings();
417+
}
418+
}
419+
}
420+
400421
private class SenderCheckBoxList extends CheckBoxList {
401422
private static final String CONFIG_SENDERLIST_VERTICAL_WRAP = "senderlist.vertical_wrap";
402423
private final JCheckBoxMenuItem miVerticalWrap = new JCheckBoxMenuItem("Senderliste vertikal umbrechen", false);
@@ -489,6 +510,7 @@ private class AddNewFilterAction extends AbstractAction {
489510
public AddNewFilterAction() {
490511
putValue(Action.SMALL_ICON, SVGIconUtilities.createSVGIcon("icons/fontawesome/plus.svg"));
491512
putValue(Action.SHORT_DESCRIPTION, STR_ACTION_NAME);
513+
putValue(Action.NAME, STR_ACTION_NAME + "...");
492514
}
493515

494516
@Override
@@ -512,9 +534,12 @@ public void actionPerformed(ActionEvent e) {
512534
}
513535

514536
private class DeleteCurrentFilterAction extends AbstractAction {
537+
private static final String STR_DELETE_CURRENT_FILTER = "Aktuellen Filter löschen";
538+
515539
public DeleteCurrentFilterAction() {
516540
putValue(Action.SMALL_ICON, SVGIconUtilities.createSVGIcon("icons/fontawesome/trash-can.svg"));
517-
putValue(Action.SHORT_DESCRIPTION, "Aktuellen Filter löschen");
541+
putValue(Action.SHORT_DESCRIPTION, STR_DELETE_CURRENT_FILTER);
542+
putValue(Action.NAME, STR_DELETE_CURRENT_FILTER+"...");
518543
}
519544

520545
@Override
@@ -552,9 +577,12 @@ public ResetThemaButtonAction() {
552577
}
553578

554579
private class RenameFilterAction extends AbstractAction {
580+
private static final String STR_RENAME_FILTER = "Filter umbenennen";
581+
555582
public RenameFilterAction() {
556583
putValue(Action.SMALL_ICON, SVGIconUtilities.createSVGIcon("icons/fontawesome/pen-to-square.svg"));
557-
putValue(Action.SHORT_DESCRIPTION, "Filter umbenennen");
584+
putValue(Action.SHORT_DESCRIPTION, STR_RENAME_FILTER);
585+
putValue(Action.NAME, STR_RENAME_FILTER + "...");
558586
}
559587

560588
@Override
@@ -676,11 +704,7 @@ private void initComponents() {
676704
createUIComponents();
677705

678706
var pnlFilterCommon = new JPanel();
679-
btnRenameFilter = new JButton();
680-
btnAddNewFilter = new JButton();
681-
btnDeleteCurrentFilter = new JButton();
682-
var separator1 = new JSeparator();
683-
btnResetCurrentFilter = new JButton();
707+
btnSplit = new JideSplitButton();
684708
var separator2 = new JSeparator();
685709
var pnlShowOnly = new JPanel();
686710
cbShowNewOnly = new JCheckBox();
@@ -752,10 +776,6 @@ private void initComponents() {
752776
// columns
753777
new AC()
754778
.grow().fill().gap()
755-
.fill().gap()
756-
.fill().gap()
757-
.align("left").gap() //NON-NLS
758-
.fill().gap()
759779
.fill(),
760780
// rows
761781
new AC()
@@ -766,17 +786,12 @@ private void initComponents() {
766786
cboxFilterSelection.setPreferredSize(null);
767787
cboxFilterSelection.setMinimumSize(new Dimension(50, 10));
768788
pnlFilterCommon.add(cboxFilterSelection, new CC().cell(0, 0));
769-
pnlFilterCommon.add(btnRenameFilter, new CC().cell(1, 0).alignX("center").growX(0)); //NON-NLS
770-
pnlFilterCommon.add(btnAddNewFilter, new CC().cell(2, 0).alignX("center").growX(0)); //NON-NLS
771-
pnlFilterCommon.add(btnDeleteCurrentFilter, new CC().cell(3, 0).alignX("center").growX(0)); //NON-NLS
772789

773-
//---- separator1 ----
774-
separator1.setOrientation(SwingConstants.VERTICAL);
775-
pnlFilterCommon.add(separator1, new CC().cell(4, 0));
776-
777-
//---- btnResetCurrentFilter ----
778-
btnResetCurrentFilter.setToolTipText("Aktuellen Filter zur\u00fccksetzen"); //NON-NLS
779-
pnlFilterCommon.add(btnResetCurrentFilter, new CC().cell(5, 0).alignX("center").growX(0)); //NON-NLS
790+
//======== btnSplit ========
791+
{
792+
btnSplit.setAlwaysDropdown(true);
793+
}
794+
pnlFilterCommon.add(btnSplit, new CC().cell(1, 0));
780795
}
781796
contentPane.add(pnlFilterCommon, new CC().cell(0, 0).growX());
782797
contentPane.add(separator2, new CC().cell(0, 1).growX());
@@ -968,10 +983,7 @@ private void initComponents() {
968983
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables @formatter:off
969984
// Generated using JFormDesigner non-commercial license
970985
private FilterSelectionComboBox cboxFilterSelection;
971-
private JButton btnRenameFilter;
972-
private JButton btnAddNewFilter;
973-
private JButton btnDeleteCurrentFilter;
974-
private JButton btnResetCurrentFilter;
986+
private JideSplitButton btnSplit;
975987
private JCheckBox cbShowNewOnly;
976988
private JCheckBox cbShowBookMarkedOnly;
977989
private JCheckBox cbShowOnlyHq;

src/main/java/mediathek/gui/tabs/tab_film/filter/SwingFilterDialog.jfd

Lines changed: 5 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ new FormModel {
1313
"title": "Filter"
1414
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
1515
"$layoutConstraints": "fillx,insets 0,hidemode 3"
16-
"$columnConstraints": "[grow,fill][fill][fill][left][fill][fill]"
16+
"$columnConstraints": "[grow,fill][fill]"
1717
"$rowConstraints": "[fill]"
1818
} ) {
1919
name: "pnlFilterCommon"
@@ -31,35 +31,11 @@ new FormModel {
3131
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
3232
"value": "cell 0 0"
3333
} )
34-
add( new FormComponent( "javax.swing.JButton" ) {
35-
name: "btnRenameFilter"
34+
add( new FormContainer( "com.jidesoft.swing.JideSplitButton", new FormLayoutManager( class javax.swing.JMenu ) ) {
35+
name: "btnSplit"
36+
"alwaysDropdown": true
3637
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
37-
"value": "cell 1 0,alignx center,growx 0"
38-
} )
39-
add( new FormComponent( "javax.swing.JButton" ) {
40-
name: "btnAddNewFilter"
41-
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
42-
"value": "cell 2 0,alignx center,growx 0"
43-
} )
44-
add( new FormComponent( "javax.swing.JButton" ) {
45-
name: "btnDeleteCurrentFilter"
46-
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
47-
"value": "cell 3 0,alignx center,growx 0"
48-
} )
49-
add( new FormComponent( "javax.swing.JSeparator" ) {
50-
name: "separator1"
51-
"orientation": 1
52-
auxiliary() {
53-
"JavaCodeGenerator.variableLocal": true
54-
}
55-
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
56-
"value": "cell 4 0"
57-
} )
58-
add( new FormComponent( "javax.swing.JButton" ) {
59-
name: "btnResetCurrentFilter"
60-
"toolTipText": "Aktuellen Filter zurücksetzen"
61-
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
62-
"value": "cell 5 0,alignx center,growx 0"
38+
"value": "cell 1 0"
6339
} )
6440
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
6541
"value": "cell 0 0,growx"
Lines changed: 4 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)