Skip to content

Commit

Permalink
- create option to show blacklist toggle icon with text
Browse files Browse the repository at this point in the history
  • Loading branch information
derreisende77 committed Aug 21, 2024
1 parent fde55a4 commit dc3d283
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- **BUGFIX:** Im "Neues Abo anlegen"-Dialog werden Textfelder im Dark Mode nicht mehr weiß hinterlegt.
- **FEATURE(Linux/Windows):** Das Aussehen von FlatLaf kann in `.mediathek3/flatlaf` angepasst werden.
- **FEATURE:** Selektierte Einträge in `Suchhistorie bearbeiten`-Dialog können nun mittels Entfernen-Taste gelöscht werden.
- **FEATURE:** Das Blacklist Filter-Icon in der Toolbar kann mittels *Einstellungen/Allgemein* mit einem aussagefähigen Zusatztext dargestellt werden.

# **14.1.0**
- JDK 21 wird nun mitgeliefert. Behebt primär Darstellungsfehler von Java Apps unter Windows.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import org.apache.commons.configuration2.Configuration;
import org.apache.commons.lang3.SystemUtils;
import org.jdesktop.swingx.JXTitledPanel;
import org.jdesktop.swingx.VerticalLayout;

import javax.swing.*;
import javax.swing.border.TitledBorder;
Expand Down Expand Up @@ -153,6 +152,14 @@ public PanelEinstellungen() {
ApplicationConfiguration.getConfiguration().setProperty(CellRendererBaseWithStart.ICON_POSITION_RIGHT, cbDrawListIconsRight.isSelected());
MediathekGui.ui().repaint();
});

boolean useIconWithText = ApplicationConfiguration.getConfiguration()
.getBoolean(ApplicationConfiguration.TOOLBAR_BLACKLIST_ICON_WITH_TEXT, false);
cbShowBlacklistIconWithText.setSelected(useIconWithText);
cbShowBlacklistIconWithText.addActionListener(l -> {
var useText = cbShowBlacklistIconWithText.isSelected();
ApplicationConfiguration.getConfiguration().setProperty(ApplicationConfiguration.TOOLBAR_BLACKLIST_ICON_WITH_TEXT, useText);
});
}

private static final String NO_INFLUENCE_TEXT = "Einstellung hat unter macOS keine Auswirkung";
Expand Down Expand Up @@ -209,6 +216,7 @@ private void initComponents() {
jpfProxyPassword = new JPasswordField();
var panel1 = new JPanel();
jCheckBoxTray = new JCheckBox();
cbShowBlacklistIconWithText = new JCheckBox();
cbUseWikipediaSenderLogos = new JCheckBox();
cbAutomaticUpdateChecks = new JCheckBox();
cbDrawListIconsRight = new JCheckBox();
Expand Down Expand Up @@ -349,23 +357,39 @@ private void initComponents() {

//======== panel1 ========
{
panel1.setLayout(new VerticalLayout());
panel1.setLayout(new MigLayout(
new LC().insets("0").hideMode(3).gridGap("5", "0"), //NON-NLS
// columns
new AC()
.grow().align("left").gap() //NON-NLS
.fill(),
// rows
new AC()
.fill().gap()
.fill().gap()
.fill().gap()
.fill()));

//---- jCheckBoxTray ----
jCheckBoxTray.setText("Programm ins Tray minimieren"); //NON-NLS
panel1.add(jCheckBoxTray);
panel1.add(jCheckBoxTray, new CC().cell(0, 0));

//---- cbShowBlacklistIconWithText ----
cbShowBlacklistIconWithText.setText("Blacklist-Filter-Icon mit Text anzeigen"); //NON-NLS
cbShowBlacklistIconWithText.setToolTipText("Neustart erforderlich"); //NON-NLS
panel1.add(cbShowBlacklistIconWithText, new CC().cell(1, 0));

//---- cbUseWikipediaSenderLogos ----
cbUseWikipediaSenderLogos.setText("Senderlogos von Wikipedia verwenden"); //NON-NLS
panel1.add(cbUseWikipediaSenderLogos);
panel1.add(cbUseWikipediaSenderLogos, new CC().cell(0, 1));

//---- cbAutomaticUpdateChecks ----
cbAutomaticUpdateChecks.setText("Programmupdates t\u00e4glich suchen"); //NON-NLS
panel1.add(cbAutomaticUpdateChecks);
panel1.add(cbAutomaticUpdateChecks, new CC().cell(0, 2));

//---- cbDrawListIconsRight ----
cbDrawListIconsRight.setText("Info-Icons der Listen rechts darstellen"); //NON-NLS
panel1.add(cbDrawListIconsRight);
panel1.add(cbDrawListIconsRight, new CC().cell(0, 3));
}

//---- modernSearchTitlePanel ----
Expand Down Expand Up @@ -416,6 +440,7 @@ private void initComponents() {
private JTextField jtfProxyUser;
private JPasswordField jpfProxyPassword;
private JCheckBox jCheckBoxTray;
private JCheckBox cbShowBlacklistIconWithText;
private JCheckBox cbUseWikipediaSenderLogos;
private JCheckBox cbAutomaticUpdateChecks;
private JCheckBox cbDrawListIconsRight;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
JFDML JFormDesigner: "8.1.1.0.298" Java: "17.0.7" encoding: "UTF-8"
JFDML JFormDesigner: "8.2.4.0.393" Java: "21.0.3" encoding: "UTF-8"

new FormModel {
contentType: "form/swing"
Expand Down Expand Up @@ -119,26 +119,45 @@ new FormModel {
name: "jpfProxyPassword"
} )
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class org.jdesktop.swingx.VerticalLayout ) ) {
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "insets 0,hidemode 3,gap 5 0"
"$columnConstraints": "[grow,left][fill]"
"$rowConstraints": "[fill][fill][fill][fill]"
} ) {
name: "panel1"
auxiliary() {
"JavaCodeGenerator.variableLocal": true
}
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "jCheckBoxTray"
"text": "Programm ins Tray minimieren"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 0"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "cbShowBlacklistIconWithText"
"text": "Blacklist-Filter-Icon mit Text anzeigen"
"toolTipText": "Neustart erforderlich"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 0"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "cbUseWikipediaSenderLogos"
"text": "Senderlogos von Wikipedia verwenden"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 1"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "cbAutomaticUpdateChecks"
"text": "Programmupdates täglich suchen"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 2"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "cbDrawListIconsRight"
"text": "Info-Icons der Listen rechts darstellen"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 3"
} )
} )
add( new FormComponent( "org.jdesktop.swingx.JXTitledPanel" ) {
Expand Down
13 changes: 12 additions & 1 deletion src/main/java/mediathek/mainwindow/MediathekGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,21 @@ protected void installToolBar() {
tabbedPane.putClientProperty("JTabbedPane.tabRotation", "auto");
}

protected void createToggleBlacklistButton() {
boolean useIconWithText = ApplicationConfiguration.getConfiguration()
.getBoolean(ApplicationConfiguration.TOOLBAR_BLACKLIST_ICON_WITH_TEXT, false);
if (useIconWithText) {
commonToolBar.add(new JButton(toggleBlacklistAction));
}
else {
commonToolBar.add(toggleBlacklistAction);
}
}

protected void createCommonToolBar() {
commonToolBar.add(loadFilmListAction);
commonToolBar.add(showFilmInformationAction);
commonToolBar.add(toggleBlacklistAction);
createToggleBlacklistButton();
commonToolBar.addSeparator();
commonToolBar.add(editBlacklistAction);
commonToolBar.add(manageAboAction);
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/mediathek/tool/ApplicationConfiguration.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
* The global application configuration class. This will contain all the config data in the future.
*/
public class ApplicationConfiguration {
public static final String TOOLBAR_BLACKLIST_ICON_WITH_TEXT = "toolbar.blacklist_icon.text";

public static final String APPLICATION_DARK_MODE = "application.dark_mode";
public static final String APPLICATION_USER_AGENT = "application.user_agent";
public static final String APPLICATION_USE_MODERN_SEARCH = "application.use.modern_search";
Expand Down

0 comments on commit dc3d283

Please sign in to comment.