Allow user to set tile size

This commit is contained in:
Jackson
2016-09-21 23:26:44 +02:00
committed by Laurent Clouet
parent 6747b666ef
commit 55b909c98b
6 changed files with 143 additions and 11 deletions

View File

@@ -30,6 +30,7 @@ public class SettingsLoader {
private String cacheDir;
private String autoSignIn;
private String ui;
private String tileSize;
public SettingsLoader() {
path = getDefaultFilePath();
@@ -39,7 +40,7 @@ public class SettingsLoader {
path = path_;
}
public SettingsLoader(String login_, String password_, String proxy_, ComputeType computeMethod_, GPUDevice gpu_, int cores_, String cacheDir_, boolean autoSignIn_, String ui_) {
public SettingsLoader(String login_, String password_, String proxy_, ComputeType computeMethod_, GPUDevice gpu_, int cores_, String cacheDir_, boolean autoSignIn_, String ui_, String tileSize_) {
path = getDefaultFilePath();
login = login_;
password = password_;
@@ -47,6 +48,7 @@ public class SettingsLoader {
cacheDir = cacheDir_;
autoSignIn = String.valueOf(autoSignIn_);
ui = ui_;
tileSize = tileSize_;
if (cores_ > 0) {
cores = String.valueOf(cores_);
}
@@ -114,6 +116,10 @@ public class SettingsLoader {
prop.setProperty("ui", ui);
}
if (tileSize != null) {
prop.setProperty("tile-size", tileSize);
}
prop.store(output, null);
}
catch (IOException io) {
@@ -155,6 +161,7 @@ public class SettingsLoader {
this.cacheDir = null;
this.autoSignIn = null;
this.ui = null;
this.tileSize = null;
if (new File(path).exists() == false) {
return;
@@ -201,6 +208,10 @@ public class SettingsLoader {
if (prop.containsKey("ui")) {
this.ui = prop.getProperty("ui");
}
if (prop.containsKey("tile-size")) {
this.tileSize = prop.getProperty("tile-size");
}
}
catch (IOException io) {
io.printStackTrace();
@@ -265,6 +276,10 @@ public class SettingsLoader {
config.setUIType(ui);
}
if (config.getTileSize() == -1 && tileSize != null) {
config.setTileSize(Integer.valueOf(tileSize));
}
config.setAutoSignIn(Boolean.valueOf(autoSignIn));
}