-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 7 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 25 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 2 |
3 files changed, 29 insertions, 5 deletions
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h index 0b9d826..9cb75ae 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.h +++ b/noncore/multimedia/opieplayer2/mediawidget.h | |||
@@ -1,68 +1,73 @@ | |||
1 | /* | 1 | /* |
2 | Copyright (C) 2002 Simon Hausmann <hausmann@kde.org> | 2 | Copyright (C) 2002 Simon Hausmann <hausmann@kde.org> |
3 | 3 | ||
4 | This library is free software; you can redistribute it and/or | 4 | This library is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU Library General Public | 5 | modify it under the terms of the GNU Library General Public |
6 | License as published by the Free Software Foundation; either | 6 | License as published by the Free Software Foundation; either |
7 | version 2 of the License, or (at your option) any later version. | 7 | version 2 of the License, or (at your option) any later version. |
8 | 8 | ||
9 | This library is distributed in the hope that it will be useful, | 9 | This library is distributed in the hope that it will be useful, |
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 | Library General Public License for more details. | 12 | Library General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU Library General Public License | 14 | You should have received a copy of the GNU Library General Public License |
15 | along with this library; see the file COPYING.LIB. If not, write to | 15 | along with this library; see the file COPYING.LIB. If not, write to |
16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 16 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
17 | Boston, MA 02111-1307, USA. | 17 | Boston, MA 02111-1307, USA. |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #ifndef MEDIAWIDGET_H | 20 | #ifndef MEDIAWIDGET_H |
21 | #define MEDIAWIDGET_H | 21 | #define MEDIAWIDGET_H |
22 | 22 | ||
23 | #include <qwidget.h> | 23 | #include <qwidget.h> |
24 | 24 | ||
25 | #include "mediaplayerstate.h" | 25 | #include "mediaplayerstate.h" |
26 | #include "playlistwidget.h" | 26 | #include "playlistwidget.h" |
27 | 27 | ||
28 | #include <vector> | ||
29 | |||
28 | class MediaWidget : public QWidget | 30 | class MediaWidget : public QWidget |
29 | { | 31 | { |
30 | Q_OBJECT | 32 | Q_OBJECT |
31 | public: | 33 | public: |
32 | enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back }; | 34 | enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back }; |
33 | 35 | ||
34 | struct Button | 36 | struct Button |
35 | { | 37 | { |
36 | // Button() : isToggle( false ), isHeld( false ), isDown( false ) {} | 38 | //Button() : isToggle( false ), isHeld( false ), isDown( false ) {} |
39 | // Button( bool toggle, bool held, bool down ) | ||
40 | // : isToggle( toggle ), isHeld( held ), isDown( down ) {} | ||
37 | 41 | ||
38 | bool isToggle : 1; | 42 | bool isToggle : 1; |
39 | bool isHeld : 1; | 43 | bool isHeld : 1; |
40 | bool isDown : 1; | 44 | bool isDown : 1; |
41 | }; | 45 | }; |
46 | typedef std::vector<Button> ButtonVector; | ||
42 | 47 | ||
43 | MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); | 48 | MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); |
44 | virtual ~MediaWidget(); | 49 | virtual ~MediaWidget(); |
45 | 50 | ||
46 | public slots: | 51 | public slots: |
47 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; | 52 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; |
48 | virtual void setLength( long length ) = 0; | 53 | virtual void setLength( long length ) = 0; |
49 | virtual void setPlaying( bool playing ) = 0; | 54 | virtual void setPlaying( bool playing ) = 0; |
50 | 55 | ||
51 | signals: | 56 | signals: |
52 | void moreReleased(); | 57 | void moreReleased(); |
53 | void lessReleased(); | 58 | void lessReleased(); |
54 | void forwardReleased(); | 59 | void forwardReleased(); |
55 | void backReleased(); | 60 | void backReleased(); |
56 | 61 | ||
57 | protected: | 62 | protected: |
58 | virtual void closeEvent( QCloseEvent * ); | 63 | virtual void closeEvent( QCloseEvent * ); |
59 | 64 | ||
60 | void handleCommand( Command command, bool buttonDown ); | 65 | void handleCommand( Command command, bool buttonDown ); |
61 | 66 | ||
62 | MediaPlayerState &mediaPlayerState; | 67 | MediaPlayerState &mediaPlayerState; |
63 | PlayListWidget &playList; | 68 | PlayListWidget &playList; |
64 | }; | 69 | }; |
65 | 70 | ||
66 | #endif // MEDIAWIDGET_H | 71 | #endif // MEDIAWIDGET_H |
67 | /* vim: et sw=4 ts=4 | 72 | /* vim: et sw=4 ts=4 |
68 | */ | 73 | */ |
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 7c20c6d..efd756c 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -1,180 +1,197 @@ | |||
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/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 | ||
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 | /* | ||
62 | MediaWidget::Button videoButtons[] = { | 63 | MediaWidget::Button videoButtons[] = { |
63 | { FALSE, FALSE, FALSE }, // stop | 64 | { FALSE, FALSE, FALSE }, // stop |
64 | { TRUE, FALSE, FALSE }, // play | 65 | { TRUE, FALSE, FALSE }, // play |
65 | { FALSE, FALSE, FALSE }, // previous | 66 | { FALSE, FALSE, FALSE }, // previous |
66 | { FALSE, FALSE, FALSE }, // next | 67 | { FALSE, FALSE, FALSE }, // next |
67 | { FALSE, FALSE, FALSE }, // volUp | 68 | { FALSE, FALSE, FALSE }, // volUp |
68 | { FALSE, FALSE, FALSE }, // volDown | 69 | { FALSE, FALSE, FALSE }, // volDown |
69 | { TRUE, FALSE, FALSE } // fullscreen | 70 | { TRUE, FALSE, FALSE } // fullscreen |
70 | }; | 71 | }; |
72 | */ | ||
71 | 73 | ||
72 | const char * const skinV_mask_file_names[7] = { | 74 | const char * const skinV_mask_file_names[7] = { |
73 | "stop","play","back","fwd","up","down","full" | 75 | "stop","play","back","fwd","up","down","full" |
74 | }; | 76 | }; |
75 | 77 | ||
76 | const int numVButtons = (sizeof(videoButtons)/sizeof(MediaWidget::Button)); | 78 | //const int numVButtons = (sizeof(videoButtons)/sizeof(MediaWidget::Button)); |
77 | 79 | ||
78 | } | 80 | } |
79 | 81 | ||
80 | VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) | 82 | VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) |
81 | : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) | 83 | : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) |
82 | { | 84 | { |
83 | setCaption( tr("OpiePlayer - Video") ); | 85 | setCaption( tr("OpiePlayer - Video") ); |
84 | 86 | ||
87 | Button defaultButton; | ||
88 | defaultButton.isToggle = defaultButton.isHeld = defaultButton.isDown = false; | ||
89 | Button toggleButton; | ||
90 | toggleButton.isToggle = true; | ||
91 | toggleButton.isHeld = toggleButton.isDown = false; | ||
92 | |||
93 | videoButtons.reserve( 7 ); | ||
94 | videoButtons.push_back( defaultButton ); // stop | ||
95 | videoButtons.push_back( toggleButton ); // play | ||
96 | videoButtons.push_back( defaultButton ); // previous | ||
97 | videoButtons.push_back( defaultButton ); // next | ||
98 | videoButtons.push_back( defaultButton ); // volUp | ||
99 | videoButtons.push_back( defaultButton ); // volDown | ||
100 | videoButtons.push_back( toggleButton ); //fullscreen | ||
101 | |||
85 | videoFrame = new XineVideoWidget ( this, "Video frame" ); | 102 | videoFrame = new XineVideoWidget ( this, "Video frame" ); |
86 | 103 | ||
87 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); | 104 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); |
88 | connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); | 105 | connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); |
89 | 106 | ||
90 | Config cfg("OpiePlayer"); | 107 | Config cfg("OpiePlayer"); |
91 | cfg.setGroup("Options"); | 108 | cfg.setGroup("Options"); |
92 | skin = cfg.readEntry("Skin","default"); | 109 | skin = cfg.readEntry("Skin","default"); |
93 | 110 | ||
94 | QString skinPath = "opieplayer2/skins/" + skin; | 111 | QString skinPath = "opieplayer2/skins/" + skin; |
95 | pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | 112 | pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
96 | imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); | 113 | imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); |
97 | imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); | 114 | imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); |
98 | 115 | ||
99 | imgButtonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); | 116 | imgButtonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); |
100 | imgButtonMask.fill( 0 ); | 117 | imgButtonMask.fill( 0 ); |
101 | 118 | ||
102 | for ( int i = 0; i < 7; i++ ) { | 119 | for ( int i = 0; i < 7; i++ ) { |
103 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); | 120 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); |
104 | masks[i] = new QBitmap( filename ); | 121 | masks[i] = new QBitmap( filename ); |
105 | 122 | ||
106 | if ( !masks[i]->isNull() ) { | 123 | if ( !masks[i]->isNull() ) { |
107 | QImage imgMask = masks[i]->convertToImage(); | 124 | QImage imgMask = masks[i]->convertToImage(); |
108 | uchar **dest = imgButtonMask.jumpTable(); | 125 | uchar **dest = imgButtonMask.jumpTable(); |
109 | for ( int y = 0; y < imgUp.height(); y++ ) { | 126 | for ( int y = 0; y < imgUp.height(); y++ ) { |
110 | uchar *line = dest[y]; | 127 | uchar *line = dest[y]; |
111 | for ( int x = 0; x < imgUp.width(); x++ ) { | 128 | for ( int x = 0; x < imgUp.width(); x++ ) { |
112 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 129 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
113 | line[x] = i + 1; | 130 | line[x] = i + 1; |
114 | } | 131 | } |
115 | } | 132 | } |
116 | } | 133 | } |
117 | } | 134 | } |
118 | 135 | ||
119 | for ( int i = 0; i < 7; i++ ) { | 136 | for ( int i = 0; i < 7; i++ ) { |
120 | buttonPixUp[i] = NULL; | 137 | buttonPixUp[i] = NULL; |
121 | buttonPixDown[i] = NULL; | 138 | buttonPixDown[i] = NULL; |
122 | } | 139 | } |
123 | 140 | ||
124 | setBackgroundPixmap( pixBg ); | 141 | setBackgroundPixmap( pixBg ); |
125 | 142 | ||
126 | slider = new QSlider( Qt::Horizontal, this ); | 143 | slider = new QSlider( Qt::Horizontal, this ); |
127 | slider->setMinValue( 0 ); | 144 | slider->setMinValue( 0 ); |
128 | slider->setMaxValue( 1 ); | 145 | slider->setMaxValue( 1 ); |
129 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); | 146 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); |
130 | //slider->setFocusPolicy( QWidget::NoFocus ); | 147 | //slider->setFocusPolicy( QWidget::NoFocus ); |
131 | 148 | ||
132 | resizeEvent( NULL ); | 149 | resizeEvent( NULL ); |
133 | 150 | ||
134 | setLength( mediaPlayerState.length() ); | 151 | setLength( mediaPlayerState.length() ); |
135 | setPosition( mediaPlayerState.position() ); | 152 | setPosition( mediaPlayerState.position() ); |
136 | setFullscreen( mediaPlayerState.isFullscreen() ); | 153 | setFullscreen( mediaPlayerState.isFullscreen() ); |
137 | setPlaying( mediaPlayerState.isPlaying() ); | 154 | setPlaying( mediaPlayerState.isPlaying() ); |
138 | } | 155 | } |
139 | 156 | ||
140 | 157 | ||
141 | VideoWidget::~VideoWidget() { | 158 | VideoWidget::~VideoWidget() { |
142 | 159 | ||
143 | for ( int i = 0; i < 7; i++ ) { | 160 | for ( int i = 0; i < 7; i++ ) { |
144 | delete buttonPixUp[i]; | 161 | delete buttonPixUp[i]; |
145 | delete buttonPixDown[i]; | 162 | delete buttonPixDown[i]; |
146 | } | 163 | } |
147 | 164 | ||
148 | for ( int i = 0; i < 7; i++ ) { | 165 | for ( int i = 0; i < 7; i++ ) { |
149 | delete masks[i]; | 166 | delete masks[i]; |
150 | } | 167 | } |
151 | 168 | ||
152 | } | 169 | } |
153 | 170 | ||
154 | QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { | 171 | QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { |
155 | QPixmap pix( img.width(), img.height() ); | 172 | QPixmap pix( img.width(), img.height() ); |
156 | QPainter p( &pix ); | 173 | QPainter p( &pix ); |
157 | p.drawTiledPixmap( pix.rect(), bg, offset ); | 174 | p.drawTiledPixmap( pix.rect(), bg, offset ); |
158 | p.drawImage( 0, 0, img ); | 175 | p.drawImage( 0, 0, img ); |
159 | return new QPixmap( pix ); | 176 | return new QPixmap( pix ); |
160 | } | 177 | } |
161 | 178 | ||
162 | QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) { | 179 | QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) { |
163 | QPixmap *pixmap = new QPixmap( pix ); | 180 | QPixmap *pixmap = new QPixmap( pix ); |
164 | pixmap->setMask( mask ); | 181 | pixmap->setMask( mask ); |
165 | return pixmap; | 182 | return pixmap; |
166 | } | 183 | } |
167 | 184 | ||
168 | void VideoWidget::resizeEvent( QResizeEvent * ) { | 185 | void VideoWidget::resizeEvent( QResizeEvent * ) { |
169 | int h = height(); | 186 | int h = height(); |
170 | int w = width(); | 187 | int w = width(); |
171 | //int Vh = 160; | 188 | //int Vh = 160; |
172 | //int Vw = 220; | 189 | //int Vw = 220; |
173 | 190 | ||
174 | slider->setFixedWidth( w - 20 ); | 191 | slider->setFixedWidth( w - 20 ); |
175 | slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); | 192 | slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); |
176 | slider->setBackgroundOrigin( QWidget::ParentOrigin ); | 193 | slider->setBackgroundOrigin( QWidget::ParentOrigin ); |
177 | slider->setFocusPolicy( QWidget::NoFocus ); | 194 | slider->setFocusPolicy( QWidget::NoFocus ); |
178 | slider->setBackgroundPixmap( pixBg ); | 195 | slider->setBackgroundPixmap( pixBg ); |
179 | 196 | ||
180 | xoff = 0;// ( imgUp->width() ) / 2; | 197 | xoff = 0;// ( imgUp->width() ) / 2; |
@@ -183,320 +200,320 @@ void VideoWidget::resizeEvent( QResizeEvent * ) { | |||
183 | else | 200 | else |
184 | yoff = 185;//(( Vh - imgUp->height() ) / 2) - 10; | 201 | yoff = 185;//(( Vh - imgUp->height() ) / 2) - 10; |
185 | QPoint p( xoff, yoff ); | 202 | QPoint p( xoff, yoff ); |
186 | 203 | ||
187 | QPixmap *pixUp = combineVImageWithBackground( imgUp, pixBg, p ); | 204 | QPixmap *pixUp = combineVImageWithBackground( imgUp, pixBg, p ); |
188 | QPixmap *pixDn = combineVImageWithBackground( imgDn, pixBg, p ); | 205 | QPixmap *pixDn = combineVImageWithBackground( imgDn, pixBg, p ); |
189 | 206 | ||
190 | for ( int i = 0; i < 7; i++ ) { | 207 | for ( int i = 0; i < 7; i++ ) { |
191 | if ( !masks[i]->isNull() ) { | 208 | if ( !masks[i]->isNull() ) { |
192 | delete buttonPixUp[i]; | 209 | delete buttonPixUp[i]; |
193 | delete buttonPixDown[i]; | 210 | delete buttonPixDown[i]; |
194 | buttonPixUp[i] = maskVPixToMask( *pixUp, *masks[i] ); | 211 | buttonPixUp[i] = maskVPixToMask( *pixUp, *masks[i] ); |
195 | buttonPixDown[i] = maskVPixToMask( *pixDn, *masks[i] ); | 212 | buttonPixDown[i] = maskVPixToMask( *pixDn, *masks[i] ); |
196 | } | 213 | } |
197 | } | 214 | } |
198 | 215 | ||
199 | delete pixUp; | 216 | delete pixUp; |
200 | delete pixDn; | 217 | delete pixDn; |
201 | } | 218 | } |
202 | 219 | ||
203 | static bool videoSliderBeingMoved = FALSE; | 220 | static bool videoSliderBeingMoved = FALSE; |
204 | 221 | ||
205 | void VideoWidget::sliderPressed() { | 222 | void VideoWidget::sliderPressed() { |
206 | videoSliderBeingMoved = TRUE; | 223 | videoSliderBeingMoved = TRUE; |
207 | } | 224 | } |
208 | 225 | ||
209 | void VideoWidget::sliderReleased() { | 226 | void VideoWidget::sliderReleased() { |
210 | videoSliderBeingMoved = FALSE; | 227 | videoSliderBeingMoved = FALSE; |
211 | if ( slider->width() == 0 ) { | 228 | if ( slider->width() == 0 ) { |
212 | return; | 229 | return; |
213 | } | 230 | } |
214 | long val = long((double)slider->value() * mediaPlayerState.length() / slider->width()); | 231 | long val = long((double)slider->value() * mediaPlayerState.length() / slider->width()); |
215 | mediaPlayerState.setPosition( val ); | 232 | mediaPlayerState.setPosition( val ); |
216 | } | 233 | } |
217 | 234 | ||
218 | void VideoWidget::setPosition( long i ) { | 235 | void VideoWidget::setPosition( long i ) { |
219 | updateSlider( i, mediaPlayerState.length() ); | 236 | updateSlider( i, mediaPlayerState.length() ); |
220 | } | 237 | } |
221 | 238 | ||
222 | 239 | ||
223 | void VideoWidget::setLength( long max ) { | 240 | void VideoWidget::setLength( long max ) { |
224 | updateSlider( mediaPlayerState.position(), max ); | 241 | updateSlider( mediaPlayerState.position(), max ); |
225 | } | 242 | } |
226 | 243 | ||
227 | void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) | 244 | void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) |
228 | { | 245 | { |
229 | if ( displayType == MediaPlayerState::Video ) { | 246 | if ( displayType == MediaPlayerState::Video ) { |
230 | makeVisible(); | 247 | makeVisible(); |
231 | return; | 248 | return; |
232 | } | 249 | } |
233 | 250 | ||
234 | // Effectively blank the view next time we show it so it looks nicer | 251 | // Effectively blank the view next time we show it so it looks nicer |
235 | scaledWidth = 0; | 252 | scaledWidth = 0; |
236 | scaledHeight = 0; | 253 | scaledHeight = 0; |
237 | hide(); | 254 | hide(); |
238 | } | 255 | } |
239 | 256 | ||
240 | void VideoWidget::updateSlider( long i, long max ) { | 257 | void VideoWidget::updateSlider( long i, long max ) { |
241 | // Will flicker too much if we don't do this | 258 | // Will flicker too much if we don't do this |
242 | if ( max == 0 ) { | 259 | if ( max == 0 ) { |
243 | return; | 260 | return; |
244 | } | 261 | } |
245 | int width = slider->width(); | 262 | int width = slider->width(); |
246 | int val = int((double)i * width / max); | 263 | int val = int((double)i * width / max); |
247 | if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) { | 264 | if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) { |
248 | if ( slider->value() != val ) { | 265 | if ( slider->value() != val ) { |
249 | slider->setValue( val ); | 266 | slider->setValue( val ); |
250 | } | 267 | } |
251 | if ( slider->maxValue() != width ) { | 268 | if ( slider->maxValue() != width ) { |
252 | slider->setMaxValue( width ); | 269 | slider->setMaxValue( width ); |
253 | } | 270 | } |
254 | } | 271 | } |
255 | } | 272 | } |
256 | 273 | ||
257 | void VideoWidget::setToggleButton( int i, bool down ) { | 274 | void VideoWidget::setToggleButton( int i, bool down ) { |
258 | if ( down != videoButtons[i].isDown ) { | 275 | if ( down != videoButtons[i].isDown ) { |
259 | toggleButton( i ); | 276 | toggleButton( i ); |
260 | } | 277 | } |
261 | } | 278 | } |
262 | 279 | ||
263 | void VideoWidget::toggleButton( int i ) { | 280 | void VideoWidget::toggleButton( int i ) { |
264 | videoButtons[i].isDown = !videoButtons[i].isDown; | 281 | videoButtons[i].isDown = !videoButtons[i].isDown; |
265 | QPainter p(this); | 282 | QPainter p(this); |
266 | paintButton ( &p, i ); | 283 | paintButton ( &p, i ); |
267 | } | 284 | } |
268 | 285 | ||
269 | void VideoWidget::paintButton( QPainter *p, int i ) { | 286 | void VideoWidget::paintButton( QPainter *p, int i ) { |
270 | 287 | ||
271 | if ( videoButtons[i].isDown ) { | 288 | if ( videoButtons[i].isDown ) { |
272 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); | 289 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); |
273 | } else { | 290 | } else { |
274 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); | 291 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); |
275 | } | 292 | } |
276 | } | 293 | } |
277 | 294 | ||
278 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | 295 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { |
279 | for ( int i = 0; i < numVButtons; i++ ) { | 296 | for ( unsigned int i = 0; i < videoButtons.size(); i++ ) { |
280 | if ( event->state() == QMouseEvent::LeftButton ) { | 297 | if ( event->state() == QMouseEvent::LeftButton ) { |
281 | // The test to see if the mouse click is inside the button or not | 298 | // The test to see if the mouse click is inside the button or not |
282 | int x = event->pos().x() - xoff; | 299 | int x = event->pos().x() - xoff; |
283 | int y = event->pos().y() - yoff; | 300 | int y = event->pos().y() - yoff; |
284 | 301 | ||
285 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask.width() | 302 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask.width() |
286 | && y < imgButtonMask.height() | 303 | && y < imgButtonMask.height() |
287 | && imgButtonMask.pixelIndex( x, y ) == i + 1 ); | 304 | && imgButtonMask.pixelIndex( x, y ) == i + 1 ); |
288 | 305 | ||
289 | if ( isOnButton && !videoButtons[i].isHeld ) { | 306 | if ( isOnButton && !videoButtons[i].isHeld ) { |
290 | videoButtons[i].isHeld = TRUE; | 307 | videoButtons[i].isHeld = TRUE; |
291 | toggleButton(i); | 308 | toggleButton(i); |
292 | 309 | ||
293 | switch (i) { | 310 | switch (i) { |
294 | case VideoVolUp: | 311 | case VideoVolUp: |
295 | emit moreClicked(); | 312 | emit moreClicked(); |
296 | return; | 313 | return; |
297 | case VideoVolDown: | 314 | case VideoVolDown: |
298 | emit lessClicked(); | 315 | emit lessClicked(); |
299 | return; | 316 | return; |
300 | } | 317 | } |
301 | } else if ( !isOnButton && videoButtons[i].isHeld ) { | 318 | } else if ( !isOnButton && videoButtons[i].isHeld ) { |
302 | videoButtons[i].isHeld = FALSE; | 319 | videoButtons[i].isHeld = FALSE; |
303 | toggleButton(i); | 320 | toggleButton(i); |
304 | } | 321 | } |
305 | } else { | 322 | } else { |
306 | 323 | ||
307 | if ( videoButtons[i].isHeld ) { | 324 | if ( videoButtons[i].isHeld ) { |
308 | videoButtons[i].isHeld = FALSE; | 325 | videoButtons[i].isHeld = FALSE; |
309 | if ( !videoButtons[i].isToggle ) { | 326 | if ( !videoButtons[i].isToggle ) { |
310 | setToggleButton( i, FALSE ); | 327 | setToggleButton( i, FALSE ); |
311 | } | 328 | } |
312 | 329 | ||
313 | switch(i) { | 330 | switch(i) { |
314 | 331 | ||
315 | case VideoPlay: { | 332 | case VideoPlay: { |
316 | if( mediaPlayerState.isPaused() ) { | 333 | if( mediaPlayerState.isPaused() ) { |
317 | setToggleButton( i, FALSE ); | 334 | setToggleButton( i, FALSE ); |
318 | mediaPlayerState.setPaused( FALSE ); | 335 | mediaPlayerState.setPaused( FALSE ); |
319 | return; | 336 | return; |
320 | } else if( !mediaPlayerState.isPaused() ) { | 337 | } else if( !mediaPlayerState.isPaused() ) { |
321 | setToggleButton( i, TRUE ); | 338 | setToggleButton( i, TRUE ); |
322 | mediaPlayerState.setPaused( TRUE ); | 339 | mediaPlayerState.setPaused( TRUE ); |
323 | return; | 340 | return; |
324 | } else { | 341 | } else { |
325 | return; | 342 | return; |
326 | } | 343 | } |
327 | } | 344 | } |
328 | 345 | ||
329 | case VideoStop: mediaPlayerState.setPlaying( FALSE ); return; | 346 | case VideoStop: mediaPlayerState.setPlaying( FALSE ); return; |
330 | case VideoNext: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; | 347 | case VideoNext: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return; |
331 | case VideoPrevious: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; | 348 | case VideoPrevious: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return; |
332 | case VideoVolUp: emit moreReleased(); return; | 349 | case VideoVolUp: emit moreReleased(); return; |
333 | case VideoVolDown: emit lessReleased(); return; | 350 | case VideoVolDown: emit lessReleased(); return; |
334 | case VideoFullscreen: mediaPlayerState.setFullscreen( TRUE ); makeVisible(); return; | 351 | case VideoFullscreen: mediaPlayerState.setFullscreen( TRUE ); makeVisible(); return; |
335 | } | 352 | } |
336 | } | 353 | } |
337 | } | 354 | } |
338 | } | 355 | } |
339 | } | 356 | } |
340 | 357 | ||
341 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { | 358 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { |
342 | mouseMoveEvent( event ); | 359 | mouseMoveEvent( event ); |
343 | } | 360 | } |
344 | 361 | ||
345 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { | 362 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { |
346 | if ( mediaPlayerState.isFullscreen() ) { | 363 | if ( mediaPlayerState.isFullscreen() ) { |
347 | mediaPlayerState.setFullscreen( FALSE ); | 364 | mediaPlayerState.setFullscreen( FALSE ); |
348 | makeVisible(); | 365 | makeVisible(); |
349 | } | 366 | } |
350 | mouseMoveEvent( event ); | 367 | mouseMoveEvent( event ); |
351 | } | 368 | } |
352 | 369 | ||
353 | void VideoWidget::showEvent( QShowEvent* ) { | 370 | void VideoWidget::showEvent( QShowEvent* ) { |
354 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); | 371 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); |
355 | mouseMoveEvent( &event ); | 372 | mouseMoveEvent( &event ); |
356 | } | 373 | } |
357 | 374 | ||
358 | 375 | ||
359 | void VideoWidget::backToNormal() { | 376 | void VideoWidget::backToNormal() { |
360 | mediaPlayerState.setFullscreen( FALSE ); | 377 | mediaPlayerState.setFullscreen( FALSE ); |
361 | makeVisible(); | 378 | makeVisible(); |
362 | } | 379 | } |
363 | 380 | ||
364 | void VideoWidget::makeVisible() { | 381 | void VideoWidget::makeVisible() { |
365 | if ( mediaPlayerState.isFullscreen() ) { | 382 | if ( mediaPlayerState.isFullscreen() ) { |
366 | setBackgroundMode( QWidget::NoBackground ); | 383 | setBackgroundMode( QWidget::NoBackground ); |
367 | showFullScreen(); | 384 | showFullScreen(); |
368 | resize( qApp->desktop()->size() ); | 385 | resize( qApp->desktop()->size() ); |
369 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); | 386 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); |
370 | 387 | ||
371 | slider->hide(); | 388 | slider->hide(); |
372 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 389 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
373 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 390 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
374 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 391 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
375 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 392 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
376 | 393 | ||
377 | } else { | 394 | } else { |
378 | showNormal(); | 395 | showNormal(); |
379 | showMaximized(); | 396 | showMaximized(); |
380 | setBackgroundPixmap( pixBg ); | 397 | setBackgroundPixmap( pixBg ); |
381 | QWidget *d = QApplication::desktop(); | 398 | QWidget *d = QApplication::desktop(); |
382 | int w = d->width(); | 399 | int w = d->width(); |
383 | int h = d->height(); | 400 | int h = d->height(); |
384 | 401 | ||
385 | if(w>h) { | 402 | if(w>h) { |
386 | int newW=(w/2)-(246/2); //this will only work with 320x240 | 403 | int newW=(w/2)-(246/2); //this will only work with 320x240 |
387 | videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); | 404 | videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); |
388 | } else { | 405 | } else { |
389 | videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); | 406 | videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); |
390 | } | 407 | } |
391 | 408 | ||
392 | if ( !mediaPlayerState.isSeekable() ) { | 409 | if ( !mediaPlayerState.isSeekable() ) { |
393 | if( !slider->isHidden()) { | 410 | if( !slider->isHidden()) { |
394 | slider->hide(); | 411 | slider->hide(); |
395 | } | 412 | } |
396 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 413 | disconnect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
397 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 414 | disconnect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
398 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 415 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
399 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 416 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
400 | } else { | 417 | } else { |
401 | slider->show(); | 418 | slider->show(); |
402 | connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 419 | connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
403 | connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 420 | connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
404 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 421 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
405 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 422 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
406 | } | 423 | } |
407 | } | 424 | } |
408 | } | 425 | } |
409 | 426 | ||
410 | 427 | ||
411 | 428 | ||
412 | 429 | ||
413 | void VideoWidget::paintEvent( QPaintEvent * pe) { | 430 | void VideoWidget::paintEvent( QPaintEvent * pe) { |
414 | QPainter p( this ); | 431 | QPainter p( this ); |
415 | 432 | ||
416 | if ( mediaPlayerState.isFullscreen() ) { | 433 | if ( mediaPlayerState.isFullscreen() ) { |
417 | // Clear the background | 434 | // Clear the background |
418 | p.setBrush( QBrush( Qt::black ) ); | 435 | p.setBrush( QBrush( Qt::black ) ); |
419 | } else { | 436 | } else { |
420 | if ( !pe->erased() ) { | 437 | if ( !pe->erased() ) { |
421 | // Combine with background and double buffer | 438 | // Combine with background and double buffer |
422 | QPixmap pix( pe->rect().size() ); | 439 | QPixmap pix( pe->rect().size() ); |
423 | QPainter p( &pix ); | 440 | QPainter p( &pix ); |
424 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 441 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
425 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); | 442 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); |
426 | for ( int i = 0; i < numVButtons; i++ ) { | 443 | for ( unsigned int i = 0; i < videoButtons.size(); i++ ) { |
427 | paintButton( &p, i ); | 444 | paintButton( &p, i ); |
428 | } | 445 | } |
429 | QPainter p2( this ); | 446 | QPainter p2( this ); |
430 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 447 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
431 | } else { | 448 | } else { |
432 | QPainter p( this ); | 449 | QPainter p( this ); |
433 | for ( int i = 0; i < numVButtons; i++ ) | 450 | for ( unsigned int i = 0; i < videoButtons.size(); i++ ) |
434 | paintButton( &p, i ); | 451 | paintButton( &p, i ); |
435 | } | 452 | } |
436 | //slider->repaint( TRUE ); | 453 | //slider->repaint( TRUE ); |
437 | } | 454 | } |
438 | } | 455 | } |
439 | 456 | ||
440 | 457 | ||
441 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { | 458 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { |
442 | switch ( e->key() ) { | 459 | switch ( e->key() ) { |
443 | ////////////////////////////// Zaurus keys | 460 | ////////////////////////////// Zaurus keys |
444 | case Key_Home: | 461 | case Key_Home: |
445 | break; | 462 | break; |
446 | case Key_F9: //activity | 463 | case Key_F9: //activity |
447 | break; | 464 | break; |
448 | case Key_F10: //contacts | 465 | case Key_F10: //contacts |
449 | // hide(); | 466 | // hide(); |
450 | break; | 467 | break; |
451 | case Key_F11: //menu | 468 | case Key_F11: //menu |
452 | break; | 469 | break; |
453 | case Key_F12: //home | 470 | case Key_F12: //home |
454 | break; | 471 | break; |
455 | case Key_F13: //mail | 472 | case Key_F13: //mail |
456 | break; | 473 | break; |
457 | case Key_Space: { | 474 | case Key_Space: { |
458 | if(mediaPlayerState.isPlaying()) { | 475 | if(mediaPlayerState.isPlaying()) { |
459 | mediaPlayerState.setPlaying(FALSE); | 476 | mediaPlayerState.setPlaying(FALSE); |
460 | } else { | 477 | } else { |
461 | mediaPlayerState.setPlaying(TRUE); | 478 | mediaPlayerState.setPlaying(TRUE); |
462 | } | 479 | } |
463 | } | 480 | } |
464 | break; | 481 | break; |
465 | case Key_Down: | 482 | case Key_Down: |
466 | // toggleButton(6); | 483 | // toggleButton(6); |
467 | emit lessClicked(); | 484 | emit lessClicked(); |
468 | emit lessReleased(); | 485 | emit lessReleased(); |
469 | // toggleButton(6); | 486 | // toggleButton(6); |
470 | break; | 487 | break; |
471 | case Key_Up: | 488 | case Key_Up: |
472 | // toggleButton(5); | 489 | // toggleButton(5); |
473 | emit moreClicked(); | 490 | emit moreClicked(); |
474 | emit moreReleased(); | 491 | emit moreReleased(); |
475 | // toggleButton(5); | 492 | // toggleButton(5); |
476 | break; | 493 | break; |
477 | case Key_Right: | 494 | case Key_Right: |
478 | mediaPlayerState.setNext(); | 495 | mediaPlayerState.setNext(); |
479 | break; | 496 | break; |
480 | case Key_Left: | 497 | case Key_Left: |
481 | mediaPlayerState.setPrev(); | 498 | mediaPlayerState.setPrev(); |
482 | break; | 499 | break; |
483 | case Key_Escape: | 500 | case Key_Escape: |
484 | break; | 501 | break; |
485 | 502 | ||
486 | }; | 503 | }; |
487 | } | 504 | } |
488 | 505 | ||
489 | XineVideoWidget* VideoWidget::vidWidget() { | 506 | XineVideoWidget* VideoWidget::vidWidget() { |
490 | return videoFrame; | 507 | return videoFrame; |
491 | } | 508 | } |
492 | 509 | ||
493 | 510 | ||
494 | void VideoWidget::setFullscreen ( bool b ) { | 511 | void VideoWidget::setFullscreen ( bool b ) { |
495 | setToggleButton( VideoFullscreen, b ); | 512 | setToggleButton( VideoFullscreen, b ); |
496 | } | 513 | } |
497 | 514 | ||
498 | 515 | ||
499 | void VideoWidget::setPlaying( bool b) { | 516 | void VideoWidget::setPlaying( bool b) { |
500 | setToggleButton( VideoPlay, b ); | 517 | setToggleButton( VideoPlay, b ); |
501 | } | 518 | } |
502 | 519 | ||
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index f996803..34558f8 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h | |||
@@ -27,102 +27,104 @@ | |||
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 VIDEO_WIDGET_H | 34 | #ifndef VIDEO_WIDGET_H |
35 | #define VIDEO_WIDGET_H | 35 | #define VIDEO_WIDGET_H |
36 | 36 | ||
37 | #include <qwidget.h> | 37 | #include <qwidget.h> |
38 | #include <qimage.h> | 38 | #include <qimage.h> |
39 | #include <qpixmap.h> | 39 | #include <qpixmap.h> |
40 | #include "xinevideowidget.h" | 40 | #include "xinevideowidget.h" |
41 | 41 | ||
42 | #include "mediawidget.h" | 42 | #include "mediawidget.h" |
43 | 43 | ||
44 | class QPixmap; | 44 | class QPixmap; |
45 | class QSlider; | 45 | class QSlider; |
46 | 46 | ||
47 | enum VideoButtons { | 47 | enum VideoButtons { |
48 | VideoStop = 0, | 48 | VideoStop = 0, |
49 | VideoPlay, | 49 | VideoPlay, |
50 | // VideoPause, | 50 | // VideoPause, |
51 | VideoPrevious, | 51 | VideoPrevious, |
52 | VideoNext, | 52 | VideoNext, |
53 | VideoVolUp, | 53 | VideoVolUp, |
54 | VideoVolDown, | 54 | VideoVolDown, |
55 | VideoFullscreen | 55 | VideoFullscreen |
56 | }; | 56 | }; |
57 | 57 | ||
58 | class VideoWidget : public MediaWidget { | 58 | class VideoWidget : public MediaWidget { |
59 | Q_OBJECT | 59 | Q_OBJECT |
60 | public: | 60 | public: |
61 | VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); | 61 | VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent=0, const char* name=0 ); |
62 | ~VideoWidget(); | 62 | ~VideoWidget(); |
63 | 63 | ||
64 | 64 | ||
65 | XineVideoWidget* vidWidget(); | 65 | XineVideoWidget* vidWidget(); |
66 | public slots: | 66 | public slots: |
67 | void updateSlider( long, long ); | 67 | void updateSlider( long, long ); |
68 | void sliderPressed( ); | 68 | void sliderPressed( ); |
69 | void sliderReleased( ); | 69 | void sliderReleased( ); |
70 | void setFullscreen( bool b ); | 70 | void setFullscreen( bool b ); |
71 | void makeVisible(); | 71 | void makeVisible(); |
72 | void backToNormal(); | 72 | void backToNormal(); |
73 | void setPosition( long ); | 73 | void setPosition( long ); |
74 | 74 | ||
75 | public: | 75 | public: |
76 | virtual void setPlaying( bool b); | 76 | virtual void setPlaying( bool b); |
77 | virtual void setLength( long ); | 77 | virtual void setLength( long ); |
78 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); | 78 | virtual void setDisplayType( MediaPlayerState::DisplayType displayType ); |
79 | 79 | ||
80 | signals: | 80 | signals: |
81 | void moreClicked(); | 81 | void moreClicked(); |
82 | void lessClicked(); | 82 | void lessClicked(); |
83 | void moreReleased(); | 83 | void moreReleased(); |
84 | void lessReleased(); | 84 | void lessReleased(); |
85 | void sliderMoved( long ); | 85 | void sliderMoved( long ); |
86 | void videoResized ( const QSize &s ); | 86 | void videoResized ( const QSize &s ); |
87 | 87 | ||
88 | protected: | 88 | protected: |
89 | 89 | ||
90 | void resizeEvent( QResizeEvent * ); | 90 | void resizeEvent( QResizeEvent * ); |
91 | void paintEvent( QPaintEvent *pe ); | 91 | void paintEvent( QPaintEvent *pe ); |
92 | void showEvent( QShowEvent *se ); | 92 | void showEvent( QShowEvent *se ); |
93 | void mouseMoveEvent( QMouseEvent *event ); | 93 | void mouseMoveEvent( QMouseEvent *event ); |
94 | void mousePressEvent( QMouseEvent *event ); | 94 | void mousePressEvent( QMouseEvent *event ); |
95 | void mouseReleaseEvent( QMouseEvent *event ); | 95 | void mouseReleaseEvent( QMouseEvent *event ); |
96 | void keyReleaseEvent( QKeyEvent *e); | 96 | void keyReleaseEvent( QKeyEvent *e); |
97 | 97 | ||
98 | private: | 98 | private: |
99 | // Ticker songInfo; | 99 | // Ticker songInfo; |
100 | QPixmap pixBg; | 100 | QPixmap pixBg; |
101 | QImage imgUp; | 101 | QImage imgUp; |
102 | QImage imgDn; | 102 | QImage imgDn; |
103 | QImage imgButtonMask; | 103 | QImage imgButtonMask; |
104 | QBitmap *masks[7]; | 104 | QBitmap *masks[7]; |
105 | QPixmap *buttonPixUp[7]; | 105 | QPixmap *buttonPixUp[7]; |
106 | QPixmap *buttonPixDown[7]; | 106 | QPixmap *buttonPixDown[7]; |
107 | QString skin; | 107 | QString skin; |
108 | // QPixmap *pixmaps[4]; | 108 | // QPixmap *pixmaps[4]; |
109 | int xoff, yoff; | 109 | int xoff, yoff; |
110 | 110 | ||
111 | 111 | ||
112 | void paintButton( QPainter *p, int i ); | 112 | void paintButton( QPainter *p, int i ); |
113 | void toggleButton( int ); | 113 | void toggleButton( int ); |
114 | void setToggleButton( int, bool ); | 114 | void setToggleButton( int, bool ); |
115 | 115 | ||
116 | QString backgroundPix; | 116 | QString backgroundPix; |
117 | QSlider *slider; | 117 | QSlider *slider; |
118 | QPixmap *pixmaps[3]; | 118 | QPixmap *pixmaps[3]; |
119 | QImage *currentFrame; | 119 | QImage *currentFrame; |
120 | int scaledWidth; | 120 | int scaledWidth; |
121 | int scaledHeight; | 121 | int scaledHeight; |
122 | XineVideoWidget* videoFrame; | 122 | XineVideoWidget* videoFrame; |
123 | |||
124 | ButtonVector videoButtons; | ||
123 | }; | 125 | }; |
124 | 126 | ||
125 | #endif // VIDEO_WIDGET_H | 127 | #endif // VIDEO_WIDGET_H |
126 | 128 | ||
127 | 129 | ||
128 | 130 | ||