forked from j62/ctbrec
1
0
Fork 0

Add "record until" in thumb overview context menu

This commit is contained in:
0xb00bface 2020-12-22 13:14:47 +01:00
parent b76a67ac7d
commit 492ef74459
1 changed files with 11 additions and 3 deletions

View File

@ -39,6 +39,7 @@ import ctbrec.ui.SiteUiFactory;
import ctbrec.ui.TipDialog; import ctbrec.ui.TipDialog;
import ctbrec.ui.TokenLabel; import ctbrec.ui.TokenLabel;
import ctbrec.ui.action.OpenRecordingsDir; import ctbrec.ui.action.OpenRecordingsDir;
import ctbrec.ui.action.SetStopDateAction;
import ctbrec.ui.controls.FasterVerticalScrollPaneSkin; import ctbrec.ui.controls.FasterVerticalScrollPaneSkin;
import ctbrec.ui.controls.SearchBox; import ctbrec.ui.controls.SearchBox;
import ctbrec.ui.controls.SearchPopover; import ctbrec.ui.controls.SearchPopover;
@ -464,10 +465,10 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
stop.setOnAction(e -> startStopAction(getSelectedThumbCells(cell), false)); stop.setOnAction(e -> startStopAction(getSelectedThumbCells(cell), false));
MenuItem startStop = recorder.isTracked(cell.getModel()) ? stop : start; MenuItem startStop = recorder.isTracked(cell.getModel()) ? stop : start;
MenuItem recordUntil = new MenuItem("Start Recording Until");
recordUntil.setOnAction(e -> startRecordingWithTimeLimit(getSelectedThumbCells(cell)));
MenuItem addPaused = new MenuItem("Add in paused state"); MenuItem addPaused = new MenuItem("Add in paused state");
addPaused.setOnAction(e -> addPaused(getSelectedThumbCells(cell))); addPaused.setOnAction(e -> addPaused(getSelectedThumbCells(cell)));
MenuItem recordUntil = new MenuItem("Record Until");
recordUntil.setOnAction(e -> LOG.debug("Record Later not implemented, yet"));
MenuItem recordLater = new MenuItem("Record Later"); MenuItem recordLater = new MenuItem("Record Later");
recordLater.setOnAction(e -> LOG.debug("Record Later not implemented, yet")); recordLater.setOnAction(e -> LOG.debug("Record Later not implemented, yet"));
@ -504,7 +505,7 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
if(modelIsTrackedByRecorder) { if(modelIsTrackedByRecorder) {
contextMenu.getItems().add(pauseResume); contextMenu.getItems().add(pauseResume);
} else { } else {
contextMenu.getItems().addAll(addPaused/*, recordUntil, recordLater*/); contextMenu.getItems().addAll(recordUntil, addPaused/*, recordLater*/);
} }
contextMenu.getItems().add(new SeparatorMenuItem()); contextMenu.getItems().add(new SeparatorMenuItem());
if(site.supportsFollow()) { if(site.supportsFollow()) {
@ -525,6 +526,13 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
return contextMenu; return contextMenu;
} }
private void startRecordingWithTimeLimit(List<ThumbCell> list) {
for (ThumbCell cell : list) {
cell.startStopAction(true);
new SetStopDateAction(cell, cell.getModel(), recorder).execute();
}
}
private void refresh() { private void refresh() {
if (updateService.isRunning()) { if (updateService.isRunning()) {
updateService.cancel(); updateService.cancel();