display pa's own choice of card icon

This commit is contained in:
mappu 2018-10-02 19:52:28 +13:00
parent 7fa01775f7
commit 4341107c65

View File

@ -98,8 +98,14 @@ void TrayIcon::onGotPulseCardInfo(const pa_card_info& cardInfo, int eol)
name = tr("Default card");
}
cardMenu->setIcon(QIcon::fromTheme("audio-card"));
QString iconName = pa_proplist_gets(cardInfo.proplist, PA_PROP_DEVICE_ICON_NAME); // e.g. audio-card-pci
if (iconName.length() == 0) {
iconName = "audio-card"; // default
}
QMenu* cardMenu = new QMenu(name, this->menu); // recursive ownership
cardMenu->setIcon(QIcon::fromTheme(iconName));
for (size_t i = 0; i < cardInfo.n_profiles; ++i) {
auto profileAction = new QAction(cardInfo.profiles[i].description, cardMenu);
cardMenu->addAction(profileAction);