Skip to content

Commit

Permalink
Improve account creation window
Browse files Browse the repository at this point in the history
  • Loading branch information
zapek committed Nov 22, 2024
1 parent 90e7b2f commit b006fe4
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ public void initialize()
.doOnError(throwable -> {
UiUtils.showAlertError(throwable);
setInProgress(false);
status.setText(null);
})
.subscribe();
}
Expand All @@ -136,6 +137,7 @@ else if (selectedFile.getPath().endsWith(".gpg") || selectedFile.getPath().endsW
.doOnError(throwable -> {
UiUtils.showAlertError(throwable);
setInProgress(false);
status.setText(null);
})
.subscribe());
}
Expand Down Expand Up @@ -184,8 +186,8 @@ public void generateProfileAndLocation(String profileName, String locationName)
configClient.createProfile(profileName).doOnSuccess(unused -> Platform.runLater(() -> generateLocation(profileName, locationName)))
.doOnError(e -> Platform.runLater(() -> {
UiUtils.showAlertError(e);
//UiUtils.showError(this.profileName, MessageFormat.format(bundle.getString("account.generation.profile.error"), e.getMessage()));
setInProgress(false);
status.setText(null);
}))
.subscribe();
}
Expand All @@ -198,8 +200,9 @@ private void generateLocation(String profileName, String locationName)

configClient.createLocation(locationName).doOnSuccess(unused -> Platform.runLater(() -> generateIdentity(profileName)))
.doOnError(e -> Platform.runLater(() -> {
UiUtils.alert(ERROR, e.getMessage()); // XXX: fix!
UiUtils.showAlertError(e);
setInProgress(false);
status.setText(null);
}))
.subscribe();
}
Expand All @@ -214,8 +217,9 @@ private void generateIdentity(String identityName)

result.doOnSuccess(identityResponse -> Platform.runLater(this::openDashboard))
.doOnError(e -> Platform.runLater(() -> {
UiUtils.alert(ERROR, e.getMessage());
UiUtils.showAlertError(e);
setInProgress(false);
status.setText(null);
}))
.subscribe();
}
Expand Down
4 changes: 3 additions & 1 deletion ui/src/main/resources/i18n/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,16 @@ main.status.dht.stats=Number of peers: {0,number,integer}\nReceived packets: {1,

# Account creation

account.welcome=Welcome to Xeres
account.welcome.tip=You need to create a profile and a location. A profile is usually your name or nickname and a location is your machine. You can have several locations like a desktop and a laptop that both use the same profile. Use the import option to import a profile that you already created before. Everything is always stored locally so don't forget to back up your data. The 'Help/Documentation' menu is always available and leaving your mouse pointer above a user interface element will show a help tooltip.
account.profile=Profile
account.profile.prompt=Profile name
account.profile.tip=Use a nickname or real name. A profile can have several locations.
account.location=Location
account.location.prompt=Location name
account.location.tip=This is your Xeres' instance on this device. Use your device's nickname or model.
account.options=Options
account.generation.profile-keys=Generating profile keys...
account.generation.profile.error=Error while creating profile: {0}
account.generation.location-keys-and-certificate=Generating location keys and certificate...
account.generation.identity=Generating identity...
account.generation.profile-load=Select a Xeres profile file (xeres_backup.xml), a Retroshare keyring (retroshare_secret_keyring.gpg) or a Retroshare profile (*.asc)
Expand Down
1 change: 0 additions & 1 deletion ui/src/main/resources/i18n/messages_fr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ account.location=Localisation
account.location.prompt=Nom de localisation
account.location.tip=Ceci est votre instance Xeres sur cet appareil. Utilisez le nom de votre appareil ou le model.
account.generation.profile-keys=Génération des clefs de profile...
account.generation.profile.error=Erreur lors de la création du profile: {0}
account.generation.location-keys-and-certificate=Génération des clefs de localisation et du certificat...
account.generation.identity=Génération de l'identité...
account.generation.profile-load=Sélectionner un fichier de profile Xeres (xeres_backup.xml), un fichier Keyring de Retroshare (retroshare_secret_keyring.gpg) ou un profile Retroshare (*.asc)
Expand Down
31 changes: 25 additions & 6 deletions ui/src/main/resources/view/account/account_creation.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,27 @@
~ along with Xeres. If not, see <http://www.gnu.org/licenses/>.
-->

<?import atlantafx.base.controls.Spacer?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<VBox alignment="CENTER" minHeight="260.0" minWidth="280.0" prefHeight="300.0" prefWidth="360.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="io.xeres.ui.controller.account.AccountCreationWindowController" styleClass="base-spacing">
<Label alignment="CENTER" text="Xeres" styleClass="title-1"/>
<?import org.kordamp.ikonli.javafx.FontIcon?>
<VBox alignment="CENTER" minHeight="380.0" minWidth="280.0" prefHeight="380.0" prefWidth="360.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="io.xeres.ui.controller.account.AccountCreationWindowController" styleClass="base-spacing">
<HBox alignment="BASELINE_RIGHT">
<Button styleClass="button-icon, flat, accent">
<graphic>
<FontIcon iconLiteral="mdi2i-information"/>
</graphic>
<tooltip>
<Tooltip showDelay="0ms" showDuration="1m" maxWidth="400" wrapText="true" text="%account.welcome.tip"/>
</tooltip>
</Button>
</HBox>
<Label alignment="CENTER" text="%account.welcome" styleClass="title-1">
<VBox.margin>
<Insets bottom="12.0"/>
</VBox.margin>
</Label>
<GridPane hgap="8" vgap="8">
<columnConstraints>
<ColumnConstraints hgrow="NEVER" minWidth="10.0" prefWidth="100.0"/>
Expand All @@ -46,7 +62,7 @@
</tooltip>
</TextField>
</GridPane>
<TitledPane fx:id="titledPane" style="-fx-padding: 8 0 0 0" styleClass="dense" expanded="false" text="Options" VBox.vgrow="ALWAYS">
<TitledPane fx:id="titledPane" style="-fx-padding: 8 0 0 0" styleClass="dense" expanded="false" text="%account.options" VBox.vgrow="ALWAYS">
<HBox>
<Button fx:id="importBackup" text="%account.generation.import">
<tooltip>
Expand All @@ -55,14 +71,17 @@
</Button>
</HBox>
</TitledPane>
<ProgressIndicator fx:id="progress" prefWidth="27.0" visible="false">
<ProgressIndicator fx:id="progress" minWidth="28.0" prefWidth="28.0" prefHeight="28.0" minHeight="28.0" visible="false">
<VBox.margin>
<Insets top="4.0"/>
</VBox.margin>
</ProgressIndicator>
<Label fx:id="status"/>
<Region VBox.vgrow="ALWAYS"/>
<Spacer VBox.vgrow="ALWAYS"/>
<HBox alignment="TOP_RIGHT">
<Button fx:id="okButton" disable="true" minWidth="72.0" mnemonicParsing="false" text="%ok"/>
<VBox.margin>
<Insets top="8.0"/>
</VBox.margin>
<Button fx:id="okButton" disable="true" minWidth="72.0" mnemonicParsing="false" text="%create"/>
</HBox>
</VBox>

0 comments on commit b006fe4

Please sign in to comment.