From c93aa1df37cc685f28c210ff33914c688525174e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20Panzenb=C3=B6ck?= Date: Fri, 21 Feb 2014 05:22:12 +0100 Subject: [PATCH] added some button icons (TODO: ok and cancel buttons) --- src/joypadw.cpp | 2 +- src/layout.cpp | 15 ++++++++++----- src/layout_edit.cpp | 12 ++++++------ 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/joypadw.cpp b/src/joypadw.cpp index c13b058..b751980 100644 --- a/src/joypadw.cpp +++ b/src/joypadw.cpp @@ -35,7 +35,7 @@ JoyPadWidget::JoyPadWidget( JoyPad* jp, int i, QWidget* parent ) insertCounter ++; } insertCounter += 2; - btnClear = new QPushButton("Clear", this); + btnClear = new QPushButton(QIcon::fromTheme("edit-clear"), "Clear", this); connect(btnClear, SIGNAL(clicked()), this, SLOT(clear())); layoutMain->addWidget(btnClear, insertCounter / 2, insertCounter % 2); insertCounter++; diff --git a/src/layout.cpp b/src/layout.cpp index ad46d77..739a5e8 100644 --- a/src/layout.cpp +++ b/src/layout.cpp @@ -11,9 +11,9 @@ LayoutManager::LayoutManager( bool useTrayIcon, const QString &devdir, const QSt : devdir(devdir), settingsDir(settingsDir), layoutGroup(new QActionGroup(this)), titleAction(new QAction(this)), - updateDevicesAction(new QAction("Update &Joystick Devices",this)), - updateLayoutsAction(new QAction("Update &Layout List",this)), - quitAction(new QAction("&Quit",this)), + updateDevicesAction(new QAction(QIcon::fromTheme("view-refresh"),"Update &Joystick Devices",this)), + updateLayoutsAction(new QAction(QIcon::fromTheme("view-refresh"),"Update &Layout List",this)), + quitAction(new QAction(QIcon::fromTheme("application-exit"),"&Quit",this)), le(0) { //prepare the popup first. titleAction->setEnabled(false); @@ -326,8 +326,13 @@ void LayoutManager::fillPopup() { //make a list of joystick devices QString title = "Joysticks: "; - foreach (JoyPad *joypad, available) { - title += QString("%1 ").arg(joypad->getIndex() + 1); + if (available.isEmpty()) { + title += "(none)"; + } + else { + foreach (JoyPad *joypad, available) { + title += QString("%1 ").arg(joypad->getIndex() + 1); + } } trayMenu.setTitle(title); diff --git a/src/layout_edit.cpp b/src/layout_edit.cpp index 4a9e748..d15d466 100644 --- a/src/layout_edit.cpp +++ b/src/layout_edit.cpp @@ -22,16 +22,16 @@ LayoutEdit::LayoutEdit( LayoutManager* l ): QWidget(NULL) { g->addWidget(cmbLayouts,0,0,1,4); //most of these buttons can link directly into slots in the LayoutManager - btnAdd = new QPushButton("&Add", frame); + btnAdd = new QPushButton(QIcon::fromTheme("list-add"), "&Add", frame); connect(btnAdd, SIGNAL(clicked()), lm, SLOT(saveAs())); g->addWidget(btnAdd,1,0); - btnRem = new QPushButton("&Remove", frame); + btnRem = new QPushButton(QIcon::fromTheme("list-remove"), "&Remove", frame); connect(btnRem, SIGNAL(clicked()), lm, SLOT(remove())); g->addWidget(btnRem,1,1); - btnUpd = new QPushButton("&Save", frame); + btnUpd = new QPushButton(QIcon::fromTheme("document-save"), "&Save", frame); connect(btnUpd, SIGNAL(clicked()), lm, SLOT(save())); g->addWidget(btnUpd,1,2); - btnRev = new QPushButton("Re&vert", frame); + btnRev = new QPushButton(QIcon::fromTheme("document-revert"), "Re&vert", frame); connect(btnRev, SIGNAL(clicked()), lm, SLOT(reload())); g->addWidget(btnRev,1,3); mainLayout->addWidget( frame ); @@ -73,10 +73,10 @@ LayoutEdit::LayoutEdit( LayoutManager* l ): QWidget(NULL) { QHBoxLayout* h = new QHBoxLayout(0); h->setMargin(0); h->setSpacing(5); - QPushButton* close = new QPushButton( "-- &Close Dialog --", this ); + QPushButton* close = new QPushButton(QIcon::fromTheme("window-close"), "&Close Dialog", this ); connect(close, SIGNAL(clicked()), this, SLOT(close())); h->addWidget(close); - QPushButton* quit = new QPushButton( "-- &Quit --", this ); + QPushButton* quit = new QPushButton(QIcon::fromTheme("application-exit"), "&Quit", this ); connect( quit, SIGNAL( clicked() ), qApp, SLOT(quit())); h->addWidget(quit); mainLayout->addLayout(h);