summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-02 19:52:45 (UTC)
committer simon <simon>2002-12-02 19:52:45 (UTC)
commit262f335a055e189130a3c0dd7028388ab103504e (patch) (unidiff)
tree9115845fae96d06ca3235ae1b8153b9739cf3be5
parente77f4914311d8a623c084d01a287798440abf01f (diff)
downloadopie-262f335a055e189130a3c0dd7028388ab103504e.zip
opie-262f335a055e189130a3c0dd7028388ab103504e.tar.gz
opie-262f335a055e189130a3c0dd7028388ab103504e.tar.bz2
- less code duplication
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h6
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp4
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h2
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp3
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h8
6 files changed, 14 insertions, 11 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 0b7d470..f4edb79 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -114,99 +114,97 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name) :
114 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" );
115 masks[i] = new QBitmap( filename ); 115 masks[i] = new QBitmap( filename );
116 116
117 if ( !masks[i]->isNull() ) { 117 if ( !masks[i]->isNull() ) {
118 QImage imgMask = masks[i]->convertToImage(); 118 QImage imgMask = masks[i]->convertToImage();
119 uchar **dest = imgButtonMask.jumpTable(); 119 uchar **dest = imgButtonMask.jumpTable();
120 for ( int y = 0; y < imgUp.height(); y++ ) { 120 for ( int y = 0; y < imgUp.height(); y++ ) {
121 uchar *line = dest[y]; 121 uchar *line = dest[y];
122 for ( int x = 0; x < imgUp.width(); x++ ) 122 for ( int x = 0; x < imgUp.width(); x++ )
123 if ( !qRed( imgMask.pixel( x, y ) ) ) 123 if ( !qRed( imgMask.pixel( x, y ) ) )
124 line[x] = i + 1; 124 line[x] = i + 1;
125 } 125 }
126 } 126 }
127 127
128 } 128 }
129 129
130 for ( int i = 0; i < 10; i++ ) { 130 for ( int i = 0; i < 10; i++ ) {
131 buttonPixUp[i] = 0l; 131 buttonPixUp[i] = 0l;
132 buttonPixDown[i] = 0l; 132 buttonPixDown[i] = 0l;
133 } 133 }
134 134
135 setBackgroundPixmap( pixBg ); 135 setBackgroundPixmap( pixBg );
136 136
137 songInfo.setFocusPolicy( QWidget::NoFocus ); 137 songInfo.setFocusPolicy( QWidget::NoFocus );
138// changeTextColor( &songInfo ); 138// changeTextColor( &songInfo );
139// songInfo.setBackgroundColor( QColor( 167, 212, 167 )); 139// songInfo.setBackgroundColor( QColor( 167, 212, 167 ));
140// songInfo.setFrameStyle( QFrame::NoFrame); 140// songInfo.setFrameStyle( QFrame::NoFrame);
141 songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); 141 songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken );
142// songInfo.setForegroundColor(Qt::white); 142// songInfo.setForegroundColor(Qt::white);
143 143
144 slider.setFixedHeight( 20 ); 144 slider.setFixedHeight( 20 );
145 slider.setMinValue( 0 ); 145 slider.setMinValue( 0 );
146 slider.setMaxValue( 1 ); 146 slider.setMaxValue( 1 );
147 slider.setFocusPolicy( QWidget::NoFocus ); 147 slider.setFocusPolicy( QWidget::NoFocus );
148 slider.setBackgroundPixmap( pixBg ); 148 slider.setBackgroundPixmap( pixBg );
149 149
150// Config cofg("qpe"); 150// Config cofg("qpe");
151// cofg.setGroup("Appearance"); 151// cofg.setGroup("Appearance");
152// QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) ); 152// QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) );
153 153
154 time.setFocusPolicy( QWidget::NoFocus ); 154 time.setFocusPolicy( QWidget::NoFocus );
155 time.setAlignment( Qt::AlignCenter ); 155 time.setAlignment( Qt::AlignCenter );
156 156
157// time.setFrame(FALSE); 157// time.setFrame(FALSE);
158// changeTextColor( &time ); 158// changeTextColor( &time );
159 159
160 resizeEvent( NULL ); 160 resizeEvent( NULL );
161 161
162 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) );
163 connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); 162 connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) );
164 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
165 connect( mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); 163 connect( mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) );
166 164
167 connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); 165 connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) );
168 connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); 166 connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) );
169 connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); 167 connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) );
170 connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); 168 connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) );
171 169
172 // Intialise state 170 // Intialise state
173 setLength( mediaPlayerState->length() ); 171 setLength( mediaPlayerState->length() );
174 setPosition( mediaPlayerState->position() ); 172 setPosition( mediaPlayerState->position() );
175 setLooping( mediaPlayerState->isFullscreen() ); 173 setLooping( mediaPlayerState->isFullscreen() );
176 // setPaused( mediaPlayerState->paused() ); 174 // setPaused( mediaPlayerState->paused() );
177 setPlaying( mediaPlayerState->isPlaying() ); 175 setPlaying( mediaPlayerState->isPlaying() );
178 176
179} 177}
180 178
181AudioWidget::~AudioWidget() { 179AudioWidget::~AudioWidget() {
182 180
183 for ( int i = 0; i < 10; i++ ) { 181 for ( int i = 0; i < 10; i++ ) {
184 delete buttonPixUp[i]; 182 delete buttonPixUp[i];
185 delete buttonPixDown[i]; 183 delete buttonPixDown[i];
186 } 184 }
187 for ( int i = 0; i < 10; i++ ) { 185 for ( int i = 0; i < 10; i++ ) {
188 delete masks[i]; 186 delete masks[i];
189 } 187 }
190// mediaPlayerState->setPlaying(false); 188// mediaPlayerState->setPlaying(false);
191} 189}
192 190
193namespace { 191namespace {
194 192
195QPixmap combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { 193QPixmap combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
196 QPixmap pix( img.width(), img.height() ); 194 QPixmap pix( img.width(), img.height() );
197 QPainter p( &pix ); 195 QPainter p( &pix );
198 p.drawTiledPixmap( pix.rect(), bg, offset ); 196 p.drawTiledPixmap( pix.rect(), bg, offset );
199 p.drawImage( 0, 0, img ); 197 p.drawImage( 0, 0, img );
200 return pix; 198 return pix;
201} 199}
202 200
203 201
204QPixmap *maskPixToMask( QPixmap pix, QBitmap mask ) { 202QPixmap *maskPixToMask( QPixmap pix, QBitmap mask ) {
205 QPixmap *pixmap = new QPixmap( pix ); 203 QPixmap *pixmap = new QPixmap( pix );
206 pixmap->setMask( mask ); 204 pixmap->setMask( mask );
207 return pixmap; 205 return pixmap;
208} 206}
209 207
210}; 208};
211 209
212void AudioWidget::resizeEvent( QResizeEvent * ) { 210void AudioWidget::resizeEvent( QResizeEvent * ) {
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h
index 74c5b0e..83927f1 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.h
+++ b/noncore/multimedia/opieplayer2/audiowidget.h
@@ -31,103 +31,103 @@
31 31
32*/ 32*/
33 33
34#ifndef AUDIO_WIDGET_H 34#ifndef AUDIO_WIDGET_H
35#define AUDIO_WIDGET_H 35#define AUDIO_WIDGET_H
36 36
37#include <qpainter.h> 37#include <qpainter.h>
38#include <qdrawutil.h> 38#include <qdrawutil.h>
39#include <qpixmap.h> 39#include <qpixmap.h>
40#include <qstring.h> 40#include <qstring.h>
41#include <qslider.h> 41#include <qslider.h>
42#include <qframe.h> 42#include <qframe.h>
43#include <qlineedit.h> 43#include <qlineedit.h>
44#include <qimage.h> 44#include <qimage.h>
45 45
46#include <opie/oticker.h> 46#include <opie/oticker.h>
47 47
48#include "mediawidget.h" 48#include "mediawidget.h"
49 49
50class QPixmap; 50class QPixmap;
51 51
52namespace { 52namespace {
53 53
54enum AudioButtons { 54enum AudioButtons {
55 AudioPlay=0, 55 AudioPlay=0,
56 AudioStop, 56 AudioStop,
57 AudioNext, 57 AudioNext,
58 AudioPrevious, 58 AudioPrevious,
59 AudioVolumeUp, 59 AudioVolumeUp,
60 AudioVolumeDown, 60 AudioVolumeDown,
61 AudioLoop, 61 AudioLoop,
62 AudioPlayList, 62 AudioPlayList,
63 AudioForward, 63 AudioForward,
64 AudioBack 64 AudioBack
65}; 65};
66}; 66};
67 67
68class AudioWidget : public MediaWidget { 68class AudioWidget : public MediaWidget {
69 Q_OBJECT 69 Q_OBJECT
70public: 70public:
71 AudioWidget( QWidget* parent=0, const char* name=0 ); 71 AudioWidget( QWidget* parent=0, const char* name=0 );
72 ~AudioWidget(); 72 ~AudioWidget();
73 void setTickerText( const QString &text ) { songInfo.setText( text ); } 73 void setTickerText( const QString &text ) { songInfo.setText( text ); }
74public slots: 74public slots:
75 void updateSlider( long, long ); 75 void updateSlider( long, long );
76 void sliderPressed( ); 76 void sliderPressed( );
77 void sliderReleased( ); 77 void sliderReleased( );
78 void setLooping( bool b) { setToggleButton( AudioLoop, b ); } 78 void setLooping( bool b) { setToggleButton( AudioLoop, b ); }
79 void setPlaying( bool b) { setToggleButton( AudioPlay, b ); }
80 void setPosition( long ); 79 void setPosition( long );
81 void setLength( long );
82 void setSeekable( bool ); 80 void setSeekable( bool );
83 81
84public: 82public:
85 void setDisplayType( MediaPlayerState::DisplayType displayType ); 83 virtual void setLength( long );
84 virtual void setPlaying( bool b) { setToggleButton( AudioPlay, b ); }
85 virtual void setDisplayType( MediaPlayerState::DisplayType displayType );
86 86
87signals: 87signals:
88 void moreClicked(); 88 void moreClicked();
89 void lessClicked(); 89 void lessClicked();
90 void moreReleased(); 90 void moreReleased();
91 void lessReleased(); 91 void lessReleased();
92 void forwardClicked(); 92 void forwardClicked();
93 void backClicked(); 93 void backClicked();
94 void forwardReleased(); 94 void forwardReleased();
95 void backReleased(); 95 void backReleased();
96 void sliderMoved(long); 96 void sliderMoved(long);
97 97
98protected: 98protected:
99 void doBlank(); 99 void doBlank();
100 void doUnblank(); 100 void doUnblank();
101 void paintEvent( QPaintEvent *pe ); 101 void paintEvent( QPaintEvent *pe );
102 void showEvent( QShowEvent *se ); 102 void showEvent( QShowEvent *se );
103 void resizeEvent( QResizeEvent *re ); 103 void resizeEvent( QResizeEvent *re );
104 void mouseMoveEvent( QMouseEvent *event ); 104 void mouseMoveEvent( QMouseEvent *event );
105 void mousePressEvent( QMouseEvent *event ); 105 void mousePressEvent( QMouseEvent *event );
106 void mouseReleaseEvent( QMouseEvent *event ); 106 void mouseReleaseEvent( QMouseEvent *event );
107 void timerEvent( QTimerEvent *event ); 107 void timerEvent( QTimerEvent *event );
108 void closeEvent( QCloseEvent *event ); 108 void closeEvent( QCloseEvent *event );
109 void keyReleaseEvent( QKeyEvent *e); 109 void keyReleaseEvent( QKeyEvent *e);
110private slots: 110private slots:
111 void skipFor(); 111 void skipFor();
112 void skipBack(); 112 void skipBack();
113 void stopSkip(); 113 void stopSkip();
114private: 114private:
115 void toggleButton( int ); 115 void toggleButton( int );
116 void setToggleButton( int, bool ); 116 void setToggleButton( int, bool );
117 void paintButton( QPainter *p, int i ); 117 void paintButton( QPainter *p, int i );
118 int skipDirection; 118 int skipDirection;
119 QString skin; 119 QString skin;
120 QPixmap pixBg; 120 QPixmap pixBg;
121 QImage imgUp; 121 QImage imgUp;
122 QImage imgDn; 122 QImage imgDn;
123 QImage imgButtonMask; 123 QImage imgButtonMask;
124 QBitmap *masks[10]; 124 QBitmap *masks[10];
125 QPixmap *buttonPixUp[10]; 125 QPixmap *buttonPixUp[10];
126 QPixmap *buttonPixDown[10]; 126 QPixmap *buttonPixDown[10];
127 127
128 QPixmap *pixmaps[4]; 128 QPixmap *pixmaps[4];
129 OTicker songInfo; 129 OTicker songInfo;
130 QSlider slider; 130 QSlider slider;
131 QLineEdit time; 131 QLineEdit time;
132 int xoff, yoff; 132 int xoff, yoff;
133 bool isStreaming : 1; 133 bool isStreaming : 1;
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp
index 9d1d7fc..83456a0 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.cpp
+++ b/noncore/multimedia/opieplayer2/mediawidget.cpp
@@ -1,37 +1,41 @@
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 20
21#include "mediawidget.h" 21#include "mediawidget.h"
22 22
23extern MediaPlayerState *mediaPlayerState; 23extern MediaPlayerState *mediaPlayerState;
24 24
25MediaWidget::MediaWidget( QWidget *parent, const char *name ) 25MediaWidget::MediaWidget( QWidget *parent, const char *name )
26 : QWidget( parent, name ) 26 : QWidget( parent, name )
27{ 27{
28 connect( mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), 28 connect( mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ),
29 this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); 29 this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) );
30 connect( mediaPlayerState, SIGNAL( lengthChanged( long ) ),
31 this, SLOT( setLength( long ) ) );
32 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ),
33 this, SLOT( setPlaying( bool ) ) );
30} 34}
31 35
32MediaWidget::~MediaWidget() 36MediaWidget::~MediaWidget()
33{ 37{
34} 38}
35 39
36/* vim: et sw=4 ts=4 40/* vim: et sw=4 ts=4
37 */ 41 */
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h
index cbd08e2..fc5198e 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.h
+++ b/noncore/multimedia/opieplayer2/mediawidget.h
@@ -1,40 +1,42 @@
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 26
27class MediaWidget : public QWidget 27class MediaWidget : public QWidget
28{ 28{
29 Q_OBJECT 29 Q_OBJECT
30public: 30public:
31 MediaWidget( QWidget *parent = 0, const char *name = 0 ); 31 MediaWidget( QWidget *parent = 0, const char *name = 0 );
32 virtual ~MediaWidget(); 32 virtual ~MediaWidget();
33 33
34public slots: 34public slots:
35 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; 35 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0;
36 virtual void setLength( long length ) = 0;
37 virtual void setPlaying( bool playing ) = 0;
36}; 38};
37 39
38#endif // MEDIAWIDGET_H 40#endif // MEDIAWIDGET_H
39/* vim: et sw=4 ts=4 41/* vim: et sw=4 ts=4
40 */ 42 */
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index 8a0016e..888fcf4 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -93,99 +93,96 @@ MediaWidget( parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) {
93 93
94 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); 94 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & )));
95 connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); 95 connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) );
96 96
97 Config cfg("OpiePlayer"); 97 Config cfg("OpiePlayer");
98 cfg.setGroup("Options"); 98 cfg.setGroup("Options");
99 skin = cfg.readEntry("Skin","default"); 99 skin = cfg.readEntry("Skin","default");
100 100
101 QString skinPath = "opieplayer2/skins/" + skin; 101 QString skinPath = "opieplayer2/skins/" + skin;
102 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); 102 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
103 imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); 103 imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) );
104 imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); 104 imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) );
105 105
106 imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); 106 imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 );
107 imgButtonMask->fill( 0 ); 107 imgButtonMask->fill( 0 );
108 108
109 for ( int i = 0; i < 7; i++ ) { 109 for ( int i = 0; i < 7; i++ ) {
110 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); 110 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png" );
111 masks[i] = new QBitmap( filename ); 111 masks[i] = new QBitmap( filename );
112 112
113 if ( !masks[i]->isNull() ) { 113 if ( !masks[i]->isNull() ) {
114 QImage imgMask = masks[i]->convertToImage(); 114 QImage imgMask = masks[i]->convertToImage();
115 uchar **dest = imgButtonMask->jumpTable(); 115 uchar **dest = imgButtonMask->jumpTable();
116 for ( int y = 0; y < imgUp->height(); y++ ) { 116 for ( int y = 0; y < imgUp->height(); y++ ) {
117 uchar *line = dest[y]; 117 uchar *line = dest[y];
118 for ( int x = 0; x < imgUp->width(); x++ ) { 118 for ( int x = 0; x < imgUp->width(); x++ ) {
119 if ( !qRed( imgMask.pixel( x, y ) ) ) 119 if ( !qRed( imgMask.pixel( x, y ) ) )
120 line[x] = i + 1; 120 line[x] = i + 1;
121 } 121 }
122 } 122 }
123 } 123 }
124 } 124 }
125 125
126 for ( int i = 0; i < 7; i++ ) { 126 for ( int i = 0; i < 7; i++ ) {
127 buttonPixUp[i] = NULL; 127 buttonPixUp[i] = NULL;
128 buttonPixDown[i] = NULL; 128 buttonPixDown[i] = NULL;
129 } 129 }
130 130
131 setBackgroundPixmap( *pixBg ); 131 setBackgroundPixmap( *pixBg );
132 132
133 slider = new QSlider( Qt::Horizontal, this ); 133 slider = new QSlider( Qt::Horizontal, this );
134 slider->setMinValue( 0 ); 134 slider->setMinValue( 0 );
135 slider->setMaxValue( 1 ); 135 slider->setMaxValue( 1 );
136 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); 136 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) );
137 //slider->setFocusPolicy( QWidget::NoFocus ); 137 //slider->setFocusPolicy( QWidget::NoFocus );
138 138
139 resizeEvent( NULL ); 139 resizeEvent( NULL );
140 140
141 connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) );
142 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
143
144 setLength( mediaPlayerState->length() ); 141 setLength( mediaPlayerState->length() );
145 setPosition( mediaPlayerState->position() ); 142 setPosition( mediaPlayerState->position() );
146 setFullscreen( mediaPlayerState->isFullscreen() ); 143 setFullscreen( mediaPlayerState->isFullscreen() );
147 setPlaying( mediaPlayerState->isPlaying() ); 144 setPlaying( mediaPlayerState->isPlaying() );
148} 145}
149 146
150 147
151VideoWidget::~VideoWidget() { 148VideoWidget::~VideoWidget() {
152 149
153 for ( int i = 0; i < 7; i++ ) { 150 for ( int i = 0; i < 7; i++ ) {
154 delete buttonPixUp[i]; 151 delete buttonPixUp[i];
155 delete buttonPixDown[i]; 152 delete buttonPixDown[i];
156 } 153 }
157 154
158 delete pixBg; 155 delete pixBg;
159 delete imgUp; 156 delete imgUp;
160 delete imgDn; 157 delete imgDn;
161 delete imgButtonMask; 158 delete imgButtonMask;
162 for ( int i = 0; i < 7; i++ ) { 159 for ( int i = 0; i < 7; i++ ) {
163 delete masks[i]; 160 delete masks[i];
164 } 161 }
165 162
166} 163}
167 164
168QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { 165QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
169 QPixmap pix( img.width(), img.height() ); 166 QPixmap pix( img.width(), img.height() );
170 QPainter p( &pix ); 167 QPainter p( &pix );
171 p.drawTiledPixmap( pix.rect(), bg, offset ); 168 p.drawTiledPixmap( pix.rect(), bg, offset );
172 p.drawImage( 0, 0, img ); 169 p.drawImage( 0, 0, img );
173 return new QPixmap( pix ); 170 return new QPixmap( pix );
174} 171}
175 172
176QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) { 173QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) {
177 QPixmap *pixmap = new QPixmap( pix ); 174 QPixmap *pixmap = new QPixmap( pix );
178 pixmap->setMask( mask ); 175 pixmap->setMask( mask );
179 return pixmap; 176 return pixmap;
180} 177}
181 178
182void VideoWidget::resizeEvent( QResizeEvent * ) { 179void VideoWidget::resizeEvent( QResizeEvent * ) {
183 int h = height(); 180 int h = height();
184 int w = width(); 181 int w = width();
185 //int Vh = 160; 182 //int Vh = 160;
186 //int Vw = 220; 183 //int Vw = 220;
187 184
188 slider->setFixedWidth( w - 20 ); 185 slider->setFixedWidth( w - 20 );
189 slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); 186 slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) );
190 slider->setBackgroundOrigin( QWidget::ParentOrigin ); 187 slider->setBackgroundOrigin( QWidget::ParentOrigin );
191 slider->setFocusPolicy( QWidget::NoFocus ); 188 slider->setFocusPolicy( QWidget::NoFocus );
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h
index 8e9dd7e..816ce2e 100644
--- a/noncore/multimedia/opieplayer2/videowidget.h
+++ b/noncore/multimedia/opieplayer2/videowidget.h
@@ -20,103 +20,105 @@
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 "xinevideowidget.h" 38#include "xinevideowidget.h"
39 39
40#include "mediawidget.h" 40#include "mediawidget.h"
41 41
42class QPixmap; 42class QPixmap;
43class QSlider; 43class QSlider;
44 44
45enum VideoButtons { 45enum VideoButtons {
46 VideoStop = 0, 46 VideoStop = 0,
47 VideoPlay, 47 VideoPlay,
48// VideoPause, 48// VideoPause,
49 VideoPrevious, 49 VideoPrevious,
50 VideoNext, 50 VideoNext,
51 VideoVolUp, 51 VideoVolUp,
52 VideoVolDown, 52 VideoVolDown,
53 VideoFullscreen 53 VideoFullscreen
54}; 54};
55 55
56class VideoWidget : public MediaWidget { 56class VideoWidget : public MediaWidget {
57 Q_OBJECT 57 Q_OBJECT
58public: 58public:
59 VideoWidget( QWidget* parent=0, const char* name=0 ); 59 VideoWidget( QWidget* parent=0, const char* name=0 );
60 ~VideoWidget(); 60 ~VideoWidget();
61 61
62 62
63 XineVideoWidget* vidWidget(); 63 XineVideoWidget* vidWidget();
64public slots: 64public slots:
65 void updateSlider( long, long ); 65 void updateSlider( long, long );
66 void sliderPressed( ); 66 void sliderPressed( );
67 void sliderReleased( ); 67 void sliderReleased( );
68 void setPlaying( bool b);
69 void setFullscreen( bool b ); 68 void setFullscreen( bool b );
70 void makeVisible(); 69 void makeVisible();
71 void backToNormal(); 70 void backToNormal();
72 void setPosition( long ); 71 void setPosition( long );
73 void setLength( long ); 72
74 void setDisplayType( MediaPlayerState::DisplayType displayType ); 73public:
74 virtual void setPlaying( bool b);
75 virtual void setLength( long );
76 virtual void setDisplayType( MediaPlayerState::DisplayType displayType );
75 77
76signals: 78signals:
77 void moreClicked(); 79 void moreClicked();
78 void lessClicked(); 80 void lessClicked();
79 void moreReleased(); 81 void moreReleased();
80 void lessReleased(); 82 void lessReleased();
81 void sliderMoved( long ); 83 void sliderMoved( long );
82 void videoResized ( const QSize &s ); 84 void videoResized ( const QSize &s );
83 85
84protected: 86protected:
85 87
86 void resizeEvent( QResizeEvent * ); 88 void resizeEvent( QResizeEvent * );
87 void paintEvent( QPaintEvent *pe ); 89 void paintEvent( QPaintEvent *pe );
88 void showEvent( QShowEvent *se ); 90 void showEvent( QShowEvent *se );
89 void mouseMoveEvent( QMouseEvent *event ); 91 void mouseMoveEvent( QMouseEvent *event );
90 void mousePressEvent( QMouseEvent *event ); 92 void mousePressEvent( QMouseEvent *event );
91 void mouseReleaseEvent( QMouseEvent *event ); 93 void mouseReleaseEvent( QMouseEvent *event );
92 void closeEvent( QCloseEvent *event ); 94 void closeEvent( QCloseEvent *event );
93 void keyReleaseEvent( QKeyEvent *e); 95 void keyReleaseEvent( QKeyEvent *e);
94 96
95private: 97private:
96// Ticker songInfo; 98// Ticker songInfo;
97 QPixmap *pixBg; 99 QPixmap *pixBg;
98 QImage *imgUp; 100 QImage *imgUp;
99 QImage *imgDn; 101 QImage *imgDn;
100 QImage *imgButtonMask; 102 QImage *imgButtonMask;
101 QBitmap *masks[7]; 103 QBitmap *masks[7];
102 QPixmap *buttonPixUp[7]; 104 QPixmap *buttonPixUp[7];
103 QPixmap *buttonPixDown[7]; 105 QPixmap *buttonPixDown[7];
104 QString skin; 106 QString skin;
105// QPixmap *pixmaps[4]; 107// QPixmap *pixmaps[4];
106 int xoff, yoff; 108 int xoff, yoff;
107 109
108 110
109 void paintButton( QPainter *p, int i ); 111 void paintButton( QPainter *p, int i );
110 void toggleButton( int ); 112 void toggleButton( int );
111 void setToggleButton( int, bool ); 113 void setToggleButton( int, bool );
112 114
113 QString backgroundPix; 115 QString backgroundPix;
114 QSlider *slider; 116 QSlider *slider;
115 QPixmap *pixmaps[3]; 117 QPixmap *pixmaps[3];
116 QImage *currentFrame; 118 QImage *currentFrame;
117 int scaledWidth; 119 int scaledWidth;
118 int scaledHeight; 120 int scaledHeight;
119 XineVideoWidget* videoFrame; 121 XineVideoWidget* videoFrame;
120}; 122};
121 123
122#endif // VIDEO_WIDGET_H 124#endif // VIDEO_WIDGET_H