removed not used and buggy features
This commit is contained in:
parent
50bf32665d
commit
3477263431
@ -9,6 +9,5 @@
|
|||||||
<file>resources/resultset_previous.png</file>
|
<file>resources/resultset_previous.png</file>
|
||||||
<file>resources/resultset_next.png</file>
|
<file>resources/resultset_next.png</file>
|
||||||
<file>resources/resultset_last.png</file>
|
<file>resources/resultset_last.png</file>
|
||||||
<file>resources/splash.png</file>
|
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@ -29,7 +29,6 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "pythontab.h"
|
#include "pythontab.h"
|
||||||
#include "yosystab.h"
|
|
||||||
|
|
||||||
static void initBasenameResource() { Q_INIT_RESOURCE(base); }
|
static void initBasenameResource() { Q_INIT_RESOURCE(base); }
|
||||||
|
|
||||||
@ -95,29 +94,12 @@ BaseMainWindow::BaseMainWindow(std::unique_ptr<Context> context, QWidget *parent
|
|||||||
|
|
||||||
splitter_v->addWidget(centralTabWidget);
|
splitter_v->addWidget(centralTabWidget);
|
||||||
splitter_v->addWidget(tabWidget);
|
splitter_v->addWidget(tabWidget);
|
||||||
displaySplash();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseMainWindow::~BaseMainWindow() {}
|
BaseMainWindow::~BaseMainWindow() {}
|
||||||
|
|
||||||
void BaseMainWindow::closeTab(int index) { delete centralTabWidget->widget(index); }
|
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::writeInfo(std::string text) { console->info(text); }
|
||||||
|
|
||||||
void BaseMainWindow::createMenusAndBars()
|
void BaseMainWindow::createMenusAndBars()
|
||||||
@ -147,10 +129,6 @@ void BaseMainWindow::createMenusAndBars()
|
|||||||
actionExit->setStatusTip("Exit the application");
|
actionExit->setStatusTip("Exit the application");
|
||||||
connect(actionExit, SIGNAL(triggered()), this, SLOT(close()));
|
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);
|
QAction *actionAbout = new QAction("About", this);
|
||||||
|
|
||||||
menuBar = new QMenuBar();
|
menuBar = new QMenuBar();
|
||||||
@ -183,19 +161,6 @@ void BaseMainWindow::createMenusAndBars()
|
|||||||
mainToolBar->addAction(actionNew);
|
mainToolBar->addAction(actionNew);
|
||||||
mainToolBar->addAction(actionOpen);
|
mainToolBar->addAction(actionOpen);
|
||||||
mainToolBar->addAction(actionSave);
|
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
|
NEXTPNR_NAMESPACE_END
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QMenuBar>
|
#include <QMenuBar>
|
||||||
#include <QProgressBar>
|
#include <QProgressBar>
|
||||||
#include <QSplashScreen>
|
|
||||||
#include <QStatusBar>
|
#include <QStatusBar>
|
||||||
#include <QTabWidget>
|
#include <QTabWidget>
|
||||||
#include <QToolBar>
|
#include <QToolBar>
|
||||||
@ -50,17 +49,14 @@ class BaseMainWindow : public QMainWindow
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
void createMenusAndBars();
|
void createMenusAndBars();
|
||||||
void displaySplash();
|
|
||||||
|
|
||||||
protected Q_SLOTS:
|
protected Q_SLOTS:
|
||||||
void writeInfo(std::string text);
|
void writeInfo(std::string text);
|
||||||
void displaySplashMessage(std::string msg);
|
|
||||||
void closeTab(int index);
|
void closeTab(int index);
|
||||||
|
|
||||||
virtual void new_proj() = 0;
|
virtual void new_proj() = 0;
|
||||||
virtual void open_proj() = 0;
|
virtual void open_proj() = 0;
|
||||||
virtual bool save_proj() = 0;
|
virtual bool save_proj() = 0;
|
||||||
void yosys();
|
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void contextChanged(Context *ctx);
|
void contextChanged(Context *ctx);
|
||||||
@ -78,7 +74,6 @@ class BaseMainWindow : public QMainWindow
|
|||||||
QAction *actionNew;
|
QAction *actionNew;
|
||||||
QAction *actionOpen;
|
QAction *actionOpen;
|
||||||
QProgressBar *progressBar;
|
QProgressBar *progressBar;
|
||||||
QSplashScreen *splash;
|
|
||||||
DesignWidget *designview;
|
DesignWidget *designview;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -230,7 +230,6 @@ void DesignWidget::newContext(Context *ctx)
|
|||||||
bel_root->setText(0, "Bels");
|
bel_root->setText(0, "Bels");
|
||||||
treeWidget->insertTopLevelItem(0, bel_root);
|
treeWidget->insertTopLevelItem(0, bel_root);
|
||||||
if (ctx) {
|
if (ctx) {
|
||||||
Q_EMIT contextLoadStatus("Configuring bels...");
|
|
||||||
for (auto bel : ctx->getBels()) {
|
for (auto bel : ctx->getBels()) {
|
||||||
auto id = ctx->getBelName(bel);
|
auto id = ctx->getBelName(bel);
|
||||||
QStringList items = QString(id.c_str(ctx)).split("/");
|
QStringList items = QString(id.c_str(ctx)).split("/");
|
||||||
@ -263,7 +262,6 @@ void DesignWidget::newContext(Context *ctx)
|
|||||||
wire_root->setText(0, "Wires");
|
wire_root->setText(0, "Wires");
|
||||||
treeWidget->insertTopLevelItem(0, wire_root);
|
treeWidget->insertTopLevelItem(0, wire_root);
|
||||||
if (ctx) {
|
if (ctx) {
|
||||||
Q_EMIT contextLoadStatus("Configuring wires...");
|
|
||||||
for (auto wire : ctx->getWires()) {
|
for (auto wire : ctx->getWires()) {
|
||||||
auto id = ctx->getWireName(wire);
|
auto id = ctx->getWireName(wire);
|
||||||
QStringList items = QString(id.c_str(ctx)).split("/");
|
QStringList items = QString(id.c_str(ctx)).split("/");
|
||||||
@ -295,7 +293,6 @@ void DesignWidget::newContext(Context *ctx)
|
|||||||
pip_root->setText(0, "Pips");
|
pip_root->setText(0, "Pips");
|
||||||
treeWidget->insertTopLevelItem(0, pip_root);
|
treeWidget->insertTopLevelItem(0, pip_root);
|
||||||
if (ctx) {
|
if (ctx) {
|
||||||
Q_EMIT contextLoadStatus("Configuring pips...");
|
|
||||||
for (auto pip : ctx->getPips()) {
|
for (auto pip : ctx->getPips()) {
|
||||||
auto id = ctx->getPipName(pip);
|
auto id = ctx->getPipName(pip);
|
||||||
QStringList items = QString(id.c_str(ctx)).split("/");
|
QStringList items = QString(id.c_str(ctx)).split("/");
|
||||||
@ -331,8 +328,6 @@ void DesignWidget::newContext(Context *ctx)
|
|||||||
cells_root = new QTreeWidgetItem(treeWidget);
|
cells_root = new QTreeWidgetItem(treeWidget);
|
||||||
cells_root->setText(0, "Cells");
|
cells_root->setText(0, "Cells");
|
||||||
treeWidget->insertTopLevelItem(0, cells_root);
|
treeWidget->insertTopLevelItem(0, cells_root);
|
||||||
|
|
||||||
Q_EMIT finishContextLoad();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DesignWidget::updateTree()
|
void DesignWidget::updateTree()
|
||||||
|
@ -65,8 +65,6 @@ class DesignWidget : public QWidget
|
|||||||
void info(std::string text);
|
void info(std::string text);
|
||||||
void selected(std::vector<DecalXY> decal);
|
void selected(std::vector<DecalXY> decal);
|
||||||
void highlight(std::vector<DecalXY> decal, int group);
|
void highlight(std::vector<DecalXY> decal, int group);
|
||||||
void finishContextLoad();
|
|
||||||
void contextLoadStatus(std::string text);
|
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void prepareMenuProperty(const QPoint &pos);
|
void prepareMenuProperty(const QPoint &pos);
|
||||||
|
@ -226,7 +226,6 @@ void MainWindow::new_proj()
|
|||||||
ctx = std::unique_ptr<Context>(new Context(chipArgs));
|
ctx = std::unique_ptr<Context>(new Context(chipArgs));
|
||||||
actionLoadJSON->setEnabled(true);
|
actionLoadJSON->setEnabled(true);
|
||||||
|
|
||||||
Q_EMIT displaySplash();
|
|
||||||
Q_EMIT contextChanged(ctx.get());
|
Q_EMIT contextChanged(ctx.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,58 +0,0 @@
|
|||||||
/*
|
|
||||||
* nextpnr -- Next Generation Place and Route
|
|
||||||
*
|
|
||||||
* Copyright (C) 2018 Miodrag Milanovic <miodrag@symbioticeda.com>
|
|
||||||
*
|
|
||||||
* 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 <QGridLayout>
|
|
||||||
|
|
||||||
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
|
|
@ -1,48 +0,0 @@
|
|||||||
/*
|
|
||||||
* nextpnr -- Next Generation Place and Route
|
|
||||||
*
|
|
||||||
* Copyright (C) 2018 Miodrag Milanovic <miodrag@symbioticeda.com>
|
|
||||||
*
|
|
||||||
* 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 <QMenu>
|
|
||||||
#include <QPlainTextEdit>
|
|
||||||
#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
|
|
Binary file not shown.
Before Width: | Height: | Size: 4.5 KiB |
@ -1,96 +0,0 @@
|
|||||||
/*
|
|
||||||
* nextpnr -- Next Generation Place and Route
|
|
||||||
*
|
|
||||||
* Copyright (C) 2018 Miodrag Milanovic <miodrag@symbioticeda.com>
|
|
||||||
* 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 <QKeyEvent>
|
|
||||||
#include <QToolTip>
|
|
||||||
|
|
||||||
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
|
|
@ -1,57 +0,0 @@
|
|||||||
/*
|
|
||||||
* nextpnr -- Next Generation Place and Route
|
|
||||||
*
|
|
||||||
* Copyright (C) 2018 Miodrag Milanovic <miodrag@symbioticeda.com>
|
|
||||||
* 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 <QLineEdit>
|
|
||||||
#include <QMenu>
|
|
||||||
#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
|
|
107
gui/yosystab.cc
107
gui/yosystab.cc
@ -1,107 +0,0 @@
|
|||||||
/*
|
|
||||||
* nextpnr -- Next Generation Place and Route
|
|
||||||
*
|
|
||||||
* Copyright (C) 2018 Miodrag Milanovic <miodrag@symbioticeda.com>
|
|
||||||
*
|
|
||||||
* 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 <QGridLayout>
|
|
||||||
#include <QMessageBox>
|
|
||||||
|
|
||||||
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<void (QProcess::*)(QProcess::ProcessError)>(&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("<p>Please make sure you have Yosys installed and available in path</p>"));
|
|
||||||
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
|
|
@ -1,59 +0,0 @@
|
|||||||
/*
|
|
||||||
* nextpnr -- Next Generation Place and Route
|
|
||||||
*
|
|
||||||
* Copyright (C) 2018 Miodrag Milanovic <miodrag@symbioticeda.com>
|
|
||||||
*
|
|
||||||
* 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 <QLineEdit>
|
|
||||||
#include <QMenu>
|
|
||||||
#include <QPlainTextEdit>
|
|
||||||
#include <QProcess>
|
|
||||||
#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
|
|
Loading…
Reference in New Issue
Block a user