Changeset View
Changeset View
Standalone View
Standalone View
gui/dialogselectmaster.cpp
Show All 20 Lines | |||||
21 | 21 | | |||
22 | #include "gui/dialogselectmaster.h" | 22 | #include "gui/dialogselectmaster.h" | ||
23 | 23 | | |||
24 | #include <QLabel> | 24 | #include <QLabel> | ||
25 | #include <QVBoxLayout> | 25 | #include <QVBoxLayout> | ||
26 | #include <QListWidget> | 26 | #include <QListWidget> | ||
27 | #include <QComboBox> | 27 | #include <QComboBox> | ||
28 | 28 | | |||
29 | #include <kiconloader.h> | | |||
30 | #include <klocalizedstring.h> | 29 | #include <klocalizedstring.h> | ||
31 | 30 | | |||
32 | #include "core/ControlManager.h" | 31 | #include "core/ControlManager.h" | ||
33 | #include "core/mixdevice.h" | 32 | #include "core/mixdevice.h" | ||
34 | #include "core/mixer.h" | 33 | #include "core/mixer.h" | ||
35 | 34 | | |||
36 | DialogSelectMaster::DialogSelectMaster( Mixer *mixer, QWidget *parent ) | 35 | DialogSelectMaster::DialogSelectMaster( Mixer *mixer, QWidget *parent ) | ||
37 | : DialogBase( parent ) | 36 | : DialogBase( parent ) | ||
▲ Show 20 Lines • Show All 131 Lines • ▼ Show 20 Line(s) | 167 | { | |||
169 | shared_ptr<MixDevice> md = mset[i]; | 168 | shared_ptr<MixDevice> md = mset[i]; | ||
170 | if ( md->playbackVolume().hasVolume() ) | 169 | if ( md->playbackVolume().hasVolume() ) | ||
171 | ++msetCount; | 170 | ++msetCount; | ||
172 | } | 171 | } | ||
173 | 172 | | |||
174 | if (msetCount > 0 && !mixer->isDynamic()) | 173 | if (msetCount > 0 && !mixer->isDynamic()) | ||
175 | { | 174 | { | ||
176 | QString mdName = i18n("Automatic (%1 recommendation)", mixer->getDriverName()); | 175 | QString mdName = i18n("Automatic (%1 recommendation)", mixer->getDriverName()); | ||
177 | QPixmap icon = KIconLoader::global()->loadScaledIcon("audio-volume-high", KIconLoader::Small, devicePixelRatioF(), IconSize(KIconLoader::Small)); | 176 | auto *item = new QListWidgetItem(QIcon::fromTheme("audio-volume-high"), mdName, m_channelSelector); | ||
178 | QListWidgetItem *item = new QListWidgetItem(icon, mdName, m_channelSelector); | | |||
179 | item->setData(Qt::UserRole, QString()); // ID here: see apply(), empty String => Automatic | 177 | item->setData(Qt::UserRole, QString()); // ID here: see apply(), empty String => Automatic | ||
180 | if (masterKey.isEmpty()) | 178 | if (masterKey.isEmpty()) | ||
181 | m_channelSelector->setCurrentItem(item); | 179 | m_channelSelector->setCurrentItem(item); | ||
182 | } | 180 | } | ||
183 | 181 | | |||
184 | // Populate ListView with the MixDevice's having a playbakc volume (excludes pure capture controls and pure enum's) | 182 | // Populate ListView with the MixDevice's having a playbakc volume (excludes pure capture controls and pure enum's) | ||
185 | for (int i = 0; i < mset.count(); ++i) | 183 | for (int i = 0; i < mset.count(); ++i) | ||
186 | { | 184 | { | ||
187 | shared_ptr<MixDevice> md = mset[i]; | 185 | shared_ptr<MixDevice> md = mset[i]; | ||
188 | if ( md->playbackVolume().hasVolume() ) | 186 | if ( md->playbackVolume().hasVolume() ) | ||
189 | { | 187 | { | ||
190 | QString mdName = md->readableName(); | 188 | QString mdName = md->readableName(); | ||
191 | QPixmap icon = KIconLoader::global()->loadScaledIcon(md->iconName(), KIconLoader::Small, devicePixelRatioF(), IconSize(KIconLoader::Small)); | 189 | auto *item = new QListWidgetItem(QIcon::fromTheme(md->iconName()), mdName, m_channelSelector); | ||
192 | QListWidgetItem *item = new QListWidgetItem(icon, mdName, m_channelSelector); | | |||
193 | item->setData(Qt::UserRole, md->id()); // ID here: see apply() | 190 | item->setData(Qt::UserRole, md->id()); // ID here: see apply() | ||
194 | if ( md->id() == masterKey ) | 191 | if ( md->id() == masterKey ) | ||
195 | { // select the current master | 192 | { // select the current master | ||
196 | m_channelSelector->setCurrentItem(item); | 193 | m_channelSelector->setCurrentItem(item); | ||
197 | } | 194 | } | ||
198 | } | 195 | } | ||
199 | } | 196 | } | ||
200 | 197 | | |||
Show All 32 Lines |