aboutsummaryrefslogtreecommitdiffstats
path: root/gui/ice40/worker.cc
diff options
context:
space:
mode:
authorMiodrag Milanovic <mmicko@gmail.com>2018-06-26 15:47:22 +0200
committerMiodrag Milanovic <mmicko@gmail.com>2018-06-26 15:47:43 +0200
commit0bd73c19778c9bdbc8e6d85c120715e239a9bc0d (patch)
treec269c560c2dc284a4721bea2722a73bb522e5e3e /gui/ice40/worker.cc
parent6f12f2b7e8c58a0b14c6f1f3df2112b8860a6e4f (diff)
downloadnextpnr-0bd73c19778c9bdbc8e6d85c120715e239a9bc0d.tar.gz
nextpnr-0bd73c19778c9bdbc8e6d85c120715e239a9bc0d.tar.bz2
nextpnr-0bd73c19778c9bdbc8e6d85c120715e239a9bc0d.zip
Make GUI use recreated context
Diffstat (limited to 'gui/ice40/worker.cc')
-rw-r--r--gui/ice40/worker.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/gui/ice40/worker.cc b/gui/ice40/worker.cc
index f6d6d261..c49b8769 100644
--- a/gui/ice40/worker.cc
+++ b/gui/ice40/worker.cc
@@ -35,7 +35,7 @@ struct WorkerInterruptionRequested
{
};
-Worker::Worker(Context *_ctx, TaskManager *parent) : ctx(_ctx)
+Worker::Worker(TaskManager *parent) : ctx(nullptr)
{
log_write_function = [this, parent](std::string text) {
Q_EMIT log(text);
@@ -56,6 +56,11 @@ Worker::Worker(Context *_ctx, TaskManager *parent) : ctx(_ctx)
};
}
+void Worker::newContext(Context *ctx_)
+{
+ ctx = ctx_;
+}
+
void Worker::loadfile(const std::string &filename)
{
Q_EMIT taskStarted();
@@ -136,9 +141,9 @@ void Worker::route()
}
}
-TaskManager::TaskManager(Context *ctx) : toTerminate(false), toPause(false)
+TaskManager::TaskManager() : toTerminate(false), toPause(false)
{
- Worker *worker = new Worker(ctx, this);
+ Worker *worker = new Worker(this);
worker->moveToThread(&workerThread);
connect(&workerThread, &QThread::finished, worker, &QObject::deleteLater);
@@ -151,6 +156,9 @@ TaskManager::TaskManager(Context *ctx) : toTerminate(false), toPause(false)
connect(this, &TaskManager::place, worker, &Worker::place);
connect(this, &TaskManager::route, worker, &Worker::route);
+
+ connect(this, &TaskManager::contextChanged, worker, &Worker::newContext);
+
connect(worker, &Worker::log, this, &TaskManager::info);
connect(worker, &Worker::loadfile_finished, this, &TaskManager::loadfile_finished);
connect(worker, &Worker::loadpcf_finished, this, &TaskManager::loadpcf_finished);