diff options
author | mio <[email protected]> | 2024-11-24 17:21:35 +1000 |
---|---|---|
committer | mio <[email protected]> | 2024-12-07 13:14:51 +1000 |
commit | 673f35da4c96122fda0f69514bce1fced1ca6b4e (patch) | |
tree | 46d0614e52f3d4791dfbd8112208c590d55c9560 /src/app/volumeAction.cpp | |
parent | 2ae198284fb1baddcdd64820d705258a2bceda5d (diff) | |
download | codeine-673f35da4c96122fda0f69514bce1fced1ca6b4e.tar.gz codeine-673f35da4c96122fda0f69514bce1fced1ca6b4e.zip |
Fix mouse events not changing volume
Using the scroll wheel over the volume slider would not change the
volume, neither would dragging the slider (until released) or clicking
on the slider.
This patch fixes the above.
See: TDE/codeine#5
Signed-off-by: mio <[email protected]>
(cherry picked from commit 14b52b5a467e1c5be5ecc9d54c252d787294df3c)
Diffstat (limited to 'src/app/volumeAction.cpp')
-rw-r--r-- | src/app/volumeAction.cpp | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/app/volumeAction.cpp b/src/app/volumeAction.cpp index ad585ef..b628ba1 100644 --- a/src/app/volumeAction.cpp +++ b/src/app/volumeAction.cpp @@ -54,9 +54,8 @@ VolumeAction::VolumeAction( TDEToolBar *bar, TDEActionCollection *ac ) m_widget = new VolumeSlider( bar->topLevelWidget() ); connect( this, TQ_SIGNAL(toggled( bool )), TQ_SLOT(toggled( bool )) ); - connect( m_widget->slider, TQ_SIGNAL(sliderMoved( int )), TQ_SLOT(sliderMoved( int )) ); - connect( m_widget->slider, TQ_SIGNAL(sliderMoved( int )), Codeine::engine(), TQ_SLOT(setStreamParameter( int )) ); - connect( m_widget->slider, TQ_SIGNAL(sliderReleased()), TQ_SLOT(sliderReleased()) ); + connect(m_widget->slider, TQ_SIGNAL(valueChanged(int)), Codeine::engine(), TQ_SLOT(setStreamParameter(int))); + connect(m_widget->slider, TQ_SIGNAL(valueChanged(int)), TQ_SLOT(sliderMoved(int))); } int @@ -75,25 +74,28 @@ VolumeAction::plug( TQWidget *bar, int index ) void VolumeAction::toggled( bool const b ) { - DEBUG_BLOCK - - TQString t = TQString::number(100 - m_widget->slider->value()) + "%"; - setToolTip( i18n( "Volume: %1" ).arg( t ) ); - m_widget->label->setText( t ); - m_widget->raise(); m_widget->setShown( b ); } void -VolumeAction::sliderMoved( int v ) +VolumeAction::sliderMoved(int v) { - v = 100 - v; //TQt sliders are wrong way round when vertical + // TQt sliders are wrong way round when vertical + v = 100 - v; - TQString t = TQString::number( v ) + '%'; + auto vol = TQString("%1%").arg(v); + m_widget->label->setText(vol); + setToolTip(i18n("Volume %1").arg(vol)); +} + +void +VolumeAction::setVolume(int volume) +{ + TQString vol = TQString("%1%").arg(volume); - setToolTip( i18n( "Volume: %1" ).arg( t ) ); - m_widget->label->setText( t ); + // TQt sliders are the wrong way round when vertical. + m_widget->slider->setValue(100 - volume); } bool |