Fixed visual issues as per @delvh 's request
This commit is contained in:
parent
b953586859
commit
8ba718f7b1
@ -91,7 +91,7 @@ public class Client implements Closeable {
|
||||
SerializationUtils.writeBytesWithLength(credentials, socket.getOutputStream());
|
||||
|
||||
// Wait for a maximum of five seconds to acquire the sender object
|
||||
long start = System.currentTimeMillis();
|
||||
final long start = System.currentTimeMillis();
|
||||
while (sender == null) {
|
||||
|
||||
// Quit immediately after handshake rejection
|
||||
@ -162,7 +162,7 @@ public class Client implements Closeable {
|
||||
eventBus.register(SendEvent.class, evt -> {
|
||||
try {
|
||||
sendEvent(evt.get());
|
||||
} catch (IOException e) {
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
@ -221,7 +221,7 @@ public class Client implements Closeable {
|
||||
*/
|
||||
public Map<String, Contact> getUsers() {
|
||||
checkOnline();
|
||||
Map<String, Contact> users = new HashMap<>();
|
||||
final Map<String, Contact> users = new HashMap<>();
|
||||
contacts.forEach(u -> users.put(u.getName(), u));
|
||||
users.put(sender.getName(), sender);
|
||||
return users;
|
||||
|
@ -232,9 +232,6 @@ public final class ChatScene {
|
||||
*/
|
||||
@FXML
|
||||
private void checkKeyCombination(KeyEvent e) {
|
||||
// TODO: Letting go of ctrl automatically posts a message. Needs to be fixed
|
||||
// soon.
|
||||
|
||||
// Automatic sending of messages via (ctrl +) enter
|
||||
if (!postButton.isDisabled() && settings.isEnterToSend() && e.getCode() == KeyCode.ENTER
|
||||
|| !settings.isEnterToSend() && e.getCode() == KeyCode.ENTER && e.isControlDown())
|
||||
|
@ -104,9 +104,7 @@ public final class LoginScene {
|
||||
if (registerCheckBox.isSelected() && !passwordField.getText().equals(repeatPasswordField.getText())) {
|
||||
clearPasswordFields();
|
||||
new Alert(AlertType.ERROR, "The entered password is unequal to the repeated one").showAndWait();
|
||||
} else {
|
||||
performHandshake(new LoginCredentials(userTextField.getText(), passwordField.getText().toCharArray(), registerCheckBox.isSelected()));
|
||||
}
|
||||
} else performHandshake(new LoginCredentials(userTextField.getText(), passwordField.getText().toCharArray(), registerCheckBox.isSelected()));
|
||||
}
|
||||
|
||||
@FXML
|
||||
@ -120,7 +118,6 @@ public final class LoginScene {
|
||||
// Make repeat password field and label visible / invisible
|
||||
repeatPasswordField.setVisible(registerCheckBox.isSelected());
|
||||
repeatPasswordLabel.setVisible(registerCheckBox.isSelected());
|
||||
|
||||
clearPasswordFields();
|
||||
}
|
||||
|
||||
@ -148,12 +145,12 @@ public final class LoginScene {
|
||||
try {
|
||||
// Try entering offline mode
|
||||
localDB.loadUsers();
|
||||
User clientUser = (User) localDB.getUsers().get(credentials.getIdentifier());
|
||||
final User clientUser = (User) localDB.getUsers().get(credentials.getIdentifier());
|
||||
if (clientUser == null) throw new EnvoyException("Could not enter offline mode: user name unknown");
|
||||
client.setSender(clientUser);
|
||||
new Alert(AlertType.WARNING, "A connection to the server could not be established. Starting in offline mode.").showAndWait();
|
||||
loadChatScene();
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
new Alert(AlertType.ERROR, "Client error: " + e).showAndWait();
|
||||
System.exit(1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user