[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdemultimedia/kmix
From:       Christian Esken <esken () kde ! org>
Date:       2011-12-22 12:56:35
Message-ID: 20111222125635.71444AC881 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1270003 by esken:

Fix missing controls.
BUGS: 265733

 M  +9 -13     backends/mixer_alsa9.cpp  
 M  +7 -5      gui/viewsliders.cpp  


--- trunk/KDE/kdemultimedia/kmix/backends/mixer_alsa9.cpp #1270002:1270003
@@ -177,17 +177,15 @@
             // --- Enumerated ---
             addEnumerated(elem, enumList);
         }
+        else
+        {
 		volPlay    = addVolume(elem, false);
         volCapture = addVolume(elem, true );
+        }
 
 
         QString readableName;
         readableName = snd_mixer_selem_id_get_name( sid );
-//        if ( readableName == "Front")
-//        {
-//        	qDebug("Front!");
-//        }
-
         int idx = snd_mixer_selem_id_get_index( sid );
         if ( idx > 0 ) {
             // Add a number to the control name, like "PCM 2", when the index is > 0
@@ -196,18 +194,16 @@
             readableName += " ";
             readableName += idxString;
         }
-        MixDevice* md = new MixDevice(_mixer, mdID, readableName, ct );
-        bool hasVolume = volPlay != 0 || volCapture != 0;
-        bool hasEnum   = enumList.count() > 0;
 
-        // If we have sliders and an enum, KMix needs two MixDevice instances (a \
                MixDevice is EITHER a VolumeControl OR an ENUM, but never both)
-        MixDevice* mdForEnum = ( hasVolume && hasEnum )
-        		             ? new MixDevice(_mixer,mdID + ".enum", readableName,ct)  // \
                For identifying/saving it needs a distinct ID. We add a ".enum"
-        					 : md;   // It is a simple ENUM (no volume control)
+		// There can be an Enum-Control with the same name as a regular control. So we \
append a ".enum" prefix to always create a unique ID +        QString \
finalMixdeviceID = enumList.isEmpty() ? mdID : mdID + ".enum"; +        if ( \
readableName == "IEC958" ) kDebug() << "IEC958! id=" << finalMixdeviceID << \
"readableName=" << readableName;  
+        MixDevice* md = new MixDevice(_mixer, finalMixdeviceID, readableName, ct );
+
         if ( volPlay    != 0      ) md->addPlaybackVolume(*volPlay);
         if ( volCapture != 0      ) md->addCaptureVolume (*volCapture);
-       	if ( hasEnum              ) mdForEnum->addEnums(enumList);
+       	if ( !enumList.isEmpty()  ) md->addEnums(enumList);
          
         m_mixDevices.append( md );
          
--- trunk/KDE/kdemultimedia/kmix/gui/viewsliders.cpp #1270002:1270003
@@ -85,7 +85,9 @@
 
     QString driverName = _mixer->getDriverName();
 
-    kDebug() <<"       ----------- Viewme          -----------:" << name;
+
+    // Hint: This text comparison is not a clean solution, but one that will work \
for quite a while. +    // TODO cesken Revise this "text comparison" thingy when I \
change the View constructor to take an "id" and a "readableName"  QString \
viewName(name);  if (viewName.contains(".Capture_Streams."))
     	emptyStreamHint = new QLabel(i18n("Capture Streams"));
@@ -118,8 +120,6 @@
     MixDeviceWidget *mdw;
     Qt::Orientation orientation = (_vflags & ViewBase::Vertical) ? Qt::Horizontal : \
Qt::Vertical;  
-
-
     if ( md->isEnum() ) {
         mdw = new MDWEnum(
                 md,           // MixDevice (parameter)
@@ -144,6 +144,7 @@
             _frm->setFrameStyle(QFrame::HLine | QFrame::Sunken);
         _separators.insert(md->id(),_frm);
         _layoutSliders->addWidget(_frm);
+
         mdw = new MDWSlider(
                 md,           // MixDevice (parameter)
                 true,         // Show Mute LED
@@ -204,14 +205,15 @@
         // The following for-loop could be simplified by using a std::find_if
         for ( int i=0; i<mixset.count(); i++ ) {
             MixDevice *md = mixset[i];
+
             if ( md->id().contains(idRegexp) )
             {
                 // Match found (by name)
                 if ( _mixSet->contains( md ) ) continue; // dup check
 
                 // Now check whether subcontrols match
-                bool subcontrolPlaybackWanted = (control->useSubcontrolPlayback() && \
                md->playbackVolume().hasVolume());
-                bool subcontrolCaptureWanted  = (control->useSubcontrolCapture()  && \
md->captureVolume().hasVolume()); +                bool subcontrolPlaybackWanted = \
(control->useSubcontrolPlayback() && ( md->playbackVolume().hasVolume() || \
md->playbackVolume().hasSwitch()) ); +                bool subcontrolCaptureWanted  = \
(control->useSubcontrolCapture()  && ( md->captureVolume() .hasVolume() || \
                md->captureVolume() .hasSwitch()) );
                 bool subcontrolEnumWanted  = (control->useSubcontrolEnum() && \
                md->isEnum());
                 bool subcontrolWanted =  subcontrolPlaybackWanted | \
subcontrolCaptureWanted | subcontrolEnumWanted;  bool splitWanted = \
control->isSplit();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic