From 3ef85b30b461972d264d7e259eca25762356c16e Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Tue, 17 Jul 2018 17:24:01 +0200 Subject: proper fix --- gui/yosystab.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'gui') diff --git a/gui/yosystab.cc b/gui/yosystab.cc index d83b969e..9bbd9c12 100644 --- a/gui/yosystab.cc +++ b/gui/yosystab.cc @@ -61,9 +61,9 @@ YosysTab::YosysTab(QString folder, QWidget *parent) : QWidget(parent) connect(process, SIGNAL(readyReadStandardError()), this, SLOT(onReadyReadStandardError())); connect(process, SIGNAL(readyReadStandardOutput()), this, SLOT(onReadyReadStandardOutput())); connect(process, &QProcess::started, this, [this] { lineEdit->setEnabled(true); }); -/* + #if QT_VERSION < QT_VERSION_CHECK(5, 6, 0) - connect(process, &QProcess::error, this, [this](QProcess::ProcessError error) { + connect(process, static_cast(&QProcess::error), this, [this](QProcess::ProcessError error) { #else connect(process, &QProcess::errorOccurred, this, [this](QProcess::ProcessError error) { #endif @@ -74,7 +74,6 @@ YosysTab::YosysTab(QString folder, QWidget *parent) : QWidget(parent) Q_EMIT deleteLater(); } }); -*/ process->setWorkingDirectory(folder); process->start("yosys"); } -- cgit v1.2.3 From 34772634317972aa4f816b6010a273bd7f3d17f3 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 18 Jul 2018 17:18:44 +0200 Subject: removed not used and buggy features --- gui/base.qrc | 1 - gui/basewindow.cc | 35 ---------------- gui/basewindow.h | 5 --- gui/designwidget.cc | 5 --- gui/designwidget.h | 2 - gui/ice40/mainwindow.cc | 1 - gui/infotab.cc | 58 ------------------------- gui/infotab.h | 48 --------------------- gui/resources/splash.png | Bin 4651 -> 0 bytes gui/yosys_edit.cc | 96 ------------------------------------------ gui/yosys_edit.h | 57 ------------------------- gui/yosystab.cc | 107 ----------------------------------------------- gui/yosystab.h | 59 -------------------------- 13 files changed, 474 deletions(-) delete mode 100644 gui/infotab.cc delete mode 100644 gui/infotab.h delete mode 100644 gui/resources/splash.png delete mode 100644 gui/yosys_edit.cc delete mode 100644 gui/yosys_edit.h delete mode 100644 gui/yosystab.cc delete mode 100644 gui/yosystab.h (limited to 'gui') diff --git a/gui/base.qrc b/gui/base.qrc index bf21986b..8f07aabe 100644 --- a/gui/base.qrc +++ b/gui/base.qrc @@ -9,6 +9,5 @@ resources/resultset_previous.png resources/resultset_next.png resources/resultset_last.png - resources/splash.png diff --git a/gui/basewindow.cc b/gui/basewindow.cc index 81c89e45..4a225bd6 100644 --- a/gui/basewindow.cc +++ b/gui/basewindow.cc @@ -29,7 +29,6 @@ #include "log.h" #include "mainwindow.h" #include "pythontab.h" -#include "yosystab.h" static void initBasenameResource() { Q_INIT_RESOURCE(base); } @@ -95,29 +94,12 @@ BaseMainWindow::BaseMainWindow(std::unique_ptr context, QWidget *parent splitter_v->addWidget(centralTabWidget); splitter_v->addWidget(tabWidget); - displaySplash(); } BaseMainWindow::~BaseMainWindow() {} void BaseMainWindow::closeTab(int index) { delete centralTabWidget->widget(index); } -void BaseMainWindow::displaySplash() -{ - splash = new QSplashScreen(); - splash->setPixmap(QPixmap(":/icons/resources/splash.png")); - splash->show(); - connect(designview, SIGNAL(finishContextLoad()), splash, SLOT(close())); - connect(designview, SIGNAL(contextLoadStatus(std::string)), this, SLOT(displaySplashMessage(std::string))); - QCoreApplication::instance()->processEvents(); -} - -void BaseMainWindow::displaySplashMessage(std::string msg) -{ - splash->showMessage(msg.c_str(), Qt::AlignCenter | Qt::AlignBottom, Qt::white); - QCoreApplication::instance()->processEvents(); -} - void BaseMainWindow::writeInfo(std::string text) { console->info(text); } void BaseMainWindow::createMenusAndBars() @@ -147,10 +129,6 @@ 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(); @@ -183,19 +161,6 @@ 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); - centralTabWidget->setTabToolTip(centralTabWidget->indexOf(yosysTab), folder); - } -} NEXTPNR_NAMESPACE_END diff --git a/gui/basewindow.h b/gui/basewindow.h index 087880ed..eee426c7 100644 --- a/gui/basewindow.h +++ b/gui/basewindow.h @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -50,17 +49,14 @@ class BaseMainWindow : public QMainWindow protected: void createMenusAndBars(); - void displaySplash(); protected Q_SLOTS: void writeInfo(std::string text); - void displaySplashMessage(std::string msg); void closeTab(int index); virtual void new_proj() = 0; virtual void open_proj() = 0; virtual bool save_proj() = 0; - void yosys(); Q_SIGNALS: void contextChanged(Context *ctx); @@ -78,7 +74,6 @@ class BaseMainWindow : public QMainWindow QAction *actionNew; QAction *actionOpen; QProgressBar *progressBar; - QSplashScreen *splash; DesignWidget *designview; }; diff --git a/gui/designwidget.cc b/gui/designwidget.cc index 335ed929..5181cd23 100644 --- a/gui/designwidget.cc +++ b/gui/designwidget.cc @@ -230,7 +230,6 @@ void DesignWidget::newContext(Context *ctx) bel_root->setText(0, "Bels"); treeWidget->insertTopLevelItem(0, bel_root); if (ctx) { - Q_EMIT contextLoadStatus("Configuring bels..."); for (auto bel : ctx->getBels()) { auto id = ctx->getBelName(bel); QStringList items = QString(id.c_str(ctx)).split("/"); @@ -263,7 +262,6 @@ void DesignWidget::newContext(Context *ctx) wire_root->setText(0, "Wires"); treeWidget->insertTopLevelItem(0, wire_root); if (ctx) { - Q_EMIT contextLoadStatus("Configuring wires..."); for (auto wire : ctx->getWires()) { auto id = ctx->getWireName(wire); QStringList items = QString(id.c_str(ctx)).split("/"); @@ -295,7 +293,6 @@ void DesignWidget::newContext(Context *ctx) pip_root->setText(0, "Pips"); treeWidget->insertTopLevelItem(0, pip_root); if (ctx) { - Q_EMIT contextLoadStatus("Configuring pips..."); for (auto pip : ctx->getPips()) { auto id = ctx->getPipName(pip); QStringList items = QString(id.c_str(ctx)).split("/"); @@ -331,8 +328,6 @@ void DesignWidget::newContext(Context *ctx) cells_root = new QTreeWidgetItem(treeWidget); cells_root->setText(0, "Cells"); treeWidget->insertTopLevelItem(0, cells_root); - - Q_EMIT finishContextLoad(); } void DesignWidget::updateTree() diff --git a/gui/designwidget.h b/gui/designwidget.h index 1afe817d..269e32fa 100644 --- a/gui/designwidget.h +++ b/gui/designwidget.h @@ -65,8 +65,6 @@ class DesignWidget : public QWidget void info(std::string text); void selected(std::vector decal); void highlight(std::vector decal, int group); - void finishContextLoad(); - void contextLoadStatus(std::string text); private Q_SLOTS: void prepareMenuProperty(const QPoint &pos); diff --git a/gui/ice40/mainwindow.cc b/gui/ice40/mainwindow.cc index 4b1f2c57..28792ed3 100644 --- a/gui/ice40/mainwindow.cc +++ b/gui/ice40/mainwindow.cc @@ -226,7 +226,6 @@ void MainWindow::new_proj() ctx = std::unique_ptr(new Context(chipArgs)); actionLoadJSON->setEnabled(true); - Q_EMIT displaySplash(); Q_EMIT contextChanged(ctx.get()); } } diff --git a/gui/infotab.cc b/gui/infotab.cc deleted file mode 100644 index dd44b806..00000000 --- a/gui/infotab.cc +++ /dev/null @@ -1,58 +0,0 @@ -/* - * nextpnr -- Next Generation Place and Route - * - * Copyright (C) 2018 Miodrag Milanovic - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -#include "infotab.h" -#include - -NEXTPNR_NAMESPACE_BEGIN - -InfoTab::InfoTab(QWidget *parent) : QWidget(parent) -{ - plainTextEdit = new QPlainTextEdit(); - plainTextEdit->setReadOnly(true); - QFont f("unexistent"); - f.setStyleHint(QFont::Monospace); - plainTextEdit->setFont(f); - - plainTextEdit->setContextMenuPolicy(Qt::CustomContextMenu); - QAction *clearAction = new QAction("Clear &buffer", this); - clearAction->setStatusTip("Clears display buffer"); - connect(clearAction, SIGNAL(triggered()), this, SLOT(clearBuffer())); - contextMenu = plainTextEdit->createStandardContextMenu(); - contextMenu->addSeparator(); - contextMenu->addAction(clearAction); - connect(plainTextEdit, SIGNAL(customContextMenuRequested(const QPoint)), this, SLOT(showContextMenu(const QPoint))); - - QGridLayout *mainLayout = new QGridLayout(); - mainLayout->addWidget(plainTextEdit); - setLayout(mainLayout); -} - -void InfoTab::info(std::string str) -{ - plainTextEdit->moveCursor(QTextCursor::End); - plainTextEdit->insertPlainText(str.c_str()); - plainTextEdit->moveCursor(QTextCursor::End); -} - -void InfoTab::showContextMenu(const QPoint &pt) { contextMenu->exec(mapToGlobal(pt)); } - -void InfoTab::clearBuffer() { plainTextEdit->clear(); } - -NEXTPNR_NAMESPACE_END diff --git a/gui/infotab.h b/gui/infotab.h deleted file mode 100644 index 41529973..00000000 --- a/gui/infotab.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * nextpnr -- Next Generation Place and Route - * - * Copyright (C) 2018 Miodrag Milanovic - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -#ifndef INFOTAB_H -#define INFOTAB_H - -#include -#include -#include "nextpnr.h" - -NEXTPNR_NAMESPACE_BEGIN - -class InfoTab : public QWidget -{ - Q_OBJECT - - public: - explicit InfoTab(QWidget *parent = 0); - void info(std::string str); - public Q_SLOTS: - void clearBuffer(); - private Q_SLOTS: - void showContextMenu(const QPoint &pt); - - private: - QPlainTextEdit *plainTextEdit; - QMenu *contextMenu; -}; - -NEXTPNR_NAMESPACE_END - -#endif // INFOTAB_H diff --git a/gui/resources/splash.png b/gui/resources/splash.png deleted file mode 100644 index 14d2842b..00000000 Binary files a/gui/resources/splash.png and /dev/null differ diff --git a/gui/yosys_edit.cc b/gui/yosys_edit.cc deleted file mode 100644 index 72d2430d..00000000 --- a/gui/yosys_edit.cc +++ /dev/null @@ -1,96 +0,0 @@ -/* - * nextpnr -- Next Generation Place and Route - * - * Copyright (C) 2018 Miodrag Milanovic - * Copyright (C) 2018 Alex Tsui - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -#include "yosys_edit.h" -#include -#include - -NEXTPNR_NAMESPACE_BEGIN - -YosysLineEditor::YosysLineEditor(QWidget *parent) : QLineEdit(parent), index(0) -{ - setContextMenuPolicy(Qt::CustomContextMenu); - QAction *clearAction = new QAction("Clear &history", this); - clearAction->setStatusTip("Clears line edit history"); - connect(clearAction, SIGNAL(triggered()), this, SLOT(clearHistory())); - contextMenu = createStandardContextMenu(); - contextMenu->addSeparator(); - contextMenu->addAction(clearAction); - - connect(this, SIGNAL(returnPressed()), SLOT(textInserted())); - connect(this, SIGNAL(customContextMenuRequested(const QPoint)), this, SLOT(showContextMenu(const QPoint))); -} - -void YosysLineEditor::keyPressEvent(QKeyEvent *ev) -{ - - if (ev->key() == Qt::Key_Up || ev->key() == Qt::Key_Down) { - QToolTip::hideText(); - if (lines.empty()) - return; - if (ev->key() == Qt::Key_Up) - index--; - if (ev->key() == Qt::Key_Down) - index++; - - if (index < 0) - index = 0; - if (index >= lines.size()) { - index = lines.size(); - clear(); - return; - } - setText(lines[index]); - } else if (ev->key() == Qt::Key_Escape) { - QToolTip::hideText(); - clear(); - return; - } else if (ev->key() == Qt::Key_Tab) { - return; - } - QToolTip::hideText(); - - QLineEdit::keyPressEvent(ev); -} - -// This makes TAB work -bool YosysLineEditor::focusNextPrevChild(bool next) { return false; } - -void YosysLineEditor::textInserted() -{ - if (lines.empty() || lines.back() != text()) - lines += text(); - if (lines.size() > 100) - lines.removeFirst(); - index = lines.size(); - clear(); - Q_EMIT textLineInserted(lines.back()); -} - -void YosysLineEditor::showContextMenu(const QPoint &pt) { contextMenu->exec(mapToGlobal(pt)); } - -void YosysLineEditor::clearHistory() -{ - lines.clear(); - index = 0; - clear(); -} - -NEXTPNR_NAMESPACE_END diff --git a/gui/yosys_edit.h b/gui/yosys_edit.h deleted file mode 100644 index 05e4ae36..00000000 --- a/gui/yosys_edit.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * nextpnr -- Next Generation Place and Route - * - * Copyright (C) 2018 Miodrag Milanovic - * Copyright (C) 2018 Alex Tsui - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -#ifndef YOSYS_EDIT_H -#define YOSYS_EDIT_H - -#include -#include -#include "nextpnr.h" - -NEXTPNR_NAMESPACE_BEGIN - -class YosysLineEditor : public QLineEdit -{ - Q_OBJECT - - public: - explicit YosysLineEditor(QWidget *parent = 0); - - private Q_SLOTS: - void textInserted(); - void showContextMenu(const QPoint &pt); - void clearHistory(); - - Q_SIGNALS: - void textLineInserted(QString); - - protected: - void keyPressEvent(QKeyEvent *) Q_DECL_OVERRIDE; - bool focusNextPrevChild(bool next) Q_DECL_OVERRIDE; - - private: - int index; - QStringList lines; - QMenu *contextMenu; -}; - -NEXTPNR_NAMESPACE_END - -#endif // YOSYS_EDIT_H diff --git a/gui/yosystab.cc b/gui/yosystab.cc deleted file mode 100644 index 9bbd9c12..00000000 --- a/gui/yosystab.cc +++ /dev/null @@ -1,107 +0,0 @@ -/* - * nextpnr -- Next Generation Place and Route - * - * Copyright (C) 2018 Miodrag Milanovic - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -#include "yosystab.h" -#include -#include - -NEXTPNR_NAMESPACE_BEGIN - -YosysTab::YosysTab(QString folder, QWidget *parent) : QWidget(parent) -{ - QFont f("unexistent"); - f.setStyleHint(QFont::Monospace); - - console = new QPlainTextEdit(); - console->setMinimumHeight(100); - console->setReadOnly(true); - console->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard); - console->setFont(f); - - console->setContextMenuPolicy(Qt::CustomContextMenu); - QAction *clearAction = new QAction("Clear &buffer", this); - clearAction->setStatusTip("Clears display buffer"); - connect(clearAction, SIGNAL(triggered()), this, SLOT(clearBuffer())); - contextMenu = console->createStandardContextMenu(); - contextMenu->addSeparator(); - contextMenu->addAction(clearAction); - connect(console, SIGNAL(customContextMenuRequested(const QPoint)), this, SLOT(showContextMenu(const QPoint))); - - lineEdit = new YosysLineEditor(); - lineEdit->setMinimumHeight(30); - lineEdit->setMaximumHeight(30); - lineEdit->setFont(f); - lineEdit->setFocus(); - lineEdit->setEnabled(false); - lineEdit->setPlaceholderText("yosys>"); - connect(lineEdit, SIGNAL(textLineInserted(QString)), this, SLOT(editLineReturnPressed(QString))); - - QGridLayout *mainLayout = new QGridLayout(); - mainLayout->addWidget(console, 0, 0); - mainLayout->addWidget(lineEdit, 1, 0); - setLayout(mainLayout); - - process = new QProcess(); - connect(process, SIGNAL(readyReadStandardError()), this, SLOT(onReadyReadStandardError())); - connect(process, SIGNAL(readyReadStandardOutput()), this, SLOT(onReadyReadStandardOutput())); - connect(process, &QProcess::started, this, [this] { lineEdit->setEnabled(true); }); - -#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0) - connect(process, static_cast(&QProcess::error), this, [this](QProcess::ProcessError error) { -#else - connect(process, &QProcess::errorOccurred, this, [this](QProcess::ProcessError error) { -#endif - if (error == QProcess::FailedToStart) { - QMessageBox::critical( - this, QString::fromUtf8("Yosys cannot be started!"), - QString::fromUtf8("

Please make sure you have Yosys installed and available in path

")); - Q_EMIT deleteLater(); - } - }); - process->setWorkingDirectory(folder); - process->start("yosys"); -} - -YosysTab::~YosysTab() -{ - process->terminate(); - process->waitForFinished(1000); // in ms - process->kill(); - process->close(); -} - -void YosysTab::displayString(QString text) -{ - QTextCursor cursor = console->textCursor(); - cursor.movePosition(QTextCursor::End); - cursor.insertText(text); - cursor.movePosition(QTextCursor::End); - console->setTextCursor(cursor); -} - -void YosysTab::onReadyReadStandardOutput() { displayString(process->readAllStandardOutput()); } -void YosysTab::onReadyReadStandardError() { displayString(process->readAllStandardError()); } - -void YosysTab::editLineReturnPressed(QString text) { process->write(text.toLatin1() + "\n"); } - -void YosysTab::showContextMenu(const QPoint &pt) { contextMenu->exec(mapToGlobal(pt)); } - -void YosysTab::clearBuffer() { console->clear(); } - -NEXTPNR_NAMESPACE_END diff --git a/gui/yosystab.h b/gui/yosystab.h deleted file mode 100644 index 1c668d15..00000000 --- a/gui/yosystab.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * nextpnr -- Next Generation Place and Route - * - * Copyright (C) 2018 Miodrag Milanovic - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -#ifndef YOSYSTAB_H -#define YOSYSTAB_H - -#include -#include -#include -#include -#include "nextpnr.h" -#include "yosys_edit.h" - -NEXTPNR_NAMESPACE_BEGIN - -class YosysTab : public QWidget -{ - Q_OBJECT - - public: - explicit YosysTab(QString folder, QWidget *parent = 0); - ~YosysTab(); - - private: - void displayString(QString text); - private Q_SLOTS: - void showContextMenu(const QPoint &pt); - void editLineReturnPressed(QString text); - void onReadyReadStandardOutput(); - void onReadyReadStandardError(); - public Q_SLOTS: - void clearBuffer(); - - private: - QPlainTextEdit *console; - YosysLineEditor *lineEdit; - QMenu *contextMenu; - QProcess *process; -}; - -NEXTPNR_NAMESPACE_END - -#endif // YOSYSTAB_H -- cgit v1.2.3 From 19828bdf455d9e7d554cab639a2cd045c897b671 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 18 Jul 2018 17:33:04 +0200 Subject: added clear action for browsing history --- gui/base.qrc | 1 + gui/designwidget.cc | 16 ++++++++++++++++ gui/designwidget.h | 1 + gui/resources/cross.png | Bin 0 -> 655 bytes 4 files changed, 18 insertions(+) create mode 100644 gui/resources/cross.png (limited to 'gui') diff --git a/gui/base.qrc b/gui/base.qrc index 8f07aabe..1a848f54 100644 --- a/gui/base.qrc +++ b/gui/base.qrc @@ -9,5 +9,6 @@ resources/resultset_previous.png resources/resultset_next.png resources/resultset_last.png + resources/cross.png diff --git a/gui/designwidget.cc b/gui/designwidget.cc index 5181cd23..93f71355 100644 --- a/gui/designwidget.cc +++ b/gui/designwidget.cc @@ -125,11 +125,27 @@ DesignWidget::DesignWidget(QWidget *parent) : QWidget(parent), ctx(nullptr), net updateButtons(); }); + actionClear = new QAction("", this); + actionClear->setIcon(QIcon(":/icons/resources/cross.png")); + actionClear->setEnabled(true); + connect(actionClear, &QAction::triggered, this, [this] { + history_index = -1; + history.clear(); + QTreeWidgetItem *clickItem = treeWidget->selectedItems().at(0); + if (clickItem->parent()) { + ElementType type = static_cast(clickItem)->getType(); + if (type != ElementType::NONE) + addToHistory(treeWidget->selectedItems().at(0)); + } + updateButtons(); + }); + QToolBar *toolbar = new QToolBar(); toolbar->addAction(actionFirst); toolbar->addAction(actionPrev); toolbar->addAction(actionNext); toolbar->addAction(actionLast); + toolbar->addAction(actionClear); QWidget *topWidget = new QWidget(); QVBoxLayout *vbox1 = new QVBoxLayout(); diff --git a/gui/designwidget.h b/gui/designwidget.h index 269e32fa..b5877f60 100644 --- a/gui/designwidget.h +++ b/gui/designwidget.h @@ -102,6 +102,7 @@ class DesignWidget : public QWidget QAction *actionPrev; QAction *actionNext; QAction *actionLast; + QAction *actionClear; QColor highlightColors[8]; QMap highlightSelected; diff --git a/gui/resources/cross.png b/gui/resources/cross.png new file mode 100644 index 00000000..1514d51a Binary files /dev/null and b/gui/resources/cross.png differ -- cgit v1.2.3 From af8b2b83f67a295d87b9f0ae9f17c408f5fedddc Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 18 Jul 2018 18:06:47 +0200 Subject: cell and net now can be selected, fixed issue with highlight --- gui/designwidget.cc | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) (limited to 'gui') diff --git a/gui/designwidget.cc b/gui/designwidget.cc index 93f71355..898ff0c6 100644 --- a/gui/designwidget.cc +++ b/gui/designwidget.cc @@ -488,13 +488,12 @@ void DesignWidget::onItemSelectionChanged() addToHistory(clickItem); clearProperties(); - if (type == ElementType::BEL) { - IdString c = static_cast(clickItem)->getData(); - BelId bel = ctx->getBelByName(c); - decals.push_back(ctx->getBelDecal(bel)); - Q_EMIT selected(decals); + IdString c = static_cast(clickItem)->getData(); + Q_EMIT selected(getDecals(type, c)); + if (type == ElementType::BEL) { + BelId bel = ctx->getBelByName(c); QtProperty *topItem = addTopLevelProperty("Bel"); addProperty(topItem, QVariant::String, "Name", c.c_str(ctx)); @@ -505,12 +504,7 @@ void DesignWidget::onItemSelectionChanged() ElementType::CELL); } else if (type == ElementType::WIRE) { - IdString c = static_cast(clickItem)->getData(); WireId wire = ctx->getWireByName(c); - - decals.push_back(ctx->getWireDecal(wire)); - Q_EMIT selected(decals); - QtProperty *topItem = addTopLevelProperty("Wire"); addProperty(topItem, QVariant::String, "Name", c.c_str(ctx)); @@ -562,12 +556,7 @@ void DesignWidget::onItemSelectionChanged() } } } else if (type == ElementType::PIP) { - IdString c = static_cast(clickItem)->getData(); PipId pip = ctx->getPipByName(c); - - decals.push_back(ctx->getPipDecal(pip)); - Q_EMIT selected(decals); - QtProperty *topItem = addTopLevelProperty("Pip"); addProperty(topItem, QVariant::String, "Name", c.c_str(ctx)); @@ -587,7 +576,6 @@ void DesignWidget::onItemSelectionChanged() addProperty(delayItem, QVariant::Double, "Fall", delay.fallDelay()); addProperty(delayItem, QVariant::Double, "Average", delay.avgDelay()); } else if (type == ElementType::NET) { - IdString c = static_cast(clickItem)->getData(); NetInfo *net = ctx->nets.at(c).get(); QtProperty *topItem = addTopLevelProperty("Net"); @@ -636,7 +624,6 @@ void DesignWidget::onItemSelectionChanged() } } else if (type == ElementType::CELL) { - IdString c = static_cast(clickItem)->getData(); CellInfo *cell = ctx->cells.at(c).get(); QtProperty *topItem = addTopLevelProperty("Cell"); @@ -700,19 +687,28 @@ std::vector DesignWidget::getDecals(ElementType type, IdString value) WireId wire = ctx->getWireByName(value); if (wire != WireId()) { decals.push_back(ctx->getWireDecal(wire)); - Q_EMIT selected(decals); } } break; case ElementType::PIP: { PipId pip = ctx->getPipByName(value); if (pip != PipId()) { decals.push_back(ctx->getPipDecal(pip)); - Q_EMIT selected(decals); } } break; case ElementType::NET: { + NetInfo *net = ctx->nets.at(value).get(); + for (auto &item : net->wires) { + decals.push_back(ctx->getWireDecal(item.first)); + if (item.second.pip != PipId()) { + decals.push_back(ctx->getPipDecal(item.second.pip)); + } + } } break; case ElementType::CELL: { + CellInfo *cell = ctx->cells.at(value).get(); + if (cell->bel != BelId()) { + decals.push_back(ctx->getBelDecal(cell->bel)); + } } break; default: break; -- cgit v1.2.3 From 2df7e130fbc18c81840a841b16f4780fbcfda34a Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 18 Jul 2018 18:37:54 +0200 Subject: Fix click on wire in net section --- gui/designwidget.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gui') diff --git a/gui/designwidget.cc b/gui/designwidget.cc index 898ff0c6..4123bf30 100644 --- a/gui/designwidget.cc +++ b/gui/designwidget.cc @@ -612,7 +612,7 @@ void DesignWidget::onItemSelectionChanged() auto name = ctx->getWireName(item.first).c_str(ctx); QtProperty *wireItem = addSubGroup(wiresItem, name); - addProperty(wireItem, QVariant::String, "Name", name); + addProperty(wireItem, QVariant::String, "Wire", name, ElementType::WIRE); if (item.second.pip != PipId()) addProperty(wireItem, QVariant::String, "Pip", ctx->getPipName(item.second.pip).c_str(ctx), -- cgit v1.2.3 From 53034959f338c952f4cf905890e44aad2ba202ae Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Fri, 20 Jul 2018 13:27:21 +0200 Subject: Start adding bitstream reading for ice40 --- gui/designwidget.cc | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'gui') diff --git a/gui/designwidget.cc b/gui/designwidget.cc index 4123bf30..d28b843b 100644 --- a/gui/designwidget.cc +++ b/gui/designwidget.cc @@ -334,16 +334,7 @@ void DesignWidget::newContext(Context *ctx) for (auto pip : nameToItem[2].toStdMap()) { pip_root->addChild(pip.second); } - - // Add nets to tree - nets_root = new QTreeWidgetItem(treeWidget); - nets_root->setText(0, "Nets"); - treeWidget->insertTopLevelItem(0, nets_root); - - // Add cells to tree - cells_root = new QTreeWidgetItem(treeWidget); - cells_root->setText(0, "Cells"); - treeWidget->insertTopLevelItem(0, cells_root); + updateTree(); } void DesignWidget::updateTree() -- cgit v1.2.3