summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-08 21:22:34 (UTC)
committer simon <simon>2002-12-08 21:22:34 (UTC)
commit10cf937a493866cfa0df9569f67c8cad25c62a5b (patch) (unidiff)
tree95719a27fb96ecb6c115f7816265a0377787db64
parenta78a8d830d81adc8c6e9b2131329d72aa0c18b55 (diff)
downloadopie-10cf937a493866cfa0df9569f67c8cad25c62a5b.zip
opie-10cf937a493866cfa0df9569f67c8cad25c62a5b.tar.gz
opie-10cf937a493866cfa0df9569f67c8cad25c62a5b.tar.bz2
- unused variables removed
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp22
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h4
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp14
3 files changed, 1 insertions, 39 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 4172da0..7fb3781 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -1,188 +1,166 @@
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#include <opie/oticker.h> 37#include <opie/oticker.h>
38 38
39#include <qwidget.h> 39#include <qwidget.h>
40#include <qpixmap.h> 40#include <qpixmap.h>
41#include <qbutton.h> 41#include <qbutton.h>
42#include <qpainter.h> 42#include <qpainter.h>
43#include <qframe.h> 43#include <qframe.h>
44#include <qlayout.h> 44#include <qlayout.h>
45#include <qdir.h> 45#include <qdir.h>
46#include <stdlib.h> 46#include <stdlib.h>
47#include <stdio.h> 47#include <stdio.h>
48 48
49#include "audiowidget.h" 49#include "audiowidget.h"
50#include "mediaplayerstate.h" 50#include "mediaplayerstate.h"
51#include "playlistwidget.h" 51#include "playlistwidget.h"
52 52
53namespace 53namespace
54{ 54{
55 55
56const int xo = -2; // movable x offset 56const int xo = -2; // movable x offset
57const int yo = 22; // movable y offset 57const int yo = 22; // movable y offset
58 58
59struct MediaButton {
60 bool isToggle, isHeld, isDown;
61};
62
63//Layout information for the audioButtons (and if it is a toggle button or not)
64/*
65MediaWidget::Button audioButtons[] = {
66 { TRUE, FALSE, FALSE }, // play
67 { FALSE, FALSE, FALSE }, // stop
68 { FALSE, FALSE, FALSE }, // next
69 { FALSE, FALSE, FALSE }, // previous
70 { FALSE, FALSE, FALSE }, // volume up
71 { FALSE, FALSE, FALSE }, // volume down
72 { TRUE, FALSE, FALSE }, // repeat/loop
73 { FALSE, FALSE, FALSE }, // playlist
74 { FALSE, FALSE, FALSE }, // forward
75 { FALSE, FALSE, FALSE } // back
76};
77*/
78
79const char * const skin_mask_file_names[10] = { 59const char * const skin_mask_file_names[10] = {
80 "play", "stop", "next", "prev", "up", 60 "play", "stop", "next", "prev", "up",
81 "down", "loop", "playlist", "forward", "back" 61 "down", "loop", "playlist", "forward", "back"
82}; 62};
83 63
84void changeTextColor( QWidget * w) { 64void changeTextColor( QWidget * w) {
85 QPalette p = w->palette(); 65 QPalette p = w->palette();
86 p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); 66 p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) );
87 p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); 67 p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) );
88 w->setPalette( p ); 68 w->setPalette( p );
89} 69}
90 70
91//const int numButtons = (sizeof(audioButtons)/sizeof(MediaWidget::Button));
92
93} 71}
94 72
95AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : 73AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) :
96 74
97 MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) { 75 MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) {
98 76
99 Button defaultButton; 77 Button defaultButton;
100 defaultButton.isToggle = defaultButton.isHeld = defaultButton.isDown = false; 78 defaultButton.isToggle = defaultButton.isHeld = defaultButton.isDown = false;
101 Button toggleButton; 79 Button toggleButton;
102 toggleButton.isToggle = true; 80 toggleButton.isToggle = true;
103 toggleButton.isHeld = toggleButton.isDown = false; 81 toggleButton.isHeld = toggleButton.isDown = false;
104 82
105 audioButtons.reserve( 10 ); 83 audioButtons.reserve( 10 );
106 audioButtons.push_back( toggleButton ); // play 84 audioButtons.push_back( toggleButton ); // play
107 audioButtons.push_back( defaultButton ); // stop 85 audioButtons.push_back( defaultButton ); // stop
108 audioButtons.push_back( defaultButton ); // next 86 audioButtons.push_back( defaultButton ); // next
109 audioButtons.push_back( defaultButton ); // previous 87 audioButtons.push_back( defaultButton ); // previous
110 audioButtons.push_back( defaultButton ); // volume up 88 audioButtons.push_back( defaultButton ); // volume up
111 audioButtons.push_back( defaultButton ); // volume down 89 audioButtons.push_back( defaultButton ); // volume down
112 audioButtons.push_back( toggleButton ); // repeat/loop 90 audioButtons.push_back( toggleButton ); // repeat/loop
113 audioButtons.push_back( defaultButton ); // playlist 91 audioButtons.push_back( defaultButton ); // playlist
114 audioButtons.push_back( defaultButton ); // forward 92 audioButtons.push_back( defaultButton ); // forward
115 audioButtons.push_back( defaultButton ); // back 93 audioButtons.push_back( defaultButton ); // back
116 94
117 setCaption( tr("OpiePlayer") ); 95 setCaption( tr("OpiePlayer") );
118 96
119 Config cfg("OpiePlayer"); 97 Config cfg("OpiePlayer");
120 cfg.setGroup("Options"); 98 cfg.setGroup("Options");
121 skin = cfg.readEntry("Skin","default"); 99 skin = cfg.readEntry("Skin","default");
122 //skin = "scaleTest"; 100 //skin = "scaleTest";
123 // color of background, frame, degree of transparency 101 // color of background, frame, degree of transparency
124 102
125 QString skinPath = "opieplayer2/skins/" + skin; 103 QString skinPath = "opieplayer2/skins/" + skin;
126 pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); 104 pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
127 imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); 105 imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) );
128 imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); 106 imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) );
129 107
130 imgButtonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); 108 imgButtonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 );
131 imgButtonMask.fill( 0 ); 109 imgButtonMask.fill( 0 );
132 110
133 for ( int i = 0; i < 10; i++ ) { 111 for ( int i = 0; i < 10; i++ ) {
134 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png" ); 112 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png" );
135 masks[i] = new QBitmap( filename ); 113 masks[i] = new QBitmap( filename );
136 114
137 if ( !masks[i]->isNull() ) { 115 if ( !masks[i]->isNull() ) {
138 QImage imgMask = masks[i]->convertToImage(); 116 QImage imgMask = masks[i]->convertToImage();
139 uchar **dest = imgButtonMask.jumpTable(); 117 uchar **dest = imgButtonMask.jumpTable();
140 for ( int y = 0; y < imgUp.height(); y++ ) { 118 for ( int y = 0; y < imgUp.height(); y++ ) {
141 uchar *line = dest[y]; 119 uchar *line = dest[y];
142 for ( int x = 0; x < imgUp.width(); x++ ) 120 for ( int x = 0; x < imgUp.width(); x++ )
143 if ( !qRed( imgMask.pixel( x, y ) ) ) 121 if ( !qRed( imgMask.pixel( x, y ) ) )
144 line[x] = i + 1; 122 line[x] = i + 1;
145 } 123 }
146 } 124 }
147 125
148 } 126 }
149 127
150 for ( int i = 0; i < 10; i++ ) { 128 for ( int i = 0; i < 10; i++ ) {
151 buttonPixUp[i] = 0l; 129 buttonPixUp[i] = 0l;
152 buttonPixDown[i] = 0l; 130 buttonPixDown[i] = 0l;
153 } 131 }
154 132
155 setBackgroundPixmap( pixBg ); 133 setBackgroundPixmap( pixBg );
156 134
157 songInfo.setFocusPolicy( QWidget::NoFocus ); 135 songInfo.setFocusPolicy( QWidget::NoFocus );
158// changeTextColor( &songInfo ); 136// changeTextColor( &songInfo );
159// songInfo.setBackgroundColor( QColor( 167, 212, 167 )); 137// songInfo.setBackgroundColor( QColor( 167, 212, 167 ));
160// songInfo.setFrameStyle( QFrame::NoFrame); 138// songInfo.setFrameStyle( QFrame::NoFrame);
161 songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); 139 songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken );
162// songInfo.setForegroundColor(Qt::white); 140// songInfo.setForegroundColor(Qt::white);
163 141
164 slider.setFixedHeight( 20 ); 142 slider.setFixedHeight( 20 );
165 slider.setMinValue( 0 ); 143 slider.setMinValue( 0 );
166 slider.setMaxValue( 1 ); 144 slider.setMaxValue( 1 );
167 slider.setFocusPolicy( QWidget::NoFocus ); 145 slider.setFocusPolicy( QWidget::NoFocus );
168 slider.setBackgroundPixmap( pixBg ); 146 slider.setBackgroundPixmap( pixBg );
169 147
170// Config cofg("qpe"); 148// Config cofg("qpe");
171// cofg.setGroup("Appearance"); 149// cofg.setGroup("Appearance");
172// QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) ); 150// QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) );
173 151
174 time.setFocusPolicy( QWidget::NoFocus ); 152 time.setFocusPolicy( QWidget::NoFocus );
175 time.setAlignment( Qt::AlignCenter ); 153 time.setAlignment( Qt::AlignCenter );
176 154
177// time.setFrame(FALSE); 155// time.setFrame(FALSE);
178// changeTextColor( &time ); 156// changeTextColor( &time );
179 157
180 resizeEvent( NULL ); 158 resizeEvent( NULL );
181 159
182 connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); 160 connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) );
183 connect( &mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); 161 connect( &mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) );
184 162
185 connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); 163 connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) );
186 connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); 164 connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) );
187 connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); 165 connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) );
188 connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); 166 connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) );
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h
index 9cb75ae..8b0d48c 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.h
+++ b/noncore/multimedia/opieplayer2/mediawidget.h
@@ -1,73 +1,71 @@
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> 28#include <vector>
29 29
30class MediaWidget : public QWidget 30class MediaWidget : public QWidget
31{ 31{
32 Q_OBJECT 32 Q_OBJECT
33public: 33public:
34 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 };
35 35
36 struct Button 36 struct Button
37 { 37 {
38 //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 ) {}
41 39
42 bool isToggle : 1; 40 bool isToggle : 1;
43 bool isHeld : 1; 41 bool isHeld : 1;
44 bool isDown : 1; 42 bool isDown : 1;
45 }; 43 };
46 typedef std::vector<Button> ButtonVector; 44 typedef std::vector<Button> ButtonVector;
47 45
48 MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); 46 MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 );
49 virtual ~MediaWidget(); 47 virtual ~MediaWidget();
50 48
51public slots: 49public slots:
52 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; 50 virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0;
53 virtual void setLength( long length ) = 0; 51 virtual void setLength( long length ) = 0;
54 virtual void setPlaying( bool playing ) = 0; 52 virtual void setPlaying( bool playing ) = 0;
55 53
56signals: 54signals:
57 void moreReleased(); 55 void moreReleased();
58 void lessReleased(); 56 void lessReleased();
59 void forwardReleased(); 57 void forwardReleased();
60 void backReleased(); 58 void backReleased();
61 59
62protected: 60protected:
63 virtual void closeEvent( QCloseEvent * ); 61 virtual void closeEvent( QCloseEvent * );
64 62
65 void handleCommand( Command command, bool buttonDown ); 63 void handleCommand( Command command, bool buttonDown );
66 64
67 MediaPlayerState &mediaPlayerState; 65 MediaPlayerState &mediaPlayerState;
68 PlayListWidget &playList; 66 PlayListWidget &playList;
69}; 67};
70 68
71#endif // MEDIAWIDGET_H 69#endif // MEDIAWIDGET_H
72/* vim: et sw=4 ts=4 70/* vim: et sw=4 ts=4
73 */ 71 */
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index efd756c..6e2e03e 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -1,175 +1,161 @@
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
62/*
63MediaWidget::Button videoButtons[] = {
64 { FALSE, FALSE, FALSE }, // stop
65 { TRUE, FALSE, FALSE }, // play
66 { FALSE, FALSE, FALSE }, // previous
67 { FALSE, FALSE, FALSE }, // next
68 { FALSE, FALSE, FALSE }, // volUp
69 { FALSE, FALSE, FALSE }, // volDown
70 { TRUE, FALSE, FALSE } // fullscreen
71};
72*/
73
74const char * const skinV_mask_file_names[7] = { 62const char * const skinV_mask_file_names[7] = {
75"stop","play","back","fwd","up","down","full" 63"stop","play","back","fwd","up","down","full"
76}; 64};
77 65
78//const int numVButtons = (sizeof(videoButtons)/sizeof(MediaWidget::Button));
79
80} 66}
81 67
82VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) 68VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name )
83 : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) 69 : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 )
84{ 70{
85 setCaption( tr("OpiePlayer - Video") ); 71 setCaption( tr("OpiePlayer - Video") );
86 72
87 Button defaultButton; 73 Button defaultButton;
88 defaultButton.isToggle = defaultButton.isHeld = defaultButton.isDown = false; 74 defaultButton.isToggle = defaultButton.isHeld = defaultButton.isDown = false;
89 Button toggleButton; 75 Button toggleButton;
90 toggleButton.isToggle = true; 76 toggleButton.isToggle = true;
91 toggleButton.isHeld = toggleButton.isDown = false; 77 toggleButton.isHeld = toggleButton.isDown = false;
92 78
93 videoButtons.reserve( 7 ); 79 videoButtons.reserve( 7 );
94 videoButtons.push_back( defaultButton ); // stop 80 videoButtons.push_back( defaultButton ); // stop
95 videoButtons.push_back( toggleButton ); // play 81 videoButtons.push_back( toggleButton ); // play
96 videoButtons.push_back( defaultButton ); // previous 82 videoButtons.push_back( defaultButton ); // previous
97 videoButtons.push_back( defaultButton ); // next 83 videoButtons.push_back( defaultButton ); // next
98 videoButtons.push_back( defaultButton ); // volUp 84 videoButtons.push_back( defaultButton ); // volUp
99 videoButtons.push_back( defaultButton ); // volDown 85 videoButtons.push_back( defaultButton ); // volDown
100 videoButtons.push_back( toggleButton ); //fullscreen 86 videoButtons.push_back( toggleButton ); //fullscreen
101 87
102 videoFrame = new XineVideoWidget ( this, "Video frame" ); 88 videoFrame = new XineVideoWidget ( this, "Video frame" );
103 89
104 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); 90 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & )));
105 connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); 91 connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) );
106 92
107 Config cfg("OpiePlayer"); 93 Config cfg("OpiePlayer");
108 cfg.setGroup("Options"); 94 cfg.setGroup("Options");
109 skin = cfg.readEntry("Skin","default"); 95 skin = cfg.readEntry("Skin","default");
110 96
111 QString skinPath = "opieplayer2/skins/" + skin; 97 QString skinPath = "opieplayer2/skins/" + skin;
112 pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); 98 pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
113 imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); 99 imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) );
114 imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); 100 imgDn = QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) );
115 101
116 imgButtonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); 102 imgButtonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 );
117 imgButtonMask.fill( 0 ); 103 imgButtonMask.fill( 0 );
118 104
119 for ( int i = 0; i < 7; i++ ) { 105 for ( int i = 0; i < 7; i++ ) {
120 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" );
121 masks[i] = new QBitmap( filename ); 107 masks[i] = new QBitmap( filename );
122 108
123 if ( !masks[i]->isNull() ) { 109 if ( !masks[i]->isNull() ) {
124 QImage imgMask = masks[i]->convertToImage(); 110 QImage imgMask = masks[i]->convertToImage();
125 uchar **dest = imgButtonMask.jumpTable(); 111 uchar **dest = imgButtonMask.jumpTable();
126 for ( int y = 0; y < imgUp.height(); y++ ) { 112 for ( int y = 0; y < imgUp.height(); y++ ) {
127 uchar *line = dest[y]; 113 uchar *line = dest[y];
128 for ( int x = 0; x < imgUp.width(); x++ ) { 114 for ( int x = 0; x < imgUp.width(); x++ ) {
129 if ( !qRed( imgMask.pixel( x, y ) ) ) 115 if ( !qRed( imgMask.pixel( x, y ) ) )
130 line[x] = i + 1; 116 line[x] = i + 1;
131 } 117 }
132 } 118 }
133 } 119 }
134 } 120 }
135 121
136 for ( int i = 0; i < 7; i++ ) { 122 for ( int i = 0; i < 7; i++ ) {
137 buttonPixUp[i] = NULL; 123 buttonPixUp[i] = NULL;
138 buttonPixDown[i] = NULL; 124 buttonPixDown[i] = NULL;
139 } 125 }
140 126
141 setBackgroundPixmap( pixBg ); 127 setBackgroundPixmap( pixBg );
142 128
143 slider = new QSlider( Qt::Horizontal, this ); 129 slider = new QSlider( Qt::Horizontal, this );
144 slider->setMinValue( 0 ); 130 slider->setMinValue( 0 );
145 slider->setMaxValue( 1 ); 131 slider->setMaxValue( 1 );
146 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); 132 slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) );
147 //slider->setFocusPolicy( QWidget::NoFocus ); 133 //slider->setFocusPolicy( QWidget::NoFocus );
148 134
149 resizeEvent( NULL ); 135 resizeEvent( NULL );
150 136
151 setLength( mediaPlayerState.length() ); 137 setLength( mediaPlayerState.length() );
152 setPosition( mediaPlayerState.position() ); 138 setPosition( mediaPlayerState.position() );
153 setFullscreen( mediaPlayerState.isFullscreen() ); 139 setFullscreen( mediaPlayerState.isFullscreen() );
154 setPlaying( mediaPlayerState.isPlaying() ); 140 setPlaying( mediaPlayerState.isPlaying() );
155} 141}
156 142
157 143
158VideoWidget::~VideoWidget() { 144VideoWidget::~VideoWidget() {
159 145
160 for ( int i = 0; i < 7; i++ ) { 146 for ( int i = 0; i < 7; i++ ) {
161 delete buttonPixUp[i]; 147 delete buttonPixUp[i];
162 delete buttonPixDown[i]; 148 delete buttonPixDown[i];
163 } 149 }
164 150
165 for ( int i = 0; i < 7; i++ ) { 151 for ( int i = 0; i < 7; i++ ) {
166 delete masks[i]; 152 delete masks[i];
167 } 153 }
168 154
169} 155}
170 156
171QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { 157QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
172 QPixmap pix( img.width(), img.height() ); 158 QPixmap pix( img.width(), img.height() );
173 QPainter p( &pix ); 159 QPainter p( &pix );
174 p.drawTiledPixmap( pix.rect(), bg, offset ); 160 p.drawTiledPixmap( pix.rect(), bg, offset );
175 p.drawImage( 0, 0, img ); 161 p.drawImage( 0, 0, img );