Fixes [stage]

This commit is contained in:
crschnick
2024-12-28 18:51:11 +00:00
parent 13234a0a37
commit 88cd8b30cb
6 changed files with 54 additions and 84 deletions
@@ -334,12 +334,6 @@ public abstract class OperationMode {
OperationMode.halt(hasError ? 1 : 0);
});
thread.start();
try {
thread.join();
} catch (InterruptedException ignored) {
OperationMode.halt(1);
}
}
private static synchronized void set(OperationMode newMode) {
@@ -1,10 +1,13 @@
package io.xpipe.app.prefs;
import io.xpipe.app.comp.base.ModalButton;
import io.xpipe.app.comp.base.ModalOverlay;
import io.xpipe.app.core.AppFont;
import io.xpipe.app.core.AppI18n;
import io.xpipe.app.core.AppProperties;
import io.xpipe.app.core.mode.OperationMode;
import io.xpipe.app.core.window.AppWindowHelper;
import io.xpipe.app.issue.ErrorEvent;
import io.xpipe.app.util.*;
import io.xpipe.core.process.OsType;
import io.xpipe.core.util.XPipeInstallation;
@@ -25,51 +28,42 @@ public class WorkspaceCreationAlert {
private static void show() throws Exception {
var name = new SimpleObjectProperty<>("New workspace");
var path = new SimpleObjectProperty<>(AppProperties.get().getDataDir());
var show = AppWindowHelper.showBlockingAlert(alert -> {
alert.setTitle(AppI18n.get("workspaceCreationAlertTitle"));
var content = new OptionsBuilder()
.nameAndDescription("workspaceName")
.addString(name)
.nameAndDescription("workspacePath")
.addPath(path)
.buildComp()
.minWidth(500)
.padding(new Insets(5, 20, 20, 20))
.apply(struc -> AppFont.small(struc.get()))
.createRegion();
alert.getButtonTypes().add(ButtonType.CANCEL);
alert.getButtonTypes().add(ButtonType.OK);
alert.getDialogPane().setContent(content);
})
.map(b -> b.getButtonData().isDefaultButton())
.orElse(false);
var content = new OptionsBuilder()
.nameAndDescription("workspaceName")
.addString(name)
.nameAndDescription("workspacePath")
.addPath(path)
.buildComp()
.prefWidth(500)
.apply(struc -> AppFont.small(struc.get()));
var modal = ModalOverlay.of("workspaceCreationAlertTitle", content);
modal.addButton(ModalButton.ok(() -> {
if (name.get() == null || path.get() == null) {
return;
}
if (!show || name.get() == null || path.get() == null) {
return;
}
var shortcutName = (AppProperties.get().isStaging() ? "XPipe PTB" : "XPipe") + " (" + name.get() + ")";
var file =
switch (OsType.getLocal()) {
try {
var shortcutName = (AppProperties.get().isStaging() ? "XPipe PTB" : "XPipe") + " (" + name.get() + ")";
var file = switch (OsType.getLocal()) {
case OsType.Windows w -> {
var exec = XPipeInstallation.getCurrentInstallationBasePath()
.resolve(XPipeInstallation.getDaemonExecutablePath(w))
.toString();
yield DesktopShortcuts.create(
exec,
"-Dio.xpipe.app.dataDir=\"" + path.get().toString()
+ "\" -Dio.xpipe.app.acceptEula=true",
yield DesktopShortcuts.create(exec, "-Dio.xpipe.app.dataDir=\"" + path.get().toString() + "\" -Dio.xpipe.app.acceptEula=true",
shortcutName);
}
default -> {
var exec = XPipeInstallation.getCurrentInstallationBasePath()
.resolve(XPipeInstallation.getRelativeCliExecutablePath(OsType.getLocal()))
.toString();
yield DesktopShortcuts.create(
exec, "-d \"" + path.get().toString() + "\" --accept-eula", shortcutName);
var exec = XPipeInstallation.getCurrentInstallationBasePath().resolve(
XPipeInstallation.getRelativeCliExecutablePath(OsType.getLocal())).toString();
yield DesktopShortcuts.create(exec, "-d \"" + path.get().toString() + "\" --accept-eula", shortcutName);
}
};
DesktopHelper.browseFileInDirectory(file);
OperationMode.close();
DesktopHelper.browseFileInDirectory(file);
OperationMode.close();
} catch (Exception e) {
ErrorEvent.fromThrowable(e).handle();
}
}));
modal.show();
}
}
@@ -1,6 +1,9 @@
package io.xpipe.app.terminal;
import io.xpipe.app.comp.base.MarkdownComp;
import io.xpipe.app.comp.base.ModalButton;
import io.xpipe.app.comp.base.ModalOverlay;
import io.xpipe.app.comp.base.ModalOverlayComp;
import io.xpipe.app.core.AppCache;
import io.xpipe.app.core.AppI18n;
import io.xpipe.app.core.window.AppWindowHelper;
@@ -92,25 +95,14 @@ public class TermiusTerminalType implements ExternalTerminalType {
var b = SshLocalBridge.get();
var keyContent = Files.readString(b.getIdentityKey());
var r = AppWindowHelper.showBlockingAlert(alert -> {
alert.setTitle(AppI18n.get("termiusSetup"));
alert.setAlertType(Alert.AlertType.NONE);
var activated = AppI18n.get()
.getMarkdownDocumentation("app:termiusSetup")
.formatted(b.getIdentityKey(), keyContent);
var markdown = new MarkdownComp(activated, s -> s)
.prefWidth(450)
.prefHeight(450)
.createRegion();
alert.getDialogPane().setContent(markdown);
alert.getButtonTypes().add(new ButtonType(AppI18n.get("ok"), ButtonBar.ButtonData.OK_DONE));
});
r.filter(buttonType -> buttonType.getButtonData().isDefaultButton());
r.ifPresent(buttonType -> {
var activated = AppI18n.get()
.getMarkdownDocumentation("app:termiusSetup")
.formatted(b.getIdentityKey(), keyContent);
var modal = ModalOverlay.of("termiusSetup", new MarkdownComp(activated, s -> s).prefWidth(450));
modal.addButton(ModalButton.ok(() -> {
AppCache.update("termiusSetup", true);
});
return r.isPresent();
}));
modal.showAndWait();
return AppCache.getBoolean("termiusSetup", false);
}
}
@@ -1,6 +1,8 @@
package io.xpipe.app.terminal;
import io.xpipe.app.comp.base.MarkdownComp;
import io.xpipe.app.comp.base.ModalButton;
import io.xpipe.app.comp.base.ModalOverlay;
import io.xpipe.app.core.AppCache;
import io.xpipe.app.core.AppI18n;
import io.xpipe.app.core.window.AppWindowHelper;
@@ -14,6 +16,8 @@ import javafx.scene.control.Alert;
import javafx.scene.control.ButtonBar;
import javafx.scene.control.ButtonType;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Optional;
@@ -84,24 +88,14 @@ public class XShellTerminalType extends ExternalTerminalType.WindowsType {
var b = SshLocalBridge.get();
var keyName = b.getIdentityKey().getFileName().toString();
var r = AppWindowHelper.showBlockingAlert(alert -> {
alert.setTitle(AppI18n.get("xshellSetup"));
alert.setAlertType(Alert.AlertType.NONE);
var activated =
AppI18n.get().getMarkdownDocumentation("app:xshellSetup").formatted(b.getIdentityKey(), keyName);
var markdown = new MarkdownComp(activated, s -> s)
.prefWidth(450)
.prefHeight(400)
.createRegion();
alert.getDialogPane().setContent(markdown);
alert.getButtonTypes().add(new ButtonType(AppI18n.get("ok"), ButtonBar.ButtonData.OK_DONE));
});
r.filter(buttonType -> buttonType.getButtonData().isDefaultButton());
r.ifPresent(buttonType -> {
var activated = AppI18n.get()
.getMarkdownDocumentation("app:xshellSetup")
.formatted(b.getIdentityKey(), keyName);
var modal = ModalOverlay.of("xshellSetup", new MarkdownComp(activated, s -> s).prefWidth(450));
modal.addButton(ModalButton.ok(() -> {
AppCache.update("xshellSetup", true);
});
return r.isPresent();
}));
modal.showAndWait();
return AppCache.getBoolean("xshellSetup", false);
}
}
-4
View File
@@ -146,10 +146,6 @@ project.ext {
"-Djavafx.preloader=io.xpipe.app.core.AppPreloader",
"-Djdk.virtualThreadScheduler.parallelism=8"
]
// Disable this on Windows for now as it requires Windows 10+
if (org.gradle.internal.os.OperatingSystem.current().isLinux() || org.gradle.internal.os.OperatingSystem.current().isMacOsX()) {
jvmRunArgs += ['-XX:+UseZGC']
}
if (org.gradle.internal.os.OperatingSystem.current().isMacOsX()) {
jvmRunArgs += ["-Dapple.awt.application.appearance=system"]
}
+1 -1
View File
@@ -1 +1 @@
14.0-25
14.0-26