Fix #47 User can block a project on his client
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user