Display rendertime of previous frame
This commit is contained in:
@@ -49,6 +49,7 @@ public class Client {
|
||||
private Configuration config;
|
||||
private Log log;
|
||||
private Job renderingJob;
|
||||
private Job previousJob;
|
||||
private BlockingQueue<Job> jobsToValidate;
|
||||
private boolean isValidatingJob;
|
||||
private long start_time;
|
||||
@@ -65,6 +66,7 @@ public class Client {
|
||||
this.log = Log.getInstance(this.config);
|
||||
this.gui = gui_;
|
||||
this.renderingJob = null;
|
||||
this.previousJob = null;
|
||||
this.jobsToValidate = new ArrayBlockingQueue<Job>(1024);
|
||||
this.isValidatingJob = false;
|
||||
|
||||
@@ -781,9 +783,14 @@ public class Client {
|
||||
ajob.setOutputImagePath(null);
|
||||
|
||||
this.isValidatingJob = false;
|
||||
this.previousJob = ajob;
|
||||
return Error.Type.OK;
|
||||
}
|
||||
|
||||
public Job getPreviousJob() {
|
||||
return this.previousJob;
|
||||
}
|
||||
|
||||
protected boolean shouldWaitBeforeRender() {
|
||||
int concurrent_job = this.jobsToValidate.size();
|
||||
if (this.isValidatingJob) {
|
||||
|
||||
@@ -35,6 +35,7 @@ import java.util.Date;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
@@ -58,6 +59,7 @@ public class Working implements Activity {
|
||||
JLabel statusContent;
|
||||
JLabel renderedFrameContent;
|
||||
JLabel remainingFrameContent;
|
||||
JLabel lastRenderTime;
|
||||
JLabel lastRender;
|
||||
JLabel creditEarned;
|
||||
JButton pauseButton;
|
||||
@@ -84,6 +86,7 @@ public class Working implements Activity {
|
||||
waiting_projects_value = new JLabel("");
|
||||
connected_machines_value = new JLabel("");
|
||||
user_info_total_rendertime_this_session_value = new JLabel("");
|
||||
lastRenderTime = new JLabel("");
|
||||
lastRender = new JLabel("");
|
||||
}
|
||||
|
||||
@@ -150,8 +153,12 @@ public class Working implements Activity {
|
||||
|
||||
// last frame
|
||||
JPanel last_frame_panel = new JPanel();
|
||||
last_frame_panel.setLayout(new BoxLayout(last_frame_panel, BoxLayout.Y_AXIS));
|
||||
last_frame_panel.setBorder(BorderFactory.createTitledBorder("Last rendered frame"));
|
||||
lastRender.setIcon(new ImageIcon(new BufferedImage(200, 120, BufferedImage.TYPE_INT_ARGB)));
|
||||
lastRender.setAlignmentX(Component.CENTER_ALIGNMENT);
|
||||
lastRenderTime.setAlignmentX(Component.CENTER_ALIGNMENT);
|
||||
last_frame_panel.add(lastRenderTime);
|
||||
last_frame_panel.add(lastRender);
|
||||
|
||||
ImageIcon image = new ImageIcon(getClass().getResource("/title.png"));
|
||||
@@ -246,6 +253,7 @@ public class Working implements Activity {
|
||||
public void showLastRender() {
|
||||
Client client = parent.getClient();
|
||||
if (client != null) {
|
||||
Job lastJob = client.getPreviousJob();
|
||||
Server server = client.getServer();
|
||||
if (server != null) {
|
||||
byte[] data = server.getLastRender();
|
||||
@@ -255,6 +263,12 @@ public class Working implements Activity {
|
||||
BufferedImage image = ImageIO.read(is);
|
||||
if (image != null) {
|
||||
lastRender.setIcon(new ImageIcon(image));
|
||||
if (lastJob != null) {
|
||||
// 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())));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
|
||||
Reference in New Issue
Block a user