Compare commits

..

6 Commits

Author SHA1 Message Date
Jafea7 b370e8e212 Include CHANGELOG.md 2025-09-13 22:25:42 +10:00
Jafea7 397cbd39b1 v25.9.13 2025-09-13 22:08:08 +10:00
Jafea7 deb279ad80 Update CHANGELOG.md 2025-09-13 22:07:56 +10:00
Jafea7 f83d9a2554 Add Discord button 2025-09-13 22:07:45 +10:00
Jafea7 7f6e7008e0 Implement CheckURL from WinkRU 2025-09-13 22:07:29 +10:00
Jafea7 a7b4a99af3 Sort Bookmarked after Recording models 2025-09-11 22:18:05 +10:00
13 changed files with 149 additions and 54 deletions

View File

@ -11,6 +11,12 @@ If this version doesn't do what you want, don't use it ... simple.
Changes from reusedname's v5.3.2 version.
25.09.11
========================
* Sort entries in site tabs: Tracked->Bookmarked
* Add Discord button to Settings->Help
* Implemnt CheckURL dialog from WinkRU v5.0.24
25.9.6
========================
* Implement @Gubi_uy SC fix

View File

@ -8,7 +8,7 @@
<parent>
<groupId>ctbrec</groupId>
<artifactId>master</artifactId>
<version>25.9.6</version>
<version>25.9.13</version>
<relativePath>../master</relativePath>
</parent>

View File

@ -35,6 +35,10 @@
<source>${project.basedir}/LICENSE.txt</source>
<outputDirectory>ctbrec</outputDirectory>
</file>
<file>
<source>${project.basedir}/../CHANGELOG.md</source>
<outputDirectory>ctbrec</outputDirectory>
</file>
<file>
<source>${project.basedir}/README.md</source>
<outputDirectory>ctbrec</outputDirectory>

View File

@ -36,6 +36,10 @@
<source>${project.basedir}/LICENSE.txt</source>
<outputDirectory>ctbrec</outputDirectory>
</file>
<file>
<source>${project.basedir}/../CHANGELOG.md</source>
<outputDirectory>ctbrec</outputDirectory>
</file>
<file>
<source>${project.basedir}/README.md</source>
<outputDirectory>ctbrec</outputDirectory>

View File

@ -31,6 +31,10 @@
<source>${project.basedir}/LICENSE.txt</source>
<outputDirectory>ctbrec</outputDirectory>
</file>
<file>
<source>${project.basedir}/../CHANGELOG.md</source>
<outputDirectory>ctbrec</outputDirectory>
</file>
<file>
<source>${project.basedir}/README.md</source>
<outputDirectory>ctbrec</outputDirectory>

View File

@ -1,25 +1,23 @@
package ctbrec.ui.action;
import lombok.extern.slf4j.Slf4j;
import ctbrec.GlobalThreadPool;
import ctbrec.Model;
import ctbrec.recorder.Recorder;
import ctbrec.ui.action.StopRecordingAction;
import ctbrec.ui.controls.Dialogs;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import ctbrec.GlobalThreadPool;
import ctbrec.Model;
import ctbrec.recorder.Recorder;
import ctbrec.ui.controls.Dialogs;
import javafx.application.Platform;
import javafx.scene.control.Button;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class CheckModelAccountAction {
private Button b;
private Recorder recorder;
private String buttonText;
public CheckModelAccountAction(Button b, Recorder recorder) {
@ -30,30 +28,30 @@ public class CheckModelAccountAction {
public void execute(Predicate<Model> filter) {
b.setDisable(true);
Runnable checker = (() -> {
List<Model> deletedAccounts = new ArrayList<>();
Runnable checker = () -> {
ArrayList<Model> deletedAccounts = new ArrayList<Model>();
try {
checkModelAccounts(filter, deletedAccounts);
} finally {
}
finally {
showResult(deletedAccounts);
}
});
GlobalThreadPool.submit(checker);
};
GlobalThreadPool.submit((Runnable)checker);
}
private void showResult(List<Model> deletedAccounts) {
Platform.runLater(() -> {
b.setDisable(false);
b.setText(buttonText);
b.setText(this.buttonText);
if (!deletedAccounts.isEmpty()) {
var sb = new StringBuilder();
StringBuilder sb = new StringBuilder();
for (Model deletedModel : deletedAccounts) {
String name = deletedModel.getDisplayName() + " ".repeat(30);
name = name.substring(0, 30);
sb.append(name).append(' ').append('(').append(deletedModel.getUrl()).append(')').append('\n');
Object name = deletedModel.getDisplayName() + " ".repeat(30);
name = ((String)name).substring(0, 30);
sb.append((String)name).append(' ').append('(').append(deletedModel.getUrl()).append(')').append('\n');
}
boolean remove = Dialogs.showConfirmDialog("Deleted Accounts", sb.toString(),
"The following accounts seem to have been deleted. Do you want to remove them?", b.getScene());
boolean remove = Dialogs.showExpandedConfirmDialog("Deleted Accounts", "Accounts list:", sb.toString(), "The following accounts seem to have been deleted. Do you want to remove them?", b.getScene());
if (remove) {
new StopRecordingAction(b, deletedAccounts, recorder).execute();
}
@ -62,21 +60,21 @@ public class CheckModelAccountAction {
}
private void checkModelAccounts(Predicate<Model> filter, List<Model> deletedAccounts) {
List<Model> models = recorder.getModels().stream() //
.filter(filter) //
.collect(Collectors.toList());
List models = recorder.getModels().stream().filter(filter).collect(Collectors.toList());
int total = models.size();
for (var i = 0; i < total; i++) {
final int counter = i+1;
Platform.runLater(() -> b.setText(buttonText + ' ' + counter + '/' + total));
var modelToCheck = models.get(i);
for (int i = 0; i < total; ++i) {
int counter = i + 1;
Platform.runLater(() -> b.setText(buttonText + " " + counter + "/" + total));
Model modelToCheck = (Model)models.get(i);
try {
if (!modelToCheck.exists()) {
if (modelToCheck.exists()) continue;
deletedAccounts.add(modelToCheck);
continue;
}
} catch (IOException e) {
log.warn("Couldn't check, if model account still exists", e);
catch (IOException e) {
log.warn("Couldn't check, if model account still exists", (Throwable)e);
}
}
}
}

View File

@ -1,6 +1,12 @@
package ctbrec.ui.controls;
import ctbrec.ui.AutosizeAlert;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Collection;
import java.util.Objects;
import java.util.Optional;
import javafx.application.Platform;
import javafx.beans.value.ChangeListener;
import javafx.geometry.Insets;
@ -9,6 +15,7 @@ import javafx.scene.control.*;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.image.Image;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Region;
import javafx.stage.Modality;
import javafx.stage.Stage;
@ -29,26 +36,68 @@ public class Dialogs {
}
public static void showError(String header, String text, Throwable t) {
showError(scene, header, text, t);
if (Objects.nonNull(t)) {
Dialogs.showError(scene, header, text, t);
} else {
Dialogs.showError(scene, header, text);
}
}
public static void showError(Scene parent, String header, String text, Throwable t) {
public static void showError(Scene parent, String header, String text) {
Runnable r = () -> {
Alert alert = new AutosizeAlert(Alert.AlertType.ERROR, parent);
AutosizeAlert alert = new AutosizeAlert(Alert.AlertType.ERROR, parent);
alert.setTitle("Error");
alert.setHeaderText(header);
String content = text;
if (t != null) {
content += " " + t.getLocalizedMessage();
}
alert.setContentText(content);
alert.setContentText(text);
if (parent != null) {
var stage = (Stage) alert.getDialogPane().getScene().getWindow();
stage.getScene().getStylesheets().addAll(parent.getStylesheets());
Stage stage = (Stage)alert.getDialogPane().getScene().getWindow();
stage.getScene().getStylesheets().addAll((Collection<String>)parent.getStylesheets());
}
alert.showAndWait();
};
if (Platform.isFxApplicationThread()) {
r.run();
} else {
Platform.runLater(r);
}
}
public static void showError(Scene parent, String header, String text, Throwable t) {
if (Objects.isNull(t)) {
Dialogs.showError(parent, header, text);
return;
}
Runnable r = () -> {
AutosizeAlert alert = new AutosizeAlert(Alert.AlertType.ERROR, parent);
alert.setTitle("Error");
alert.setHeaderText(header);
String content = text + "\n" + t.getLocalizedMessage();
alert.setContentText(content);
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
t.printStackTrace(pw);
String exceptionText = sw.toString();
Label label = new Label("The exception stacktrace was:");
TextArea textArea = new TextArea(exceptionText);
textArea.setEditable(false);
textArea.setWrapText(true);
textArea.setMaxWidth(Double.MAX_VALUE);
textArea.setMaxHeight(Double.MAX_VALUE);
GridPane.setVgrow(textArea, Priority.ALWAYS);
GridPane.setHgrow(textArea, Priority.ALWAYS);
GridPane expContent = new GridPane();
expContent.setMaxWidth(Double.MAX_VALUE);
expContent.add(label, 0, 0);
expContent.add(textArea, 0, 1);
alert.getDialogPane().setExpandableContent(expContent);
alert.getDialogPane().setMinHeight(Double.NEGATIVE_INFINITY);
alert.getDialogPane().setMinWidth(Double.NEGATIVE_INFINITY);
if (parent != null) {
Stage stage = (Stage)alert.getDialogPane().getScene().getWindow();
stage.getScene().getStylesheets().addAll((Collection<String>)parent.getStylesheets());
}
alert.showAndWait();
};
if (Platform.isFxApplicationThread()) {
r.run();
} else {
@ -121,6 +170,24 @@ public class Dialogs {
return confirm.getResult() == YES;
}
public static boolean showExpandedConfirmDialog(String title, String message, String expandedText, String header, Scene parent) {
AutosizeAlert confirm = new AutosizeAlert(Alert.AlertType.CONFIRMATION, message, parent, ButtonType.YES, ButtonType.NO);
confirm.setTitle(title);
confirm.setHeaderText(header);
TextArea textArea = new TextArea(expandedText);
textArea.setEditable(false);
textArea.setWrapText(true);
textArea.setMaxWidth(Double.MAX_VALUE);
textArea.setMaxHeight(Double.MAX_VALUE);
GridPane.setVgrow(textArea, Priority.ALWAYS);
GridPane.setHgrow(textArea, Priority.ALWAYS);
confirm.getDialogPane().setExpandableContent(textArea);
confirm.getDialogPane().setExpanded(true);
confirm.getDialogPane().setMinHeight(Double.NEGATIVE_INFINITY);
confirm.showAndWait();
return confirm.getResult() == ButtonType.YES;
}
public static ButtonType showShutdownDialog(Scene parent) {
var message = "There are recordings in progress";
var confirm = new AutosizeAlert(AlertType.CONFIRMATION, "", parent, YES, FINISH, NO);

View File

@ -15,7 +15,6 @@ import javafx.scene.layout.BorderPane;
import javafx.scene.layout.VBox;
import lombok.extern.slf4j.Slf4j;
// import java.awt.Desktop;
import java.io.File;
import java.io.IOException;
@ -53,8 +52,12 @@ public class HelpTab extends Tab {
Button openCfg = new Button("Open Config Dir");
openCfg.setStyle("-fx-font-family: 'Arial'; -fx-font-size: 16px; -fx-font-weight: bold; -fx-text-fill: #ffffff; -fx-background-color: #FF9800; -fx-padding: 15 30; -fx-border-radius: 5; -fx-background-radius: 5;");
Button openDiscord = new Button("Discord");
openDiscord.setStyle("-fx-font-family: 'Arial'; -fx-font-size: 16px; -fx-font-weight: bold; -fx-text-fill: #ffffff; -fx-background-color: #ff0022; -fx-padding: 15 30; -fx-border-radius: 5; -fx-background-radius: 5;");
File cfgDir = Config.getInstance().getConfigDir();
String path = (cfgDir != null) ? cfgDir.getAbsolutePath() : "Unknown";
Label configStaticLabel = new Label("Config Dir:");
configStaticLabel.setStyle("-fx-font-family: 'Arial'; -fx-font-size: 14px; -fx-font-weight: bold; -fx-alignment: center;");
Label configValueLabel = new Label(path);
@ -75,8 +78,9 @@ public class HelpTab extends Tab {
VBox vbox = new VBox();
vbox.setAlignment(Pos.CENTER);
vbox.setSpacing(20);
vbox.getChildren().addAll(wanLabelBox, openHelp, configLabelBox, openCfg, logLabelBox, openLog);
vbox.getChildren().addAll(wanLabelBox, openHelp, configLabelBox, openCfg, logLabelBox, openLog, openDiscord);
// Set up the BorderPane layout
BorderPane layout = new BorderPane();
layout.setCenter(vbox);
@ -95,14 +99,13 @@ public class HelpTab extends Tab {
File logFile = new File("ctbrec.log");
if (logFile.exists()) {
try {
// Use Runtime.getRuntime().exec() to open the file in a separate process
String osName = System.getProperty("os.name").toLowerCase();
ProcessBuilder pb = null;
if (osName.contains("mac")) {
pb = new ProcessBuilder("open", logFile.getAbsolutePath());
} else if (osName.contains("win")) {
pb = new ProcessBuilder("explorer.exe", logFile.getAbsolutePath());
} else { // Assume it's a Unix/Linux system
} else {
pb = new ProcessBuilder("xdg-open", logFile.getAbsolutePath());
}
pb.start();
@ -118,14 +121,13 @@ public class HelpTab extends Tab {
File configDir = Config.getInstance().getConfigDir();
if (configDir.exists()) {
try {
// Use Runtime.getRuntime().exec() to open the file in a separate process
String osName = System.getProperty("os.name").toLowerCase();
ProcessBuilder pb = null;
if (osName.contains("mac")) {
pb = new ProcessBuilder("open", configDir.getAbsolutePath());
} else if (osName.contains("win")) {
pb = new ProcessBuilder("explorer.exe", configDir.getAbsolutePath());
} else { // Assume it's a Unix/Linux system
} else {
pb = new ProcessBuilder("xdg-open", configDir.getAbsolutePath());
}
pb.start();
@ -136,6 +138,8 @@ public class HelpTab extends Tab {
log.warn("Config dir doesn't exist: {}", configDir.getAbsolutePath());
}
});
openDiscord.setOnAction(e -> DesktopIntegration.open("https://discord.gg/8jCXgVHzgf"));
}
private void startDocumentationServer() {

View File

@ -686,6 +686,10 @@ public class ThumbOverviewTab extends Tab implements TabSelectionListener {
thumbs.remove(i);
thumbsToMove.add(0, thumb);
}
if (recorder.isMarkedForLaterRecording(thumb.getModel())) {
thumbs.remove(i);
thumbsToMove.add(thumb);
}
}
}
thumbs.addAll(0, thumbsToMove);

View File

@ -8,7 +8,7 @@
<parent>
<groupId>ctbrec</groupId>
<artifactId>master</artifactId>
<version>25.9.6</version>
<version>25.9.13</version>
<relativePath>../master</relativePath>
</parent>

View File

@ -11,7 +11,7 @@
<groupId>ctbrec</groupId>
<artifactId>master</artifactId>
<packaging>pom</packaging>
<version>25.9.6</version>
<version>25.9.13</version>
<modules>
<module>../common</module>

View File

@ -8,7 +8,7 @@
<parent>
<groupId>ctbrec</groupId>
<artifactId>master</artifactId>
<version>25.9.6</version>
<version>25.9.13</version>
<relativePath>../master</relativePath>
</parent>

View File

@ -30,6 +30,10 @@
<source>${project.basedir}/LICENSE.txt</source>
<outputDirectory>ctbrec</outputDirectory>
</file>
<file>
<source>${project.basedir}/../CHANGELOG.md</source>
<outputDirectory>ctbrec</outputDirectory>
</file>
<file>
<source>${project.basedir}/README.md</source>
<outputDirectory>ctbrec</outputDirectory>