Skip to content

Commit

Permalink
Improve code quality
Browse files Browse the repository at this point in the history
  • Loading branch information
code-irisnk committed Mar 13, 2024
1 parent bc9dd1e commit 21934a5
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 39 deletions.
14 changes: 10 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<junit.version>5.10.0</junit.version>
<junit.version>5.10.1</junit.version>
<javafx.version>21</javafx.version>
</properties>

Expand All @@ -29,7 +29,7 @@
<dependency>
<groupId>org.controlsfx</groupId>
<artifactId>controlsfx</artifactId>
<version>11.1.2</version>
<version>11.2.1</version>
</dependency>
<dependency>
<groupId>com.dlsc.formsfx</groupId>
Expand All @@ -45,7 +45,7 @@
<dependency>
<groupId>net.synedra</groupId>
<artifactId>validatorfx</artifactId>
<version>0.4.0</version>
<version>0.4.2</version>
<exclusions>
<exclusion>
<groupId>org.openjfx</groupId>
Expand Down Expand Up @@ -102,7 +102,7 @@
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>RELEASE</version>
<version>24.1.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
Expand Down Expand Up @@ -141,4 +141,10 @@
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>central</id>
<url>https://repo.maven.apache.org/maven2/</url>
</repository>
</repositories>
</project>
4 changes: 2 additions & 2 deletions qodana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ profile:
# paths:
# - <path/where/not/run/inspection>

projectJDK: 21 #(Applied in CI/CD pipeline)
projectJDK: "21" #(Applied in CI/CD pipeline)

#Execute shell command before Qodana execution (Applied in CI/CD pipeline)
#bootstrap: sh ./prepare-qodana.sh

#Install IDE plugins before Qodana execution (Applied in CI/CD pipeline)
#plugins:
# - id: <plugin.id> #(plugin id can be found at https://plugins.jetbrains.com)
# - id: <plugin.id> # (plugin id can be found at https://plugins.jetbrains.com)

#Specify Qodana linter for analysis (Applied in CI/CD pipeline)
linter: jetbrains/qodana-jvm-community:latest
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import team.elrant.bubbles.xmpp.ConnectedUser;

public class ChatViewApplication extends Application {
private ConnectedUser connectedUser = null;
private String contactJid = null;
private final ConnectedUser connectedUser;
private final String contactJid;

public ChatViewApplication(ConnectedUser connectedUser, String contactJid) {
this.connectedUser = connectedUser;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/team/elrant/bubbles/xmpp/ConnectedUser.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public void saveUserToFile(String filename) {
// Create a temporary user object without the password
User userWithoutPassword = new User(super.getUsername(), super.getServiceName());

// Write the user object (without password) to the file
// Write the user object (without a password) to the file
objectOut.writeObject(userWithoutPassword);

System.out.println("User information (excluding password) saved to " + filename);
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/team/elrant/bubbles/xmpp/DummyUser.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ public static void main(String[] args) {
String username = "dummy";
String password = "";
String serviceName = "elrant.team";

ConnectedUser user = null;
Roster roster;
ConnectedUser user;
try {
user = new ConnectedUser(username, password, serviceName);
} catch (Exception e){
e.printStackTrace(); // Replace with more robust error handling in the future
// Accept every incoming subscription request
roster = user.getRoster();
roster.setSubscriptionMode(Roster.SubscriptionMode.accept_all);
} catch (Exception ignored){
// Replace with more robust error handling in the future
}
// Accept every incoming subscription request
Roster roster = user.getRoster();
roster.setSubscriptionMode(Roster.SubscriptionMode.accept_all);
}
}
45 changes: 22 additions & 23 deletions src/main/resources/team/elrant/bubbles/gui/LoginView.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,28 @@
<?import javafx.scene.text.Font?>

<Pane prefHeight="189.0" prefWidth="295.0" xmlns="http://javafx.com/javafx/21" xmlns:fx="http://javafx.com/fxml/1" fx:controller="team.elrant.bubbles.gui.LoginController">
<AnchorPane layoutY="14.0">
<children>
<AnchorPane fx:id="formPane" layoutX="22.0" layoutY="55.0" prefHeight="56.0" prefWidth="222.0">
<Label alignment="BASELINE_LEFT" layoutY="4.0" text="Username">
<font>
<Font name="Segoe UI Semibold" size="12.0" />
</font>
</Label>
<TextField fx:id="username_field" layoutX="80.0" promptText="Username" />
<Label alignment="BASELINE_LEFT" layoutX="1.0" layoutY="38.0" text="Password">
<font>
<Font name="Segoe UI Semibold" size="12.0" />
</font>
</Label>
<PasswordField fx:id="password_field" layoutX="80.0" layoutY="34.0" promptText="********" />
</AnchorPane>
<Label fx:id="loginLabel" alignment="BASELINE_CENTER" contentDisplay="CENTER" maxWidth="-Infinity" minWidth="-Infinity" prefHeight="39.0" prefWidth="293.0" text="Log-in" textAlignment="CENTER">
<font>
<Font name="Segoe UI Semibold" size="25.0" />
</font>
</Label>
</children>
</AnchorPane>
<AnchorPane layoutY="14.0">
<AnchorPane fx:id="formPane" layoutX="22.0" layoutY="55.0" prefHeight="56.0" prefWidth="222.0">
<Label alignment="BASELINE_LEFT" layoutY="4.0" text="Username">
<font>
<Font name="Segoe UI Semibold" size="12.0"/>
</font>
</Label>
<TextField fx:id="username_field" layoutX="80.0" promptText="Username"/>
<Label alignment="BASELINE_LEFT" layoutX="1.0" layoutY="38.0" text="Password">
<font>
<Font name="Segoe UI Semibold" size="12.0"/>
</font>
</Label>
<PasswordField fx:id="password_field" layoutX="80.0" layoutY="34.0" promptText="********"/>
</AnchorPane>
<Label fx:id="loginLabel" alignment="BASELINE_CENTER" contentDisplay="CENTER" maxWidth="-Infinity"
minWidth="-Infinity" prefHeight="39.0" prefWidth="293.0" text="Log-in" textAlignment="CENTER">
<font>
<Font name="Segoe UI Semibold" size="25.0"/>
</font>
</Label>
</AnchorPane>
<Button fx:id="submitButton" layoutX="226.0" layoutY="150.0" mnemonicParsing="false" onAction="#onSubmitButtonClick" text="Submit" />
<Label fx:id="failedLoginLabel" layoutX="36.0" layoutY="154.0" prefHeight="17.0" prefWidth="174.0" text="Wrong username or password!" textFill="#b50000" visible="false" />
<Label fx:id="successfulLoginLabel" layoutX="115.0" layoutY="154.0" text="Successful login!" textFill="#00bc00" visible="false" />
Expand Down

0 comments on commit 21934a5

Please sign in to comment.