[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/phonon/kcm
From: Matthias Kretz <kretz () kde ! org>
Date: 2007-09-27 10:15:10
Message-ID: 1190888110.576616.16099.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 717689 by mkretz:
keep the order of devices as returned from availableAudioOutputDevices()
M +15 -5 outputdevicechoice.cpp
--- trunk/KDE/kdelibs/phonon/kcm/outputdevicechoice.cpp #717688:717689
@@ -197,22 +197,32 @@
hash.insert(dev.index(), dev);
}
for (int i = 0; i <= Phonon::LastCategory; ++i) {
+ Phonon::AudioOutputDeviceModel *model = m_outputModel.value(i);
+ Q_ASSERT(model);
+
QHash<int, Phonon::AudioOutputDevice> hashCopy(hash);
QList<Phonon::AudioOutputDevice> orderedList;
- if (m_outputModel.value(i)) {
+ if (model->rowCount() > 0) {
QList<int> order = m_outputModel.value(i)->tupleIndexOrder();
foreach (int idx, order) {
if (hashCopy.contains(idx)) {
orderedList << hashCopy.take(idx);
}
}
- foreach (Phonon::AudioOutputDevice dev, hashCopy) {
- orderedList << dev;
+ if (hashCopy.size() > 1) {
+ // keep the order of the original list
+ foreach (const Phonon::AudioOutputDevice &dev, list) {
+ if (hashCopy.contains(dev.index())) {
+ orderedList << hashCopy.take(dev.index());
+ }
+ }
+ } else if (hashCopy.size() == 1) {
+ orderedList += hashCopy.values();
}
+ model->setModelData(orderedList);
} else {
- orderedList = list;
+ model->setModelData(list);
}
- m_outputModel[i]->setModelData(orderedList);
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic