Skip to content

Commit

Permalink
- fixes #696
Browse files Browse the repository at this point in the history
- fix incorrect description of download play action
- switch to nightly
- catch some exceptions in download list when removing or selecting entries
  • Loading branch information
derreisende77 committed Jul 27, 2023
1 parent 7ea4ca2 commit 0a1d96d
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 42 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# **14.0.1**
- **BUGFIX:** Inkorrekte Beschreibung des "Gespeicherten Film abspielen" Toolbar-Button im Tab Download wurde korrigiert.

# **14.0.0**
- Es wird nun Java 20 verwendet.
- User Interface wurde primär für neue macOS-Versionen überarbeitet.
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/mediathek/config/Konstanten.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@

public class Konstanten {
public static final long MINIMUM_MEMORY_THRESHOLD = 768 * FileUtils.ONE_MB;
public static final Version MVVERSION = new Version(14,0,0);
public static final Version MVVERSION = new Version(14,0,1);

public static final ApplicationType APPLICATION_TYPE = ApplicationType.PRODUCTION;
public static final ApplicationType APPLICATION_TYPE = ApplicationType.NIGHTLY;
public static final String MACOS_OFFICIAL_APP = "OSX_OFFICIAL_APP";

public static final String FORMAT_ZIP = ".zip";
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/mediathek/gui/actions/PlayDownloadAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
import java.awt.event.ActionEvent;

public class PlayDownloadAction extends AbstractAction {
private static final String ACTION_TEXT = "Gespeicherten Film abspielen";
private final GuiDownloads guiDownloads;

public PlayDownloadAction(GuiDownloads guiDownloads) {
this.guiDownloads = guiDownloads;
putValue(Action.NAME, "Gespeicherten Film abspielen");
putValue(Action.SHORT_DESCRIPTION, "Film abspielen");
putValue(Action.NAME, ACTION_TEXT);
putValue(Action.SHORT_DESCRIPTION, ACTION_TEXT);
putValue(Action.SMALL_ICON, SVGIconUtilities.createSVGIcon("icons/fontawesome/play.svg"));
}

Expand Down
78 changes: 40 additions & 38 deletions src/main/java/mediathek/gui/tabs/tab_downloads/GuiDownloads.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,21 +202,25 @@ private void updateFilmSizes(int[] rows) {
boolean updateNeeded = false;

for (var row : rows) {
var indexRow = tabelle.convertRowIndexToModel(row);
var listeDownloads = daten.getListeDownloads();
var dlInfo = listeDownloads.get(indexRow);
if (dlInfo != null) {
if (dlInfo.mVFilmSize.getSize() != 0)
continue;
try {
var indexRow = tabelle.convertRowIndexToModel(row);
var listeDownloads = daten.getListeDownloads();
var dlInfo = listeDownloads.get(indexRow);
if (dlInfo != null) {
if (dlInfo.mVFilmSize.getSize() != 0)
continue;

if (dlInfo.film != null) {
var oldSize = dlInfo.mVFilmSize.getSize();
dlInfo.queryLiveSize();
if (dlInfo.mVFilmSize.getSize() != oldSize)
updateNeeded = true;
}
} else
logger.error("Could not get download object");
if (dlInfo.film != null) {
var oldSize = dlInfo.mVFilmSize.getSize();
dlInfo.queryLiveSize();
if (dlInfo.mVFilmSize.getSize() != oldSize)
updateNeeded = true;
}
} else
logger.error("Could not get download object");
}
catch (Exception ignored) {
}
}

if (updateNeeded)
Expand Down Expand Up @@ -598,17 +602,22 @@ private ArrayList<DatenDownload> getSelDownloads() {

@Override
public Optional<DatenFilm> getCurrentlySelectedFilm() {
final int selectedTableRow = tabelle.getSelectedRow();
if (selectedTableRow != -1) {
Optional<DatenFilm> optRet;
final int modelIndex = tabelle.convertRowIndexToModel(selectedTableRow);
final DatenDownload download = (DatenDownload) tabelle.getModel().getValueAt(modelIndex, DatenDownload.DOWNLOAD_REF);
if (download.film == null)
optRet = Optional.empty();
else
optRet = Optional.of(download.film);
return optRet;
} else {
try {
final int selectedTableRow = tabelle.getSelectedRow();
if (selectedTableRow != -1) {
Optional<DatenFilm> optRet;
int modelIndex = tabelle.convertRowIndexToModel(selectedTableRow);
final DatenDownload download = (DatenDownload) tabelle.getModel().getValueAt(modelIndex, DatenDownload.DOWNLOAD_REF);
if (download.film == null)
optRet = Optional.empty();
else
optRet = Optional.of(download.film);
return optRet;
} else {
return Optional.empty();
}
}
catch (Exception e) {
return Optional.empty();
}
}
Expand Down Expand Up @@ -948,19 +957,12 @@ public void stopAllWaitingDownloads() {
}

private void updateFilmData() {
if (isShowing()) {
DatenFilm selectedFilm = null;
final int selectedTableRow = tabelle.getSelectedRow();
if (selectedTableRow != -1) {
final DatenDownload datenDownload = (DatenDownload) tabelle.getModel().getValueAt(tabelle.convertRowIndexToModel(selectedTableRow), DatenDownload.DOWNLOAD_REF);
if (datenDownload != null) {
selectedFilm = datenDownload.film;
}
}
var infoDialog = mediathekGui.getFilmInfoDialog();
if (infoDialog != null) {
infoDialog.updateCurrentFilm(selectedFilm);
}
if (!isShowing())
return;

var infoDialog = mediathekGui.getFilmInfoDialog();
if (infoDialog != null) {
infoDialog.updateCurrentFilm(getCurrentlySelectedFilm().orElse(null));
}
}

Expand Down

0 comments on commit 0a1d96d

Please sign in to comment.