Browse Source

UI refinements, fixes #166

Sebastian Stenzel 9 years ago
parent
commit
d0afeab74b

+ 5 - 0
main/ui/src/main/java/org/cryptomator/ui/controllers/MainController.java

@@ -36,6 +36,7 @@ import org.slf4j.LoggerFactory;
 import dagger.Lazy;
 import javafx.application.Platform;
 import javafx.beans.binding.Binding;
+import javafx.beans.binding.Bindings;
 import javafx.beans.binding.BooleanBinding;
 import javafx.beans.property.ObjectProperty;
 import javafx.beans.property.SimpleObjectProperty;
@@ -120,6 +121,9 @@ public class MainController extends AbstractFXMLViewController {
 	@FXML
 	private Pane contentPane;
 
+	@FXML
+	private Pane emptyListInstructions;
+
 	@Override
 	public void initialize() {
 		vaultList.setItems(vaults);
@@ -127,6 +131,7 @@ public class MainController extends AbstractFXMLViewController {
 		activeController.set(welcomeController.get());
 		selectedVault.bind(vaultList.getSelectionModel().selectedItemProperty());
 		removeVaultButton.disableProperty().bind(canEditSelectedVault);
+		emptyListInstructions.visibleProperty().bind(Bindings.isEmpty(vaults));
 
 		EasyBind.subscribe(activeController, this::activeControllerDidChange);
 		EasyBind.subscribe(selectedVault, this::selectedVaultDidChange);

+ 10 - 0
main/ui/src/main/java/org/cryptomator/ui/controllers/SettingsController.java

@@ -9,6 +9,7 @@
 package org.cryptomator.ui.controllers;
 
 import java.net.URL;
+import java.util.Optional;
 import java.util.ResourceBundle;
 
 import javax.inject.Inject;
@@ -21,6 +22,7 @@ import org.fxmisc.easybind.EasyBind;
 
 import javafx.fxml.FXML;
 import javafx.scene.control.CheckBox;
+import javafx.scene.control.Label;
 import javafx.scene.control.TextField;
 import javafx.scene.input.KeyEvent;
 
@@ -42,12 +44,16 @@ public class SettingsController extends AbstractFXMLViewController {
 	@FXML
 	private TextField portField;
 
+	@FXML
+	private Label versionLabel;
+
 	@Override
 	public void initialize() {
 		checkForUpdatesCheckbox.setDisable(areUpdatesManagedExternally());
 		checkForUpdatesCheckbox.setSelected(settings.isCheckForUpdatesEnabled() && !areUpdatesManagedExternally());
 		portField.setText(String.valueOf(settings.getPort()));
 		portField.addEventFilter(KeyEvent.KEY_TYPED, this::filterNumericKeyEvents);
+		versionLabel.setText(String.format(localization.getString("settings.version.label"), applicationVersion().orElse("SNAPSHOT")));
 
 		EasyBind.subscribe(portField.textProperty(), this::portDidChange);
 		EasyBind.subscribe(checkForUpdatesCheckbox.selectedProperty(), settings::setCheckForUpdatesEnabled);
@@ -63,6 +69,10 @@ public class SettingsController extends AbstractFXMLViewController {
 		return localization;
 	}
 
+	private Optional<String> applicationVersion() {
+		return Optional.ofNullable(getClass().getPackage().getImplementationVersion());
+	}
+
 	private void portDidChange(String newValue) {
 		try {
 			int port = Integer.parseInt(newValue);

+ 12 - 1
main/ui/src/main/resources/fxml/main.fxml

@@ -20,6 +20,9 @@
 <?import javafx.scene.control.Button?>
 <?import javafx.scene.control.Separator?>
 <?import javafx.scene.control.Label?>
+<?import javafx.scene.layout.StackPane?>
+<?import javafx.scene.layout.AnchorPane?>
+<?import javafx.scene.shape.Arc?>
 
 <HBox fx:id="rootPane" prefHeight="440.0" prefWidth="652.0" spacing="12.0" xmlns:fx="http://javafx.com/fxml" cacheShape="true" cache="true">
 
@@ -49,7 +52,15 @@
 	</fx:define>
 
 	<VBox prefWidth="200.0" cacheShape="true" cache="true">
-		<ListView fx:id="vaultList" VBox.vgrow="ALWAYS" focusTraversable="false" cacheShape="true" cache="true"/>
+		<StackPane VBox.vgrow="ALWAYS" cacheShape="true" cache="true">
+			<ListView fx:id="vaultList" focusTraversable="false" cacheShape="true" cache="true"/>
+			<AnchorPane fx:id="emptyListInstructions" cacheShape="true" cache="true">
+				<HBox AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="10.0" AnchorPane.bottomAnchor="100.0" alignment="CENTER" cacheShape="true" cache="true">
+					<Label textAlignment="CENTER" text="%main.emptyListInstructions" wrapText="true" cacheShape="true" cache="true"/>
+				</HBox>
+				<Arc AnchorPane.bottomAnchor="5.0" type="OPEN" centerX="-10.0" centerY="0.0" radiusY="100.0" radiusX="60.0" startAngle="0" length="-60.0" strokeWidth="1" stroke="BLACK" fill="TRANSPARENT"/>
+			</AnchorPane>
+		</StackPane>
 		<ToolBar VBox.vgrow="NEVER" styleClass="list-related-toolbar" cacheShape="true" cache="true">
 			<items>
 				<ToggleButton text="&#xf489;" styleClass="ionicons" fx:id="addVaultButton" onAction="#didClickAddVault" focusTraversable="false" cacheShape="true" cache="true"/>

+ 3 - 2
main/ui/src/main/resources/fxml/settings.fxml

@@ -16,8 +16,9 @@
 <?import javafx.scene.control.TextField?>
 <?import javafx.scene.layout.VBox?>
 
-<VBox prefWidth="400.0" alignment="TOP_CENTER" spacing="12.0" cacheShape="true" cache="true">
-	<GridPane VBox.vgrow="ALWAYS" vgap="12.0" hgap="12.0" xmlns:fx="http://javafx.com/fxml" cacheShape="true" cache="true">
+<VBox prefWidth="400.0" alignment="TOP_CENTER" spacing="12.0" xmlns:fx="http://javafx.com/fxml" cacheShape="true" cache="true">
+	<Label VBox.vgrow="NEVER" fx:id="versionLabel" alignment="CENTER" cacheShape="true" cache="true" />
+	<GridPane VBox.vgrow="ALWAYS" vgap="12.0" hgap="12.0" cacheShape="true" cache="true">
 		<padding>
 			<Insets top="24.0" right="12.0" bottom="24.0" left="12.0" />
 		</padding>

+ 6 - 3
main/ui/src/main/resources/fxml/unlocked.fxml

@@ -28,9 +28,12 @@
 	<fx:define>
 		<ContextMenu fx:id="moreOptionsMenu">
 			<items>
-				<MenuItem text="%unlocked.moreOptions.reveal" onAction="#didClickRevealVault"/>
-				<!-- Future use: -->
-				<MenuItem text="%unlocked.moreOptions.copyUrl" onAction="#didClickCopyUrl"/>
+				<MenuItem text="%unlocked.moreOptions.reveal" onAction="#didClickRevealVault">
+					<graphic><Label text="&#xf133;" styleClass="ionicons"/></graphic>
+				</MenuItem>
+				<MenuItem text="%unlocked.moreOptions.copyUrl" onAction="#didClickCopyUrl">
+					<graphic><Label text="&#xf376;" styleClass="ionicons"/></graphic>
+				</MenuItem>
 			</items>
 		</ContextMenu>
 	</fx:define>

+ 4 - 2
main/ui/src/main/resources/fxml/welcome.fxml

@@ -20,7 +20,7 @@
 
 <VBox prefWidth="400.0" prefHeight="400.0" spacing="24.0" alignment="CENTER" xmlns:fx="http://javafx.com/fxml" cacheShape="true" cache="true">
 	
-	<VBox fx:id="checkForUpdatesContainer" spacing="6.0" alignment="CENTER" cacheShape="true" cache="true">
+	<VBox fx:id="checkForUpdatesContainer" spacing="6.0" alignment="CENTER" cacheShape="true" cache="true" prefHeight="50.0">
 		<HBox alignment="CENTER" spacing="5.0" cacheShape="true" cache="true">
 			<Label fx:id="checkForUpdatesStatus" cacheShape="true" cache="true" />
 			<ProgressIndicator fx:id="checkForUpdatesIndicator" progress="-1" prefWidth="15.0" prefHeight="15.0" cacheShape="true" cache="true" cacheHint="SPEED" />
@@ -28,8 +28,10 @@
 		<Hyperlink alignment="CENTER" fx:id="updateLink" onAction="#didClickUpdateLink" cacheShape="true" cache="true" />
 	</VBox>
 	
-	<ImageView fitHeight="200.0" preserveRatio="true" smooth="false" cache="true">
+	<ImageView fitHeight="200.0" preserveRatio="true" smooth="false" cache="true" style="-fx-background-color: green;">
 		<Image url="/bot_welcome.png"/>
 	</ImageView>
+	
+	<VBox prefHeight="50.0"/>
 
 </VBox>

+ 2 - 0
main/ui/src/main/resources/localization.properties

@@ -10,6 +10,7 @@
 app.name=Cryptomator
 
 # main.fxml
+main.emptyListInstructions=Click here to add a vault
 main.directoryList.contextMenu.remove=Remove from list
 main.directoryList.contextMenu.changePassword=Change password
 main.addDirectory.contextMenu.new=Create new vault
@@ -73,6 +74,7 @@ macWarnings.moreInformationButton=Learn more
 macWarnings.whitelistButton=Decrypt selected anyway
 
 # settings.fxml
+settings.version.label=Version %s
 settings.checkForUpdates.label=Check for updates
 settings.port.label=WebDAV Port *
 settings.port.prompt=0 = Choose automatically

+ 2 - 0
main/ui/src/main/resources/localization_de.properties

@@ -10,6 +10,7 @@
 app.name=Cryptomator
 
 # main.fxml
+main.emptyListInstructions=Klicken Sie hier, um neue Tresore hinzuzufügen
 main.directoryList.contextMenu.remove=Aus Liste entfernen
 main.directoryList.contextMenu.changePassword=Passwort ändern
 main.addDirectory.contextMenu.new=Tresor erstellen
@@ -73,6 +74,7 @@ macWarnings.moreInformationButton=Mehr erfahren
 macWarnings.whitelistButton=Trotzdem entschlüsseln
 
 # settings.fxml
+settings.version.label=Version %s
 settings.checkForUpdates.label=Auf Updates prüfen
 settings.port.label=WebDAV Port *
 settings.port.prompt=0 = Automatisch wählen