Add SVG option to gui
This commit is contained in:
parent
affb12cc27
commit
3e95c57317
@ -30,5 +30,6 @@
|
||||
<file>resources/group.png</file>
|
||||
<file>resources/camera.png</file>
|
||||
<file>resources/film.png</file>
|
||||
<file>resources/save_svg.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -266,6 +266,11 @@ void BaseMainWindow::createMenusAndBars()
|
||||
actionMovie->setChecked(false);
|
||||
connect(actionMovie, &QAction::triggered, this, &BaseMainWindow::saveMovie);
|
||||
|
||||
actionSaveSVG = new QAction("Save SVG", this);
|
||||
actionSaveSVG->setIcon(QIcon(":/icons/resources/save_svg.png"));
|
||||
actionSaveSVG->setStatusTip("Saving a SVG");
|
||||
connect(actionSaveSVG, &QAction::triggered, this, &BaseMainWindow::saveSVG);
|
||||
|
||||
// set initial state
|
||||
fpgaView->enableDisableDecals(actionDisplayBel->isChecked(), actionDisplayWire->isChecked(),
|
||||
actionDisplayPip->isChecked(), actionDisplayGroups->isChecked());
|
||||
@ -334,6 +339,7 @@ void BaseMainWindow::createMenusAndBars()
|
||||
deviceViewToolBar->addSeparator();
|
||||
deviceViewToolBar->addAction(actionScreenshot);
|
||||
deviceViewToolBar->addAction(actionMovie);
|
||||
deviceViewToolBar->addAction(actionSaveSVG);
|
||||
|
||||
// Add status bar with progress bar
|
||||
statusBar = new QStatusBar();
|
||||
@ -416,6 +422,27 @@ void BaseMainWindow::saveMovie()
|
||||
fpgaView->movieStop();
|
||||
}
|
||||
}
|
||||
|
||||
void BaseMainWindow::saveSVG()
|
||||
{
|
||||
QString fileName = QFileDialog::getSaveFileName(this, QString("Save SVG"), QString(), QString("*.svg"));
|
||||
if (!fileName.isEmpty()) {
|
||||
if (!fileName.endsWith(".svg"))
|
||||
fileName += ".svg";
|
||||
bool ok;
|
||||
QString options =
|
||||
QInputDialog::getText(this, "Save SVG", tr("Save options:"), QLineEdit::Normal, "scale=500", &ok);
|
||||
if (ok) {
|
||||
try {
|
||||
ctx->writeSVG(fileName.toStdString(), options.toStdString());
|
||||
log("Saving SVG successful.\n");
|
||||
} catch (const log_execution_error_exception &ex) {
|
||||
log("Saving SVG failed.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BaseMainWindow::pack_finished(bool status)
|
||||
{
|
||||
disableActions();
|
||||
|
@ -85,6 +85,7 @@ class BaseMainWindow : public QMainWindow
|
||||
|
||||
void screenshot();
|
||||
void saveMovie();
|
||||
void saveSVG();
|
||||
|
||||
Q_SIGNALS:
|
||||
void contextChanged(Context *ctx);
|
||||
@ -134,6 +135,7 @@ class BaseMainWindow : public QMainWindow
|
||||
|
||||
QAction *actionScreenshot;
|
||||
QAction *actionMovie;
|
||||
QAction *actionSaveSVG;
|
||||
};
|
||||
|
||||
NEXTPNR_NAMESPACE_END
|
||||
|
BIN
gui/resources/save_svg.png
Normal file
BIN
gui/resources/save_svg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
Loading…
Reference in New Issue
Block a user