rpms/kdemultimedia/devel kmix_pa-20100117.patch, NONE, 1.1 kdemultimedia.spec, 1.170, 1.171 kmix_pa-20100111.patch, 1.1, NONE

Rex Dieter rdieter at fedoraproject.org
Sun Jan 17 22:33:43 UTC 2010


Author: rdieter

Update of /cvs/pkgs/rpms/kdemultimedia/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv16667

Modified Files:
	kdemultimedia.spec 
Added Files:
	kmix_pa-20100117.patch 
Removed Files:
	kmix_pa-20100111.patch 
Log Message:
* Sun Jan 17 2010 Rex Dieter <rdieter at fedoraproject.org> - 4.3.90-4
- respin kmix_pa patch


kmix_pa-20100117.patch:
 CMakeLists.txt              |    1 
 KMixApp.cpp                 |   14 
 dialogviewconfiguration.cpp |    4 
 kmix-platforms.cpp          |    8 
 kmix.cpp                    |   53 +
 kmix.h                      |    1 
 kmixerwidget.cpp            |    2 
 kmixerwidget.h              |    1 
 kmixprefdlg.h               |    2 
 main.cpp                    |    1 
 mdwmoveaction.cpp           |   48 +
 mdwmoveaction.h             |   46 +
 mdwslider.cpp               |  133 ++---
 mdwslider.h                 |   13 
 mixdevice.cpp               |  105 +++
 mixdevice.h                 |   15 
 mixdevicewidget.cpp         |    1 
 mixdevicewidget.h           |    2 
 mixer.cpp                   |   27 -
 mixer.h                     |    9 
 mixer_alsa9.cpp             |    4 
 mixer_backend.cpp           |   15 
 mixer_backend.h             |    5 
 mixer_pulse.cpp             | 1167 +++++++++++++++++++++++++++++++++++++-------
 mixer_pulse.h               |   60 +-
 mixertoolbox.cpp            |  147 ++---
 mixertoolbox.h              |    3 
 viewbase.cpp                |   72 ++
 viewbase.h                  |    7 
 viewdockareapopup.cpp       |   11 
 viewdockareapopup.h         |    2 
 viewsliders.cpp             |   18 
 viewsliders.h               |    4 
 33 files changed, 1609 insertions(+), 392 deletions(-)

--- NEW FILE kmix_pa-20100117.patch ---
diff --git a/kmix/CMakeLists.txt b/kmix/CMakeLists.txt
index 4880470..d7929da 100644
--- a/kmix/CMakeLists.txt
+++ b/kmix/CMakeLists.txt
@@ -18,6 +18,7 @@ set(kmix_KDEINIT_SRCS ${kmix_adaptor_SRCS}
    viewdockareapopup.cpp 
    viewsliders.cpp 
    mixdevicewidget.cpp 
+   mdwmoveaction.cpp 
    mdwslider.cpp 
    mdwenum.cpp 
    kmixerwidget.cpp 
diff --git a/kmix/KMixApp.cpp b/kmix/KMixApp.cpp
index a5cf1d5..43ec696 100644
--- a/kmix/KMixApp.cpp
+++ b/kmix/KMixApp.cpp
@@ -51,7 +51,8 @@ KMixApp::newInstance()
         // There are 3 cases for a new instance
 
 	//kDebug(67100) <<  "KMixApp::newInstance() isRestored()=" << isRestored() << "_keepVisibility=" << _keepVisibility;
-	if ( m_kmix )
+	static bool first = true;
+	if ( !first )
 	{	// There already exists an instance/window
  
                 /* !!! @bug : _keepVisibilty has the wrong value here.
@@ -74,7 +75,11 @@ KMixApp::newInstance()
                         // starts it again, the KMix main window will be shown.
 			// If KMix is restored by SM or the --keepvisibilty is used, KMix will NOT
 			// explicitly be shown.
-			m_kmix->show();
+			if ( !m_kmix ) {
+				m_kmix->show();
+			} else {
+				kWarning(67100) << "KMixApp::newInstance() Window has not finished constructing yet so ignoring the show() request.";
+			}
 		}
 		else {
                         // CASE 2: If KMix is running, AND  ( session gets restored OR keepvisibilty command line switch )
@@ -92,6 +97,11 @@ KMixApp::newInstance()
 	{
                 // CASE 3: KMix was not running yet => instanciate a new one
 		//kDebug(67100) <<  "KMixApp::newInstance() Instanciate: _keepVisibility=" << _keepVisibility ;
+		first = false;	// NB See https://qa.mandriva.com/show_bug.cgi?id=56893#c3
+				// It is important to track this via a separate variable and not
+				// based on m_kmix to handle this race condition.
+				// Specific protection for the activation-prior-to-full-construction
+				// case exists above in the 'already running case'
 		m_kmix = new KMixWindow(_keepVisibility);
 		//connect(this, SIGNAL(stopUpdatesOnVisibility()), m_kmix, SLOT(stopVisibilityUpdates()));
 		if ( isSessionRestored() && KMainWindow::canBeRestored(0) )
diff --git a/kmix/dialogviewconfiguration.cpp b/kmix/dialogviewconfiguration.cpp
index c035037..e586186 100644
--- a/kmix/dialogviewconfiguration.cpp
+++ b/kmix/dialogviewconfiguration.cpp
@@ -264,10 +264,10 @@ void DialogViewConfiguration::createPage()
 
             //qDebug()  << "add DialogViewConfigurationItem: " << mdName << " visible=" << mdw->isVisible() << "splitted=" << splitted;
             if ( mdw->isVisible() ) {
-              new DialogViewConfigurationItem(_qlw, md->id(), mdw->isVisible(), mdName, splitted, mdw->iconName());
+              new DialogViewConfigurationItem(_qlw, md->id(), mdw->isVisible(), mdName, splitted, mdw->mixDevice()->iconName());
             }
             else {
-              new DialogViewConfigurationItem(_qlwInactive, md->id(), mdw->isVisible(), mdName, splitted, mdw->iconName());
+              new DialogViewConfigurationItem(_qlwInactive, md->id(), mdw->isVisible(), mdName, splitted, mdw->mixDevice()->iconName());
             }
 
 /*
diff --git a/kmix/kmix-platforms.cpp b/kmix/kmix-platforms.cpp
index f7b8c9a..5f61989 100644
--- a/kmix/kmix-platforms.cpp
+++ b/kmix/kmix-platforms.cpp
@@ -129,6 +129,10 @@ MixerFactory g_mixerFactories[] = {
     { IRIX_getMixer, IRIX_getDriverName },
 #endif
 
+#if defined(PULSE_MIXER)
+    { PULSE_getMixer, PULSE_getDriverName },
+#endif
+
 #if defined(ALSA_MIXER)
     { ALSA_getMixer, ALSA_getDriverName },
 #endif
@@ -145,10 +149,6 @@ MixerFactory g_mixerFactories[] = {
     { HPUX_getMixer, HPUX_getDriverName },
 #endif
 
-#if defined(PULSE_MIXER)
-    { PULSE_getMixer, PULSE_getDriverName },
-#endif
-
     { 0, 0 }
 };
 
diff --git a/kmix/kmix.cpp b/kmix/kmix.cpp
index 30cc5d4..37a9066 100644
--- a/kmix/kmix.cpp
+++ b/kmix/kmix.cpp
@@ -49,6 +49,7 @@
 #include <ktoggleaction.h>
 
 // KMix
+#include "guiprofile.h"
 #include "mixertoolbox.h"
 #include "kmix.h"
 #include "kmixdevicemanager.h"
@@ -399,11 +400,30 @@ void KMixWindow::recreateGUIwithoutSavingView()
  */
 void KMixWindow::recreateGUI(bool saveConfig)
 {
+   // Find out which of the tabs is currently selected for restoration
+   int current_tab = -1;
+   if (m_wsMixers)
+      current_tab = m_wsMixers->currentIndex();
+
+   // NOTE (coling) This is a bug but I don't have time to find the source.
+   // When returning from "Configure Mixers..." we MUST save, but the
+   // flag comes through as false, presumably due to the rebuildGUI() signal
+   // being tied to the recreateGUIwithoutSavingView() slot.
+   // This should really be fixed :s
+   Q_UNUSED(saveConfig);
    saveViewConfig();  // save the state before recreating
+
+   // Before clearing the mixer widgets, we must increase the refcount on the guiprof to save it deleting the ViewBase object.
+   if ( Mixer::mixers().count() > 0 )
+      for (int i=0; i<Mixer::mixers().count(); ++i)
+         MixerToolBox::instance()->selectProfile((Mixer::mixers())[i])->increaseRefcount();
    clearMixerWidgets();
+
    if ( Mixer::mixers().count() > 0 ) {
       for (int i=0; i<Mixer::mixers().count(); ++i) {
          Mixer *mixer = (Mixer::mixers())[i];
+         // We've increased the refcount before clearing, so remember and decrease it again.
+         MixerToolBox::instance()->selectProfile(mixer)->decreaseRefcount();
          addMixerWidget(mixer->id());
       }
       bool dockingSucceded = updateDocking();
@@ -415,6 +435,39 @@ void KMixWindow::recreateGUI(bool saveConfig)
        updateDocking();  // -<- removes the DockIcon
        hide();
    }
+
+   if (current_tab >= 0) {
+      m_wsMixers->setCurrentIndex(current_tab);
+   }
+}
+
+
+/**
+* Create or recreate the Mixer GUI elements
+*/
+void KMixWindow::redrawMixer( const QString& mixer_ID )
+{
+    for ( int i=0; i<m_wsMixers->count() ; ++i )
+    {
+        QWidget *w = m_wsMixers->widget(i);
+        if ( w->inherits("KMixerWidget") )
+        {
+            KMixerWidget* kmw = (KMixerWidget*)w;
+            if ( kmw->mixer()->id() == mixer_ID )
+            {
+                kDebug(67100) << "KMixWindow::redrawMixer() " << mixer_ID << " is being redrawn";
+                kmw->loadConfig( KGlobal::config().data() );
+
+                // Is the below needed? It is done on startup so copied it here...
+                kmw->setTicks( m_showTicks );
+                kmw->setLabels( m_showLabels );
+
+                return;
+            }
+        }
+    }
+
+    kWarning(67100) << "KMixWindow::redrawMixer() Requested to redraw " << mixer_ID << " but I cannot find it :s";
 }
 
 
diff --git a/kmix/kmix.h b/kmix/kmix.h
index 7fca083..81774ea 100644
--- a/kmix/kmix.h
+++ b/kmix/kmix.h
@@ -87,6 +87,7 @@ KMixWindow : public KXmlGuiWindow
    virtual void applyPrefs( KMixPrefDlg *prefDlg );
    void recreateGUI(bool saveView);
    void recreateGUIwithoutSavingView();
+   void redrawMixer( const QString& mixer_ID );
       
       
    //void stopVisibilityUpdates();
diff --git a/kmix/kmixerwidget.cpp b/kmix/kmixerwidget.cpp
index b7fdb2a..def1bae 100644
--- a/kmix/kmixerwidget.cpp
+++ b/kmix/kmixerwidget.cpp
@@ -92,6 +92,7 @@ void KMixerWidget::createLayout(ViewBase::ViewFlags vflags)
    // delete old objects
    if( m_balanceSlider ) {
       delete m_balanceSlider;
+      m_balanceSlider = 0;
    }
[...2464 lines suppressed...]
+    }
+}
 
 void ViewBase::refreshVolumeLevels()
 {
     // is virtual
 }
 
-Mixer* ViewBase::getMixer() {
+Mixer* ViewBase::getMixer()
+{
     return _mixer;
 }
 
+void ViewBase::setMixSet()
+{
+    if ( _mixer->dynamic()) {
+
+        // Check the guiprofile... if it is not the fallback GUIProfile, then
+        // make sure that we add a specific entry for any devices not present.
+        if ( 0 != _guiprof && MixerToolBox::instance()->fallbackProfile(_mixer) != _guiprof ) {
+            kDebug(67100) << "Dynamic mixer " << _mixer->id() << " is NOT using Fallback GUIProfile. Checking to see if new controls are present";
+
+            QList<QString> new_mix_devices;
+            MixSet ms = _mixer->getMixSet();
+            for (int i=0; i < ms.count(); ++i)
+                new_mix_devices.append(ms[i]->id());
+            std::vector<ProfControl*>::const_iterator itEnd = _guiprof->_controls.end();
+            for ( std::vector<ProfControl*>::const_iterator it = _guiprof->_controls.begin(); it != itEnd; ++it)
+                new_mix_devices.removeAll((*it)->id);
+
+            if ( new_mix_devices.count() > 0 ) {
+                kDebug(67100) << "Found " << new_mix_devices.count() << " new controls. Adding to GUIProfile";
+                while ( new_mix_devices.count() > 0 ) {
+                    ProfControl* ctl = new ProfControl();
+                    ctl->id = new_mix_devices.takeAt(0);
+                    ctl->subcontrols = ".*";
+                    ctl->tab = _guiprof->_tabs[0]->name; // Use the first tab... not ideal but should work most of the time;
+                    ctl->show = "simple";
+                    _guiprof->_controls.push_back(ctl);
+                }
+                QString profileName;
+                profileName =  _mixer->id() + "." + id();
+                _guiprof->writeProfile(profileName);
+            }
+        }
+
+        // We need to delete the current MixDeviceWidgets so we can redraw them
+        while (!_mdws.isEmpty()) {
+            QWidget* mdw = _mdws.last();
+            _mdws.pop_back();
+            delete mdw;
+        }
+
+        // Clean up our _mixSet so we can reapply our GUIProfile
+        _mixSet->clear();
+    }
+    _setMixSet();
+}
+
+
 /**
  * Open the View configuration dialog. The user can select which channels he wants
  * to see and which not.
diff --git a/kmix/viewbase.h b/kmix/viewbase.h
index 0470f18..e3a6f9d 100644
--- a/kmix/viewbase.h
+++ b/kmix/viewbase.h
@@ -83,7 +83,7 @@ public:
      */
     virtual void createDeviceWidgets();
 
-    virtual void setMixSet() = 0;
+    void setMixSet();
     
     Mixer* getMixer();
 
@@ -118,6 +118,7 @@ public:
 
 signals:
     void rebuildGUI();
+    void redrawMixer( const QString& mixer_ID );
 
 
 protected:
@@ -129,7 +130,11 @@ protected:
     ViewFlags _vflags;
     GUIProfile* _guiprof;
    KActionCollection *_localActionColletion;
+
+    virtual void _setMixSet() = 0;
+
 public slots:
+   virtual void controlsReconfigured( const QString& mixer_ID );
    virtual void refreshVolumeLevels();
    virtual void configureView(); 
    void toggleMenuBarSlot();
diff --git a/kmix/viewdockareapopup.cpp b/kmix/viewdockareapopup.cpp
index 57ac597..9f9f7fd 100644
--- a/kmix/viewdockareapopup.cpp
+++ b/kmix/viewdockareapopup.cpp
@@ -81,9 +81,18 @@ void ViewDockAreaPopup::showContextMenu()
 }
 
 
-void ViewDockAreaPopup::setMixSet()
+void ViewDockAreaPopup::_setMixSet()
 {
    // kDebug(67100) << "ViewDockAreaPopup::setMixSet()\n";
+
+   if ( _mixer->dynamic() ) {
+      // Our _layoutMDW now should only contain spacer widgets from the QSpacerItems's in add() below.
+      // We need to trash those too otherwise all sliders gradually migrate away from the edge :p
+      QLayoutItem *li;
+      while ( ( li = _layoutMDW->takeAt(0) ) )
+         delete li;
+   }
+
    MixDevice *dockMD = Mixer::getGlobalMasterMD();
    if ( dockMD == 0 ) {
       // If we have no dock device yet, we will take the first available mixer device
diff --git a/kmix/viewdockareapopup.h b/kmix/viewdockareapopup.h
index f289dd6..65323cf 100644
--- a/kmix/viewdockareapopup.h
+++ b/kmix/viewdockareapopup.h
@@ -43,7 +43,6 @@ public:
     ~ViewDockAreaPopup();
     MixDevice* dockDevice();
 
-    virtual void setMixSet();
     virtual QWidget* add(MixDevice *mdw);
     virtual void constructionFinished();
     virtual void refreshVolumeLevels();
@@ -58,6 +57,7 @@ protected:
     QPushButton     *_showPanelBox;
 
     void wheelEvent ( QWheelEvent * e );
+    virtual void _setMixSet();
 
 private:
     QGridLayout* _layoutMDW;
diff --git a/kmix/viewsliders.cpp b/kmix/viewsliders.cpp
index fa2246c..a43ceef 100644
--- a/kmix/viewsliders.cpp
+++ b/kmix/viewsliders.cpp
@@ -119,10 +119,20 @@ QWidget* ViewSliders::add(MixDevice *md)
 }
 
 
-void ViewSliders::setMixSet()
+void ViewSliders::_setMixSet()
 {
-    const MixSet& mixset = _mixer->getMixSet();
-
+   const MixSet& mixset = _mixer->getMixSet();
+
+   if ( _mixer->dynamic() ) {
+      // We will be recreating our sliders, so make sure we trash all the separators too.
+      qDeleteAll(_separators);
+      _separators.clear();
+      // Our _layoutSliders now should only contain spacer widgets from the addSpacing() calls in add() above.
+      // We need to trash those too otherwise all sliders gradually migrate away from the edge :p
+      QLayoutItem *li;
+      while ( ( li = _layoutSliders->takeAt(0) ) )
+         delete li;
+   }
 
    // This method iterates the controls from the Profile
    // Each control is checked, whether it is also contained in the mixset, and
@@ -135,7 +145,7 @@ void ViewSliders::setMixSet()
       if ( control->tab == id() ) {
          // The TabName of the control matches this View name (!! attention: Better use some ID, due to i18n() )
          bool isUsed = false;
-   
+
          QRegExp idRegexp(control->id);
          //kDebug(67100) << "ViewSliders::setMixSet(): Check GUIProfile id==" << control->id << "\n";
          // The following for-loop could be simplified by using a std::find_if
diff --git a/kmix/viewsliders.h b/kmix/viewsliders.h
index 1695595..9f7ce32 100644
--- a/kmix/viewsliders.h
+++ b/kmix/viewsliders.h
@@ -36,7 +36,6 @@ public:
     ViewSliders(QWidget* parent, const char* name, Mixer* mixer, ViewBase::ViewFlags vflags, GUIProfile *guiprof, KActionCollection *actColl);
     ~ViewSliders();
 
-    virtual void setMixSet();
     virtual QWidget* add(MixDevice *mdw);
     virtual void constructionFinished();
     virtual void configurationUpdate();
@@ -44,6 +43,9 @@ public:
 public slots:
     virtual void refreshVolumeLevels();
 
+protected:
+    virtual void _setMixSet();
+
 private:
     QBoxLayout* _layoutMDW;
     QLayout* _layoutSliders;


Index: kdemultimedia.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kdemultimedia/devel/kdemultimedia.spec,v
retrieving revision 1.170
retrieving revision 1.171
diff -u -p -r1.170 -r1.171
--- kdemultimedia.spec	14 Jan 2010 14:28:02 -0000	1.170
+++ kdemultimedia.spec	17 Jan 2010 22:33:42 -0000	1.171
@@ -2,7 +2,7 @@
 Name:    kdemultimedia
 Epoch:   6
 Version: 4.3.90
-Release: 3%{?dist}
+Release: 4%{?dist}
 Summary: KDE Multimedia applications
 
 Group:   Applications/Multimedia
@@ -16,7 +16,7 @@ Patch1: kdemultimedia-4.3.75-nomplayerth
 Patch2: kdemultimedia-4.3.75-kscd_doc.patch
 # git clone git://colin.guthr.ie/kdemultimedia
 # git diff master..remotes/origin/pulse > kmix_pa-<date>.patch
-Patch3: kmix_pa-20100111.patch
+Patch3: kmix_pa-20100117.patch
 
 ## upstream patches
 
@@ -183,6 +183,9 @@ fi
 
 
 %changelog
+* Sun Jan 17 2010 Rex Dieter <rdieter at fedoraproject.org> - 4.3.90-4
+- respin kmix_pa patch
+
 * Thu Jan 14 2010 Rex Dieter <rdieter at fedoraproject.org> - 4.3.90-3
 - (re)enable mplayerthumbs (fedora-only)
 


--- kmix_pa-20100111.patch DELETED ---



More information about the scm-commits mailing list