mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-25 09:00:26 +00:00
Various small UI improvements
This commit is contained in:
parent
7605a4331a
commit
4689bcc2aa
9 changed files with 65 additions and 52 deletions
|
@ -22,6 +22,7 @@ import javafx.application.Platform;
|
|||
import javafx.beans.binding.Bindings;
|
||||
import javafx.beans.property.SimpleBooleanProperty;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.beans.value.ObservableBooleanValue;
|
||||
import javafx.collections.ListChangeListener;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Orientation;
|
||||
|
@ -29,10 +30,7 @@ import javafx.geometry.Pos;
|
|||
import javafx.scene.Node;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.input.DragEvent;
|
||||
import javafx.scene.layout.HBox;
|
||||
import javafx.scene.layout.Priority;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.scene.layout.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -89,7 +87,7 @@ public class BrowserComp extends SimpleComp {
|
|||
.widthProperty()
|
||||
.addListener(
|
||||
// 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);
|
||||
r.getStyleClass().add("browser");
|
||||
|
@ -137,10 +135,10 @@ public class BrowserComp extends SimpleComp {
|
|||
}
|
||||
|
||||
private Node createTabs() {
|
||||
var multi = new MultiContentComp(Map.of(
|
||||
var multi = new MultiContentComp(Map.<Comp<?>, ObservableBooleanValue>of(
|
||||
Comp.of(() -> createTabPane()),
|
||||
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()))));
|
||||
return multi.createRegion();
|
||||
}
|
||||
|
|
|
@ -71,11 +71,15 @@ public class BrowserModel {
|
|||
|
||||
public void restoreState(BrowserSavedState state) {
|
||||
state.getLastSystems().forEach(e -> {
|
||||
restoreState(e, null);
|
||||
});
|
||||
}
|
||||
|
||||
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(), new SimpleBooleanProperty());
|
||||
});
|
||||
entry.getName(), entry.getStore().asNeeded(), e.getPath(), busy);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -1,18 +1,23 @@
|
|||
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.fxcomps.SimpleComp;
|
||||
import io.xpipe.app.fxcomps.impl.FancyTooltipAugment;
|
||||
import io.xpipe.app.fxcomps.impl.PrettyImageComp;
|
||||
import io.xpipe.app.storage.DataStorage;
|
||||
import javafx.beans.property.SimpleStringProperty;
|
||||
import javafx.geometry.Insets;
|
||||
import javafx.geometry.Orientation;
|
||||
import javafx.scene.control.Button;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.ScrollPane;
|
||||
import javafx.scene.control.Separator;
|
||||
import javafx.scene.layout.Region;
|
||||
import javafx.scene.layout.VBox;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import org.kordamp.ikonli.javafx.FontIcon;
|
||||
|
||||
public class BrowserWelcomeComp extends SimpleComp {
|
||||
|
||||
|
@ -29,6 +34,7 @@ public class BrowserWelcomeComp extends SimpleComp {
|
|||
var welcome = new BrowserGreetingComp().createSimple();
|
||||
|
||||
var vbox = new VBox(welcome);
|
||||
vbox.setMaxWidth(600);
|
||||
vbox.setPadding(new Insets(40, 40, 40, 50));
|
||||
vbox.setSpacing(18);
|
||||
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:");
|
||||
header.getStyleClass().add(Styles.TEXT_MUTED);
|
||||
AppFont.header(header);
|
||||
vbox.getChildren().add(header);
|
||||
|
||||
var storeList = new VBox();
|
||||
storeList.setPadding(new Insets(0, 0, 0, 10));
|
||||
storeList.setSpacing(8);
|
||||
state.getLastSystems().forEach(e-> {
|
||||
var entry = DataStorage.get().getStoreEntry(e.getUuid());
|
||||
|
@ -53,31 +59,29 @@ public class BrowserWelcomeComp extends SimpleComp {
|
|||
|
||||
var graphic =
|
||||
entry.get().getProvider().getDisplayIconFileName(entry.get().getStore());
|
||||
var view = new PrettyImageComp(new SimpleStringProperty(graphic), 24, 24);
|
||||
var l = new Label(entry.get().getName() + (e.getPath() != null ? ": " + e.getPath() : ""), view.createRegion());
|
||||
l.setGraphicTextGap(10);
|
||||
storeList.getChildren().add(l);
|
||||
});
|
||||
|
||||
vbox.getChildren().add(storeList);
|
||||
vbox.getChildren().add(new Spacer(20));
|
||||
|
||||
var restoreLabel = new Label("Do you want to restore these sessions?");
|
||||
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);
|
||||
var view = new PrettyImageComp(new SimpleStringProperty(graphic), 45, 45);
|
||||
var openButton = new Button(null, new FontIcon("mdmz-restore"));
|
||||
new FancyTooltipAugment<>("restore").augment(openButton);
|
||||
openButton.getStyleClass().addAll(Styles.FLAT, Styles.BUTTON_CIRCLE);
|
||||
openButton.setOnAction(event -> {
|
||||
model.restoreState(e, openButton.disableProperty());
|
||||
event.consume();
|
||||
});
|
||||
vbox.getChildren().add(restoreButton);
|
||||
var tile = new Tile(entry.get().getName(), e.getPath(), view.createRegion());
|
||||
tile.setAction(openButton);
|
||||
storeList.getChildren().add(tile);
|
||||
});
|
||||
|
||||
var sp = new ScrollPane(storeList);
|
||||
sp.setFitToWidth(true);
|
||||
vbox.getChildren().add(sp);
|
||||
vbox.getChildren().add(new Separator(Orientation.HORIZONTAL));
|
||||
|
||||
var tile = new TileButtonComp("restore", "restoreAllSessions", "mdmz-restore", actionEvent -> {
|
||||
model.restoreState(state);
|
||||
actionEvent.consume();
|
||||
}).grow(true, false);
|
||||
vbox.getChildren().add(tile.createRegion());
|
||||
|
||||
return vbox;
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ public class CustomFormRenderer extends PreferencesFxFormRenderer {
|
|||
var descriptionLabel = new Label();
|
||||
AppFont.medium(descriptionLabel);
|
||||
descriptionLabel.setWrapText(true);
|
||||
descriptionLabel.setMaxWidth(700);
|
||||
descriptionLabel.setMaxWidth(800);
|
||||
descriptionLabel
|
||||
.disableProperty()
|
||||
.bind(c.getFieldLabel().disabledProperty());
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package io.xpipe.app.prefs;
|
||||
|
||||
import atlantafx.base.controls.Tile;
|
||||
import io.xpipe.app.core.App;
|
||||
import io.xpipe.app.core.AppFont;
|
||||
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.SimpleComp;
|
||||
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.image.ImageView;
|
||||
import javafx.scene.layout.Region;
|
||||
|
@ -24,26 +25,22 @@ public class PropertiesComp extends SimpleComp {
|
|||
var label = new Label(AppI18n.get("xPipeClient"), image);
|
||||
label.getStyleClass().add("header");
|
||||
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)
|
||||
.name("build")
|
||||
.addComp(
|
||||
AppI18n.observable("version"),
|
||||
new LabelComp(AppProperties.get().getVersion() + " ("
|
||||
+ AppProperties.get().getArch() + ")"),
|
||||
null)
|
||||
.addComp(
|
||||
AppI18n.observable("build"),
|
||||
new LabelComp(AppProperties.get().getBuild()),
|
||||
null)
|
||||
.name("runtimeVersion")
|
||||
.addComp(
|
||||
AppI18n.observable("runtimeVersion"),
|
||||
new LabelComp(System.getProperty("java.vm.version")),
|
||||
null)
|
||||
.name("virtualMachine")
|
||||
.addComp(
|
||||
AppI18n.observable("virtualMachine"),
|
||||
new LabelComp(System.getProperty("java.vm.vendor") + " " + System.getProperty("java.vm.name")),
|
||||
null)
|
||||
.buildComp();
|
||||
|
|
|
@ -64,7 +64,7 @@ developerModeDescription=When enabled, you will have access to a variety of addi
|
|||
editor=Editor
|
||||
custom=Custom
|
||||
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
|
||||
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++
|
||||
|
@ -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.
|
||||
program=Program
|
||||
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
|
||||
powershell=Powershell
|
||||
pwsh=Powershell Core
|
||||
|
|
|
@ -143,7 +143,7 @@ gedit=GEdit
|
|||
leafpad=Leafpad
|
||||
mousepad=Mousepad
|
||||
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
|
||||
sublime=Sublime Text
|
||||
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:
|
||||
license=License
|
||||
installRequired=Installation Required
|
||||
restore=Restore
|
||||
restoreAllSessions=Restore all sessions
|
||||
|
||||
|
||||
|
|
|
@ -16,6 +16,10 @@
|
|||
-fx-graphic-text-gap: 0.8em;
|
||||
}
|
||||
|
||||
.properties-comp .tile > * {
|
||||
-fx-padding: 0.6em 0 0.6em 0;
|
||||
}
|
||||
|
||||
.about-tab .information {
|
||||
-fx-spacing: 2em;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,10 @@
|
|||
-fx-padding: 1em;
|
||||
}
|
||||
|
||||
.browser .tile > * {
|
||||
-fx-padding: 0.6em 0 0.6em 0;
|
||||
}
|
||||
|
||||
.browser .overview {
|
||||
-fx-spacing: 1.5em;
|
||||
-fx-padding: 1.5em;
|
||||
|
|
Loading…
Reference in a new issue