Fix #47 User can block a project on his client

This commit is contained in:
Laurent Clouet
2015-10-27 21:00:44 +00:00
parent 8b25a08f6a
commit 4873b8272b
4 changed files with 36 additions and 1 deletions

View File

@@ -16,6 +16,7 @@ import javax.swing.JButton;
import javax.swing.JLabel;
import com.sheepit.client.Client;
import com.sheepit.client.Server;
import com.sheepit.client.os.OS;
import com.sheepit.client.standalone.GuiSwing;
import com.sheepit.client.standalone.GuiSwing.ActivityType;
@@ -134,6 +135,12 @@ public class Working implements Activity {
parent.getContentPane().add(pauseButton, constraints);
++currentRow;
JButton blockJob = new JButton("Block this project");
constraints.gridx = 1;
constraints.gridy = currentRow;
blockJob.addActionListener(new blockJobAction());
parent.getContentPane().add(blockJob, constraints);
exitAfterFrame = new JButton("Exit after this frame");
constraints.gridx = 2;
constraints.gridy = currentRow;
@@ -238,4 +245,16 @@ public class Working implements Activity {
}
}
class blockJobAction implements ActionListener {
@Override
public void actionPerformed(ActionEvent e) {
Client client = parent.getClient();
if (client != null) {
client.getRenderingJob().setAskForRendererKill(true);
client.getRenderingJob().setUserBlockJob(true);
OS.getOS().kill(client.getRenderingJob().getProcessRender().getProcess());
}
}
}
}