aboutsummaryrefslogtreecommitdiffstats
path: root/gui/ice40/mainwindow.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/mainwindow.cc
parent6f12f2b7e8c58a0b14c6f1f3df2112b8860a6e4f (diff)
downloadnextpnr-0bd73c19778c9bdbc8e6d85c120715e239a9bc0d.tar.gz
nextpnr-0bd73c19778c9bdbc8e6d85c120715e239a9bc0d.tar.bz2
nextpnr-0bd73c19778c9bdbc8e6d85c120715e239a9bc0d.zip
Make GUI use recreated context
Diffstat (limited to 'gui/ice40/mainwindow.cc')
-rw-r--r--gui/ice40/mainwindow.cc26
1 files changed, 22 insertions, 4 deletions
diff --git a/gui/ice40/mainwindow.cc b/gui/ice40/mainwindow.cc
index 61ceb3e6..32074adc 100644
--- a/gui/ice40/mainwindow.cc
+++ b/gui/ice40/mainwindow.cc
@@ -36,14 +36,14 @@ static void initMainResource() { Q_INIT_RESOURCE(nextpnr); }
NEXTPNR_NAMESPACE_BEGIN
-MainWindow::MainWindow(Context *_ctx, QWidget *parent) : BaseMainWindow(_ctx, parent), timing_driven(false)
+MainWindow::MainWindow(QWidget *parent) : BaseMainWindow(parent), timing_driven(false)
{
initMainResource();
- std::string title = "nextpnr-ice40 - " + ctx->getChipName();
+ std::string title = "nextpnr-ice40 - [EMPTY]";
setWindowTitle(title.c_str());
- task = new TaskManager(_ctx);
+ task = new TaskManager();
connect(task, SIGNAL(log(std::string)), this, SLOT(writeInfo(std::string)));
connect(task, SIGNAL(loadfile_finished(bool)), this, SLOT(loadfile_finished(bool)));
@@ -58,6 +58,9 @@ MainWindow::MainWindow(Context *_ctx, QWidget *parent) : BaseMainWindow(_ctx, pa
connect(task, SIGNAL(taskStarted()), this, SLOT(taskStarted()));
connect(task, SIGNAL(taskPaused()), this, SLOT(taskPaused()));
+ connect(this, SIGNAL(contextChanged(Context*)), this, SLOT(newContext(Context*)));
+ connect(this, SIGNAL(contextChanged(Context*)), task, SIGNAL(contextChanged(Context*)));
+
createMenu();
}
@@ -178,12 +181,27 @@ void MainWindow::createMenu()
void MainWindow::new_proj()
{
disableActions();
+ ArchArgs chipArgs;
+ chipArgs.type = ArchArgs::HX1K;
+ chipArgs.package = "tq144";
+ if (ctx)
+ delete ctx;
+ ctx = new Context(chipArgs);
+
+ Q_EMIT contextChanged(ctx);
+
actionLoadJSON->setEnabled(true);
}
+void MainWindow::newContext(Context *ctx)
+{
+ std::string title = "nextpnr-ice40 - " + ctx->getChipName();
+ setWindowTitle(title.c_str());
+}
+
void MainWindow::open_proj()
{
- QString fileName = QFileDialog::getOpenFileName(this, QString("Open Project"), QString(), QString("*.npnr"));
+ QString fileName = QFileDialog::getOpenFileName(this, QString("Open Project"), QString(), QString("*.proj"));
if (!fileName.isEmpty()) {
tabWidget->setCurrentWidget(info);