Skip to content
This repository was archived by the owner on Nov 26, 2019. It is now read-only.

Commit 65565a8

Browse files
committed
Update nomore uses DB related stuff
1 parent ae8d4fa commit 65565a8

File tree

4 files changed

+45
-87
lines changed

4 files changed

+45
-87
lines changed

client/src/main/java/com/msc/serverbrowser/data/properties/Property.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ public enum Property
2020
ALLOW_CLOSE_SAMP(11, false, Boolean.class),
2121
CHANGELOG_ENABLED(12, true, Boolean.class),
2222
DEVELOPMENT(13, false, Boolean.class),
23-
LAST_TAG_NAME(14, "1.3.6", String.class),
2423
ALLOW_CACHING_DOWNLOADS(15, true, Boolean.class),
2524
AUTOMTAIC_UPDATES(16, true, Boolean.class);
2625

client/src/main/java/com/msc/serverbrowser/gui/controllers/implementations/SettingsController.java

Lines changed: 41 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import com.msc.serverbrowser.data.properties.Property;
1111
import com.msc.serverbrowser.gui.View;
1212
import com.msc.serverbrowser.gui.controllers.interfaces.ViewController;
13+
import com.msc.serverbrowser.util.UpdateUtility;
1314
import com.msc.serverbrowser.util.basic.StringUtility;
1415

1516
import javafx.beans.property.BooleanProperty;
@@ -31,62 +32,42 @@
3132
public class SettingsController implements ViewController
3233
{
3334
// Information
34-
@FXML
35-
private Label informationLabel;
35+
@FXML private Label informationLabel;
3636

3737
// General Settings
38-
@FXML
39-
private TextField sampPathTextField;
40-
@FXML
41-
private CheckBox saveLastViewCheckBox;
38+
@FXML private TextField sampPathTextField;
39+
@FXML private CheckBox saveLastViewCheckBox;
4240

4341
// Appearance Settings
44-
@FXML
45-
private CheckBox darkThemeCheckBox;
42+
@FXML private CheckBox darkThemeCheckBox;
4643

4744
// Permission Settings
48-
@FXML
49-
private CheckBox allowCloseSampCheckBox;
50-
@FXML
51-
private CheckBox allowCloseGtaCheckBox;
45+
@FXML private CheckBox allowCloseSampCheckBox;
46+
@FXML private CheckBox allowCloseGtaCheckBox;
5247

5348
// SA-MP Settings
54-
@FXML
55-
private Spinner<Integer> fpsLimitSpinner;
56-
@FXML
57-
private Spinner<Integer> pageSizeSpinner;
58-
@FXML
59-
private CheckBox audioproxyCheckBox;
60-
@FXML
61-
private CheckBox timestampsCheckBox;
62-
@FXML
63-
private CheckBox multicoreCheckbox;
64-
@FXML
65-
private CheckBox audioMsgCheckBox;
66-
@FXML
67-
private CheckBox headMoveCheckBox;
68-
@FXML
69-
private CheckBox imeCheckBox;
70-
@FXML
71-
private CheckBox directModeCheckBox;
72-
@FXML
73-
private CheckBox nameTagStatusCheckBox;
49+
@FXML private Spinner<Integer> fpsLimitSpinner;
50+
@FXML private Spinner<Integer> pageSizeSpinner;
51+
@FXML private CheckBox audioproxyCheckBox;
52+
@FXML private CheckBox timestampsCheckBox;
53+
@FXML private CheckBox multicoreCheckbox;
54+
@FXML private CheckBox audioMsgCheckBox;
55+
@FXML private CheckBox headMoveCheckBox;
56+
@FXML private CheckBox imeCheckBox;
57+
@FXML private CheckBox directModeCheckBox;
58+
@FXML private CheckBox nameTagStatusCheckBox;
7459

7560
// TODO(MSC) Connection Settings
7661
// @FXML
7762
// private CheckBox askForUsernameOnConnectCheckBox;
7863

7964
// Update Settings
80-
@FXML
81-
private CheckBox showChangelogCheckBox;
82-
@FXML
83-
private CheckBox enableAutomaticUpdatesCheckBox;
84-
@FXML
85-
private Button manualUpdateButton;
65+
@FXML private CheckBox showChangelogCheckBox;
66+
@FXML private CheckBox enableAutomaticUpdatesCheckBox;
67+
@FXML private Button manualUpdateButton;
8668

8769
// Downloads
88-
@FXML
89-
private CheckBox allowCachingDownloadsCheckBox;
70+
@FXML private CheckBox allowCachingDownloadsCheckBox;
9071

9172
@Override
9273
public void initialize()
@@ -153,35 +134,26 @@ private void configureLegacyPropertyComponents()
153134
initLegacySettings(legacyProperties);
154135

155136
fpsLimitSpinner.valueProperty()
156-
.addListener(__ -> changeLegacyIntegerSetting(LegacySettingsController.FPS_LIMIT,
157-
fpsLimitSpinner.getValue()));
137+
.addListener(__ -> changeLegacyIntegerSetting(LegacySettingsController.FPS_LIMIT, fpsLimitSpinner.getValue()));
158138
pageSizeSpinner.valueProperty()
159-
.addListener(__ -> changeLegacyIntegerSetting(LegacySettingsController.PAGE_SIZE,
160-
pageSizeSpinner.getValue()));
139+
.addListener(__ -> changeLegacyIntegerSetting(LegacySettingsController.PAGE_SIZE, pageSizeSpinner.getValue()));
161140

162141
multicoreCheckbox
163-
.setOnAction(__ -> changeLegacyBooleanSetting(LegacySettingsController.MULTICORE,
164-
multicoreCheckbox.isSelected()));
142+
.setOnAction(__ -> changeLegacyBooleanSetting(LegacySettingsController.MULTICORE, multicoreCheckbox.isSelected()));
165143
audioMsgCheckBox
166-
.setOnAction(__ -> changeLegacyBooleanSetting(LegacySettingsController.AUDIO_MESSAGE_OFF,
167-
!audioMsgCheckBox.isSelected()));
144+
.setOnAction(__ -> changeLegacyBooleanSetting(LegacySettingsController.AUDIO_MESSAGE_OFF, !audioMsgCheckBox.isSelected()));
168145
audioproxyCheckBox
169-
.setOnAction(__ -> changeLegacyBooleanSetting(LegacySettingsController.AUDIO_PROXY_OFF,
170-
!audioproxyCheckBox.isSelected()));
146+
.setOnAction(__ -> changeLegacyBooleanSetting(LegacySettingsController.AUDIO_PROXY_OFF, !audioproxyCheckBox.isSelected()));
171147
timestampsCheckBox
172-
.setOnAction(__ -> changeLegacyBooleanSetting(LegacySettingsController.TIMESTAMP,
173-
timestampsCheckBox.isSelected()));
148+
.setOnAction(__ -> changeLegacyBooleanSetting(LegacySettingsController.TIMESTAMP, timestampsCheckBox.isSelected()));
174149
headMoveCheckBox
175-
.setOnAction(__ -> changeLegacyBooleanSetting(LegacySettingsController.HEAD_MOVE,
176-
!headMoveCheckBox.isSelected()));
150+
.setOnAction(__ -> changeLegacyBooleanSetting(LegacySettingsController.HEAD_MOVE, !headMoveCheckBox.isSelected()));
177151
imeCheckBox
178152
.setOnAction(__ -> changeLegacyBooleanSetting(LegacySettingsController.IME, imeCheckBox.isSelected()));
179153
directModeCheckBox
180-
.setOnAction(__ -> changeLegacyBooleanSetting(LegacySettingsController.DIRECT_MODE,
181-
directModeCheckBox.isSelected()));
154+
.setOnAction(__ -> changeLegacyBooleanSetting(LegacySettingsController.DIRECT_MODE, directModeCheckBox.isSelected()));
182155
nameTagStatusCheckBox
183-
.setOnAction(__ -> changeLegacyBooleanSetting(LegacySettingsController.NO_NAME_TAG_STATUS,
184-
!nameTagStatusCheckBox.isSelected()));
156+
.setOnAction(__ -> changeLegacyBooleanSetting(LegacySettingsController.NO_NAME_TAG_STATUS, !nameTagStatusCheckBox.isSelected()));
185157
}
186158

187159
private void initInformationArea()
@@ -192,7 +164,7 @@ private void initInformationArea()
192164
.append(System.lineSeparator())
193165
.append(System.lineSeparator())
194166
.append("Version: ")
195-
.append(ClientPropertiesController.getPropertyAsString(Property.LAST_TAG_NAME));
167+
.append(UpdateUtility.VERSION);
196168

197169
informationLabel.setText(builder.toString());
198170
}
@@ -220,30 +192,25 @@ private void initLegacySettings(final Properties legacyProperties)
220192
final boolean multicore = StringUtility.stringToBoolean(legacyProperties
221193
.getProperty(LegacySettingsController.MULTICORE, LegacySettingsController.MULTICORE_DEFAULT));
222194
final boolean audioMsgOff = !StringUtility.stringToBoolean(legacyProperties
223-
.getProperty(LegacySettingsController.AUDIO_MESSAGE_OFF,
224-
LegacySettingsController.AUDIO_MESSAGE_OFF_DEFAULT));
195+
.getProperty(LegacySettingsController.AUDIO_MESSAGE_OFF, LegacySettingsController.AUDIO_MESSAGE_OFF_DEFAULT));
225196
final boolean audioProxyOff = !StringUtility.stringToBoolean(legacyProperties
226-
.getProperty(LegacySettingsController.AUDIO_PROXY_OFF,
227-
LegacySettingsController.AUDIO_PROXY_OFF_DEFAULT));
197+
.getProperty(LegacySettingsController.AUDIO_PROXY_OFF, LegacySettingsController.AUDIO_PROXY_OFF_DEFAULT));
228198
final boolean timestamp = StringUtility.stringToBoolean(legacyProperties
229199
.getProperty(LegacySettingsController.TIMESTAMP, LegacySettingsController.TIMESTAMP_DEFAULT));
230200
final boolean disableHeadMove = !StringUtility.stringToBoolean(legacyProperties
231201
.getProperty(LegacySettingsController.HEAD_MOVE, LegacySettingsController.DISABLE_HEAD_MOVE_DEFAULT));
232202
final boolean ime = StringUtility.stringToBoolean(legacyProperties
233203
.getProperty(LegacySettingsController.IME, LegacySettingsController.IME_DEFAULT));
234204
final boolean noNameTagStatus = !StringUtility.stringToBoolean(legacyProperties
235-
.getProperty(LegacySettingsController.NO_NAME_TAG_STATUS,
236-
LegacySettingsController.NO_NAME_TAG_STATUS_DEFAULT));
205+
.getProperty(LegacySettingsController.NO_NAME_TAG_STATUS, LegacySettingsController.NO_NAME_TAG_STATUS_DEFAULT));
237206
final boolean directMode = StringUtility.stringToBoolean(legacyProperties
238207
.getProperty(LegacySettingsController.DIRECT_MODE, LegacySettingsController.DIRECT_MODE_DEFAULT));
239208

240209
final int fpsLimit = Integer
241-
.parseInt(legacyProperties.getProperty(LegacySettingsController.FPS_LIMIT,
242-
LegacySettingsController.FPS_LIMIT_DEFAULT));
210+
.parseInt(legacyProperties.getProperty(LegacySettingsController.FPS_LIMIT, LegacySettingsController.FPS_LIMIT_DEFAULT));
243211
fpsLimitSpinner.getValueFactory().setValue(fpsLimit);
244212
final int pageSize = Integer
245-
.parseInt(legacyProperties.getProperty(LegacySettingsController.PAGE_SIZE,
246-
LegacySettingsController.PAGE_SIZE_DEFAULT));
213+
.parseInt(legacyProperties.getProperty(LegacySettingsController.PAGE_SIZE, LegacySettingsController.PAGE_SIZE_DEFAULT));
247214
pageSizeSpinner.getValueFactory().setValue(pageSize);
248215

249216
multicoreCheckbox.setSelected(multicore);
@@ -258,10 +225,8 @@ private void initLegacySettings(final Properties legacyProperties)
258225
}
259226

260227
/**
261-
* Does a one way binding of a {@link CheckBox} to a {@link Property}. Initially
262-
* sets the value
263-
* of the {@link CheckBox} according to the {@link Property Properties} value.
264-
* As soon as the
228+
* Does a one way binding of a {@link CheckBox} to a {@link Property}. Initially sets the value
229+
* of the {@link CheckBox} according to the {@link Property Properties} value. As soon as the
265230
* {@link CheckBox} value changes, the {@link Property} value will also change.
266231
*
267232
* @param box
@@ -291,16 +256,13 @@ private void onClickClearDownloadCache()
291256
}
292257

293258
/**
294-
* Restores all settings to default. Some settings like
295-
* {@link Property#DEVELOPMENT} and
296-
* {@link Property#SHOW_CHANGELOG} won't be reset, since the user can't change
297-
* those anyways.
259+
* Restores all settings to default. Some settings like {@link Property#DEVELOPMENT} and
260+
* {@link Property#SHOW_CHANGELOG} won't be reset, since the user can't change those anyways.
298261
*/
299262
@FXML
300263
private void onClickRestore()
301264
{
302-
final Alert alert = new Alert(AlertType.CONFIRMATION, "Are you sure, that you want to reset all you settings?",
303-
ButtonType.YES, ButtonType.NO);
265+
final Alert alert = new Alert(AlertType.CONFIRMATION, "Are you sure, that you want to reset all you settings?", ButtonType.YES, ButtonType.NO);
304266
alert.setTitle("Reset settings");
305267
Client.insertAlertOwner(alert);
306268

client/src/main/java/com/msc/serverbrowser/util/UpdateUtility.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
import org.kohsuke.github.GitHubBuilder;
1212
import org.kohsuke.github.RateLimitHandler;
1313

14-
import com.msc.serverbrowser.data.properties.ClientPropertiesController;
15-
import com.msc.serverbrowser.data.properties.Property;
1614
import com.msc.serverbrowser.util.basic.ArrayUtility;
1715

1816
/**
@@ -23,6 +21,8 @@
2321
*/
2422
public final class UpdateUtility
2523
{
24+
public static final String VERSION = "1.3.6";
25+
2626
private UpdateUtility()
2727
{
2828
// Constructor to prevent instantiation
@@ -37,10 +37,9 @@ private UpdateUtility()
3737
*/
3838
public static Boolean isUpToDate() throws IOException
3939
{
40-
final String currentTagName = ClientPropertiesController.getPropertyAsString(Property.LAST_TAG_NAME);
41-
final String latestTag = getRelease().get().getTagName();
40+
final String latestVersion = getRelease().get().getTagName();
4241

43-
final CompareResult result = compareVersions(currentTagName, latestTag);
42+
final CompareResult result = compareVersions(VERSION, latestVersion);
4443
return result != CompareResult.LESS;
4544
}
4645

client/src/main/java/com/msc/serverbrowser/util/basic/FileUtility.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,6 @@ public static File downloadFile(final URL url, final String outputPath, final Do
116116
fileOutputStream.write(bytes, 0, (int) length);
117117
}
118118

119-
System.out.println(progressProperty.get());
120-
121119
return new File(outputPath);
122120
}
123121
}

0 commit comments

Comments
 (0)