summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp6
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h6
2 files changed, 6 insertions, 6 deletions
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index 77eab71..2f51c82 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -1,179 +1,179 @@
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
56namespace 56namespace
57{ 57{
58 58
59const int xo = 2; // movable x offset 59const int xo = 2; // movable x offset
60const int yo = 0; // movable y offset 60const int yo = 0; // movable y offset
61 61
62const char * const skinV_mask_file_names[7] = { 62const char * const skinV_mask_file_names[7] = {
63"stop","play","back","fwd","up","down","full" 63"play","stop","fwd","back","up","down","full"
64}; 64};
65 65
66} 66}
67 67
68VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) 68VideoWidget::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 defaultButton.isToggle = defaultButton.isHeld = defaultButton.isDown = false; 74 defaultButton.isToggle = defaultButton.isHeld = defaultButton.isDown = false;
75 Button toggleButton; 75 Button toggleButton;
76 toggleButton.isToggle = true; 76 toggleButton.isToggle = true;
77 toggleButton.isHeld = toggleButton.isDown = false; 77 toggleButton.isHeld = toggleButton.isDown = false;
78 78
79 buttons.reserve( 7 ); 79 buttons.reserve( 7 );
80 buttons.push_back( defaultButton ); // stop
81 buttons.push_back( toggleButton ); // play 80 buttons.push_back( toggleButton ); // play
82 buttons.push_back( defaultButton ); // previous 81 buttons.push_back( defaultButton ); // stop
83 buttons.push_back( defaultButton ); // next 82 buttons.push_back( defaultButton ); // next
83 buttons.push_back( defaultButton ); // previous
84 buttons.push_back( defaultButton ); // volUp 84 buttons.push_back( defaultButton ); // volUp
85 buttons.push_back( defaultButton ); // volDown 85 buttons.push_back( defaultButton ); // volDown
86 buttons.push_back( toggleButton ); //fullscreen 86 buttons.push_back( toggleButton ); //fullscreen
87 87
88 videoFrame = new XineVideoWidget ( this, "Video frame" ); 88 videoFrame = new XineVideoWidget ( this, "Video frame" );
89 89
90 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); 90 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & )));
91 connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); 91 connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) );
92 92
93 Config cfg("OpiePlayer"); 93 Config cfg("OpiePlayer");
94 cfg.setGroup("Options"); 94 cfg.setGroup("Options");
95 skin = cfg.readEntry("Skin","default"); 95 skin = cfg.readEntry("Skin","default");
96 96
97 QString skinPath = "opieplayer2/skins/" + skin; 97 QString skinPath = "opieplayer2/skins/" + skin;
98 pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); 98 pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
99 imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); 99 imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) );
100 imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); 100 imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) );
101 101
102 buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); 102 buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 );
103 buttonMask.fill( 0 ); 103 buttonMask.fill( 0 );
104 104
105 for ( int i = 0; i < 7; i++ ) { 105 for ( int i = 0; i < 7; i++ ) {
106 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); 106 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png" );
107 masks[i] = new QBitmap( filename ); 107 masks[i] = new QBitmap( filename );
108 108
109 if ( !masks[i]->isNull() ) { 109 if ( !masks[i]->isNull() ) {
110 QImage imgMask = masks[i]->convertToImage(); 110 QImage imgMask = masks[i]->convertToImage();
111 uchar **dest = buttonMask.jumpTable(); 111 uchar **dest = buttonMask.jumpTable();
112 for ( int y = 0; y < imgUp.height(); y++ ) { 112 for ( int y = 0; y < imgUp.height(); y++ ) {
113 uchar *line = dest[y]; 113 uchar *line = dest[y];
114 for ( int x = 0; x < imgUp.width(); x++ ) { 114 for ( int x = 0; x < imgUp.width(); x++ ) {
115 if ( !qRed( imgMask.pixel( x, y ) ) ) 115 if ( !qRed( imgMask.pixel( x, y ) ) )
116 line[x] = i + 1; 116 line[x] = i + 1;
117 } 117 }
118 } 118 }
119 } 119 }
120 } 120 }
121 121
122 for ( int i = 0; i < 7; i++ ) { 122 for ( int i = 0; i < 7; i++ ) {
123 buttonPixUp[i] = NULL; 123 buttonPixUp[i] = NULL;
124 buttonPixDown[i] = NULL; 124 buttonPixDown[i] = NULL;
125 } 125 }
126 126
127 setBackgroundPixmap( pixBg ); 127 setBackgroundPixmap( pixBg );
128 128
129 slider = new QSlider( Qt::Horizontal, this ); 129 slider = new QSlider( Qt::Horizontal, this );
130 slider->setMinValue( 0 ); 130 slider->setMinValue( 0 );
131 slider->setMaxValue( 1 ); 131 slider->setMaxValue( 1 );
132 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); 132 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) );
133 //slider->setFocusPolicy( QWidget::NoFocus ); 133 //slider->setFocusPolicy( QWidget::NoFocus );
134 134
135 resizeEvent( NULL ); 135 resizeEvent( NULL );
136 136
137 setLength( mediaPlayerState.length() ); 137 setLength( mediaPlayerState.length() );
138 setPosition( mediaPlayerState.position() ); 138 setPosition( mediaPlayerState.position() );
139 setFullscreen( mediaPlayerState.isFullscreen() ); 139 setFullscreen( mediaPlayerState.isFullscreen() );
140 setPlaying( mediaPlayerState.isPlaying() ); 140 setPlaying( mediaPlayerState.isPlaying() );
141} 141}
142 142
143 143
144VideoWidget::~VideoWidget() { 144VideoWidget::~VideoWidget() {
145 145
146 for ( int i = 0; i < 7; i++ ) { 146 for ( int i = 0; i < 7; i++ ) {
147 delete buttonPixUp[i]; 147 delete buttonPixUp[i];
148 delete buttonPixDown[i]; 148 delete buttonPixDown[i];
149 } 149 }
150 150
151 for ( int i = 0; i < 7; i++ ) { 151 for ( int i = 0; i < 7; i++ ) {
152 delete masks[i]; 152 delete masks[i];
153 } 153 }
154 154
155} 155}
156 156
157QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { 157QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
158 QPixmap pix( img.width(), img.height() ); 158 QPixmap pix( img.width(), img.height() );
159 QPainter p( &pix ); 159 QPainter p( &pix );
160 p.drawTiledPixmap( pix.rect(), bg, offset ); 160 p.drawTiledPixmap( pix.rect(), bg, offset );
161 p.drawImage( 0, 0, img ); 161 p.drawImage( 0, 0, img );
162 return new QPixmap( pix ); 162 return new QPixmap( pix );
163} 163}
164 164
165QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) { 165QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) {
166 QPixmap *pixmap = new QPixmap( pix ); 166 QPixmap *pixmap = new QPixmap( pix );
167 pixmap->setMask( mask ); 167 pixmap->setMask( mask );
168 return pixmap; 168 return pixmap;
169} 169}
170 170
171void VideoWidget::resizeEvent( QResizeEvent * ) { 171void VideoWidget::resizeEvent( QResizeEvent * ) {
172 int h = height(); 172 int h = height();
173 int w = width(); 173 int w = width();
174 //int Vh = 160; 174 //int Vh = 160;
175 //int Vw = 220; 175 //int Vw = 220;
176 176
177 slider->setFixedWidth( w - 20 ); 177 slider->setFixedWidth( w - 20 );
178 slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); 178 slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) );
179 slider->setBackgroundOrigin( QWidget::ParentOrigin ); 179 slider->setBackgroundOrigin( QWidget::ParentOrigin );
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h
index 24e8741..cb6171c 100644
--- a/noncore/multimedia/opieplayer2/videowidget.h
+++ b/noncore/multimedia/opieplayer2/videowidget.h
@@ -1,125 +1,125 @@
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#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
44class QPixmap; 44class QPixmap;
45class QSlider; 45class QSlider;
46 46
47enum VideoButtons { 47enum VideoButtons {
48 VideoStop = 0, 48 VideoPlay = 0,
49 VideoPlay, 49 VideoStop,
50// VideoPause, 50// VideoPause,
51 VideoPrevious,
52 VideoNext, 51 VideoNext,
52 VideoPrevious,
53 VideoVolUp, 53 VideoVolUp,
54 VideoVolDown, 54 VideoVolDown,
55 VideoFullscreen 55 VideoFullscreen
56}; 56};
57 57
58class VideoWidget : public MediaWidget { 58class VideoWidget : public MediaWidget {
59 Q_OBJECT 59 Q_OBJECT
60public: 60public:
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();
66public slots: 66public 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
75public: 75public:
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
80signals: 80signals:
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
88protected: 88protected:
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
98private: 98private:
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 QBitmap *masks[7]; 103 QBitmap *masks[7];
104 QPixmap *buttonPixUp[7]; 104 QPixmap *buttonPixUp[7];
105 QPixmap *buttonPixDown[7]; 105 QPixmap *buttonPixDown[7];
106 QString skin; 106 QString skin;
107// QPixmap *pixmaps[4]; 107// QPixmap *pixmaps[4];
108 108
109 109
110 virtual void paintButton( QPainter &p, int i ); 110 virtual void paintButton( QPainter &p, int i );
111 void setToggleButton( int, bool ); 111 void setToggleButton( int, bool );
112 112
113 QString backgroundPix; 113 QString backgroundPix;
114 QSlider *slider; 114 QSlider *slider;
115 QPixmap *pixmaps[3]; 115 QPixmap *pixmaps[3];
116 QImage *currentFrame; 116 QImage *currentFrame;
117 int scaledWidth; 117 int scaledWidth;
118 int scaledHeight; 118 int scaledHeight;
119 XineVideoWidget* videoFrame; 119 XineVideoWidget* videoFrame;
120}; 120};
121 121
122#endif // VIDEO_WIDGET_H 122#endif // VIDEO_WIDGET_H
123 123
124 124
125 125