-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix various Dark theme issues #6368
Merged
tobiasdiez
merged 2 commits into
JabRef:master
from
MootezSaaD:various-dark-theme-fixes
Apr 28, 2020
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,7 @@ | |
import javafx.stage.Window; | ||
import javafx.util.Duration; | ||
|
||
import org.jabref.Globals; | ||
import org.jabref.gui.icon.IconTheme; | ||
import org.jabref.gui.util.DirectoryDialogConfiguration; | ||
import org.jabref.gui.util.FileDialogConfiguration; | ||
|
@@ -126,6 +127,7 @@ public <T> Optional<T> showChoiceDialogAndWait(String title, String content, Str | |
choiceDialog.setHeaderText(title); | ||
choiceDialog.setTitle(title); | ||
choiceDialog.setContentText(content); | ||
Globals.getThemeLoader().installCss(choiceDialog.getDialogPane().getScene(), Globals.prefs); | ||
return choiceDialog.showAndWait(); | ||
} | ||
|
||
|
@@ -148,12 +150,14 @@ public Optional<String> showInputDialogWithDefaultAndWait(String title, String c | |
@Override | ||
public void showInformationDialogAndWait(String title, String content) { | ||
FXDialog alert = createDialog(AlertType.INFORMATION, title, content); | ||
Globals.getThemeLoader().installCss(alert.getDialogPane().getScene(), Globals.prefs); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does it work, if you move this line inside the createDialog? Then you could reduce some code duplication There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes! didn't really pay attention. |
||
alert.showAndWait(); | ||
} | ||
|
||
@Override | ||
public void showWarningDialogAndWait(String title, String content) { | ||
FXDialog alert = createDialog(AlertType.WARNING, title, content); | ||
Globals.getThemeLoader().installCss(alert.getDialogPane().getScene(), Globals.prefs); | ||
alert.showAndWait(); | ||
} | ||
|
||
|
@@ -188,6 +192,7 @@ public void showErrorDialogAndWait(String message) { | |
@Override | ||
public boolean showConfirmationDialogAndWait(String title, String content) { | ||
FXDialog alert = createDialog(AlertType.CONFIRMATION, title, content); | ||
Globals.getThemeLoader().installCss(alert.getDialogPane().getScene(), Globals.prefs); | ||
return alert.showAndWait().filter(buttonType -> buttonType == ButtonType.OK).isPresent(); | ||
} | ||
|
||
|
@@ -196,6 +201,7 @@ public boolean showConfirmationDialogAndWait(String title, String content, Strin | |
FXDialog alert = createDialog(AlertType.CONFIRMATION, title, content); | ||
ButtonType okButtonType = new ButtonType(okButtonLabel, ButtonBar.ButtonData.OK_DONE); | ||
alert.getButtonTypes().setAll(ButtonType.CANCEL, okButtonType); | ||
Globals.getThemeLoader().installCss(alert.getDialogPane().getScene(), Globals.prefs); | ||
return alert.showAndWait().filter(buttonType -> buttonType == okButtonType).isPresent(); | ||
} | ||
|
||
|
@@ -206,6 +212,7 @@ public boolean showConfirmationDialogAndWait(String title, String content, | |
ButtonType okButtonType = new ButtonType(okButtonLabel, ButtonBar.ButtonData.OK_DONE); | ||
ButtonType cancelButtonType = new ButtonType(cancelButtonLabel, ButtonBar.ButtonData.NO); | ||
alert.getButtonTypes().setAll(okButtonType, cancelButtonType); | ||
Globals.getThemeLoader().installCss(alert.getDialogPane().getScene(), Globals.prefs); | ||
return alert.showAndWait().filter(buttonType -> buttonType == okButtonType).isPresent(); | ||
} | ||
|
||
|
@@ -214,6 +221,7 @@ public boolean showConfirmationDialogWithOptOutAndWait(String title, String cont | |
String optOutMessage, Consumer<Boolean> optOutAction) { | ||
FXDialog alert = createDialogWithOptOut(AlertType.CONFIRMATION, title, content, optOutMessage, optOutAction); | ||
alert.getButtonTypes().setAll(ButtonType.YES, ButtonType.NO); | ||
Globals.getThemeLoader().installCss(alert.getDialogPane().getScene(), Globals.prefs); | ||
return alert.showAndWait().filter(buttonType -> buttonType == ButtonType.YES).isPresent(); | ||
} | ||
|
||
|
@@ -225,6 +233,7 @@ public boolean showConfirmationDialogWithOptOutAndWait(String title, String cont | |
ButtonType okButtonType = new ButtonType(okButtonLabel, ButtonBar.ButtonData.YES); | ||
ButtonType cancelButtonType = new ButtonType(cancelButtonLabel, ButtonBar.ButtonData.NO); | ||
alert.getButtonTypes().setAll(okButtonType, cancelButtonType); | ||
Globals.getThemeLoader().installCss(alert.getDialogPane().getScene(), Globals.prefs); | ||
return alert.showAndWait().filter(buttonType -> buttonType == okButtonType).isPresent(); | ||
} | ||
|
||
|
@@ -244,6 +253,7 @@ public Optional<ButtonType> showCustomDialogAndWait(String title, DialogPane con | |
alert.getButtonTypes().setAll(buttonTypes); | ||
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE); | ||
alert.setResizable(true); | ||
Globals.getThemeLoader().installCss(alert.getDialogPane().getScene(), Globals.prefs); | ||
return alert.showAndWait(); | ||
} | ||
|
||
|
@@ -268,6 +278,7 @@ public <V> void showProgressDialogAndWait(String title, String content, Task<V> | |
task.cancel(); | ||
progressDialog.close(); | ||
}); | ||
Globals.getThemeLoader().installCss(progressDialog.getDialogPane().getScene(), Globals.prefs); | ||
progressDialog.show(); | ||
} | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are trying to remove the
Globals
class (in the long term). To facilitate this, could you please extract thethemeLoader
andpreferences
, and initialize them by passing the global objects as dependencies through the constructor (i.e. moveGlobals
from this class to the caller)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have refactored the code but I m not sure if I've done it correctly