wip on file preview

This commit is contained in:
Zlatin Balevsky
2019-11-10 13:59:01 +00:00
parent a2637570b1
commit 036971cfe5
4 changed files with 66 additions and 0 deletions

View File

@@ -204,6 +204,16 @@ class MainFrameController {
downloader.pause()
core.eventBus.publish(new UIDownloadPausedEvent())
}
@ControllerAction
void preview() {
def downloader = model.downloads[selectedDownload()].downloader
File previewFile = downloader.generatePreview()
if (previewFile != null)
Desktop.getDesktop().open(previewFile)
else
JOptionPane.showMessageDialog(null, "Failed to generate preview", "Failed to generate preveiw", JOptionPane.ERROR_MESSAGE)
}
@ControllerAction
void clear() {

View File

@@ -216,6 +216,7 @@ class MainFrameView {
button(text: "Pause", enabled : bind {model.pauseButtonEnabled}, pauseAction)
button(text: bind { model.resumeButtonText }, enabled : bind {model.retryButtonEnabled}, resumeAction)
button(text: "Cancel", enabled : bind {model.cancelButtonEnabled }, cancelAction)
button(text: "Preview", previewAction)
button(text: "Clear Done", enabled : bind {model.clearButtonEnabled}, clearAction)
}
}