Fixed visual issues as per @delvh 's request
This commit is contained in:
parent
3e0b73ef12
commit
d6e12df076
@ -91,7 +91,7 @@ public class Client implements Closeable {
|
|||||||
SerializationUtils.writeBytesWithLength(credentials, socket.getOutputStream());
|
SerializationUtils.writeBytesWithLength(credentials, socket.getOutputStream());
|
||||||
|
|
||||||
// Wait for a maximum of five seconds to acquire the sender object
|
// Wait for a maximum of five seconds to acquire the sender object
|
||||||
long start = System.currentTimeMillis();
|
final long start = System.currentTimeMillis();
|
||||||
while (sender == null) {
|
while (sender == null) {
|
||||||
|
|
||||||
// Quit immediately after handshake rejection
|
// Quit immediately after handshake rejection
|
||||||
@ -162,7 +162,7 @@ public class Client implements Closeable {
|
|||||||
eventBus.register(SendEvent.class, evt -> {
|
eventBus.register(SendEvent.class, evt -> {
|
||||||
try {
|
try {
|
||||||
sendEvent(evt.get());
|
sendEvent(evt.get());
|
||||||
} catch (IOException e) {
|
} catch (final IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -221,7 +221,7 @@ public class Client implements Closeable {
|
|||||||
*/
|
*/
|
||||||
public Map<String, Contact> getUsers() {
|
public Map<String, Contact> getUsers() {
|
||||||
checkOnline();
|
checkOnline();
|
||||||
Map<String, Contact> users = new HashMap<>();
|
final Map<String, Contact> users = new HashMap<>();
|
||||||
contacts.forEach(u -> users.put(u.getName(), u));
|
contacts.forEach(u -> users.put(u.getName(), u));
|
||||||
users.put(sender.getName(), sender);
|
users.put(sender.getName(), sender);
|
||||||
return users;
|
return users;
|
||||||
|
@ -232,9 +232,6 @@ public final class ChatScene {
|
|||||||
*/
|
*/
|
||||||
@FXML
|
@FXML
|
||||||
private void checkKeyCombination(KeyEvent e) {
|
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
|
// Automatic sending of messages via (ctrl +) enter
|
||||||
if (!postButton.isDisabled() && settings.isEnterToSend() && e.getCode() == KeyCode.ENTER
|
if (!postButton.isDisabled() && settings.isEnterToSend() && e.getCode() == KeyCode.ENTER
|
||||||
|| !settings.isEnterToSend() && e.getCode() == KeyCode.ENTER && e.isControlDown())
|
|| !settings.isEnterToSend() && e.getCode() == KeyCode.ENTER && e.isControlDown())
|
||||||
|
@ -28,7 +28,7 @@ import envoy.util.EnvoyLog;
|
|||||||
* Project: <strong>envoy-client</strong><br>
|
* Project: <strong>envoy-client</strong><br>
|
||||||
* File: <strong>LoginDialog.java</strong><br>
|
* File: <strong>LoginDialog.java</strong><br>
|
||||||
* Created: <strong>03.04.2020</strong><br>
|
* Created: <strong>03.04.2020</strong><br>
|
||||||
*
|
*
|
||||||
* @author Kai S. K. Engelbart
|
* @author Kai S. K. Engelbart
|
||||||
* @since Envoy Client v0.1-beta
|
* @since Envoy Client v0.1-beta
|
||||||
*/
|
*/
|
||||||
@ -72,7 +72,7 @@ public final class LoginScene {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads the login dialog using the FXML file {@code LoginDialog.fxml}.
|
* Loads the login dialog using the FXML file {@code LoginDialog.fxml}.
|
||||||
*
|
*
|
||||||
* @param client the client used to perform the handshake
|
* @param client the client used to perform the handshake
|
||||||
* @param localDB the local database used for offline login
|
* @param localDB the local database used for offline login
|
||||||
* @param receivedMessageCache the cache storing messages received during
|
* @param receivedMessageCache the cache storing messages received during
|
||||||
@ -104,9 +104,7 @@ public final class LoginScene {
|
|||||||
if (registerCheckBox.isSelected() && !passwordField.getText().equals(repeatPasswordField.getText())) {
|
if (registerCheckBox.isSelected() && !passwordField.getText().equals(repeatPasswordField.getText())) {
|
||||||
clearPasswordFields();
|
clearPasswordFields();
|
||||||
new Alert(AlertType.ERROR, "The entered password is unequal to the repeated one").showAndWait();
|
new Alert(AlertType.ERROR, "The entered password is unequal to the repeated one").showAndWait();
|
||||||
} else {
|
} else performHandshake(new LoginCredentials(userTextField.getText(), passwordField.getText().toCharArray(), registerCheckBox.isSelected()));
|
||||||
performHandshake(new LoginCredentials(userTextField.getText(), passwordField.getText().toCharArray(), registerCheckBox.isSelected()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
@ -120,7 +118,6 @@ public final class LoginScene {
|
|||||||
// Make repeat password field and label visible / invisible
|
// Make repeat password field and label visible / invisible
|
||||||
repeatPasswordField.setVisible(registerCheckBox.isSelected());
|
repeatPasswordField.setVisible(registerCheckBox.isSelected());
|
||||||
repeatPasswordLabel.setVisible(registerCheckBox.isSelected());
|
repeatPasswordLabel.setVisible(registerCheckBox.isSelected());
|
||||||
|
|
||||||
clearPasswordFields();
|
clearPasswordFields();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,12 +145,12 @@ public final class LoginScene {
|
|||||||
try {
|
try {
|
||||||
// Try entering offline mode
|
// Try entering offline mode
|
||||||
localDB.loadUsers();
|
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");
|
if (clientUser == null) throw new EnvoyException("Could not enter offline mode: user name unknown");
|
||||||
client.setSender(clientUser);
|
client.setSender(clientUser);
|
||||||
new Alert(AlertType.WARNING, "A connection to the server could not be established. Starting in offline mode.").showAndWait();
|
new Alert(AlertType.WARNING, "A connection to the server could not be established. Starting in offline mode.").showAndWait();
|
||||||
loadChatScene();
|
loadChatScene();
|
||||||
} catch (Exception e) {
|
} catch (final Exception e) {
|
||||||
new Alert(AlertType.ERROR, "Client error: " + e).showAndWait();
|
new Alert(AlertType.ERROR, "Client error: " + e).showAndWait();
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
* Project: <strong>envoy-client</strong><br>
|
* Project: <strong>envoy-client</strong><br>
|
||||||
* File: <strong>package-info.java</strong><br>
|
* File: <strong>package-info.java</strong><br>
|
||||||
* Created: <strong>08.06.2020</strong><br>
|
* Created: <strong>08.06.2020</strong><br>
|
||||||
*
|
*
|
||||||
* @author Kai S. K. Engelbart
|
* @author Kai S. K. Engelbart
|
||||||
* @since Envoy Client v0.1-beta
|
* @since Envoy Client v0.1-beta
|
||||||
*/
|
*/
|
||||||
package envoy.client.ui.controller;
|
package envoy.client.ui.controller;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
.button{
|
.button{
|
||||||
-fx-background-color: rgb(105,0,153);
|
-fx-background-color: rgb(105,0,153);
|
||||||
-fx-text-fill: white;
|
-fx-text-fill: white;
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
.button{
|
.button{
|
||||||
-fx-background-color: snow;
|
-fx-background-color: snow;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user