Merge branch 'fix/ui-dialog' into 'master'
Fix: when there an empty queue, display a better exit dialog See merge request sheepitrenderfarm/client!235
This commit is contained in:
@@ -559,17 +559,30 @@ public class Working implements Activity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int jobsQueueSize = getJobsQueueSize(client);
|
int jobsQueueSize = getJobsQueueSize(client);
|
||||||
int userDecision = showCloseDialog(jobsQueueSize);
|
if (jobsQueueSize == 0) {
|
||||||
|
int userDecision = showCloseDialogNoFrame();
|
||||||
if (userDecision == 0) {
|
if (userDecision == 0) {
|
||||||
finishJobBeforeExit(client, jobsQueueSize);
|
exitImmediately(client);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (userDecision == 1) {
|
else {
|
||||||
exitImmediately(client);
|
int userDecision = showCloseDialog(jobsQueueSize);
|
||||||
|
if (userDecision == 0) {
|
||||||
|
finishJobBeforeExit(client, jobsQueueSize);
|
||||||
|
}
|
||||||
|
else if (userDecision == 1) {
|
||||||
|
exitImmediately(client);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int showCloseDialogNoFrame() {
|
||||||
|
String[] exitJobOptions = {"Exit Immediately", "Do Nothing" };
|
||||||
|
return JOptionPane.showOptionDialog(null, "Exit Now or Later", "Exit Now or Later",
|
||||||
|
JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, exitJobOptions, exitJobOptions[1]); // Make the "Do nothing" button the default one to avoid mistakes
|
||||||
|
}
|
||||||
|
|
||||||
public int showCloseDialog(int jobsQueueSize) {
|
public int showCloseDialog(int jobsQueueSize) {
|
||||||
String[] exitJobOptions = { "Exit after current Jobs", "Exit Immediately", "Do Nothing" };
|
String[] exitJobOptions = { "Exit after current Jobs", "Exit Immediately", "Do Nothing" };
|
||||||
return JOptionPane.showOptionDialog(null, String.format(
|
return JOptionPane.showOptionDialog(null, String.format(
|
||||||
|
|||||||
Reference in New Issue
Block a user