Various small UI improvements

This commit is contained in:
crschnick 2023-06-19 09:03:34 +00:00
parent 7605a4331a
commit 4689bcc2aa
9 changed files with 65 additions and 52 deletions

View file

@ -22,6 +22,7 @@ import javafx.application.Platform;
import javafx.beans.binding.Bindings; import javafx.beans.binding.Bindings;
import javafx.beans.property.SimpleBooleanProperty; import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.SimpleStringProperty;
import javafx.beans.value.ObservableBooleanValue;
import javafx.collections.ListChangeListener; import javafx.collections.ListChangeListener;
import javafx.geometry.Insets; import javafx.geometry.Insets;
import javafx.geometry.Orientation; import javafx.geometry.Orientation;
@ -29,10 +30,7 @@ import javafx.geometry.Pos;
import javafx.scene.Node; import javafx.scene.Node;
import javafx.scene.control.*; import javafx.scene.control.*;
import javafx.scene.input.DragEvent; import javafx.scene.input.DragEvent;
import javafx.scene.layout.HBox; import javafx.scene.layout.*;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -89,7 +87,7 @@ public class BrowserComp extends SimpleComp {
.widthProperty() .widthProperty()
.addListener( .addListener(
// set sidebar width in pixels depending on split pane width // set sidebar width in pixels depending on split pane width
(obs, old, val) -> splitPane.setDividerPosition(0, 280 / splitPane.getWidth())); (obs, old, val) -> splitPane.setDividerPosition(0, 320 / splitPane.getWidth()));
var r = addBottomBar(splitPane); var r = addBottomBar(splitPane);
r.getStyleClass().add("browser"); r.getStyleClass().add("browser");
@ -137,10 +135,10 @@ public class BrowserComp extends SimpleComp {
} }
private Node createTabs() { private Node createTabs() {
var multi = new MultiContentComp(Map.of( var multi = new MultiContentComp(Map.<Comp<?>, ObservableBooleanValue>of(
Comp.of(() -> createTabPane()), Comp.of(() -> createTabPane()),
BindingsHelper.persist(Bindings.isNotEmpty(model.getOpenFileSystems())), BindingsHelper.persist(Bindings.isNotEmpty(model.getOpenFileSystems())),
new BrowserWelcomeComp(model), new BrowserWelcomeComp(model).apply(struc -> StackPane.setAlignment(struc.get(), Pos.CENTER_LEFT)),
BindingsHelper.persist(Bindings.isEmpty(model.getOpenFileSystems())))); BindingsHelper.persist(Bindings.isEmpty(model.getOpenFileSystems()))));
return multi.createRegion(); return multi.createRegion();
} }

View file

@ -71,11 +71,15 @@ public class BrowserModel {
public void restoreState(BrowserSavedState state) { public void restoreState(BrowserSavedState state) {
state.getLastSystems().forEach(e -> { state.getLastSystems().forEach(e -> {
var storageEntry = DataStorage.get().getStoreEntry(e.getUuid()); restoreState(e, null);
storageEntry.ifPresent(entry -> { });
openFileSystemAsync( }
entry.getName(), entry.getStore().asNeeded(), e.getPath(), new SimpleBooleanProperty());
}); public void restoreState(BrowserSavedState.Entry e, BooleanProperty busy) {
var storageEntry = DataStorage.get().getStoreEntry(e.getUuid());
storageEntry.ifPresent(entry -> {
openFileSystemAsync(
entry.getName(), entry.getStore().asNeeded(), e.getPath(), busy);
}); });
} }

View file

@ -1,18 +1,23 @@
package io.xpipe.app.browser; package io.xpipe.app.browser;
import atlantafx.base.controls.Spacer; import atlantafx.base.controls.Tile;
import atlantafx.base.theme.Styles;
import io.xpipe.app.comp.base.TileButtonComp;
import io.xpipe.app.core.AppFont; import io.xpipe.app.core.AppFont;
import io.xpipe.app.fxcomps.SimpleComp; import io.xpipe.app.fxcomps.SimpleComp;
import io.xpipe.app.fxcomps.impl.FancyTooltipAugment;
import io.xpipe.app.fxcomps.impl.PrettyImageComp; import io.xpipe.app.fxcomps.impl.PrettyImageComp;
import io.xpipe.app.storage.DataStorage; import io.xpipe.app.storage.DataStorage;
import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.SimpleStringProperty;
import javafx.geometry.Insets; import javafx.geometry.Insets;
import javafx.geometry.Orientation;
import javafx.scene.control.Button; import javafx.scene.control.Button;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.scene.control.ScrollPane;
import javafx.scene.control.Separator;
import javafx.scene.layout.Region; import javafx.scene.layout.Region;
import javafx.scene.layout.VBox; import javafx.scene.layout.VBox;
import org.kordamp.ikonli.javafx.FontIcon;
import java.util.concurrent.atomic.AtomicBoolean;
public class BrowserWelcomeComp extends SimpleComp { public class BrowserWelcomeComp extends SimpleComp {
@ -29,6 +34,7 @@ public class BrowserWelcomeComp extends SimpleComp {
var welcome = new BrowserGreetingComp().createSimple(); var welcome = new BrowserGreetingComp().createSimple();
var vbox = new VBox(welcome); var vbox = new VBox(welcome);
vbox.setMaxWidth(600);
vbox.setPadding(new Insets(40, 40, 40, 50)); vbox.setPadding(new Insets(40, 40, 40, 50));
vbox.setSpacing(18); vbox.setSpacing(18);
if (state == null) { if (state == null) {
@ -39,11 +45,11 @@ public class BrowserWelcomeComp extends SimpleComp {
} }
var header = new Label("Last time you were connected to the following systems:"); var header = new Label("Last time you were connected to the following systems:");
header.getStyleClass().add(Styles.TEXT_MUTED);
AppFont.header(header); AppFont.header(header);
vbox.getChildren().add(header); vbox.getChildren().add(header);
var storeList = new VBox(); var storeList = new VBox();
storeList.setPadding(new Insets(0, 0, 0, 10));
storeList.setSpacing(8); storeList.setSpacing(8);
state.getLastSystems().forEach(e-> { state.getLastSystems().forEach(e-> {
var entry = DataStorage.get().getStoreEntry(e.getUuid()); var entry = DataStorage.get().getStoreEntry(e.getUuid());
@ -53,31 +59,29 @@ public class BrowserWelcomeComp extends SimpleComp {
var graphic = var graphic =
entry.get().getProvider().getDisplayIconFileName(entry.get().getStore()); entry.get().getProvider().getDisplayIconFileName(entry.get().getStore());
var view = new PrettyImageComp(new SimpleStringProperty(graphic), 24, 24); var view = new PrettyImageComp(new SimpleStringProperty(graphic), 45, 45);
var l = new Label(entry.get().getName() + (e.getPath() != null ? ": " + e.getPath() : ""), view.createRegion()); var openButton = new Button(null, new FontIcon("mdmz-restore"));
l.setGraphicTextGap(10); new FancyTooltipAugment<>("restore").augment(openButton);
storeList.getChildren().add(l); openButton.getStyleClass().addAll(Styles.FLAT, Styles.BUTTON_CIRCLE);
openButton.setOnAction(event -> {
model.restoreState(e, openButton.disableProperty());
event.consume();
});
var tile = new Tile(entry.get().getName(), e.getPath(), view.createRegion());
tile.setAction(openButton);
storeList.getChildren().add(tile);
}); });
vbox.getChildren().add(storeList); var sp = new ScrollPane(storeList);
vbox.getChildren().add(new Spacer(20)); sp.setFitToWidth(true);
vbox.getChildren().add(sp);
vbox.getChildren().add(new Separator(Orientation.HORIZONTAL));
var restoreLabel = new Label("Do you want to restore these sessions?"); var tile = new TileButtonComp("restore", "restoreAllSessions", "mdmz-restore", actionEvent -> {
AppFont.header(restoreLabel);
vbox.getChildren().add(restoreLabel);
var restoreButton = new Button("Restore sessions");
var done = new AtomicBoolean();
restoreButton.setOnAction(event -> {
if (done.get()) {
return;
}
done.set(true);
model.restoreState(state); model.restoreState(state);
event.consume(); actionEvent.consume();
}); }).grow(true, false);
vbox.getChildren().add(restoreButton); vbox.getChildren().add(tile.createRegion());
return vbox; return vbox;
} }

View file

@ -84,7 +84,7 @@ public class CustomFormRenderer extends PreferencesFxFormRenderer {
var descriptionLabel = new Label(); var descriptionLabel = new Label();
AppFont.medium(descriptionLabel); AppFont.medium(descriptionLabel);
descriptionLabel.setWrapText(true); descriptionLabel.setWrapText(true);
descriptionLabel.setMaxWidth(700); descriptionLabel.setMaxWidth(800);
descriptionLabel descriptionLabel
.disableProperty() .disableProperty()
.bind(c.getFieldLabel().disabledProperty()); .bind(c.getFieldLabel().disabledProperty());

View file

@ -1,5 +1,6 @@
package io.xpipe.app.prefs; package io.xpipe.app.prefs;
import atlantafx.base.controls.Tile;
import io.xpipe.app.core.App; import io.xpipe.app.core.App;
import io.xpipe.app.core.AppFont; import io.xpipe.app.core.AppFont;
import io.xpipe.app.core.AppI18n; import io.xpipe.app.core.AppI18n;
@ -7,7 +8,7 @@ import io.xpipe.app.core.AppProperties;
import io.xpipe.app.fxcomps.Comp; import io.xpipe.app.fxcomps.Comp;
import io.xpipe.app.fxcomps.SimpleComp; import io.xpipe.app.fxcomps.SimpleComp;
import io.xpipe.app.fxcomps.impl.LabelComp; import io.xpipe.app.fxcomps.impl.LabelComp;
import io.xpipe.app.util.DynamicOptionsBuilder; import io.xpipe.app.util.OptionsBuilder;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.scene.image.ImageView; import javafx.scene.image.ImageView;
import javafx.scene.layout.Region; import javafx.scene.layout.Region;
@ -24,26 +25,22 @@ public class PropertiesComp extends SimpleComp {
var label = new Label(AppI18n.get("xPipeClient"), image); var label = new Label(AppI18n.get("xPipeClient"), image);
label.getStyleClass().add("header"); label.getStyleClass().add("header");
AppFont.setSize(label, 5); AppFont.setSize(label, 5);
return label; return new Tile(AppI18n.get("xPipeClient"), "Version " + AppProperties.get().getVersion() + " ("
+ AppProperties.get().getArch() + ")", image);
}); });
var section = new DynamicOptionsBuilder(false) var section = new OptionsBuilder()
.addComp(title, null) .addComp(title, null)
.name("build")
.addComp( .addComp(
AppI18n.observable("version"),
new LabelComp(AppProperties.get().getVersion() + " ("
+ AppProperties.get().getArch() + ")"),
null)
.addComp(
AppI18n.observable("build"),
new LabelComp(AppProperties.get().getBuild()), new LabelComp(AppProperties.get().getBuild()),
null) null)
.name("runtimeVersion")
.addComp( .addComp(
AppI18n.observable("runtimeVersion"),
new LabelComp(System.getProperty("java.vm.version")), new LabelComp(System.getProperty("java.vm.version")),
null) null)
.name("virtualMachine")
.addComp( .addComp(
AppI18n.observable("virtualMachine"),
new LabelComp(System.getProperty("java.vm.vendor") + " " + System.getProperty("java.vm.name")), new LabelComp(System.getProperty("java.vm.vendor") + " " + System.getProperty("java.vm.name")),
null) null)
.buildComp(); .buildComp();

View file

@ -64,7 +64,7 @@ developerModeDescription=When enabled, you will have access to a variety of addi
editor=Editor editor=Editor
custom=Custom custom=Custom
customEditorCommand=Custom editor command customEditorCommand=Custom editor command
customEditorCommandDescription=The command to use to open the custom editor. The placeholder string $file will be replaced by the quoted absolute file name when called. customEditorCommandDescription=The command to execute to open the custom editor. The placeholder string $file will be replaced by the quoted absolute file name when called.
editorReloadTimeout=Editor reload timeout editorReloadTimeout=Editor reload timeout
editorReloadTimeoutDescription=The amount of milliseconds to wait before reading a file after it has been updated. This avoids issues in cases where your editor is slow at writing or releasing file locks. editorReloadTimeoutDescription=The amount of milliseconds to wait before reading a file after it has been updated. This avoids issues in cases where your editor is slow at writing or releasing file locks.
notepad++=Notepad++ notepad++=Notepad++
@ -95,7 +95,7 @@ terminalProgram=Default program
terminalProgramDescription=The default terminal to use when opening any kind of shell connection. This application is only used for display purposes, the started shell program depends on the shell connection itself. terminalProgramDescription=The default terminal to use when opening any kind of shell connection. This application is only used for display purposes, the started shell program depends on the shell connection itself.
program=Program program=Program
customTerminalCommand=Custom terminal command customTerminalCommand=Custom terminal command
customTerminalCommandDescription=The command to use to open the custom terminal. The placeholder string $cmd will be replaced by the quoted shell script file name when called. customTerminalCommandDescription=The command to execute to open the custom terminal. The placeholder string $cmd will be replaced by the quoted shell script file name when called.
cmd=cmd.exe cmd=cmd.exe
powershell=Powershell powershell=Powershell
pwsh=Powershell Core pwsh=Powershell Core

View file

@ -143,7 +143,7 @@ gedit=GEdit
leafpad=Leafpad leafpad=Leafpad
mousepad=Mousepad mousepad=Mousepad
pluma=Pluma pluma=Pluma
noTerminalSet=No terminal application has been set. Please do so in the settings menu. noTerminalSet=No terminal application has been set automatically. You can do so manually in the settings menu.
textEdit=Text Edit textEdit=Text Edit
sublime=Sublime Text sublime=Sublime Text
newTable=new_table newTable=new_table
@ -220,5 +220,7 @@ extensionInstallDescription=This action requires additional third party librarie
extensionInstallLicenseNote=By performing the download and automatic installation you agree to the terms of the third party licenses: extensionInstallLicenseNote=By performing the download and automatic installation you agree to the terms of the third party licenses:
license=License license=License
installRequired=Installation Required installRequired=Installation Required
restore=Restore
restoreAllSessions=Restore all sessions

View file

@ -16,6 +16,10 @@
-fx-graphic-text-gap: 0.8em; -fx-graphic-text-gap: 0.8em;
} }
.properties-comp .tile > * {
-fx-padding: 0.6em 0 0.6em 0;
}
.about-tab .information { .about-tab .information {
-fx-spacing: 2em; -fx-spacing: 2em;
} }

View file

@ -4,6 +4,10 @@
-fx-padding: 1em; -fx-padding: 1em;
} }
.browser .tile > * {
-fx-padding: 0.6em 0 0.6em 0;
}
.browser .overview { .browser .overview {
-fx-spacing: 1.5em; -fx-spacing: 1.5em;
-fx-padding: 1.5em; -fx-padding: 1.5em;