diff options
author | Miodrag Milanovic <mmicko@gmail.com> | 2018-07-16 21:15:49 +0200 |
---|---|---|
committer | Miodrag Milanovic <mmicko@gmail.com> | 2018-07-16 21:15:49 +0200 |
commit | ee2ed461e6f2bab10234e437276c7b312437bf0c (patch) | |
tree | 4049c90e5dd8e711ac8e859a09f3f818b36b53c8 /gui/basewindow.cc | |
parent | 56fa8cc669f07194527e171474a514ef80af48e1 (diff) | |
download | nextpnr-ee2ed461e6f2bab10234e437276c7b312437bf0c.tar.gz nextpnr-ee2ed461e6f2bab10234e437276c7b312437bf0c.tar.bz2 nextpnr-ee2ed461e6f2bab10234e437276c7b312437bf0c.zip |
Added Yosys tab with interactive console
Diffstat (limited to 'gui/basewindow.cc')
-rw-r--r-- | gui/basewindow.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gui/basewindow.cc b/gui/basewindow.cc index 07b71105..af048f0e 100644 --- a/gui/basewindow.cc +++ b/gui/basewindow.cc @@ -29,6 +29,7 @@ #include "log.h"
#include "mainwindow.h"
#include "pythontab.h"
+#include "yosystab.h"
static void initBasenameResource() { Q_INIT_RESOURCE(base); }
@@ -73,8 +74,12 @@ BaseMainWindow::BaseMainWindow(std::unique_ptr<Context> context, QWidget *parent connect(this, SIGNAL(contextChanged(Context *)), console, SLOT(newContext(Context *)));
centralTabWidget = new QTabWidget();
+ centralTabWidget->setTabsClosable(true);
+ connect(centralTabWidget, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int)));
+
FPGAViewWidget *fpgaView = new FPGAViewWidget();
centralTabWidget->addTab(fpgaView, "Graphics");
+ centralTabWidget->tabBar()->tabButton(0, QTabBar::RightSide)->resize(0, 0);
connect(this, SIGNAL(contextChanged(Context *)), fpgaView, SLOT(newContext(Context *)));
connect(designview, SIGNAL(selected(std::vector<DecalXY>)), fpgaView,
@@ -95,6 +100,8 @@ BaseMainWindow::BaseMainWindow(std::unique_ptr<Context> context, QWidget *parent BaseMainWindow::~BaseMainWindow() {}
+void BaseMainWindow::closeTab(int index) { delete centralTabWidget->widget(index); }
+
void BaseMainWindow::displaySplash()
{
splash = new QSplashScreen();
@@ -140,6 +147,10 @@ void BaseMainWindow::createMenusAndBars() actionExit->setStatusTip("Exit the application");
connect(actionExit, SIGNAL(triggered()), this, SLOT(close()));
+ QAction *actionYosys = new QAction("Yosys", this);
+ actionYosys->setStatusTip("Run Yosys");
+ connect(actionYosys, SIGNAL(triggered()), this, SLOT(yosys()));
+
QAction *actionAbout = new QAction("About", this);
menuBar = new QMenuBar();
@@ -172,6 +183,18 @@ void BaseMainWindow::createMenusAndBars() mainToolBar->addAction(actionNew);
mainToolBar->addAction(actionOpen);
mainToolBar->addAction(actionSave);
+ mainToolBar->addAction(actionYosys);
}
+void BaseMainWindow::yosys()
+{
+ QString folder = QFileDialog::getExistingDirectory(0, ("Select Work Folder"), QDir::currentPath(),
+ QFileDialog::ShowDirsOnly);
+ if (!folder.isEmpty() && !folder.isNull()) {
+ YosysTab *yosysTab = new YosysTab(folder);
+ yosysTab->setAttribute(Qt::WA_DeleteOnClose);
+ centralTabWidget->addTab(yosysTab, "Yosys");
+ centralTabWidget->setCurrentWidget(yosysTab);
+ }
+}
NEXTPNR_NAMESPACE_END
|