[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#351607: Patch for minor bug in kmix panel applet



Hey,

Attached is a version of a patch that's going into KDE 3.5.2, which
provides better behavior in kde 3.5.1's kmix panel applet. it should
apply cleanly to kdemultimedia_3.5.1.orig.tar.gz.

This solves the issue where the capture and playback channels are saved
using the same name, and upon restarting kde, the panel applet forgets
that the capture channel has been hidden if the playback channel has
not. With this patch, the configuration file gets saved with a
"Capture." tag in it for appropriate channels, and it handles backwards
compatability with the old config file format.

The other issues mentioned in this bug are actually part of alsa's
normal behavior, applying this patch, or going to 3.5.2 should result in
this bug being closed.
http://bugs.kde.org/show_bug.cgi?id=121451 shows the details surrounding
the issue.

Thanks
Andrew Pilley
diff -Nur kdemultimedia-3.5.1/kmix/kmixtoolbox.cpp kdemultimedia-3.5.1-kmix/kmix/kmixtoolbox.cpp
--- kdemultimedia-3.5.1/kmix/kmixtoolbox.cpp	2006-01-20 03:40:29.000000000 +1100
+++ kdemultimedia-3.5.1-kmix/kmix/kmixtoolbox.cpp	2006-02-25 10:37:42.855207360 +1100
@@ -98,6 +98,36 @@
 	     */
             // !!! check
  	    devgrp.sprintf( "%s.%s.Dev%s", viewPrefix.ascii(), grp.ascii(), mdw->mixDevice()->getPK().ascii() );
+
+       /**
+          Find an appropriate group name for capture GUI elements.
+          We try devgrp.append(".Capture")
+          If it doesn't exist, we fall back to devgrp.
+          This is the second compatability measure, and was introduced for KDE3.5.2.
+         */
+       if ( mdw->mixDevice()->getVolume().isCapture() ) {
+          /* A "capture" GUI element must save its own state. Otherwise playback and capture
+             properties would be written twice under the same name. This would mean, when
+            restoring, both would get the same value. This is bad, because hidden sliders will re-appear
+             after restart of KMix, and a lot of other nasty GUI-related problems.
+             So we add ".Capture" to the group name.
+             See bug 121451 "KMix panel applet shows broken duplicates of bass, treble sliders"
+
+             The name should have been set in the backend class, but we REALLY cannot do this for KDE3.5.x. !!
+             This issue will be fixed in KDE4 by the great config cleanup.
+            */
+          QString devgrpTmp(devgrp);
+          devgrpTmp.append(".Capture");
+          if(config->hasGroup(devgrpTmp) ) {
+             // Group for capture device exists => take over the name
+             devgrp = devgrpTmp;
+          }
+          else {
+             // do nothing => keep old name (devgrp).
+             // Saving wil autmatically create the group 'devgrp.append(".Capture")'
+             kdDebug(67100) << "KMixToolBox::loadConfig() capture fallback activcated. Fallback group is " << devgrp << endl;
+          }
+       }  // isCapture()
 	    if ( ! config->hasGroup(devgrp) ) {
 		// fall back to old-Style configuration (KMix2.1 and earlier)
 		devgrp.sprintf( "%s.%s.Dev%i", viewPrefix.ascii(), grp.ascii(), n );
@@ -148,6 +178,12 @@
             }
 	    devgrp.sprintf( "%s.%s.Dev%s", viewPrefix.ascii(), grp.ascii(), mdw->mixDevice()->getPK().ascii() );
 	    //devgrp.sprintf( "%s.%s.Dev%i", viewPrefix.ascii(), grp.ascii(), n );
+       
+         if ( mdw->mixDevice()->getVolume().isCapture() ) {
+            /* see loadConfig for the rationale of having an own name for capture devices. */
+            devgrp.append(".Capture");
+         } // isCapture()
+       
 	    config->setGroup( devgrp );
 
 	    if ( qmdw->inherits("MixDeviceWidget") ) { // -<- in reality it is only in MDWSlider

Reply to: