UI improvement: adding checkbox before textbox for entering own mountpath is given

This commit is contained in:
infeo
2018-03-30 12:43:50 +02:00
parent 2341440ed9
commit 13c5e2470b
6 changed files with 42 additions and 15 deletions
@@ -122,6 +122,9 @@ public class UnlockController implements ViewController {
@FXML
private ChoiceBox<Character> winDriveLetter;
@FXML
private CheckBox useOwnMountPath;
@FXML
private HBox mountPathBox;
@@ -163,13 +166,18 @@ public class UnlockController implements ViewController {
savePassword.setDisable(!keychainAccess.isPresent());
unlockAfterStartup.disableProperty().bind(savePassword.disabledProperty().or(savePassword.selectedProperty().not()));
mountPathBox.managedProperty().bind(mountPathLabel.visibleProperty());
mountPath.managedProperty().bind(mountPathLabel.visibleProperty());
changeMountPathButton.managedProperty().bind(mountPathLabel.visibleProperty());
mountPathLabel.setVisible(false);
mountPathBox.visibleProperty().bind(mountPathLabel.visibleProperty());
mountPathBox.managedProperty().bind(mountPathLabel.managedProperty());
mountPath.visibleProperty().bind(mountPathLabel.visibleProperty());
mountPath.managedProperty().bind(mountPathLabel.managedProperty());
changeMountPathButton.visibleProperty().bind(mountPathLabel.visibleProperty());
changeMountPathButton.managedProperty().bind(mountPathLabel.managedProperty());
if (SystemUtils.IS_OS_WINDOWS) {
winDriveLetter.setConverter(new WinDriveLetterLabelConverter());
mountPathLabel.setVisible(false);
useOwnMountPath.setVisible(false);
useOwnMountPath.setManaged(false);
mountPathLabel.setManaged(false);
//dirty cheat
mountPathBox.setMouseTransparent(true);
@@ -178,8 +186,9 @@ public class UnlockController implements ViewController {
winDriveLetterLabel.setManaged(false);
winDriveLetter.setVisible(false);
winDriveLetter.setManaged(false);
if(VolumeImpl.WEBDAV.equals(settings.volumeImpl().get())){
mountPathLabel.setVisible(false);
if (VolumeImpl.WEBDAV.equals(settings.volumeImpl().get())) {
useOwnMountPath.setVisible(false);
useOwnMountPath.setManaged(false);
mountPathLabel.setManaged(false);
}
}
@@ -243,15 +252,18 @@ public class UnlockController implements ViewController {
unlockAfterStartup.setSelected(savePassword.isSelected() && vaultSettings.unlockAfterStartup().get());
mountAfterUnlock.setSelected(vaultSettings.mountAfterUnlock().get());
revealAfterMount.setSelected(vaultSettings.revealAfterMount().get());
useOwnMountPath.setSelected(vaultSettings.usesIndividualMountPath().get());
vaultSubs = vaultSubs.and(EasyBind.subscribe(unlockAfterStartup.selectedProperty(), vaultSettings.unlockAfterStartup()::set));
vaultSubs = vaultSubs.and(EasyBind.subscribe(mountAfterUnlock.selectedProperty(), vaultSettings.mountAfterUnlock()::set));
vaultSubs = vaultSubs.and(EasyBind.subscribe(revealAfterMount.selectedProperty(), vaultSettings.revealAfterMount()::set));
vaultSubs = vaultSubs.and(EasyBind.subscribe(useOwnMountPath.selectedProperty(), vaultSettings.usesIndividualMountPath()::set));
changeMountPathButton.visibleProperty().bind(
vaultSettings.individualMountPath().isNotEqualTo(mountPath.textProperty())
vaultSettings.individualMountPath().isNotEqualTo(mountPath.textProperty())
);
mountPath.textProperty().setValue(vaultSettings.individualMountPath().getValueSafe());
mountPathLabel.visibleProperty().bind(useOwnMountPath.selectedProperty());
}
@@ -57,7 +57,7 @@ public class FuseVolume implements Volume {
// auto assign drive letter
mountPath = windowsDriveLetters.getAvailableDriveLetters().iterator().next() + ":\\";
}
} else if (vaultSettings.individualMountPath().get() != null) {
} else if (vaultSettings.usesIndividualMountPath().get()) {
//specific path given
mountPath = vaultSettings.individualMountPath().get();
} else {
+6 -3
View File
@@ -91,12 +91,15 @@
<ChoiceBox GridPane.rowIndex="6" GridPane.columnIndex="1" fx:id="winDriveLetter" GridPane.hgrow="ALWAYS" maxWidth="Infinity" cacheShape="true" cache="true" />
<!-- Row 3.6 Alt2 -->
<Label GridPane.rowIndex="6" GridPane.columnIndex="0" fx:id="mountPathLabel" text="%unlock.label.mountPath" cacheShape="true" cache="true" />
<CheckBox GridPane.rowIndex="6" GridPane.columnIndex="0" fx:id="useOwnMountPath" text="%unlock.label.useOwnMountPath" cacheShape="true" cache="true" />
<HBox GridPane.rowIndex="6" GridPane.columnIndex="1" fx:id="mountPathBox" spacing="6.0">
<TextField GridPane.rowIndex="6" GridPane.columnIndex="1" fx:id="mountPath" cacheShape="true" cache="true" />
<Label GridPane.rowIndex="7" GridPane.columnIndex="0" fx:id="mountPathLabel" text="%unlock.label.mountPath" cacheShape="true" cache="true" />
<HBox GridPane.rowIndex="7" GridPane.columnIndex="1" fx:id="mountPathBox" spacing="6.0">
<TextField GridPane.rowIndex="7" GridPane.columnIndex="1" fx:id="mountPath" cacheShape="true" cache="true" />
<Button text="%unlock.label.mountPathButton" fx:id="changeMountPathButton" onAction="#didClickchangeMountPathButton"/>
</HBox>
</GridPane>
<!-- Row 4 -->
@@ -67,6 +67,7 @@ unlock.label.mountName=Drive Name
unlock.label.unlockAfterStartup=Auto-Unlock on Start (Experimental)
unlock.label.revealAfterMount=Reveal Drive
unlock.label.winDriveLetter=Drive Letter
unlock.label.useOwnMountPath=Use own Mount point
unlock.label.mountPath=Mount Path
unlock.label.mountPathButton=Apply
unlock.label.downloadsPageLink=All Cryptomator versions