[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdemultimedia/kmix
From: Christian Esken <esken () kde ! org>
Date: 2004-10-01 6:52:06
Message-ID: 20041001065206.52C09126DD () office ! kde ! org
[Download RAW message or body]
CVS commit by esken:
Add readSetFromHWforceUpdate() method: This allows to enforce emitting update signal \
- this is neccesary when reconstructing GUI elements on runtime. This also fixes a \
(yet unknown and unreported) bug with applying prefs dialog, but not changing the \
dock icon prefs.
M +4 -2 kmix.cpp 1.191
M +15 -8 mixer.cpp 1.82
M +4 -3 mixer.h 1.53
--- kdemultimedia/kmix/kmix.cpp #1.190:1.191
@@ -465,11 +465,13 @@ KMixWindow::applyPrefs( KMixPrefDlg *pre
this->setUpdatesEnabled(false);
+ updateDocking();
+
for (KMixerWidget *mw=m_mixerWidgets.first(); mw!=0; mw=m_mixerWidgets.next())
{
mw->setTicks( m_showTicks );
mw->setLabels( m_showLabels );
+ mw->mixer()->readSetFromHWforceUpdate(); // needed, as updateDocking() has \
reconstructed the DockWidget }
- updateDocking();
this->setUpdatesEnabled(false);
--- kdemultimedia/kmix/mixer.cpp #1.81:1.82
@@ -83,6 +83,6 @@ Mixer::Mixer( int device, int card ) : D
m_isOpen = false;
- //_stateMessage = "OK";
_errno = 0;
+ readSetFromHWforceUpdate(); // enforce an initial update on first readSetFromHW()
m_balance = 0;
@@ -244,4 +244,16 @@ MixDevice* Mixer::operator[](int num)
/**
+ * After calling this, readSetFromHW() will do a complete update. This will
+ * trigger emitting the appropriate signals like newVolumeLevels().
+ *
+ * This method is useful, if you need to get a "refresh signal" - used at:
+ * 1) Start of KMix - so that we can be sure an initial signal is emitted
+ * 2) When reconstructing any MixerWidget (e.g. DockIcon after applying preferences)
+ */
+void Mixer::readSetFromHWforceUpdate() const {
+ _readSetFromHWforceUpdate = true;
+}
+
+/**
You can call this to retrieve the freshest information from the mixer HW.
This method is also called regulary by the mixer timer.
@@ -250,9 +262,10 @@ void Mixer::readSetFromHW()
{
bool updated = prepareUpdate();
- if ( ! updated ) {
+ if ( (! updated) && (! _readSetFromHWforceUpdate) ) {
// Some drivers (ALSA) are smart. We don't need to run the following
// time-consuming update loop if there was no change
return;
}
+ _readSetFromHWforceUpdate = false;
MixDevice* md;
for( md = m_mixDevices.first(); md != 0; md = m_mixDevices.next() )
@@ -388,10 +401,4 @@ QString Mixer::errorText(int mixer_error
}
-/*
-QString& Mixer::stateMessage() const {
- const QString &s = _stateMessage;
- return s;
-}
-*/
/**
--- kdemultimedia/kmix/mixer.h #1.52:1.53
@@ -143,4 +142,5 @@ class Mixer : public QObject, virtual pu
virtual int writeVolumeToHW( int devnum, Volume &volume ) = 0;
virtual void readSetFromHW();
+ void readSetFromHWforceUpdate() const;
virtual void setRecordSource( int deviceidx, bool on );
@@ -175,6 +175,4 @@ class Mixer : public QObject, virtual pu
bool m_isOpen;
int m_balance; // from -100 (just left) to 100 (just right)
- // The state of the driver (Mixer_* backends should change it after an \
initialization error)
- //QString _stateMessage;
int _errno;
@@ -186,4 +184,7 @@ class Mixer : public QObject, virtual pu
public:
int setupMixer( MixSet set );
+
+ private:
+ mutable bool _readSetFromHWforceUpdate;
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic