~exprez135/cryptomator-libre

48815657441723c664fe783ed1d718c5720bacd7 — Sebastian Stenzel 1 year, 8 months ago f2f1406
Added welcome screen and onboarding text
M main/ui/src/main/java/org/cryptomator/ui/mainwindow/MainWindowModule.java => main/ui/src/main/java/org/cryptomator/ui/mainwindow/MainWindowModule.java +5 -0
@@ 87,6 87,11 @@ abstract class MainWindowModule {
	@IntoMap
	@FxControllerKey(VaultDetailController.class)
	abstract FxController bindVaultDetailController(VaultDetailController controller);
	
	@Binds
	@IntoMap
	@FxControllerKey(WelcomeController.class)
	abstract FxController bindWelcomeController(WelcomeController controller);

	@Binds
	@IntoMap

A main/ui/src/main/java/org/cryptomator/ui/mainwindow/WelcomeController.java => main/ui/src/main/java/org/cryptomator/ui/mainwindow/WelcomeController.java +45 -0
@@ 0,0 1,45 @@
package org.cryptomator.ui.mainwindow;

import javafx.application.Application;
import javafx.beans.binding.Bindings;
import javafx.beans.binding.BooleanBinding;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import org.cryptomator.common.vaults.Vault;
import org.cryptomator.ui.common.FxController;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.inject.Inject;

@MainWindowScoped
public class WelcomeController implements FxController {
	
	private static final Logger LOG = LoggerFactory.getLogger(WelcomeController.class);
	private static final String GETTING_STARTED_URI = "https://docs.cryptomator.org/en/latest/desktop/basic-concepts/";

	private final Application application;
	private final BooleanBinding noVaultPresent;

	@Inject
	public WelcomeController(Application application, ObservableList<Vault> vaults) {
		this.application = application;
		this.noVaultPresent = Bindings.isEmpty(vaults);
	}

	@FXML
	public void visitGettingStartedGuide() {
		LOG.trace("Opening {}", GETTING_STARTED_URI);
		application.getHostServices().showDocument(GETTING_STARTED_URI);
	}

	/* Getter/Setter */

	public BooleanBinding noVaultPresentProperty() {
		return noVaultPresent;
	}

	public boolean isNoVaultPresent() {
		return noVaultPresent.get();
	}
}

M main/ui/src/main/resources/fxml/main_window.fxml => main/ui/src/main/resources/fxml/main_window.fxml +0 -3
@@ 1,10 1,7 @@
<?xml version="1.0" encoding="UTF-8"?>

<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.control.Tooltip?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.Region?>
<?import javafx.scene.layout.StackPane?>

M main/ui/src/main/resources/fxml/vault_detail.fxml => main/ui/src/main/resources/fxml/vault_detail.fxml +2 -2
@@ 13,14 13,13 @@
<VBox xmlns="http://javafx.com/javafx"
	  xmlns:fx="http://javafx.com/fxml"
	  fx:controller="org.cryptomator.ui.mainwindow.VaultDetailController"
	  styleClass="vault-detail"
	  minWidth="300"
	  spacing="36">
	<padding>
		<Insets topRightBottomLeft="24"/>
	</padding>
	<children>
		<HBox spacing="12" visible="${controller.anyVaultSelected}">
		<HBox spacing="12" visible="${controller.anyVaultSelected}" managed="${controller.anyVaultSelected}">
			<StackPane alignment="CENTER">
				<Circle styleClass="glyph-icon-primary" radius="16"/>
				<FontAwesome5IconView styleClass="glyph-icon-white" glyph="${controller.glyph}" HBox.hgrow="NEVER" glyphSize="16"/>


@@ 48,6 47,7 @@
			</VBox>
		</HBox>

		<fx:include VBox.vgrow="ALWAYS" source="vault_detail_welcome.fxml" visible="${!controller.anyVaultSelected}" managed="${!controller.anyVaultSelected}"/>
		<fx:include VBox.vgrow="ALWAYS" source="vault_detail_locked.fxml" visible="${controller.vault.locked}" managed="${controller.vault.locked}"/>
		<fx:include VBox.vgrow="ALWAYS" source="vault_detail_unlocked.fxml" visible="${controller.vault.unlocked}" managed="${controller.vault.unlocked}"/>
		<fx:include VBox.vgrow="ALWAYS" source="vault_detail_missing.fxml" visible="${controller.vault.missing}" managed="${controller.vault.missing}"/>

A main/ui/src/main/resources/fxml/vault_detail_welcome.fxml => main/ui/src/main/resources/fxml/vault_detail_welcome.fxml +23 -0
@@ 0,0 1,23 @@
<?import javafx.scene.control.Hyperlink?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Text?>
<?import javafx.scene.text.TextFlow?>
<VBox xmlns="http://javafx.com/javafx"
	  xmlns:fx="http://javafx.com/fxml"
	  fx:controller="org.cryptomator.ui.mainwindow.WelcomeController"
	  alignment="CENTER"
	  spacing="24">
	<children>
		<ImageView VBox.vgrow="ALWAYS" fitHeight="128" preserveRatio="true" smooth="true" cache="true">
			<Image url="/bot.png"/>
		</ImageView>
		
		<TextFlow prefWidth="-Infinity" visible="${controller.noVaultPresent}" managed="${controller.noVaultPresent}">
			<Text text="%main.vaultDetail.welcomeOnboarding"/>
			<Text text=" "/>
			<Hyperlink text="docs.cryptomator.org" styleClass="hyperlink-underline" onAction="#visitGettingStartedGuide"/>
		</TextFlow>
	</children>
</VBox>
\ No newline at end of file

M main/ui/src/main/resources/i18n/strings.properties => main/ui/src/main/resources/i18n/strings.properties +2 -0
@@ 160,6 160,8 @@ main.vaultlist.emptyList.onboardingInstruction=Click here to add a vault
main.vaultlist.contextMenu.remove=Remove Vault
main.vaultlist.addVaultBtn=Add Vault
## Vault Detail
### Welcome
main.vaultDetail.welcomeOnboarding=Thanks for choosing Cryptomator to protect your files. If you need any assistance, check out our getting started guides:
### Locked
main.vaultDetail.lockedStatus=LOCKED
main.vaultDetail.unlockBtn=Unlock