From 34772634317972aa4f816b6010a273bd7f3d17f3 Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Wed, 18 Jul 2018 17:18:44 +0200 Subject: [PATCH] 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 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 14d2842b95f853cf0947a5edb2fd398625d3c552..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4651 zcmc&&XH(OQ)BS}O5HKcmX)z)JsTMj?gMjoBkd8tGm1ZI+(gLUiL?8)OLb31{LltSE zD+-BT=|zgvAkqb-&x%`LlaDfdVHR#U0N@w;&q2U5iuh3yeAm*(3_J&hz$A4A z6KQS$0By8H89Uz}U!z22IuB=cwa0{n55kR61J^P>sefD$7wyzeC2>iJoSyUWIX~E2eFw)1-wui`sYo@=^H*EUmpB0 zuT%9`U;wqjDYVnd@cR?YpMWY<*59(-g|$M00`u^AD3!1a;M zXP#rR^_v+Zw$=ELd~UEjWglxL@U%vt`FPWW`c4u@dM-{HMTKvj$H(6f3KRsaW8Zj9 zSiG`h`p@r?8)Bpas@$=GO295AOM~_KcF3i9D<|*HZ)(S)XD9hi#5_lK)p|u?;eYtS5bBrZEFVm*e8Ixn1+~)1&c_|GamJFI+IG01 z52{f4&Z)f$!oR2Z05+2{(Fj={mp0M^B!JsyC>-;5raux2VkA;<8b0$TR}~QpHvjNv z98T&q47aO+!~BW3vx2@JirZJvP6#X)UKn42*ou6Manf-rprq1uw0Euk5vTCgwwlWg z7+@1Jg)+?&wk-M(X98y{ssU9~TMJI1IeiHce+nFC%w+4uv(*+(c=P$%@Ch0cnby#y zIVAFs8F*NvWP@4i^6~u6H+whe&Y^a$`sGs0v!eTxuNbMSa z9Jrt6KVffq52v>EDuzt2+t2Cn1VW?A8Zka9n#Qut`oVdp5OH9*3gTej|GGQ_O8a4a z%FJ3d;;Z7ypf0h+1=RzOEGItplij8fUZGcVolENoBf2Idk^ah>ao_3?CS1;LqQ{pg7cR@rhrtS9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rhX 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