Remove Live Previews
This commit is contained in:
parent
2add4d8f0a
commit
4287c6a5c2
|
@ -42,7 +42,6 @@ import javafx.scene.layout.StackPane;
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
import javafx.scene.paint.Paint;
|
import javafx.scene.paint.Paint;
|
||||||
import javafx.scene.shape.Circle;
|
import javafx.scene.shape.Circle;
|
||||||
import javafx.scene.shape.Polygon;
|
|
||||||
import javafx.scene.shape.Rectangle;
|
import javafx.scene.shape.Rectangle;
|
||||||
import javafx.scene.shape.Shape;
|
import javafx.scene.shape.Shape;
|
||||||
import javafx.scene.text.Text;
|
import javafx.scene.text.Text;
|
||||||
|
@ -97,7 +96,6 @@ public class ThumbCell extends StackPane {
|
||||||
private final Recorder recorder;
|
private final Recorder recorder;
|
||||||
private final RecordingIndicator recordingIndicator;
|
private final RecordingIndicator recordingIndicator;
|
||||||
private final Tooltip recordingIndicatorTooltip;
|
private final Tooltip recordingIndicatorTooltip;
|
||||||
private StackPane previewTrigger;
|
|
||||||
private final StackPane groupIndicator;
|
private final StackPane groupIndicator;
|
||||||
private final Label groupIndicatorTooltipTrigger;
|
private final Label groupIndicatorTooltipTrigger;
|
||||||
private int index = 0;
|
private int index = 0;
|
||||||
|
@ -116,7 +114,6 @@ public class ThumbCell extends StackPane {
|
||||||
.maximumSize(10000)
|
.maximumSize(10000)
|
||||||
.build(CacheLoader.from(ThumbCell::getStreamResolution));
|
.build(CacheLoader.from(ThumbCell::getStreamResolution));
|
||||||
private final ThumbOverviewTab parent;
|
private final ThumbOverviewTab parent;
|
||||||
private CompletableFuture<Boolean> startPreview;
|
|
||||||
|
|
||||||
public ThumbCell(ThumbOverviewTab parent, Model model, Recorder recorder, double aspectRatio) {
|
public ThumbCell(ThumbOverviewTab parent, Model model, Recorder recorder, double aspectRatio) {
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
|
@ -259,6 +256,7 @@ public class ThumbCell extends StackPane {
|
||||||
case RECORDING -> pauseResumeAction(true);
|
case RECORDING -> pauseResumeAction(true);
|
||||||
case PAUSED -> pauseResumeAction(false);
|
case PAUSED -> pauseResumeAction(false);
|
||||||
case BOOKMARKED -> forgetModel();
|
case BOOKMARKED -> forgetModel();
|
||||||
|
case NOT -> handleNotState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,72 +266,8 @@ public class ThumbCell extends StackPane {
|
||||||
.thenAccept(r -> update());
|
.thenAccept(r -> update());
|
||||||
}
|
}
|
||||||
|
|
||||||
private Node createPreviewTrigger() {
|
private void handleNotState() {
|
||||||
var s = 24;
|
// Implement the logic for when the recording state is NOT
|
||||||
previewTrigger = new StackPane();
|
|
||||||
previewTrigger.setStyle("-fx-background-color: white;");
|
|
||||||
previewTrigger.setOpacity(.8);
|
|
||||||
previewTrigger.setMaxSize(s, s);
|
|
||||||
|
|
||||||
var play = new Polygon(16, 8, 26, 15, 16, 22);
|
|
||||||
StackPane.setMargin(play, new Insets(0, 0, 0, 3));
|
|
||||||
play.setStyle("-fx-background-color: black;");
|
|
||||||
previewTrigger.getChildren().add(play);
|
|
||||||
|
|
||||||
var clip = new Circle(s / 2.0);
|
|
||||||
clip.setTranslateX(clip.getRadius());
|
|
||||||
clip.setTranslateY(clip.getRadius());
|
|
||||||
previewTrigger.setClip(clip);
|
|
||||||
StackPane.setAlignment(previewTrigger, Pos.BOTTOM_LEFT);
|
|
||||||
StackPane.setMargin(previewTrigger, new Insets(0, 0, 24, 4));
|
|
||||||
previewTrigger.setOnMouseEntered(evt -> startPreview());
|
|
||||||
previewTrigger.setOnMouseExited(evt -> stopPreview());
|
|
||||||
return previewTrigger;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void stopPreview() {
|
|
||||||
if (startPreview != null) {
|
|
||||||
startPreview.cancel(true);
|
|
||||||
}
|
|
||||||
setPreviewVisible(previewTrigger, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void startPreview() {
|
|
||||||
previewTrigger.setCursor(Cursor.HAND);
|
|
||||||
startPreview = CompletableFuture.supplyAsync(() -> {
|
|
||||||
try {
|
|
||||||
Thread.sleep(500);
|
|
||||||
return true;
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
Thread.currentThread().interrupt();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}, GlobalThreadPool.get()).whenComplete((result, exception) -> {
|
|
||||||
startPreview = null;
|
|
||||||
if (Boolean.TRUE.equals(result)) {
|
|
||||||
setPreviewVisible(previewTrigger, true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setPreviewVisible(Node previewTrigger, boolean visible) {
|
|
||||||
parent.suspendUpdates(visible);
|
|
||||||
iv.setVisible(!visible);
|
|
||||||
topic.setVisible(!visible);
|
|
||||||
topicBackground.setVisible(!visible);
|
|
||||||
name.setVisible(!visible);
|
|
||||||
nameBackground.setVisible(!visible);
|
|
||||||
streamPreview.setVisible(visible);
|
|
||||||
if (visible) {
|
|
||||||
streamPreview.startStream(model);
|
|
||||||
} else {
|
|
||||||
streamPreview.stop();
|
|
||||||
}
|
|
||||||
recordingIndicator.setVisible(!visible);
|
|
||||||
if (!visible) {
|
|
||||||
updateRecordingIndicator();
|
|
||||||
}
|
|
||||||
previewTrigger.setCursor(visible ? Cursor.HAND : Cursor.DEFAULT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSelected(boolean selected) {
|
public void setSelected(boolean selected) {
|
||||||
|
|
Loading…
Reference in New Issue