Merge branch 'revert-7d6d69c1' into 'master'

Revert "Merge branch 'fix/exit-dialog' into 'master'"

See merge request sheepitrenderfarm/client!206
This commit is contained in:
harlekin
2023-03-07 08:50:45 +00:00

View File

@@ -33,7 +33,6 @@ import java.awt.Image;
import java.io.File;
import java.io.IOException;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.Objects;
@@ -520,7 +519,7 @@ public class Working implements Activity {
}
private int getJobsQueueSize(Client client) {
return client.getUploadQueueSize() + (client.getRenderingJob() != null ? 1 : 0);
return client.getUploadQueueSize() + (client.isRunning() ? 1 : 0);
}
class PauseAction implements ActionListener {
@@ -572,17 +571,13 @@ public class Working implements Activity {
}
public int showCloseDialog(int jobsQueueSize) {
ArrayList<String> exitJobOptions = new ArrayList<String>();
if (jobsQueueSize > 0) {
exitJobOptions.add("Exit after current Jobs");
}
exitJobOptions.add("Exit Immediately");
exitJobOptions.add("Do Nothing");
String message = jobsQueueSize == 0 ? "Do you want to exit now?" : String.format("<html>You have <strong>%d frame%s</strong> being uploaded or rendered. Do you want to finish the jobs or exit now?.\n\n", jobsQueueSize, (jobsQueueSize > 1 ? "s" : ""));
return JOptionPane.showOptionDialog(null, message, "Exit Now or Later?",
JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, exitJobOptions.toArray(), exitJobOptions.size() - 1); // Make the "Do nothing" button the default one to avoid mistakes
String[] exitJobOptions = { "Exit after current Jobs", "Exit Immediately", "Do Nothing" };
return JOptionPane.showOptionDialog(null, String.format(
"<html>You have <strong>%d frame%s</strong> being uploaded or rendered. Do you want to finish the jobs or exit now?.\n\n",
jobsQueueSize, // Add the current frame to the total count ONLY if the client is running
(jobsQueueSize > 1 ? "s" : ""), (jobsQueueSize > 1 ? (jobsQueueSize + " ") : ""), (jobsQueueSize > 1 ? "s" : "")),
"Exit Now or Later", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, exitJobOptions,
exitJobOptions[2]); // Make the "Do nothing" button the default one to avoid mistakes
}
public void finishJobBeforeExit(Client client, int jobsQueueSize) {