From 5c99acf04dc4eadcd5c27630381af56d6ca2d4ad Mon Sep 17 00:00:00 2001 From: harlekin <5800926-mw102@users.noreply.gitlab.com> Date: Tue, 7 Mar 2023 08:50:45 +0000 Subject: [PATCH] Revert "Merge branch 'fix/exit-dialog' into 'master'" --- .../standalone/swing/activity/Working.java | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/sheepit/client/standalone/swing/activity/Working.java b/src/main/java/com/sheepit/client/standalone/swing/activity/Working.java index 75150b6..54a1820 100644 --- a/src/main/java/com/sheepit/client/standalone/swing/activity/Working.java +++ b/src/main/java/com/sheepit/client/standalone/swing/activity/Working.java @@ -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 exitJobOptions = new ArrayList(); - 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("You have %d frame%s 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( + "You have %d frame%s 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) {