Load stylesheet from config dir if it exists
On startup ctbrec looks for style.css in the config directory. If it exists, it is added to JavaFX's list of stylesheets
This commit is contained in:
parent
cab0ac469b
commit
5c4d0d5290
|
@ -1,6 +1,7 @@
|
|||
package ctbrec.ui;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
@ -122,6 +123,7 @@ public class CamrecApplication extends Application {
|
|||
|
||||
switchToStartTab();
|
||||
|
||||
loadUserStyleSheet(primaryStage);
|
||||
primaryStage.getScene().getStylesheets().add("/ctbrec/ui/ThumbCell.css");
|
||||
primaryStage.getScene().getStylesheets().add("/ctbrec/ui/controls/SearchBox.css");
|
||||
primaryStage.getScene().getStylesheets().add("/ctbrec/ui/controls/Popover.css");
|
||||
|
@ -186,6 +188,13 @@ public class CamrecApplication extends Application {
|
|||
});
|
||||
}
|
||||
|
||||
private void loadUserStyleSheet(Stage primaryStage) {
|
||||
File userCss = new File(Config.getInstance().getConfigDir(), "style.css");
|
||||
if(userCss.exists() && userCss.isFile()) {
|
||||
primaryStage.getScene().getStylesheets().add(userCss.toURI().toString());
|
||||
}
|
||||
}
|
||||
|
||||
private void switchToStartTab() {
|
||||
String startTab = Config.getInstance().getSettings().startTab;
|
||||
if(StringUtil.isNotBlank(startTab)) {
|
||||
|
|
Loading…
Reference in New Issue