-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 6 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 4 |
3 files changed, 7 insertions, 7 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 3b33209..6e9c14a 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -67,49 +67,49 @@ const MediaWidget::SkinButtonInfo skinInfo[] = | |||
67 | { MediaWidget::Loop, "loop", MediaWidget::ToggleButton }, | 67 | { MediaWidget::Loop, "loop", MediaWidget::ToggleButton }, |
68 | { MediaWidget::PlayList, "playlist", MediaWidget::NormalButton }, | 68 | { MediaWidget::PlayList, "playlist", MediaWidget::NormalButton }, |
69 | { MediaWidget::Forward, "forward", MediaWidget::NormalButton }, | 69 | { MediaWidget::Forward, "forward", MediaWidget::NormalButton }, |
70 | { MediaWidget::Back, "back", MediaWidget::NormalButton } | 70 | { MediaWidget::Back, "back", MediaWidget::NormalButton } |
71 | }; | 71 | }; |
72 | 72 | ||
73 | const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] ); | 73 | const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] ); |
74 | 74 | ||
75 | void changeTextColor( QWidget * w) { | 75 | void changeTextColor( QWidget * w) { |
76 | QPalette p = w->palette(); | 76 | QPalette p = w->palette(); |
77 | p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); | 77 | p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); |
78 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); | 78 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); |
79 | w->setPalette( p ); | 79 | w->setPalette( p ); |
80 | } | 80 | } |
81 | 81 | ||
82 | } | 82 | } |
83 | 83 | ||
84 | AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : | 84 | AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : |
85 | 85 | ||
86 | MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ), | 86 | MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ), |
87 | audioSliderBeingMoved( false ) | 87 | audioSliderBeingMoved( false ) |
88 | { | 88 | { |
89 | for ( uint i = 0; i < buttonCount; ++i ) { | 89 | for ( uint i = 0; i < buttonCount; ++i ) { |
90 | Button button; | 90 | Button button; |
91 | button.buttonType = skinInfo[ i ].buttonType; | 91 | button.type = skinInfo[ i ].type; |
92 | buttons.push_back( button ); | 92 | buttons.push_back( button ); |
93 | } | 93 | } |
94 | 94 | ||
95 | setCaption( tr("OpiePlayer") ); | 95 | setCaption( tr("OpiePlayer") ); |
96 | 96 | ||
97 | Config cfg("OpiePlayer"); | 97 | Config cfg("OpiePlayer"); |
98 | cfg.setGroup("Options"); | 98 | cfg.setGroup("Options"); |
99 | skin = cfg.readEntry("Skin","default"); | 99 | skin = cfg.readEntry("Skin","default"); |
100 | //skin = "scaleTest"; | 100 | //skin = "scaleTest"; |
101 | // color of background, frame, degree of transparency | 101 | // color of background, frame, degree of transparency |
102 | 102 | ||
103 | QString skinPath = "opieplayer2/skins/" + skin; | 103 | QString skinPath = "opieplayer2/skins/" + skin; |
104 | pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | 104 | pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
105 | imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); | 105 | imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); |
106 | imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); | 106 | imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); |
107 | 107 | ||
108 | buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); | 108 | buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); |
109 | buttonMask.fill( 0 ); | 109 | buttonMask.fill( 0 ); |
110 | 110 | ||
111 | masks.reserve( buttonCount ); | 111 | masks.reserve( buttonCount ); |
112 | 112 | ||
113 | for ( uint i = 0; i < masks.capacity(); i++ ) { | 113 | for ( uint i = 0; i < masks.capacity(); i++ ) { |
114 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skinInfo[i].fileName + ".png" ); | 114 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skinInfo[i].fileName + ".png" ); |
115 | masks.push_back( QBitmap( filename ) ); | 115 | masks.push_back( QBitmap( filename ) ); |
@@ -366,49 +366,49 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
366 | if ( isOnButton && !buttons[i].isHeld ) { | 366 | if ( isOnButton && !buttons[i].isHeld ) { |
367 | buttons[i].isHeld = TRUE; | 367 | buttons[i].isHeld = TRUE; |
368 | toggleButton(i); | 368 | toggleButton(i); |
369 | switch (i) { | 369 | switch (i) { |
370 | case VolumeUp: | 370 | case VolumeUp: |
371 | emit moreClicked(); | 371 | emit moreClicked(); |
372 | return; | 372 | return; |
373 | case VolumeDown: | 373 | case VolumeDown: |
374 | emit lessClicked(); | 374 | emit lessClicked(); |
375 | return; | 375 | return; |
376 | case Forward: | 376 | case Forward: |
377 | emit forwardClicked(); | 377 | emit forwardClicked(); |
378 | return; | 378 | return; |
379 | case Back: | 379 | case Back: |
380 | emit backClicked(); | 380 | emit backClicked(); |
381 | return; | 381 | return; |
382 | } | 382 | } |
383 | } else if ( !isOnButton && buttons[i].isHeld ) { | 383 | } else if ( !isOnButton && buttons[i].isHeld ) { |
384 | buttons[i].isHeld = FALSE; | 384 | buttons[i].isHeld = FALSE; |
385 | toggleButton(i); | 385 | toggleButton(i); |
386 | } | 386 | } |
387 | } else { | 387 | } else { |
388 | if ( buttons[i].isHeld ) { | 388 | if ( buttons[i].isHeld ) { |
389 | buttons[i].isHeld = FALSE; | 389 | buttons[i].isHeld = FALSE; |
390 | if ( buttons[i].buttonType != ToggleButton ) { | 390 | if ( buttons[i].type != ToggleButton ) { |
391 | setToggleButton( i, FALSE ); | 391 | setToggleButton( i, FALSE ); |
392 | } | 392 | } |
393 | qDebug("mouseEvent %d", i); | 393 | qDebug("mouseEvent %d", i); |
394 | handleCommand( static_cast<Command>( i ), buttons[ i ].isDown ); | 394 | handleCommand( static_cast<Command>( i ), buttons[ i ].isDown ); |
395 | } | 395 | } |
396 | } | 396 | } |
397 | } | 397 | } |
398 | } | 398 | } |
399 | 399 | ||
400 | 400 | ||
401 | void AudioWidget::mousePressEvent( QMouseEvent *event ) { | 401 | void AudioWidget::mousePressEvent( QMouseEvent *event ) { |
402 | mouseMoveEvent( event ); | 402 | mouseMoveEvent( event ); |
403 | } | 403 | } |
404 | 404 | ||
405 | 405 | ||
406 | void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) { | 406 | void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) { |
407 | mouseMoveEvent( event ); | 407 | mouseMoveEvent( event ); |
408 | } | 408 | } |
409 | 409 | ||
410 | 410 | ||
411 | void AudioWidget::showEvent( QShowEvent* ) { | 411 | void AudioWidget::showEvent( QShowEvent* ) { |
412 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); | 412 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); |
413 | mouseMoveEvent( &event ); | 413 | mouseMoveEvent( &event ); |
414 | } | 414 | } |
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h index e0f2cf1..9fb3499 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.h +++ b/noncore/multimedia/opieplayer2/mediawidget.h | |||
@@ -18,61 +18,61 @@ | |||
18 | along with this library; see the file COPYING.LIB. If not, write to | 18 | along with this library; see the file COPYING.LIB. If not, write to |
19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 19 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
20 | Boston, MA 02111-1307, USA. | 20 | Boston, MA 02111-1307, USA. |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #ifndef MEDIAWIDGET_H | 23 | #ifndef MEDIAWIDGET_H |
24 | #define MEDIAWIDGET_H | 24 | #define MEDIAWIDGET_H |
25 | 25 | ||
26 | #include <qwidget.h> | 26 | #include <qwidget.h> |
27 | 27 | ||
28 | #include "mediaplayerstate.h" | 28 | #include "mediaplayerstate.h" |
29 | #include "playlistwidget.h" | 29 | #include "playlistwidget.h" |
30 | 30 | ||
31 | #include <vector> | 31 | #include <vector> |
32 | 32 | ||
33 | class MediaWidget : public QWidget | 33 | class MediaWidget : public QWidget |
34 | { | 34 | { |
35 | Q_OBJECT | 35 | Q_OBJECT |
36 | public: | 36 | public: |
37 | enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back }; | 37 | enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back }; |
38 | enum ButtonType { NormalButton, ToggleButton }; | 38 | enum ButtonType { NormalButton, ToggleButton }; |
39 | 39 | ||
40 | struct Button | 40 | struct Button |
41 | { | 41 | { |
42 | Button() : buttonType( NormalButton ), isHeld( false ), isDown( false ) {} | 42 | Button() : type( NormalButton ), isHeld( false ), isDown( false ) {} |
43 | 43 | ||
44 | ButtonType buttonType : 1; | 44 | ButtonType type : 1; |
45 | bool isHeld : 1; | 45 | bool isHeld : 1; |
46 | bool isDown : 1; | 46 | bool isDown : 1; |
47 | }; | 47 | }; |
48 | typedef std::vector<Button> ButtonVector; | 48 | typedef std::vector<Button> ButtonVector; |
49 | 49 | ||
50 | struct SkinButtonInfo | 50 | struct SkinButtonInfo |
51 | { | 51 | { |
52 | Command command; | 52 | Command command; |
53 | const char *fileName; | 53 | const char *fileName; |
54 | ButtonType buttonType; | 54 | ButtonType type; |
55 | }; | 55 | }; |
56 | 56 | ||
57 | MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); | 57 | MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); |
58 | virtual ~MediaWidget(); | 58 | virtual ~MediaWidget(); |
59 | 59 | ||
60 | public slots: | 60 | public slots: |
61 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; | 61 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; |
62 | virtual void setLength( long length ) = 0; | 62 | virtual void setLength( long length ) = 0; |
63 | virtual void setPlaying( bool playing ) = 0; | 63 | virtual void setPlaying( bool playing ) = 0; |
64 | 64 | ||
65 | signals: | 65 | signals: |
66 | void moreReleased(); | 66 | void moreReleased(); |
67 | void lessReleased(); | 67 | void lessReleased(); |
68 | void forwardReleased(); | 68 | void forwardReleased(); |
69 | void backReleased(); | 69 | void backReleased(); |
70 | 70 | ||
71 | protected: | 71 | protected: |
72 | virtual void closeEvent( QCloseEvent * ); | 72 | virtual void closeEvent( QCloseEvent * ); |
73 | 73 | ||
74 | void handleCommand( Command command, bool buttonDown ); | 74 | void handleCommand( Command command, bool buttonDown ); |
75 | 75 | ||
76 | bool isOverButton( const QPoint &position, int buttonId ) const; | 76 | bool isOverButton( const QPoint &position, int buttonId ) const; |
77 | 77 | ||
78 | void paintButton( int buttonId ); | 78 | void paintButton( int buttonId ); |
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 23acfa3..380c703 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -51,49 +51,49 @@ | |||
51 | # include <qdirectpainter_qws.h> | 51 | # include <qdirectpainter_qws.h> |
52 | # include <qgfxraster_qws.h> | 52 | # include <qgfxraster_qws.h> |
53 | #endif | 53 | #endif |
54 | 54 | ||
55 | 55 | ||
56 | namespace | 56 | namespace |
57 | { | 57 | { |
58 | 58 | ||
59 | const int xo = 2; // movable x offset | 59 | const int xo = 2; // movable x offset |
60 | const int yo = 0; // movable y offset | 60 | const int yo = 0; // movable y offset |
61 | 61 | ||
62 | const char * const skinV_mask_file_names[7] = { | 62 | const char * const skinV_mask_file_names[7] = { |
63 | "play","stop","fwd","back","up","down","full" | 63 | "play","stop","fwd","back","up","down","full" |
64 | }; | 64 | }; |
65 | 65 | ||
66 | } | 66 | } |
67 | 67 | ||
68 | VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) | 68 | VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) |
69 | : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) | 69 | : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) |
70 | { | 70 | { |
71 | setCaption( tr("OpiePlayer - Video") ); | 71 | setCaption( tr("OpiePlayer - Video") ); |
72 | 72 | ||
73 | Button defaultButton; | 73 | Button defaultButton; |
74 | Button toggleButton = defaultButton; | 74 | Button toggleButton = defaultButton; |
75 | toggleButton.buttonType = ToggleButton; | 75 | toggleButton.type = ToggleButton; |
76 | 76 | ||
77 | buttons.reserve( 7 ); | 77 | buttons.reserve( 7 ); |
78 | buttons.push_back( toggleButton ); // play | 78 | buttons.push_back( toggleButton ); // play |
79 | buttons.push_back( defaultButton ); // stop | 79 | buttons.push_back( defaultButton ); // stop |
80 | buttons.push_back( defaultButton ); // next | 80 | buttons.push_back( defaultButton ); // next |
81 | buttons.push_back( defaultButton ); // previous | 81 | buttons.push_back( defaultButton ); // previous |
82 | buttons.push_back( defaultButton ); // volUp | 82 | buttons.push_back( defaultButton ); // volUp |
83 | buttons.push_back( defaultButton ); // volDown | 83 | buttons.push_back( defaultButton ); // volDown |
84 | buttons.push_back( toggleButton ); //fullscreen | 84 | buttons.push_back( toggleButton ); //fullscreen |
85 | 85 | ||
86 | videoFrame = new XineVideoWidget ( this, "Video frame" ); | 86 | videoFrame = new XineVideoWidget ( this, "Video frame" ); |
87 | 87 | ||
88 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); | 88 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); |
89 | connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); | 89 | connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); |
90 | 90 | ||
91 | Config cfg("OpiePlayer"); | 91 | Config cfg("OpiePlayer"); |
92 | cfg.setGroup("Options"); | 92 | cfg.setGroup("Options"); |
93 | skin = cfg.readEntry("Skin","default"); | 93 | skin = cfg.readEntry("Skin","default"); |
94 | 94 | ||
95 | QString skinPath = "opieplayer2/skins/" + skin; | 95 | QString skinPath = "opieplayer2/skins/" + skin; |
96 | pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | 96 | pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
97 | imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); | 97 | imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); |
98 | imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); | 98 | imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); |
99 | 99 | ||
@@ -275,49 +275,49 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
275 | if ( event->state() == QMouseEvent::LeftButton ) { | 275 | if ( event->state() == QMouseEvent::LeftButton ) { |
276 | // The test to see if the mouse click is inside the button or not | 276 | // The test to see if the mouse click is inside the button or not |
277 | bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i ); | 277 | bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i ); |
278 | 278 | ||
279 | if ( isOnButton && !buttons[i].isHeld ) { | 279 | if ( isOnButton && !buttons[i].isHeld ) { |
280 | buttons[i].isHeld = TRUE; | 280 | buttons[i].isHeld = TRUE; |
281 | toggleButton(i); | 281 | toggleButton(i); |
282 | 282 | ||
283 | switch (i) { | 283 | switch (i) { |
284 | case VideoVolUp: | 284 | case VideoVolUp: |
285 | emit moreClicked(); | 285 | emit moreClicked(); |
286 | return; | 286 | return; |
287 | case VideoVolDown: | 287 | case VideoVolDown: |
288 | emit lessClicked(); | 288 | emit lessClicked(); |
289 | return; | 289 | return; |
290 | } | 290 | } |
291 | } else if ( !isOnButton && buttons[i].isHeld ) { | 291 | } else if ( !isOnButton && buttons[i].isHeld ) { |
292 | buttons[i].isHeld = FALSE; | 292 | buttons[i].isHeld = FALSE; |
293 | toggleButton(i); | 293 | toggleButton(i); |
294 | } | 294 | } |
295 | } else { | 295 | } else { |
296 | 296 | ||
297 | if ( buttons[i].isHeld ) { | 297 | if ( buttons[i].isHeld ) { |
298 | buttons[i].isHeld = FALSE; | 298 | buttons[i].isHeld = FALSE; |
299 | if ( buttons[i].buttonType != ToggleButton ) { | 299 | if ( buttons[i].type != ToggleButton ) { |
300 | setToggleButton( i, FALSE ); | 300 | setToggleButton( i, FALSE ); |
301 | } | 301 | } |
302 | 302 | ||
303 | switch(i) { | 303 | switch(i) { |
304 | 304 | ||
305 | case VideoPlay: { | 305 | case VideoPlay: { |
306 | if( mediaPlayerState.isPaused() ) { | 306 | if( mediaPlayerState.isPaused() ) { |
307 | setToggleButton( i, FALSE ); | 307 | setToggleButton( i, FALSE ); |
308 | mediaPlayerState.setPaused( FALSE ); | 308 | mediaPlayerState.setPaused( FALSE ); |
309 | return; | 309 | return; |
310 | } else if( !mediaPlayerState.isPaused() ) { | 310 | } else if( !mediaPlayerState.isPaused() ) { |
311 | setToggleButton( i, TRUE ); | 311 | setToggleButton( i, TRUE ); |
312 | mediaPlayerState.setPaused( TRUE ); | 312 | mediaPlayerState.setPaused( TRUE ); |
313 | return; | 313 | return; |
314 | } else { | 314 | } else { |
315 | return; | 315 | return; |
316 | } | 316 | } |
317 | } | 317 | } |
318 | 318 | ||
319 | case VideoStop: mediaPlayerState.setPlaying( FALSE ); return; | 319 | case VideoStop: mediaPlayerState.setPlaying( FALSE ); return; |
320 | case VideoNext: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; | 320 | case VideoNext: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; |
321 | case VideoPrevious: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; | 321 | case VideoPrevious: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; |
322 | case VideoVolUp: emit moreReleased(); return; | 322 | case VideoVolUp: emit moreReleased(); return; |
323 | case VideoVolDown: emit lessReleased(); return; | 323 | case VideoVolDown: emit lessReleased(); return; |