summaryrefslogtreecommitdiffstats
path: root/src/app
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2023-10-05 14:42:25 +0900
committerMichele Calgaro <[email protected]>2023-10-06 12:55:12 +0900
commitd1d095a264719caf78a389439bd751f9a044ab8b (patch)
treeed7dd1d96c5398e8b6c728a7c4bac5d1565e9754 /src/app
parentdecb99db2fd2ed41c4605436942f03e3b4f53116 (diff)
downloadcodeine-d1d095a264719caf78a389439bd751f9a044ab8b.tar.gz
codeine-d1d095a264719caf78a389439bd751f9a044ab8b.zip
Fix volume slider functionality and visualization
Signed-off-by: Michele Calgaro <[email protected]> (cherry picked from commit 1884d0e5a2d8269c27b5874a0626810f979e2e92)
Diffstat (limited to 'src/app')
-rw-r--r--src/app/volumeAction.cpp18
-rw-r--r--src/app/xineEngine.cpp3
2 files changed, 17 insertions, 4 deletions
diff --git a/src/app/volumeAction.cpp b/src/app/volumeAction.cpp
index 0c0b81c..1663190 100644
--- a/src/app/volumeAction.cpp
+++ b/src/app/volumeAction.cpp
@@ -31,13 +31,19 @@ public:
slider->setRange( 0, 100 );
setFrameStyle( TQFrame::Plain | TQFrame::Box );
- setSizePolicy( TQSizePolicy::Minimum, TQSizePolicy::Fixed );
+ setSizePolicy( TQSizePolicy::Preferred, TQSizePolicy::Preferred );
+
+ // Calculate width required for max label size
+ label->setText( "100%" );
+ adjustSize();
+ requiredWidth = width();
hide();
}
TQLabel *label;
TQSlider *slider;
+ int requiredWidth;
};
@@ -71,6 +77,10 @@ VolumeAction::toggled( bool const b )
{
DEBUG_BLOCK
+ TQString t = TQString::number(Codeine::engine()->volume()) + "%";
+ setToolTip( i18n( "Volume: %1" ).arg( t ) );
+ m_widget->label->setText( t );
+
m_widget->raise();
m_widget->setShown( b );
}
@@ -80,7 +90,7 @@ VolumeAction::sliderMoved( int v )
{
v = 100 - v; //TQt sliders are wrong way round when vertical
- TQString const t = TQString::number( v ) + '%';
+ TQString t = TQString::number( v ) + '%';
setToolTip( i18n( "Volume: %1" ).arg( t ) );
m_widget->label->setText( t );
@@ -94,8 +104,8 @@ VolumeAction::eventFilter( TQObject *o, TQEvent *e )
case TQEvent::Resize: {
TQWidget const * const &a = m_anchor;
- m_widget->move( a->mapTo( m_widget->parentWidget(), TQPoint( 0, a->height() ) ) );
- m_widget->resize( a->width(), m_widget->sizeHint().height() );
+ m_widget->resize( m_widget->requiredWidth, m_widget->sizeHint().height() );
+ m_widget->move( a->mapTo( m_widget->parentWidget(), TQPoint( a->width() - m_widget->width(), a->height() ) ) );
return false;
}
diff --git a/src/app/xineEngine.cpp b/src/app/xineEngine.cpp
index c57f79e..74f4f35 100644
--- a/src/app/xineEngine.cpp
+++ b/src/app/xineEngine.cpp
@@ -555,7 +555,10 @@ VideoWindow::setStreamParameter( int value )
else if( sender == "aspect_ratio_menu" )
parameter = XINE_PARAM_VO_ASPECT_RATIO;
else if( sender == "volume" )
+ {
parameter = XINE_PARAM_AUDIO_AMP_LEVEL;
+ value = 100 - value; // TQt sliders are wrong way round when vertical
+ }
else
return;