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 54a1820..75150b6 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,6 +33,7 @@ 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;
@@ -519,7 +520,7 @@ public class Working implements Activity {
}
private int getJobsQueueSize(Client client) {
- return client.getUploadQueueSize() + (client.isRunning() ? 1 : 0);
+ return client.getUploadQueueSize() + (client.getRenderingJob() != null ? 1 : 0);
}
class PauseAction implements ActionListener {
@@ -571,13 +572,17 @@ public class Working implements Activity {
}
public int showCloseDialog(int jobsQueueSize) {
- 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
+ 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
}
public void finishJobBeforeExit(Client client, int jobsQueueSize) {