aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiodrag Milanovic <mmicko@gmail.com>2018-06-22 13:10:27 +0200
committerMiodrag Milanovic <mmicko@gmail.com>2018-06-22 13:10:43 +0200
commit7f368282700172925428e45f23b8b61e0bf39f94 (patch)
tree0e5f5695807624f81fab2d70bfe93c4ed959287f
parent0448bed85901454280d56e7de132c3b16da39e6d (diff)
downloadnextpnr-7f368282700172925428e45f23b8b61e0bf39f94.tar.gz
nextpnr-7f368282700172925428e45f23b8b61e0bf39f94.tar.bz2
nextpnr-7f368282700172925428e45f23b8b61e0bf39f94.zip
fixed namespace for gui section
-rw-r--r--gui/basewindow.cc8
-rw-r--r--gui/basewindow.h7
-rw-r--r--gui/designwidget.cc4
-rw-r--r--gui/designwidget.h5
-rw-r--r--gui/dummy/mainwindow.cc10
-rw-r--r--gui/dummy/mainwindow.h5
-rw-r--r--gui/fpgaviewwidget.cc4
-rw-r--r--gui/fpgaviewwidget.h5
-rw-r--r--gui/ice40/mainwindow.cc22
-rw-r--r--gui/ice40/mainwindow.h5
-rw-r--r--gui/ice40/worker.cc10
-rw-r--r--gui/ice40/worker.h5
-rw-r--r--gui/infotab.cc4
-rw-r--r--gui/infotab.h5
-rw-r--r--gui/line_editor.cc7
-rw-r--r--gui/line_editor.h5
-rw-r--r--gui/pythontab.cc6
-rw-r--r--gui/pythontab.h5
-rw-r--r--ice40/main.cc2
19 files changed, 90 insertions, 34 deletions
diff --git a/gui/basewindow.cc b/gui/basewindow.cc
index b7258dd3..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(base);
+ 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/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 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 <QThread>
#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
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
diff --git a/ice40/main.cc b/ice40/main.cc
index 067637e8..9e925148 100644
--- a/ice40/main.cc
+++ b/ice40/main.cc
@@ -38,6 +38,8 @@
#include "timing.h"
#include "version.h"
+USING_NEXTPNR_NAMESPACE
+
void svg_dump_el(const GraphicElement &el)
{
float scale = 10.0, offset = 10.0;