Jelajahi Sumber

- Added "remove vault" button to toolbar
- Using Ionicons in the toolbar now

Sebastian Stenzel 9 tahun lalu
induk
melakukan
c9564bae62

+ 6 - 1
NOTICE.md

@@ -4,7 +4,7 @@ Copyright (c) 2014, Sebastian Stenzel
 Cryptomator is licensed under the MIT license. The details can be found in the accompanying license file.
 
 ## Third party softwares
-Cryptomator uses third party softwares that may be licensed under different licenses.
+Cryptomator uses third party libraries and fonts that may be licensed under different licenses.
 
 ### AquaFX
 The ProgressIndicator in ui/src/main/resource/css/mac_theme.css contains code from the AquaFX project.
@@ -62,6 +62,11 @@ This product includes software developed at The Apache Software Foundation (http
 
 ResolverUtil.java Copyright 2005-2006 Tim Fennell
 
+### Ionicons
+Copyright (c) 2016 Drifty (http://drifty.com/)
+
+ionicons.ttf Licensed under the accompanying MIT license
+
 ### Jackrabbit WebDAV Library
 Copyright 2004-2014 The Apache Software Foundation
 

+ 3 - 1
main/ui/src/main/java/org/cryptomator/ui/MainApplication.java

@@ -29,6 +29,7 @@ import javafx.application.Application;
 import javafx.application.Platform;
 import javafx.fxml.FXMLLoader;
 import javafx.scene.image.Image;
+import javafx.scene.text.Font;
 import javafx.stage.Stage;
 
 public class MainApplication extends Application {
@@ -51,6 +52,7 @@ public class MainApplication extends Application {
 
 	@Override
 	public void start(final Stage primaryStage) throws IOException {
+		Font.loadFont(getClass().getResourceAsStream("/css/ionicons.ttf"), 12.0);
 		ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
 		FXMLLoader.setDefaultClassLoader(contextClassLoader);
 		Platform.runLater(() -> {
@@ -70,7 +72,7 @@ public class MainApplication extends Application {
 		final ResourceBundle rb = ResourceBundle.getBundle("localization");
 		primaryStage.setTitle(rb.getString("app.name"));
 		primaryStage.setResizable(false);
-		primaryStage.getIcons().add(new Image(MainApplication.class.getResourceAsStream("/window_icon.png"))); 
+		primaryStage.getIcons().add(new Image(MainApplication.class.getResourceAsStream("/window_icon.png")));
 		primaryStage.show();
 
 		ActiveWindowStyleSupport.startObservingFocus(primaryStage);

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

@@ -38,6 +38,7 @@ import javafx.event.ActionEvent;
 import javafx.fxml.FXML;
 import javafx.geometry.Side;
 import javafx.scene.Parent;
+import javafx.scene.control.Button;
 import javafx.scene.control.ContextMenu;
 import javafx.scene.control.ListCell;
 import javafx.scene.control.ListView;
@@ -70,6 +71,9 @@ public class MainController extends AbstractFXMLViewController {
 	@FXML
 	private ToggleButton addVaultButton;
 
+	@FXML
+	private Button removeVaultButton;
+
 	@FXML
 	private Pane contentPane;
 
@@ -110,6 +114,7 @@ public class MainController extends AbstractFXMLViewController {
 		vaultList.setItems(items);
 		vaultList.setCellFactory(this::createDirecoryListCell);
 		vaultList.getSelectionModel().getSelectedItems().addListener(this::selectedVaultDidChange);
+		removeVaultButton.disableProperty().bind(vaultList.getSelectionModel().selectedItemProperty().isNull());
 		this.showWelcomeView();
 	}
 

TEMPAT SAMPAH
main/ui/src/main/resources/css/ionicons.ttf


+ 22 - 4
main/ui/src/main/resources/css/linux_theme.css

@@ -166,20 +166,37 @@
 	-fx-alignment: CENTER_LEFT;
 }
 
-.tool-bar.list-related-toolbar .toggle-button {
-	-fx-padding: 0.4em 0.8em 0.4em 0.8em;
+.tool-bar.list-related-toolbar .spacer {
+	-fx-border-color: transparent COLOR_BORDER transparent transparent;
+    -fx-border-width: 1;
+}
+
+.tool-bar.list-related-toolbar .toggle-button,
+.tool-bar.list-related-toolbar .button {
+	-fx-font-family: Ionicons;
+	-fx-font-size: 1.8em;
+	-fx-text-fill: COLOR_TEXT;
+	-fx-padding: 0.2em 0.8em 0.2em 0.8em;
 	-fx-background-color: transparent;
 	-fx-background-insets: 1;
 	-fx-border-color: transparent COLOR_BORDER transparent transparent;
 	-fx-border-width: 1;
 }
 
-.tool-bar.list-related-toolbar .toggle-button:hover {
+.tool-bar.list-related-toolbar .toggle-button:disabled,
+.tool-bar.list-related-toolbar .button:disabled {
+	-fx-text-fill: COLOR_TEXT_DISABLED;
+}
+
+.tool-bar.list-related-toolbar .toggle-button:hover,
+.tool-bar.list-related-toolbar .button:hover {
 	-fx-background-color: COLOR_VGRAD_MEDIUM;
 }
 
 .tool-bar.list-related-toolbar .toggle-button:armed,
-.tool-bar.list-related-toolbar .toggle-button:selected {
+.tool-bar.list-related-toolbar .toggle-button:selected,
+.tool-bar.list-related-toolbar .button:armed,
+.tool-bar.list-related-toolbar .button:selected {
 	-fx-background-color: COLOR_VGRAD_DARK;
 }
 
@@ -190,6 +207,7 @@
  ******************************************************************************/
 
 .context-menu {
+	-fx-font-size: 12px;
 	-fx-background-color: COLOR_BORDER, COLOR_BACKGROUND;
 	-fx-background-insets: 0, 1;
 	-fx-padding: 1;

+ 20 - 3
main/ui/src/main/resources/css/mac_theme.css

@@ -222,17 +222,33 @@
     -fx-alignment: CENTER_LEFT;
 }
 
-.tool-bar.list-related-toolbar .toggle-button {
+.tool-bar.list-related-toolbar .spacer {
+	-fx-border-color: transparent COLOR_BORDER transparent transparent;
+    -fx-border-width: 1;
+}
+
+.tool-bar.list-related-toolbar .toggle-button,
+.tool-bar.list-related-toolbar .button {
+	-fx-font-family: Ionicons;
+	-fx-font-size: 1.4em;
+	-fx-text-fill: COLOR_TEXT;
 	-fx-background-color: transparent;
-	-fx-padding: 0.2em 0.8em 0.2em 0.8em;
+	-fx-padding: 0.1em 0.6em 0.1em 0.6em;
 	-fx-background-insets: 0;
 	-fx-background-radius: 0;
 	-fx-border-color: transparent COLOR_BORDER transparent transparent;
     -fx-border-width: 1;
 }
 
+.tool-bar.list-related-toolbar .toggle-button:disabled,
+.tool-bar.list-related-toolbar .button:disabled {
+	-fx-text-fill: COLOR_TEXT_DISABLED;
+}
+
 .tool-bar.list-related-toolbar .toggle-button:armed,
-.tool-bar.list-related-toolbar .toggle-button:selected {
+.tool-bar.list-related-toolbar .toggle-button:selected,
+.tool-bar.list-related-toolbar .button:armed,
+.tool-bar.list-related-toolbar .button:selected {
 	-fx-background-color: linear-gradient(to bottom, #C0C0C0 0%, #ADADAD 100%);
 }
 
@@ -243,6 +259,7 @@
  ******************************************************************************/
 
 .context-menu {
+	-fx-font-size: 13px;
     -fx-background-color: rgba(255.0, 255.0, 255.0, 0.9);
     -fx-background-insets: 0;
     -fx-background-radius: 4.0;

+ 15 - 1
main/ui/src/main/resources/css/win_theme.css

@@ -14,6 +14,7 @@
     -fx-font-size: 12px;
 	
 	COLOR_TEXT: #000;
+	COLOR_TEXT_DISABLED: #888;
 	COLOR_HYPERLINK: #3399FF;
 	COLOR_BORDER: #ACACAC;
 	COLOR_BORDER_FOCUS: #3399FF;
@@ -227,10 +228,22 @@
 .tool-bar.list-related-toolbar {
 	-fx-background-color: transparent;
     -fx-padding: 0.1em 0 0.1em 0;
-    -fx-spacing: 0;
+    -fx-spacing: 1px;
     -fx-alignment: CENTER_LEFT;
 }
 
+.tool-bar.list-related-toolbar .toggle-button,
+.tool-bar.list-related-toolbar .button {
+	-fx-font-family: Ionicons;
+	-fx-font-size: 1.4em;
+	-fx-text-fill: COLOR_TEXT;
+}
+
+.tool-bar.list-related-toolbar .toggle-button:disabled,
+.tool-bar.list-related-toolbar .button:disabled {
+	-fx-text-fill: COLOR_TEXT_DISABLED;
+}
+
 /*******************************************************************************
  *                                                                             *
  * PopupMenu                                                                   *
@@ -238,6 +251,7 @@
  ******************************************************************************/
 
 .context-menu {
+	-fx-font-size: 12px;
     -fx-background-color: derive(COLOR_BACKGROUND, -30%), COLOR_BACKGROUND;
     -fx-background-insets: 0, 1;
     -fx-padding: 1px; 

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

@@ -17,6 +17,8 @@
 <?import javafx.scene.control.ContextMenu?>
 <?import javafx.scene.control.MenuItem?>
 <?import javafx.geometry.Insets?>
+<?import javafx.scene.control.Button?>
+<?import javafx.scene.control.Separator?>
 
 <HBox fx:id="rootPane" prefHeight="440.0" prefWidth="640.0" xmlns:fx="http://javafx.com/fxml" cacheShape="true" cache="true">
 
@@ -43,7 +45,11 @@
 				<ListView fx:id="vaultList" VBox.vgrow="ALWAYS" focusTraversable="false" cacheShape="true" cache="true"/>
 				<ToolBar VBox.vgrow="NEVER" styleClass="list-related-toolbar" cacheShape="true" cache="true">
 					<items>
-						<ToggleButton text="+" fx:id="addVaultButton" onAction="#didClickAddVault" focusTraversable="false" cacheShape="true" cache="true"/>
+						<ToggleButton text="&#xf489;" fx:id="addVaultButton" onAction="#didClickAddVault" focusTraversable="false" cacheShape="true" cache="true"/>
+						<Button text="&#xf462;" fx:id="removeVaultButton" onAction="#didClickRemoveSelectedEntry" focusTraversable="false" cacheShape="true" cache="true"/>
+						<Pane HBox.hgrow="ALWAYS" styleClass="spacer" />
+						<!-- future use: -->
+						<Button text="&#xf43c;" disable="true" focusTraversable="false" cacheShape="true" cache="true"/>
 					</items>
 				</ToolBar>
 			</children>