@@ -2,7 +2,7 @@
|
||||
* Copyright (C) 2015 Laurent CLOUET
|
||||
* Author Laurent CLOUET <laurent.clouet@nopnop.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; version 2
|
||||
* of the License.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Copyright (C) 2015 Laurent CLOUET
|
||||
* Author Laurent CLOUET <laurent.clouet@nopnop.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; version 2
|
||||
* of the License.
|
||||
@@ -94,7 +94,7 @@ public class Settings implements Activity {
|
||||
private ButtonGroup themeOptionsGroup;
|
||||
private JRadioButton lightMode;
|
||||
private JRadioButton darkMode;
|
||||
|
||||
|
||||
private JCheckBox saveFile;
|
||||
private JCheckBox autoSignIn;
|
||||
JButton saveButton;
|
||||
@@ -108,13 +108,12 @@ public class Settings implements Activity {
|
||||
haveAutoStarted = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
@Override public void show() {
|
||||
Configuration config = parent.getConfiguration();
|
||||
new SettingsLoader(config.getConfigFilePath()).merge(config);
|
||||
|
||||
applyTheme(config.getTheme()); // apply the proper theme (light/dark)
|
||||
|
||||
applyTheme(config.getTheme()); // apply the proper theme (light/dark)
|
||||
|
||||
List<GPUDevice> gpus = GPU.listDevices(config);
|
||||
useGPUs.clear(); // Empty the auxiliary list (used in the list of checkboxes)
|
||||
|
||||
@@ -132,10 +131,10 @@ public class Settings implements Activity {
|
||||
++currentRow;
|
||||
|
||||
constraints.gridy = currentRow;
|
||||
parent.getContentPane().add(new JLabel(" "), constraints); // Add a separator between logo and first panel
|
||||
|
||||
parent.getContentPane().add(new JLabel(" "), constraints); // Add a separator between logo and first panel
|
||||
|
||||
currentRow++;
|
||||
|
||||
|
||||
// authentication
|
||||
CollapsibleJPanel authentication_panel = new CollapsibleJPanel(new GridLayout(2, 2));
|
||||
authentication_panel.setBorder(BorderFactory.createTitledBorder("Authentication"));
|
||||
@@ -165,33 +164,33 @@ public class Settings implements Activity {
|
||||
// Theme selection panel
|
||||
CollapsibleJPanel themePanel = new CollapsibleJPanel(new GridLayout(1, 3));
|
||||
themePanel.setBorder(BorderFactory.createTitledBorder("Theme"));
|
||||
|
||||
|
||||
themeOptionsGroup = new ButtonGroup();
|
||||
|
||||
|
||||
lightMode = new JRadioButton("Light");
|
||||
lightMode.setActionCommand("light");
|
||||
lightMode.setSelected(config.getTheme().equals("light"));
|
||||
lightMode.addActionListener(new ApplyThemeAction());
|
||||
|
||||
|
||||
darkMode = new JRadioButton("Dark");
|
||||
darkMode.setActionCommand("dark");
|
||||
darkMode.setSelected(config.getTheme().equals("dark"));
|
||||
darkMode.addActionListener(new ApplyThemeAction());
|
||||
|
||||
|
||||
themePanel.add(lightMode);
|
||||
themePanel.add(darkMode);
|
||||
|
||||
|
||||
// Group both radio buttons to allow only one selected
|
||||
themeOptionsGroup.add(lightMode);
|
||||
themeOptionsGroup.add(darkMode);
|
||||
|
||||
|
||||
currentRow++;
|
||||
constraints.gridx = 0;
|
||||
constraints.gridy = currentRow;
|
||||
constraints.gridwidth = 2;
|
||||
|
||||
|
||||
parent.getContentPane().add(themePanel, constraints);
|
||||
|
||||
|
||||
// directory
|
||||
CollapsibleJPanel directory_panel = new CollapsibleJPanel(new GridLayout(1, 3));
|
||||
directory_panel.setBorder(BorderFactory.createTitledBorder("Cache"));
|
||||
@@ -260,7 +259,7 @@ public class Settings implements Activity {
|
||||
|
||||
if (gpus.size() > 0) {
|
||||
renderbucketSizeLabel = new JLabel("Renderbucket size:");
|
||||
renderbucketSize = new JSlider();
|
||||
renderbucketSize = new JSlider();
|
||||
renderbucketSize.setMajorTickSpacing(1);
|
||||
renderbucketSize.setMinorTickSpacing(1);
|
||||
renderbucketSize.setPaintTicks(true);
|
||||
@@ -291,7 +290,7 @@ public class Settings implements Activity {
|
||||
// Initialisation values will apply if we are not able to detect the proper GPU technology or
|
||||
// because is a new one (different from CUDA and OPENCL). In that case, move into a safe position
|
||||
// of 32x32 pixel render bucket and a maximum of 128x128 pixel for the "unknown GPU"
|
||||
int maxRenderbucketSize = 128;
|
||||
int maxRenderbucketSize = 128;
|
||||
int recommendedBucketSize = 32;
|
||||
|
||||
if (config.getComputeMethod() == ComputeType.GPU || config.getComputeMethod() == ComputeType.CPU_GPU) {
|
||||
@@ -308,7 +307,7 @@ public class Settings implements Activity {
|
||||
recommendedBucketSize = gpu.getRecommendedRenderBucketSize(config.getGPUDevice().getMemory());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
buildRenderBucketSizeSlider(maxRenderbucketSize, config.getRenderbucketSize() != -1 ?
|
||||
((int) (Math.log(config.getRenderbucketSize()) / Math.log(2))) - 5 :
|
||||
((int) (Math.log(recommendedBucketSize) / Math.log(2))) - 5);
|
||||
@@ -331,14 +330,14 @@ public class Settings implements Activity {
|
||||
CPU cpu = new CPU();
|
||||
if (cpu.cores() > 1) { // if only one core is available, no need to show the choice
|
||||
double step = 1;
|
||||
double display = (double)cpu.cores() / step;
|
||||
double display = (double) cpu.cores() / step;
|
||||
while (display > 10) {
|
||||
step += 1.0;
|
||||
display = (double)cpu.cores() / step;
|
||||
display = (double) cpu.cores() / step;
|
||||
}
|
||||
|
||||
cpuCores = new JSlider(1, cpu.cores());
|
||||
cpuCores.setMajorTickSpacing((int)(step));
|
||||
cpuCores.setMajorTickSpacing((int) (step));
|
||||
cpuCores.setMinorTickSpacing(1);
|
||||
cpuCores.setPaintTicks(true);
|
||||
cpuCores.setPaintLabels(true);
|
||||
@@ -365,10 +364,10 @@ public class Settings implements Activity {
|
||||
int all_ram = (int) os.getMemory();
|
||||
ram = new JSlider(0, all_ram);
|
||||
int step = 1000000;
|
||||
double display = (double)all_ram / (double)step;
|
||||
double display = (double) all_ram / (double) step;
|
||||
while (display > 10) {
|
||||
step += 1000000;
|
||||
display = (double)all_ram / (double)step;
|
||||
display = (double) all_ram / (double) step;
|
||||
}
|
||||
Hashtable<Integer, JLabel> labelTable = new Hashtable<Integer, JLabel>();
|
||||
for (int g = 0; g < all_ram; g += step) {
|
||||
@@ -378,7 +377,7 @@ public class Settings implements Activity {
|
||||
ram.setLabelTable(labelTable);
|
||||
ram.setPaintTicks(true);
|
||||
ram.setPaintLabels(true);
|
||||
ram.setValue((int)(config.getMaxMemory() != -1 ? config.getMaxMemory() : os.getMemory()));
|
||||
ram.setValue((int) (config.getMaxMemory() != -1 ? config.getMaxMemory() : os.getMemory()));
|
||||
JLabel ramLabel = new JLabel("Memory:");
|
||||
|
||||
compute_devices_constraints.weightx = 1.0 / gpus.size();
|
||||
@@ -405,7 +404,7 @@ public class Settings implements Activity {
|
||||
priority.setPaintTicks(true);
|
||||
priority.setPaintLabels(true);
|
||||
priority.setValue(config.getPriority());
|
||||
JLabel priorityLabel = new JLabel(high_priority_support ? "Priority (High <-> Low):" : "Priority (Normal <-> Low):" );
|
||||
JLabel priorityLabel = new JLabel(high_priority_support ? "Priority (High <-> Low):" : "Priority (Normal <-> Low):");
|
||||
|
||||
compute_devices_constraints.weightx = 1.0 / gpus.size();
|
||||
compute_devices_constraints.gridx = 0;
|
||||
@@ -452,7 +451,7 @@ public class Settings implements Activity {
|
||||
if (parent.getConfiguration().getMaxRenderTime() > 0) {
|
||||
val = parent.getConfiguration().getMaxRenderTime() / 60;
|
||||
}
|
||||
renderTime = new JSpinner(new SpinnerNumberModel(val,0,1000,1));
|
||||
renderTime = new JSpinner(new SpinnerNumberModel(val, 0, 1000, 1));
|
||||
|
||||
advanced_panel.add(renderTimeLabel);
|
||||
advanced_panel.add(renderTime);
|
||||
@@ -482,8 +481,8 @@ public class Settings implements Activity {
|
||||
|
||||
currentRow++;
|
||||
constraints.gridy = currentRow;
|
||||
parent.getContentPane().add(new JLabel(" "), constraints); // Add a separator between last checkboxes and button
|
||||
|
||||
parent.getContentPane().add(new JLabel(" "), constraints); // Add a separator between last checkboxes and button
|
||||
|
||||
currentRow++;
|
||||
String buttonText = "Start";
|
||||
if (parent.getClient() != null) {
|
||||
@@ -540,19 +539,20 @@ public class Settings implements Activity {
|
||||
if (login.getText().isEmpty() || password.getPassword().length == 0 || Proxy.isValidURL(proxy.getText()) == false) {
|
||||
selected = false;
|
||||
}
|
||||
|
||||
|
||||
saveButton.setEnabled(selected);
|
||||
return selected;
|
||||
}
|
||||
|
||||
|
||||
private void applyTheme(String theme_) {
|
||||
try {
|
||||
if (theme_.equals("light")) {
|
||||
UIManager.setLookAndFeel(new FlatLightLaf());
|
||||
} else if (theme_.equals("dark")) {
|
||||
}
|
||||
else if (theme_.equals("dark")) {
|
||||
UIManager.setLookAndFeel(new FlatDarkLaf());
|
||||
}
|
||||
|
||||
|
||||
// Apply the new theme
|
||||
FlatLaf.updateUI();
|
||||
}
|
||||
@@ -563,9 +563,10 @@ public class Settings implements Activity {
|
||||
|
||||
class ChooseFileAction implements ActionListener {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
JOptionPane.showMessageDialog(parent.getContentPane(), "<html>The working directory has to be dedicated directory. <br />Caution, everything not related to SheepIt-Renderfarm will be removed.<br />You should create a directory specifically for it.</html>", "Warning: files will be removed!", JOptionPane.WARNING_MESSAGE);
|
||||
@Override public void actionPerformed(ActionEvent arg0) {
|
||||
JOptionPane.showMessageDialog(parent.getContentPane(),
|
||||
"<html>The working directory has to be dedicated directory. <br />Caution, everything not related to SheepIt-Renderfarm will be removed.<br />You should create a directory specifically for it.</html>",
|
||||
"Warning: files will be removed!", JOptionPane.WARNING_MESSAGE);
|
||||
int returnVal = cacheDirChooser.showOpenDialog(parent.getContentPane());
|
||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||
File file = cacheDirChooser.getSelectedFile();
|
||||
@@ -577,16 +578,14 @@ public class Settings implements Activity {
|
||||
|
||||
class CpuChangeAction implements ActionListener {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@Override public void actionPerformed(ActionEvent e) {
|
||||
checkDisplaySaveButton();
|
||||
}
|
||||
}
|
||||
|
||||
class GpuChangeAction implements ActionListener {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@Override public void actionPerformed(ActionEvent e) {
|
||||
renderbucketSizeLabel.setVisible(false);
|
||||
renderbucketSize.setVisible(false);
|
||||
|
||||
@@ -597,8 +596,8 @@ public class Settings implements Activity {
|
||||
}
|
||||
else {
|
||||
GPULister gpu;
|
||||
int maxRenderbucketSize = 128; // Max default render bucket size
|
||||
int recommendedBucketSize = 32; // Default recommended render bucket size
|
||||
int maxRenderbucketSize = 128; // Max default render bucket size
|
||||
int recommendedBucketSize = 32; // Default recommended render bucket size
|
||||
|
||||
if (useGPUs.get(counter).getGPUDevice().getType().equals("CUDA")) {
|
||||
gpu = new Nvidia();
|
||||
@@ -631,8 +630,7 @@ public class Settings implements Activity {
|
||||
|
||||
class AutoSignInChangeAction implements ActionListener {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@Override public void actionPerformed(ActionEvent e) {
|
||||
if (autoSignIn.isSelected()) {
|
||||
saveFile.setSelected(true);
|
||||
}
|
||||
@@ -640,16 +638,14 @@ public class Settings implements Activity {
|
||||
}
|
||||
|
||||
class ApplyThemeAction implements ActionListener {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@Override public void actionPerformed(ActionEvent e) {
|
||||
applyTheme(themeOptionsGroup.getSelection().getActionCommand());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class SaveAction implements ActionListener {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@Override public void actionPerformed(ActionEvent e) {
|
||||
if (parent == null) {
|
||||
return;
|
||||
}
|
||||
@@ -658,7 +654,7 @@ public class Settings implements Activity {
|
||||
if (config == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (themeOptionsGroup.getSelection().getActionCommand() != null)
|
||||
config.setTheme(themeOptionsGroup.getSelection().getActionCommand());
|
||||
|
||||
@@ -720,7 +716,7 @@ public class Settings implements Activity {
|
||||
|
||||
int max_rendertime = -1;
|
||||
if (renderTime != null) {
|
||||
max_rendertime = (Integer)renderTime.getValue() * 60;
|
||||
max_rendertime = (Integer) renderTime.getValue() * 60;
|
||||
config.setMaxRenderTime(max_rendertime);
|
||||
}
|
||||
|
||||
@@ -752,23 +748,11 @@ public class Settings implements Activity {
|
||||
}
|
||||
|
||||
if (saveFile.isSelected()) {
|
||||
parent.setSettingsLoader(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(),
|
||||
GuiSwing.type,
|
||||
themeOptionsGroup.getSelection().getActionCommand(), // selected theme
|
||||
priority.getValue()));
|
||||
parent.setSettingsLoader(
|
||||
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(), GuiSwing.type,
|
||||
themeOptionsGroup.getSelection().getActionCommand(), // selected theme
|
||||
priority.getValue()));
|
||||
|
||||
// wait for successful authentication (to store the public key)
|
||||
// or do we already have one?
|
||||
@@ -794,17 +778,14 @@ public class Settings implements Activity {
|
||||
|
||||
public class CheckCanStart implements KeyListener {
|
||||
|
||||
@Override
|
||||
public void keyPressed(KeyEvent arg0) {
|
||||
@Override public void keyPressed(KeyEvent arg0) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyReleased(KeyEvent arg0) {
|
||||
@Override public void keyReleased(KeyEvent arg0) {
|
||||
checkDisplaySaveButton();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyTyped(KeyEvent arg0) {
|
||||
@Override public void keyTyped(KeyEvent arg0) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Copyright (C) 2015 Laurent CLOUET
|
||||
* Author Laurent CLOUET <laurent.clouet@nopnop.net>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; version 2
|
||||
* of the License.
|
||||
@@ -102,8 +102,7 @@ public class Working implements Activity {
|
||||
log = Log.getInstance(parent_.getConfiguration());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
@Override public void show() {
|
||||
// If the stored theme and the UIManager's theme doesn't match is bc the user has changed it
|
||||
if (!currentTheme.equals(UIManager.getLookAndFeel().getName())) {
|
||||
// And, as the user has changed the theme, then we must recreate all the UI elements with session data
|
||||
@@ -127,11 +126,11 @@ public class Working implements Activity {
|
||||
lastRenderTime = new JLabel(lastRenderTime.getText());
|
||||
lastRender = new JLabel(lastRender.getText());
|
||||
userInfoQueuedUploadsAndSizeValue = new JLabel(userInfoQueuedUploadsAndSizeValue.getText());
|
||||
|
||||
|
||||
// set the new theme as the current one
|
||||
currentTheme = UIManager.getLookAndFeel().getName();
|
||||
}
|
||||
|
||||
|
||||
// current project
|
||||
JPanel current_project_panel = new JPanel(new SpringLayout());
|
||||
current_project_panel.setBorder(BorderFactory.createTitledBorder("Project"));
|
||||
@@ -248,12 +247,12 @@ public class Working implements Activity {
|
||||
global_constraints.weightx = 1;
|
||||
global_constraints.gridx = 0;
|
||||
|
||||
parent.getContentPane().add(new JLabel(" "), global_constraints); // Add a separator between logo and first panel
|
||||
parent.getContentPane().add(new JLabel(" "), global_constraints); // Add a separator between logo and first panel
|
||||
parent.getContentPane().add(current_project_panel, global_constraints);
|
||||
parent.getContentPane().add(global_stats_panel, global_constraints);
|
||||
parent.getContentPane().add(session_info_panel, global_constraints);
|
||||
parent.getContentPane().add(last_frame_panel, global_constraints);
|
||||
parent.getContentPane().add(new JLabel(" "), global_constraints); // Add a separator between last panel and buttons
|
||||
parent.getContentPane().add(new JLabel(" "), global_constraints); // Add a separator between last panel and buttons
|
||||
parent.getContentPane().add(buttonsPanel, global_constraints);
|
||||
|
||||
Spring widthLeftColumn = getBestWidth(current_project_panel, 4, 2);
|
||||
@@ -314,11 +313,9 @@ public class Working implements Activity {
|
||||
}
|
||||
|
||||
public void displayUploadQueueStats(int queueSize, long queueVolume) {
|
||||
userInfoQueuedUploadsAndSizeValue.setText(String.format("%d%s%s",
|
||||
queueSize,
|
||||
(queueSize > 0 ? String.format(" (%.2fMB) ", (queueVolume / 1024.0 / 1024.0)) : ""),
|
||||
(queueSize == this.parent.getConfiguration().getMaxUploadingJob() ? "- Queue full!" : "")
|
||||
));
|
||||
userInfoQueuedUploadsAndSizeValue.setText(
|
||||
String.format("%d%s%s", queueSize, (queueSize > 0 ? String.format(" (%.2fMB) ", (queueVolume / 1024.0 / 1024.0)) : ""),
|
||||
(queueSize == this.parent.getConfiguration().getMaxUploadingJob() ? "- Queue full!" : "")));
|
||||
|
||||
// If the user has requested to exit, then we need to update the JButton with the queue size
|
||||
if (this.exitAfterFrame.getText().startsWith("Cancel")) {
|
||||
@@ -330,20 +327,19 @@ public class Working implements Activity {
|
||||
}
|
||||
}
|
||||
|
||||
exitAfterFrame.setText(String.format("Cancel exit (%s frame%s to go)",
|
||||
queueSize,
|
||||
(queueSize > 1 ? "s" : ""))
|
||||
);
|
||||
exitAfterFrame.setText(String.format("Cancel exit (%s frame%s to go)", queueSize, (queueSize > 1 ? "s" : "")));
|
||||
}
|
||||
}
|
||||
|
||||
public void updateTime() {
|
||||
if (this.parent.getClient().getStartTime() != 0) {
|
||||
user_info_total_rendertime_this_session_value.setText(Utils.humanDuration(new Date((new Date().getTime() - this.parent.getClient().getStartTime()))));
|
||||
user_info_total_rendertime_this_session_value
|
||||
.setText(Utils.humanDuration(new Date((new Date().getTime() - this.parent.getClient().getStartTime()))));
|
||||
}
|
||||
Job job = this.parent.getClient().getRenderingJob();
|
||||
if (job != null && job.getProcessRender() != null && job.getProcessRender().getStartTime() > 0) {
|
||||
current_project_duration_value.setText("<html>" + Utils.humanDuration(new Date((new Date().getTime() - job.getProcessRender().getStartTime()))) + "</html>");
|
||||
current_project_duration_value
|
||||
.setText("<html>" + Utils.humanDuration(new Date((new Date().getTime() - job.getProcessRender().getStartTime()))) + "</html>");
|
||||
}
|
||||
else {
|
||||
current_project_duration_value.setText("");
|
||||
@@ -371,7 +367,7 @@ public class Working implements Activity {
|
||||
else {
|
||||
try {
|
||||
String path = lastJob.getOutputImagePath();
|
||||
|
||||
|
||||
BufferedImage img = ImageIO.read(new File(path));
|
||||
float width = img.getWidth();
|
||||
float height = img.getHeight();
|
||||
@@ -386,16 +382,16 @@ public class Working implements Activity {
|
||||
}
|
||||
catch (IOException e) {
|
||||
log.error(String.format("Working::showLastRender() Unable to load/preview rendered frame [%s]. Exception %s",
|
||||
lastJob.getOutputImagePath(),
|
||||
e.getMessage()));
|
||||
lastJob.getOutputImagePath(), e.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (icon != null) {
|
||||
lastRender.setIcon(icon);
|
||||
// don't use lastJob.getProcessRender().getDuration() due to timezone
|
||||
if (lastJob.getProcessRender().getDuration() > 1) {
|
||||
lastRenderTime.setText("Render time : " + Utils.humanDuration(new Date(lastJob.getProcessRender().getEndTime() - lastJob.getProcessRender().getStartTime())));
|
||||
lastRenderTime.setText("Render time : " + Utils
|
||||
.humanDuration(new Date(lastJob.getProcessRender().getEndTime() - lastJob.getProcessRender().getStartTime())));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -463,8 +459,7 @@ public class Working implements Activity {
|
||||
|
||||
class PauseAction implements ActionListener {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@Override public void actionPerformed(ActionEvent e) {
|
||||
Client client = parent.getClient();
|
||||
if (client != null) {
|
||||
if (client.isSuspended()) {
|
||||
@@ -482,8 +477,7 @@ public class Working implements Activity {
|
||||
}
|
||||
|
||||
class SettingsAction implements ActionListener {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@Override public void actionPerformed(ActionEvent e) {
|
||||
if (parent != null) {
|
||||
parent.showActivity(ActivityType.SETTINGS);
|
||||
}
|
||||
@@ -491,34 +485,22 @@ public class Working implements Activity {
|
||||
}
|
||||
|
||||
class ExitAfterAction implements ActionListener {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@Override public void actionPerformed(ActionEvent e) {
|
||||
Client client = parent.getClient();
|
||||
if (client != null) {
|
||||
if (client.isRunning()) {
|
||||
String[] exitJobOptions = {"Exit after current Jobs", "Exit Immediately", "Do Nothing"};
|
||||
String[] exitJobOptions = { "Exit after current Jobs", "Exit Immediately", "Do Nothing" };
|
||||
int jobsQueueSize = client.getUploadQueueSize() + (client.isRunning() ? 1 : 0);
|
||||
|
||||
int userDecision = 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,
|
||||
|
||||
int userDecision = 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
|
||||
|
||||
if (userDecision == 0) {
|
||||
exitAfterFrame.setText(String.format("Cancel exit (%s frame%s to go)",
|
||||
jobsQueueSize,
|
||||
(jobsQueueSize > 1 ? "s" : ""))
|
||||
);
|
||||
exitAfterFrame.setText(String.format("Cancel exit (%s frame%s to go)", jobsQueueSize, (jobsQueueSize > 1 ? "s" : "")));
|
||||
|
||||
client.askForStop();
|
||||
}
|
||||
@@ -536,8 +518,7 @@ public class Working implements Activity {
|
||||
}
|
||||
|
||||
class blockJobAction implements ActionListener {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@Override public void actionPerformed(ActionEvent e) {
|
||||
Client client = parent.getClient();
|
||||
if (client != null) {
|
||||
Job job = client.getRenderingJob();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Laurent CLOUET
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; version 2
|
||||
* of the License.
|
||||
@@ -105,8 +105,7 @@ public class CollapsibleJPanel extends JPanel {
|
||||
setMaximumSize(new Dimension(getMaximumSize().width, height));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component add(Component component) { // Need this to get the original height of panel
|
||||
@Override public Component add(Component component) { // Need this to get the original height of panel
|
||||
|
||||
Component returnComponent = super.add(component);
|
||||
|
||||
@@ -115,8 +114,7 @@ public class CollapsibleJPanel extends JPanel {
|
||||
return returnComponent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBorder(Border border) { // Need this to get the border title
|
||||
@Override public void setBorder(Border border) { // Need this to get the border title
|
||||
|
||||
if (border instanceof TitledBorder && (borderTitle == "")) {
|
||||
borderTitle = ((TitledBorder) border).getTitle();
|
||||
@@ -129,27 +127,22 @@ public class CollapsibleJPanel extends JPanel {
|
||||
|
||||
public class onClickHandler implements MouseListener {
|
||||
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
@Override public void mouseClicked(MouseEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e) {
|
||||
@Override public void mousePressed(MouseEvent e) {
|
||||
if (e.getPoint().y < COLLAPSED_HEIGHT) { // Only if click is on top of panel
|
||||
((CollapsibleJPanel) e.getComponent()).toggleCollapsed();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
@Override public void mouseEntered(MouseEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseExited(MouseEvent e) {
|
||||
@Override public void mouseExited(MouseEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e) {
|
||||
@Override public void mouseReleased(MouseEvent e) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user