preferences network mockup

This commit is contained in:
Jan-Peter Klein
2024-06-28 12:59:12 +02:00
parent d6fd012f71
commit 506827ffef
8 changed files with 114 additions and 0 deletions
@@ -40,6 +40,7 @@ public enum FontAwesome5Icon {
LOCK("\uF023"), //
LOCK_OPEN("\uF3C1"), //
MAGIC("\uF0D0"), //
NETWORK("\uF6FF"), //
PENCIL("\uF303"), //
PLUS("\uF067"), //
PRINT("\uF02F"), //
@@ -0,0 +1,42 @@
package org.cryptomator.ui.preferences;
import org.cryptomator.ui.common.FxController;
import org.cryptomator.ui.controls.NumericTextField;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.inject.Inject;
import javafx.fxml.FXML;
import javafx.scene.control.RadioButton;
import javafx.scene.control.ToggleGroup;
import javafx.scene.layout.VBox;
@PreferencesScoped
public class NetworkPreferencesController implements FxController {
private static final Logger LOG = LoggerFactory.getLogger(NetworkPreferencesController.class);
public ToggleGroup proxyToggleGroup;
public RadioButton noProxyBtn;
public RadioButton systemSettingsBtn;
public RadioButton manualProxyBtn;
public VBox manualProxyBox;
public NumericTextField httpProxyPort;
public NumericTextField httpsProxyPort;
@Inject
NetworkPreferencesController() {
}
@FXML
public void initialize() {
proxyToggleGroup.selectToggle(noProxyBtn);
proxyToggleGroup.selectedToggleProperty().addListener((_, _, newValue) -> {
if (newValue != null) {
RadioButton selectedRadioButton = (RadioButton) newValue;
manualProxyBox.setDisable(!selectedRadioButton.equals(manualProxyBtn));
}
});
}
}
@@ -31,6 +31,7 @@ public class PreferencesController implements FxController {
public Tab updatesTab;
public Tab contributeTab;
public Tab aboutTab;
public Tab networkTab;
@Inject
public PreferencesController(Environment env, @PreferencesWindow Stage window, ObjectProperty<SelectedPreferencesTab> selectedTabProperty, UpdateChecker updateChecker) {
@@ -63,6 +64,7 @@ public class PreferencesController implements FxController {
case UPDATES -> updatesTab;
case CONTRIBUTE -> contributeTab;
case ABOUT -> aboutTab;
case NETWORK -> networkTab;
case ANY -> updateAvailable.get() ? updatesTab : generalTab;
};
}
@@ -89,4 +89,9 @@ abstract class PreferencesModule {
@FxControllerKey(AboutController.class)
abstract FxController bindAboutController(AboutController controller);
@Binds
@IntoMap
@FxControllerKey(NetworkPreferencesController.class)
abstract FxController bindNetworkPreferencesController(NetworkPreferencesController controller);
}
@@ -35,4 +35,8 @@ public enum SelectedPreferencesTab {
* Show about tab
*/
ABOUT,
/**
* Show network tab
*/
NETWORK
}
+8
View File
@@ -46,6 +46,14 @@
<fx:include source="preferences_updates.fxml"/>
</content>
</Tab>
<Tab fx:id="network" id="NETWORK" text="%preferences.network">
<graphic>
<FontAwesome5IconView glyph="NETWORK"/>
</graphic>
<content>
<fx:include source="preferences_network.fxml"/>
</content>
</Tab>
<Tab fx:id="contributeTab" id="CONTRIBUTE" text="%preferences.contribute">
<graphic>
<FontAwesome5IconView glyph="HEART"/>
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.RadioButton?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.control.CheckBox?>
<?import javafx.scene.control.ToggleGroup?>
<?import org.cryptomator.ui.controls.NumericTextField?>
<VBox xmlns:fx="http://javafx.com/fxml"
xmlns="http://javafx.com/javafx"
fx:controller="org.cryptomator.ui.preferences.NetworkPreferencesController"
spacing="24">
<fx:define>
<ToggleGroup fx:id="proxyToggleGroup"/>
</fx:define>
<padding>
<Insets topRightBottomLeft="24"/>
</padding>
<VBox>
<Label text="Configure Proxy Access to the Internet"/>
<RadioButton fx:id="noProxyBtn" text="No Proxy" toggleGroup="${proxyToggleGroup}" />
<RadioButton fx:id="systemSettingsBtn" text="Use system proxy settings" toggleGroup="${proxyToggleGroup}" />
<RadioButton fx:id="manualProxyBtn" text="Manual proxy configuration" toggleGroup="${proxyToggleGroup}" />
<VBox fx:id="manualProxyBox">
<padding>
<Insets left="24"/>
</padding>
<HBox spacing="12" alignment="CENTER_LEFT">
<Label text="HTTP Proxy" minWidth="90" />
<TextField fx:id="httpProxy" HBox.hgrow="ALWAYS" />
<Label text="Port"/>
<NumericTextField fx:id="httpProxyPort" prefWidth="60" promptText="0" />
</HBox>
<CheckBox text="Also use this proxy for HTTPS"/>
<HBox spacing="12" alignment="CENTER_LEFT">
<Label text="HTTPS Proxy" minWidth="90"/>
<TextField fx:id="httpsProxy" HBox.hgrow="ALWAYS" />
<Label text="Port"/>
<NumericTextField fx:id="httpsProxyPort" prefWidth="60" promptText="0"/>
</HBox>
</VBox>
</VBox>
</VBox>
@@ -328,6 +328,8 @@ preferences.updates.lastUpdateCheck.daysAgo=%s days ago
preferences.updates.lastUpdateCheck.hoursAgo=%s hours ago
preferences.updates.checkFailed=Looking for updates failed. Please check your internet connection or try again later.
preferences.updates.upToDate=Cryptomator is up-to-date.
## Network
preferences.network=Network
## Contribution
preferences.contribute=Support Us