aboutsummaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
authorMiodrag Milanovic <mmicko@gmail.com>2018-07-14 17:58:58 +0200
committerMiodrag Milanovic <mmicko@gmail.com>2018-07-14 17:58:58 +0200
commitf339f796a1bd7e98be184085e831e9d44ea85dd1 (patch)
tree67f94d1047020f3bebb5390ffd6414165da3ce0c /gui
parent0b1ae3ce8da9fb3a3b4eaf337d6bf0b7f6aaab1e (diff)
downloadnextpnr-f339f796a1bd7e98be184085e831e9d44ea85dd1.tar.gz
nextpnr-f339f796a1bd7e98be184085e831e9d44ea85dd1.tar.bz2
nextpnr-f339f796a1bd7e98be184085e831e9d44ea85dd1.zip
simplified Icon allocation
Diffstat (limited to 'gui')
-rw-r--r--gui/basewindow.cc28
-rw-r--r--gui/designwidget.cc25
-rw-r--r--gui/ice40/mainwindow.cc80
3 files changed, 50 insertions, 83 deletions
diff --git a/gui/basewindow.cc b/gui/basewindow.cc
index 04898410..b9c1de5e 100644
--- a/gui/basewindow.cc
+++ b/gui/basewindow.cc
@@ -42,7 +42,7 @@ BaseMainWindow::BaseMainWindow(std::unique_ptr<Context> context, QWidget *parent
log_files.clear();
log_streams.clear();
- setObjectName(QStringLiteral("BaseMainWindow"));
+ setObjectName("BaseMainWindow");
resize(1024, 768);
createMenusAndBars();
@@ -92,35 +92,27 @@ void BaseMainWindow::writeInfo(std::string text) { console->info(text); }
void BaseMainWindow::createMenusAndBars()
{
- actionNew = new QAction("New", this);
- QIcon iconNew;
- iconNew.addFile(QStringLiteral(":/icons/resources/new.png"));
- actionNew->setIcon(iconNew);
+ actionNew = new QAction("New", this);
+ actionNew->setIcon(QIcon(":/icons/resources/new.png"));
actionNew->setShortcuts(QKeySequence::New);
actionNew->setStatusTip("New project file");
connect(actionNew, SIGNAL(triggered()), this, SLOT(new_proj()));
- actionOpen = new QAction("Open", this);
- QIcon iconOpen;
- iconOpen.addFile(QStringLiteral(":/icons/resources/open.png"));
- actionOpen->setIcon(iconOpen);
+ actionOpen = new QAction("Open", this);
+ actionOpen->setIcon(QIcon(":/icons/resources/open.png"));
actionOpen->setShortcuts(QKeySequence::Open);
actionOpen->setStatusTip("Open an existing project file");
connect(actionOpen, SIGNAL(triggered()), this, SLOT(open_proj()));
- QAction *actionSave = new QAction("Save", this);
- QIcon iconSave;
- iconSave.addFile(QStringLiteral(":/icons/resources/save.png"));
- actionSave->setIcon(iconSave);
+ QAction *actionSave = new QAction("Save", this);
+ actionSave->setIcon(QIcon(":/icons/resources/save.png"));
actionSave->setShortcuts(QKeySequence::Save);
actionSave->setStatusTip("Save existing project to disk");
- connect(actionSave, SIGNAL(triggered()), this, SLOT(save_proj()));
actionSave->setEnabled(false);
+ connect(actionSave, SIGNAL(triggered()), this, SLOT(save_proj()));
- QAction *actionExit = new QAction("Exit", this);
- QIcon iconExit;
- iconExit.addFile(QStringLiteral(":/icons/resources/exit.png"));
- actionExit->setIcon(iconExit);
+ QAction *actionExit = new QAction("Exit", this);
+ actionExit->setIcon(QIcon(":/icons/resources/exit.png"));
actionExit->setShortcuts(QKeySequence::Quit);
actionExit->setStatusTip("Exit the application");
connect(actionExit, SIGNAL(triggered()), this, SLOT(close()));
diff --git a/gui/designwidget.cc b/gui/designwidget.cc
index 9602a4d3..ba2c76f5 100644
--- a/gui/designwidget.cc
+++ b/gui/designwidget.cc
@@ -89,31 +89,26 @@ DesignWidget::DesignWidget(QWidget *parent) : QWidget(parent), ctx(nullptr), net
propertyEditor->setPropertiesWithoutValueMarked(true);
propertyEditor->show();
-
- const QIcon searchIcon(":/icons/resources/zoom.png");
+
QLineEdit *lineEdit = new QLineEdit();
lineEdit->setClearButtonEnabled(true);
- lineEdit->addAction(searchIcon, QLineEdit::LeadingPosition);
+ lineEdit->addAction(QIcon(":/icons/resources/zoom.png"), QLineEdit::LeadingPosition);
lineEdit->setPlaceholderText("Search...");
- actionFirst = new QAction("", this);
- QIcon iconFirst(QStringLiteral(":/icons/resources/resultset_first.png"));
- actionFirst->setIcon(iconFirst);
+ actionFirst = new QAction("", this);
+ actionFirst->setIcon(QIcon(":/icons/resources/resultset_first.png"));
actionFirst->setEnabled(false);
- actionPrev = new QAction("", this);
- QIcon iconPrev(QStringLiteral(":/icons/resources/resultset_previous.png"));
- actionPrev->setIcon(iconPrev);
+ actionPrev = new QAction("", this);
+ actionPrev->setIcon(QIcon(":/icons/resources/resultset_previous.png"));
actionPrev->setEnabled(false);
- actionNext = new QAction("", this);
- QIcon iconNext(QStringLiteral(":/icons/resources/resultset_next.png"));
- actionNext->setIcon(iconNext);
+ actionNext = new QAction("", this);
+ actionNext->setIcon(QIcon(":/icons/resources/resultset_next.png"));
actionNext->setEnabled(false);
- actionLast = new QAction("", this);
- QIcon iconLast(QStringLiteral(":/icons/resources/resultset_last.png"));
- actionLast->setIcon(iconLast);
+ actionLast = new QAction("", this);
+ actionLast->setIcon(QIcon(":/icons/resources/resultset_last.png"));
actionLast->setEnabled(false);
QToolBar *toolbar = new QToolBar();
diff --git a/gui/ice40/mainwindow.cc b/gui/ice40/mainwindow.cc
index 4ade1f1f..772ca6ac 100644
--- a/gui/ice40/mainwindow.cc
+++ b/gui/ice40/mainwindow.cc
@@ -71,61 +71,47 @@ void MainWindow::createMenu()
QMenu *menu_Design = new QMenu("&Design", menuBar);
menuBar->addAction(menu_Design->menuAction());
- actionLoadJSON = new QAction("Open JSON", this);
- QIcon iconLoadJSON;
- iconLoadJSON.addFile(QStringLiteral(":/icons/resources/open_json.png"));
- actionLoadJSON->setIcon(iconLoadJSON);
+ actionLoadJSON = new QAction("Open JSON", this);
+ actionLoadJSON->setIcon(QIcon(":/icons/resources/open_json.png"));
actionLoadJSON->setStatusTip("Open an existing JSON file");
- connect(actionLoadJSON, SIGNAL(triggered()), this, SLOT(open_json()));
actionLoadJSON->setEnabled(true);
+ connect(actionLoadJSON, SIGNAL(triggered()), this, SLOT(open_json()));
- actionLoadPCF = new QAction("Open PCF", this);
- QIcon iconLoadPCF;
- iconLoadPCF.addFile(QStringLiteral(":/icons/resources/open_pcf.png"));
- actionLoadPCF->setIcon(iconLoadPCF);
+ actionLoadPCF = new QAction("Open PCF", this);
+ actionLoadPCF->setIcon(QIcon(":/icons/resources/open_pcf.png"));
actionLoadPCF->setStatusTip("Open PCF file");
- connect(actionLoadPCF, SIGNAL(triggered()), this, SLOT(open_pcf()));
actionLoadPCF->setEnabled(false);
+ connect(actionLoadPCF, SIGNAL(triggered()), this, SLOT(open_pcf()));
- actionPack = new QAction("Pack", this);
- QIcon iconPack;
- iconPack.addFile(QStringLiteral(":/icons/resources/pack.png"));
- actionPack->setIcon(iconPack);
+ actionPack = new QAction("Pack", this);
+ actionPack->setIcon(QIcon(":/icons/resources/pack.png"));
actionPack->setStatusTip("Pack current design");
- connect(actionPack, SIGNAL(triggered()), task, SIGNAL(pack()));
actionPack->setEnabled(false);
+ connect(actionPack, SIGNAL(triggered()), task, SIGNAL(pack()));
- actionAssignBudget = new QAction("Assign Budget", this);
- QIcon iconAssignBudget;
- iconAssignBudget.addFile(QStringLiteral(":/icons/resources/time_add.png"));
- actionAssignBudget->setIcon(iconAssignBudget);
+ actionAssignBudget = new QAction("Assign Budget", this);
+ actionAssignBudget->setIcon(QIcon(":/icons/resources/time_add.png"));
actionAssignBudget->setStatusTip("Assign time budget for current design");
- connect(actionAssignBudget, SIGNAL(triggered()), this, SLOT(budget()));
actionAssignBudget->setEnabled(false);
+ connect(actionAssignBudget, SIGNAL(triggered()), this, SLOT(budget()));
- actionPlace = new QAction("Place", this);
- QIcon iconPlace;
- iconPlace.addFile(QStringLiteral(":/icons/resources/place.png"));
- actionPlace->setIcon(iconPlace);
+ actionPlace = new QAction("Place", this);
+ actionPlace->setIcon(QIcon(":/icons/resources/place.png"));
actionPlace->setStatusTip("Place current design");
- connect(actionPlace, SIGNAL(triggered()), this, SLOT(place()));
actionPlace->setEnabled(false);
+ connect(actionPlace, SIGNAL(triggered()), this, SLOT(place()));
- actionRoute = new QAction("Route", this);
- QIcon iconRoute;
- iconRoute.addFile(QStringLiteral(":/icons/resources/route.png"));
- actionRoute->setIcon(iconRoute);
+ actionRoute = new QAction("Route", this);
+ actionRoute->setIcon(QIcon(":/icons/resources/route.png"));
actionRoute->setStatusTip("Route current design");
- connect(actionRoute, SIGNAL(triggered()), task, SIGNAL(route()));
actionRoute->setEnabled(false);
+ connect(actionRoute, SIGNAL(triggered()), task, SIGNAL(route()));
- actionSaveAsc = new QAction("Save ASC", this);
- QIcon iconSaveAsc;
- iconSaveAsc.addFile(QStringLiteral(":/icons/resources/save_asc.png"));
- actionSaveAsc->setIcon(iconSaveAsc);
+ actionSaveAsc = new QAction("Save ASC", this);
+ actionSaveAsc->setIcon(QIcon(":/icons/resources/save_asc.png"));
actionSaveAsc->setStatusTip("Save ASC file");
- connect(actionSaveAsc, SIGNAL(triggered()), this, SLOT(save_asc()));
actionSaveAsc->setEnabled(false);
+ connect(actionSaveAsc, SIGNAL(triggered()), this, SLOT(save_asc()));
QToolBar *taskFPGABar = new QToolBar();
addToolBar(Qt::TopToolBarArea, taskFPGABar);
@@ -146,29 +132,23 @@ void MainWindow::createMenu()
menu_Design->addAction(actionRoute);
menu_Design->addAction(actionSaveAsc);
- actionPlay = new QAction("Play", this);
- QIcon iconPlay;
- iconPlay.addFile(QStringLiteral(":/icons/resources/control_play.png"));
- actionPlay->setIcon(iconPlay);
+ actionPlay = new QAction("Play", this);
+ actionPlay->setIcon(QIcon(":/icons/resources/control_play.png"));
actionPlay->setStatusTip("Continue running task");
- connect(actionPlay, SIGNAL(triggered()), task, SLOT(continue_thread()));
actionPlay->setEnabled(false);
+ connect(actionPlay, SIGNAL(triggered()), task, SLOT(continue_thread()));
- actionPause = new QAction("Pause", this);
- QIcon iconPause;
- iconPause.addFile(QStringLiteral(":/icons/resources/control_pause.png"));
- actionPause->setIcon(iconPause);
+ actionPause = new QAction("Pause", this);
+ actionPause->setIcon(QIcon(":/icons/resources/control_pause.png"));
actionPause->setStatusTip("Pause running task");
- connect(actionPause, SIGNAL(triggered()), task, SLOT(pause_thread()));
actionPause->setEnabled(false);
+ connect(actionPause, SIGNAL(triggered()), task, SLOT(pause_thread()));
- actionStop = new QAction("Stop", this);
- QIcon iconStop;
- iconStop.addFile(QStringLiteral(":/icons/resources/control_stop.png"));
- actionStop->setIcon(iconStop);
+ actionStop = new QAction("Stop", this);
+ actionStop->setIcon(QIcon(":/icons/resources/control_stop.png"));
actionStop->setStatusTip("Stop running task");
- connect(actionStop, SIGNAL(triggered()), task, SLOT(terminate_thread()));
actionStop->setEnabled(false);
+ connect(actionStop, SIGNAL(triggered()), task, SLOT(terminate_thread()));
QToolBar *taskToolBar = new QToolBar();
addToolBar(Qt::TopToolBarArea, taskToolBar);