mirror of
https://github.com/cryptomator/cryptomator.git
synced 2026-05-17 18:21:26 +00:00
Removed dependency to fontawesomefx, using fontawesome 5 instead (which we have a pro license for)
This commit is contained in:
16
main/pom.xml
16
main/pom.xml
@@ -32,7 +32,6 @@
|
||||
<cryptomator.webdav.version>1.0.10</cryptomator.webdav.version>
|
||||
|
||||
<javafx.version>12</javafx.version>
|
||||
<fontawesomefx.version>4.7.0-9.1.2</fontawesomefx.version>
|
||||
|
||||
<commons-io.version>2.6</commons-io.version>
|
||||
<commons-lang3.version>3.8.1</commons-lang3.version>
|
||||
@@ -52,16 +51,6 @@
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>ossrh-snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>jcenter</id>
|
||||
<url>http://jcenter.bintray.com</url>
|
||||
@@ -140,11 +129,6 @@
|
||||
<artifactId>javafx-fxml</artifactId>
|
||||
<version>${javafx.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.jensd</groupId>
|
||||
<artifactId>fontawesomefx-fontawesome</artifactId>
|
||||
<version>${fontawesomefx.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Logging -->
|
||||
<dependency>
|
||||
|
||||
@@ -36,10 +36,6 @@
|
||||
<groupId>org.openjfx</groupId>
|
||||
<artifactId>javafx-fxml</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.jensd</groupId>
|
||||
<artifactId>fontawesomefx-fontawesome</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- EasyBind -->
|
||||
<dependency>
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package org.cryptomator.ui.controls;
|
||||
|
||||
/**
|
||||
* Inspired by de.jensd:fontawesomefx-fontawesome
|
||||
*/
|
||||
public enum FontAwesome5Icon {
|
||||
ANCHOR("\uF13D"), //
|
||||
COGS("\uF085"), //
|
||||
EXCLAMATION_TRIANGLE("\uF071"), //
|
||||
FOLDER_OPEN("\uF07C"), //
|
||||
HDD("\uF0A0"), //
|
||||
LOCK_ALT("\uF30D"), //
|
||||
LOCK_OPEN_ALT("\uF3C2"), //
|
||||
MINUS("\uF068"), //
|
||||
PLUS("\uF067"), //
|
||||
SPINNER("\uF110"), //
|
||||
SYNC("\uF021"), //
|
||||
TIMES("\uF00D"), //
|
||||
;
|
||||
|
||||
private final String unicode;
|
||||
|
||||
FontAwesome5Icon(String unicode) {
|
||||
this.unicode = unicode;
|
||||
}
|
||||
|
||||
public String unicode() {
|
||||
return unicode;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package org.cryptomator.ui.controls;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import javafx.beans.property.DoubleProperty;
|
||||
import javafx.beans.property.ObjectProperty;
|
||||
import javafx.beans.property.SimpleDoubleProperty;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.scene.text.Font;
|
||||
import javafx.scene.text.Text;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.UncheckedIOException;
|
||||
|
||||
/**
|
||||
* Inspired by de.jensd:fontawesomefx-fontawesome
|
||||
*/
|
||||
public class FontAwesome5IconView extends Text {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(FontAwesome5IconView.class);
|
||||
private static final FontAwesome5Icon DEFAULT_GLYPH = FontAwesome5Icon.ANCHOR;
|
||||
private static final double DEFAULT_GLYPH_SIZE = 12.0;
|
||||
private static final String FONT_PATH = "/css/fontawesome5-pro-solid.otf";
|
||||
private static final Font FONT;
|
||||
|
||||
private ObjectProperty<FontAwesome5Icon> glyph = new SimpleObjectProperty<>(this, "glyph", DEFAULT_GLYPH);
|
||||
private DoubleProperty glyphSize = new SimpleDoubleProperty(this, "glyphSize", DEFAULT_GLYPH_SIZE);
|
||||
|
||||
static {
|
||||
try (InputStream in = FontAwesome5IconView.class.getResourceAsStream(FONT_PATH)) {
|
||||
Preconditions.checkNotNull(in, "Resource not found: " + FONT_PATH);
|
||||
FONT = Font.loadFont(in, DEFAULT_GLYPH_SIZE);
|
||||
if (FONT != null) {
|
||||
LOG.debug("Loaded family: {}", FONT.getFamily());
|
||||
} else {
|
||||
throw new IllegalStateException("Failed to load font.");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new UncheckedIOException(e);
|
||||
}
|
||||
}
|
||||
|
||||
public FontAwesome5IconView() {
|
||||
getStyleClass().addAll("glyph-icon");
|
||||
glyphProperty().addListener(this::glyphChanged);
|
||||
glyphSizeProperty().addListener(this::glyphSizeChanged);
|
||||
setFont(FONT);
|
||||
setGlyph(DEFAULT_GLYPH);
|
||||
setGlyphSize(DEFAULT_GLYPH_SIZE);
|
||||
}
|
||||
|
||||
private void glyphChanged(@SuppressWarnings("unused") ObservableValue<? extends FontAwesome5Icon> observable, @SuppressWarnings("unused") FontAwesome5Icon oldValue, FontAwesome5Icon newValue) {
|
||||
setText(newValue.unicode());
|
||||
}
|
||||
|
||||
private void glyphSizeChanged(@SuppressWarnings("unused") ObservableValue<? extends Number> observable, @SuppressWarnings("unused") Number oldValue, Number newValue) {
|
||||
setFont(new Font(FONT.getFamily(), newValue.doubleValue()));
|
||||
}
|
||||
|
||||
/* Getter/Setter */
|
||||
|
||||
public ObjectProperty<FontAwesome5Icon> glyphProperty() {
|
||||
return glyph;
|
||||
}
|
||||
|
||||
public void setGlyph(FontAwesome5Icon glyph) {
|
||||
this.glyph.set(glyph == null ? DEFAULT_GLYPH : glyph);
|
||||
}
|
||||
|
||||
public FontAwesome5Icon getGlyph() {
|
||||
return glyph.get();
|
||||
}
|
||||
|
||||
public DoubleProperty glyphSizeProperty() {
|
||||
return glyphSize;
|
||||
}
|
||||
|
||||
public void setGlyphSize(double glyphSize) {
|
||||
this.glyphSize.set(glyphSize);
|
||||
}
|
||||
|
||||
public double getGlyphSize() {
|
||||
return glyphSize.get();
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import javafx.beans.property.ObjectProperty;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import org.cryptomator.ui.common.FxController;
|
||||
import org.cryptomator.common.vaults.Vault;
|
||||
import org.cryptomator.ui.controls.FontAwesome5Icon;
|
||||
import org.fxmisc.easybind.EasyBind;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@@ -13,33 +14,33 @@ import javax.inject.Inject;
|
||||
public class VaultListCellController implements FxController {
|
||||
|
||||
private final ObjectProperty<Vault> vault = new SimpleObjectProperty<>();
|
||||
private final Binding<String> glyph;
|
||||
private final Binding<FontAwesome5Icon> glyph;
|
||||
|
||||
@Inject
|
||||
VaultListCellController() {
|
||||
this.glyph = EasyBind.select(vault).selectObject(Vault::stateProperty).map(this::getGlyphForVaultState).orElse("WARNING");
|
||||
this.glyph = EasyBind.select(vault).selectObject(Vault::stateProperty).map(this::getGlyphForVaultState).orElse(FontAwesome5Icon.EXCLAMATION_TRIANGLE);
|
||||
}
|
||||
|
||||
private String getGlyphForVaultState(Vault.State state) {
|
||||
private FontAwesome5Icon getGlyphForVaultState(Vault.State state) {
|
||||
switch (state) {
|
||||
case LOCKED:
|
||||
return "LOCK";
|
||||
return FontAwesome5Icon.LOCK_ALT;
|
||||
case PROCESSING:
|
||||
return "SPINNER";
|
||||
return FontAwesome5Icon.SPINNER;
|
||||
case UNLOCKED:
|
||||
return "UNLOCK";
|
||||
return FontAwesome5Icon.LOCK_OPEN_ALT;
|
||||
default:
|
||||
return "WARNING";
|
||||
return FontAwesome5Icon.EXCLAMATION_TRIANGLE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Getter/Setter */
|
||||
|
||||
public Binding<String> glyphProperty() {
|
||||
public Binding<FontAwesome5Icon> glyphProperty() {
|
||||
return glyph;
|
||||
}
|
||||
|
||||
public String getGlyph() {
|
||||
public FontAwesome5Icon getGlyph() {
|
||||
return glyph.getValue();
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
-fx-text-fill: TEXT_FILL;
|
||||
}
|
||||
|
||||
.fa-icon {
|
||||
.glyph-icon {
|
||||
-fx-fill: TEXT_FILL;
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
-fx-padding: 0;
|
||||
}
|
||||
|
||||
.main-window .title .button .fa-icon {
|
||||
.main-window .title .button .glyph-icon {
|
||||
-fx-fill: white;
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
-fx-background-color: none;
|
||||
}
|
||||
|
||||
.main-window .title .button:armed .fa-icon {
|
||||
.main-window .title .button:armed .glyph-icon {
|
||||
-fx-fill: CONTROL_WHITE_BG_ARMED;
|
||||
}
|
||||
|
||||
@@ -194,10 +194,6 @@
|
||||
-fx-background-color: CONTROL_BG_ARMED;
|
||||
}
|
||||
|
||||
.list-cell .lock-icon {
|
||||
-fx-fill: TEXT_FILL;
|
||||
}
|
||||
|
||||
.list-cell .detail-label {
|
||||
-fx-text-fill: TEXT_FILL_SECONDARY;
|
||||
-fx-font-size: 0.8em;
|
||||
|
||||
Binary file not shown.
BIN
main/ui/src/main/resources/css/fontawesome5-pro-solid.otf
Normal file
BIN
main/ui/src/main/resources/css/fontawesome5-pro-solid.otf
Normal file
Binary file not shown.
Binary file not shown.
@@ -35,7 +35,7 @@
|
||||
-fx-text-fill: TEXT_FILL;
|
||||
}
|
||||
|
||||
.fa-icon {
|
||||
.glyph-icon {
|
||||
-fx-fill: TEXT_FILL;
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@
|
||||
-fx-padding: 0;
|
||||
}
|
||||
|
||||
.main-window .title .button .fa-icon {
|
||||
.main-window .title .button .glyph-icon {
|
||||
-fx-fill: white;
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
-fx-background-color: none;
|
||||
}
|
||||
|
||||
.main-window .title .button:armed .fa-icon {
|
||||
.main-window .title .button:armed .glyph-icon {
|
||||
-fx-fill: CONTROL_WHITE_BG_ARMED;
|
||||
}
|
||||
|
||||
@@ -194,10 +194,6 @@
|
||||
-fx-background-color: CONTROL_BG_ARMED;
|
||||
}
|
||||
|
||||
.list-cell .lock-icon {
|
||||
-fx-fill: TEXT_FILL;
|
||||
}
|
||||
|
||||
.list-cell .detail-label {
|
||||
-fx-text-fill: TEXT_FILL_SECONDARY;
|
||||
-fx-font-size: 0.8em;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.Region?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView?>
|
||||
<?import org.cryptomator.ui.controls.FontAwesome5IconView?>
|
||||
<VBox xmlns="http://javafx.com/javafx"
|
||||
xmlns:fx="http://javafx.com/fxml"
|
||||
fx:controller="org.cryptomator.ui.addvaultwizard.CreateNewVaultLocationController"
|
||||
@@ -35,7 +35,7 @@
|
||||
<RadioButton fx:id="customRadioButton" toggleGroup="${predefinedLocationToggler}" text="TODO custom location"/>
|
||||
<Button contentDisplay="LEFT" text="%addvaultwizard.new.directoryPickerButton" onAction="#chooseCustomVaultPath" disable="${controller.usePresetPath}">
|
||||
<graphic>
|
||||
<FontAwesomeIconView styleClass="fa-icons" glyphName="FOLDER_OPEN"/>
|
||||
<FontAwesome5IconView glyph="FOLDER_OPEN"/>
|
||||
</graphic>
|
||||
</Button>
|
||||
</HBox>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView?>
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
@@ -10,6 +9,7 @@
|
||||
<?import javafx.scene.layout.Region?>
|
||||
<?import javafx.scene.layout.StackPane?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import org.cryptomator.ui.controls.FontAwesome5IconView?>
|
||||
<VBox xmlns="http://javafx.com/javafx"
|
||||
xmlns:fx="http://javafx.com/fxml"
|
||||
fx:controller="org.cryptomator.ui.mainwindow.MainWindowController"
|
||||
@@ -24,7 +24,7 @@
|
||||
<Button contentDisplay="GRAPHIC_ONLY" mnemonicParsing="false" onAction="#showPreferences">
|
||||
<graphic>
|
||||
<StackPane>
|
||||
<FontAwesomeIconView styleClass="fa-icon" glyphName="COGS"/>
|
||||
<FontAwesome5IconView glyph="COGS"/>
|
||||
<Region styleClass="update-indicator" visible="${controller.updateAvailable}" StackPane.alignment="TOP_RIGHT" prefWidth="10" prefHeight="10" maxWidth="-Infinity" maxHeight="-Infinity"/>
|
||||
</StackPane>
|
||||
</graphic>
|
||||
@@ -34,7 +34,7 @@
|
||||
</Button>
|
||||
<Button contentDisplay="GRAPHIC_ONLY" mnemonicParsing="false" onAction="#close">
|
||||
<graphic>
|
||||
<FontAwesomeIconView styleClass="fa-icon" glyphName="CLOSE"/>
|
||||
<FontAwesome5IconView glyph="TIMES"/>
|
||||
</graphic>
|
||||
<tooltip>
|
||||
<Tooltip text="%main.closeBtn.tooltip"/>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<?import javafx.scene.control.Tab?>
|
||||
<?import javafx.scene.control.TabPane?>
|
||||
<?import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView?>
|
||||
<?import org.cryptomator.ui.controls.FontAwesome5IconView?>
|
||||
<TabPane xmlns="http://javafx.com/javafx"
|
||||
xmlns:fx="http://javafx.com/fxml"
|
||||
fx:id="tabPane"
|
||||
@@ -13,7 +13,7 @@
|
||||
<tabs>
|
||||
<Tab fx:id="generalTab" text="%preferences.general">
|
||||
<graphic>
|
||||
<FontAwesomeIconView styleClass="fa-icon" glyphName="COGS"/>
|
||||
<FontAwesome5IconView glyph="COGS"/>
|
||||
</graphic>
|
||||
<content>
|
||||
<fx:include source="/fxml/preferences_general.fxml"/>
|
||||
@@ -21,7 +21,7 @@
|
||||
</Tab>
|
||||
<Tab fx:id="updatesTab" text="%preferences.updates">
|
||||
<graphic>
|
||||
<FontAwesomeIconView styleClass="fa-icon" glyphName="REFRESH"/>
|
||||
<FontAwesome5IconView glyph="SYNC"/>
|
||||
</graphic>
|
||||
<content>
|
||||
<fx:include source="/fxml/preferences_updates.fxml"/>
|
||||
@@ -29,7 +29,7 @@
|
||||
</Tab>
|
||||
<Tab fx:id="volumeTab" text="%preferences.volume">
|
||||
<graphic>
|
||||
<FontAwesomeIconView styleClass="fa-icon" glyphName="HDD_ALT"/>
|
||||
<FontAwesome5IconView glyph="HDD"/>
|
||||
</graphic>
|
||||
<content>
|
||||
<fx:include source="/fxml/preferences_volume.fxml"/>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView?>
|
||||
<?import javafx.scene.control.Button?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.control.ListView?>
|
||||
@@ -10,6 +9,7 @@
|
||||
<?import javafx.scene.layout.StackPane?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import javafx.scene.shape.Arc?>
|
||||
<?import org.cryptomator.ui.controls.FontAwesome5IconView?>
|
||||
<VBox xmlns="http://javafx.com/javafx"
|
||||
xmlns:fx="http://javafx.com/fxml"
|
||||
fx:controller="org.cryptomator.ui.mainwindow.VaultListController"
|
||||
@@ -26,7 +26,7 @@
|
||||
<HBox styleClass="toolbar-container" VBox.vgrow="NEVER" alignment="CENTER_LEFT">
|
||||
<Button contentDisplay="GRAPHIC_ONLY" mnemonicParsing="false" onAction="#didClickAddVault">
|
||||
<graphic>
|
||||
<FontAwesomeIconView styleClass="fa-icon" glyphName="PLUS"/>
|
||||
<FontAwesome5IconView glyph="PLUS"/>
|
||||
</graphic>
|
||||
<tooltip>
|
||||
<Tooltip text="Add Vault"/>
|
||||
@@ -34,7 +34,7 @@
|
||||
</Button>
|
||||
<Button contentDisplay="GRAPHIC_ONLY" mnemonicParsing="false" onAction="#didClickRemoveVault">
|
||||
<graphic>
|
||||
<FontAwesomeIconView styleClass="fa-icon" glyphName="MINUS"/>
|
||||
<FontAwesome5IconView glyph="MINUS"/>
|
||||
</graphic>
|
||||
<tooltip>
|
||||
<Tooltip text="Remove Vault"/>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView?>
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
<?import org.cryptomator.ui.controls.FontAwesome5IconView?>
|
||||
<HBox xmlns="http://javafx.com/javafx"
|
||||
xmlns:fx="http://javafx.com/fxml"
|
||||
fx:controller="org.cryptomator.ui.mainwindow.VaultListCellController"
|
||||
@@ -16,7 +16,7 @@
|
||||
<Insets top="6" right="8" bottom="6" left="10"/>
|
||||
</padding>
|
||||
<children>
|
||||
<FontAwesomeIconView styleClass="lock-icon" glyphName="${controller.glyph}" HBox.hgrow="NEVER" glyphSize="16"/>
|
||||
<FontAwesome5IconView glyph="${controller.glyph}" HBox.hgrow="NEVER" glyphSize="16"/>
|
||||
<VBox spacing="4" HBox.hgrow="ALWAYS">
|
||||
<Label text="${controller.vault.displayableName}"/>
|
||||
<Label styleClass="detail-label" text="${controller.vault.displayablePath}" textOverrun="CENTER_ELLIPSIS"/>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<?import javafx.scene.control.Tab?>
|
||||
<?import javafx.scene.control.TabPane?>
|
||||
<?import de.jensd.fx.glyphs.fontawesome.FontAwesomeIconView?>
|
||||
<?import org.cryptomator.ui.controls.FontAwesome5IconView?>
|
||||
<TabPane xmlns="http://javafx.com/javafx"
|
||||
xmlns:fx="http://javafx.com/fxml"
|
||||
fx:id="tabPane"
|
||||
@@ -13,7 +13,7 @@
|
||||
<tabs>
|
||||
<Tab fx:id="generalTab" text="TODO General">
|
||||
<graphic>
|
||||
<FontAwesomeIconView styleClass="fa-icon" glyphName="COGS"/>
|
||||
<FontAwesome5IconView glyph="COGS"/>
|
||||
</graphic>
|
||||
<content>
|
||||
<fx:include source="/fxml/vault_options_general.fxml"/>
|
||||
@@ -21,7 +21,7 @@
|
||||
</Tab>
|
||||
<Tab fx:id="mountTab" text="TODO Mounting">
|
||||
<graphic>
|
||||
<FontAwesomeIconView styleClass="fa-icon" glyphName="HDD_ALT"/>
|
||||
<FontAwesome5IconView glyph="HDD"/>
|
||||
</graphic>
|
||||
<content>
|
||||
<fx:include source="/fxml/vault_options_mount.fxml"/>
|
||||
|
||||
Reference in New Issue
Block a user