aboutsummaryrefslogtreecommitdiff
path: root/app/rendercoord.hpp
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2020-08-13 21:17:30 +0200
committerJulian T <julian@jtle.dk>2020-08-13 21:17:30 +0200
commit65d26692ae8736f67f3951f088b26086eeb6b829 (patch)
tree7043254e116f2fab7690b5565d114a6afac3cd9b /app/rendercoord.hpp
parent5b0b916c561f602723b9ae80f5462a7939b652a1 (diff)
Added nicer ui which can save
Diffstat (limited to 'app/rendercoord.hpp')
-rw-r--r--app/rendercoord.hpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/app/rendercoord.hpp b/app/rendercoord.hpp
index 6aa8698..113b4dc 100644
--- a/app/rendercoord.hpp
+++ b/app/rendercoord.hpp
@@ -2,6 +2,7 @@
#define RENDER_THREAD_H
#include "draw.hpp"
+#include <qlabel.h>
#include <render.hpp>
#include <qobject.h>
@@ -19,6 +20,7 @@ class RenderThread : public QThread {
// Returns 0 if successful or 1 if busy
int render(QRgb *buffer, unsigned samples);
+ unsigned current_samples();
signals:
void done(unsigned workerid);
@@ -30,6 +32,7 @@ class RenderThread : public QThread {
QRgb *m_writebuffer;
unsigned m_samples;
+ unsigned m_current_samples;
Renderer m_render;
@@ -38,23 +41,34 @@ class RenderThread : public QThread {
unsigned m_id;
};
+const std::string states[] = { "Stopped", "Running" };
+enum State { stopped, running };
+
class RenderCoordinator : public QObject {
Q_OBJECT
public:
- RenderCoordinator(QObject *parent, DrawWidget &target, Renderer r);
+ RenderCoordinator(QObject *parent, DrawWidget &target, Renderer r, QLabel *status=nullptr);
void setSamples(unsigned samples);
void render();
public slots:
void workerDone(unsigned workerid);
+ private slots:
+ void updateUi();
+
private:
DrawWidget &m_target;
Renderer m_renderer;
RenderThread m_worker;
+ QLabel *m_status;
+ QTimer m_timer;
+
+ State m_state;
+
unsigned m_samples;
};