author | zecke <zecke> | 2004-03-14 18:05:28 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-03-14 18:05:28 (UTC) |
commit | 9e54b8bd8343af7c301da17d82596d6027e53309 (patch) (unidiff) | |
tree | 693613ff9f1a0f3415e0623e636d47ac4798da2d | |
parent | 98bbe5561e8e1a862e19a3d0a0d49ed90ef15b54 (diff) | |
download | opie-9e54b8bd8343af7c301da17d82596d6027e53309.zip opie-9e54b8bd8343af7c301da17d82596d6027e53309.tar.gz opie-9e54b8bd8343af7c301da17d82596d6027e53309.tar.bz2 |
OpiePlayer -> ODP
12 files changed, 23 insertions, 7 deletions
diff --git a/core/multimedia/opieplayer/audiowidget.cpp b/core/multimedia/opieplayer/audiowidget.cpp index 8bcc567..7da2d54 100644 --- a/core/multimedia/opieplayer/audiowidget.cpp +++ b/core/multimedia/opieplayer/audiowidget.cpp | |||
@@ -1,228 +1,229 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qpe/qpeapplication.h> | 20 | #include <qpe/qpeapplication.h> |
21 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
22 | #include <qpe/config.h> | 22 | #include <qpe/config.h> |
23 | 23 | ||
24 | #include <qdir.h> | 24 | #include <qdir.h> |
25 | #include "audiowidget.h" | 25 | #include "audiowidget.h" |
26 | #include "mediaplayerstate.h" | 26 | #include "mediaplayerstate.h" |
27 | 27 | ||
28 | #include <stdlib.h> | 28 | #include <stdlib.h> |
29 | #include <stdio.h> | 29 | #include <stdio.h> |
30 | 30 | ||
31 | extern MediaPlayerState *mediaPlayerState; | 31 | extern MediaPlayerState *mediaPlayerState; |
32 | 32 | ||
33 | 33 | ||
34 | static const int xo = -2; // movable x offset | 34 | static const int xo = -2; // movable x offset |
35 | static const int yo = 22; // movable y offset | 35 | static const int yo = 22; // movable y offset |
36 | 36 | ||
37 | using namespace Opie::Ui; | ||
37 | struct MediaButton { | 38 | struct MediaButton { |
38 | bool isToggle, isHeld, isDown; | 39 | bool isToggle, isHeld, isDown; |
39 | }; | 40 | }; |
40 | 41 | ||
41 | //Layout information for the audioButtons (and if it is a toggle button or not) | 42 | //Layout information for the audioButtons (and if it is a toggle button or not) |
42 | MediaButton audioButtons[] = { | 43 | MediaButton audioButtons[] = { |
43 | { TRUE, FALSE, FALSE }, // play | 44 | { TRUE, FALSE, FALSE }, // play |
44 | { FALSE, FALSE, FALSE }, // stop | 45 | { FALSE, FALSE, FALSE }, // stop |
45 | { FALSE, FALSE, FALSE }, // next | 46 | { FALSE, FALSE, FALSE }, // next |
46 | { FALSE, FALSE, FALSE }, // previous | 47 | { FALSE, FALSE, FALSE }, // previous |
47 | { FALSE, FALSE, FALSE }, // volume up | 48 | { FALSE, FALSE, FALSE }, // volume up |
48 | { FALSE, FALSE, FALSE }, // volume down | 49 | { FALSE, FALSE, FALSE }, // volume down |
49 | { TRUE, FALSE, FALSE }, // repeat/loop | 50 | { TRUE, FALSE, FALSE }, // repeat/loop |
50 | { FALSE, FALSE, FALSE }, // playlist | 51 | { FALSE, FALSE, FALSE }, // playlist |
51 | { FALSE, FALSE, FALSE }, // forward | 52 | { FALSE, FALSE, FALSE }, // forward |
52 | { FALSE, FALSE, FALSE } // back | 53 | { FALSE, FALSE, FALSE } // back |
53 | }; | 54 | }; |
54 | 55 | ||
55 | const char *skin_mask_file_names[10] = { | 56 | const char *skin_mask_file_names[10] = { |
56 | "play", "stop", "next", "prev", "up", | 57 | "play", "stop", "next", "prev", "up", |
57 | "down", "loop", "playlist", "forward", "back" | 58 | "down", "loop", "playlist", "forward", "back" |
58 | }; | 59 | }; |
59 | 60 | ||
60 | static void changeTextColor( QWidget *w ) { | 61 | static void changeTextColor( QWidget *w ) { |
61 | QPalette p = w->palette(); | 62 | QPalette p = w->palette(); |
62 | p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); | 63 | p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); |
63 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); | 64 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); |
64 | w->setPalette( p ); | 65 | w->setPalette( p ); |
65 | } | 66 | } |
66 | 67 | ||
67 | static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); | 68 | static const int numButtons = (sizeof(audioButtons)/sizeof(MediaButton)); |
68 | 69 | ||
69 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : | 70 | AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : |
70 | QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) | 71 | QWidget( parent, name, f ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ) |
71 | { | 72 | { |
72 | setCaption( tr("OpiePlayer") ); | 73 | setCaption( tr("OpiePlayer") ); |
73 | // qDebug("<<<<<audioWidget"); | 74 | // qDebug("<<<<<audioWidget"); |
74 | 75 | ||
75 | Config cfg("OpiePlayer"); | 76 | Config cfg("OpiePlayer"); |
76 | cfg.setGroup("Options"); | 77 | cfg.setGroup("Options"); |
77 | skin = cfg.readEntry("Skin","default"); | 78 | skin = cfg.readEntry("Skin","default"); |
78 | //skin = "scaleTest"; | 79 | //skin = "scaleTest"; |
79 | // color of background, frame, degree of transparency | 80 | // color of background, frame, degree of transparency |
80 | 81 | ||
81 | // QString skinPath = "opieplayer/skins/" + skin; | 82 | // QString skinPath = "opieplayer/skins/" + skin; |
82 | QString skinPath; | 83 | QString skinPath; |
83 | skinPath = "opieplayer2/skins/" + skin; | 84 | skinPath = "opieplayer2/skins/" + skin; |
84 | if(!QDir(QString(getenv("OPIEDIR")) +"/pics/"+skinPath).exists()) | 85 | if(!QDir(QString(getenv("OPIEDIR")) +"/pics/"+skinPath).exists()) |
85 | skinPath = "opieplayer2/skins/default"; | 86 | skinPath = "opieplayer2/skins/default"; |
86 | 87 | ||
87 | // qDebug("skin path " + skinPath); | 88 | // qDebug("skin path " + skinPath); |
88 | 89 | ||
89 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | 90 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
90 | imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); | 91 | imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); |
91 | imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); | 92 | imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); |
92 | 93 | ||
93 | imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); | 94 | imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); |
94 | imgButtonMask->fill( 0 ); | 95 | imgButtonMask->fill( 0 ); |
95 | 96 | ||
96 | for ( int i = 0; i < 10; i++ ) { | 97 | for ( int i = 0; i < 10; i++ ) { |
97 | QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png"; | 98 | QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png"; |
98 | masks[i] = new QBitmap( filename ); | 99 | masks[i] = new QBitmap( filename ); |
99 | 100 | ||
100 | if ( !masks[i]->isNull() ) { | 101 | if ( !masks[i]->isNull() ) { |
101 | QImage imgMask = masks[i]->convertToImage(); | 102 | QImage imgMask = masks[i]->convertToImage(); |
102 | uchar **dest = imgButtonMask->jumpTable(); | 103 | uchar **dest = imgButtonMask->jumpTable(); |
103 | for ( int y = 0; y < imgUp->height(); y++ ) { | 104 | for ( int y = 0; y < imgUp->height(); y++ ) { |
104 | uchar *line = dest[y]; | 105 | uchar *line = dest[y]; |
105 | for ( int x = 0; x < imgUp->width(); x++ ) | 106 | for ( int x = 0; x < imgUp->width(); x++ ) |
106 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 107 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
107 | line[x] = i + 1; | 108 | line[x] = i + 1; |
108 | } | 109 | } |
109 | } | 110 | } |
110 | 111 | ||
111 | } | 112 | } |
112 | 113 | ||
113 | for ( int i = 0; i < 11; i++ ) { | 114 | for ( int i = 0; i < 11; i++ ) { |
114 | buttonPixUp[i] = NULL; | 115 | buttonPixUp[i] = NULL; |
115 | buttonPixDown[i] = NULL; | 116 | buttonPixDown[i] = NULL; |
116 | } | 117 | } |
117 | 118 | ||
118 | QWidget *d = QApplication::desktop(); | 119 | QWidget *d = QApplication::desktop(); |
119 | int width = d->width(); | 120 | int width = d->width(); |
120 | int height = d->height(); | 121 | int height = d->height(); |
121 | 122 | ||
122 | if( (width != pixBg->width() ) || (height != pixBg->height() ) ) { | 123 | if( (width != pixBg->width() ) || (height != pixBg->height() ) ) { |
123 | // qDebug("<<<<<<<< scale image >>>>>>>>>>>>"); | 124 | // qDebug("<<<<<<<< scale image >>>>>>>>>>>>"); |
124 | QImage img; | 125 | QImage img; |
125 | img = pixBg->convertToImage(); | 126 | img = pixBg->convertToImage(); |
126 | pixBg->convertFromImage( img.smoothScale( width, height)); | 127 | pixBg->convertFromImage( img.smoothScale( width, height)); |
127 | } | 128 | } |
128 | setBackgroundPixmap( *pixBg); | 129 | setBackgroundPixmap( *pixBg); |
129 | 130 | ||
130 | songInfo.setFocusPolicy( QWidget::NoFocus ); | 131 | songInfo.setFocusPolicy( QWidget::NoFocus ); |
131 | 132 | ||
132 | // changeTextColor( &songInfo ); | 133 | // changeTextColor( &songInfo ); |
133 | // songInfo.setBackgroundColor( QColor( 167, 212, 167 )); | 134 | // songInfo.setBackgroundColor( QColor( 167, 212, 167 )); |
134 | // songInfo.setFrameStyle( QFrame::NoFrame); | 135 | // songInfo.setFrameStyle( QFrame::NoFrame); |
135 | // songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); | 136 | // songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); |
136 | //NoFrame | 137 | //NoFrame |
137 | // songInfo.setForegroundColor(Qt::white); | 138 | // songInfo.setForegroundColor(Qt::white); |
138 | 139 | ||
139 | slider.setFixedHeight( 20 ); | 140 | slider.setFixedHeight( 20 ); |
140 | slider.setMinValue( 0 ); | 141 | slider.setMinValue( 0 ); |
141 | slider.setMaxValue( 1 ); | 142 | slider.setMaxValue( 1 ); |
142 | slider.setFocusPolicy( QWidget::NoFocus ); | 143 | slider.setFocusPolicy( QWidget::NoFocus ); |
143 | 144 | ||
144 | slider.setBackgroundPixmap( *pixBg ); | 145 | slider.setBackgroundPixmap( *pixBg ); |
145 | 146 | ||
146 | time.setFocusPolicy( QWidget::NoFocus ); | 147 | time.setFocusPolicy( QWidget::NoFocus ); |
147 | time.setAlignment( Qt::AlignCenter ); | 148 | time.setAlignment( Qt::AlignCenter ); |
148 | time.setFrame(FALSE); | 149 | time.setFrame(FALSE); |
149 | changeTextColor( &time ); | 150 | changeTextColor( &time ); |
150 | 151 | ||
151 | resizeEvent( NULL ); | 152 | resizeEvent( NULL ); |
152 | 153 | ||
153 | connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 154 | connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
154 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 155 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
155 | 156 | ||
156 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); | 157 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); |
157 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); | 158 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); |
158 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); | 159 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); |
159 | // connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); | 160 | // connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( setPaused(bool) ) ); |
160 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | 161 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); |
161 | 162 | ||
162 | // Intialise state | 163 | // Intialise state |
163 | setLength( mediaPlayerState->length() ); | 164 | setLength( mediaPlayerState->length() ); |
164 | setPosition( mediaPlayerState->position() ); | 165 | setPosition( mediaPlayerState->position() ); |
165 | setLooping( mediaPlayerState->fullscreen() ); | 166 | setLooping( mediaPlayerState->fullscreen() ); |
166 | // setPaused( mediaPlayerState->paused() ); | 167 | // setPaused( mediaPlayerState->paused() ); |
167 | setPlaying( mediaPlayerState->playing() ); | 168 | setPlaying( mediaPlayerState->playing() ); |
168 | this->setFocus(); | 169 | this->setFocus(); |
169 | } | 170 | } |
170 | 171 | ||
171 | 172 | ||
172 | AudioWidget::~AudioWidget() { | 173 | AudioWidget::~AudioWidget() { |
173 | // setPlaying( false); | 174 | // setPlaying( false); |
174 | 175 | ||
175 | for ( int i = 0; i < 10; i++ ) { | 176 | for ( int i = 0; i < 10; i++ ) { |
176 | if(buttonPixUp[i]) delete buttonPixUp[i]; | 177 | if(buttonPixUp[i]) delete buttonPixUp[i]; |
177 | if(buttonPixDown[i]) delete buttonPixDown[i]; | 178 | if(buttonPixDown[i]) delete buttonPixDown[i]; |
178 | } | 179 | } |
179 | if(pixBg) delete pixBg; | 180 | if(pixBg) delete pixBg; |
180 | if(imgUp) delete imgUp; | 181 | if(imgUp) delete imgUp; |
181 | if(imgDn) delete imgDn; | 182 | if(imgDn) delete imgDn; |
182 | if(imgButtonMask) delete imgButtonMask; | 183 | if(imgButtonMask) delete imgButtonMask; |
183 | for ( int i = 0; i < 10; i++ ) { | 184 | for ( int i = 0; i < 10; i++ ) { |
184 | if(masks[i]) delete masks[i]; | 185 | if(masks[i]) delete masks[i]; |
185 | } | 186 | } |
186 | } | 187 | } |
187 | 188 | ||
188 | 189 | ||
189 | QPixmap *combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { | 190 | QPixmap *combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { |
190 | QPixmap pix( img.width(), img.height() ); | 191 | QPixmap pix( img.width(), img.height() ); |
191 | QPainter p( &pix ); | 192 | QPainter p( &pix ); |
192 | p.drawTiledPixmap( pix.rect(), bg, offset ); | 193 | p.drawTiledPixmap( pix.rect(), bg, offset ); |
193 | p.drawImage( 0, 0, img ); | 194 | p.drawImage( 0, 0, img ); |
194 | return new QPixmap( pix ); | 195 | return new QPixmap( pix ); |
195 | } | 196 | } |
196 | 197 | ||
197 | 198 | ||
198 | QPixmap *maskPixToMask( QPixmap pix, QBitmap mask ) | 199 | QPixmap *maskPixToMask( QPixmap pix, QBitmap mask ) |
199 | { | 200 | { |
200 | QPixmap *pixmap = new QPixmap( pix ); | 201 | QPixmap *pixmap = new QPixmap( pix ); |
201 | pixmap->setMask( mask ); | 202 | pixmap->setMask( mask ); |
202 | return pixmap; | 203 | return pixmap; |
203 | } | 204 | } |
204 | 205 | ||
205 | 206 | ||
206 | 207 | ||
207 | void AudioWidget::resizeEvent( QResizeEvent * ) { | 208 | void AudioWidget::resizeEvent( QResizeEvent * ) { |
208 | int h = height(); | 209 | int h = height(); |
209 | int w = width(); | 210 | int w = width(); |
210 | 211 | ||
211 | songInfo.setGeometry( QRect( 2, 10, w - 4, 20 ) ); | 212 | songInfo.setGeometry( QRect( 2, 10, w - 4, 20 ) ); |
212 | slider.setFixedWidth( w - 110 ); | 213 | slider.setFixedWidth( w - 110 ); |
213 | slider.setGeometry( QRect( 15, h - 30, w - 90, 20 ) ); | 214 | slider.setGeometry( QRect( 15, h - 30, w - 90, 20 ) ); |
214 | slider.setBackgroundOrigin( QWidget::ParentOrigin ); | 215 | slider.setBackgroundOrigin( QWidget::ParentOrigin ); |
215 | time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); | 216 | time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); |
216 | 217 | ||
217 | xoff = ( w - imgUp->width() ) / 2; | 218 | xoff = ( w - imgUp->width() ) / 2; |
218 | yoff = (( h - imgUp->height() ) / 2) - 10; | 219 | yoff = (( h - imgUp->height() ) / 2) - 10; |
219 | QPoint p( xoff, yoff ); | 220 | QPoint p( xoff, yoff ); |
220 | 221 | ||
221 | QPixmap *pixUp = combineImageWithBackground( *imgUp, *pixBg, p ); | 222 | QPixmap *pixUp = combineImageWithBackground( *imgUp, *pixBg, p ); |
222 | QPixmap *pixDn = combineImageWithBackground( *imgDn, *pixBg, p ); | 223 | QPixmap *pixDn = combineImageWithBackground( *imgDn, *pixBg, p ); |
223 | 224 | ||
224 | for ( int i = 0; i < 10; i++ ) { | 225 | for ( int i = 0; i < 10; i++ ) { |
225 | if ( !masks[i]->isNull() ) { | 226 | if ( !masks[i]->isNull() ) { |
226 | delete buttonPixUp[i]; | 227 | delete buttonPixUp[i]; |
227 | delete buttonPixDown[i]; | 228 | delete buttonPixDown[i]; |
228 | buttonPixUp[i] = maskPixToMask( *pixUp, *masks[i] ); | 229 | buttonPixUp[i] = maskPixToMask( *pixUp, *masks[i] ); |
diff --git a/core/multimedia/opieplayer/audiowidget.h b/core/multimedia/opieplayer/audiowidget.h index 96bc55c..0a7cb26 100644 --- a/core/multimedia/opieplayer/audiowidget.h +++ b/core/multimedia/opieplayer/audiowidget.h | |||
@@ -1,118 +1,118 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | 20 | ||
21 | #ifndef AUDIO_WIDGET_H | 21 | #ifndef AUDIO_WIDGET_H |
22 | #define AUDIO_WIDGET_H | 22 | #define AUDIO_WIDGET_H |
23 | 23 | ||
24 | #include <qwidget.h> | 24 | #include <qwidget.h> |
25 | #include <qpainter.h> | 25 | #include <qpainter.h> |
26 | #include <qdrawutil.h> | 26 | #include <qdrawutil.h> |
27 | #include <qpixmap.h> | 27 | #include <qpixmap.h> |
28 | #include <qbitmap.h> | 28 | #include <qbitmap.h> |
29 | #include <qstring.h> | 29 | #include <qstring.h> |
30 | #include <qslider.h> | 30 | #include <qslider.h> |
31 | #include <qlineedit.h> | 31 | #include <qlineedit.h> |
32 | #include <qframe.h> | 32 | #include <qframe.h> |
33 | 33 | ||
34 | #include <opie/oticker.h> | 34 | #include <opie2/oticker.h> |
35 | 35 | ||
36 | class QPixmap; | 36 | class QPixmap; |
37 | 37 | ||
38 | enum AudioButtons { | 38 | enum AudioButtons { |
39 | AudioPlay=0, | 39 | AudioPlay=0, |
40 | AudioStop, | 40 | AudioStop, |
41 | AudioNext, | 41 | AudioNext, |
42 | AudioPrevious, | 42 | AudioPrevious, |
43 | AudioVolumeUp, | 43 | AudioVolumeUp, |
44 | AudioVolumeDown, | 44 | AudioVolumeDown, |
45 | AudioLoop, | 45 | AudioLoop, |
46 | AudioPlayList, | 46 | AudioPlayList, |
47 | AudioForward, | 47 | AudioForward, |
48 | AudioBack | 48 | AudioBack |
49 | }; | 49 | }; |
50 | 50 | ||
51 | 51 | ||
52 | //#define USE_DBLBUF | 52 | //#define USE_DBLBUF |
53 | 53 | ||
54 | class AudioWidget : public QWidget { | 54 | class AudioWidget : public QWidget { |
55 | Q_OBJECT | 55 | Q_OBJECT |
56 | public: | 56 | public: |
57 | AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); | 57 | AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); |
58 | ~AudioWidget(); | 58 | ~AudioWidget(); |
59 | void setTickerText( const QString &text ) { songInfo.setText( text ); } | 59 | void setTickerText( const QString &text ) { songInfo.setText( text ); } |
60 | bool isStreaming; | 60 | bool isStreaming; |
61 | public slots: | 61 | public slots: |
62 | void updateSlider( long, long ); | 62 | void updateSlider( long, long ); |
63 | void sliderPressed( ); | 63 | void sliderPressed( ); |
64 | void sliderReleased( ); | 64 | void sliderReleased( ); |
65 | // void setPaused( bool b) { setToggleButton( AudioPause, b ); } | 65 | // void setPaused( bool b) { setToggleButton( AudioPause, b ); } |
66 | void setLooping( bool b) { setToggleButton( AudioLoop, b ); } | 66 | void setLooping( bool b) { setToggleButton( AudioLoop, b ); } |
67 | void setPlaying( bool b) { setToggleButton( AudioPlay, b ); } | 67 | void setPlaying( bool b) { setToggleButton( AudioPlay, b ); } |
68 | void setPosition( long ); | 68 | void setPosition( long ); |
69 | void setLength( long ); | 69 | void setLength( long ); |
70 | void setView( char ); | 70 | void setView( char ); |
71 | 71 | ||
72 | signals: | 72 | signals: |
73 | void moreClicked(); | 73 | void moreClicked(); |
74 | void lessClicked(); | 74 | void lessClicked(); |
75 | void moreReleased(); | 75 | void moreReleased(); |
76 | void lessReleased(); | 76 | void lessReleased(); |
77 | void sliderMoved(long); | 77 | void sliderMoved(long); |
78 | void forwardClicked(); | 78 | void forwardClicked(); |
79 | void backClicked(); | 79 | void backClicked(); |
80 | void forwardReleased(); | 80 | void forwardReleased(); |
81 | void backReleased(); | 81 | void backReleased(); |
82 | 82 | ||
83 | protected: | 83 | protected: |
84 | void doBlank(); | 84 | void doBlank(); |
85 | void doUnblank(); | 85 | void doUnblank(); |
86 | void paintEvent( QPaintEvent *pe ); | 86 | void paintEvent( QPaintEvent *pe ); |
87 | void showEvent( QShowEvent *se ); | 87 | void showEvent( QShowEvent *se ); |
88 | void resizeEvent( QResizeEvent *re ); | 88 | void resizeEvent( QResizeEvent *re ); |
89 | void mouseMoveEvent( QMouseEvent *event ); | 89 | void mouseMoveEvent( QMouseEvent *event ); |
90 | void mousePressEvent( QMouseEvent *event ); | 90 | void mousePressEvent( QMouseEvent *event ); |
91 | void mouseReleaseEvent( QMouseEvent *event ); | 91 | void mouseReleaseEvent( QMouseEvent *event ); |
92 | void timerEvent( QTimerEvent *event ); | 92 | void timerEvent( QTimerEvent *event ); |
93 | void closeEvent( QCloseEvent *event ); | 93 | void closeEvent( QCloseEvent *event ); |
94 | void keyReleaseEvent( QKeyEvent *e); | 94 | void keyReleaseEvent( QKeyEvent *e); |
95 | private: | 95 | private: |
96 | void toggleButton( int ); | 96 | void toggleButton( int ); |
97 | void setToggleButton( int, bool ); | 97 | void setToggleButton( int, bool ); |
98 | void paintButton( QPainter *p, int i ); | 98 | void paintButton( QPainter *p, int i ); |
99 | QString skin; | 99 | QString skin; |
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[11]; | 104 | QBitmap *masks[11]; |
105 | QPixmap *buttonPixUp[11]; | 105 | QPixmap *buttonPixUp[11]; |
106 | QPixmap *buttonPixDown[11]; | 106 | QPixmap *buttonPixDown[11]; |
107 | 107 | ||
108 | QPixmap *pixmaps[4]; | 108 | QPixmap *pixmaps[4]; |
109 | OTicker songInfo; | 109 | Opie::Ui::OTicker songInfo; |
110 | QSlider slider; | 110 | QSlider slider; |
111 | QLineEdit time; | 111 | QLineEdit time; |
112 | int xoff, yoff; | 112 | int xoff, yoff; |
113 | 113 | ||
114 | }; | 114 | }; |
115 | 115 | ||
116 | 116 | ||
117 | #endif // AUDIO_WIDGET_H | 117 | #endif // AUDIO_WIDGET_H |
118 | 118 | ||
diff --git a/core/multimedia/opieplayer/config.in b/core/multimedia/opieplayer/config.in index dc1b79a..d25b11f 100644 --- a/core/multimedia/opieplayer/config.in +++ b/core/multimedia/opieplayer/config.in | |||
@@ -1,12 +1,12 @@ | |||
1 | config OPIEPLAYER | 1 | config OPIEPLAYER |
2 | boolean "opie-mediaplayer (mediaplayer that plays mp3, mpeg, and wav)" | 2 | boolean "opie-mediaplayer (mediaplayer that plays mp3, mpeg, and wav)" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIEUI2 |
5 | 5 | ||
6 | source core/multimedia/opieplayer/libflash/config.in | 6 | source core/multimedia/opieplayer/libflash/config.in |
7 | source core/multimedia/opieplayer/libmad/config.in | 7 | source core/multimedia/opieplayer/libmad/config.in |
8 | source core/multimedia/opieplayer/libmpeg3/config.in | 8 | source core/multimedia/opieplayer/libmpeg3/config.in |
9 | source core/multimedia/opieplayer/modplug/config.in | 9 | source core/multimedia/opieplayer/modplug/config.in |
10 | source core/multimedia/opieplayer/wavplugin/config.in | 10 | source core/multimedia/opieplayer/wavplugin/config.in |
11 | source core/multimedia/opieplayer/vorbis/tremor/config.in | 11 | source core/multimedia/opieplayer/vorbis/tremor/config.in |
12 | source core/multimedia/opieplayer/vorbis/config.in | 12 | source core/multimedia/opieplayer/vorbis/config.in |
diff --git a/core/multimedia/opieplayer/inputDialog.cpp b/core/multimedia/opieplayer/inputDialog.cpp index 38b8f53..44a1cdd 100644 --- a/core/multimedia/opieplayer/inputDialog.cpp +++ b/core/multimedia/opieplayer/inputDialog.cpp | |||
@@ -1,59 +1,60 @@ | |||
1 | #include "inputDialog.h" | 1 | #include "inputDialog.h" |
2 | 2 | ||
3 | #include <qpe/resource.h> | 3 | #include <qpe/resource.h> |
4 | 4 | ||
5 | #include <opie/ofiledialog.h> | 5 | #include <opie2/ofiledialog.h> |
6 | 6 | ||
7 | #include <qlineedit.h> | 7 | #include <qlineedit.h> |
8 | #include <qpushbutton.h> | 8 | #include <qpushbutton.h> |
9 | 9 | ||
10 | using namespace Opie::Ui; | ||
10 | InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) | 11 | InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) |
11 | : QDialog( parent, name, modal, fl ) { | 12 | : QDialog( parent, name, modal, fl ) { |
12 | if ( !name ) { | 13 | if ( !name ) { |
13 | setName( "InputDialog" ); | 14 | setName( "InputDialog" ); |
14 | } | 15 | } |
15 | resize( 234, 115); | 16 | resize( 234, 115); |
16 | setMaximumSize( QSize( 240, 40)); | 17 | setMaximumSize( QSize( 240, 40)); |
17 | setCaption( tr( name ) ); | 18 | setCaption( tr( name ) ); |
18 | 19 | ||
19 | QPushButton *browserButton; | 20 | QPushButton *browserButton; |
20 | browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton"); | 21 | browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton"); |
21 | browserButton->setGeometry( QRect( 205, 10, 22, 22)); | 22 | browserButton->setGeometry( QRect( 205, 10, 22, 22)); |
22 | connect( browserButton, SIGNAL(released()),this,SLOT(browse())); | 23 | connect( browserButton, SIGNAL(released()),this,SLOT(browse())); |
23 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); | 24 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); |
24 | LineEdit1->setGeometry( QRect( 4, 10, 190, 22 ) ); | 25 | LineEdit1->setGeometry( QRect( 4, 10, 190, 22 ) ); |
25 | LineEdit1->setFocus(); | 26 | LineEdit1->setFocus(); |
26 | } | 27 | } |
27 | /* | 28 | /* |
28 | * return the current text(input) | 29 | * return the current text(input) |
29 | */ | 30 | */ |
30 | QString InputDialog::text() const { | 31 | QString InputDialog::text() const { |
31 | return LineEdit1->text(); | 32 | return LineEdit1->text(); |
32 | } | 33 | } |
33 | /* | 34 | /* |
34 | * Destroys the object and frees any allocated resources | 35 | * Destroys the object and frees any allocated resources |
35 | */ | 36 | */ |
36 | InputDialog::~InputDialog() { | 37 | InputDialog::~InputDialog() { |
37 | } | 38 | } |
38 | 39 | ||
39 | void InputDialog::browse() { | 40 | void InputDialog::browse() { |
40 | 41 | ||
41 | MimeTypes types; | 42 | MimeTypes types; |
42 | QStringList audio, video, all; | 43 | QStringList audio, video, all; |
43 | audio << "audio/*"; | 44 | audio << "audio/*"; |
44 | audio << "playlist/plain"; | 45 | audio << "playlist/plain"; |
45 | audio << "audio/x-mpegurl"; | 46 | audio << "audio/x-mpegurl"; |
46 | 47 | ||
47 | video << "video/*"; | 48 | video << "video/*"; |
48 | video << "playlist/plain"; | 49 | video << "playlist/plain"; |
49 | 50 | ||
50 | all += audio; | 51 | all += audio; |
51 | all += video; | 52 | all += video; |
52 | types.insert("All Media Files", all ); | 53 | types.insert("All Media Files", all ); |
53 | types.insert("Audio", audio ); | 54 | types.insert("Audio", audio ); |
54 | types.insert("Video", video ); | 55 | types.insert("Video", video ); |
55 | 56 | ||
56 | QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 ); | 57 | QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 ); |
57 | LineEdit1->setText(str); | 58 | LineEdit1->setText(str); |
58 | } | 59 | } |
59 | 60 | ||
diff --git a/core/multimedia/opieplayer/libflash/libflashpluginimpl.cpp b/core/multimedia/opieplayer/libflash/libflashpluginimpl.cpp index af2c07e..b2a1b5d 100644 --- a/core/multimedia/opieplayer/libflash/libflashpluginimpl.cpp +++ b/core/multimedia/opieplayer/libflash/libflashpluginimpl.cpp | |||
@@ -1,70 +1,72 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include "libflashplugin.h" | 20 | #include "libflashplugin.h" |
21 | #include "libflashpluginimpl.h" | 21 | #include "libflashpluginimpl.h" |
22 | 22 | ||
23 | 23 | ||
24 | LibFlashPluginImpl::LibFlashPluginImpl() | 24 | LibFlashPluginImpl::LibFlashPluginImpl() |
25 | : libflashplugin(0), ref(0) | 25 | : libflashplugin(0), ref(0) |
26 | { | 26 | { |
27 | } | 27 | } |
28 | 28 | ||
29 | 29 | ||
30 | LibFlashPluginImpl::~LibFlashPluginImpl() | 30 | LibFlashPluginImpl::~LibFlashPluginImpl() |
31 | { | 31 | { |
32 | if ( libflashplugin ) | 32 | if ( libflashplugin ) |
33 | delete libflashplugin; | 33 | delete libflashplugin; |
34 | } | 34 | } |
35 | 35 | ||
36 | 36 | ||
37 | MediaPlayerDecoder *LibFlashPluginImpl::decoder() | 37 | MediaPlayerDecoder *LibFlashPluginImpl::decoder() |
38 | { | 38 | { |
39 | if ( !libflashplugin ) | 39 | if ( !libflashplugin ) |
40 | libflashplugin = new LibFlashPlugin; | 40 | libflashplugin = new LibFlashPlugin; |
41 | return libflashplugin; | 41 | return libflashplugin; |
42 | } | 42 | } |
43 | 43 | ||
44 | 44 | ||
45 | MediaPlayerEncoder *LibFlashPluginImpl::encoder() | 45 | MediaPlayerEncoder *LibFlashPluginImpl::encoder() |
46 | { | 46 | { |
47 | return NULL; | 47 | return NULL; |
48 | } | 48 | } |
49 | 49 | ||
50 | 50 | ||
51 | #ifndef QT_NO_COMPONENT | 51 | #ifndef QT_NO_COMPONENT |
52 | 52 | ||
53 | 53 | ||
54 | QRESULT LibFlashPluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | 54 | QRESULT LibFlashPluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) |
55 | { | 55 | { |
56 | *iface = 0; | 56 | *iface = 0; |
57 | if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) ) | 57 | if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) ) |
58 | *iface = this, (*iface)->addRef(); | 58 | *iface = this, (*iface)->addRef(); |
59 | else | ||
60 | return QS_FALSE; | ||
59 | return QS_OK; | 61 | return QS_OK; |
60 | } | 62 | } |
61 | 63 | ||
62 | 64 | ||
63 | Q_EXPORT_INTERFACE() | 65 | Q_EXPORT_INTERFACE() |
64 | { | 66 | { |
65 | Q_CREATE_INSTANCE( LibFlashPluginImpl ) | 67 | Q_CREATE_INSTANCE( LibFlashPluginImpl ) |
66 | } | 68 | } |
67 | 69 | ||
68 | 70 | ||
69 | #endif | 71 | #endif |
70 | 72 | ||
diff --git a/core/multimedia/opieplayer/libmad/libmadpluginimpl.cpp b/core/multimedia/opieplayer/libmad/libmadpluginimpl.cpp index 67779e8..b3e01e5 100644 --- a/core/multimedia/opieplayer/libmad/libmadpluginimpl.cpp +++ b/core/multimedia/opieplayer/libmad/libmadpluginimpl.cpp | |||
@@ -1,70 +1,72 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include "libmadplugin.h" | 20 | #include "libmadplugin.h" |
21 | #include "libmadpluginimpl.h" | 21 | #include "libmadpluginimpl.h" |
22 | 22 | ||
23 | 23 | ||
24 | LibMadPluginImpl::LibMadPluginImpl() | 24 | LibMadPluginImpl::LibMadPluginImpl() |
25 | : libmadplugin(0), ref(0) | 25 | : libmadplugin(0), ref(0) |
26 | { | 26 | { |
27 | } | 27 | } |
28 | 28 | ||
29 | 29 | ||
30 | LibMadPluginImpl::~LibMadPluginImpl() | 30 | LibMadPluginImpl::~LibMadPluginImpl() |
31 | { | 31 | { |
32 | if ( libmadplugin ) | 32 | if ( libmadplugin ) |
33 | delete libmadplugin; | 33 | delete libmadplugin; |
34 | } | 34 | } |
35 | 35 | ||
36 | 36 | ||
37 | MediaPlayerDecoder *LibMadPluginImpl::decoder() | 37 | MediaPlayerDecoder *LibMadPluginImpl::decoder() |
38 | { | 38 | { |
39 | if ( !libmadplugin ) | 39 | if ( !libmadplugin ) |
40 | libmadplugin = new LibMadPlugin; | 40 | libmadplugin = new LibMadPlugin; |
41 | return libmadplugin; | 41 | return libmadplugin; |
42 | } | 42 | } |
43 | 43 | ||
44 | 44 | ||
45 | MediaPlayerEncoder *LibMadPluginImpl::encoder() | 45 | MediaPlayerEncoder *LibMadPluginImpl::encoder() |
46 | { | 46 | { |
47 | return NULL; | 47 | return NULL; |
48 | } | 48 | } |
49 | 49 | ||
50 | 50 | ||
51 | #ifndef QT_NO_COMPONENT | 51 | #ifndef QT_NO_COMPONENT |
52 | 52 | ||
53 | 53 | ||
54 | QRESULT LibMadPluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | 54 | QRESULT LibMadPluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) |
55 | { | 55 | { |
56 | *iface = 0; | 56 | *iface = 0; |
57 | if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) ) | 57 | if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) ) |
58 | *iface = this, (*iface)->addRef(); | 58 | *iface = this, (*iface)->addRef(); |
59 | else | ||
60 | return QS_FALSE; | ||
59 | return QS_OK; | 61 | return QS_OK; |
60 | } | 62 | } |
61 | 63 | ||
62 | 64 | ||
63 | Q_EXPORT_INTERFACE() | 65 | Q_EXPORT_INTERFACE() |
64 | { | 66 | { |
65 | Q_CREATE_INSTANCE( LibMadPluginImpl ) | 67 | Q_CREATE_INSTANCE( LibMadPluginImpl ) |
66 | } | 68 | } |
67 | 69 | ||
68 | 70 | ||
69 | #endif | 71 | #endif |
70 | 72 | ||
diff --git a/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.cpp b/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.cpp index bf3f372..f6d34b8 100644 --- a/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.cpp +++ b/core/multimedia/opieplayer/libmpeg3/libmpeg3pluginimpl.cpp | |||
@@ -1,70 +1,72 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include "libmpeg3plugin.h" | 20 | #include "libmpeg3plugin.h" |
21 | #include "libmpeg3pluginimpl.h" | 21 | #include "libmpeg3pluginimpl.h" |
22 | 22 | ||
23 | 23 | ||
24 | LibMpeg3PluginImpl::LibMpeg3PluginImpl() | 24 | LibMpeg3PluginImpl::LibMpeg3PluginImpl() |
25 | : libmpeg3plugin(0), ref(0) | 25 | : libmpeg3plugin(0), ref(0) |
26 | { | 26 | { |
27 | } | 27 | } |
28 | 28 | ||
29 | 29 | ||
30 | LibMpeg3PluginImpl::~LibMpeg3PluginImpl() | 30 | LibMpeg3PluginImpl::~LibMpeg3PluginImpl() |
31 | { | 31 | { |
32 | if ( libmpeg3plugin ) | 32 | if ( libmpeg3plugin ) |
33 | delete libmpeg3plugin; | 33 | delete libmpeg3plugin; |
34 | } | 34 | } |
35 | 35 | ||
36 | 36 | ||
37 | MediaPlayerDecoder *LibMpeg3PluginImpl::decoder() | 37 | MediaPlayerDecoder *LibMpeg3PluginImpl::decoder() |
38 | { | 38 | { |
39 | if ( !libmpeg3plugin ) | 39 | if ( !libmpeg3plugin ) |
40 | libmpeg3plugin = new LibMpeg3Plugin; | 40 | libmpeg3plugin = new LibMpeg3Plugin; |
41 | return libmpeg3plugin; | 41 | return libmpeg3plugin; |
42 | } | 42 | } |
43 | 43 | ||
44 | 44 | ||
45 | MediaPlayerEncoder *LibMpeg3PluginImpl::encoder() | 45 | MediaPlayerEncoder *LibMpeg3PluginImpl::encoder() |
46 | { | 46 | { |
47 | return NULL; | 47 | return NULL; |
48 | } | 48 | } |
49 | 49 | ||
50 | 50 | ||
51 | #ifndef QT_NO_COMPONENT | 51 | #ifndef QT_NO_COMPONENT |
52 | 52 | ||
53 | 53 | ||
54 | QRESULT LibMpeg3PluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | 54 | QRESULT LibMpeg3PluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) |
55 | { | 55 | { |
56 | *iface = 0; | 56 | *iface = 0; |
57 | if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) ) | 57 | if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) ) |
58 | *iface = this, (*iface)->addRef(); | 58 | *iface = this, (*iface)->addRef(); |
59 | else | ||
60 | return QS_FALSE; | ||
59 | return QS_OK; | 61 | return QS_OK; |
60 | } | 62 | } |
61 | 63 | ||
62 | 64 | ||
63 | Q_EXPORT_INTERFACE() | 65 | Q_EXPORT_INTERFACE() |
64 | { | 66 | { |
65 | Q_CREATE_INSTANCE( LibMpeg3PluginImpl ) | 67 | Q_CREATE_INSTANCE( LibMpeg3PluginImpl ) |
66 | } | 68 | } |
67 | 69 | ||
68 | 70 | ||
69 | #endif | 71 | #endif |
70 | 72 | ||
diff --git a/core/multimedia/opieplayer/modplug/modpluginimpl.cpp b/core/multimedia/opieplayer/modplug/modpluginimpl.cpp index 6e64e76..6205779 100644 --- a/core/multimedia/opieplayer/modplug/modpluginimpl.cpp +++ b/core/multimedia/opieplayer/modplug/modpluginimpl.cpp | |||
@@ -1,60 +1,62 @@ | |||
1 | /* This file is part of the KDE project | 1 | /* This file is part of the KDE project |
2 | Copyright (C) 2002 Simon Hausmann <hausmann@kde.org> | 2 | Copyright (C) 2002 Simon Hausmann <hausmann@kde.org> |
3 | 3 | ||
4 | This program is free software; you can redistribute it and/or | 4 | This program is free software; you can redistribute it and/or |
5 | modify it under the terms of the GNU General Public | 5 | modify it under the terms of the GNU 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 program is distributed in the hope that it will be useful, | 9 | This program 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 | General Public License for more details. | 12 | General Public License for more details. |
13 | 13 | ||
14 | You should have received a copy of the GNU General Public License | 14 | You should have received a copy of the GNU General Public License |
15 | along with this program; see the file COPYING. If not, write to | 15 | along with this program; see the file COPYING. 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 | #include "modplugin.h" | 20 | #include "modplugin.h" |
21 | #include "modpluginimpl.h" | 21 | #include "modpluginimpl.h" |
22 | 22 | ||
23 | ModPluginImpl::ModPluginImpl() | 23 | ModPluginImpl::ModPluginImpl() |
24 | :m_plugin( 0 ), ref( 0 ) | 24 | :m_plugin( 0 ), ref( 0 ) |
25 | { | 25 | { |
26 | } | 26 | } |
27 | 27 | ||
28 | ModPluginImpl::~ModPluginImpl() | 28 | ModPluginImpl::~ModPluginImpl() |
29 | { | 29 | { |
30 | delete m_plugin; | 30 | delete m_plugin; |
31 | } | 31 | } |
32 | 32 | ||
33 | #ifndef QT_NO_COMPONENT | 33 | #ifndef QT_NO_COMPONENT |
34 | 34 | ||
35 | QRESULT ModPluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | 35 | QRESULT ModPluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) |
36 | { | 36 | { |
37 | *iface = 0; | 37 | *iface = 0; |
38 | if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) ) | 38 | if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) ) |
39 | *iface = this, (*iface)->addRef(); | 39 | *iface = this, (*iface)->addRef(); |
40 | else | ||
41 | return QS_FALSE; | ||
40 | return QS_OK; | 42 | return QS_OK; |
41 | } | 43 | } |
42 | 44 | ||
43 | Q_EXPORT_INTERFACE() | 45 | Q_EXPORT_INTERFACE() |
44 | { | 46 | { |
45 | Q_CREATE_INSTANCE( ModPluginImpl ) | 47 | Q_CREATE_INSTANCE( ModPluginImpl ) |
46 | } | 48 | } |
47 | 49 | ||
48 | #endif | 50 | #endif |
49 | 51 | ||
50 | MediaPlayerDecoder *ModPluginImpl::decoder() | 52 | MediaPlayerDecoder *ModPluginImpl::decoder() |
51 | { | 53 | { |
52 | if ( !m_plugin ) | 54 | if ( !m_plugin ) |
53 | m_plugin = new ModPlugin; | 55 | m_plugin = new ModPlugin; |
54 | return m_plugin; | 56 | return m_plugin; |
55 | } | 57 | } |
56 | 58 | ||
57 | MediaPlayerEncoder *ModPluginImpl::encoder() | 59 | MediaPlayerEncoder *ModPluginImpl::encoder() |
58 | { | 60 | { |
59 | return 0; | 61 | return 0; |
60 | } | 62 | } |
diff --git a/core/multimedia/opieplayer/opieplayer.pro b/core/multimedia/opieplayer/opieplayer.pro index 03d8a89..d7b0fb8 100644 --- a/core/multimedia/opieplayer/opieplayer.pro +++ b/core/multimedia/opieplayer/opieplayer.pro | |||
@@ -1,21 +1,21 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG = qt warn_on release | 2 | CONFIG = qt warn_on release |
3 | #release | 3 | #release |
4 | DESTDIR = $(OPIEDIR)/bin | 4 | DESTDIR = $(OPIEDIR)/bin |
5 | HEADERS = loopcontrol.h mediaplayerplugininterface.h \ | 5 | HEADERS = loopcontrol.h mediaplayerplugininterface.h \ |
6 | playlistselection.h mediaplayerstate.h \ | 6 | playlistselection.h mediaplayerstate.h \ |
7 | videowidget.h audiowidget.h playlistwidget.h \ | 7 | videowidget.h audiowidget.h playlistwidget.h \ |
8 | mediaplayer.h audiodevice.h inputDialog.h om3u.h | 8 | mediaplayer.h audiodevice.h inputDialog.h om3u.h |
9 | SOURCES = main.cpp \ | 9 | SOURCES = main.cpp \ |
10 | loopcontrol.cpp playlistselection.cpp mediaplayerstate.cpp \ | 10 | loopcontrol.cpp playlistselection.cpp mediaplayerstate.cpp \ |
11 | videowidget.cpp audiowidget.cpp playlistwidget.cpp \ | 11 | videowidget.cpp audiowidget.cpp playlistwidget.cpp \ |
12 | mediaplayer.cpp audiodevice.cpp inputDialog.cpp om3u.cpp | 12 | mediaplayer.cpp audiodevice.cpp inputDialog.cpp om3u.cpp |
13 | TARGET = opieplayer | 13 | TARGET = opieplayer |
14 | INCLUDEPATH += $(OPIEDIR)/include | 14 | INCLUDEPATH += $(OPIEDIR)/include |
15 | DEPENDPATH += $(OPIEDIR)/include | 15 | DEPENDPATH += $(OPIEDIR)/include |
16 | LIBS += -lqpe -lpthread -lopie | 16 | LIBS += -lqpe -lpthread -lopieui2 |
17 | 17 | ||
18 | INCLUDEPATH += $(OPIEDIR)/include | 18 | INCLUDEPATH += $(OPIEDIR)/include |
19 | DEPENDPATH += $(OPIEDIR)/include | 19 | DEPENDPATH += $(OPIEDIR)/include |
20 | 20 | ||
21 | include ( $(OPIEDIR)/include.pro ) | 21 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp index d002c42..164458b 100644 --- a/core/multimedia/opieplayer/videowidget.cpp +++ b/core/multimedia/opieplayer/videowidget.cpp | |||
@@ -376,298 +376,300 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
376 | } | 376 | } |
377 | 377 | ||
378 | case VideoStop: mediaPlayerState->setPlaying( FALSE ); setToggleButton( i+1, true); setToggleButton( i, true ); return; | 378 | case VideoStop: mediaPlayerState->setPlaying( FALSE ); setToggleButton( i+1, true); setToggleButton( i, true ); return; |
379 | case VideoNext: mediaPlayerState->setNext(); return; | 379 | case VideoNext: mediaPlayerState->setNext(); return; |
380 | case VideoPrevious: mediaPlayerState->setPrev(); return; | 380 | case VideoPrevious: mediaPlayerState->setPrev(); return; |
381 | case VideoVolUp: emit moreReleased(); return; | 381 | case VideoVolUp: emit moreReleased(); return; |
382 | case VideoVolDown: emit lessReleased(); return; | 382 | case VideoVolDown: emit lessReleased(); return; |
383 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; | 383 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; |
384 | } | 384 | } |
385 | } | 385 | } |
386 | } | 386 | } |
387 | } | 387 | } |
388 | } | 388 | } |
389 | 389 | ||
390 | 390 | ||
391 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { | 391 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { |
392 | mouseMoveEvent( event ); | 392 | mouseMoveEvent( event ); |
393 | } | 393 | } |
394 | 394 | ||
395 | 395 | ||
396 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { | 396 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { |
397 | if ( mediaPlayerState->fullscreen() ) | 397 | if ( mediaPlayerState->fullscreen() ) |
398 | { | 398 | { |
399 | mediaPlayerState->setFullscreen( FALSE ); | 399 | mediaPlayerState->setFullscreen( FALSE ); |
400 | makeVisible(); | 400 | makeVisible(); |
401 | } | 401 | } |
402 | mouseMoveEvent( event ); | 402 | mouseMoveEvent( event ); |
403 | // } | 403 | // } |
404 | } | 404 | } |
405 | 405 | ||
406 | 406 | ||
407 | void VideoWidget::makeVisible() { | 407 | void VideoWidget::makeVisible() { |
408 | if ( mediaPlayerState->fullscreen() ) | 408 | if ( mediaPlayerState->fullscreen() ) |
409 | { | 409 | { |
410 | setBackgroundMode( QWidget::NoBackground ); | 410 | setBackgroundMode( QWidget::NoBackground ); |
411 | showFullScreen(); | 411 | showFullScreen(); |
412 | resize( qApp->desktop()->size() ); | 412 | resize( qApp->desktop()->size() ); |
413 | slider->hide(); | 413 | slider->hide(); |
414 | } | 414 | } |
415 | else | 415 | else |
416 | { | 416 | { |
417 | setBackgroundPixmap( *pixBg ); | 417 | setBackgroundPixmap( *pixBg ); |
418 | showNormal(); | 418 | showNormal(); |
419 | QPEApplication::showWidget( this ); | 419 | QPEApplication::showWidget( this ); |
420 | slider->show(); | 420 | slider->show(); |
421 | } | 421 | } |
422 | } | 422 | } |
423 | 423 | ||
424 | 424 | ||
425 | void VideoWidget::paintEvent( QPaintEvent * pe) { | 425 | void VideoWidget::paintEvent( QPaintEvent * pe) { |
426 | QPainter p( this ); | 426 | QPainter p( this ); |
427 | 427 | ||
428 | if ( mediaPlayerState->fullscreen() ) { | 428 | if ( mediaPlayerState->fullscreen() ) { |
429 | // Clear the background | 429 | // Clear the background |
430 | p.setBrush( QBrush( Qt::black ) ); | 430 | p.setBrush( QBrush( Qt::black ) ); |
431 | p.drawRect( rect() ); | 431 | p.drawRect( rect() ); |
432 | } else { | 432 | } else { |
433 | if ( !pe->erased() ) { | 433 | if ( !pe->erased() ) { |
434 | // Combine with background and double buffer | 434 | // Combine with background and double buffer |
435 | QPixmap pix( pe->rect().size() ); | 435 | QPixmap pix( pe->rect().size() ); |
436 | QPainter p( &pix ); | 436 | QPainter p( &pix ); |
437 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 437 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
438 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); | 438 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); |
439 | for ( int i = 0; i < numVButtons; i++ ) { | 439 | for ( int i = 0; i < numVButtons; i++ ) { |
440 | paintButton( &p, i ); | 440 | paintButton( &p, i ); |
441 | } | 441 | } |
442 | QPainter p2( this ); | 442 | QPainter p2( this ); |
443 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 443 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
444 | } else { | 444 | } else { |
445 | QPainter p( this ); | 445 | QPainter p( this ); |
446 | for ( int i = 0; i < numVButtons; i++ ) | 446 | for ( int i = 0; i < numVButtons; i++ ) |
447 | paintButton( &p, i ); | 447 | paintButton( &p, i ); |
448 | } | 448 | } |
449 | slider->repaint( TRUE ); | 449 | slider->repaint( TRUE ); |
450 | } | 450 | } |
451 | } | 451 | } |
452 | 452 | ||
453 | 453 | ||
454 | void VideoWidget::closeEvent( QCloseEvent* ) { | 454 | void VideoWidget::closeEvent( QCloseEvent* ) { |
455 | mediaPlayerState->setList(); | 455 | mediaPlayerState->setList(); |
456 | } | 456 | } |
457 | 457 | ||
458 | 458 | ||
459 | bool VideoWidget::playVideo() { | 459 | bool VideoWidget::playVideo() { |
460 | bool result = FALSE; | 460 | bool result = FALSE; |
461 | // qDebug("<<<<<<<<<<<<<<<< play video"); | 461 | // qDebug("<<<<<<<<<<<<<<<< play video"); |
462 | int stream = 0; | 462 | int stream = 0; |
463 | 463 | ||
464 | int sw = mediaPlayerState->curDecoder()->videoWidth( stream ); | 464 | int sw = mediaPlayerState->curDecoder()->videoWidth( stream ); |
465 | int sh = mediaPlayerState->curDecoder()->videoHeight( stream ); | 465 | int sh = mediaPlayerState->curDecoder()->videoHeight( stream ); |
466 | int dd = QPixmap::defaultDepth(); | 466 | int dd = QPixmap::defaultDepth(); |
467 | int w = height(); | 467 | int w = height(); |
468 | int h = width(); | 468 | int h = width(); |
469 | 469 | ||
470 | ColorFormat format = (dd == 16) ? RGB565 : BGRA8888; | 470 | ColorFormat format = (dd == 16) ? RGB565 : BGRA8888; |
471 | 471 | ||
472 | if ( mediaPlayerState->fullscreen() ) | 472 | if ( mediaPlayerState->fullscreen() ) |
473 | { | 473 | { |
474 | #ifdef USE_DIRECT_PAINTER | 474 | #ifdef USE_DIRECT_PAINTER |
475 | QDirectPainter p(this); | 475 | QDirectPainter p(this); |
476 | 476 | ||
477 | if ( ( qt_screen->transformOrientation() == 3 ) && | 477 | if ( ( qt_screen->transformOrientation() == 3 ) && |
478 | ( ( dd == 16 ) || ( dd == 32 ) ) && ( p.numRects() == 1 ) ) | 478 | ( ( dd == 16 ) || ( dd == 32 ) ) && ( p.numRects() == 1 ) ) |
479 | { | 479 | { |
480 | 480 | ||
481 | w = 320; | 481 | w = 320; |
482 | h = 240; | 482 | h = 240; |
483 | 483 | ||
484 | if ( mediaPlayerState->scaled() ) | 484 | if ( mediaPlayerState->scaled() ) |
485 | { | 485 | { |
486 | // maintain aspect ratio | 486 | // maintain aspect ratio |
487 | if ( w * sh > sw * h ) | 487 | if ( w * sh > sw * h ) |
488 | w = sw * h / sh; | 488 | w = sw * h / sh; |
489 | else | 489 | else |
490 | h = sh * w / sw; | 490 | h = sh * w / sw; |
491 | } | 491 | } |
492 | else | 492 | else |
493 | { | 493 | { |
494 | w = sw; | 494 | w = sw; |
495 | h = sh; | 495 | h = sh; |
496 | } | 496 | } |
497 | 497 | ||
498 | w--; // we can't allow libmpeg to overwrite. | 498 | w--; // we can't allow libmpeg to overwrite. |
499 | QPoint roff = qt_screen->mapToDevice( p.offset(), QSize( qt_screen->width(), qt_screen->height() ) ); | 499 | QPoint roff = qt_screen->mapToDevice( p.offset(), QSize( qt_screen->width(), qt_screen->height() ) ); |
500 | 500 | ||
501 | int ox = roff.x() - height() + 2 + (height() - w) / 2; | 501 | int ox = roff.x() - height() + 2 + (height() - w) / 2; |
502 | int oy = roff.y() + (width() - h) / 2; | 502 | int oy = roff.y() + (width() - h) / 2; |
503 | int sx = 0, sy = 0; | 503 | int sx = 0, sy = 0; |
504 | 504 | ||
505 | uchar* fp = p.frameBuffer() + p.lineStep() * oy; | 505 | uchar* fp = p.frameBuffer() + p.lineStep() * oy; |
506 | fp += dd * ox / 8; | 506 | fp += dd * ox / 8; |
507 | uchar **jt = new uchar*[h]; | 507 | uchar **jt = new uchar*[h]; |
508 | 508 | ||
509 | for ( int i = h; i; i-- ) | 509 | for ( int i = h; i; i-- ) |
510 | { | 510 | { |
511 | jt[h - i] = fp; | 511 | jt[h - i] = fp; |
512 | fp += p.lineStep(); | 512 | fp += p.lineStep(); |
513 | } | 513 | } |
514 | 514 | ||
515 | result = mediaPlayerState->curDecoder()->videoReadScaledFrame( jt, sx, sy, sw, sh, w, h, format, 0) == 0; | 515 | result = mediaPlayerState->curDecoder()->videoReadScaledFrame( jt, sx, sy, sw, sh, w, h, format, 0) == 0; |
516 | 516 | ||
517 | delete [] jt; | 517 | delete [] jt; |
518 | } | 518 | } |
519 | else | 519 | else |
520 | { | 520 | { |
521 | #endif | 521 | #endif |
522 | QPainter p(this); | 522 | QPainter p(this); |
523 | 523 | ||
524 | w = 320; | 524 | w = 320; |
525 | h = 240; | 525 | h = 240; |
526 | 526 | ||
527 | if ( mediaPlayerState->scaled() ) | 527 | if ( mediaPlayerState->scaled() ) |
528 | { | 528 | { |
529 | // maintain aspect ratio | 529 | // maintain aspect ratio |
530 | if ( w * sh > sw * h ) | 530 | if ( w * sh > sw * h ) |
531 | w = sw * h / sh; | 531 | w = sw * h / sh; |
532 | else | 532 | else |
533 | h = sh * w / sw; | 533 | h = sh * w / sw; |
534 | } | 534 | } |
535 | else | 535 | else |
536 | { | 536 | { |
537 | w = sw; | 537 | w = sw; |
538 | h = sh; | 538 | h = sh; |
539 | } | 539 | } |
540 | 540 | ||
541 | int bytes = ( dd == 16 ) ? 2 : 4; | 541 | int bytes = ( dd == 16 ) ? 2 : 4; |
542 | QImage tempFrame( w, h, bytes << 3 ); | 542 | QImage tempFrame( w, h, bytes << 3 ); |
543 | result = mediaPlayerState->curDecoder()->videoReadScaledFrame( tempFrame.jumpTable(), | 543 | result = mediaPlayerState->curDecoder()->videoReadScaledFrame( tempFrame.jumpTable(), |
544 | 0, 0, sw, sh, w, h, format, 0) == 0; | 544 | 0, 0, sw, sh, w, h, format, 0) == 0; |
545 | 545 | ||
546 | if ( result && mediaPlayerState->fullscreen() ) | 546 | if ( result && mediaPlayerState->fullscreen() ) |
547 | { | 547 | { |
548 | 548 | ||
549 | int rw = h, rh = w; | 549 | int rw = h, rh = w; |
550 | QImage rotatedFrame( rw, rh, bytes << 3 ); | 550 | QImage rotatedFrame( rw, rh, bytes << 3 ); |
551 | 551 | ||
552 | ushort* in = (ushort*)tempFrame.bits(); | 552 | ushort* in = (ushort*)tempFrame.bits(); |
553 | ushort* out = (ushort*)rotatedFrame.bits(); | 553 | ushort* out = (ushort*)rotatedFrame.bits(); |
554 | int spl = rotatedFrame.bytesPerLine() / bytes; | 554 | int spl = rotatedFrame.bytesPerLine() / bytes; |
555 | 555 | ||
556 | for (int x=0; x<h; x++) | 556 | for (int x=0; x<h; x++) |
557 | { | 557 | { |
558 | if ( bytes == 2 ) | 558 | if ( bytes == 2 ) |
559 | { | 559 | { |
560 | ushort* lout = out++ + (w - 1)*spl; | 560 | ushort* lout = out++ + (w - 1)*spl; |
561 | for (int y=0; y<w; y++) { | 561 | for (int y=0; y<w; y++) { |
562 | *lout=*in++; | 562 | *lout=*in++; |
563 | lout-=spl; | 563 | lout-=spl; |
564 | } | 564 | } |
565 | } | 565 | } |
566 | else | 566 | else |
567 | { | 567 | { |
568 | ulong* lout = ((ulong *)out)++ + (w - 1)*spl; | 568 | ulong* _out = (ulong *)out; |
569 | ulong* lout = _out++ + (w - 1)*spl; | ||
569 | for (int y=0; y<w; y++) | 570 | for (int y=0; y<w; y++) |
570 | { | 571 | { |
571 | *lout=*((ulong*)in)++; | 572 | ulong *_in = (ulong*)in; |
573 | *lout=*_in++; | ||
572 | lout-=spl; | 574 | lout-=spl; |
573 | } | 575 | } |
574 | } | 576 | } |
575 | } | 577 | } |
576 | 578 | ||
577 | p.drawImage( (240 - rw) / 2, (320 - rh) / 2, rotatedFrame, 0, 0, rw, rh ); | 579 | p.drawImage( (240 - rw) / 2, (320 - rh) / 2, rotatedFrame, 0, 0, rw, rh ); |
578 | } | 580 | } |
579 | #ifdef USE_DIRECT_PAINTER | 581 | #ifdef USE_DIRECT_PAINTER |
580 | } | 582 | } |
581 | #endif | 583 | #endif |
582 | } | 584 | } |
583 | else | 585 | else |
584 | { | 586 | { |
585 | 587 | ||
586 | w = 220; | 588 | w = 220; |
587 | h = 160; | 589 | h = 160; |
588 | 590 | ||
589 | // maintain aspect ratio | 591 | // maintain aspect ratio |
590 | if ( w * sh > sw * h ) | 592 | if ( w * sh > sw * h ) |
591 | w = sw * h / sh; | 593 | w = sw * h / sh; |
592 | else | 594 | else |
593 | h = sh * w / sw; | 595 | h = sh * w / sw; |
594 | 596 | ||
595 | result = mediaPlayerState->curDecoder()->videoReadScaledFrame( currentFrame->jumpTable(), 0, 0, sw, sh, w, h, format, 0) == 0; | 597 | result = mediaPlayerState->curDecoder()->videoReadScaledFrame( currentFrame->jumpTable(), 0, 0, sw, sh, w, h, format, 0) == 0; |
596 | 598 | ||
597 | QPainter p( this ); | 599 | QPainter p( this ); |
598 | int deskW = qApp->desktop()->width(); | 600 | int deskW = qApp->desktop()->width(); |
599 | // Image changed size, therefore need to blank the possibly unpainted regions first | 601 | // Image changed size, therefore need to blank the possibly unpainted regions first |
600 | if ( scaledWidth != w || scaledHeight != h ) | 602 | if ( scaledWidth != w || scaledHeight != h ) |
601 | { | 603 | { |
602 | p.setBrush( QBrush( Qt::black ) ); | 604 | p.setBrush( QBrush( Qt::black ) ); |
603 | p.drawRect( ( deskW -scaledWidth)/2, 20, scaledWidth, 160 ); | 605 | p.drawRect( ( deskW -scaledWidth)/2, 20, scaledWidth, 160 ); |
604 | } | 606 | } |
605 | 607 | ||
606 | scaledWidth = w; | 608 | scaledWidth = w; |
607 | scaledHeight = h; | 609 | scaledHeight = h; |
608 | 610 | ||
609 | if ( result ) | 611 | if ( result ) |
610 | { | 612 | { |
611 | p.drawImage( (deskW - scaledWidth) / 2, 20 + (160 - scaledHeight) / 2, *currentFrame, 0, 0, scaledWidth, scaledHeight ); | 613 | p.drawImage( (deskW - scaledWidth) / 2, 20 + (160 - scaledHeight) / 2, *currentFrame, 0, 0, scaledWidth, scaledHeight ); |
612 | } | 614 | } |
613 | 615 | ||
614 | } | 616 | } |
615 | 617 | ||
616 | return result; | 618 | return result; |
617 | } | 619 | } |
618 | 620 | ||
619 | 621 | ||
620 | 622 | ||
621 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) | 623 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) |
622 | { | 624 | { |
623 | switch ( e->key() ) | 625 | switch ( e->key() ) |
624 | { | 626 | { |
625 | ////////////////////////////// Zaurus keys | 627 | ////////////////////////////// Zaurus keys |
626 | case Key_Home: | 628 | case Key_Home: |
627 | break; | 629 | break; |
628 | case Key_F9: //activity | 630 | case Key_F9: //activity |
629 | break; | 631 | break; |
630 | case Key_F10: //contacts | 632 | case Key_F10: //contacts |
631 | // hide(); | 633 | // hide(); |
632 | break; | 634 | break; |
633 | case Key_F11: //menu | 635 | case Key_F11: //menu |
634 | break; | 636 | break; |
635 | case Key_F12: //home | 637 | case Key_F12: //home |
636 | break; | 638 | break; |
637 | case Key_F13: //mail | 639 | case Key_F13: //mail |
638 | break; | 640 | break; |
639 | case Key_Space: | 641 | case Key_Space: |
640 | { | 642 | { |
641 | if(mediaPlayerState->playing()) | 643 | if(mediaPlayerState->playing()) |
642 | { | 644 | { |
643 | mediaPlayerState->setPlaying(FALSE); | 645 | mediaPlayerState->setPlaying(FALSE); |
644 | } | 646 | } |
645 | else | 647 | else |
646 | { | 648 | { |
647 | mediaPlayerState->setPlaying(TRUE); | 649 | mediaPlayerState->setPlaying(TRUE); |
648 | } | 650 | } |
649 | } | 651 | } |
650 | break; | 652 | break; |
651 | case Key_Down: | 653 | case Key_Down: |
652 | // toggleButton(6); | 654 | // toggleButton(6); |
653 | // emit lessClicked(); | 655 | // emit lessClicked(); |
654 | // emit lessReleased(); | 656 | // emit lessReleased(); |
655 | // toggleButton(6); | 657 | // toggleButton(6); |
656 | break; | 658 | break; |
657 | case Key_Up: | 659 | case Key_Up: |
658 | // toggleButton(5); | 660 | // toggleButton(5); |
659 | // emit moreClicked(); | 661 | // emit moreClicked(); |
660 | // emit moreReleased(); | 662 | // emit moreReleased(); |
661 | // toggleButton(5); | 663 | // toggleButton(5); |
662 | break; | 664 | break; |
663 | case Key_Right: | 665 | case Key_Right: |
664 | mediaPlayerState->setNext(); | 666 | mediaPlayerState->setNext(); |
665 | break; | 667 | break; |
666 | case Key_Left: | 668 | case Key_Left: |
667 | mediaPlayerState->setPrev(); | 669 | mediaPlayerState->setPrev(); |
668 | break; | 670 | break; |
669 | case Key_Escape: | 671 | case Key_Escape: |
670 | break; | 672 | break; |
671 | 673 | ||
672 | }; | 674 | }; |
673 | } | 675 | } |
diff --git a/core/multimedia/opieplayer/vorbis/libtremorpluginimpl.cpp b/core/multimedia/opieplayer/vorbis/libtremorpluginimpl.cpp index 440747a..0c7b1ea 100644 --- a/core/multimedia/opieplayer/vorbis/libtremorpluginimpl.cpp +++ b/core/multimedia/opieplayer/vorbis/libtremorpluginimpl.cpp | |||
@@ -1,71 +1,73 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | * libtremorpluginimpl.cpp | 2 | * libtremorpluginimpl.cpp |
3 | * | 3 | * |
4 | * Copyright (C) 2002 Latchesar Ionkov <lucho@ionkov.net> | 4 | * Copyright (C) 2002 Latchesar Ionkov <lucho@ionkov.net> |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
8 | * the Free Software Foundation; either version 2 of the License, or | 8 | * the Free Software Foundation; either version 2 of the License, or |
9 | * (at your option) any later version. | 9 | * (at your option) any later version. |
10 | * | 10 | * |
11 | * This program is distributed in the hope that it will be useful, | 11 | * This program is distributed in the hope that it will be useful, |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | * GNU General Public License for more details. | 14 | * GNU General Public License for more details. |
15 | * | 15 | * |
16 | * You should have received a copy of the GNU General Public License | 16 | * You should have received a copy of the GNU General Public License |
17 | * along with this program; if not, write to the Free Software | 17 | * along with this program; if not, write to the Free Software |
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 | ****************************************************************************/ | 19 | ****************************************************************************/ |
20 | 20 | ||
21 | #include "libtremorplugin.h" | 21 | #include "libtremorplugin.h" |
22 | #include "libtremorpluginimpl.h" | 22 | #include "libtremorpluginimpl.h" |
23 | 23 | ||
24 | 24 | ||
25 | LibTremorPluginImpl::LibTremorPluginImpl() | 25 | LibTremorPluginImpl::LibTremorPluginImpl() |
26 | : libtremorplugin(0), ref(0) | 26 | : libtremorplugin(0), ref(0) |
27 | { | 27 | { |
28 | } | 28 | } |
29 | 29 | ||
30 | 30 | ||
31 | LibTremorPluginImpl::~LibTremorPluginImpl() | 31 | LibTremorPluginImpl::~LibTremorPluginImpl() |
32 | { | 32 | { |
33 | if ( libtremorplugin ) | 33 | if ( libtremorplugin ) |
34 | delete libtremorplugin; | 34 | delete libtremorplugin; |
35 | } | 35 | } |
36 | 36 | ||
37 | 37 | ||
38 | MediaPlayerDecoder *LibTremorPluginImpl::decoder() | 38 | MediaPlayerDecoder *LibTremorPluginImpl::decoder() |
39 | { | 39 | { |
40 | if ( !libtremorplugin ) | 40 | if ( !libtremorplugin ) |
41 | libtremorplugin = new LibTremorPlugin; | 41 | libtremorplugin = new LibTremorPlugin; |
42 | return libtremorplugin; | 42 | return libtremorplugin; |
43 | } | 43 | } |
44 | 44 | ||
45 | 45 | ||
46 | MediaPlayerEncoder *LibTremorPluginImpl::encoder() | 46 | MediaPlayerEncoder *LibTremorPluginImpl::encoder() |
47 | { | 47 | { |
48 | return NULL; | 48 | return NULL; |
49 | } | 49 | } |
50 | 50 | ||
51 | 51 | ||
52 | #ifndef QT_NO_COMPONENT | 52 | #ifndef QT_NO_COMPONENT |
53 | 53 | ||
54 | 54 | ||
55 | QRESULT LibTremorPluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | 55 | QRESULT LibTremorPluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) |
56 | { | 56 | { |
57 | *iface = 0; | 57 | *iface = 0; |
58 | if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) ) | 58 | if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) ) |
59 | *iface = this, (*iface)->addRef(); | 59 | *iface = this, (*iface)->addRef(); |
60 | else | ||
61 | return QS_FALSE; | ||
60 | return QS_OK; | 62 | return QS_OK; |
61 | } | 63 | } |
62 | 64 | ||
63 | 65 | ||
64 | Q_EXPORT_INTERFACE() | 66 | Q_EXPORT_INTERFACE() |
65 | { | 67 | { |
66 | Q_CREATE_INSTANCE( LibTremorPluginImpl ) | 68 | Q_CREATE_INSTANCE( LibTremorPluginImpl ) |
67 | } | 69 | } |
68 | 70 | ||
69 | 71 | ||
70 | #endif | 72 | #endif |
71 | 73 | ||
diff --git a/core/multimedia/opieplayer/wavplugin/wavpluginimpl.cpp b/core/multimedia/opieplayer/wavplugin/wavpluginimpl.cpp index c232d7b..4280880 100644 --- a/core/multimedia/opieplayer/wavplugin/wavpluginimpl.cpp +++ b/core/multimedia/opieplayer/wavplugin/wavpluginimpl.cpp | |||
@@ -1,69 +1,71 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include "wavplugin.h" | 20 | #include "wavplugin.h" |
21 | #include "wavpluginimpl.h" | 21 | #include "wavpluginimpl.h" |
22 | 22 | ||
23 | WavPluginImpl::WavPluginImpl() | 23 | WavPluginImpl::WavPluginImpl() |
24 | : libmadplugin(0), ref(0) | 24 | : libmadplugin(0), ref(0) |
25 | { | 25 | { |
26 | } | 26 | } |
27 | 27 | ||
28 | 28 | ||
29 | WavPluginImpl::~WavPluginImpl() | 29 | WavPluginImpl::~WavPluginImpl() |
30 | { | 30 | { |
31 | if ( libmadplugin ) | 31 | if ( libmadplugin ) |
32 | delete libmadplugin; | 32 | delete libmadplugin; |
33 | } | 33 | } |
34 | 34 | ||
35 | 35 | ||
36 | MediaPlayerDecoder *WavPluginImpl::decoder() | 36 | MediaPlayerDecoder *WavPluginImpl::decoder() |
37 | { | 37 | { |
38 | if ( !libmadplugin ) | 38 | if ( !libmadplugin ) |
39 | libmadplugin = new WavPlugin; | 39 | libmadplugin = new WavPlugin; |
40 | return libmadplugin; | 40 | return libmadplugin; |
41 | } | 41 | } |
42 | 42 | ||
43 | 43 | ||
44 | MediaPlayerEncoder *WavPluginImpl::encoder() | 44 | MediaPlayerEncoder *WavPluginImpl::encoder() |
45 | { | 45 | { |
46 | return NULL; | 46 | return NULL; |
47 | } | 47 | } |
48 | 48 | ||
49 | 49 | ||
50 | #ifndef QT_NO_COMPONENT | 50 | #ifndef QT_NO_COMPONENT |
51 | 51 | ||
52 | 52 | ||
53 | QRESULT WavPluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) | 53 | QRESULT WavPluginImpl::queryInterface( const QUuid &uuid, QUnknownInterface **iface ) |
54 | { | 54 | { |
55 | *iface = 0; | 55 | *iface = 0; |
56 | if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) ) | 56 | if ( ( uuid == IID_QUnknown ) || ( uuid == IID_MediaPlayerPlugin ) ) |
57 | *iface = this, (*iface)->addRef(); | 57 | *iface = this, (*iface)->addRef(); |
58 | else | ||
59 | return QS_FALSE; | ||
58 | return QS_OK; | 60 | return QS_OK; |
59 | } | 61 | } |
60 | 62 | ||
61 | 63 | ||
62 | Q_EXPORT_INTERFACE() | 64 | Q_EXPORT_INTERFACE() |
63 | { | 65 | { |
64 | Q_CREATE_INSTANCE( WavPluginImpl ) | 66 | Q_CREATE_INSTANCE( WavPluginImpl ) |
65 | } | 67 | } |
66 | 68 | ||
67 | 69 | ||
68 | #endif | 70 | #endif |
69 | 71 | ||