User can choose how much he willing to spent on each frame (based on pull request from 'Rolf Aretz Lap'

This commit is contained in:
Laurent Clouet
2017-04-25 13:06:23 +02:00
parent 6f6af88582
commit 0508db7f75
7 changed files with 91 additions and 4 deletions

View File

@@ -47,6 +47,7 @@ public class SettingsLoader {
private String gpu;
private String cores;
private String ram;
private String renderTime;
private String cacheDir;
private String autoSignIn;
private String ui;
@@ -61,7 +62,7 @@ public class SettingsLoader {
path = path_;
}
public SettingsLoader(String login_, String password_, String proxy_, ComputeType computeMethod_, GPUDevice gpu_, int cores_, int maxRam_, String cacheDir_, boolean autoSignIn_, String ui_, String tileSize_, int priority_) {
public SettingsLoader(String login_, String password_, String proxy_, ComputeType computeMethod_, GPUDevice gpu_, int cores_, int maxRam_, int maxRenderTime_, String cacheDir_, boolean autoSignIn_, String ui_, String tileSize_, int priority_) {
path = getDefaultFilePath();
login = login_;
password = password_;
@@ -77,6 +78,9 @@ public class SettingsLoader {
if (maxRam_ > 0) {
ram = String.valueOf(maxRam_);
}
if (maxRenderTime_ > 0) {
renderTime = String.valueOf(maxRenderTime_);
}
if (computeMethod_ != null) {
try {
computeMethod = computeMethod_.name();
@@ -125,6 +129,10 @@ public class SettingsLoader {
prop.setProperty("ram", ram);
}
if (renderTime != null) {
prop.setProperty("rendertime", renderTime);
}
if (login != null) {
prop.setProperty("login", login);
}
@@ -193,6 +201,7 @@ public class SettingsLoader {
this.tileSize = null;
this.priority = 19; // must be the same default as Configuration
this.ram = null;
this.renderTime = null;
if (new File(path).exists() == false) {
return;
@@ -224,6 +233,10 @@ public class SettingsLoader {
this.ram = prop.getProperty("ram");
}
if (prop.containsKey("rendertime")) {
this.renderTime = prop.getProperty("rendertime");
}
if (prop.containsKey("login")) {
this.login = prop.getProperty("login");
}
@@ -315,6 +328,10 @@ public class SettingsLoader {
config.setMaxMemory(Integer.valueOf(ram));
}
if (config.getMaxRenderTime() == -1 && renderTime != null) {
config.setMaxRenderTime(Integer.valueOf(renderTime));
}
if (config.getUserSpecifiedACacheDir() == false && cacheDir != null && new File(cacheDir).exists()) {
config.setCacheDir(new File(cacheDir));
}