Fixed various bugs
These are: * different size of addContact- and SettingsButton * default icons in light mode for users and groups (even though they are currently just the version used in dark mode) * wrong preferred size of unnamed "Login" label in LoginScene * unopenable LoginScene for some OS (Debian) * white screen when the current scene is switched Additionally cleaned up code a bit in MessageControl and LoginScene(.java)
This commit is contained in:
parent
c34457730f
commit
9234e23fae
@ -4,6 +4,7 @@ import java.io.IOException;
|
||||
import java.util.Stack;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import javafx.application.Platform;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
@ -125,10 +126,11 @@ public final class SceneContext {
|
||||
|
||||
sceneStack.push(scene);
|
||||
stage.setScene(scene);
|
||||
if (sceneInfo == SceneInfo.LOGIN_SCENE) stage.setResizable(false);
|
||||
else stage.setResizable(true);
|
||||
// The LoginScene is the only scene not intended to be resized
|
||||
// As strange as it seems, this is needed as otherwise the LoginScene won't be
|
||||
// displayed on some OS (...Debian...)
|
||||
Platform.runLater(() -> stage.setResizable(sceneInfo != SceneInfo.LOGIN_SCENE));
|
||||
applyCSS();
|
||||
stage.sizeToScene();
|
||||
stage.show();
|
||||
} catch (final IOException e) {
|
||||
EnvoyLog.getLogger(SceneContext.class).log(Level.SEVERE, String.format("Could not load scene for %s: ", sceneInfo), e);
|
||||
|
@ -136,23 +136,23 @@ public final class LoginScene {
|
||||
|
||||
@FXML
|
||||
private void registerSwitchPressed() {
|
||||
registration = !registration;
|
||||
|
||||
// Make repeat password field and label visible / invisible
|
||||
repeatPasswordField.setVisible(registration);
|
||||
if (loginButton.getText().equals("Login")) {
|
||||
if (!registration) {
|
||||
// case if the current mode is login
|
||||
loginButton.setText("Register");
|
||||
loginButton.setPadding(new Insets(2, 116, 2, 116));
|
||||
registerTextLabel.setText("Already an account?");
|
||||
registerSwitch.setText("Login");
|
||||
offlineModeButton.setDisable(true);
|
||||
} else {
|
||||
// case if the current mode is registration
|
||||
loginButton.setText("Login");
|
||||
loginButton.setPadding(new Insets(2, 125, 2, 125));
|
||||
registerTextLabel.setText("No account yet?");
|
||||
registerSwitch.setText("Register");
|
||||
offlineModeButton.setDisable(false);
|
||||
}
|
||||
registration = !registration;
|
||||
// Make repeat password field and label visible / invisible
|
||||
repeatPasswordField.setVisible(registration);
|
||||
offlineModeButton.setDisable(registration);
|
||||
}
|
||||
|
||||
@FXML
|
||||
@ -167,7 +167,7 @@ public final class LoginScene {
|
||||
localDB.setUser(localDB.getUsers().get(identifier));
|
||||
localDB.initializeUserStorage();
|
||||
localDB.loadUserData();
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
// User storage empty, wrong user name etc. -> default lastSync
|
||||
}
|
||||
return localDB.getLastSync();
|
||||
@ -190,7 +190,7 @@ public final class LoginScene {
|
||||
try {
|
||||
// Try entering offline mode
|
||||
localDB.loadUsers();
|
||||
final User clientUser = (User) localDB.getUsers().get(credentials.getIdentifier());
|
||||
final User clientUser = localDB.getUsers().get(credentials.getIdentifier());
|
||||
if (clientUser == null) throw new EnvoyException("Could not enter offline mode: user name unknown");
|
||||
client.setSender(clientUser);
|
||||
loadChatScene();
|
||||
|
@ -40,8 +40,9 @@ import envoy.util.EnvoyLog;
|
||||
*/
|
||||
public class MessageControl extends Label {
|
||||
|
||||
private static LocalDB localDB;
|
||||
private boolean ownMessage;
|
||||
private boolean ownMessage;
|
||||
|
||||
private static LocalDB localDB;
|
||||
|
||||
private static final DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("dd.MM.yyyy HH:mm:ss")
|
||||
.withZone(ZoneId.systemDefault());
|
||||
@ -57,7 +58,7 @@ public class MessageControl extends Label {
|
||||
// Creating the underlying VBox and the dateLabel
|
||||
final var hbox = new HBox();
|
||||
if (message.getSenderID() != localDB.getUser().getID() && message instanceof GroupMessage) {
|
||||
Label label = new Label();
|
||||
final var label = new Label();
|
||||
label.getStyleClass().add("groupMemberNames");
|
||||
label.setText(localDB.getUsers()
|
||||
.values()
|
||||
@ -73,12 +74,12 @@ public class MessageControl extends Label {
|
||||
final var vbox = new VBox(hbox);
|
||||
|
||||
// Creating the actions for the MenuItems
|
||||
final ContextMenu contextMenu = new ContextMenu();
|
||||
final MenuItem copyMenuItem = new MenuItem("Copy");
|
||||
final MenuItem deleteMenuItem = new MenuItem("Delete");
|
||||
final MenuItem forwardMenuItem = new MenuItem("Forward");
|
||||
final MenuItem quoteMenuItem = new MenuItem("Quote");
|
||||
final MenuItem infoMenuItem = new MenuItem("Info");
|
||||
final var contextMenu = new ContextMenu();
|
||||
final var copyMenuItem = new MenuItem("Copy");
|
||||
final var deleteMenuItem = new MenuItem("Delete");
|
||||
final var forwardMenuItem = new MenuItem("Forward");
|
||||
final var quoteMenuItem = new MenuItem("Quote");
|
||||
final var infoMenuItem = new MenuItem("Info");
|
||||
copyMenuItem.setOnAction(e -> copyMessage(message));
|
||||
deleteMenuItem.setOnAction(e -> deleteMessage(message));
|
||||
forwardMenuItem.setOnAction(e -> forwardMessage(message));
|
||||
@ -109,13 +110,13 @@ public class MessageControl extends Label {
|
||||
final var textLabel = new Label(message.getText());
|
||||
textLabel.setMaxWidth(430);
|
||||
textLabel.setWrapText(true);
|
||||
HBox hBoxBottom = new HBox();
|
||||
final var hBoxBottom = new HBox();
|
||||
hBoxBottom.getChildren().add(textLabel);
|
||||
// Setting the message status icon and background color
|
||||
if (message.getSenderID() == localDB.getUser().getID()) {
|
||||
final var statusIcon = new ImageView(statusImages.get(message.getStatus()));
|
||||
statusIcon.setPreserveRatio(true);
|
||||
Region space = new Region();
|
||||
final var space = new Region();
|
||||
HBox.setHgrow(space, Priority.ALWAYS);
|
||||
hBoxBottom.getChildren().add(space);
|
||||
hBoxBottom.getChildren().add(statusIcon);
|
||||
@ -156,5 +157,10 @@ public class MessageControl extends Label {
|
||||
*/
|
||||
public static void setLocalDB(LocalDB localDB) { MessageControl.localDB = localDB; }
|
||||
|
||||
/**
|
||||
* @return whether the message stored by this {@code MessageControl} has been
|
||||
* sent by this user of Envoy
|
||||
* @since Envoy Client v0.1-beta
|
||||
*/
|
||||
public boolean isOwnMessage() { return ownMessage; }
|
||||
}
|
||||
|
@ -66,7 +66,7 @@
|
||||
<Region id="transparentBackground" prefHeight="77.0" prefWidth="115.0" />
|
||||
<VBox id="transparentBackground" alignment="CENTER_RIGHT" prefHeight="200.0" prefWidth="100.0" spacing="5.0">
|
||||
<children>
|
||||
<Button fx:id="settingsButton" mnemonicParsing="true" onAction="#settingsButtonClicked" text="">
|
||||
<Button fx:id="settingsButton" mnemonicParsing="true" onAction="#settingsButtonClicked" prefHeight="30.0" prefWidth="30.0" text="">
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||
</padding>
|
||||
@ -74,7 +74,7 @@
|
||||
<Insets />
|
||||
</VBox.margin>
|
||||
</Button>
|
||||
<Button mnemonicParsing="true" onAction="#addContactButtonClicked" text=" + ">
|
||||
<Button mnemonicParsing="true" onAction="#addContactButtonClicked" prefHeight="30.0" prefWidth="30.0" text=" + ">
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||
</padding>
|
||||
|
@ -32,7 +32,9 @@
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||
</padding>
|
||||
</Label>
|
||||
<Label alignment="TOP_CENTER" contentDisplay="CENTER" prefHeight="33.0" prefWidth="87.0" text="LOGIN" textAlignment="CENTER">
|
||||
<Label alignment="TOP_CENTER" contentDisplay="CENTER"
|
||||
prefHeight="33.0" prefWidth="110.0" text="LOGIN"
|
||||
textAlignment="CENTER">
|
||||
<font>
|
||||
<Font size="26.0" />
|
||||
</font>
|
||||
|
BIN
client/src/main/resources/icons/light/group_icon.png
Normal file
BIN
client/src/main/resources/icons/light/group_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 52 KiB |
BIN
client/src/main/resources/icons/light/user_icon.png
Normal file
BIN
client/src/main/resources/icons/light/user_icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 39 KiB |
Reference in New Issue
Block a user