Skip to content

Commit d6945e1

Browse files
committed
disabling project list on left for linux. adapted texts
1 parent 75503dd commit d6945e1

File tree

1 file changed

+31
-37
lines changed

1 file changed

+31
-37
lines changed

src/main/java/de/doubleslash/keeptime/view/SettingsController.java

Lines changed: 31 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import de.doubleslash.keeptime.common.Resources;
2828
import de.doubleslash.keeptime.common.Resources.RESOURCE;
2929
import de.doubleslash.keeptime.controller.Controller;
30+
import de.doubleslash.keeptime.exceptions.FXMLLoaderException;
3031
import de.doubleslash.keeptime.model.Model;
3132
import javafx.fxml.FXML;
3233
import javafx.fxml.FXMLLoader;
@@ -44,8 +45,6 @@
4445
import javafx.stage.Stage;
4546

4647
public class SettingsController {
47-
AboutController aboutController;
48-
Stage aboutStage;
4948

5049
@FXML
5150
private ColorPicker hoverBackgroundColor;
@@ -98,35 +97,30 @@ public class SettingsController {
9897
private static final Logger LOG = LoggerFactory.getLogger(SettingsController.class);
9998

10099
private Controller controller;
101-
private Stage thisStage;
100+
102101
private static final String INPUT_FILE = "config.xml";
103102

103+
private AboutController aboutController;
104+
105+
private Stage thisStage;
106+
107+
private Stage aboutStage;
108+
104109
@FXML
105110
private void initialize() {
106111
LOG.debug("start init");
107112
LOG.info("OS: {}", OS.getOSname());
108113
LOG.debug("set versionLabel text");
109114
LOG.debug("load substages");
110-
loadSubStages();
115+
loadAboutStage();
111116
LOG.debug("set version label text");
112117

113118
if (OS.isLinux()) {
114-
if (useHotkeyCheckBox != null) {
115-
LOG.debug("useHotkeyCheckBox is initialized");
116-
useHotkeyCheckBox.setDisable(true);
117-
} else {
118-
LOG.warn("useHotkeyCheckBox is null");
119-
}
120-
121-
if (hotkeyLabel != null) {
122-
LOG.debug("hotkeyLabel is initialized");
123-
hotkeyLabel.setDisable(true);
124-
} else {
125-
LOG.warn("hotkeyLabel is null");
126-
}
127-
128-
LOG.debug("globalKeyloggerLabel is initialized");
119+
LOG.info("Disabling unsupported settings for Linux.");
120+
useHotkeyCheckBox.setDisable(true);
121+
hotkeyLabel.setDisable(true);
129122
globalKeyloggerLabel.setDisable(true);
123+
displayProjectsRightCheckBox.setDisable(true);
130124
}
131125

132126
LOG.debug("saveButton.setOnAction");
@@ -141,8 +135,9 @@ private void initialize() {
141135
final Alert alert = new Alert(AlertType.WARNING);
142136
alert.setTitle("Warning!");
143137
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
144-
alert.setHeaderText("color settings wrong!");
145-
alert.setContentText("The level of opacity on your hover background is to high for Linux.");
138+
alert.setHeaderText("Color setting not supported!");
139+
alert.setContentText(
140+
"The level of opacity on your hover background is to high for Linux. Resetting it.");
146141

147142
alert.showAndWait();
148143
}
@@ -153,21 +148,21 @@ private void initialize() {
153148
final Alert alert = new Alert(AlertType.WARNING);
154149
alert.setTitle("Warning!");
155150
alert.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
156-
alert.setHeaderText("color settings wrong!");
157-
alert.setContentText("The level of opacity on your default background is to high for Linux.");
151+
alert.setHeaderText("Color settings not supported!");
152+
alert.setContentText(
153+
"The level of opacity on your hover background is to high for Linux. Resetting it.");
158154

159155
alert.showAndWait();
160156
}
161-
}
162-
163-
if (!displayProjectsRightCheckBox.isSelected()) {
164-
final Alert warning = new Alert(AlertType.WARNING);
165-
warning.setTitle("No Linux Support");
166-
warning.setHeaderText(null);
167-
warning.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
168-
warning.setContentText(
169-
"The project list on the left side has no Linux support and doesn't run quite well on Windows ether. Please change your settings so, that your project list is on the right side.");
170-
warning.showAndWait();
157+
if (!displayProjectsRightCheckBox.isSelected()) {
158+
displayProjectsRightCheckBox.setSelected(true);
159+
final Alert warning = new Alert(AlertType.WARNING);
160+
warning.setTitle("Warning!");
161+
warning.setHeaderText("No Linux Support");
162+
warning.getDialogPane().setMinHeight(Region.USE_PREF_SIZE);
163+
warning.setContentText("The project list on the left side has no Linux support. Resetting it.");
164+
warning.showAndWait();
165+
}
171166
}
172167

173168
controller.updateSettings(hoverBackgroundColor.getValue(), hoverFontColor.getValue(),
@@ -232,7 +227,7 @@ public void setStage(final Stage thisStage) {
232227
this.thisStage = thisStage;
233228
}
234229

235-
private void loadSubStages() {
230+
private void loadAboutStage() {
236231
try {
237232
// About stage
238233
LOG.debug("load about.fxml");
@@ -254,9 +249,8 @@ private void loadSubStages() {
254249
});
255250

256251
LOG.debug("done setting up stage");
257-
} catch (final IOException e1) {
258-
// TODO Auto-generated catch block
259-
LOG.error(e1.getMessage());
252+
} catch (final IOException e) {
253+
throw new FXMLLoaderException("Could not load About stage.", e);
260254
}
261255

262256
}

0 commit comments

Comments
 (0)