summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-08 20:36:14 (UTC)
committer simon <simon>2002-12-08 20:36:14 (UTC)
commit7c3bd0be34ef70a2297e6f27c592da62f3010da5 (patch) (unidiff)
treec73aaf583ef2b9f56f544f580b52145aca356e84
parentec91b042d8312f83027beb357448fe02a13e8923 (diff)
downloadopie-7c3bd0be34ef70a2297e6f27c592da62f3010da5.zip
opie-7c3bd0be34ef70a2297e6f27c592da62f3010da5.tar.gz
opie-7c3bd0be34ef70a2297e6f27c592da62f3010da5.tar.bz2
- minor cleanup
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp13
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp12
2 files changed, 15 insertions, 10 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 8dbfb3d..7bf3a19 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -5,132 +5,135 @@
5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com> 5 Copyright (c) 2002 L. Potter <ljp@llornkcor.com>
6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> 6 Copyright (c) 2002 Holger Freyther <zecke@handhelds.org>
7 =. 7 =.
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more 22..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with 26  -_. . .   )=.  = Library General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34#include <qpe/qpeapplication.h> 34#include <qpe/qpeapplication.h>
35#include <qpe/resource.h> 35#include <qpe/resource.h>
36#include <qpe/config.h> 36#include <qpe/config.h>
37#include <opie/oticker.h> 37#include <opie/oticker.h>
38 38
39#include <qwidget.h> 39#include <qwidget.h>
40#include <qpixmap.h> 40#include <qpixmap.h>
41#include <qbutton.h> 41#include <qbutton.h>
42#include <qpainter.h> 42#include <qpainter.h>
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
53static const int xo = -2; // movable x offset 53namespace
54static const int yo = 22; // movable y offset 54{
55
56const int xo = -2; // movable x offset
57const int yo = 22; // movable y offset
55 58
56struct MediaButton { 59struct MediaButton {
57 bool isToggle, isHeld, isDown; 60 bool isToggle, isHeld, isDown;
58}; 61};
59 62
60//Layout information for the audioButtons (and if it is a toggle button or not) 63//Layout information for the audioButtons (and if it is a toggle button or not)
61MediaButton audioButtons[] = { 64MediaButton audioButtons[] = {
62 { TRUE, FALSE, FALSE }, // play 65 { TRUE, FALSE, FALSE }, // play
63 { FALSE, FALSE, FALSE }, // stop 66 { FALSE, FALSE, FALSE }, // stop
64 { FALSE, FALSE, FALSE }, // next 67 { FALSE, FALSE, FALSE }, // next
65 { FALSE, FALSE, FALSE }, // previous 68 { FALSE, FALSE, FALSE }, // previous
66 { FALSE, FALSE, FALSE }, // volume up 69 { FALSE, FALSE, FALSE }, // volume up
67 { FALSE, FALSE, FALSE }, // volume down 70 { FALSE, FALSE, FALSE }, // volume down
68 { TRUE, FALSE, FALSE }, // repeat/loop 71 { TRUE, FALSE, FALSE }, // repeat/loop
69 { FALSE, FALSE, FALSE }, // playlist 72 { FALSE, FALSE, FALSE }, // playlist
70 { FALSE, FALSE, FALSE }, // forward 73 { FALSE, FALSE, FALSE }, // forward
71 { FALSE, FALSE, FALSE } // back 74 { FALSE, FALSE, FALSE } // back
72}; 75};
73 76
74const char * const skin_mask_file_names[10] = { 77const char * const skin_mask_file_names[10] = {
75 "play", "stop", "next", "prev", "up", 78 "play", "stop", "next", "prev", "up",
76 "down", "loop", "playlist", "forward", "back" 79 "down", "loop", "playlist", "forward", "back"
77}; 80};
78 81
79 82void changeTextColor( QWidget * w) {
80static void changeTextColor( QWidget * w) {
81 QPalette p = w->palette(); 83 QPalette p = w->palette();
82 p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); 84 p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) );
83 p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); 85 p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) );
84 w->setPalette( p ); 86 w->setPalette( p );
85} 87}
86 88
87static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); 89const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton));
88 90
91}
89 92
90AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : 93AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) :
91 94
92 MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) { 95 MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) {
93 96
94 setCaption( tr("OpiePlayer") ); 97 setCaption( tr("OpiePlayer") );
95 98
96 Config cfg("OpiePlayer"); 99 Config cfg("OpiePlayer");
97 cfg.setGroup("Options"); 100 cfg.setGroup("Options");
98 skin = cfg.readEntry("Skin","default"); 101 skin = cfg.readEntry("Skin","default");
99 //skin = "scaleTest"; 102 //skin = "scaleTest";
100 // color of background, frame, degree of transparency 103 // color of background, frame, degree of transparency
101 104
102 QString skinPath = "opieplayer2/skins/" + skin; 105 QString skinPath = "opieplayer2/skins/" + skin;
103 pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); 106 pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
104 imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); 107 imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) );
105 imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); 108 imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) );
106 109
107 imgButtonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); 110 imgButtonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 );
108 imgButtonMask.fill( 0 ); 111 imgButtonMask.fill( 0 );
109 112
110 for ( int i = 0; i < 10; i++ ) { 113 for ( int i = 0; i < 10; i++ ) {
111 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png" ); 114 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png" );
112 masks[i] = new QBitmap( filename ); 115 masks[i] = new QBitmap( filename );
113 116
114 if ( !masks[i]->isNull() ) { 117 if ( !masks[i]->isNull() ) {
115 QImage imgMask = masks[i]->convertToImage(); 118 QImage imgMask = masks[i]->convertToImage();
116 uchar **dest = imgButtonMask.jumpTable(); 119 uchar **dest = imgButtonMask.jumpTable();
117 for ( int y = 0; y < imgUp.height(); y++ ) { 120 for ( int y = 0; y < imgUp.height(); y++ ) {
118 uchar *line = dest[y]; 121 uchar *line = dest[y];
119 for ( int x = 0; x < imgUp.width(); x++ ) 122 for ( int x = 0; x < imgUp.width(); x++ )
120 if ( !qRed( imgMask.pixel( x, y ) ) ) 123 if ( !qRed( imgMask.pixel( x, y ) ) )
121 line[x] = i + 1; 124 line[x] = i + 1;
122 } 125 }
123 } 126 }
124 127
125 } 128 }
126 129
127 for ( int i = 0; i < 10; i++ ) { 130 for ( int i = 0; i < 10; i++ ) {
128 buttonPixUp[i] = 0l; 131 buttonPixUp[i] = 0l;
129 buttonPixDown[i] = 0l; 132 buttonPixDown[i] = 0l;
130 } 133 }
131 134
132 setBackgroundPixmap( pixBg ); 135 setBackgroundPixmap( pixBg );
133 136
134 songInfo.setFocusPolicy( QWidget::NoFocus ); 137 songInfo.setFocusPolicy( QWidget::NoFocus );
135// changeTextColor( &songInfo ); 138// changeTextColor( &songInfo );
136// songInfo.setBackgroundColor( QColor( 167, 212, 167 )); 139// songInfo.setBackgroundColor( QColor( 167, 212, 167 ));
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index b7305fe..a0aed62 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -8,122 +8,124 @@
8 .=l. 8 .=l.
9           .>+-= 9           .>+-=
10 _;:,     .>    :=|. This program is free software; you can 10 _;:,     .>    :=|. This program is free software; you can
11.> <`_,   >  .   <= redistribute it and/or modify it under 11.> <`_,   >  .   <= redistribute it and/or modify it under
12:`=1 )Y*s>-.--   : the terms of the GNU General Public 12:`=1 )Y*s>-.--   : the terms of the GNU General Public
13.="- .-=="i,     .._ License as published by the Free Software 13.="- .-=="i,     .._ License as published by the Free Software
14 - .   .-<_>     .<> Foundation; either version 2 of the License, 14 - .   .-<_>     .<> Foundation; either version 2 of the License,
15     ._= =}       : or (at your option) any later version. 15     ._= =}       : or (at your option) any later version.
16    .%`+i>       _;_. 16    .%`+i>       _;_.
17    .i_,=:_.      -<s. This program is distributed in the hope that 17    .i_,=:_.      -<s. This program is distributed in the hope that
18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY; 18     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; Library General Public License for more 22..}^=.=       =       ; Library General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = Library General Public License along with 26  -_. . .   )=.  = Library General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34#include <qpe/qpeapplication.h> 34#include <qpe/qpeapplication.h>
35#include <qpe/resource.h> 35#include <qpe/resource.h>
36#include <qpe/config.h> 36#include <qpe/config.h>
37 37
38 38
39#include <qwidget.h> 39#include <qwidget.h>
40#include <qpainter.h> 40#include <qpainter.h>
41#include <qpixmap.h> 41#include <qpixmap.h>
42#include <qslider.h> 42#include <qslider.h>
43#include <qdrawutil.h> 43#include <qdrawutil.h>
44#include "videowidget.h" 44#include "videowidget.h"
45#include "mediaplayerstate.h" 45#include "mediaplayerstate.h"
46#include "playlistwidget.h" 46#include "playlistwidget.h"
47 47
48 48
49#ifdef Q_WS_QWS 49#ifdef Q_WS_QWS
50# define USE_DIRECT_PAINTER 50# define USE_DIRECT_PAINTER
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
56namespace
57{
56 58
57 59const int xo = 2; // movable x offset
58static const int xo = 2; // movable x offset 60const int yo = 0; // movable y offset
59static const int yo = 0; // movable y offset
60 61
61 62
62struct MediaButton { 63struct MediaButton {
63 bool isToggle, isHeld, isDown; 64 bool isToggle, isHeld, isDown;
64}; 65};
65 66
66MediaButton videoButtons[] = { 67MediaButton videoButtons[] = {
67 { FALSE, FALSE, FALSE }, // stop 68 { FALSE, FALSE, FALSE }, // stop
68 { TRUE, FALSE, FALSE }, // play 69 { TRUE, FALSE, FALSE }, // play
69 { FALSE, FALSE, FALSE }, // previous 70 { FALSE, FALSE, FALSE }, // previous
70 { FALSE, FALSE, FALSE }, // next 71 { FALSE, FALSE, FALSE }, // next
71 { FALSE, FALSE, FALSE }, // volUp 72 { FALSE, FALSE, FALSE }, // volUp
72 { FALSE, FALSE, FALSE }, // volDown 73 { FALSE, FALSE, FALSE }, // volDown
73 { TRUE, FALSE, FALSE } // fullscreen 74 { TRUE, FALSE, FALSE } // fullscreen
74}; 75};
75 76
76const char *skinV_mask_file_names[7] = { 77const char * const skinV_mask_file_names[7] = {
77"stop","play","back","fwd","up","down","full" 78"stop","play","back","fwd","up","down","full"
78}; 79};
79 80
80static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); 81const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton));
81 82
83}
82 84
83VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) 85VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name )
84 : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) 86 : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 )
85{ 87{
86 setCaption( tr("OpiePlayer - Video") ); 88 setCaption( tr("OpiePlayer - Video") );
87 89
88 videoFrame = new XineVideoWidget ( this, "Video frame" ); 90 videoFrame = new XineVideoWidget ( this, "Video frame" );
89 91
90 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); 92 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & )));
91 connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); 93 connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) );
92 94
93 Config cfg("OpiePlayer"); 95 Config cfg("OpiePlayer");
94 cfg.setGroup("Options"); 96 cfg.setGroup("Options");
95 skin = cfg.readEntry("Skin","default"); 97 skin = cfg.readEntry("Skin","default");
96 98
97 QString skinPath = "opieplayer2/skins/" + skin; 99 QString skinPath = "opieplayer2/skins/" + skin;
98 pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); 100 pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
99 imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); 101 imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) );
100 imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); 102 imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) );
101 103
102 imgButtonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); 104 imgButtonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 );
103 imgButtonMask.fill( 0 ); 105 imgButtonMask.fill( 0 );
104 106
105 for ( int i = 0; i < 7; i++ ) { 107 for ( int i = 0; i < 7; i++ ) {
106 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); 108 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png" );
107 masks[i] = new QBitmap( filename ); 109 masks[i] = new QBitmap( filename );
108 110
109 if ( !masks[i]->isNull() ) { 111 if ( !masks[i]->isNull() ) {
110 QImage imgMask = masks[i]->convertToImage(); 112 QImage imgMask = masks[i]->convertToImage();
111 uchar **dest = imgButtonMask.jumpTable(); 113 uchar **dest = imgButtonMask.jumpTable();
112 for ( int y = 0; y < imgUp.height(); y++ ) { 114 for ( int y = 0; y < imgUp.height(); y++ ) {
113 uchar *line = dest[y]; 115 uchar *line = dest[y];
114 for ( int x = 0; x < imgUp.width(); x++ ) { 116 for ( int x = 0; x < imgUp.width(); x++ ) {
115 if ( !qRed( imgMask.pixel( x, y ) ) ) 117 if ( !qRed( imgMask.pixel( x, y ) ) )
116 line[x] = i + 1; 118 line[x] = i + 1;
117 } 119 }
118 } 120 }
119 } 121 }
120 } 122 }
121 123
122 for ( int i = 0; i < 7; i++ ) { 124 for ( int i = 0; i < 7; i++ ) {
123 buttonPixUp[i] = NULL; 125 buttonPixUp[i] = NULL;
124 buttonPixDown[i] = NULL; 126 buttonPixDown[i] = NULL;
125 } 127 }
126 128
127 setBackgroundPixmap( pixBg ); 129 setBackgroundPixmap( pixBg );
128 130
129 slider = new QSlider( Qt::Horizontal, this ); 131 slider = new QSlider( Qt::Horizontal, this );