diff --git a/kmix-pulse.patch b/kmix-pulse.patch index 8e22ae4..4b126f8 100644 --- a/kmix-pulse.patch +++ b/kmix-pulse.patch @@ -2603,241 +2603,6 @@ index 6dcd68b..6c43b0c 100644 -#endif +#endif -diff --git a/kmix/mixertoolbox.cpp b/kmix/mixertoolbox.cpp -index f424916..873082f 100644 ---- a/kmix/mixertoolbox.cpp -+++ b/kmix/mixertoolbox.cpp -@@ -37,7 +37,7 @@ - - - MixerToolBox* MixerToolBox::s_instance = 0; --GUIProfile* MixerToolBox::s_fallbackProfile = 0; -+QMap MixerToolBox::s_fallbackProfiles; - QRegExp MixerToolBox::s_ignoreMixerExpression("Modem"); - //KLocale* MixerToolBox::s_whatsthisLocale = 0; - -@@ -112,7 +112,8 @@ void MixerToolBox::initMixer(bool multiDriverMode, QString& ref_hwInfoString) - for( int drv=0; drv sane exit from outer loop - break; -@@ -136,31 +137,33 @@ void MixerToolBox::initMixer(bool multiDriverMode, QString& ref_hwInfoString) - autodetectionFinished = true; // highest device number of driver and a Mixer => finished - } - -- // append driverName (used drivers) -- if ( mixerAccepted && !drvInfoAppended ) -- { -- drvInfoAppended = true; -- QString driverName = Mixer::driverName(drv); -- if ( Mixer::mixers().count() > 1) { -- driverInfoUsed += " + "; -- } -- driverInfoUsed += driverName; -- } -- -- // Check whether there are mixers in different drivers, so that the user can be warned -- if (mixerAccepted && !multipleDriversActive) -+ if ( mixerAccepted ) - { -- if ( driverWithMixer == -1 ) -+ kDebug(67100) << "Success! Found a mixer with the : " << driverName << " driver"; -+ // append driverName (used drivers) -+ if ( !drvInfoAppended ) - { -- // Aha, this is the very first detected device -- driverWithMixer = drv; -+ drvInfoAppended = true; -+ if ( Mixer::mixers().count() > 1) -+ driverInfoUsed += " + "; -+ driverInfoUsed += driverName; - } -- else if ( driverWithMixer != drv ) -+ -+ // Check whether there are mixers in different drivers, so that the user can be warned -+ if ( !multipleDriversActive ) - { -- // Got him: There are mixers in different drivers -- multipleDriversActive = true; -- } -- } // !multipleDriversActive -+ if ( driverWithMixer == -1 ) -+ { -+ // Aha, this is the very first detected device -+ driverWithMixer = drv; -+ } -+ else if ( driverWithMixer != drv ) -+ { -+ // Got him: There are mixers in different drivers -+ multipleDriversActive = true; -+ } -+ } // !multipleDriversActive -+ } // mixerAccepted - - } // loop over sound card devices of current driver - -@@ -357,9 +360,13 @@ GUIProfile* MixerToolBox::selectProfile(Mixer* mixer) - - QString userProfileDir = KStandardDirs::locateLocal("appdata", "profiles/" ); - -+ QString mixerNameSpacesToUnderscores = mixer->baseName(); -+ mixerNameSpacesToUnderscores.replace(" ","_"); -+ - // (1) User profile Directory - QDir dir(userProfileDir); - dir.setFilter(QDir::Files); -+ dir.setNameFilters(QStringList(mixer->getDriverName() + "." + mixerNameSpacesToUnderscores + "*.xml")); - QFileInfoList fileList = dir.entryInfoList(); - - QString fileNamePrefix = "profiles/" + mixer->getDriverName() + "."; -@@ -369,39 +376,34 @@ GUIProfile* MixerToolBox::selectProfile(Mixer* mixer) - QString fileNameFQ; - fileNameFQ = KStandardDirs::locate("appdata", fileName ); - kDebug() << fileName << "; fnfq1=" << fileNameFQ; -- QFileInfo qfi1(fileNameFQ); -- fileList.insert(0, qfi1); -+ if (!fileNameFQ.isEmpty()) -+ fileList.insert(0, QFileInfo(fileNameFQ)); - - // (3) Soundcard specific profile (usually from system Directory) -- QString mixerNameSpacesToUnderscores = mixer->baseName(); -- mixerNameSpacesToUnderscores.replace(" ","_"); - fileName = fileNamePrefix + mixerNameSpacesToUnderscores + ".xml"; - fileNameFQ = KStandardDirs::locate("appdata", fileName ); - kDebug() << fileName << "; fnfq2=" << fileNameFQ; -- QFileInfo qfi2(fileNameFQ); -- fileList.insert(0, qfi2); -+ if (!fileNameFQ.isEmpty()) -+ fileList.insert(0, QFileInfo(fileNameFQ)); - - - - for (int i = 0; i < fileList.size(); ++i) { - QFileInfo fileInfo = fileList.at(i); -- kDebug() << i << ": Check user profile " << fileInfo.fileName() ; -- if ( QDir::match( "*.xml", fileInfo.fileName() ) ) { -- QString fileNameAbs = fileInfo.absoluteFilePath(); -- QString fileNameRelToProfile = "profiles/" + fileInfo.fileName(); -- kDebug() << i << ": Try user profile " << fileNameAbs; -- GUIProfile* guiprofTemp = new GUIProfile(); -- if ( guiprofTemp->readProfile(fileNameAbs, fileNameRelToProfile) ) { -- matchValueTemp = guiprofTemp->match(mixer); -- if ( matchValueTemp < matchValueBest ) { -- delete guiprofTemp; -- guiprofTemp = 0; -- matchValueTemp = 0; -- } -- else { -- guiprofBest = guiprofTemp; -- matchValueBest = matchValueTemp; -- } -+ QString fileNameAbs = fileInfo.absoluteFilePath(); -+ QString fileNameRelToProfile = "profiles/" + fileInfo.fileName(); -+ kDebug() << i << ": Try user profile " << fileNameAbs; -+ GUIProfile* guiprofTemp = new GUIProfile(); -+ if ( guiprofTemp->readProfile(fileNameAbs, fileNameRelToProfile) ) { -+ matchValueTemp = guiprofTemp->match(mixer); -+ if ( matchValueTemp < matchValueBest ) { -+ delete guiprofTemp; -+ guiprofTemp = 0; -+ matchValueTemp = 0; -+ } -+ else { -+ guiprofBest = guiprofTemp; -+ matchValueBest = matchValueTemp; - } - } - } -@@ -411,33 +413,40 @@ kDebug() << fileName << "; fnfq2=" << fileNameFQ; - // Still no profile found. This should usually not happen. This means one of the following things: - // a) The KMix installation is not OK - // b) The user has a defective profile in ~/.kde/share/apps/kmix/profiles/ -- // c) It is a Backend that ships no default profile (currently this is only Mixer_SUN) -- if ( s_fallbackProfile == 0 ) { -- s_fallbackProfile = new GUIProfile(); -- -- ProfProduct* prd = new ProfProduct(); -- prd->vendor = mixer->getDriverName(); -- prd->productName = mixer->readableName(); -- prd->productRelease = "1.0"; -- s_fallbackProfile->_products.insert(prd); -- -- ProfControl* ctl = new ProfControl(); -- ctl->id = ".*"; -- ctl->regexp = ".*"; // make sure id matches the regexp -- ctl->subcontrols = ".*"; -- ctl->show = "simple"; -- s_fallbackProfile->_controls.push_back(ctl); -- -- s_fallbackProfile->_soundcardDriver = mixer->getDriverName(); -- s_fallbackProfile->_soundcardName = mixer->readableName(); -- -- s_fallbackProfile->finalizeProfile(); -- } -- guiprofBest = s_fallbackProfile; -+ // c) It is a Backend that ships no default profile (currently this is only Mixer_SUN and Mixer_PULSE) -+ guiprofBest = fallbackProfile(mixer); - } - // kDebug(67100) << "New Best =" << matchValueBest << " pointer=" << guiprofBest << "\n"; - - return guiprofBest; - } - -+ -+GUIProfile* MixerToolBox::fallbackProfile(Mixer *mixer) -+{ -+ if ( ! s_fallbackProfiles.contains(mixer) ) { -+ GUIProfile *fallback = new GUIProfile(); -+ -+ ProfProduct* prd = new ProfProduct(); -+ prd->vendor = mixer->getDriverName(); -+ prd->productName = mixer->readableName(); -+ prd->productRelease = "1.0"; -+ fallback->_products.insert(prd); -+ -+ ProfControl* ctl = new ProfControl(); -+ ctl->id = ".*"; -+ ctl->regexp = ".*"; // make sure id matches the regexp -+ ctl->subcontrols = ".*"; -+ ctl->show = "simple"; -+ fallback->_controls.push_back(ctl); -+ -+ fallback->_soundcardDriver = mixer->getDriverName(); -+ fallback->_soundcardName = mixer->readableName(); -+ -+ fallback->finalizeProfile(); -+ s_fallbackProfiles[mixer] = fallback; -+ } -+ return s_fallbackProfiles[mixer]; -+} -+ - #include "mixertoolbox.moc" -diff --git a/kmix/mixertoolbox.h b/kmix/mixertoolbox.h -index 2af5118..fa19645 100644 ---- a/kmix/mixertoolbox.h -+++ b/kmix/mixertoolbox.h -@@ -53,6 +53,7 @@ class MixerToolBox : public QObject - - Mixer* find( const QString& mixer_id); - GUIProfile* selectProfile(Mixer*); -+ GUIProfile* fallbackProfile(Mixer*); - //static KLocale* whatsthisControlLocale(); - - signals: -@@ -60,7 +61,7 @@ class MixerToolBox : public QObject - - private: - static MixerToolBox* s_instance; -- static GUIProfile* s_fallbackProfile; -+ static QMap s_fallbackProfiles; - QMap s_mixerNums; - static QRegExp s_ignoreMixerExpression; - diff --git a/kmix/verticaltext.cpp b/kmix/verticaltext.cpp index 3cdfc88..62cd32a 100644 --- a/kmix/verticaltext.cpp