SVN commit 1246243 by esken: Add constant for volume control pageStep (VOLUME_PAGESTEP_DIVISOR) Implement smart-unmute for DockIcon Cleanups M +1 -1 core/mixer.cpp M +2 -1 core/mixer.h M +12 -14 gui/kmixdockwidget.cpp M +7 -26 gui/mdwslider.cpp M +1 -1 gui/mdwslider.h --- trunk/KDE/kdemultimedia/kmix/core/mixer.cpp #1246242:1246243 @@ -39,8 +39,8 @@ MasterControl Mixer::_globalMasterCurrent; MasterControl Mixer::_globalMasterPreferred; float Mixer::VOLUME_STEP_DIVISOR = 20; +float Mixer::VOLUME_PAGESTEP_DIVISOR = 10; - int Mixer::numDrivers() { MixerFactory *factory = g_mixerFactories; --- trunk/KDE/kdemultimedia/kmix/core/mixer.h #1246242:1246243 @@ -158,7 +158,8 @@ /// get the actual MixSet MixSet getMixSet(); - static float VOLUME_STEP_DIVISOR; + static float VOLUME_STEP_DIVISOR; // The divisor for defining volume control steps (for mouse-wheel, DBUS and Normal step for Sliders ) + static float VOLUME_PAGESTEP_DIVISOR; // The divisor for defining volume control steps (page-step for sliders) /// DBUS oriented methods virtual void increaseVolume( const QString& mixdeviceID ); --- trunk/KDE/kdemultimedia/kmix/gui/kmixdockwidget.cpp #1246242:1246243 @@ -86,8 +86,8 @@ } #ifdef _GNU_SOURCE -// TODO minimizeRestore usage is currently VERY broken -#warning minimizeRestore usage is currently VERY broken in KMIx. This must be fixed before doing a release. +// TODO minimizeRestore usage is currently a bit broken. It only works by chance +#warning minimizeRestore usage is currently slightly broken in KMIx. This should be fixed before doing a release. #endif if (_volumePopup) { @@ -394,25 +394,23 @@ if ( inc < 1 ) inc = 1; long int cv = inc * (delta / 120 ); - kDebug() << "twe: " << cv << " : " << vol; - vol.changeAllVolumes(cv); - kDebug() << "twe: " << cv << " : " << vol; -/* for ( int i = 0; i < vol.count(); i++ ) { - int newVal = vol[i] + (inc * (delta / 120)); - if( newVal < 0 ) newVal = 0; - vol.setVolume( (Volume::ChannelID)i, newVal < vol.maxVolume() ? newVal : vol.maxVolume() ); +// kDebug() << "twe: " << cv << " : " << vol; + if ( cv > 0 && md->isMuted()) + { // increasing form muted state: unmute and start with a low volume level + md->setMuted(false); + vol.setAllVolumes(cv); } - */ + else + vol.changeAllVolumes(cv); +// kDebug() << "twe: " << cv << " : " << vol; + if ( _playBeepOnVolumeChange ) { QString fileName("KDE_Beep_Digital_1.ogg"); _audioPlayer->setCurrentSource(fileName); _audioPlayer->play(); } -/* if ( md->playbackVolume().hasVolume() ) - md->playbackVolume().setVolume(vol); - else - md->captureVolume().setVolume(vol);;*/ + md->mixer()->commitVolumeChange(md); setVolumeTip(); } --- trunk/KDE/kdemultimedia/kmix/gui/mdwslider.cpp #1246242:1246243 @@ -331,9 +331,9 @@ if ( hasVolumeSliders ) { if ( wantsPlaybackSliders ) - addSliders( volLayout, 'p', bothCaptureANDPlaybackExist ); + addSliders( volLayout, 'p', bothCaptureANDPlaybackExist, m_mixdevice->playbackVolume(), m_slidersPlayback); if ( wantsCaptureSliders ) - addSliders( volLayout, 'c', bothCaptureANDPlaybackExist ); + addSliders( volLayout, 'c', bothCaptureANDPlaybackExist, m_mixdevice->captureVolume() , m_slidersCapture ); if ( wantsMediaControls ) addMediaControls( volLayout ); // Please note that the addmediaControls() is in the hasVolumeSliders check onyl because it was easier to integrate controlLayout->addSpacing( 3 ); @@ -434,9 +434,9 @@ if ( hasVolumeSliders ) { if ( wantsPlaybackSliders && m_mixdevice->playbackVolume().count() > 0 ) - addSliders( volLayout, 'p', false ); + addSliders( volLayout, 'p', false, m_mixdevice->playbackVolume(), m_slidersPlayback ); if ( wantsCaptureSliders && m_mixdevice->captureVolume().count() > 0 ) - addSliders( volLayout, 'c', bothCaptureANDPlaybackExist ); + addSliders( volLayout, 'c', bothCaptureANDPlaybackExist, m_mixdevice->captureVolume() , m_slidersCapture ); if ( wantsMediaControls ) addMediaControls( volLayout ); } @@ -512,40 +512,21 @@ void MDWSlider::mediaPrev(bool) { - kDebug() << "ZZZZZZZ"; mixDevice()->mediaPrev(); } void MDWSlider::mediaNext(bool) { - kDebug() << "ZZZZZZZ"; mixDevice()->mediaNext(); } void MDWSlider::mediaPlay(bool) { - kDebug() << "ZZZZZZZ"; mixDevice()->mediaPlay(); } -void MDWSlider::addSliders( QBoxLayout *volLayout, char type, bool forceCaptureLabel) +void MDWSlider::addSliders( QBoxLayout *volLayout, char type, bool forceCaptureLabel, Volume& vol, QList& ref_sliders) { - Volume* volP; - QList* ref_slidersP; - - if ( type == 'c' ) { // capture - volP = &m_mixdevice->captureVolume(); - ref_slidersP = &m_slidersCapture; - } - else { // playback - - volP = &m_mixdevice->playbackVolume(); - ref_slidersP = &m_slidersPlayback; - } - - Volume& vol = *volP; - QList& ref_sliders = *ref_slidersP; - LabelType labelType = LT_NONE; if ( vol.count() >= 2 && ! isStereoLinked() ) @@ -594,14 +575,14 @@ QAbstractSlider* slider; if ( m_small ) { - slider = new KSmallSlider( minvol, maxvol, (maxvol-minvol)/10, // @todo !! User definable steps + slider = new KSmallSlider( minvol, maxvol, (maxvol-minvol) / Mixer::VOLUME_PAGESTEP_DIVISOR, vol.getVolume( vc.chid ), _orientation, this ); } // small else { slider = new VolumeSlider( _orientation, this ); slider->setMinimum(0); slider->setMaximum(maxvol); - slider->setPageStep(maxvol/10); + slider->setPageStep(maxvol / Mixer::VOLUME_PAGESTEP_DIVISOR); slider->setValue( maxvol - vol.getVolume( vc.chid ) ); extraData(slider).setSubcontrolLabel(subcontrolLabel); --- trunk/KDE/kdemultimedia/kmix/gui/mdwslider.h #1246242:1246243 @@ -129,7 +129,7 @@ void setIcon( QString iconname ); QPixmap loadIcon( QString filename ); void createWidgets( bool showMuteLED, bool showCaptureLED ); - void addSliders( QBoxLayout *volLayout, char type, bool addLabel); + void addSliders( QBoxLayout *volLayout, char type, bool addLabel, Volume& vol, QList& ref_sliders); //void addDefaultLabel(QBoxLayout *layout, Qt::Orientation orientation); // Methods that are called two times from a wrapper. Once for playabck, once for capture