Some UI reorganization [release]

This commit is contained in:
crschnick 2023-03-28 10:21:12 +00:00
parent 3ebe0d4639
commit 1eabf90a62
5 changed files with 38 additions and 26 deletions

View file

@ -7,6 +7,7 @@ import io.xpipe.app.core.mode.OperationMode;
import io.xpipe.app.fxcomps.SimpleComp;
import io.xpipe.app.issue.ErrorEvent;
import io.xpipe.app.issue.UserReportComp;
import io.xpipe.app.prefs.AppPrefs;
import io.xpipe.app.util.*;
import io.xpipe.core.impl.FileNames;
import io.xpipe.core.process.OsType;
@ -18,7 +19,7 @@ public class BrowseDirectoryComp extends SimpleComp {
@Override
protected Region createSimple() {
return new DynamicOptionsBuilder(false)
var b = new DynamicOptionsBuilder(false)
.addComp(
"issueReporter",
new ButtonComp(AppI18n.observable("reportIssue"), () -> {
@ -37,27 +38,29 @@ public class BrowseDirectoryComp extends SimpleComp {
.resolve("xpipe.log")
.toString());
}),
null)
.addComp(
"launchDebugMode",
new ButtonComp(AppI18n.observable("launchDebugMode"), () -> {
OperationMode.executeAfterShutdown(() -> {
try (var sc = ShellStore.createLocal().create().start()) {
var script = FileNames.join(
XPipeInstallation.getCurrentInstallationBasePath()
.toString(),
XPipeInstallation.getDaemonDebugScriptPath(sc.getOsType()));
if (sc.getOsType().equals(OsType.WINDOWS)) {
sc.executeSimpleCommand(ScriptHelper.createDetachCommand(sc, "\"" + script + "\""));
} else {
TerminalHelper.open("X-Pipe Debug", "\"" + script + "\"");
}
null);
if (AppPrefs.get().developerMode().getValue()) {
b.addComp(
"launchDebugMode",
new ButtonComp(AppI18n.observable("launchDebugMode"), () -> {
OperationMode.executeAfterShutdown(() -> {
try (var sc = ShellStore.createLocal().create().start()) {
var script = FileNames.join(
XPipeInstallation.getCurrentInstallationBasePath()
.toString(),
XPipeInstallation.getDaemonDebugScriptPath(sc.getOsType()));
if (sc.getOsType().equals(OsType.WINDOWS)) {
sc.executeSimpleCommand(ScriptHelper.createDetachCommand(sc, "\"" + script + "\""));
} else {
TerminalHelper.open("X-Pipe Debug", "\"" + script + "\"");
}
});
DesktopHelper.browsePath(AppLogs.get().getSessionLogsDirectory());
}),
null)
.addComp(
}
});
DesktopHelper.browsePath(AppLogs.get().getSessionLogsDirectory());
}),
null);
}
return b.addComp(
"installationFiles",
new ButtonComp(AppI18n.observable("openInstallationDirectory"), () -> {
DesktopHelper.browsePath(XPipeInstallation.getCurrentInstallationBasePath());

View file

@ -34,21 +34,28 @@ public class StoreCreationBarComp extends SimpleComp {
.shortcut(new KeyCodeCombination(KeyCode.C, KeyCombination.SHORTCUT_DOWN))
.apply(new FancyTooltipAugment<>("addCommand"));
var newShellStore = new ButtonComp(
AppI18n.observable("addHost"), new FontIcon("mdi2h-home-plus-outline"), () -> {
var newHostStore = new ButtonComp(
AppI18n.observable("addHost"), new FontIcon("mdi2h-home-plus"), () -> {
GuiDsStoreCreator.showCreation(v -> v.getDisplayCategory().equals(DataStoreProvider.DisplayCategory.HOST));
})
.shortcut(new KeyCodeCombination(KeyCode.H, KeyCombination.SHORTCUT_DOWN))
.apply(new FancyTooltipAugment<>("addHost"));
var newShellStore = new ButtonComp(
AppI18n.observable("addShell"), new FontIcon("mdi2t-text-box-multiple"), () -> {
GuiDsStoreCreator.showCreation(v -> v.getDisplayCategory().equals(DataStoreProvider.DisplayCategory.SHELL));
})
.shortcut(new KeyCodeCombination(KeyCode.S, KeyCombination.SHORTCUT_DOWN))
.apply(new FancyTooltipAugment<>("addShell"));
var newDbStore = new ButtonComp(
AppI18n.observable("addDatabase"), new FontIcon("mdi2d-database-plus-outline"), () -> {
AppI18n.observable("addDatabase"), new FontIcon("mdi2d-database-plus"), () -> {
GuiDsStoreCreator.showCreation(v -> v.getDisplayCategory().equals(DataStoreProvider.DisplayCategory.DATABASE));
})
.shortcut(new KeyCodeCombination(KeyCode.D, KeyCombination.SHORTCUT_DOWN))
.apply(new FancyTooltipAugment<>("addDatabase"));
var box = new VerticalComp(List.of(newShellStore, newDbStore, newStreamStore));
var box = new VerticalComp(List.of(newHostStore, newShellStore, newStreamStore, newDbStore));
box.apply(s -> AppFont.medium(s.get()));
var bar = box.createRegion();
bar.getStyleClass().add("bar");

View file

@ -131,6 +131,7 @@ public interface DataStoreProvider {
enum DisplayCategory {
HOST,
DATABASE,
SHELL,
COMMAND,
OTHER;
}

View file

@ -36,6 +36,7 @@ clean=Clean
refresh=Refresh
addDatabase=Add Database ...
addHost=Add Host ...
addShell=Add Shell ...
addCommand=Add Command ...
addOther=Add Other ...
addStreamTitle=Add Stream Store

View file

@ -1 +1 @@
0.5.21
0.5.22