[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdemultimedia/kmix
From: Colin Guthrie <cguthrie () mandriva ! org>
Date: 2011-04-03 11:51:54
Message-ID: 20110403115154.4FB0FAC8D4 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1226946 by cguthrie:
kmix: Do not save/load mixer profiles for dynamic mixers (e.g. PulseAudio)
These mixer profiles are just 'odd' when it comes to PA, especially the streams (as \
opposed to devices). When used under plain ALSA mixer profiles make sense to hide the \
unecessary complexity of ALSA from most users, but PA already hides that complexity \
and building a filter system on top of that makes little sense and leads to strange \
bugs/configurations.
CCBUG: 265317
CCBUG: 237239
CCBUG: 264835
M +22 -4 apps/kmix.cpp
M +5 -1 gui/guiprofile.cpp
M +13 -2 gui/viewbase.cpp
--- trunk/KDE/kdemultimedia/kmix/apps/kmix.cpp #1226945:1226946
@@ -338,8 +338,11 @@
// The following loop is necessary for the case that the user has hidden all \
views for a Mixer instance.
// Otherwise we would not save the Meta information (step -2- below for that \
mixer.
- foreach ( Mixer* mixer, Mixer::mixers() )
+ // We also do not save dynamic mixers (e.g. PulseAudio)
+ foreach ( Mixer* mixer, Mixer::mixers() ) {
+ if ( !mixer->dynamic() )
mixerViews[mixer->id()]; // just insert a map entry
+ }
// -1- Save the views themselves
for ( int i=0; i<m_wsMixers->count() ; ++i ) {
@@ -350,10 +353,12 @@
// Otherwise the user will be confused afer re-plugging the card (as the \
config was not saved). mw->saveConfig( KGlobal::config().data() );
// add the view to the corresponding mixer list, so we can save a \
views-per-mixer list below + if ( !mw->mixer()->dynamic() ) {
QStringList& qsl = mixerViews[mw->mixer()->id()];
qsl.append(mw->getGuiprof()->getId());
}
}
+ }
// -2- Save Meta-Information (which views, and in which order). views-per-mixer \
list KConfigGroup pconfig(KGlobal::config(), "Profiles");
@@ -538,10 +543,16 @@
continue; // OK, this mixer already has a profile => skip it
}
// No TAB YET => This should mean KMix is just started, or the user has just \
plugged in a card
- bool profileListHasKey = pconfig.hasKey( mixer->id() ); // <<< SHOULD be \
before the following line
- QStringList profileList = pconfig.readEntry( mixer->id(), QStringList() );
+ bool profileListHasKey = false;
+ QStringList profileList;
+ bool aProfileWasAddedSucesufully = false;
- bool aProfileWasAddedSucesufully = false;
+ if ( !mixer->dynamic() ) {
+ // We do not support save profiles for dynamic mixers (i.e. PulseAudio)
+
+ profileListHasKey = pconfig.hasKey( mixer->id() ); // <<< SHOULD be \
before the following line + profileList = pconfig.readEntry( mixer->id(), \
QStringList() ); +
foreach ( QString profileId, profileList)
{
// This handles the profileList form the kmixrc
@@ -555,6 +566,7 @@
kError() << "Cannot load profile " << profileId << " . It was \
removed by the user, or the KMix config file is defective."; }
}
+ }
// The we_need_a_fallback case is a bit tricky. Please ask the author \
(cesken) before even considering to change the code.
bool we_need_a_fallback = !aProfileWasAddedSucesufully; // we *possibly* \
want a fallback, if we couldn't add one @@ -567,11 +579,17 @@
// Lets try a bunch of fallback strategies:
GUIProfile* guiprof = 0;
+ if ( !mixer->dynamic() ) {
+ // We know that GUIProfile::find() will return 0 if the mixer is \
dynamic, so don't bother checking. + kDebug() << "Attempting to find a \
card-specific GUI Profile for the mixer " << mixer->id();
guiprof = GUIProfile::find(mixer, QString("default"), false, false); \
// ### Card specific profile ### if ( guiprof == 0 ) {
+ kDebug() << "Not found. Attempting to find a generic GUI Profile \
for the mixer " << mixer->id();
guiprof = GUIProfile::find(mixer, QString("default"), false, true); \
// ### Card unspecific profile ### }
+ }
if ( guiprof == 0) {
+ kDebug() << "Using fallback GUI Profile for the mixer " << \
mixer->id();
// This means there is neither card specific nor card unspecific \
profile
// This is the case for some backends (as they don't ship profiles).
guiprof = GUIProfile::fallbackProfile(mixer);
--- trunk/KDE/kdemultimedia/kmix/gui/guiprofile.cpp #1226945:1226946
@@ -158,8 +158,12 @@
{
GUIProfile* guiprof = 0;
- if ( mixer == 0 || profileName.isEmpty() ) {
+ if ( mixer == 0 || profileName.isEmpty() )
return 0;
+
+ if ( mixer->dynamic() ) {
+ kDebug(67100) << "GUIProfile::find() Not loading GUIProfile for Dynamic \
Mixer (e.g. PulseAudio)"; + return 0;
}
QString requestedProfileName;
--- trunk/KDE/kdemultimedia/kmix/gui/viewbase.cpp #1226945:1226946
@@ -307,6 +307,10 @@
kDebug(67100) << "KMixToolBox::loadView() grp=" << grp.toAscii();
static char guiComplexity[3][20] = { "simple", "extended", "all" };
+
+ // Certain bits are not saved for dynamic mixers (e.g. PulseAudio)
+ bool dynamic = _mixer->dynamic();
+
for ( int tries = 0; tries < 3; tries++ )
{
bool atLeastOneControlIsShown = false;
@@ -340,7 +344,7 @@
}
bool mdwEnabled = false;
- if ( devcg.hasKey("Show") )
+ if ( !dynamic && devcg.hasKey("Show") )
{
mdwEnabled = ( true == devcg.readEntry("Show", true) );
//kDebug() << "Load devgrp" << devgrp << "show=" << mdwEnabled;
@@ -389,6 +393,9 @@
// KConfigGroup cg = config->group( grp );
kDebug(67100) << "KMixToolBox::saveView() grp=" << grp;
+ // Certain bits are not saved for dynamic mixers (e.g. PulseAudio)
+ bool dynamic = _mixer->dynamic();
+
for (int i=0; i < view->_mdws.count(); ++i ){
QWidget *qmdw = view->_mdws[i];
if ( qmdw->inherits("MixDeviceWidget") )
@@ -408,14 +415,18 @@
// only sliders have the ability to split apart in mutliple channels
devcg.writeEntry( "Split", ! mdw->isStereoLinked() );
}
+ if ( !dynamic ) {
devcg.writeEntry( "Show" , mdw->isVisibleTo(view) );
kDebug() << "Save devgrp" << devgrp << "show=" << mdw->isVisibleTo(view);
+ }
} // inherits MixDeviceWidget
} // for all MDW's
+ if ( !dynamic ) {
+ // We do not save GUIProfiles (as they cannot be customised) for dynamic \
mixers (e.g. PulseAudio) kDebug(67100) << "GUIProfile is dirty: " << \
guiProfile()->isDirty();
- if ( guiProfile()->isDirty() ) {
+ if ( guiProfile()->isDirty() )
guiProfile()->writeProfile();
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic