Fix: reverse order of priority to be more user friendly

This commit is contained in:
Sheepit Renderfarm
2021-05-29 15:14:00 +00:00
parent 3ffbdbb19b
commit 40dfe8c0b1
2 changed files with 28 additions and 6 deletions

View File

@@ -16,7 +16,7 @@ public enum SwingTooltips {
MEMORY("How much RAM Sheepit may use. This isn't a 100% safe limit, since Blender can erroneously use more, \n" MEMORY("How much RAM Sheepit may use. This isn't a 100% safe limit, since Blender can erroneously use more, \n"
+ "but Sheepit will try its best to give you jobs that require less than what you've entered here."), + "but Sheepit will try its best to give you jobs that require less than what you've entered here."),
PRIORITY("Which priority in your system the rendering process should have. Note that minus 19 is the highest, 19 is the lowest."), PRIORITY("Which priority in your system the rendering process should have."),
MINIMIZE_TO_SYSTRAY("Whether Sheepit should vanish into your system tray (the icons next to the clock in the bottom right) when you minimize the window."), MINIMIZE_TO_SYSTRAY("Whether Sheepit should vanish into your system tray (the icons next to the clock in the bottom right) when you minimize the window."),

View File

@@ -428,14 +428,26 @@ public class Settings implements Activity {
parent.getContentPane().add(compute_devices_panel, constraints); parent.getContentPane().add(compute_devices_panel, constraints);
// priority // priority
// ui display low -> high but the actual values are reversed
// -19 is highest priority
boolean high_priority_support = os.getSupportHighPriority(); boolean high_priority_support = os.getSupportHighPriority();
priority = new JSlider(high_priority_support ? -19 : 0, 19); priority = new JSlider(high_priority_support ? -19 : 0, 19);
priority.setMajorTickSpacing(19); Hashtable<Integer, JLabel> labelTablePriority = new Hashtable<>();
labelTablePriority.put(high_priority_support ? -19 : 0, new JLabel("Low"));
labelTablePriority.put(19, new JLabel("High"));
priority.setLabelTable(labelTablePriority);
priority.setMinorTickSpacing(1); priority.setMinorTickSpacing(1);
priority.setPaintTicks(true); priority.setPaintTicks(true);
priority.setPaintLabels(true); priority.setPaintLabels(true);
priority.setValue(config.getPriority()); if (high_priority_support) {
JLabel priorityLabel = new JLabel(high_priority_support ? "Priority (High <-> Low):" : "Priority (Normal <-> Low):"); // inverse
priority.setValue(-1 * config.getPriority());
}
else {
priority.setValue(19 - config.getPriority());
}
JLabel priorityLabel = new JLabel("Priority");
priorityLabel.setToolTipText(SwingTooltips.PRIORITY.getText()); priorityLabel.setToolTipText(SwingTooltips.PRIORITY.getText());
boolean showPrioritySlider = os.checkNiceAvailability(); boolean showPrioritySlider = os.checkNiceAvailability();
@@ -770,7 +782,17 @@ public class Settings implements Activity {
config.setMaxRenderTime(max_rendertime); config.setMaxRenderTime(max_rendertime);
} }
config.setUsePriority(priority.getValue()); // ui display low -> high but the actual values are reversed
// -19 is highest priority
OS os = OS.getOS();
boolean high_priority_support = os.getSupportHighPriority();
if (high_priority_support) {
// inverse
config.setUsePriority(-1 * priority.getValue());
}
else {
config.setUsePriority(19 - priority.getValue());
}
String proxyText = null; String proxyText = null;
if (proxy != null) { if (proxy != null) {
@@ -801,7 +823,7 @@ public class Settings implements Activity {
parent.setSettingsLoader( parent.setSettingsLoader(
new SettingsLoader(config.getConfigFilePath(), login.getText(), new String(password.getPassword()), proxyText, hostnameText, method, new SettingsLoader(config.getConfigFilePath(), login.getText(), new String(password.getPassword()), proxyText, hostnameText, method,
selected_gpu, renderbucket_size, cpu_cores, max_ram, max_rendertime, cachePath, autoSignIn.isSelected(), useSysTray.isSelected(), selected_gpu, renderbucket_size, cpu_cores, max_ram, max_rendertime, cachePath, autoSignIn.isSelected(), useSysTray.isSelected(),
GuiSwing.type, themeOptionsGroup.getSelection().getActionCommand(), priority.getValue())); GuiSwing.type, themeOptionsGroup.getSelection().getActionCommand(), config.getPriority()));
// wait for successful authentication (to store the public key) // wait for successful authentication (to store the public key)
// or do we already have one? // or do we already have one?