Skip to content

Commit

Permalink
Fromating code 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Eng-Ziad7 committed Jun 20, 2024
1 parent 1b53bd1 commit 85365a8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 20 deletions.
5 changes: 3 additions & 2 deletions GUI/src/main/java/gui/preferences/Set.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ public void mainAutoPaste(boolean isMainAutoPasteEnabled) {
AppSettings.CLEAR.mainAutoPaste();
preferences.putBoolean(MAIN_AUTO_PASTE.toString(), isMainAutoPasteEnabled);
}
public void mainTheme(String theme){

public void mainTheme(String theme) {
AppSettings.CLEAR.mainTheme();
preferences.put(MAIT_THEME.toString() ,theme );
preferences.put(MAIT_THEME.toString(), theme);

}

Expand Down
1 change: 1 addition & 0 deletions GUI/src/main/java/main/Drifty_GUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ private Menu getEditMenu() {
});
settings.setOnAction(e -> {
Settings settings1 = new Settings();
settings1.creatSettings();
});
menu.getItems().addAll(wipeHistory, settings);
return menu;
Expand Down
2 changes: 1 addition & 1 deletion GUI/src/main/java/ui/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private void changeFormBtn(String theme) {
private Stage stage = Constants.getStage("Settings", false);
Label lblAutoPaste = new Label("Auto-Paste");

public Settings() {
public void creatSettings() {

VBox root = new VBox(10);
root.setPadding(new Insets(10));
Expand Down
23 changes: 6 additions & 17 deletions GUI/src/main/java/ui/UIController.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,7 @@ private void setControlProperties() {
selectJob(job);
});
form.cbAutoPaste.setSelected(AppSettings.GET.mainAutoPaste());
form.cbAutoPaste.selectedProperty().addListener(((observable, oldValue, newValue) ->
AppSettings.SET.mainAutoPaste(newValue)
));
form.cbAutoPaste.selectedProperty().addListener(((observable, oldValue, newValue) -> AppSettings.SET.mainAutoPaste(newValue)));
form.cbAutoPaste.setOnAction(e -> {
Settings.autoPasteCheck.setSelected(form.cbAutoPaste.isSelected());
});
Expand Down Expand Up @@ -295,13 +293,10 @@ private Runnable verifyLink(String link) {
String folder = fileExists(filename);
String windowTitle;
if (!folder.isEmpty()) {
message = intro + "And the file exists in this download folder:" + nl + folder + nl.repeat(2) +
"If you wish to download it again, it will be given the name shown below, or you can change it as you wish." + nl.repeat(2) +
"YES will add the job to the list with new filename. NO will do nothing.";
message = intro + "And the file exists in this download folder:" + nl + folder + nl.repeat(2) + "If you wish to download it again, it will be given the name shown below, or you can change it as you wish." + nl.repeat(2) + "YES will add the job to the list with new filename. NO will do nothing.";
windowTitle = "File Already Exists";
} else {
message = intro + "However, the file does not exist in any of your download folders." + nl.repeat(2) +
"Do you still wish to download this file?";
message = intro + "However, the file does not exist in any of your download folders." + nl.repeat(2) + "Do you still wish to download this file?";
windowTitle = "File Already Downloaded";
}
ConfirmationDialog ask = new ConfirmationDialog(windowTitle, message, renameFile(filename, dir));
Expand Down Expand Up @@ -505,12 +500,8 @@ private void updateBatch() {

private void checkHistoryAddJobs(Worker<ConcurrentLinkedDeque<Job>> worker) {
String pastJobNoFile = "You have downloaded %s in the past, but the file does not exist in your download folder." + nl.repeat(2) + " Click Yes if you still wish to download this file. Otherwise, click No.";
String pastJobFileExists = "You have downloaded %s in the past, and the file exists in your download folder." + nl.repeat(2) +
"It will be renamed as shown here, or you may change the filename to your liking." + nl.repeat(2) +
"Clicking Yes will commit the job with the shown filename, while clicking No will not add this file to the job list.";
String fileExistsString = "This file:" + nl.repeat(2) + "%s" + nl.repeat(2) + "Exists in in the download folder." + nl.repeat(2) +
"It will be renamed as shown here, or you may change the filename to your liking." + nl.repeat(2) +
"Clicking Yes will commit the job with the shown filename, while clicking No will not add this file to the job list.";
String pastJobFileExists = "You have downloaded %s in the past, and the file exists in your download folder." + nl.repeat(2) + "It will be renamed as shown here, or you may change the filename to your liking." + nl.repeat(2) + "Clicking Yes will commit the job with the shown filename, while clicking No will not add this file to the job list.";
String fileExistsString = "This file:" + nl.repeat(2) + "%s" + nl.repeat(2) + "Exists in in the download folder." + nl.repeat(2) + "It will be renamed as shown here, or you may change the filename to your liking." + nl.repeat(2) + "Clicking Yes will commit the job with the shown filename, while clicking No will not add this file to the job list.";
Platform.runLater(() -> {
String message;
ConfirmationDialog ask = new ConfirmationDialog("", "");
Expand Down Expand Up @@ -783,9 +774,7 @@ private void commitJobListToListView() {
} else {
// Remove duplicate jobs if any
Set<String> encounteredLinks = new HashSet<>();
ConcurrentLinkedDeque<Job> duplicates = getJobs().jobList().stream()
.filter(job -> !encounteredLinks.add(job.getLink()))
.collect(Collectors.toCollection(ConcurrentLinkedDeque::new));
ConcurrentLinkedDeque<Job> duplicates = getJobs().jobList().stream().filter(job -> !encounteredLinks.add(job.getLink())).collect(Collectors.toCollection(ConcurrentLinkedDeque::new));
for (Job job : duplicates) {
removeJobFromList(job);
}
Expand Down

0 comments on commit 85365a8

Please sign in to comment.