add menu icons

This commit is contained in:
mappu 2018-10-02 19:33:08 +13:00
parent 0cda1431ec
commit 52ab4b1aa3

View File

@ -8,16 +8,18 @@
#include <pulse/pulseaudio.h>
TrayIcon::TrayIcon(QObject *parent) :
QSystemTrayIcon(QIcon::fromTheme("preferences-desktop-sound"), parent),
QSystemTrayIcon(QIcon::fromTheme("audio-card" /*"preferences-desktop-sound"*/), parent),
pulse(this)
{
this->menu = new QMenu(); // can only be explicitly owned by a QWidget, not any QObject, so we need to
// manually manage its lifecycle in the d'tor
this->quitAction = new QAction("Quit");
this->quitAction->setIcon(QIcon::fromTheme("application-exit"));
connect(this->quitAction, &QAction::triggered, this, &TrayIcon::on_quitAction_triggered);
this->refreshAction = new QAction("Refresh");
this->refreshAction->setIcon(QIcon::fromTheme("view-refresh"));
connect(this->refreshAction, &QAction::triggered, this, &TrayIcon::onRefreshAction_triggered);
// Set up basic menu only, will be wiped during refresh
@ -97,6 +99,7 @@ void TrayIcon::onGotPulseCardInfo(const pa_card_info& cardInfo, int eol)
}
QMenu* cardMenu = new QMenu(name);
cardMenu->setIcon(QIcon::fromTheme("audio-card"));
for (size_t i = 0; i < cardInfo.n_profiles; ++i) {
auto profileAction = new QAction(cardInfo.profiles[i].description, cardMenu);
cardMenu->addAction(profileAction);