diff options
author | Clifford Wolf <clifford@clifford.at> | 2018-06-22 15:38:17 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2018-06-22 15:38:17 +0200 |
commit | 001c6ceb5661976eb3f0146c1b819a7f2ad8ea7d (patch) | |
tree | 06846f1268806265eaaa4d1ec97410e8c0045621 /gui | |
parent | 9b98a7175be440a6a59ddcc022615e04b8538bda (diff) | |
parent | 56c09fc5e5f7fb5c299f7a0b52e839556146615d (diff) | |
download | nextpnr-001c6ceb5661976eb3f0146c1b819a7f2ad8ea7d.tar.gz nextpnr-001c6ceb5661976eb3f0146c1b819a7f2ad8ea7d.tar.bz2 nextpnr-001c6ceb5661976eb3f0146c1b819a7f2ad8ea7d.zip |
Merge branch 'master' of gitlab.com:SymbioticEDA/nextpnr
Diffstat (limited to 'gui')
28 files changed, 423 insertions, 50 deletions
diff --git a/gui/CMakeLists.txt b/gui/CMakeLists.txt index b4dcde11..f19d2d20 100644 --- a/gui/CMakeLists.txt +++ b/gui/CMakeLists.txt @@ -3,7 +3,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON) aux_source_directory(. GUI_SOURCE_FILES) aux_source_directory(${family}/ GUI_SOURCE_FILES) -set(_RESOURCES nextpnr.qrc) +set(_RESOURCES base.qrc ${family}/nextpnr.qrc) qt5_add_resources(GUI_RESOURCE_FILES ${_RESOURCES}) diff --git a/gui/nextpnr.qrc b/gui/base.qrc index b9e2f237..b9e2f237 100644 --- a/gui/nextpnr.qrc +++ b/gui/base.qrc diff --git a/gui/basewindow.cc b/gui/basewindow.cc index 9020a719..f16b205d 100644 --- a/gui/basewindow.cc +++ b/gui/basewindow.cc @@ -10,10 +10,14 @@ #include "mainwindow.h"
#include "pythontab.h"
+static void initBasenameResource() { Q_INIT_RESOURCE(base); }
+
+NEXTPNR_NAMESPACE_BEGIN
+
BaseMainWindow::BaseMainWindow(Context *_ctx, QWidget *parent)
: QMainWindow(parent), ctx(_ctx)
{
- Q_INIT_RESOURCE(nextpnr);
+ initBasenameResource();
qRegisterMetaType<std::string>();
log_files.clear();
@@ -114,3 +118,5 @@ void BaseMainWindow::createMenusAndBars() mainToolBar->addAction(actionOpen);
mainToolBar->addAction(actionSave);
}
+
+NEXTPNR_NAMESPACE_END
diff --git a/gui/basewindow.h b/gui/basewindow.h index b20d4621..55e4affc 100644 --- a/gui/basewindow.h +++ b/gui/basewindow.h @@ -11,11 +11,10 @@ #include <QTabWidget>
#include <QToolBar>
-// FIXME
-USING_NEXTPNR_NAMESPACE
-
Q_DECLARE_METATYPE(std::string)
+NEXTPNR_NAMESPACE_BEGIN
+
class BaseMainWindow : public QMainWindow
{
Q_OBJECT
@@ -45,4 +44,6 @@ class BaseMainWindow : public QMainWindow QStatusBar *statusBar;
};
+NEXTPNR_NAMESPACE_END
+
#endif // BASEMAINWINDOW_H
diff --git a/gui/designwidget.cc b/gui/designwidget.cc index 9bb25992..7b1ce543 100644 --- a/gui/designwidget.cc +++ b/gui/designwidget.cc @@ -7,6 +7,8 @@ #include "fpgaviewwidget.h"
#include "pybindings.h"
+NEXTPNR_NAMESPACE_BEGIN
+
enum class ElementType
{
BEL,
@@ -234,3 +236,5 @@ void DesignWidget::selectObject() {
Q_EMIT info("selected " + itemContextMenu->text(0).toStdString() + "\n");
}
+
+NEXTPNR_NAMESPACE_END
diff --git a/gui/designwidget.h b/gui/designwidget.h index 9682726c..5bd12d4d 100644 --- a/gui/designwidget.h +++ b/gui/designwidget.h @@ -7,8 +7,7 @@ #include "qttreepropertybrowser.h"
#include "qtvariantproperty.h"
-// FIXME
-USING_NEXTPNR_NAMESPACE
+NEXTPNR_NAMESPACE_BEGIN
class DesignWidget : public QWidget
{
@@ -45,4 +44,6 @@ class DesignWidget : public QWidget QMap<QString, QtVariantProperty *> idToProperty;
};
+NEXTPNR_NAMESPACE_END
+
#endif // DESIGNWIDGET_H
diff --git a/gui/dummy/mainwindow.cc b/gui/dummy/mainwindow.cc index 7982c5f5..da162dd0 100644 --- a/gui/dummy/mainwindow.cc +++ b/gui/dummy/mainwindow.cc @@ -1,8 +1,14 @@ #include "mainwindow.h"
+static void initMainResource() { Q_INIT_RESOURCE(nextpnr); }
+
+NEXTPNR_NAMESPACE_BEGIN
+
MainWindow::MainWindow(Context *_ctx, QWidget *parent)
: BaseMainWindow(_ctx, parent)
{
+ initMainResource();
+
std::string title = "nextpnr-dummy - " + ctx->getChipName();
setWindowTitle(title.c_str());
@@ -19,4 +25,6 @@ void MainWindow::createMenu() void MainWindow::open() {}
-bool MainWindow::save() { return false; }
\ No newline at end of file +bool MainWindow::save() { return false; }
+
+NEXTPNR_NAMESPACE_END
diff --git a/gui/dummy/mainwindow.h b/gui/dummy/mainwindow.h index c9690f2c..c2786906 100644 --- a/gui/dummy/mainwindow.h +++ b/gui/dummy/mainwindow.h @@ -3,8 +3,7 @@ #include "../basewindow.h"
-// FIXME
-USING_NEXTPNR_NAMESPACE
+NEXTPNR_NAMESPACE_BEGIN
class MainWindow : public BaseMainWindow
{
@@ -22,4 +21,6 @@ class MainWindow : public BaseMainWindow virtual bool save();
};
+NEXTPNR_NAMESPACE_END
+
#endif // MAINWINDOW_H
diff --git a/gui/dummy/nextpnr.qrc b/gui/dummy/nextpnr.qrc new file mode 100644 index 00000000..03585ec0 --- /dev/null +++ b/gui/dummy/nextpnr.qrc @@ -0,0 +1,2 @@ +<RCC> +</RCC> diff --git a/gui/fpgaviewwidget.cc b/gui/fpgaviewwidget.cc index 6b7e7787..8119eae3 100644 --- a/gui/fpgaviewwidget.cc +++ b/gui/fpgaviewwidget.cc @@ -6,6 +6,8 @@ #include <math.h> #include "mainwindow.h" +NEXTPNR_NAMESPACE_BEGIN + FPGAViewWidget::FPGAViewWidget(QWidget *parent) : QOpenGLWidget(parent), m_xMove(0), m_yMove(0), m_zDistance(1.0) { @@ -173,3 +175,5 @@ void FPGAViewWidget::wheelEvent(QWheelEvent *event) setZoom(step.y() * -0.1f); } } + +NEXTPNR_NAMESPACE_END diff --git a/gui/fpgaviewwidget.h b/gui/fpgaviewwidget.h index 2407f757..fc3ca562 100644 --- a/gui/fpgaviewwidget.h +++ b/gui/fpgaviewwidget.h @@ -7,8 +7,7 @@ #include <QPainter> #include "nextpnr.h" -// FIXME -USING_NEXTPNR_NAMESPACE +NEXTPNR_NAMESPACE_BEGIN class FPGAViewWidget : public QOpenGLWidget, protected QOpenGLFunctions { @@ -49,4 +48,6 @@ class FPGAViewWidget : public QOpenGLWidget, protected QOpenGLFunctions Context *ctx; }; +NEXTPNR_NAMESPACE_END + #endif diff --git a/gui/ice40/mainwindow.cc b/gui/ice40/mainwindow.cc index 934798bb..0a248938 100644 --- a/gui/ice40/mainwindow.cc +++ b/gui/ice40/mainwindow.cc @@ -11,24 +11,105 @@ #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)
{
+ initMainResource();
+
std::string title = "nextpnr-ice40 - " + ctx->getChipName();
setWindowTitle(title.c_str());
- createMenu();
-
task = new TaskManager(_ctx);
connect(task, SIGNAL(log(std::string)), this, SLOT(writeInfo(std::string)));
+
+ connect(task, SIGNAL(loadfile_finished(bool)), this, SLOT(loadfile_finished(bool)));
+ connect(task, SIGNAL(pack_finished(bool)), this, SLOT(pack_finished(bool)));
+ connect(task, SIGNAL(place_finished(bool)), this, SLOT(place_finished(bool)));
+ connect(task, SIGNAL(route_finished(bool)), this, SLOT(route_finished(bool)));
+
+ connect(task, SIGNAL(taskCanceled()), this, SLOT(taskCanceled()));
+ connect(task, SIGNAL(taskStarted()), this, SLOT(taskStarted()));
+ connect(task, SIGNAL(taskPaused()), this, SLOT(taskPaused()));
+
+ createMenu();
}
-MainWindow::~MainWindow() {}
+MainWindow::~MainWindow() { delete task; }
void MainWindow::createMenu()
{
- QMenu *menu_Custom = new QMenu("&ICE 40", menuBar);
- menuBar->addAction(menu_Custom->menuAction());
+ QMenu *menu_Design = new QMenu("&Design", menuBar);
+ menuBar->addAction(menu_Design->menuAction());
+
+ actionPack = new QAction("Pack", this);
+ QIcon iconPack;
+ iconPack.addFile(QStringLiteral(":/icons/resources/pack.png"));
+ actionPack->setIcon(iconPack);
+ actionPack->setStatusTip("Pack current design");
+ connect(actionPack, SIGNAL(triggered()), task, SIGNAL(pack()));
+ actionPack->setEnabled(false);
+
+ actionPlace = new QAction("Place", this);
+ QIcon iconPlace;
+ iconPlace.addFile(QStringLiteral(":/icons/resources/place.png"));
+ actionPlace->setIcon(iconPlace);
+ actionPlace->setStatusTip("Place current design");
+ connect(actionPlace, SIGNAL(triggered()), task, SIGNAL(place()));
+ actionPlace->setEnabled(false);
+
+ actionRoute = new QAction("Route", this);
+ QIcon iconRoute;
+ iconRoute.addFile(QStringLiteral(":/icons/resources/route.png"));
+ actionRoute->setIcon(iconRoute);
+ actionRoute->setStatusTip("Route current design");
+ connect(actionRoute, SIGNAL(triggered()), task, SIGNAL(route()));
+ actionRoute->setEnabled(false);
+
+ QToolBar *taskFPGABar = new QToolBar();
+ addToolBar(Qt::TopToolBarArea, taskFPGABar);
+
+ taskFPGABar->addAction(actionPack);
+ taskFPGABar->addAction(actionPlace);
+ taskFPGABar->addAction(actionRoute);
+
+ menu_Design->addAction(actionPack);
+ menu_Design->addAction(actionPlace);
+ menu_Design->addAction(actionRoute);
+
+ actionPlay = new QAction("Play", this);
+ QIcon iconPlay;
+ iconPlay.addFile(QStringLiteral(":/icons/resources/control_play.png"));
+ actionPlay->setIcon(iconPlay);
+ actionPlay->setStatusTip("Continue running task");
+ connect(actionPlay, SIGNAL(triggered()), task, SLOT(continue_thread()));
+ actionPlay->setEnabled(false);
+
+ actionPause = new QAction("Pause", this);
+ QIcon iconPause;
+ iconPause.addFile(QStringLiteral(":/icons/resources/control_pause.png"));
+ actionPause->setIcon(iconPause);
+ actionPause->setStatusTip("Pause running task");
+ connect(actionPause, SIGNAL(triggered()), task, SLOT(pause_thread()));
+ actionPause->setEnabled(false);
+
+ actionStop = new QAction("Stop", this);
+ QIcon iconStop;
+ iconStop.addFile(QStringLiteral(":/icons/resources/control_stop.png"));
+ actionStop->setIcon(iconStop);
+ actionStop->setStatusTip("Stop running task");
+ connect(actionStop, SIGNAL(triggered()), task, SLOT(terminate_thread()));
+ actionStop->setEnabled(false);
+
+ QToolBar *taskToolBar = new QToolBar();
+ addToolBar(Qt::TopToolBarArea, taskToolBar);
+
+ taskToolBar->addAction(actionPlay);
+ taskToolBar->addAction(actionPause);
+ taskToolBar->addAction(actionStop);
}
void MainWindow::open()
@@ -39,7 +120,84 @@ void MainWindow::open() tabWidget->setCurrentWidget(info);
std::string fn = fileName.toStdString();
- task->parsejson(fn);
+ disableActions();
+ Q_EMIT task->loadfile(fn);
+ }
+}
+
+bool MainWindow::save() { return false; }
+
+void MainWindow::disableActions()
+{
+ actionPack->setEnabled(false);
+ actionPlace->setEnabled(false);
+ actionRoute->setEnabled(false);
+
+ actionPlay->setEnabled(false);
+ actionPause->setEnabled(false);
+ actionStop->setEnabled(false);
+}
+
+void MainWindow::loadfile_finished(bool status)
+{
+ disableActions();
+ if (status) {
+ log("Loading design successful.\n");
+ actionPack->setEnabled(true);
+ }
+ else {
+ log("Loading design failed.\n");
+ }
+}
+void MainWindow::pack_finished(bool status)
+{
+ disableActions();
+ if (status) {
+ log("Packing design successful.\n");
+ actionPlace->setEnabled(true);
+ }
+ else {
+ log("Packing design failed.\n");
+ }
+}
+void MainWindow::place_finished(bool status)
+{
+ disableActions();
+ if (status) {
+ log("Placing design successful.\n");
+ actionRoute->setEnabled(true);
+ }
+ else {
+ log("Placing design failed.\n");
}
}
-bool MainWindow::save() { return false; }
\ No newline at end of file +void MainWindow::route_finished(bool status)
+{
+ disableActions();
+ if (status)
+ log("Routing design successful.\n");
+ else
+ log("Routing design failed.\n");
+}
+
+void MainWindow::taskCanceled()
+{
+ log("CANCELED\n");
+ disableActions();
+}
+
+void MainWindow::taskStarted()
+{
+ disableActions();
+ actionPause->setEnabled(true);
+ actionStop->setEnabled(true);
+}
+
+void MainWindow::taskPaused()
+{
+ disableActions();
+ actionPlay->setEnabled(true);
+ actionStop->setEnabled(true);
+}
+
+NEXTPNR_NAMESPACE_END
\ No newline at end of file diff --git a/gui/ice40/mainwindow.h b/gui/ice40/mainwindow.h index fd65f9ae..9083ed8a 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
{
@@ -21,9 +20,27 @@ class MainWindow : public BaseMainWindow protected Q_SLOTS:
virtual void open();
virtual bool save();
+ void loadfile_finished(bool status);
+ void pack_finished(bool status);
+ void place_finished(bool status);
+ void route_finished(bool status);
+
+ void taskCanceled();
+ void taskStarted();
+ void taskPaused();
private:
+ void disableActions();
+
TaskManager *task;
+ QAction *actionPack;
+ QAction *actionPlace;
+ QAction *actionRoute;
+ QAction *actionPlay;
+ QAction *actionPause;
+ QAction *actionStop;
};
+NEXTPNR_NAMESPACE_END
+
#endif // MAINWINDOW_H
diff --git a/gui/ice40/nextpnr.qrc b/gui/ice40/nextpnr.qrc new file mode 100644 index 00000000..3bc68978 --- /dev/null +++ b/gui/ice40/nextpnr.qrc @@ -0,0 +1,10 @@ +<RCC> + <qresource prefix="/icons"> + <file>resources/control_play.png</file> + <file>resources/control_pause.png</file> + <file>resources/control_stop.png</file> + <file>resources/pack.png</file> + <file>resources/place.png</file> + <file>resources/route.png</file> + </qresource> +</RCC> diff --git a/gui/ice40/resources/control_pause.png b/gui/ice40/resources/control_pause.png Binary files differnew file mode 100644 index 00000000..ec61099b --- /dev/null +++ b/gui/ice40/resources/control_pause.png diff --git a/gui/ice40/resources/control_play.png b/gui/ice40/resources/control_play.png Binary files differnew file mode 100644 index 00000000..f8c8ec68 --- /dev/null +++ b/gui/ice40/resources/control_play.png diff --git a/gui/ice40/resources/control_stop.png b/gui/ice40/resources/control_stop.png Binary files differnew file mode 100644 index 00000000..e6f75d23 --- /dev/null +++ b/gui/ice40/resources/control_stop.png diff --git a/gui/ice40/resources/pack.png b/gui/ice40/resources/pack.png Binary files differnew file mode 100644 index 00000000..da3c2a2d --- /dev/null +++ b/gui/ice40/resources/pack.png diff --git a/gui/ice40/resources/place.png b/gui/ice40/resources/place.png Binary files differnew file mode 100644 index 00000000..0905f933 --- /dev/null +++ b/gui/ice40/resources/place.png diff --git a/gui/ice40/resources/route.png b/gui/ice40/resources/route.png Binary files differnew file mode 100644 index 00000000..258c16c6 --- /dev/null +++ b/gui/ice40/resources/route.png diff --git a/gui/ice40/worker.cc b/gui/ice40/worker.cc index 5702137b..9df24f65 100644 --- a/gui/ice40/worker.cc +++ b/gui/ice40/worker.cc @@ -10,47 +10,151 @@ #include "route.h" #include "timing.h" -Worker::Worker(Context *_ctx) : ctx(_ctx) +NEXTPNR_NAMESPACE_BEGIN + +struct WorkerInterruptionRequested +{ +}; + +Worker::Worker(Context *_ctx, TaskManager *parent) : ctx(_ctx) { - log_write_function = [this](std::string text) { Q_EMIT log(text); }; + log_write_function = [this, parent](std::string text) { + Q_EMIT log(text); + if (parent->shouldTerminate()) { + parent->clearTerminate(); + throw WorkerInterruptionRequested(); + } + if (parent->isPaused()) + { + Q_EMIT taskPaused(); + } + while (parent->isPaused()) { + if (parent->shouldTerminate()) { + parent->clearTerminate(); + throw WorkerInterruptionRequested(); + } + QThread::sleep(1); + } + }; } -void Worker::parsejson(const std::string &filename) +void Worker::loadfile(const std::string &filename) { + Q_EMIT taskStarted(); std::string fn = filename; std::ifstream f(fn); try { - if (!parse_json_file(f, fn, ctx)) - log_error("Loading design failed.\n"); - if (!pack_design(ctx)) - log_error("Packing design failed.\n"); + Q_EMIT loadfile_finished(parse_json_file(f, fn, ctx)); + } catch (WorkerInterruptionRequested) { + Q_EMIT taskCanceled(); + } +} + +void Worker::pack() +{ + Q_EMIT taskStarted(); + try { + Q_EMIT pack_finished(pack_design(ctx)); + } catch (WorkerInterruptionRequested) { + Q_EMIT taskCanceled(); + } +} + +void Worker::place() +{ + Q_EMIT taskStarted(); + try { double freq = 50e6; assign_budget(ctx, freq); print_utilisation(ctx); + Q_EMIT place_finished(place_design_sa(ctx)); + } catch (WorkerInterruptionRequested) { + Q_EMIT taskCanceled(); + } +} - if (!place_design_sa(ctx)) - log_error("Placing design failed.\n"); - if (!route_design(ctx)) - log_error("Routing design failed.\n"); - Q_EMIT log("done"); - } catch (log_execution_error_exception) { +void Worker::route() +{ + Q_EMIT taskStarted(); + try { + Q_EMIT route_finished(route_design(ctx)); + } catch (WorkerInterruptionRequested) { + Q_EMIT taskCanceled(); } } -TaskManager::TaskManager(Context *ctx) + +TaskManager::TaskManager(Context *ctx) : toTerminate(false), toPause(false) { - Worker *worker = new Worker(ctx); + Worker *worker = new Worker(ctx, this); worker->moveToThread(&workerThread); + connect(&workerThread, &QThread::finished, worker, &QObject::deleteLater); - connect(this, &TaskManager::parsejson, worker, &Worker::parsejson); + + connect(this, &TaskManager::loadfile, worker, &Worker::loadfile); + connect(this, &TaskManager::pack, worker, &Worker::pack); + connect(this, &TaskManager::place, worker, &Worker::place); + connect(this, &TaskManager::route, worker, &Worker::route); + connect(worker, &Worker::log, this, &TaskManager::info); + connect(worker, &Worker::loadfile_finished, this, &TaskManager::loadfile_finished); + connect(worker, &Worker::pack_finished, this, &TaskManager::pack_finished); + connect(worker, &Worker::place_finished, this, &TaskManager::place_finished); + connect(worker, &Worker::route_finished, this, &TaskManager::route_finished); + + connect(worker, &Worker::taskCanceled, this, &TaskManager::taskCanceled); + connect(worker, &Worker::taskStarted, this, &TaskManager::taskStarted); + connect(worker, &Worker::taskPaused, this, &TaskManager::taskPaused); + workerThread.start(); } TaskManager::~TaskManager() { + if (workerThread.isRunning()) + terminate_thread(); workerThread.quit(); workerThread.wait(); } -void TaskManager::info(const std::string &result) { Q_EMIT log(result); }
\ No newline at end of file +void TaskManager::info(const std::string &result) { Q_EMIT log(result); } + +void TaskManager::terminate_thread() +{ + QMutexLocker locker(&mutex); + toPause = false; + toTerminate = true; +} + +bool TaskManager::shouldTerminate() +{ + QMutexLocker locker(&mutex); + return toTerminate; +} + +void TaskManager::clearTerminate() +{ + QMutexLocker locker(&mutex); + toTerminate = false; +} + +void TaskManager::pause_thread() +{ + QMutexLocker locker(&mutex); + toPause = true; +} + +void TaskManager::continue_thread() +{ + QMutexLocker locker(&mutex); + toPause = false; + Q_EMIT taskStarted(); +} + +bool TaskManager::isPaused() +{ + QMutexLocker locker(&mutex); + return toPause; +} + +NEXTPNR_NAMESPACE_END diff --git a/gui/ice40/worker.h b/gui/ice40/worker.h index 12d740dd..320dc94c 100644 --- a/gui/ice40/worker.h +++ b/gui/ice40/worker.h @@ -1,21 +1,33 @@ #ifndef WORKER_H #define WORKER_H +#include <QMutex> #include <QThread> #include "nextpnr.h" -// FIXME -USING_NEXTPNR_NAMESPACE +NEXTPNR_NAMESPACE_BEGIN + +class TaskManager; class Worker : public QObject { Q_OBJECT public: - Worker(Context *ctx); + Worker(Context *ctx, TaskManager *parent); public Q_SLOTS: - void parsejson(const std::string &filename); + void loadfile(const std::string &); + void pack(); + void place(); + void route(); Q_SIGNALS: void log(const std::string &text); + void loadfile_finished(bool status); + void pack_finished(bool status); + void place_finished(bool status); + void route_finished(bool status); + void taskCanceled(); + void taskStarted(); + void taskPaused(); private: Context *ctx; @@ -29,11 +41,37 @@ class TaskManager : public QObject public: TaskManager(Context *ctx); ~TaskManager(); + bool shouldTerminate(); + void clearTerminate(); + bool isPaused(); public Q_SLOTS: void info(const std::string &text); + void terminate_thread(); + void pause_thread(); + void continue_thread(); Q_SIGNALS: - void parsejson(const std::string &); + void terminate(); + void loadfile(const std::string &); + void pack(); + void place(); + void route(); + + // redirected signals void log(const std::string &text); + void loadfile_finished(bool status); + void pack_finished(bool status); + void place_finished(bool status); + void route_finished(bool status); + void taskCanceled(); + void taskStarted(); + void taskPaused(); + + private: + QMutex mutex; + bool toTerminate; + bool toPause; }; +NEXTPNR_NAMESPACE_END + #endif // WORKER_H diff --git a/gui/infotab.cc b/gui/infotab.cc index 7690b83c..29d557d2 100644 --- a/gui/infotab.cc +++ b/gui/infotab.cc @@ -1,6 +1,8 @@ #include "infotab.h"
#include <QGridLayout>
+NEXTPNR_NAMESPACE_BEGIN
+
InfoTab::InfoTab(QWidget *parent) : QWidget(parent)
{
plainTextEdit = new QPlainTextEdit();
@@ -37,3 +39,5 @@ void InfoTab::showContextMenu(const QPoint &pt) }
void InfoTab::clearBuffer() { plainTextEdit->clear(); }
+
+NEXTPNR_NAMESPACE_END
diff --git a/gui/infotab.h b/gui/infotab.h index d7f1408c..3e0220c4 100644 --- a/gui/infotab.h +++ b/gui/infotab.h @@ -5,8 +5,7 @@ #include <QPlainTextEdit>
#include "nextpnr.h"
-// FIXME
-USING_NEXTPNR_NAMESPACE
+NEXTPNR_NAMESPACE_BEGIN
class InfoTab : public QWidget
{
@@ -24,4 +23,6 @@ class InfoTab : public QWidget QMenu *contextMenu;
};
+NEXTPNR_NAMESPACE_END
+
#endif // INFOTAB_H
diff --git a/gui/line_editor.cc b/gui/line_editor.cc index b5ed955f..6299c9cc 100644 --- a/gui/line_editor.cc +++ b/gui/line_editor.cc @@ -1,7 +1,8 @@ #include "line_editor.h" - #include <QKeyEvent> +NEXTPNR_NAMESPACE_BEGIN + LineEditor::LineEditor(QWidget *parent) : QLineEdit(parent), index(0) { setContextMenuPolicy(Qt::CustomContextMenu); @@ -64,4 +65,6 @@ void LineEditor::clearHistory() lines.clear(); index = 0; clear(); -}
\ No newline at end of file +} + +NEXTPNR_NAMESPACE_END
\ No newline at end of file diff --git a/gui/line_editor.h b/gui/line_editor.h index 15b675f9..5f27e502 100644 --- a/gui/line_editor.h +++ b/gui/line_editor.h @@ -3,6 +3,9 @@ #include <QLineEdit> #include <QMenu> +#include "nextpnr.h" + +NEXTPNR_NAMESPACE_BEGIN class LineEditor : public QLineEdit { @@ -28,4 +31,6 @@ class LineEditor : public QLineEdit QMenu *contextMenu; }; +NEXTPNR_NAMESPACE_END + #endif // LINE_EDITOR_H diff --git a/gui/pythontab.cc b/gui/pythontab.cc index 96a6c4b9..19aa0162 100644 --- a/gui/pythontab.cc +++ b/gui/pythontab.cc @@ -3,6 +3,8 @@ #include "emb.h"
#include "pybindings.h"
+NEXTPNR_NAMESPACE_BEGIN
+
PythonTab::PythonTab(QWidget *parent) : QWidget(parent)
{
PyImport_ImportModule("emb");
@@ -114,4 +116,6 @@ void PythonTab::showContextMenu(const QPoint &pt) contextMenu->exec(mapToGlobal(pt));
}
-void PythonTab::clearBuffer() { plainTextEdit->clear(); }
\ No newline at end of file +void PythonTab::clearBuffer() { plainTextEdit->clear(); }
+
+NEXTPNR_NAMESPACE_END
diff --git a/gui/pythontab.h b/gui/pythontab.h index 5aed8b0b..52a8ff8d 100644 --- a/gui/pythontab.h +++ b/gui/pythontab.h @@ -8,8 +8,7 @@ #include "line_editor.h"
#include "nextpnr.h"
-// FIXME
-USING_NEXTPNR_NAMESPACE
+NEXTPNR_NAMESPACE_BEGIN
class PythonTab : public QWidget
{
@@ -33,4 +32,6 @@ class PythonTab : public QWidget emb::stdout_write_type write;
};
+NEXTPNR_NAMESPACE_END
+
#endif // PYTHONTAB_H
|