ソースを参照

Merge branch 'master' of http://git.winfor.ch/nicolas/Almond

Nicolas Winkler 5 年 前
コミット
2514849040
3 ファイル変更17 行追加0 行削除
  1. 10 0
      Almond.cpp
  2. 5 0
      Almond.h
  3. 2 0
      BackgroundTask.h

+ 10 - 0
Almond.cpp

@@ -27,6 +27,16 @@ Almond::~Almond(void)
 }
 
 
+void Almond::submitBackgroundTask(BackgroundTask* task)
+{
+    bool taken = QThreadPool::globalInstance()->tryTake(task->getRunnable());
+    if (taken) {
+        ui.backgroundProgress->setRange(0, 0);
+        ui.backgroundProgress->setVisible(true);
+    }
+}
+
+
 void Almond::on_zoom_out_clicked()
 {
     mw->zoom(2);

+ 5 - 0
Almond.h

@@ -5,6 +5,7 @@
 
 #include <Mandel.h>
 #include "MandelWidget.h"
+#include "BackgroundTask.h"
 #include "exportdialogs.h"
 #include "gradientchoosedialog.h"
 #include "choosegenerators.h"
@@ -26,6 +27,8 @@ public:
     Almond(QWidget *parent = Q_NULLPTR);
     ~Almond(void);
 
+    void submitBackgroundTask(BackgroundTask* task);
+
 private slots:
     void on_zoom_out_clicked();
     void on_zoom_in_clicked();
@@ -40,6 +43,8 @@ private slots:
 
     void on_chooseGenerator_clicked();
 
+    void backgroundTaskFinished();
+
 private:
     Ui::AlmondClass ui;
 };

+ 2 - 0
BackgroundTask.h

@@ -7,6 +7,8 @@ class BackgroundTask
 {
 public:
     BackgroundTask(QRunnable* task);
+
+    QRunnable* getRunnable(void);
 };
 
 #endif // BACKGROUNDTASK_H