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

View file

@ -34,21 +34,28 @@ public class StoreCreationBarComp extends SimpleComp {
.shortcut(new KeyCodeCombination(KeyCode.C, KeyCombination.SHORTCUT_DOWN)) .shortcut(new KeyCodeCombination(KeyCode.C, KeyCombination.SHORTCUT_DOWN))
.apply(new FancyTooltipAugment<>("addCommand")); .apply(new FancyTooltipAugment<>("addCommand"));
var newShellStore = new ButtonComp( var newHostStore = new ButtonComp(
AppI18n.observable("addHost"), new FontIcon("mdi2h-home-plus-outline"), () -> { AppI18n.observable("addHost"), new FontIcon("mdi2h-home-plus"), () -> {
GuiDsStoreCreator.showCreation(v -> v.getDisplayCategory().equals(DataStoreProvider.DisplayCategory.HOST)); GuiDsStoreCreator.showCreation(v -> v.getDisplayCategory().equals(DataStoreProvider.DisplayCategory.HOST));
}) })
.shortcut(new KeyCodeCombination(KeyCode.H, KeyCombination.SHORTCUT_DOWN)) .shortcut(new KeyCodeCombination(KeyCode.H, KeyCombination.SHORTCUT_DOWN))
.apply(new FancyTooltipAugment<>("addHost")); .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( 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)); GuiDsStoreCreator.showCreation(v -> v.getDisplayCategory().equals(DataStoreProvider.DisplayCategory.DATABASE));
}) })
.shortcut(new KeyCodeCombination(KeyCode.D, KeyCombination.SHORTCUT_DOWN)) .shortcut(new KeyCodeCombination(KeyCode.D, KeyCombination.SHORTCUT_DOWN))
.apply(new FancyTooltipAugment<>("addDatabase")); .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())); box.apply(s -> AppFont.medium(s.get()));
var bar = box.createRegion(); var bar = box.createRegion();
bar.getStyleClass().add("bar"); bar.getStyleClass().add("bar");

View file

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

View file

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

View file

@ -1 +1 @@
0.5.21 0.5.22