summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp7
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h1
2 files changed, 4 insertions, 4 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 8f34736..adef247 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -43,65 +43,67 @@
43#include <qframe.h> 43#include <qframe.h>
44#include <qlayout.h> 44#include <qlayout.h>
45#include <qdir.h> 45#include <qdir.h>
46#include <stdlib.h> 46#include <stdlib.h>
47#include <stdio.h> 47#include <stdio.h>
48 48
49#include "audiowidget.h" 49#include "audiowidget.h"
50#include "mediaplayerstate.h" 50#include "mediaplayerstate.h"
51#include "playlistwidget.h" 51#include "playlistwidget.h"
52 52
53namespace 53namespace
54{ 54{
55 55
56const int xo = -2; // movable x offset 56const int xo = -2; // movable x offset
57const int yo = 22; // movable y offset 57const int yo = 22; // movable y offset
58 58
59const char * const skin_mask_file_names[10] = { 59const char * const skin_mask_file_names[10] = {
60 "play", "stop", "next", "prev", "up", 60 "play", "stop", "next", "prev", "up",
61 "down", "loop", "playlist", "forward", "back" 61 "down", "loop", "playlist", "forward", "back"
62}; 62};
63 63
64void changeTextColor( QWidget * w) { 64void changeTextColor( QWidget * w) {
65 QPalette p = w->palette(); 65 QPalette p = w->palette();
66 p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); 66 p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) );
67 p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); 67 p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) );
68 w->setPalette( p ); 68 w->setPalette( p );
69} 69}
70 70
71} 71}
72 72
73AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : 73AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) :
74 74
75 MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) { 75 MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ),
76 audioSliderBeingMoved( false )
77{
76 78
77 Button defaultButton; 79 Button defaultButton;
78 defaultButton.isToggle = defaultButton.isHeld = defaultButton.isDown = false; 80 defaultButton.isToggle = defaultButton.isHeld = defaultButton.isDown = false;
79 Button toggleButton; 81 Button toggleButton;
80 toggleButton.isToggle = true; 82 toggleButton.isToggle = true;
81 toggleButton.isHeld = toggleButton.isDown = false; 83 toggleButton.isHeld = toggleButton.isDown = false;
82 84
83 buttons.reserve( 10 ); 85 buttons.reserve( 10 );
84 buttons.push_back( toggleButton ); // play 86 buttons.push_back( toggleButton ); // play
85 buttons.push_back( defaultButton ); // stop 87 buttons.push_back( defaultButton ); // stop
86 buttons.push_back( defaultButton ); // next 88 buttons.push_back( defaultButton ); // next
87 buttons.push_back( defaultButton ); // previous 89 buttons.push_back( defaultButton ); // previous
88 buttons.push_back( defaultButton ); // volume up 90 buttons.push_back( defaultButton ); // volume up
89 buttons.push_back( defaultButton ); // volume down 91 buttons.push_back( defaultButton ); // volume down
90 buttons.push_back( toggleButton ); // repeat/loop 92 buttons.push_back( toggleButton ); // repeat/loop
91 buttons.push_back( defaultButton ); // playlist 93 buttons.push_back( defaultButton ); // playlist
92 buttons.push_back( defaultButton ); // forward 94 buttons.push_back( defaultButton ); // forward
93 buttons.push_back( defaultButton ); // back 95 buttons.push_back( defaultButton ); // back
94 96
95 setCaption( tr("OpiePlayer") ); 97 setCaption( tr("OpiePlayer") );
96 98
97 Config cfg("OpiePlayer"); 99 Config cfg("OpiePlayer");
98 cfg.setGroup("Options"); 100 cfg.setGroup("Options");
99 skin = cfg.readEntry("Skin","default"); 101 skin = cfg.readEntry("Skin","default");
100 //skin = "scaleTest"; 102 //skin = "scaleTest";
101 // color of background, frame, degree of transparency 103 // color of background, frame, degree of transparency
102 104
103 QString skinPath = "opieplayer2/skins/" + skin; 105 QString skinPath = "opieplayer2/skins/" + skin;
104 pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); 106 pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
105 imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); 107 imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) );
106 imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); 108 imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) );
107 109
@@ -203,67 +205,64 @@ QPixmap *maskPixToMask( QPixmap pix, QBitmap mask ) {
203 return pixmap; 205 return pixmap;
204} 206}
205 207
206}; 208};
207 209
208void AudioWidget::resizeEvent( QResizeEvent * ) { 210void AudioWidget::resizeEvent( QResizeEvent * ) {
209 int h = height(); 211 int h = height();
210 int w = width(); 212 int w = width();
211 213
212 songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) ); 214 songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) );
213 slider.setFixedWidth( w - 110 ); 215 slider.setFixedWidth( w - 110 );
214 slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); 216 slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) );
215 slider.setBackgroundOrigin( QWidget::ParentOrigin ); 217 slider.setBackgroundOrigin( QWidget::ParentOrigin );
216 time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); 218 time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) );
217 219
218 upperLeftOfButtonMask.rx() = ( w - imgUp.width() ) / 2; 220 upperLeftOfButtonMask.rx() = ( w - imgUp.width() ) / 2;
219 upperLeftOfButtonMask.ry() = (( h - imgUp.height() ) / 2) - 10; 221 upperLeftOfButtonMask.ry() = (( h - imgUp.height() ) / 2) - 10;
220 QPoint p = upperLeftOfButtonMask; 222 QPoint p = upperLeftOfButtonMask;
221 223
222 QPixmap pixUp = combineImageWithBackground( imgUp, pixBg, p ); 224 QPixmap pixUp = combineImageWithBackground( imgUp, pixBg, p );
223 QPixmap pixDn = combineImageWithBackground( imgDn, pixBg, p ); 225 QPixmap pixDn = combineImageWithBackground( imgDn, pixBg, p );
224 226
225 for ( int i = 0; i < 10; i++ ) { 227 for ( int i = 0; i < 10; i++ ) {
226 if ( !masks[i]->isNull() ) { 228 if ( !masks[i]->isNull() ) {
227 delete buttonPixUp[i]; 229 delete buttonPixUp[i];
228 delete buttonPixDown[i]; 230 delete buttonPixDown[i];
229 buttonPixUp[i] = maskPixToMask( pixUp, *masks[i] ); 231 buttonPixUp[i] = maskPixToMask( pixUp, *masks[i] );
230 buttonPixDown[i] = maskPixToMask( pixDn, *masks[i] ); 232 buttonPixDown[i] = maskPixToMask( pixDn, *masks[i] );
231 } 233 }
232 } 234 }
233} 235}
234 236
235static bool audioSliderBeingMoved = FALSE;
236
237
238void AudioWidget::sliderPressed() { 237void AudioWidget::sliderPressed() {
239 audioSliderBeingMoved = TRUE; 238 audioSliderBeingMoved = TRUE;
240} 239}
241 240
242 241
243void AudioWidget::sliderReleased() { 242void AudioWidget::sliderReleased() {
244 audioSliderBeingMoved = FALSE; 243 audioSliderBeingMoved = FALSE;
245 if ( slider.width() == 0 ) 244 if ( slider.width() == 0 )
246 return; 245 return;
247 long val = long((double)slider.value() * mediaPlayerState.length() / slider.width()); 246 long val = long((double)slider.value() * mediaPlayerState.length() / slider.width());
248 mediaPlayerState.setPosition( val ); 247 mediaPlayerState.setPosition( val );
249} 248}
250 249
251void AudioWidget::setPosition( long i ) { 250void AudioWidget::setPosition( long i ) {
252 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); 251 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i);
253 updateSlider( i, mediaPlayerState.length() ); 252 updateSlider( i, mediaPlayerState.length() );
254} 253}
255 254
256 255
257void AudioWidget::setLength( long max ) { 256void AudioWidget::setLength( long max ) {
258 updateSlider( mediaPlayerState.position(), max ); 257 updateSlider( mediaPlayerState.position(), max );
259} 258}
260 259
261 260
262void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { 261void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) {
263 if ( mediaType == MediaPlayerState::Audio ) { 262 if ( mediaType == MediaPlayerState::Audio ) {
264 // startTimer( 150 ); 263 // startTimer( 150 );
265 showMaximized(); 264 showMaximized();
266 return; 265 return;
267 } 266 }
268 267
269 killTimers(); 268 killTimers();
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h
index 4598d51..8426490 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.h
+++ b/noncore/multimedia/opieplayer2/audiowidget.h
@@ -78,37 +78,38 @@ signals:
78protected: 78protected:
79 void doBlank(); 79 void doBlank();
80 void doUnblank(); 80 void doUnblank();
81 void paintEvent( QPaintEvent *pe ); 81 void paintEvent( QPaintEvent *pe );
82 void showEvent( QShowEvent *se ); 82 void showEvent( QShowEvent *se );
83 void resizeEvent( QResizeEvent *re ); 83 void resizeEvent( QResizeEvent *re );
84 void mouseMoveEvent( QMouseEvent *event ); 84 void mouseMoveEvent( QMouseEvent *event );
85 void mousePressEvent( QMouseEvent *event ); 85 void mousePressEvent( QMouseEvent *event );
86 void mouseReleaseEvent( QMouseEvent *event ); 86 void mouseReleaseEvent( QMouseEvent *event );
87 void timerEvent( QTimerEvent *event ); 87 void timerEvent( QTimerEvent *event );
88 void keyReleaseEvent( QKeyEvent *e); 88 void keyReleaseEvent( QKeyEvent *e);
89private slots: 89private slots:
90 void skipFor(); 90 void skipFor();
91 void skipBack(); 91 void skipBack();
92 void stopSkip(); 92 void stopSkip();
93private: 93private:
94 void setToggleButton( int, bool ); 94 void setToggleButton( int, bool );
95 virtual void paintButton( QPainter &p, int i ); 95 virtual void paintButton( QPainter &p, int i );
96 int skipDirection; 96 int skipDirection;
97 QString skin; 97 QString skin;
98 QPixmap pixBg; 98 QPixmap pixBg;
99 QImage imgUp; 99 QImage imgUp;
100 QImage imgDn; 100 QImage imgDn;
101 QBitmap *masks[10]; 101 QBitmap *masks[10];
102 QPixmap *buttonPixUp[10]; 102 QPixmap *buttonPixUp[10];
103 QPixmap *buttonPixDown[10]; 103 QPixmap *buttonPixDown[10];
104 104
105 QPixmap *pixmaps[4]; 105 QPixmap *pixmaps[4];
106 OTicker songInfo; 106 OTicker songInfo;
107 QSlider slider; 107 QSlider slider;
108 QLineEdit time; 108 QLineEdit time;
109 bool isStreaming : 1; 109 bool isStreaming : 1;
110 bool audioSliderBeingMoved : 1;
110}; 111};
111 112
112 113
113#endif // AUDIO_WIDGET_H 114#endif // AUDIO_WIDGET_H
114 115