summaryrefslogtreecommitdiffstats
path: root/kmix/mixertoolbox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kmix/mixertoolbox.cpp')
-rw-r--r--kmix/mixertoolbox.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/kmix/mixertoolbox.cpp b/kmix/mixertoolbox.cpp
index 1021fd8c..25836ae3 100644
--- a/kmix/mixertoolbox.cpp
+++ b/kmix/mixertoolbox.cpp
@@ -249,7 +249,6 @@ void MixerToolBox::initMixer(TQPtrList<Mixer> &mixers, bool multiDriverMode, TQS
}
-
/*
* Clean up and free all resources of all found Mixers, which were found in the initMixer() call
*/
@@ -279,10 +278,6 @@ void MixerToolBox::deinitMixer(TQPtrList<Mixer> &mixers)
}
/**
- * Clean up and free all resources of the given mixers
- * @par mixers The list of mixers to deinitialize.
- */
-/**
* Scan for Mixers in the System and update the given list. No longer existing mixers
* will be deinitialized.
* @par mixers The list where to add the found Mixers. This parameter is superfluous
@@ -291,12 +286,15 @@ void MixerToolBox::deinitMixer(TQPtrList<Mixer> &mixers)
* @par multiDriverMode Whether the Mixer scan should try more all backendends.
* 'true' means to scan all backends. 'false' means: After scanning the
* current backend the next backend is only scanned if no Mixers were found yet.
+ * @return true if any change in the mixers list has been detected.
*/
-void MixerToolBox::updateMixer(TQPtrList<Mixer> &mixers, bool multiDriverMode, TQString& ref_hwInfoString)
+bool MixerToolBox::updateMixer(TQPtrList<Mixer> &mixers, bool multiDriverMode, TQString& ref_hwInfoString)
{
+ bool changesDetected = false;
TQPtrList<Mixer> newMixers;
// Scan for new mixers
initMixer(newMixers, multiDriverMode, ref_hwInfoString);
+tqWarning("MIKE <updateMixer> OLD mixer=%d NEW=%d",mixers.count(),newMixers.count());
// Remove no longer existing mixers
TQPtrList<Mixer> mixersToDeinit;
Mixer *searchMixer = NULL;
@@ -314,13 +312,16 @@ void MixerToolBox::updateMixer(TQPtrList<Mixer> &mixers, bool multiDriverMode, T
}
if (!searchMixer)
{
+ changesDetected = true;
mixers.take();
mixersToDeinit.append(currMixer);
+tqWarning("MIKE <updateMixer> remove mixer=("+currMixer->id()+")="+currMixer->mixerName());
}
currMixer = mixers.next();
}
deinitMixer(mixersToDeinit);
// Add newly found mixers
+ int insertLocation = 0;
searchMixer = newMixers.first();
while (searchMixer)
{
@@ -336,11 +337,16 @@ void MixerToolBox::updateMixer(TQPtrList<Mixer> &mixers, bool multiDriverMode, T
if (!currMixer)
{
// New mixer, append to existing list
+ changesDetected = true;
newMixers.take();
- mixers.append(searchMixer);
+ mixers.insert(insertLocation, searchMixer);
+tqWarning("MIKE <updateMixer> add new mixer=("+searchMixer->id()+")="+searchMixer->mixerName());
}
searchMixer = newMixers.next();
+ ++insertLocation;
}
// Deallocate duplicated mixers
deinitMixer(newMixers);
+
+ return changesDetected;
}