From 7f368282700172925428e45f23b8b61e0bf39f94 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 22 Jun 2018 13:10:27 +0200 Subject: fixed namespace for gui section --- gui/ice40/mainwindow.cc | 22 +++++++++++++--------- gui/ice40/mainwindow.h | 5 +++-- gui/ice40/worker.cc | 10 +++++++--- gui/ice40/worker.h | 5 +++-- 4 files changed, 26 insertions(+), 16 deletions(-) (limited to 'gui/ice40') diff --git a/gui/ice40/mainwindow.cc b/gui/ice40/mainwindow.cc index 9ce7f41e..4c7bc18f 100644 --- a/gui/ice40/mainwindow.cc +++ b/gui/ice40/mainwindow.cc @@ -11,11 +11,15 @@ #include "place_sa.h" #include "route.h" +static void initMainResource() { Q_INIT_RESOURCE(nextpnr); } + +NEXTPNR_NAMESPACE_BEGIN + MainWindow::MainWindow(Context *_ctx, QWidget *parent) : BaseMainWindow(_ctx, parent) { - Q_INIT_RESOURCE(nextpnr); - + initMainResource(); + std::string title = "nextpnr-ice40 - " + ctx->getChipName(); setWindowTitle(title.c_str()); @@ -37,24 +41,21 @@ void MainWindow::createMenu() icon1.addFile(QStringLiteral(":/icons/resources/control_play.png")); actionPlay->setIcon(icon1); actionPlay->setStatusTip("Continue running task"); - connect(actionPlay, SIGNAL(triggered()), task, - SLOT(continue_thread())); + connect(actionPlay, SIGNAL(triggered()), task, SLOT(continue_thread())); QAction *actionPause = new QAction("Pause", this); QIcon icon2; icon2.addFile(QStringLiteral(":/icons/resources/control_pause.png")); actionPause->setIcon(icon2); actionPause->setStatusTip("Pause running task"); - connect(actionPause, SIGNAL(triggered()), task, - SLOT(pause_thread())); + connect(actionPause, SIGNAL(triggered()), task, SLOT(pause_thread())); QAction *actionStop = new QAction("Stop", this); QIcon icon3; icon3.addFile(QStringLiteral(":/icons/resources/control_stop.png")); actionStop->setIcon(icon3); actionStop->setStatusTip("Stop running task"); - connect(actionStop, SIGNAL(triggered()), task, - SLOT(terminate_thread())); + connect(actionStop, SIGNAL(triggered()), task, SLOT(terminate_thread())); QToolBar *taskToolBar = new QToolBar(); addToolBar(Qt::TopToolBarArea, taskToolBar); @@ -75,4 +76,7 @@ void MainWindow::open() Q_EMIT task->parsejson(fn); } } -bool MainWindow::save() { return false; } \ No newline at end of file + +bool MainWindow::save() { return false; } + +NEXTPNR_NAMESPACE_END \ No newline at end of file diff --git a/gui/ice40/mainwindow.h b/gui/ice40/mainwindow.h index fd65f9ae..712f341a 100644 --- a/gui/ice40/mainwindow.h +++ b/gui/ice40/mainwindow.h @@ -4,8 +4,7 @@ #include "../basewindow.h" #include "worker.h" -// FIXME -USING_NEXTPNR_NAMESPACE +NEXTPNR_NAMESPACE_BEGIN class MainWindow : public BaseMainWindow { @@ -26,4 +25,6 @@ class MainWindow : public BaseMainWindow TaskManager *task; }; +NEXTPNR_NAMESPACE_END + #endif // MAINWINDOW_H diff --git a/gui/ice40/worker.cc b/gui/ice40/worker.cc index 3854c67f..9549f659 100644 --- a/gui/ice40/worker.cc +++ b/gui/ice40/worker.cc @@ -10,6 +10,8 @@ #include "route.h" #include "timing.h" +NEXTPNR_NAMESPACE_BEGIN + struct WorkerInterruptionRequested { }; @@ -22,7 +24,7 @@ Worker::Worker(Context *_ctx, TaskManager *parent) : ctx(_ctx) parent->clearTerminate(); throw WorkerInterruptionRequested(); } - while (parent->isPaused()){ + while (parent->isPaused()) { QThread::sleep(1); } }; @@ -64,7 +66,7 @@ TaskManager::TaskManager(Context *ctx) : toTerminate(false), toPause(false) TaskManager::~TaskManager() { - if (workerThread.isRunning()) + if (workerThread.isRunning()) terminate_thread(); workerThread.quit(); workerThread.wait(); @@ -105,4 +107,6 @@ bool TaskManager::isPaused() { QMutexLocker locker(&mutex); return toPause; -} \ No newline at end of file +} + +NEXTPNR_NAMESPACE_END diff --git a/gui/ice40/worker.h b/gui/ice40/worker.h index 49d1df4d..181fafa3 100644 --- a/gui/ice40/worker.h +++ b/gui/ice40/worker.h @@ -5,8 +5,7 @@ #include #include "nextpnr.h" -// FIXME -USING_NEXTPNR_NAMESPACE +NEXTPNR_NAMESPACE_BEGIN class TaskManager; @@ -51,4 +50,6 @@ class TaskManager : public QObject bool toPause; }; +NEXTPNR_NAMESPACE_END + #endif // WORKER_H -- cgit v1.2.3