summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2020-09-16 23:34:21 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2020-09-16 23:34:21 +0900
commit00105125e3010438663b1355f6f1579476ee9510 (patch)
tree51e43d62f7c9900c007c92ad5e226bdc4bf9d4bc
parentf0e311f71b7f02fb20e5db21a297a2c4caee9153 (diff)
downloadtdemultimedia-feat/kmix/mixer-detection.tar.gz
tdemultimedia-feat/kmix/mixer-detection.zip
This is a temporary commit to save WIP done on this topic.feat/kmix/mixer-detection
Development of this feature will only resume after the release of R14.1.0. Relates to bug 3159. NOTE: this commit needs to be completed/reworked. It should not be merged to master as is. Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
-rw-r--r--kmix/KMixApp.cpp9
-rw-r--r--kmix/KMixApp.h6
-rw-r--r--kmix/kmix-platforms.cpp2
-rw-r--r--kmix/kmix.cpp12
-rw-r--r--kmix/kmix.h1
-rw-r--r--kmix/mixer.cpp4
-rw-r--r--kmix/mixertoolbox.cpp20
-rw-r--r--kmix/mixertoolbox.h7
8 files changed, 42 insertions, 19 deletions
diff --git a/kmix/KMixApp.cpp b/kmix/KMixApp.cpp
index d511605..a1032e2 100644
--- a/kmix/KMixApp.cpp
+++ b/kmix/KMixApp.cpp
@@ -26,7 +26,7 @@
KMixApp::KMixApp()
- : KUniqueApplication(), m_kmix( 0 )
+ : KUniqueApplication(), m_kmix(NULL), m_updateMixersTimer(NULL)
{
// We handle autostart via standard autostart-enabled .desktop file instead of the session manager
disableSessionManagement();
@@ -35,6 +35,10 @@ KMixApp::KMixApp()
KMixApp::~KMixApp()
{
+ if (m_updateMixersTimer)
+ {
+ delete m_updateMixersTimer;
+ }
if (m_kmix)
{
delete m_kmix;
@@ -52,6 +56,9 @@ KMixApp::newInstance()
else
{
m_kmix = new KMixWindow;
+ m_updateMixersTimer = new TQTimer();
+ connect(m_updateMixersTimer, TQT_SIGNAL(timeout()), m_kmix, TQT_SLOT(updateMixers()));
+ m_updateMixersTimer->start(5000);
connect(this, TQT_SIGNAL(stopUpdatesOnVisibility()), m_kmix, TQT_SLOT(stopVisibilityUpdates()));
if ( isRestored() && TDEMainWindow::canBeRestored(0) )
{
diff --git a/kmix/KMixApp.h b/kmix/KMixApp.h
index 7630e1f..d48fc1b 100644
--- a/kmix/KMixApp.h
+++ b/kmix/KMixApp.h
@@ -2,6 +2,7 @@
#define KMixApp_h
#include <kuniqueapplication.h>
+#include <tqtimer.h>
class KMixWindow;
@@ -12,9 +13,9 @@ Q_OBJECT
public:
KMixApp();
~KMixApp();
- int newInstance ();
+ int newInstance();
- public slots:
+ public slots:
void quitExtended(); // For a hack on visibility()
signals:
@@ -22,6 +23,7 @@ Q_OBJECT
private:
KMixWindow *m_kmix;
+ TQTimer *m_updateMixersTimer;
};
#endif
diff --git a/kmix/kmix-platforms.cpp b/kmix/kmix-platforms.cpp
index b27a9ed..b918279 100644
--- a/kmix/kmix-platforms.cpp
+++ b/kmix/kmix-platforms.cpp
@@ -20,8 +20,6 @@
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-/* This code is being #include'd from mixer.cpp */
-
#ifndef KMIX_PLATFORMS_CPP
#define KMIX_PLATFORMS_CPP
diff --git a/kmix/kmix.cpp b/kmix/kmix.cpp
index 3ebf672..9a786ab 100644
--- a/kmix/kmix.cpp
+++ b/kmix/kmix.cpp
@@ -546,8 +546,16 @@ void KMixWindow::stopVisibilityUpdates()
m_visibilityUpdateAllowed = false;
}
-void
-KMixWindow::slotHWInfo() {
+void KMixWindow::updateMixers()
+{
+tqWarning("MIKE <KMixWindow> update mixers ENTER");
+ if (MixerToolBox::updateMixer(Mixer::mixers(), m_multiDriverMode, m_hwInfoString))
+ {
+ initMixerWidgets();
+ }
+}
+
+void KMixWindow::slotHWInfo() {
KMessageBox::information( 0, m_hwInfoString, i18n("Mixer Hardware Information") );
}
diff --git a/kmix/kmix.h b/kmix/kmix.h
index c41beb6..fb1d99e 100644
--- a/kmix/kmix.h
+++ b/kmix/kmix.h
@@ -109,6 +109,7 @@ KMixWindow : public TDEMainWindow, virtual public KMixIface
void saveVolumes();
virtual void applyPrefs( KMixPrefDlg *prefDlg );
void stopVisibilityUpdates();
+ void updateMixers();
private:
TDEAccel *m_keyAccel;
diff --git a/kmix/mixer.cpp b/kmix/mixer.cpp
index 778d6af..74f4113 100644
--- a/kmix/mixer.cpp
+++ b/kmix/mixer.cpp
@@ -80,8 +80,8 @@ bool Mixer::isValid(int driver, int device)
Mixer_Backend *mb = mf(device);
if (mb)
{
- bool ret = mb->isValid();
- delete mb;
+ bool ret = mb->isValid();
+ delete mb;
return ret;
}
}
diff --git a/kmix/mixertoolbox.cpp b/kmix/mixertoolbox.cpp
index 1021fd8..25836ae 100644
--- a/kmix/mixertoolbox.cpp
+++ b/kmix/mixertoolbox.cpp
@@ -249,7 +249,6 @@ void MixerToolBox::initMixer(TQPtrList<Mixer> &mixers, bool multiDriverMode, TQS
}
-
/*
* Clean up and free all resources of all found Mixers, which were found in the initMixer() call
*/
@@ -279,10 +278,6 @@ void MixerToolBox::deinitMixer(TQPtrList<Mixer> &mixers)
}
/**
- * Clean up and free all resources of the given mixers
- * @par mixers The list of mixers to deinitialize.
- */
-/**
* Scan for Mixers in the System and update the given list. No longer existing mixers
* will be deinitialized.
* @par mixers The list where to add the found Mixers. This parameter is superfluous
@@ -291,12 +286,15 @@ void MixerToolBox::deinitMixer(TQPtrList<Mixer> &mixers)
* @par multiDriverMode Whether the Mixer scan should try more all backendends.
* 'true' means to scan all backends. 'false' means: After scanning the
* current backend the next backend is only scanned if no Mixers were found yet.
+ * @return true if any change in the mixers list has been detected.
*/
-void MixerToolBox::updateMixer(TQPtrList<Mixer> &mixers, bool multiDriverMode, TQString& ref_hwInfoString)
+bool MixerToolBox::updateMixer(TQPtrList<Mixer> &mixers, bool multiDriverMode, TQString& ref_hwInfoString)
{
+ bool changesDetected = false;
TQPtrList<Mixer> newMixers;
// Scan for new mixers
initMixer(newMixers, multiDriverMode, ref_hwInfoString);
+tqWarning("MIKE <updateMixer> OLD mixer=%d NEW=%d",mixers.count(),newMixers.count());
// Remove no longer existing mixers
TQPtrList<Mixer> mixersToDeinit;
Mixer *searchMixer = NULL;
@@ -314,13 +312,16 @@ void MixerToolBox::updateMixer(TQPtrList<Mixer> &mixers, bool multiDriverMode, T
}
if (!searchMixer)
{
+ changesDetected = true;
mixers.take();
mixersToDeinit.append(currMixer);
+tqWarning("MIKE <updateMixer> remove mixer=("+currMixer->id()+")="+currMixer->mixerName());
}
currMixer = mixers.next();
}
deinitMixer(mixersToDeinit);
// Add newly found mixers
+ int insertLocation = 0;
searchMixer = newMixers.first();
while (searchMixer)
{
@@ -336,11 +337,16 @@ void MixerToolBox::updateMixer(TQPtrList<Mixer> &mixers, bool multiDriverMode, T
if (!currMixer)
{
// New mixer, append to existing list
+ changesDetected = true;
newMixers.take();
- mixers.append(searchMixer);
+ mixers.insert(insertLocation, searchMixer);
+tqWarning("MIKE <updateMixer> add new mixer=("+searchMixer->id()+")="+searchMixer->mixerName());
}
searchMixer = newMixers.next();
+ ++insertLocation;
}
// Deallocate duplicated mixers
deinitMixer(newMixers);
+
+ return changesDetected;
}
diff --git a/kmix/mixertoolbox.h b/kmix/mixertoolbox.h
index a964e9a..59d8672 100644
--- a/kmix/mixertoolbox.h
+++ b/kmix/mixertoolbox.h
@@ -12,12 +12,13 @@ class Mixer;
* The reason, why it is not put in a common base class is, that the classes are
* very different and cannot be changed (e.g. KPanelApplet) without major headache.
*/
-class MixerToolBox {
- public:
+class MixerToolBox
+{
+ public:
static void initMixer(TQPtrList<Mixer> &mixers, bool multiDriverMode, TQString& ref_hwInfoString);
static void deinitMixer();
static void deinitMixer(TQPtrList<Mixer>&);
- static void updateMixer(TQPtrList<Mixer> &mixers, bool multiDriverMode, TQString& ref_hwInfoString);
+ static bool updateMixer(TQPtrList<Mixer> &mixers, bool multiDriverMode, TQString& ref_hwInfoString);
};