Add ForcePriority Overlay Icon, Fix Highlighting in Recorded Models tab

- Added an icon to show a model has ForcePriority enabled in the Site Tabs (Lightning Bolt over Record icon)
- Fixed issue where Highlighting in Recorded Models would not refresh when ForcePriority was enabled via Site Tab context-menu
This commit is contained in:
XxInvictus 2023-11-24 01:38:10 +10:30
parent 4936ecf191
commit 410302560b
8 changed files with 22 additions and 3 deletions

View File

@ -8,7 +8,8 @@ public enum Icon {
CLOCK_16(Icon.class.getResource("/16/clock.png").toExternalForm()),
GROUP_16(Icon.class.getResource("/16/users.png").toExternalForm()),
MEDIA_PLAYBACK_PAUSE_16(Icon.class.getResource("/16/media-playback-pause.png").toExternalForm()),
MEDIA_RECORD_16(Icon.class.getResource("/16/media-record.png").toExternalForm());
MEDIA_RECORD_16(Icon.class.getResource("/16/media-record.png").toExternalForm()),
MEDIA_FORCE_RECORD_16(Icon.class.getResource("/16/media-force-record.png").toExternalForm());
private String url;

View File

@ -27,6 +27,7 @@ public class JavaFxModel implements Model {
private final transient BooleanProperty onlineProperty = new SimpleBooleanProperty();
private final transient BooleanProperty recordingProperty = new SimpleBooleanProperty();
private final transient BooleanProperty pausedProperty = new SimpleBooleanProperty();
private final transient BooleanProperty forcePriorityProperty = new SimpleBooleanProperty();
private final transient SimpleIntegerProperty priorityProperty = new SimpleIntegerProperty();
private final transient SimpleObjectProperty<Instant> lastSeenProperty = new SimpleObjectProperty<>();
private final transient SimpleObjectProperty<Instant> lastRecordedProperty = new SimpleObjectProperty<>();
@ -119,6 +120,10 @@ public class JavaFxModel implements Model {
public BooleanProperty getPausedProperty() {
return pausedProperty;
}
public BooleanProperty getForcePriorityProperty() {
return forcePriorityProperty;
}
public SimpleIntegerProperty getPriorityProperty() {
return priorityProperty;
@ -267,6 +272,7 @@ public class JavaFxModel implements Model {
@Override
public void setForcePriority(boolean forcePriority) {
delegate.setForcePriority(forcePriority);
forcePriorityProperty.set(forcePriority);
}
public SimpleObjectProperty<Instant> lastSeenProperty() {

View File

@ -73,6 +73,7 @@ public class ThumbCell extends StackPane {
private static final Duration ANIMATION_DURATION = new Duration(250);
private static final Image imgRecordIndicator = new Image(MEDIA_RECORD_16.url());
private static final Image imgForceRecordIndicator = new Image(MEDIA_FORCE_RECORD_16.url());
private static final Image imgPauseIndicator = new Image(MEDIA_PLAYBACK_PAUSE_16.url());
private static final Image imgBookmarkIndicator = new Image(BOOKMARK_16.url());
private static final Image imgGroupIndicator = new Image(Icon.GROUP_16.url());
@ -122,6 +123,7 @@ public class ThumbCell extends StackPane {
this.imgAspectRatio = aspectRatio;
recording = recorder.isTracked(model);
model.setSuspended(recorder.isSuspended(model));
model.setForcePriority(recorder.isForcePriority(model));
this.setStyle("-fx-background-color: -fx-base");
streamPreview = new StreamPreview();
@ -497,8 +499,13 @@ public class ThumbCell extends StackPane {
recordingIndicatorTooltip.setText("Resume Recording");
} else {
modelRecordingState = ModelRecordingState.RECORDING;
recordingIndicator.setImage(imgRecordIndicator);
recordingIndicatorTooltip.setText("Pause Recording");
if (model.isForcePriority()) {
recordingIndicator.setImage(imgForceRecordIndicator);
recordingIndicatorTooltip.setText("Pause Recording (Resets Forced)");
} else {
recordingIndicator.setImage(imgRecordIndicator);
recordingIndicatorTooltip.setText("Pause Recording");
}
}
} else {
if (model.isMarkedForLaterRecording()) {

View File

@ -257,10 +257,12 @@ public class RecordedModelsTab extends AbstractRecordedModelsTab implements TabS
if (index == -1) {
observableModels.add(updatedModel);
updatedModel.getPausedProperty().addListener(createPauseListener(updatedModel));
updatedModel.getForcePriorityProperty().addListener(createForcePriorityListener(updatedModel));
} else {
// make sure to update the JavaFX online property, so that the table cell is updated
JavaFxModel oldModel = observableModels.get(index);
oldModel.setSuspended(updatedModel.isSuspended());
oldModel.setForcePriority(updatedModel.isForcePriority());
oldModel.getOnlineProperty().set(updatedModel.getOnlineProperty().get());
oldModel.getRecordingProperty().set(updatedModel.getRecordingProperty().get());
oldModel.lastRecordedProperty().set(updatedModel.lastRecordedProperty().get());

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -86,6 +86,7 @@ public class RemoteRecorder implements Recorder {
sendRequest("start", model);
findModel(model).ifPresent(cachedModel -> {
cachedModel.setSuspended(model.isSuspended());
cachedModel.setForcePriority(model.isForcePriority());
cachedModel.setMarkedForLaterRecording(model.isMarkedForLaterRecording());
cachedModel.setRecordUntil(model.getRecordUntil());
cachedModel.setRecordUntilSubsequentAction(model.getRecordUntilSubsequentAction());

View File

@ -345,6 +345,7 @@ public class SimplifiedLocalRecorder implements Recorder {
private void copyModelProperties(Model src, Model existing) {
existing.setSuspended(src.isSuspended());
existing.setForcePriority(src.isForcePriority());
existing.setMarkedForLaterRecording(src.isMarkedForLaterRecording());
existing.setPriority(src.getPriority());
existing.setRecordUntil(src.getRecordUntil());

View File

@ -87,6 +87,7 @@ public class RecorderServlet extends AbstractCtbrecServlet {
log.debug("Starting recording for model {} - {}", model.getName(), model.getUrl());
log.trace("Model marked: {}", model.isMarkedForLaterRecording());
log.trace("Model paused: {}", model.isSuspended());
log.trace("Model forced: {}", model.isForcePriority());
log.trace("Model until: {}", model.getRecordUntil().equals(Instant.ofEpochMilli(Model.RECORD_INDEFINITELY)) ? "no limit" : model.getRecordUntil());
log.trace("Model after: {}", model.getRecordUntilSubsequentAction());
recorder.addModel(model);