Skip to content

Commit

Permalink
- code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
derreisende77 committed Oct 26, 2024
1 parent 65731ac commit 5292e05
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/main/java/mediathek/mainwindow/MediathekGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public class MediathekGui extends JFrame {
private static final int MIN_WINDOW_HEIGHT = 600;
private static final String ACTION_MAP_KEY_COPY_HQ_URL = "COPY_HQ_URL";
private static final String ACTION_MAP_KEY_COPY_NORMAL_URL = "COPY_NORMAL_URL";
private static final String TABBED_PANE_TRAILING_COMPONENT = "JTabbedPane.trailingComponent";
/**
* "Pointer" to UI
*/
Expand Down Expand Up @@ -146,6 +147,7 @@ public class MediathekGui extends JFrame {
private IndicatorThread progressIndicatorThread;
private AutomaticFilmlistUpdate automaticFilmlistUpdate;
private boolean shutdownRequested;

public MediathekGui() {
ui = this;

Expand Down Expand Up @@ -238,7 +240,6 @@ public MediathekGui() {
try {
TimeUnit.SECONDS.sleep(10);
logger.info("Auto DL and Quit: Updating filmlist...");
final var daten = Daten.getInstance();
daten.getListeFilme().clear(); // sonst wird evtl. nur eine Diff geladen
daten.getFilmeLaden().loadFilmlist("", false);
logger.info("Auto DL and Quit: Filmlist update done.");
Expand Down Expand Up @@ -283,6 +284,15 @@ public void onFailure(@NotNull Throwable t) {
performAustrianVlcCheck();
}

/**
* Return the user interface instance
*
* @return the class instance or null.
*/
public static MediathekGui ui() {
return ui;
}

private void performAustrianVlcCheck() {
//perform check only when we are not in download-only mode...
if (!Config.shouldDownloadAndQuit()) {
Expand All @@ -307,15 +317,6 @@ private void subscribeTableModelChangeEvent() {
messageBus.subscribe(this);
}

/**
* Return the user interface instance
*
* @return the class instance or null.
*/
public static MediathekGui ui() {
return ui;
}

private void mapFilmUrlCopyCommands() {
final var im = jMenuBar.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
im.put(KeyStroke.getKeyStroke(KeyEvent.VK_H, GuiFunktionen.getPlatformControlKey() |
Expand Down Expand Up @@ -368,7 +369,7 @@ protected void setToolBarProperties() {
}

protected void installToolBar() {
tabbedPane.putClientProperty("JTabbedPane.trailingComponent", commonToolBar);
tabbedPane.putClientProperty(TABBED_PANE_TRAILING_COMPONENT, commonToolBar);
tabbedPane.putClientProperty("JTabbedPane.tabRotation", "auto");
}

Expand Down Expand Up @@ -688,7 +689,6 @@ private void restoreSizeFromConfig() {
/*
We are not in maximized mode, so just read all the settings and restore...
*/
var config = ApplicationConfiguration.getConfiguration();
try {
config.lock(LockMode.READ);
int width = config.getInt(ApplicationConfiguration.APPLICATION_UI_MAINWINDOW_WIDTH, MIN_WINDOW_WIDTH);
Expand Down Expand Up @@ -854,11 +854,11 @@ protected void configureTabPlacement() {
if (topPosition) {
tabbedPane.setTabPlacement(JTabbedPane.TOP);
getContentPane().remove(commonToolBar);
tabbedPane.putClientProperty("JTabbedPane.trailingComponent", commonToolBar);
tabbedPane.putClientProperty(TABBED_PANE_TRAILING_COMPONENT, commonToolBar);
}
else {
tabbedPane.setTabPlacement(JTabbedPane.LEFT);
tabbedPane.putClientProperty("JTabbedPane.trailingComponent", null);
tabbedPane.putClientProperty(TABBED_PANE_TRAILING_COMPONENT, null);
getContentPane().add(commonToolBar, BorderLayout.PAGE_START);
}
}
Expand Down Expand Up @@ -1093,7 +1093,7 @@ private void createDeveloperMenu() {
JMenu devMenu = new JMenu("Entwickler");

JMenuItem miGc = new JMenuItem("GC ausführen");
miGc.addActionListener(l -> System.gc());
miGc.addActionListener(_ -> System.gc());

devMenu.add(miGc);

Expand Down

0 comments on commit 5292e05

Please sign in to comment.