|
|
|
@ -41,7 +41,7 @@
|
|
|
|
|
#include <tdepopupmenu.h>
|
|
|
|
|
#include <kstandarddirs.h>
|
|
|
|
|
|
|
|
|
|
Amarok::Slider::Slider( Qt::Orientation orientation, TQWidget *parent, uint max )
|
|
|
|
|
Amarok::Slider::Slider( TQt::Orientation orientation, TQWidget *parent, uint max )
|
|
|
|
|
: TQSlider( orientation, parent )
|
|
|
|
|
, m_sliding( false )
|
|
|
|
|
, m_outside( false )
|
|
|
|
@ -53,7 +53,7 @@ Amarok::Slider::Slider( Qt::Orientation orientation, TQWidget *parent, uint max
|
|
|
|
|
void
|
|
|
|
|
Amarok::Slider::wheelEvent( TQWheelEvent *e )
|
|
|
|
|
{
|
|
|
|
|
if( orientation() == Qt::Vertical ) {
|
|
|
|
|
if( orientation() == TQt::Vertical ) {
|
|
|
|
|
// Will be handled by the parent widget
|
|
|
|
|
e->ignore();
|
|
|
|
|
return;
|
|
|
|
@ -78,7 +78,7 @@ Amarok::Slider::mouseMoveEvent( TQMouseEvent *e )
|
|
|
|
|
//feels better, but using set value of 20 is bad of course
|
|
|
|
|
TQRect rect( -20, -20, width()+40, height()+40 );
|
|
|
|
|
|
|
|
|
|
if ( orientation() == Qt::Horizontal && !rect.contains( e->pos() ) ) {
|
|
|
|
|
if ( orientation() == TQt::Horizontal && !rect.contains( e->pos() ) ) {
|
|
|
|
|
if ( !m_outside )
|
|
|
|
|
TQSlider::setValue( m_prevValue );
|
|
|
|
|
m_outside = true;
|
|
|
|
@ -94,7 +94,7 @@ Amarok::Slider::mouseMoveEvent( TQMouseEvent *e )
|
|
|
|
|
void
|
|
|
|
|
Amarok::Slider::slideEvent( TQMouseEvent *e )
|
|
|
|
|
{
|
|
|
|
|
TQSlider::setValue( orientation() == Qt::Horizontal
|
|
|
|
|
TQSlider::setValue( orientation() == TQt::Horizontal
|
|
|
|
|
? ((TQApplication::reverseLayout())
|
|
|
|
|
? TQRangeControl::valueFromPosition( width() - (e->pos().x() - sliderRect().width()/2), width() + sliderRect().width() )
|
|
|
|
|
: TQRangeControl::valueFromPosition( e->pos().x() - sliderRect().width()/2, width() - sliderRect().width() ) )
|
|
|
|
@ -140,7 +140,7 @@ Amarok::Slider::setValue( int newValue )
|
|
|
|
|
#define THICKNESS 7
|
|
|
|
|
#define MARGIN 3
|
|
|
|
|
|
|
|
|
|
Amarok::PrettySlider::PrettySlider( Qt::Orientation orientation, SliderMode mode,
|
|
|
|
|
Amarok::PrettySlider::PrettySlider( TQt::Orientation orientation, SliderMode mode,
|
|
|
|
|
TQWidget *parent, uint max )
|
|
|
|
|
: Amarok::Slider( orientation, parent, max )
|
|
|
|
|
, m_mode( mode )
|
|
|
|
@ -175,7 +175,7 @@ void
|
|
|
|
|
Amarok::PrettySlider::slideEvent( TQMouseEvent *e )
|
|
|
|
|
{
|
|
|
|
|
if( m_mode == Pretty || m_showingMoodbar )
|
|
|
|
|
TQSlider::setValue( orientation() == Qt::Horizontal
|
|
|
|
|
TQSlider::setValue( orientation() == TQt::Horizontal
|
|
|
|
|
? TQRangeControl::valueFromPosition( e->pos().x(), width()-2 )
|
|
|
|
|
: TQRangeControl::valueFromPosition( e->pos().y(), height()-2 ) );
|
|
|
|
|
else
|
|
|
|
@ -192,7 +192,7 @@ namespace Amarok {
|
|
|
|
|
void
|
|
|
|
|
Amarok::PrettySlider::paintEvent( TQPaintEvent *e )
|
|
|
|
|
{
|
|
|
|
|
const int w = orientation() == Qt::Horizontal ? width() : height();
|
|
|
|
|
const int w = orientation() == TQt::Horizontal ? width() : height();
|
|
|
|
|
const int pos = int( double( w-2 ) / maxValue() * Slider::value() );
|
|
|
|
|
int h = THICKNESS;
|
|
|
|
|
|
|
|
|
@ -203,7 +203,7 @@ Amarok::PrettySlider::paintEvent( TQPaintEvent *e )
|
|
|
|
|
if( m_showingMoodbar )
|
|
|
|
|
{
|
|
|
|
|
if( m_mode == Normal )
|
|
|
|
|
h = (orientation() == Qt::Vertical ? width() : height()) - 2*MARGIN;
|
|
|
|
|
h = (orientation() == TQt::Vertical ? width() : height()) - 2*MARGIN;
|
|
|
|
|
mood = m_bundle.moodbar().draw( w, h );
|
|
|
|
|
}
|
|
|
|
|
// If we're a Normal PrettySlider and we have no moodbar,
|
|
|
|
@ -219,7 +219,7 @@ Amarok::PrettySlider::paintEvent( TQPaintEvent *e )
|
|
|
|
|
|
|
|
|
|
buf.fill( parentWidget()->backgroundColor() );
|
|
|
|
|
|
|
|
|
|
if ( orientation() == Qt::Vertical )
|
|
|
|
|
if ( orientation() == TQt::Vertical )
|
|
|
|
|
{
|
|
|
|
|
p.translate( 0, height()-1 );
|
|
|
|
|
p.rotate( -90 ); //90 degrees clockwise
|
|
|
|
@ -351,7 +351,7 @@ Amarok::PrettySlider::sizeHint() const
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
Amarok::VolumeSlider::VolumeSlider( TQWidget *parent, uint max )
|
|
|
|
|
: Amarok::Slider( Qt::Horizontal, parent, max )
|
|
|
|
|
: Amarok::Slider( TQt::Horizontal, parent, max )
|
|
|
|
|
, m_animCount( 0 )
|
|
|
|
|
, m_animTimer( new TQTimer( this ) )
|
|
|
|
|
, m_pixmapInset( TQPixmap( locate( "data","amarok/images/volumeslider-inset.png" ) ) )
|
|
|
|
@ -420,7 +420,7 @@ Amarok::VolumeSlider::slotAnimTimer() //SLOT
|
|
|
|
|
void
|
|
|
|
|
Amarok::VolumeSlider::mousePressEvent( TQMouseEvent *e )
|
|
|
|
|
{
|
|
|
|
|
if( e->button() != Qt::RightButton ) {
|
|
|
|
|
if( e->button() != TQt::RightButton ) {
|
|
|
|
|
Amarok::Slider::mousePressEvent( e );
|
|
|
|
|
slideEvent( e );
|
|
|
|
|
}
|
|
|
|
|