summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-02 20:01:57 (UTC)
committer simon <simon>2002-12-02 20:01:57 (UTC)
commitacfbc79f2acf59fa5e4494dde4ea1c4ea5e429b7 (patch) (unidiff)
tree0589832714da4838a678b2e40e431816087efc39
parent262f335a055e189130a3c0dd7028388ab103504e (diff)
downloadopie-acfbc79f2acf59fa5e4494dde4ea1c4ea5e429b7.zip
opie-acfbc79f2acf59fa5e4494dde4ea1c4ea5e429b7.tar.gz
opie-acfbc79f2acf59fa5e4494dde4ea1c4ea5e429b7.tar.bz2
- less header inclusions
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.h2
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp1
2 files changed, 0 insertions, 3 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.h b/noncore/multimedia/opieplayer2/mediaplayer.h
index 1e34c88..de3886e 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.h
+++ b/noncore/multimedia/opieplayer2/mediaplayer.h
@@ -1,77 +1,75 @@
1 /* 1 /*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
5 Copyright (c) 2002 LJP <> 5 Copyright (c) 2002 LJP <>
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#ifndef MEDIA_PLAYER_H 34#ifndef MEDIA_PLAYER_H
35#define MEDIA_PLAYER_H 35#define MEDIA_PLAYER_H
36 36
37#include <qmainwindow.h> 37#include <qmainwindow.h>
38#include <qframe.h> 38#include <qframe.h>
39#include <qpe/qlibrary.h>
40#include <qpe/mediaplayerplugininterface.h>
41 39
42#include "xinecontrol.h" 40#include "xinecontrol.h"
43 41
44class DocLnk; 42class DocLnk;
45class VolumeControl; 43class VolumeControl;
46 44
47class MediaPlayer : public QObject { 45class MediaPlayer : public QObject {
48 Q_OBJECT 46 Q_OBJECT
49public: 47public:
50 MediaPlayer( QObject *parent, const char *name ); 48 MediaPlayer( QObject *parent, const char *name );
51 ~MediaPlayer(); 49 ~MediaPlayer();
52private slots: 50private slots:
53 void setPlaying( bool ); 51 void setPlaying( bool );
54 void pauseCheck( bool ); 52 void pauseCheck( bool );
55 void play(); 53 void play();
56 void next(); 54 void next();
57 void prev(); 55 void prev();
58 void startIncreasingVolume(); 56 void startIncreasingVolume();
59 void startDecreasingVolume(); 57 void startDecreasingVolume();
60 void stopChangingVolume(); 58 void stopChangingVolume();
61 void cleanUp(); 59 void cleanUp();
62 void blank( bool ); 60 void blank( bool );
63 61
64protected: 62protected:
65 void timerEvent( QTimerEvent *e ); 63 void timerEvent( QTimerEvent *e );
66 void keyReleaseEvent( QKeyEvent *e); 64 void keyReleaseEvent( QKeyEvent *e);
67private: 65private:
68 bool isBlanked, l, r; 66 bool isBlanked, l, r;
69 int fd, fl; 67 int fd, fl;
70 int volumeDirection; 68 int volumeDirection;
71 XineControl *xineControl; 69 XineControl *xineControl;
72 VolumeControl *volControl; 70 VolumeControl *volControl;
73}; 71};
74 72
75 73
76#endif // MEDIA_PLAYER_H 74#endif // MEDIA_PLAYER_H
77 75
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index 888fcf4..e0ca243 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -1,228 +1,227 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> 4              Copyright (c) 2002 Max Reiss <harlekin@handhelds.org>
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/mediaplayerplugininterface.h>
37#include <qpe/config.h> 36#include <qpe/config.h>
38 37
39 38
40#include <qwidget.h> 39#include <qwidget.h>
41#include <qpainter.h> 40#include <qpainter.h>
42#include <qpixmap.h> 41#include <qpixmap.h>
43#include <qslider.h> 42#include <qslider.h>
44#include <qdrawutil.h> 43#include <qdrawutil.h>
45#include "videowidget.h" 44#include "videowidget.h"
46#include "mediaplayerstate.h" 45#include "mediaplayerstate.h"
47#include "playlistwidget.h" 46#include "playlistwidget.h"
48 47
49 48
50#ifdef Q_WS_QWS 49#ifdef Q_WS_QWS
51# define USE_DIRECT_PAINTER 50# define USE_DIRECT_PAINTER
52# include <qdirectpainter_qws.h> 51# include <qdirectpainter_qws.h>
53# include <qgfxraster_qws.h> 52# include <qgfxraster_qws.h>
54#endif 53#endif
55 54
56 55
57extern MediaPlayerState *mediaPlayerState; 56extern MediaPlayerState *mediaPlayerState;
58extern PlayListWidget *playList; 57extern PlayListWidget *playList;
59 58
60 59
61static const int xo = 2; // movable x offset 60static const int xo = 2; // movable x offset
62static const int yo = 0; // movable y offset 61static const int yo = 0; // movable y offset
63 62
64 63
65struct MediaButton { 64struct MediaButton {
66 bool isToggle, isHeld, isDown; 65 bool isToggle, isHeld, isDown;
67}; 66};
68 67
69MediaButton videoButtons[] = { 68MediaButton videoButtons[] = {
70 { FALSE, FALSE, FALSE }, // stop 69 { FALSE, FALSE, FALSE }, // stop
71 { TRUE, FALSE, FALSE }, // play 70 { TRUE, FALSE, FALSE }, // play
72 { FALSE, FALSE, FALSE }, // previous 71 { FALSE, FALSE, FALSE }, // previous
73 { FALSE, FALSE, FALSE }, // next 72 { FALSE, FALSE, FALSE }, // next
74 { FALSE, FALSE, FALSE }, // volUp 73 { FALSE, FALSE, FALSE }, // volUp
75 { FALSE, FALSE, FALSE }, // volDown 74 { FALSE, FALSE, FALSE }, // volDown
76 { TRUE, FALSE, FALSE } // fullscreen 75 { TRUE, FALSE, FALSE } // fullscreen
77}; 76};
78 77
79const char *skinV_mask_file_names[7] = { 78const char *skinV_mask_file_names[7] = {
80"stop","play","back","fwd","up","down","full" 79"stop","play","back","fwd","up","down","full"
81}; 80};
82 81
83static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); 82static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton));
84 83
85 84
86VideoWidget::VideoWidget(QWidget* parent, const char* name) : 85VideoWidget::VideoWidget(QWidget* parent, const char* name) :
87MediaWidget( parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) { 86MediaWidget( parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) {
88 87
89 88
90 setCaption( tr("OpiePlayer - Video") ); 89 setCaption( tr("OpiePlayer - Video") );
91 90
92 videoFrame = new XineVideoWidget ( this, "Video frame" ); 91 videoFrame = new XineVideoWidget ( this, "Video frame" );
93 92
94 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); 93 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & )));
95 connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); 94 connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) );
96 95
97 Config cfg("OpiePlayer"); 96 Config cfg("OpiePlayer");
98 cfg.setGroup("Options"); 97 cfg.setGroup("Options");
99 skin = cfg.readEntry("Skin","default"); 98 skin = cfg.readEntry("Skin","default");
100 99
101 QString skinPath = "opieplayer2/skins/" + skin; 100 QString skinPath = "opieplayer2/skins/" + skin;
102 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); 101 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
103 imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); 102 imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) );
104 imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); 103 imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) );
105 104
106 imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); 105 imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 );
107 imgButtonMask->fill( 0 ); 106 imgButtonMask->fill( 0 );
108 107
109 for ( int i = 0; i < 7; i++ ) { 108 for ( int i = 0; i < 7; i++ ) {
110 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); 109 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png" );
111 masks[i] = new QBitmap( filename ); 110 masks[i] = new QBitmap( filename );
112 111
113 if ( !masks[i]->isNull() ) { 112 if ( !masks[i]->isNull() ) {
114 QImage imgMask = masks[i]->convertToImage(); 113 QImage imgMask = masks[i]->convertToImage();
115 uchar **dest = imgButtonMask->jumpTable(); 114 uchar **dest = imgButtonMask->jumpTable();
116 for ( int y = 0; y < imgUp->height(); y++ ) { 115 for ( int y = 0; y < imgUp->height(); y++ ) {
117 uchar *line = dest[y]; 116 uchar *line = dest[y];
118 for ( int x = 0; x < imgUp->width(); x++ ) { 117 for ( int x = 0; x < imgUp->width(); x++ ) {
119 if ( !qRed( imgMask.pixel( x, y ) ) ) 118 if ( !qRed( imgMask.pixel( x, y ) ) )
120 line[x] = i + 1; 119 line[x] = i + 1;
121 } 120 }
122 } 121 }
123 } 122 }
124 } 123 }
125 124
126 for ( int i = 0; i < 7; i++ ) { 125 for ( int i = 0; i < 7; i++ ) {
127 buttonPixUp[i] = NULL; 126 buttonPixUp[i] = NULL;
128 buttonPixDown[i] = NULL; 127 buttonPixDown[i] = NULL;
129 } 128 }
130 129
131 setBackgroundPixmap( *pixBg ); 130 setBackgroundPixmap( *pixBg );
132 131
133 slider = new QSlider( Qt::Horizontal, this ); 132 slider = new QSlider( Qt::Horizontal, this );
134 slider->setMinValue( 0 ); 133 slider->setMinValue( 0 );
135 slider->setMaxValue( 1 ); 134 slider->setMaxValue( 1 );
136 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); 135 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) );
137 //slider->setFocusPolicy( QWidget::NoFocus ); 136 //slider->setFocusPolicy( QWidget::NoFocus );
138 137
139 resizeEvent( NULL ); 138 resizeEvent( NULL );
140 139
141 setLength( mediaPlayerState->length() ); 140 setLength( mediaPlayerState->length() );
142 setPosition( mediaPlayerState->position() ); 141 setPosition( mediaPlayerState->position() );
143 setFullscreen( mediaPlayerState->isFullscreen() ); 142 setFullscreen( mediaPlayerState->isFullscreen() );
144 setPlaying( mediaPlayerState->isPlaying() ); 143 setPlaying( mediaPlayerState->isPlaying() );
145} 144}
146 145
147 146
148VideoWidget::~VideoWidget() { 147VideoWidget::~VideoWidget() {
149 148
150 for ( int i = 0; i < 7; i++ ) { 149 for ( int i = 0; i < 7; i++ ) {
151 delete buttonPixUp[i]; 150 delete buttonPixUp[i];
152 delete buttonPixDown[i]; 151 delete buttonPixDown[i];
153 } 152 }
154 153
155 delete pixBg; 154 delete pixBg;
156 delete imgUp; 155 delete imgUp;
157 delete imgDn; 156 delete imgDn;
158 delete imgButtonMask; 157 delete imgButtonMask;
159 for ( int i = 0; i < 7; i++ ) { 158 for ( int i = 0; i < 7; i++ ) {
160 delete masks[i]; 159 delete masks[i];
161 } 160 }
162 161
163} 162}
164 163
165QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { 164QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
166 QPixmap pix( img.width(), img.height() ); 165 QPixmap pix( img.width(), img.height() );
167 QPainter p( &pix ); 166 QPainter p( &pix );
168 p.drawTiledPixmap( pix.rect(), bg, offset ); 167 p.drawTiledPixmap( pix.rect(), bg, offset );
169 p.drawImage( 0, 0, img ); 168 p.drawImage( 0, 0, img );
170 return new QPixmap( pix ); 169 return new QPixmap( pix );
171} 170}
172 171
173QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) { 172QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) {
174 QPixmap *pixmap = new QPixmap( pix ); 173 QPixmap *pixmap = new QPixmap( pix );
175 pixmap->setMask( mask ); 174 pixmap->setMask( mask );
176 return pixmap; 175 return pixmap;
177} 176}
178 177
179void VideoWidget::resizeEvent( QResizeEvent * ) { 178void VideoWidget::resizeEvent( QResizeEvent * ) {
180 int h = height(); 179 int h = height();
181 int w = width(); 180 int w = width();
182 //int Vh = 160; 181 //int Vh = 160;
183 //int Vw = 220; 182 //int Vw = 220;
184 183
185 slider->setFixedWidth( w - 20 ); 184 slider->setFixedWidth( w - 20 );
186 slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); 185 slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) );
187 slider->setBackgroundOrigin( QWidget::ParentOrigin ); 186 slider->setBackgroundOrigin( QWidget::ParentOrigin );
188 slider->setFocusPolicy( QWidget::NoFocus ); 187 slider->setFocusPolicy( QWidget::NoFocus );
189 slider->setBackgroundPixmap( *pixBg ); 188 slider->setBackgroundPixmap( *pixBg );
190 189
191 xoff = 0;// ( imgUp->width() ) / 2; 190 xoff = 0;// ( imgUp->width() ) / 2;
192 if(w>h) 191 if(w>h)
193 yoff = 0; 192 yoff = 0;
194 else 193 else
195 yoff = 185;//(( Vh - imgUp->height() ) / 2) - 10; 194 yoff = 185;//(( Vh - imgUp->height() ) / 2) - 10;
196 QPoint p( xoff, yoff ); 195 QPoint p( xoff, yoff );
197 196
198 QPixmap *pixUp = combineVImageWithBackground( *imgUp, *pixBg, p ); 197 QPixmap *pixUp = combineVImageWithBackground( *imgUp, *pixBg, p );
199 QPixmap *pixDn = combineVImageWithBackground( *imgDn, *pixBg, p ); 198 QPixmap *pixDn = combineVImageWithBackground( *imgDn, *pixBg, p );
200 199
201 for ( int i = 0; i < 7; i++ ) { 200 for ( int i = 0; i < 7; i++ ) {
202 if ( !masks[i]->isNull() ) { 201 if ( !masks[i]->isNull() ) {
203 delete buttonPixUp[i]; 202 delete buttonPixUp[i];
204 delete buttonPixDown[i]; 203 delete buttonPixDown[i];
205 buttonPixUp[i] = maskVPixToMask( *pixUp, *masks[i] ); 204 buttonPixUp[i] = maskVPixToMask( *pixUp, *masks[i] );
206 buttonPixDown[i] = maskVPixToMask( *pixDn, *masks[i] ); 205 buttonPixDown[i] = maskVPixToMask( *pixDn, *masks[i] );
207 } 206 }
208 } 207 }
209 208
210 delete pixUp; 209 delete pixUp;
211 delete pixDn; 210 delete pixDn;
212} 211}
213 212
214static bool videoSliderBeingMoved = FALSE; 213static bool videoSliderBeingMoved = FALSE;
215 214
216void VideoWidget::sliderPressed() { 215void VideoWidget::sliderPressed() {
217 videoSliderBeingMoved = TRUE; 216 videoSliderBeingMoved = TRUE;
218} 217}
219 218
220void VideoWidget::sliderReleased() { 219void VideoWidget::sliderReleased() {
221 videoSliderBeingMoved = FALSE; 220 videoSliderBeingMoved = FALSE;
222 if ( slider->width() == 0 ) { 221 if ( slider->width() == 0 ) {
223 return; 222 return;
224 } 223 }
225 long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); 224 long val = long((double)slider->value() * mediaPlayerState->length() / slider->width());
226 mediaPlayerState->setPosition( val ); 225 mediaPlayerState->setPosition( val );
227} 226}
228 227