From 65d26692ae8736f67f3951f088b26086eeb6b829 Mon Sep 17 00:00:00 2001 From: Julian T Date: Thu, 13 Aug 2020 21:17:30 +0200 Subject: Added nicer ui which can save --- app/rendercoord.hpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'app/rendercoord.hpp') 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 #include #include @@ -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; }; -- cgit v1.2.3