summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/audiowidget.cpp
Unidiff
Diffstat (limited to 'noncore/multimedia/opieplayer2/audiowidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp10
1 files changed, 1 insertions, 9 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 1b0de5d..125fd72 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -46,54 +46,49 @@ void Ticker::timerEvent( QTimerEvent * ) {
46 46
47void Ticker::drawContents( QPainter *p ) { 47void Ticker::drawContents( QPainter *p ) {
48 QPixmap pm( width(), height() ); 48 QPixmap pm( width(), height() );
49 pm.fill( colorGroup().base() ); 49 pm.fill( colorGroup().base() );
50 QPainter pmp( &pm ); 50 QPainter pmp( &pm );
51 for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) { 51 for ( int i = 0; i - pos < width() && (i < 1 || pixelLen > width()); i += pixelLen ) {
52 pmp.drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText ); 52 pmp.drawText( i - pos, 0, INT_MAX, height(), AlignVCenter, scrollText );
53 } 53 }
54 p->drawPixmap( 0, 0, pm ); 54 p->drawPixmap( 0, 0, pm );
55} 55}
56 56
57 57
58
59
60struct MediaButton { 58struct MediaButton {
61 int xPos, yPos; 59 int xPos, yPos;
62 int color; 60 int color;
63 bool isToggle, isBig, isHeld, isDown; 61 bool isToggle, isBig, isHeld, isDown;
64}; 62};
65 63
66 64
67
68
69// Layout information for the audioButtons (and if it is a toggle button or not) 65// Layout information for the audioButtons (and if it is a toggle button or not)
70MediaButton audioButtons[] = { 66MediaButton audioButtons[] = {
71 { 3*30-15+xo, 3*30-13+yo, 0, TRUE, TRUE, FALSE, FALSE }, // play 67 { 3*30-15+xo, 3*30-13+yo, 0, TRUE, TRUE, FALSE, FALSE }, // play
72 { 1*30+xo, 5*30+yo, 2, FALSE, FALSE, FALSE, FALSE }, // stop 68 { 1*30+xo, 5*30+yo, 2, FALSE, FALSE, FALSE, FALSE }, // stop
73 { 5*30+xo, 5*30+yo, 2, TRUE, FALSE, FALSE, FALSE }, // pause 69 { 5*30+xo, 5*30+yo, 2, TRUE, FALSE, FALSE, FALSE }, // pause
74 { 6*30-5+xo, 3*30+yo, 1, FALSE, FALSE, FALSE, FALSE }, // next 70 { 6*30-5+xo, 3*30+yo, 1, FALSE, FALSE, FALSE, FALSE }, // next
75 { 0*30+5+xo, 3*30+yo, 1, FALSE, FALSE, FALSE, FALSE }, // previous 71 { 0*30+5+xo, 3*30+yo, 1, FALSE, FALSE, FALSE, FALSE }, // previous
76 { 3*30+xo, 0*30+5+yo, 3, FALSE, FALSE, FALSE, FALSE }, // volume up 72 { 3*30+xo, 0*30+5+yo, 3, FALSE, FALSE, FALSE, FALSE }, // volume up
77 { 3*30+xo, 6*30-5+yo, 3, FALSE, FALSE, FALSE, FALSE }, // volume down 73 { 3*30+xo, 6*30-5+yo, 3, FALSE, FALSE, FALSE, FALSE }, // volume down
78 { 5*30+xo, 1*30+yo, 0, TRUE, FALSE, FALSE, FALSE }, // repeat/loop 74 { 5*30+xo, 1*30+yo, 0, TRUE, FALSE, FALSE, FALSE }, // repeat/loop
79 { 1*30+xo, 1*30+yo, 0, FALSE, FALSE, FALSE, FALSE } // playlist 75 { 1*30+xo, 1*30+yo, 0, FALSE, FALSE, FALSE, FALSE } // playlist
80}; 76};
81 77
82static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); 78static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton));
83 79
84 80
85AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : 81AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
86 QWidget( parent, name, f ) 82 QWidget( parent, name, f ) {
87{
88 setCaption( tr("OpiePlayer - Audio") ); 83 setCaption( tr("OpiePlayer - Audio") );
89 Config cfg("OpiePlayer"); 84 Config cfg("OpiePlayer");
90 cfg.setGroup("AudioWidget"); 85 cfg.setGroup("AudioWidget");
91 86
92 QString backgroundPix, buttonsAllPix, buttonsBigPix, controlsPix, animatedPix; 87 QString backgroundPix, buttonsAllPix, buttonsBigPix, controlsPix, animatedPix;
93 backgroundPix=cfg.readEntry( " backgroundPix", "opieplayer/metalFinish"); 88 backgroundPix=cfg.readEntry( " backgroundPix", "opieplayer/metalFinish");
94 buttonsAllPix=cfg.readEntry( "buttonsAllPix","opieplayer/mediaButtonsAll"); 89 buttonsAllPix=cfg.readEntry( "buttonsAllPix","opieplayer/mediaButtonsAll");
95 buttonsBigPix=cfg.readEntry( "buttonsBigPix","opieplayer/mediaButtonsBig"); 90 buttonsBigPix=cfg.readEntry( "buttonsBigPix","opieplayer/mediaButtonsBig");
96 controlsPix=cfg.readEntry( "controlsPix","opieplayer/mediaControls"); 91 controlsPix=cfg.readEntry( "controlsPix","opieplayer/mediaControls");
97 92
98 setBackgroundPixmap( Resource::loadPixmap( backgroundPix) ); 93 setBackgroundPixmap( Resource::loadPixmap( backgroundPix) );
99 pixmaps[0] = new QPixmap( Resource::loadPixmap( buttonsAllPix ) ); 94 pixmaps[0] = new QPixmap( Resource::loadPixmap( buttonsAllPix ) );
@@ -118,28 +113,26 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
118 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); 113 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) );
119 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); 114 connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) );
120 connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); 115 connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) );
121 connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); 116 connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) );
122 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); 117 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
123 118
124 // Intialise state 119 // Intialise state
125 setLength( mediaPlayerState->length() ); 120 setLength( mediaPlayerState->length() );
126 setPosition( mediaPlayerState->position() ); 121 setPosition( mediaPlayerState->position() );
127 setLooping( mediaPlayerState->fullscreen() ); 122 setLooping( mediaPlayerState->fullscreen() );
128 setPaused( mediaPlayerState->paused() ); 123 setPaused( mediaPlayerState->paused() );
129 setPlaying( mediaPlayerState->playing() ); 124 setPlaying( mediaPlayerState->playing() );
130
131} 125}
132 126
133
134AudioWidget::~AudioWidget() { 127AudioWidget::~AudioWidget() {
135 mediaPlayerState->isStreaming = FALSE; 128 mediaPlayerState->isStreaming = FALSE;
136 for ( int i = 0; i < 3; i++ ) { 129 for ( int i = 0; i < 3; i++ ) {
137 delete pixmaps[i]; 130 delete pixmaps[i];
138 } 131 }
139} 132}
140 133
141 134
142static bool audioSliderBeingMoved = FALSE; 135static bool audioSliderBeingMoved = FALSE;
143 136
144 137
145void AudioWidget::sliderPressed() { 138void AudioWidget::sliderPressed() {
@@ -147,25 +140,24 @@ void AudioWidget::sliderPressed() {
147} 140}
148 141
149 142
150void AudioWidget::sliderReleased() { 143void AudioWidget::sliderReleased() {
151 audioSliderBeingMoved = FALSE; 144 audioSliderBeingMoved = FALSE;
152 if ( slider->width() == 0 ) { 145 if ( slider->width() == 0 ) {
153 return; 146 return;
154 } 147 }
155 long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); 148 long val = long((double)slider->value() * mediaPlayerState->length() / slider->width());
156 mediaPlayerState->setPosition( val ); 149 mediaPlayerState->setPosition( val );
157} 150}
158 151
159
160void AudioWidget::setPosition( long i ) { 152void AudioWidget::setPosition( long i ) {
161 // qDebug("set position %d",i); 153 // qDebug("set position %d",i);
162 updateSlider( i, mediaPlayerState->length() ); 154 updateSlider( i, mediaPlayerState->length() );
163} 155}
164 156
165 157
166void AudioWidget::setLength( long max ) { 158void AudioWidget::setLength( long max ) {
167 updateSlider( mediaPlayerState->position(), max ); 159 updateSlider( mediaPlayerState->position(), max );
168} 160}
169 161
170 162
171void AudioWidget::setView( char view ) { 163void AudioWidget::setView( char view ) {