Added Save ASC option
This commit is contained in:
parent
103dde79de
commit
e770f16a22
@ -48,6 +48,7 @@ MainWindow::MainWindow(Context *_ctx, QWidget *parent) : BaseMainWindow(_ctx, pa
|
||||
|
||||
connect(task, SIGNAL(loadfile_finished(bool)), this, SLOT(loadfile_finished(bool)));
|
||||
connect(task, SIGNAL(loadpcf_finished(bool)), this, SLOT(loadpcf_finished(bool)));
|
||||
connect(task, SIGNAL(saveasc_finished(bool)), this, SLOT(saveasc_finished(bool)));
|
||||
connect(task, SIGNAL(pack_finished(bool)), this, SLOT(pack_finished(bool)));
|
||||
connect(task, SIGNAL(budget_finish(bool)), this, SLOT(budget_finish(bool)));
|
||||
connect(task, SIGNAL(place_finished(bool)), this, SLOT(place_finished(bool)));
|
||||
@ -107,6 +108,14 @@ void MainWindow::createMenu()
|
||||
connect(actionRoute, SIGNAL(triggered()), task, SIGNAL(route()));
|
||||
actionRoute->setEnabled(false);
|
||||
|
||||
actionSaveAsc = new QAction("Save ASC", this);
|
||||
QIcon iconSaveAsc;
|
||||
iconSaveAsc.addFile(QStringLiteral(":/icons/resources/save_asc.png"));
|
||||
actionSaveAsc->setIcon(iconSaveAsc);
|
||||
actionSaveAsc->setStatusTip("Save ASC file");
|
||||
connect(actionSaveAsc, SIGNAL(triggered()), this, SLOT(save_asc()));
|
||||
actionSaveAsc->setEnabled(false);
|
||||
|
||||
QToolBar *taskFPGABar = new QToolBar();
|
||||
addToolBar(Qt::TopToolBarArea, taskFPGABar);
|
||||
|
||||
@ -115,12 +124,14 @@ void MainWindow::createMenu()
|
||||
taskFPGABar->addAction(actionAssignBudget);
|
||||
taskFPGABar->addAction(actionPlace);
|
||||
taskFPGABar->addAction(actionRoute);
|
||||
taskFPGABar->addAction(actionSaveAsc);
|
||||
|
||||
menu_Design->addAction(actionLoadPCF);
|
||||
menu_Design->addAction(actionPack);
|
||||
menu_Design->addAction(actionAssignBudget);
|
||||
menu_Design->addAction(actionPlace);
|
||||
menu_Design->addAction(actionRoute);
|
||||
menu_Design->addAction(actionSaveAsc);
|
||||
|
||||
actionPlay = new QAction("Play", this);
|
||||
QIcon iconPlay;
|
||||
@ -169,7 +180,7 @@ void MainWindow::open()
|
||||
|
||||
void MainWindow::open_pcf()
|
||||
{
|
||||
QString fileName = QFileDialog::getOpenFileName(this, QString(), QString(), QString("*.pcf"));
|
||||
QString fileName = QFileDialog::getOpenFileName(this, QString("Open PCF"), QString(), QString("*.pcf"));
|
||||
if (!fileName.isEmpty()) {
|
||||
tabWidget->setCurrentWidget(info);
|
||||
|
||||
@ -181,6 +192,16 @@ void MainWindow::open_pcf()
|
||||
|
||||
bool MainWindow::save() { return false; }
|
||||
|
||||
void MainWindow::save_asc()
|
||||
{
|
||||
QString fileName = QFileDialog::getSaveFileName(this, QString("Save ASC"), QString(), QString("*.asc"));
|
||||
if (!fileName.isEmpty()) {
|
||||
std::string fn = fileName.toStdString();
|
||||
disableActions();
|
||||
Q_EMIT task->saveasc(fn);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::disableActions()
|
||||
{
|
||||
actionLoadPCF->setEnabled(false);
|
||||
@ -188,6 +209,7 @@ void MainWindow::disableActions()
|
||||
actionAssignBudget->setEnabled(false);
|
||||
actionPlace->setEnabled(false);
|
||||
actionRoute->setEnabled(false);
|
||||
actionSaveAsc->setEnabled(false);
|
||||
|
||||
actionPlay->setEnabled(false);
|
||||
actionPause->setEnabled(false);
|
||||
@ -217,6 +239,16 @@ void MainWindow::loadpcf_finished(bool status)
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::saveasc_finished(bool status)
|
||||
{
|
||||
disableActions();
|
||||
if (status) {
|
||||
log("Saving ASC successful.\n");
|
||||
} else {
|
||||
log("Saving ASC failed.\n");
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::pack_finished(bool status)
|
||||
{
|
||||
disableActions();
|
||||
@ -253,9 +285,10 @@ void MainWindow::place_finished(bool status)
|
||||
void MainWindow::route_finished(bool status)
|
||||
{
|
||||
disableActions();
|
||||
if (status)
|
||||
if (status) {
|
||||
log("Routing design successful.\n");
|
||||
else
|
||||
actionSaveAsc->setEnabled(true);
|
||||
} else
|
||||
log("Routing design failed.\n");
|
||||
}
|
||||
|
||||
|
@ -43,9 +43,11 @@ class MainWindow : public BaseMainWindow
|
||||
void open_pcf();
|
||||
void budget();
|
||||
void place();
|
||||
void save_asc();
|
||||
|
||||
void loadfile_finished(bool status);
|
||||
void loadpcf_finished(bool status);
|
||||
void saveasc_finished(bool status);
|
||||
void pack_finished(bool status);
|
||||
void budget_finish(bool status);
|
||||
void place_finished(bool status);
|
||||
@ -64,6 +66,7 @@ class MainWindow : public BaseMainWindow
|
||||
QAction *actionAssignBudget;
|
||||
QAction *actionPlace;
|
||||
QAction *actionRoute;
|
||||
QAction *actionSaveAsc;
|
||||
QAction *actionPlay;
|
||||
QAction *actionPause;
|
||||
QAction *actionStop;
|
||||
|
@ -8,5 +8,6 @@
|
||||
<file>resources/route.png</file>
|
||||
<file>resources/time_add.png</file>
|
||||
<file>resources/open_pcf.png</file>
|
||||
<file>resources/save_asc.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
BIN
gui/ice40/resources/save_asc.png
Normal file
BIN
gui/ice40/resources/save_asc.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
@ -80,6 +80,19 @@ void Worker::loadpcf(const std::string &filename)
|
||||
}
|
||||
}
|
||||
|
||||
void Worker::saveasc(const std::string &filename)
|
||||
{
|
||||
Q_EMIT taskStarted();
|
||||
std::string fn = filename;
|
||||
std::ofstream f(fn);
|
||||
try {
|
||||
write_asc(ctx, f);
|
||||
Q_EMIT saveasc_finished(true);
|
||||
} catch (WorkerInterruptionRequested) {
|
||||
Q_EMIT taskCanceled();
|
||||
}
|
||||
}
|
||||
|
||||
void Worker::pack()
|
||||
{
|
||||
Q_EMIT taskStarted();
|
||||
@ -132,6 +145,7 @@ TaskManager::TaskManager(Context *ctx) : toTerminate(false), toPause(false)
|
||||
|
||||
connect(this, &TaskManager::loadfile, worker, &Worker::loadfile);
|
||||
connect(this, &TaskManager::loadpcf, worker, &Worker::loadpcf);
|
||||
connect(this, &TaskManager::saveasc, worker, &Worker::saveasc);
|
||||
connect(this, &TaskManager::pack, worker, &Worker::pack);
|
||||
connect(this, &TaskManager::budget, worker, &Worker::budget);
|
||||
connect(this, &TaskManager::place, worker, &Worker::place);
|
||||
@ -140,6 +154,7 @@ TaskManager::TaskManager(Context *ctx) : toTerminate(false), toPause(false)
|
||||
connect(worker, &Worker::log, this, &TaskManager::info);
|
||||
connect(worker, &Worker::loadfile_finished, this, &TaskManager::loadfile_finished);
|
||||
connect(worker, &Worker::loadpcf_finished, this, &TaskManager::loadpcf_finished);
|
||||
connect(worker, &Worker::saveasc_finished, this, &TaskManager::saveasc_finished);
|
||||
connect(worker, &Worker::pack_finished, this, &TaskManager::pack_finished);
|
||||
connect(worker, &Worker::budget_finish, this, &TaskManager::budget_finish);
|
||||
connect(worker, &Worker::place_finished, this, &TaskManager::place_finished);
|
||||
|
@ -36,6 +36,7 @@ class Worker : public QObject
|
||||
public Q_SLOTS:
|
||||
void loadfile(const std::string &);
|
||||
void loadpcf(const std::string &);
|
||||
void saveasc(const std::string &);
|
||||
void pack();
|
||||
void budget(double freq);
|
||||
void place(bool timing_driven);
|
||||
@ -44,6 +45,7 @@ class Worker : public QObject
|
||||
void log(const std::string &text);
|
||||
void loadfile_finished(bool status);
|
||||
void loadpcf_finished(bool status);
|
||||
void saveasc_finished(bool status);
|
||||
void pack_finished(bool status);
|
||||
void budget_finish(bool status);
|
||||
void place_finished(bool status);
|
||||
@ -76,6 +78,7 @@ class TaskManager : public QObject
|
||||
void terminate();
|
||||
void loadfile(const std::string &);
|
||||
void loadpcf(const std::string &);
|
||||
void saveasc(const std::string &);
|
||||
void pack();
|
||||
void budget(double freq);
|
||||
void place(bool timing_driven);
|
||||
@ -85,6 +88,7 @@ class TaskManager : public QObject
|
||||
void log(const std::string &text);
|
||||
void loadfile_finished(bool status);
|
||||
void loadpcf_finished(bool status);
|
||||
void saveasc_finished(bool status);
|
||||
void pack_finished(bool status);
|
||||
void budget_finish(bool status);
|
||||
void place_finished(bool status);
|
||||
|
Loading…
Reference in New Issue
Block a user