author | harlekin <harlekin> | 2002-10-10 10:17:20 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-10 10:17:20 (UTC) |
commit | 6e766588ca61322c59d0a527cb240522d9d8210e (patch) (unidiff) | |
tree | 4a4114876f4bfaac699177a0b44f3424644d256f | |
parent | 2cbc91d6aff15c931426f3c835b5126c7da3ba2b (diff) | |
download | opie-6e766588ca61322c59d0a527cb240522d9d8210e.zip opie-6e766588ca61322c59d0a527cb240522d9d8210e.tar.gz opie-6e766588ca61322c59d0a527cb240522d9d8210e.tar.bz2 |
little changes to the gamma
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidgetgui.cpp | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 6 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/yuv2rgb.h | 15 |
6 files changed, 17 insertions, 15 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index 85030de..c0e5acd 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp | |||
@@ -70,215 +70,216 @@ Lib::Lib( XineVideoWidget* widget ) { | |||
70 | m_video = false; | 70 | m_video = false; |
71 | m_wid = widget; | 71 | m_wid = widget; |
72 | printf("Lib"); | 72 | printf("Lib"); |
73 | QCString str( getenv("HOME") ); | 73 | QCString str( getenv("HOME") ); |
74 | str += "/Settings/opiexine.cf"; | 74 | str += "/Settings/opiexine.cf"; |
75 | // get the configuration | 75 | // get the configuration |
76 | 76 | ||
77 | // not really OO, should be an extra class, later | 77 | // not really OO, should be an extra class, later |
78 | if ( !QFile(str).exists() ) { | 78 | if ( !QFile(str).exists() ) { |
79 | QFile f(str); | 79 | QFile f(str); |
80 | f.open(IO_WriteOnly); | 80 | f.open(IO_WriteOnly); |
81 | QTextStream ts( &f ); | 81 | QTextStream ts( &f ); |
82 | ts << "misc.memcpy_method:glibc\n"; | 82 | ts << "misc.memcpy_method:glibc\n"; |
83 | f.close(); | 83 | f.close(); |
84 | } | 84 | } |
85 | 85 | ||
86 | m_xine = xine_new( ); | 86 | m_xine = xine_new( ); |
87 | 87 | ||
88 | xine_config_load( m_xine, str.data() ); | 88 | xine_config_load( m_xine, str.data() ); |
89 | 89 | ||
90 | 90 | ||
91 | // allocate oss for sound | 91 | // allocate oss for sound |
92 | // and fb for framebuffer | 92 | // and fb for framebuffer |
93 | m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); | 93 | m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); |
94 | m_videoOutput = ::init_video_out_plugin( m_config, NULL ); | 94 | m_videoOutput = ::init_video_out_plugin( m_config, NULL ); |
95 | 95 | ||
96 | 96 | ||
97 | //xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL); | 97 | //xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL); |
98 | 98 | ||
99 | 99 | ||
100 | null_display_handler( m_videoOutput, xine_display_frame, this ); | 100 | null_display_handler( m_videoOutput, xine_display_frame, this ); |
101 | xine_init( m_xine, m_audioOutput, m_videoOutput ); | 101 | xine_init( m_xine, m_audioOutput, m_videoOutput ); |
102 | 102 | ||
103 | if (m_wid != 0 ) { | 103 | if (m_wid != 0 ) { |
104 | printf( "!0\n" ); | 104 | printf( "!0\n" ); |
105 | resize ( m_wid-> size ( ) ); | 105 | resize ( m_wid-> size ( ) ); |
106 | ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); | 106 | ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); |
107 | 107 | ||
108 | m_wid->repaint(); | 108 | m_wid->repaint(); |
109 | } | 109 | } |
110 | 110 | ||
111 | xine_register_event_listener( m_xine, xine_event_handler, this ); | 111 | xine_register_event_listener( m_xine, xine_event_handler, this ); |
112 | } | 112 | } |
113 | 113 | ||
114 | Lib::~Lib() { | 114 | Lib::~Lib() { |
115 | // free( m_config ); | 115 | // free( m_config ); |
116 | xine_remove_event_listener( m_xine, xine_event_handler ); | 116 | xine_remove_event_listener( m_xine, xine_event_handler ); |
117 | xine_exit( m_xine ); | 117 | xine_exit( m_xine ); |
118 | /* FIXME either free or delete but valgrind bitches against both */ | 118 | /* FIXME either free or delete but valgrind bitches against both */ |
119 | //free( m_videoOutput ); | 119 | //free( m_videoOutput ); |
120 | //delete m_audioOutput; | 120 | //delete m_audioOutput; |
121 | } | 121 | } |
122 | 122 | ||
123 | void Lib::resize ( const QSize &s ) { | 123 | void Lib::resize ( const QSize &s ) { |
124 | if ( s. width ( ) && s. height ( ) ) { | 124 | if ( s. width ( ) && s. height ( ) ) { |
125 | ::null_set_gui_width( m_videoOutput, s. width() ); | 125 | ::null_set_gui_width( m_videoOutput, s. width() ); |
126 | ::null_set_gui_height( m_videoOutput, s. height() ); | 126 | ::null_set_gui_height( m_videoOutput, s. height() ); |
127 | } | 127 | } |
128 | } | 128 | } |
129 | 129 | ||
130 | QCString Lib::version() { | 130 | QCString Lib::version() { |
131 | // QCString str( xine_get_str_version() ); | 131 | // QCString str( xine_get_str_version() ); |
132 | // return str; | 132 | // return str; |
133 | return "test"; | 133 | return "test"; |
134 | } | 134 | } |
135 | 135 | ||
136 | int Lib::majorVersion() { | 136 | int Lib::majorVersion() { |
137 | xine_get_version ( &m_major_version, &m_minor_version, &m_sub_version ); | 137 | xine_get_version ( &m_major_version, &m_minor_version, &m_sub_version ); |
138 | return m_major_version; | 138 | return m_major_version; |
139 | } | 139 | } |
140 | 140 | ||
141 | int Lib::minorVersion() { | 141 | int Lib::minorVersion() { |
142 | xine_get_version ( &m_major_version, &m_minor_version, &m_sub_version ); | 142 | xine_get_version ( &m_major_version, &m_minor_version, &m_sub_version ); |
143 | return m_minor_version; | 143 | return m_minor_version; |
144 | } | 144 | } |
145 | 145 | ||
146 | int Lib::subVersion() { | 146 | int Lib::subVersion() { |
147 | xine_get_version ( &m_major_version, &m_minor_version, &m_sub_version ); | 147 | xine_get_version ( &m_major_version, &m_minor_version, &m_sub_version ); |
148 | return m_sub_version; | 148 | return m_sub_version; |
149 | } | 149 | } |
150 | 150 | ||
151 | int Lib::play( const QString& fileName, int startPos, int start_time ) { | 151 | int Lib::play( const QString& fileName, int startPos, int start_time ) { |
152 | QString str = fileName.stripWhiteSpace(); | 152 | QString str = fileName.stripWhiteSpace(); |
153 | if ( !xine_open( m_xine, QFile::encodeName(str.utf8() ).data() ) ) { | 153 | if ( !xine_open( m_xine, QFile::encodeName(str.utf8() ).data() ) ) { |
154 | return 0; | 154 | return 0; |
155 | } | 155 | } |
156 | return xine_play( m_xine, startPos, start_time); | 156 | return xine_play( m_xine, startPos, start_time); |
157 | } | 157 | } |
158 | 158 | ||
159 | void Lib::stop() { | 159 | void Lib::stop() { |
160 | qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); | 160 | qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); |
161 | xine_stop( m_xine ); | 161 | xine_stop( m_xine ); |
162 | } | 162 | } |
163 | 163 | ||
164 | void Lib::pause() { | 164 | void Lib::pause() { |
165 | xine_set_param( m_xine, XINE_PARAM_SPEED, XINE_SPEED_PAUSE ); | 165 | xine_set_param( m_xine, XINE_PARAM_SPEED, XINE_SPEED_PAUSE ); |
166 | } | 166 | } |
167 | 167 | ||
168 | int Lib::speed() { | 168 | int Lib::speed() { |
169 | return xine_get_param ( m_xine, XINE_PARAM_SPEED ); | 169 | return xine_get_param ( m_xine, XINE_PARAM_SPEED ); |
170 | } | 170 | } |
171 | 171 | ||
172 | void Lib::setSpeed( int speed ) { | 172 | void Lib::setSpeed( int speed ) { |
173 | xine_set_param ( m_xine, XINE_PARAM_SPEED, speed ); | 173 | xine_set_param ( m_xine, XINE_PARAM_SPEED, speed ); |
174 | } | 174 | } |
175 | 175 | ||
176 | int Lib::status() { | 176 | int Lib::status() { |
177 | return xine_get_status( m_xine ); | 177 | return xine_get_status( m_xine ); |
178 | } | 178 | } |
179 | 179 | ||
180 | int Lib::currentPosition() { | 180 | int Lib::currentPosition() { |
181 | xine_get_pos_length( m_xine, &m_pos, &m_time, &m_length ); | 181 | xine_get_pos_length( m_xine, &m_pos, &m_time, &m_length ); |
182 | return m_pos; | 182 | return m_pos; |
183 | } | 183 | } |
184 | 184 | ||
185 | int Lib::currentTime() { | 185 | int Lib::currentTime() { |
186 | xine_get_pos_length( m_xine, &m_pos, &m_time, &m_length ); | 186 | xine_get_pos_length( m_xine, &m_pos, &m_time, &m_length ); |
187 | return m_time/1000; | 187 | return m_time/1000; |
188 | } | 188 | } |
189 | 189 | ||
190 | int Lib::length() { | 190 | int Lib::length() { |
191 | xine_get_pos_length( m_xine, &m_pos, &m_time, &m_length ); | 191 | xine_get_pos_length( m_xine, &m_pos, &m_time, &m_length ); |
192 | return m_length/1000; | 192 | return m_length/1000; |
193 | } | 193 | } |
194 | 194 | ||
195 | bool Lib::isSeekable() { | 195 | bool Lib::isSeekable() { |
196 | return xine_get_stream_info( m_xine, XINE_STREAM_INFO_SEEKABLE ); | 196 | return xine_get_stream_info( m_xine, XINE_STREAM_INFO_SEEKABLE ); |
197 | } | 197 | } |
198 | 198 | ||
199 | void Lib::seekTo( int time ) { | 199 | void Lib::seekTo( int time ) { |
200 | // xine_trick_mode ( m_xine, XINE_TRICK_MODE_SEEK_TO_TIME, time ); NOT IMPLEMENTED YET IN XINE :_( | 200 | // xine_trick_mode ( m_xine, XINE_TRICK_MODE_SEEK_TO_TIME, time ); NOT IMPLEMENTED YET IN XINE :_( |
201 | xine_play( m_xine, 0, time ); | 201 | xine_play( m_xine, 0, time ); |
202 | } | 202 | } |
203 | 203 | ||
204 | 204 | ||
205 | Frame Lib::currentFrame() { | 205 | Frame Lib::currentFrame() { |
206 | Frame frame; | 206 | Frame frame; |
207 | return frame; | 207 | return frame; |
208 | }; | 208 | }; |
209 | 209 | ||
210 | QString Lib::metaInfo( int number) { | 210 | QString Lib::metaInfo( int number) { |
211 | return xine_get_meta_info( m_xine, number ); | 211 | return xine_get_meta_info( m_xine, number ); |
212 | } | 212 | } |
213 | 213 | ||
214 | int Lib::error() { | 214 | int Lib::error() { |
215 | return xine_get_error( m_xine ); | 215 | return xine_get_error( m_xine ); |
216 | }; | 216 | }; |
217 | 217 | ||
218 | void Lib::handleXineEvent( xine_event_t* t ) { | 218 | void Lib::handleXineEvent( xine_event_t* t ) { |
219 | if ( t->type == XINE_EVENT_PLAYBACK_FINISHED ) { | 219 | if ( t->type == XINE_EVENT_PLAYBACK_FINISHED ) { |
220 | emit stopped(); | 220 | emit stopped(); |
221 | } | 221 | } |
222 | } | 222 | } |
223 | 223 | ||
224 | 224 | ||
225 | void Lib::setShowVideo( bool video ) { | 225 | void Lib::setShowVideo( bool video ) { |
226 | m_video = video; | 226 | m_video = video; |
227 | ::null_set_show_video( m_videoOutput, video ); | 227 | ::null_set_show_video( m_videoOutput, video ); |
228 | } | 228 | } |
229 | 229 | ||
230 | bool Lib::isShowingVideo() { | 230 | bool Lib::isShowingVideo() { |
231 | return ::null_is_showing_video( m_videoOutput ); | 231 | return ::null_is_showing_video( m_videoOutput ); |
232 | } | 232 | } |
233 | 233 | ||
234 | bool Lib::hasVideo() { | 234 | bool Lib::hasVideo() { |
235 | //looks like it is not implemented yet | 235 | //looks like it is not implemented yet |
236 | //return xine_get_stream_info( m_xine, XINE_STREAM_INFO_VIDEO_CHANNELS ); | 236 | //return xine_get_stream_info( m_xine, XINE_STREAM_INFO_VIDEO_CHANNELS ); |
237 | // ugly hack until xine is ready, look for the width of the video | 237 | // ugly hack until xine is ready, look for the width of the video |
238 | int test = xine_get_stream_info( m_xine, 2 ); | 238 | int test = xine_get_stream_info( m_xine, 2 ); |
239 | if( test > 0 ) { | 239 | if( test > 0 ) { |
240 | // qDebug( QString(" has video: %1").arg( test ) ); | 240 | // qDebug( QString(" has video: %1").arg( test ) ); |
241 | return true; | 241 | return true; |
242 | } else { | 242 | } else { |
243 | //qDebug ( "does not have video "); | 243 | //qDebug ( "does not have video "); |
244 | return false; | 244 | return false; |
245 | } | 245 | } |
246 | } | 246 | } |
247 | 247 | ||
248 | void Lib::showVideoFullScreen( bool fullScreen ) { | 248 | void Lib::showVideoFullScreen( bool fullScreen ) { |
249 | ::null_set_fullscreen( m_videoOutput, fullScreen ); | 249 | ::null_set_fullscreen( m_videoOutput, fullScreen ); |
250 | } | 250 | } |
251 | 251 | ||
252 | bool Lib::isVideoFullScreen() { | 252 | bool Lib::isVideoFullScreen() { |
253 | return ::null_is_fullscreen( m_videoOutput ); | 253 | return ::null_is_fullscreen( m_videoOutput ); |
254 | } | 254 | } |
255 | 255 | ||
256 | void Lib::setScaling( bool scale ) { | 256 | void Lib::setScaling( bool scale ) { |
257 | ::null_set_scaling( m_videoOutput, scale ); | 257 | ::null_set_scaling( m_videoOutput, scale ); |
258 | } | 258 | } |
259 | 259 | ||
260 | void Lib::setGamma( int value ) { | 260 | void Lib::setGamma( int value ) { |
261 | //qDebug( QString( "%1").arg(value) ); | 261 | //qDebug( QString( "%1").arg(value) ); |
262 | int gammaValue = ( 100 + value ); | ||
262 | ::null_set_videoGamma( m_videoOutput, value ); | 263 | ::null_set_videoGamma( m_videoOutput, value ); |
263 | } | 264 | } |
264 | 265 | ||
265 | bool Lib::isScaling() { | 266 | bool Lib::isScaling() { |
266 | return ::null_is_scaling( m_videoOutput ); | 267 | return ::null_is_scaling( m_videoOutput ); |
267 | } | 268 | } |
268 | 269 | ||
269 | void Lib::xine_event_handler( void* user_data, xine_event_t* t ) { | 270 | void Lib::xine_event_handler( void* user_data, xine_event_t* t ) { |
270 | ( (Lib*)user_data)->handleXineEvent( t ); | 271 | ( (Lib*)user_data)->handleXineEvent( t ); |
271 | } | 272 | } |
272 | 273 | ||
273 | void Lib::xine_display_frame( void* user_data, uint8_t *frame, | 274 | void Lib::xine_display_frame( void* user_data, uint8_t *frame, |
274 | int width, int height, int bytes ) { | 275 | int width, int height, int bytes ) { |
275 | ( (Lib*)user_data)->drawFrame( frame, width, height, bytes ); | 276 | ( (Lib*)user_data)->drawFrame( frame, width, height, bytes ); |
276 | } | 277 | } |
277 | 278 | ||
278 | void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { | 279 | void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { |
279 | if ( !m_video ) { | 280 | if ( !m_video ) { |
280 | qWarning("not showing video now"); | 281 | qWarning("not showing video now"); |
281 | return; | 282 | return; |
282 | } | 283 | } |
283 | m_wid-> setVideoFrame ( frame, width, height, bytes ); | 284 | m_wid-> setVideoFrame ( frame, width, height, bytes ); |
284 | } | 285 | } |
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 5069a49..606f8e9 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -1,230 +1,230 @@ | |||
1 | #include <qpe/qpeapplication.h> | 1 | #include <qpe/qpeapplication.h> |
2 | #include <qpe/qlibrary.h> | 2 | #include <qpe/qlibrary.h> |
3 | #include <qpe/resource.h> | 3 | #include <qpe/resource.h> |
4 | #include <qpe/config.h> | 4 | #include <qpe/config.h> |
5 | #include <qpe/qcopenvelope_qws.h> | 5 | #include <qpe/qcopenvelope_qws.h> |
6 | #include <qfileinfo.h> | 6 | #include <qfileinfo.h> |
7 | 7 | ||
8 | #include <qmainwindow.h> | 8 | #include <qmainwindow.h> |
9 | #include <qmessagebox.h> | 9 | #include <qmessagebox.h> |
10 | #include <qwidgetstack.h> | 10 | #include <qwidgetstack.h> |
11 | #include <qfile.h> | 11 | #include <qfile.h> |
12 | 12 | ||
13 | #include "mediaplayer.h" | 13 | #include "mediaplayer.h" |
14 | #include "playlistwidget.h" | 14 | #include "playlistwidget.h" |
15 | #include "audiowidget.h" | 15 | #include "audiowidget.h" |
16 | #include "videowidget.h" | 16 | #include "videowidget.h" |
17 | #include "volumecontrol.h" | 17 | #include "volumecontrol.h" |
18 | 18 | ||
19 | #include "mediaplayerstate.h" | 19 | #include "mediaplayerstate.h" |
20 | 20 | ||
21 | // for setBacklight() | 21 | // for setBacklight() |
22 | #include <linux/fb.h> | 22 | #include <linux/fb.h> |
23 | #include <sys/file.h> | 23 | #include <sys/file.h> |
24 | #include <sys/ioctl.h> | 24 | #include <sys/ioctl.h> |
25 | 25 | ||
26 | 26 | ||
27 | extern AudioWidget *audioUI; | 27 | extern AudioWidget *audioUI; |
28 | extern VideoWidget *videoUI; | 28 | extern VideoWidget *videoUI; |
29 | extern PlayListWidget *playList; | 29 | extern PlayListWidget *playList; |
30 | extern MediaPlayerState *mediaPlayerState; | 30 | extern MediaPlayerState *mediaPlayerState; |
31 | 31 | ||
32 | 32 | ||
33 | #define FBIOBLANK 0x4611 | 33 | #define FBIOBLANK 0x4611 |
34 | 34 | ||
35 | MediaPlayer::MediaPlayer( QObject *parent, const char *name ) | 35 | MediaPlayer::MediaPlayer( QObject *parent, const char *name ) |
36 | : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { | 36 | : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { |
37 | 37 | ||
38 | playList->setCaption(tr("OpiePlayer: Initializating")); | 38 | playList->setCaption( tr( "OpiePlayer: Initializating" ) ); |
39 | 39 | ||
40 | qApp->processEvents(); | 40 | qApp->processEvents(); |
41 | // QPEApplication::grabKeyboard(); // EVIL | 41 | // QPEApplication::grabKeyboard(); // EVIL |
42 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 42 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
43 | 43 | ||
44 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); | 44 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); |
45 | 45 | ||
46 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); | 46 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); |
47 | 47 | ||
48 | connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); | 48 | connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); |
49 | connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); | 49 | connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); |
50 | connect( mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); | 50 | connect( mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); |
51 | 51 | ||
52 | connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | 52 | connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); |
53 | connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | 53 | connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); |
54 | connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | 54 | connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); |
55 | connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | 55 | connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); |
56 | 56 | ||
57 | connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | 57 | connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); |
58 | connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | 58 | connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); |
59 | connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | 59 | connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); |
60 | connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | 60 | connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); |
61 | 61 | ||
62 | volControl = new VolumeControl; | 62 | volControl = new VolumeControl; |
63 | xineControl = new XineControl(); | 63 | xineControl = new XineControl(); |
64 | playList->setCaption(tr("OpiePlayer")); | 64 | playList->setCaption(tr("OpiePlayer")); |
65 | } | 65 | } |
66 | 66 | ||
67 | MediaPlayer::~MediaPlayer() { | 67 | MediaPlayer::~MediaPlayer() { |
68 | delete xineControl; | 68 | delete xineControl; |
69 | delete volControl; | 69 | delete volControl; |
70 | } | 70 | } |
71 | 71 | ||
72 | void MediaPlayer::pauseCheck( bool b ) { | 72 | void MediaPlayer::pauseCheck( bool b ) { |
73 | if ( b && !mediaPlayerState->playing() ) { | 73 | if ( b && !mediaPlayerState->playing() ) { |
74 | mediaPlayerState->setPaused( FALSE ); | 74 | mediaPlayerState->setPaused( FALSE ); |
75 | } | 75 | } |
76 | } | 76 | } |
77 | 77 | ||
78 | void MediaPlayer::play() { | 78 | void MediaPlayer::play() { |
79 | mediaPlayerState->setPlaying( FALSE ); | 79 | mediaPlayerState->setPlaying( FALSE ); |
80 | mediaPlayerState->setPlaying( TRUE ); | 80 | mediaPlayerState->setPlaying( TRUE ); |
81 | } | 81 | } |
82 | 82 | ||
83 | void MediaPlayer::setPlaying( bool play ) { | 83 | void MediaPlayer::setPlaying( bool play ) { |
84 | if ( !play ) { | 84 | if ( !play ) { |
85 | return; | 85 | return; |
86 | } | 86 | } |
87 | 87 | ||
88 | if ( mediaPlayerState->paused() ) { | 88 | if ( mediaPlayerState->paused() ) { |
89 | mediaPlayerState->setPaused( FALSE ); | 89 | mediaPlayerState->setPaused( FALSE ); |
90 | return; | 90 | return; |
91 | } | 91 | } |
92 | 92 | ||
93 | QString tickerText, time, fileName; | 93 | QString tickerText, time, fileName; |
94 | if( playList->whichList() == 0 ) { //check for filelist | 94 | if( playList->whichList() == 0 ) { //check for filelist |
95 | const DocLnk *playListCurrent = playList->current(); | 95 | const DocLnk *playListCurrent = playList->current(); |
96 | if ( playListCurrent != NULL ) { | 96 | if ( playListCurrent != NULL ) { |
97 | currentFile = playListCurrent; | 97 | currentFile = playListCurrent; |
98 | } | 98 | } |
99 | xineControl->play( currentFile->file() ); | 99 | xineControl->play( currentFile->file() ); |
100 | fileName = currentFile->name(); | 100 | fileName = currentFile->name(); |
101 | long seconds = mediaPlayerState->length();// | 101 | long seconds = mediaPlayerState->length();// |
102 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); | 102 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); |
103 | //qDebug(time); | 103 | //qDebug(time); |
104 | 104 | ||
105 | } else { | 105 | } else { |
106 | //if playing in file list.. play in a different way | 106 | //if playing in file list.. play in a different way |
107 | // random and looping settings enabled causes problems here, | 107 | // random and looping settings enabled causes problems here, |
108 | // since there is no selected file in the playlist, but a selected file in the file list, | 108 | // since there is no selected file in the playlist, but a selected file in the file list, |
109 | // so we remember and shutoff | 109 | // so we remember and shutoff |
110 | l = mediaPlayerState->looping(); | 110 | l = mediaPlayerState->looping(); |
111 | if(l) { | 111 | if(l) { |
112 | mediaPlayerState->setLooping( false ); | 112 | mediaPlayerState->setLooping( false ); |
113 | } | 113 | } |
114 | r = mediaPlayerState->shuffled(); | 114 | r = mediaPlayerState->shuffled(); |
115 | mediaPlayerState->setShuffled( false ); | 115 | mediaPlayerState->setShuffled( false ); |
116 | 116 | ||
117 | fileName = playList->currentFileListPathName(); | 117 | fileName = playList->currentFileListPathName(); |
118 | xineControl->play( fileName ); | 118 | xineControl->play( fileName ); |
119 | long seconds = mediaPlayerState->length(); | 119 | long seconds = mediaPlayerState->length(); |
120 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); | 120 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); |
121 | //qDebug(time); | 121 | //qDebug(time); |
122 | if( fileName.left(4) != "http" ) { | 122 | if( fileName.left(4) != "http" ) { |
123 | fileName = QFileInfo( fileName ).baseName(); | 123 | fileName = QFileInfo( fileName ).baseName(); |
124 | } | 124 | } |
125 | 125 | ||
126 | } | 126 | } |
127 | 127 | ||
128 | if( fileName.left(4) == "http" ) { | 128 | if( fileName.left(4) == "http" ) { |
129 | if ( xineControl->getMetaInfo().isEmpty() ) { | 129 | if ( xineControl->getMetaInfo().isEmpty() ) { |
130 | tickerText = tr( " File: " ) + fileName; | 130 | tickerText = tr( " File: " ) + fileName; |
131 | } else { | 131 | } else { |
132 | tickerText = xineControl->getMetaInfo(); | 132 | tickerText = xineControl->getMetaInfo(); |
133 | } | 133 | } |
134 | } else { | 134 | } else { |
135 | if ( xineControl->getMetaInfo().isEmpty() ) { | 135 | if ( xineControl->getMetaInfo().isEmpty() ) { |
136 | tickerText = tr( " File: " ) + fileName + tr( ", Length: " ) + time + " "; | 136 | tickerText = tr( " File: " ) + fileName + tr( ", Length: " ) + time + " "; |
137 | } else { | 137 | } else { |
138 | tickerText = xineControl->getMetaInfo() + " Length: " + time + " "; | 138 | tickerText = xineControl->getMetaInfo() + " Length: " + time + " "; |
139 | } | 139 | } |
140 | } | 140 | } |
141 | audioUI->setTickerText( tickerText ); | 141 | audioUI->setTickerText( tickerText ); |
142 | } | 142 | } |
143 | 143 | ||
144 | 144 | ||
145 | void MediaPlayer::prev() { | 145 | void MediaPlayer::prev() { |
146 | if( playList->whichList() == 0 ) { //if using the playlist | 146 | if( playList->whichList() == 0 ) { //if using the playlist |
147 | if ( playList->prev() ) { | 147 | if ( playList->prev() ) { |
148 | play(); | 148 | play(); |
149 | } else if ( mediaPlayerState->looping() ) { | 149 | } else if ( mediaPlayerState->looping() ) { |
150 | if ( playList->last() ) { | 150 | if ( playList->last() ) { |
151 | play(); | 151 | play(); |
152 | } | 152 | } |
153 | } else { | 153 | } else { |
154 | mediaPlayerState->setList(); | 154 | mediaPlayerState->setList(); |
155 | } | 155 | } |
156 | } | 156 | } |
157 | } | 157 | } |
158 | 158 | ||
159 | 159 | ||
160 | void MediaPlayer::next() { | 160 | void MediaPlayer::next() { |
161 | 161 | ||
162 | if(playList->whichList() == 0) { //if using the playlist | 162 | if(playList->whichList() == 0) { //if using the playlist |
163 | if ( playList->next() ) { | 163 | if ( playList->next() ) { |
164 | play(); | 164 | play(); |
165 | } else if ( mediaPlayerState->looping() ) { | 165 | } else if ( mediaPlayerState->looping() ) { |
166 | if ( playList->first() ) { | 166 | if ( playList->first() ) { |
167 | play(); | 167 | play(); |
168 | } | 168 | } |
169 | } else { | 169 | } else { |
170 | mediaPlayerState->setList(); | 170 | mediaPlayerState->setList(); |
171 | } | 171 | } |
172 | } else { //if playing from file list, let's just stop | 172 | } else { //if playing from file list, let's just stop |
173 | qDebug("<<<<<<<<<<<<<<<<<stop for filelists"); | 173 | qDebug("<<<<<<<<<<<<<<<<<stop for filelists"); |
174 | mediaPlayerState->setPlaying(false); | 174 | mediaPlayerState->setPlaying(false); |
175 | mediaPlayerState->setView('l'); | 175 | mediaPlayerState->setView('l'); |
176 | if(l) mediaPlayerState->setLooping(l); | 176 | if(l) mediaPlayerState->setLooping(l); |
177 | if(r) mediaPlayerState->setShuffled(r); | 177 | if(r) mediaPlayerState->setShuffled(r); |
178 | } | 178 | } |
179 | qApp->processEvents(); | 179 | qApp->processEvents(); |
180 | } | 180 | } |
181 | 181 | ||
182 | 182 | ||
183 | void MediaPlayer::startDecreasingVolume() { | 183 | void MediaPlayer::startDecreasingVolume() { |
184 | volumeDirection = -1; | 184 | volumeDirection = -1; |
185 | startTimer( 100 ); | 185 | startTimer( 100 ); |
186 | volControl->decVol(2); | 186 | volControl->decVol(2); |
187 | } | 187 | } |
188 | 188 | ||
189 | 189 | ||
190 | void MediaPlayer::startIncreasingVolume() { | 190 | void MediaPlayer::startIncreasingVolume() { |
191 | volumeDirection = +1; | 191 | volumeDirection = +1; |
192 | startTimer( 100 ); | 192 | startTimer( 100 ); |
193 | volControl->incVol(2); | 193 | volControl->incVol(2); |
194 | } | 194 | } |
195 | 195 | ||
196 | 196 | ||
197 | bool drawnOnScreenDisplay = FALSE; | 197 | bool drawnOnScreenDisplay = FALSE; |
198 | unsigned int onScreenDisplayVolume = 0; | 198 | unsigned int onScreenDisplayVolume = 0; |
199 | const int yoff = 110; | 199 | const int yoff = 110; |
200 | 200 | ||
201 | void MediaPlayer::stopChangingVolume() { | 201 | void MediaPlayer::stopChangingVolume() { |
202 | killTimers(); | 202 | killTimers(); |
203 | // Get rid of the on-screen display stuff | 203 | // Get rid of the on-screen display stuff |
204 | drawnOnScreenDisplay = FALSE; | 204 | drawnOnScreenDisplay = FALSE; |
205 | onScreenDisplayVolume = 0; | 205 | onScreenDisplayVolume = 0; |
206 | int w=0; | 206 | int w=0; |
207 | int h=0; | 207 | int h=0; |
208 | if( !xineControl->hasVideo() ) { | 208 | if( !xineControl->hasVideo() ) { |
209 | w = audioUI->width(); | 209 | w = audioUI->width(); |
210 | h = audioUI->height(); | 210 | h = audioUI->height(); |
211 | audioUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); | 211 | audioUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); |
212 | } else { | 212 | } else { |
213 | w = videoUI->width(); | 213 | w = videoUI->width(); |
214 | h = videoUI->height(); | 214 | h = videoUI->height(); |
215 | videoUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); | 215 | videoUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); |
216 | } | 216 | } |
217 | } | 217 | } |
218 | 218 | ||
219 | 219 | ||
220 | void MediaPlayer::timerEvent( QTimerEvent * ) { | 220 | void MediaPlayer::timerEvent( QTimerEvent * ) { |
221 | if ( volumeDirection == +1 ) { | 221 | if ( volumeDirection == +1 ) { |
222 | volControl->incVol( 2 ); | 222 | volControl->incVol( 2 ); |
223 | } else if ( volumeDirection == -1 ) { | 223 | } else if ( volumeDirection == -1 ) { |
224 | volControl->decVol( 2 ); | 224 | volControl->decVol( 2 ); |
225 | } | 225 | } |
226 | 226 | ||
227 | 227 | ||
228 | // TODO FIXME | 228 | // TODO FIXME |
229 | // huh?? | 229 | // huh?? |
230 | unsigned int v= 0; | 230 | unsigned int v= 0; |
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp index 1042a0c..49356d3 100644 --- a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp | |||
@@ -1,227 +1,227 @@ | |||
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 | ..}^=.= = ; General Public License for more | 22 | ..}^=.= = ; 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 | -_. . . )=. = General Public License along with | 26 | -_. . . )=. = 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/qpemenubar.h> | 34 | #include <qpe/qpemenubar.h> |
35 | #include <qpe/qpetoolbar.h> | 35 | #include <qpe/qpetoolbar.h> |
36 | #include <qpe/fileselector.h> | 36 | #include <qpe/fileselector.h> |
37 | #include <qpe/qpeapplication.h> | 37 | #include <qpe/qpeapplication.h> |
38 | #include <qpe/storage.h> | 38 | #include <qpe/storage.h> |
39 | #include <qpe/mimetype.h> | 39 | #include <qpe/mimetype.h> |
40 | #include <qpe/config.h> | 40 | #include <qpe/config.h> |
41 | #include <qpe/global.h> | 41 | #include <qpe/global.h> |
42 | #include <qpe/resource.h> | 42 | #include <qpe/resource.h> |
43 | 43 | ||
44 | #include <qpopupmenu.h> | 44 | #include <qpopupmenu.h> |
45 | #include <qaction.h> | 45 | #include <qaction.h> |
46 | #include <qcursor.h> | 46 | #include <qcursor.h> |
47 | #include <qdir.h> | 47 | #include <qdir.h> |
48 | #include <qlayout.h> | 48 | #include <qlayout.h> |
49 | 49 | ||
50 | #include "playlistselection.h" | 50 | #include "playlistselection.h" |
51 | #include "playlistwidget.h" | 51 | #include "playlistwidget.h" |
52 | #include "mediaplayerstate.h" | 52 | #include "mediaplayerstate.h" |
53 | #include "inputDialog.h" | 53 | #include "inputDialog.h" |
54 | 54 | ||
55 | //only needed for the random play | 55 | //only needed for the random play |
56 | #include <stdlib.h> | 56 | #include <stdlib.h> |
57 | 57 | ||
58 | #include "audiowidget.h" | 58 | #include "audiowidget.h" |
59 | #include "videowidget.h" | 59 | #include "videowidget.h" |
60 | #include "mediaplayerstate.h" | 60 | #include "mediaplayerstate.h" |
61 | 61 | ||
62 | extern MediaPlayerState *mediaPlayerState; | 62 | extern MediaPlayerState *mediaPlayerState; |
63 | 63 | ||
64 | PlayListWidgetGui::PlayListWidgetGui( QWidget* parent, const char* name, WFlags fl ) | 64 | PlayListWidgetGui::PlayListWidgetGui( QWidget* parent, const char* name, WFlags fl ) |
65 | : QMainWindow( parent, name, fl ) { | 65 | : QMainWindow( parent, name, fl ) { |
66 | 66 | ||
67 | d = new PlayListWidgetPrivate; | 67 | d = new PlayListWidgetPrivate; |
68 | d->setDocumentUsed = FALSE; | 68 | d->setDocumentUsed = FALSE; |
69 | d->current = NULL; | 69 | d->current = NULL; |
70 | 70 | ||
71 | setBackgroundMode( PaletteButton ); | 71 | setBackgroundMode( PaletteButton ); |
72 | setToolBarsMovable( FALSE ); | 72 | setToolBarsMovable( FALSE ); |
73 | 73 | ||
74 | // Create Toolbar | 74 | // Create Toolbar |
75 | QPEToolBar *toolbar = new QPEToolBar( this ); | 75 | QPEToolBar *toolbar = new QPEToolBar( this ); |
76 | toolbar->setHorizontalStretchable( TRUE ); | 76 | toolbar->setHorizontalStretchable( TRUE ); |
77 | 77 | ||
78 | // Create Menubar | 78 | // Create Menubar |
79 | QPEMenuBar *menu = new QPEMenuBar( toolbar ); | 79 | QPEMenuBar *menu = new QPEMenuBar( toolbar ); |
80 | menu->setMargin( 0 ); | 80 | menu->setMargin( 0 ); |
81 | 81 | ||
82 | bar = new QPEToolBar( this ); | 82 | bar = new QPEToolBar( this ); |
83 | bar->setLabel( tr( "Play Operations" ) ); | 83 | bar->setLabel( tr( "Play Operations" ) ); |
84 | 84 | ||
85 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet( "trash" ), "", bar, "close" ); | 85 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet( "trash" ), "", bar, "close" ); |
86 | tbDeletePlaylist->setFlat( TRUE ); | 86 | tbDeletePlaylist->setFlat( TRUE ); |
87 | tbDeletePlaylist->setFixedSize( 20, 20 ); | 87 | tbDeletePlaylist->setFixedSize( 20, 20 ); |
88 | 88 | ||
89 | tbDeletePlaylist->hide(); | 89 | tbDeletePlaylist->hide(); |
90 | 90 | ||
91 | pmPlayList = new QPopupMenu( this ); | 91 | pmPlayList = new QPopupMenu( this ); |
92 | menu->insertItem( tr( "File" ), pmPlayList ); | 92 | menu->insertItem( tr( "File" ), pmPlayList ); |
93 | 93 | ||
94 | pmView = new QPopupMenu( this ); | 94 | pmView = new QPopupMenu( this ); |
95 | menu->insertItem( tr( "View" ), pmView ); | 95 | menu->insertItem( tr( "View" ), pmView ); |
96 | pmView->isCheckable(); | 96 | pmView->isCheckable(); |
97 | 97 | ||
98 | skinsMenu = new QPopupMenu( this ); | 98 | skinsMenu = new QPopupMenu( this ); |
99 | pmView->insertItem( tr( "Skins" ), skinsMenu ); | 99 | pmView->insertItem( tr( "Skins" ), skinsMenu ); |
100 | skinsMenu->isCheckable(); | 100 | skinsMenu->isCheckable(); |
101 | 101 | ||
102 | gammaMenu = new QPopupMenu( this ); | 102 | gammaMenu = new QPopupMenu( this ); |
103 | pmView->insertItem( tr( "Gamma (Video)" ), gammaMenu ); | 103 | pmView->insertItem( tr( "Gamma (Video)" ), gammaMenu ); |
104 | 104 | ||
105 | gammaSlider = new QSlider( QSlider::Vertical, gammaMenu ); | 105 | gammaSlider = new QSlider( QSlider::Vertical, gammaMenu ); |
106 | gammaSlider->setRange( -100, 100 ); | 106 | gammaSlider->setRange( -40, 40 ); |
107 | gammaSlider->setTickmarks( QSlider::Left ); | 107 | gammaSlider->setTickmarks( QSlider::Left ); |
108 | gammaSlider->setTickInterval( 20 ); | 108 | gammaSlider->setTickInterval( 20 ); |
109 | gammaSlider->setFocusPolicy( QWidget::NoFocus ); | 109 | //gammaSlider->setFocusPolicy( QWidget::NoFocus ); |
110 | gammaSlider->setValue( 0 ); | 110 | gammaSlider->setValue( 0 ); |
111 | gammaSlider->setMinimumHeight( 50 ); | 111 | gammaSlider->setMinimumHeight( 50 ); |
112 | 112 | ||
113 | gammaLCD = new QLCDNumber( 3, gammaMenu ); | 113 | gammaLCD = new QLCDNumber( 3, gammaMenu ); |
114 | 114 | ||
115 | gammaMenu->insertItem( gammaSlider ); | 115 | gammaMenu->insertItem( gammaSlider ); |
116 | gammaMenu->insertItem( gammaLCD ); | 116 | gammaMenu->insertItem( gammaLCD ); |
117 | 117 | ||
118 | connect( gammaSlider, SIGNAL( valueChanged( int ) ), gammaLCD, SLOT( display( int ) ) ); | 118 | connect( gammaSlider, SIGNAL( valueChanged( int ) ), gammaLCD, SLOT( display( int ) ) ); |
119 | 119 | ||
120 | vbox5 = new QVBox( this ); | 120 | vbox5 = new QVBox( this ); |
121 | QVBox *vbox4 = new QVBox( vbox5 ); | 121 | QVBox *vbox4 = new QVBox( vbox5 ); |
122 | QHBox *hbox6 = new QHBox( vbox4 ); | 122 | QHBox *hbox6 = new QHBox( vbox4 ); |
123 | 123 | ||
124 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); | 124 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); |
125 | 125 | ||
126 | QWidget *pTab; | 126 | QWidget *pTab; |
127 | pTab = new QWidget( tabWidget, "pTab" ); | 127 | pTab = new QWidget( tabWidget, "pTab" ); |
128 | tabWidget->insertTab( pTab, "Playlist"); | 128 | tabWidget->insertTab( pTab, "Playlist"); |
129 | 129 | ||
130 | QGridLayout *Playout = new QGridLayout( pTab ); | 130 | QGridLayout *Playout = new QGridLayout( pTab ); |
131 | Playout->setSpacing( 2); | 131 | Playout->setSpacing( 2); |
132 | Playout->setMargin( 2); | 132 | Playout->setMargin( 2); |
133 | 133 | ||
134 | // Add the playlist area | 134 | // Add the playlist area |
135 | QVBox *vbox3 = new QVBox( pTab ); | 135 | QVBox *vbox3 = new QVBox( pTab ); |
136 | d->playListFrame = vbox3; | 136 | d->playListFrame = vbox3; |
137 | 137 | ||
138 | QHBox *hbox2 = new QHBox( vbox3 ); | 138 | QHBox *hbox2 = new QHBox( vbox3 ); |
139 | d->selectedFiles = new PlayListSelection( hbox2 ); | 139 | d->selectedFiles = new PlayListSelection( hbox2 ); |
140 | 140 | ||
141 | vbox1 = new QVBox( hbox2 ); | 141 | vbox1 = new QVBox( hbox2 ); |
142 | QPEApplication::setStylusOperation( d->selectedFiles->viewport(), QPEApplication::RightOnHold ); | 142 | QPEApplication::setStylusOperation( d->selectedFiles->viewport(), QPEApplication::RightOnHold ); |
143 | QVBox *stretch1 = new QVBox( vbox1 ); // add stretch | 143 | QVBox *stretch1 = new QVBox( vbox1 ); // add stretch |
144 | 144 | ||
145 | Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 ); | 145 | Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 ); |
146 | 146 | ||
147 | QWidget *aTab; | 147 | QWidget *aTab; |
148 | aTab = new QWidget( tabWidget, "aTab" ); | 148 | aTab = new QWidget( tabWidget, "aTab" ); |
149 | 149 | ||
150 | QGridLayout *Alayout = new QGridLayout( aTab ); | 150 | QGridLayout *Alayout = new QGridLayout( aTab ); |
151 | Alayout->setSpacing( 2 ); | 151 | Alayout->setSpacing( 2 ); |
152 | Alayout->setMargin( 2 ); | 152 | Alayout->setMargin( 2 ); |
153 | audioView = new QListView( aTab, "Audioview" ); | 153 | audioView = new QListView( aTab, "Audioview" ); |
154 | audioView->addColumn( tr( "Title" ), 140 ); | 154 | audioView->addColumn( tr( "Title" ), 140 ); |
155 | audioView->addColumn( tr( "Size" ), -1 ); | 155 | audioView->addColumn( tr( "Size" ), -1 ); |
156 | audioView->addColumn( tr( "Media" ), -1 ); | 156 | audioView->addColumn( tr( "Media" ), -1 ); |
157 | audioView->addColumn( tr( "Path" ), 0 ); | 157 | audioView->addColumn( tr( "Path" ), 0 ); |
158 | audioView->setColumnAlignment( 1, Qt::AlignRight ); | 158 | audioView->setColumnAlignment( 1, Qt::AlignRight ); |
159 | audioView->setColumnAlignment( 2, Qt::AlignRight ); | 159 | audioView->setColumnAlignment( 2, Qt::AlignRight ); |
160 | audioView->setAllColumnsShowFocus( TRUE ); | 160 | audioView->setAllColumnsShowFocus( TRUE ); |
161 | audioView->setSorting( 0, TRUE ); | 161 | audioView->setSorting( 0, TRUE ); |
162 | audioView->setMultiSelection( TRUE ); | 162 | audioView->setMultiSelection( TRUE ); |
163 | audioView->setSelectionMode( QListView::Extended ); | 163 | audioView->setSelectionMode( QListView::Extended ); |
164 | Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 ); | 164 | Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 ); |
165 | tabWidget->insertTab( aTab, tr( "Audio" ) ); | 165 | tabWidget->insertTab( aTab, tr( "Audio" ) ); |
166 | 166 | ||
167 | QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold ); | 167 | QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold ); |
168 | 168 | ||
169 | QWidget *vTab; | 169 | QWidget *vTab; |
170 | vTab = new QWidget( tabWidget, "vTab" ); | 170 | vTab = new QWidget( tabWidget, "vTab" ); |
171 | 171 | ||
172 | QGridLayout *Vlayout = new QGridLayout( vTab ); | 172 | QGridLayout *Vlayout = new QGridLayout( vTab ); |
173 | Vlayout->setSpacing( 2 ); | 173 | Vlayout->setSpacing( 2 ); |
174 | Vlayout->setMargin( 2 ); | 174 | Vlayout->setMargin( 2 ); |
175 | videoView = new QListView( vTab, "Videoview" ); | 175 | videoView = new QListView( vTab, "Videoview" ); |
176 | videoView->addColumn( tr( "Title" ), 140); | 176 | videoView->addColumn( tr( "Title" ), 140); |
177 | videoView->addColumn( tr( "Size" ), -1 ); | 177 | videoView->addColumn( tr( "Size" ), -1 ); |
178 | videoView->addColumn(tr( "Media" ), -1 ); | 178 | videoView->addColumn(tr( "Media" ), -1 ); |
179 | videoView->addColumn(tr( "Path" ), 0 ); | 179 | videoView->addColumn(tr( "Path" ), 0 ); |
180 | videoView->setColumnAlignment( 1, Qt::AlignRight ); | 180 | videoView->setColumnAlignment( 1, Qt::AlignRight ); |
181 | videoView->setColumnAlignment( 2, Qt::AlignRight ); | 181 | videoView->setColumnAlignment( 2, Qt::AlignRight ); |
182 | videoView->setAllColumnsShowFocus( TRUE ); | 182 | videoView->setAllColumnsShowFocus( TRUE ); |
183 | videoView->setSorting( 0, TRUE ); | 183 | videoView->setSorting( 0, TRUE ); |
184 | videoView->setMultiSelection( TRUE ); | 184 | videoView->setMultiSelection( TRUE ); |
185 | videoView->setSelectionMode( QListView::Extended ); | 185 | videoView->setSelectionMode( QListView::Extended ); |
186 | Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 ); | 186 | Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 ); |
187 | 187 | ||
188 | QPEApplication::setStylusOperation( videoView->viewport(), QPEApplication::RightOnHold ); | 188 | QPEApplication::setStylusOperation( videoView->viewport(), QPEApplication::RightOnHold ); |
189 | 189 | ||
190 | tabWidget->insertTab( vTab, tr( "Video" ) ); | 190 | tabWidget->insertTab( vTab, tr( "Video" ) ); |
191 | 191 | ||
192 | //playlists list | 192 | //playlists list |
193 | QWidget *LTab; | 193 | QWidget *LTab; |
194 | LTab = new QWidget( tabWidget, "LTab" ); | 194 | LTab = new QWidget( tabWidget, "LTab" ); |
195 | QGridLayout *Llayout = new QGridLayout( LTab ); | 195 | QGridLayout *Llayout = new QGridLayout( LTab ); |
196 | Llayout->setSpacing( 2 ); | 196 | Llayout->setSpacing( 2 ); |
197 | Llayout->setMargin( 2 ); | 197 | Llayout->setMargin( 2 ); |
198 | 198 | ||
199 | playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE ); | 199 | playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE ); |
200 | Llayout->addMultiCellWidget( playLists, 0, 0, 0, 1 ); | 200 | Llayout->addMultiCellWidget( playLists, 0, 0, 0, 1 ); |
201 | 201 | ||
202 | tabWidget->insertTab( LTab, tr( "Lists" ) ); | 202 | tabWidget->insertTab( LTab, tr( "Lists" ) ); |
203 | 203 | ||
204 | setCentralWidget( vbox5 ); | 204 | setCentralWidget( vbox5 ); |
205 | } | 205 | } |
206 | 206 | ||
207 | 207 | ||
208 | 208 | ||
209 | PlayListWidgetGui::~PlayListWidgetGui() { | 209 | PlayListWidgetGui::~PlayListWidgetGui() { |
210 | } | 210 | } |
211 | 211 | ||
212 | void PlayListWidgetGui::setView( char view ) { | 212 | void PlayListWidgetGui::setView( char view ) { |
213 | if ( view == 'l' ) | 213 | if ( view == 'l' ) |
214 | showMaximized(); | 214 | showMaximized(); |
215 | else | 215 | else |
216 | hide(); | 216 | hide(); |
217 | } | 217 | } |
218 | 218 | ||
219 | 219 | ||
220 | void PlayListWidgetGui::setActiveWindow() { | 220 | void PlayListWidgetGui::setActiveWindow() { |
221 | // qDebug("SETTING active window"); | 221 | // qDebug("SETTING active window"); |
222 | // When we get raised we need to ensure that it switches views | 222 | // When we get raised we need to ensure that it switches views |
223 | char origView = mediaPlayerState->view(); | 223 | char origView = mediaPlayerState->view(); |
224 | mediaPlayerState->setView( 'l' ); // invalidate | 224 | mediaPlayerState->setView( 'l' ); // invalidate |
225 | mediaPlayerState->setView( origView ); // now switch back | 225 | mediaPlayerState->setView( origView ); // now switch back |
226 | } | 226 | } |
227 | 227 | ||
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index f5f5c37..7b8ad7a 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -1,511 +1,511 @@ | |||
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/mediaplayerplugininterface.h> | 36 | #include <qpe/mediaplayerplugininterface.h> |
37 | #include <qpe/config.h> | 37 | #include <qpe/config.h> |
38 | 38 | ||
39 | 39 | ||
40 | #include <qwidget.h> | 40 | #include <qwidget.h> |
41 | #include <qpainter.h> | 41 | #include <qpainter.h> |
42 | #include <qpixmap.h> | 42 | #include <qpixmap.h> |
43 | #include <qslider.h> | 43 | #include <qslider.h> |
44 | #include <qdrawutil.h> | 44 | #include <qdrawutil.h> |
45 | #include "videowidget.h" | 45 | #include "videowidget.h" |
46 | #include "mediaplayerstate.h" | 46 | #include "mediaplayerstate.h" |
47 | #include "playlistwidget.h" | 47 | #include "playlistwidget.h" |
48 | 48 | ||
49 | 49 | ||
50 | #ifdef Q_WS_QWS | 50 | #ifdef Q_WS_QWS |
51 | # define USE_DIRECT_PAINTER | 51 | # define USE_DIRECT_PAINTER |
52 | # include <qdirectpainter_qws.h> | 52 | # include <qdirectpainter_qws.h> |
53 | # include <qgfxraster_qws.h> | 53 | # include <qgfxraster_qws.h> |
54 | #endif | 54 | #endif |
55 | 55 | ||
56 | 56 | ||
57 | extern MediaPlayerState *mediaPlayerState; | 57 | extern MediaPlayerState *mediaPlayerState; |
58 | extern PlayListWidget *playList; | 58 | extern PlayListWidget *playList; |
59 | 59 | ||
60 | 60 | ||
61 | static const int xo = 2; // movable x offset | 61 | static const int xo = 2; // movable x offset |
62 | static const int yo = 0; // movable y offset | 62 | static const int yo = 0; // movable y offset |
63 | 63 | ||
64 | 64 | ||
65 | struct MediaButton { | 65 | struct MediaButton { |
66 | bool isToggle, isHeld, isDown; | 66 | bool isToggle, isHeld, isDown; |
67 | }; | 67 | }; |
68 | 68 | ||
69 | MediaButton videoButtons[] = { | 69 | MediaButton videoButtons[] = { |
70 | { FALSE, FALSE, FALSE }, // stop | 70 | { FALSE, FALSE, FALSE }, // stop |
71 | { TRUE, FALSE, FALSE }, // play | 71 | { TRUE, FALSE, FALSE }, // play |
72 | { FALSE, FALSE, FALSE }, // previous | 72 | { FALSE, FALSE, FALSE }, // previous |
73 | { FALSE, FALSE, FALSE }, // next | 73 | { FALSE, FALSE, FALSE }, // next |
74 | { FALSE, FALSE, FALSE }, // volUp | 74 | { FALSE, FALSE, FALSE }, // volUp |
75 | { FALSE, FALSE, FALSE }, // volDown | 75 | { FALSE, FALSE, FALSE }, // volDown |
76 | { TRUE, FALSE, FALSE } // fullscreen | 76 | { TRUE, FALSE, FALSE } // fullscreen |
77 | }; | 77 | }; |
78 | 78 | ||
79 | const char *skinV_mask_file_names[7] = { | 79 | const char *skinV_mask_file_names[7] = { |
80 | "stop","play","back","fwd","up","down","full" | 80 | "stop","play","back","fwd","up","down","full" |
81 | }; | 81 | }; |
82 | 82 | ||
83 | static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); | 83 | static const int numVButtons = (sizeof(videoButtons)/sizeof(MediaButton)); |
84 | 84 | ||
85 | 85 | ||
86 | VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : | 86 | VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : |
87 | QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { | 87 | QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { |
88 | 88 | ||
89 | 89 | ||
90 | setCaption( tr("OpiePlayer - Video") ); | 90 | setCaption( tr("OpiePlayer - Video") ); |
91 | 91 | ||
92 | videoFrame = new XineVideoWidget ( this, "Video frame" ); | 92 | videoFrame = new XineVideoWidget ( this, "Video frame" ); |
93 | 93 | ||
94 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); | 94 | connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); |
95 | connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); | 95 | connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); |
96 | 96 | ||
97 | Config cfg("OpiePlayer"); | 97 | Config cfg("OpiePlayer"); |
98 | cfg.setGroup("Options"); | 98 | cfg.setGroup("Options"); |
99 | skin = cfg.readEntry("Skin","default"); | 99 | skin = cfg.readEntry("Skin","default"); |
100 | 100 | ||
101 | QString skinPath = "opieplayer2/skins/" + skin; | 101 | QString skinPath = "opieplayer2/skins/" + skin; |
102 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); | 102 | pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); |
103 | imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); | 103 | imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); |
104 | imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); | 104 | imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); |
105 | 105 | ||
106 | imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); | 106 | imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); |
107 | imgButtonMask->fill( 0 ); | 107 | imgButtonMask->fill( 0 ); |
108 | 108 | ||
109 | for ( int i = 0; i < 7; i++ ) { | 109 | for ( int i = 0; i < 7; i++ ) { |
110 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); | 110 | QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png" ); |
111 | masks[i] = new QBitmap( filename ); | 111 | masks[i] = new QBitmap( filename ); |
112 | 112 | ||
113 | if ( !masks[i]->isNull() ) { | 113 | if ( !masks[i]->isNull() ) { |
114 | QImage imgMask = masks[i]->convertToImage(); | 114 | QImage imgMask = masks[i]->convertToImage(); |
115 | uchar **dest = imgButtonMask->jumpTable(); | 115 | uchar **dest = imgButtonMask->jumpTable(); |
116 | for ( int y = 0; y < imgUp->height(); y++ ) { | 116 | for ( int y = 0; y < imgUp->height(); y++ ) { |
117 | uchar *line = dest[y]; | 117 | uchar *line = dest[y]; |
118 | for ( int x = 0; x < imgUp->width(); x++ ) { | 118 | for ( int x = 0; x < imgUp->width(); x++ ) { |
119 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 119 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
120 | line[x] = i + 1; | 120 | line[x] = i + 1; |
121 | } | 121 | } |
122 | } | 122 | } |
123 | } | 123 | } |
124 | } | 124 | } |
125 | 125 | ||
126 | for ( int i = 0; i < 7; i++ ) { | 126 | for ( int i = 0; i < 7; i++ ) { |
127 | buttonPixUp[i] = NULL; | 127 | buttonPixUp[i] = NULL; |
128 | buttonPixDown[i] = NULL; | 128 | buttonPixDown[i] = NULL; |
129 | } | 129 | } |
130 | 130 | ||
131 | setBackgroundPixmap( *pixBg ); | 131 | setBackgroundPixmap( *pixBg ); |
132 | 132 | ||
133 | slider = new QSlider( Qt::Horizontal, this ); | 133 | slider = new QSlider( Qt::Horizontal, this ); |
134 | slider->setMinValue( 0 ); | 134 | slider->setMinValue( 0 ); |
135 | slider->setMaxValue( 1 ); | 135 | slider->setMaxValue( 1 ); |
136 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); | 136 | slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) ); |
137 | slider->setFocusPolicy( QWidget::NoFocus ); | 137 | //slider->setFocusPolicy( QWidget::NoFocus ); |
138 | 138 | ||
139 | resizeEvent( NULL ); | 139 | resizeEvent( NULL ); |
140 | 140 | ||
141 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 141 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
142 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 142 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
143 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); | 143 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); |
144 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); | 144 | connect( mediaPlayerState, SIGNAL( viewChanged(char) ), this, SLOT( setView(char) ) ); |
145 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | 145 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); |
146 | 146 | ||
147 | setLength( mediaPlayerState->length() ); | 147 | setLength( mediaPlayerState->length() ); |
148 | setPosition( mediaPlayerState->position() ); | 148 | setPosition( mediaPlayerState->position() ); |
149 | setFullscreen( mediaPlayerState->fullscreen() ); | 149 | setFullscreen( mediaPlayerState->fullscreen() ); |
150 | setPlaying( mediaPlayerState->playing() ); | 150 | setPlaying( mediaPlayerState->playing() ); |
151 | } | 151 | } |
152 | 152 | ||
153 | 153 | ||
154 | VideoWidget::~VideoWidget() { | 154 | VideoWidget::~VideoWidget() { |
155 | 155 | ||
156 | for ( int i = 0; i < 7; i++ ) { | 156 | for ( int i = 0; i < 7; i++ ) { |
157 | delete buttonPixUp[i]; | 157 | delete buttonPixUp[i]; |
158 | delete buttonPixDown[i]; | 158 | delete buttonPixDown[i]; |
159 | } | 159 | } |
160 | 160 | ||
161 | delete pixBg; | 161 | delete pixBg; |
162 | delete imgUp; | 162 | delete imgUp; |
163 | delete imgDn; | 163 | delete imgDn; |
164 | delete imgButtonMask; | 164 | delete imgButtonMask; |
165 | for ( int i = 0; i < 7; i++ ) { | 165 | for ( int i = 0; i < 7; i++ ) { |
166 | delete masks[i]; | 166 | delete masks[i]; |
167 | } | 167 | } |
168 | 168 | ||
169 | } | 169 | } |
170 | 170 | ||
171 | QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { | 171 | QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { |
172 | QPixmap pix( img.width(), img.height() ); | 172 | QPixmap pix( img.width(), img.height() ); |
173 | QPainter p( &pix ); | 173 | QPainter p( &pix ); |
174 | p.drawTiledPixmap( pix.rect(), bg, offset ); | 174 | p.drawTiledPixmap( pix.rect(), bg, offset ); |
175 | p.drawImage( 0, 0, img ); | 175 | p.drawImage( 0, 0, img ); |
176 | return new QPixmap( pix ); | 176 | return new QPixmap( pix ); |
177 | } | 177 | } |
178 | 178 | ||
179 | QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) { | 179 | QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) { |
180 | QPixmap *pixmap = new QPixmap( pix ); | 180 | QPixmap *pixmap = new QPixmap( pix ); |
181 | pixmap->setMask( mask ); | 181 | pixmap->setMask( mask ); |
182 | return pixmap; | 182 | return pixmap; |
183 | } | 183 | } |
184 | 184 | ||
185 | void VideoWidget::resizeEvent( QResizeEvent * ) { | 185 | void VideoWidget::resizeEvent( QResizeEvent * ) { |
186 | int h = height(); | 186 | int h = height(); |
187 | int w = width(); | 187 | int w = width(); |
188 | //int Vh = 160; | 188 | //int Vh = 160; |
189 | //int Vw = 220; | 189 | //int Vw = 220; |
190 | 190 | ||
191 | slider->setFixedWidth( w - 20 ); | 191 | slider->setFixedWidth( w - 20 ); |
192 | slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); | 192 | slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); |
193 | slider->setBackgroundOrigin( QWidget::ParentOrigin ); | 193 | slider->setBackgroundOrigin( QWidget::ParentOrigin ); |
194 | slider->setFocusPolicy( QWidget::NoFocus ); | 194 | slider->setFocusPolicy( QWidget::NoFocus ); |
195 | slider->setBackgroundPixmap( *pixBg ); | 195 | slider->setBackgroundPixmap( *pixBg ); |
196 | 196 | ||
197 | xoff = 0;// ( imgUp->width() ) / 2; | 197 | xoff = 0;// ( imgUp->width() ) / 2; |
198 | if(w>h) | 198 | if(w>h) |
199 | yoff = 0; | 199 | yoff = 0; |
200 | else | 200 | else |
201 | yoff = 185;//(( Vh - imgUp->height() ) / 2) - 10; | 201 | yoff = 185;//(( Vh - imgUp->height() ) / 2) - 10; |
202 | QPoint p( xoff, yoff ); | 202 | QPoint p( xoff, yoff ); |
203 | 203 | ||
204 | QPixmap *pixUp = combineVImageWithBackground( *imgUp, *pixBg, p ); | 204 | QPixmap *pixUp = combineVImageWithBackground( *imgUp, *pixBg, p ); |
205 | QPixmap *pixDn = combineVImageWithBackground( *imgDn, *pixBg, p ); | 205 | QPixmap *pixDn = combineVImageWithBackground( *imgDn, *pixBg, p ); |
206 | 206 | ||
207 | for ( int i = 0; i < 7; i++ ) { | 207 | for ( int i = 0; i < 7; i++ ) { |
208 | if ( !masks[i]->isNull() ) { | 208 | if ( !masks[i]->isNull() ) { |
209 | delete buttonPixUp[i]; | 209 | delete buttonPixUp[i]; |
210 | delete buttonPixDown[i]; | 210 | delete buttonPixDown[i]; |
211 | buttonPixUp[i] = maskVPixToMask( *pixUp, *masks[i] ); | 211 | buttonPixUp[i] = maskVPixToMask( *pixUp, *masks[i] ); |
212 | buttonPixDown[i] = maskVPixToMask( *pixDn, *masks[i] ); | 212 | buttonPixDown[i] = maskVPixToMask( *pixDn, *masks[i] ); |
213 | } | 213 | } |
214 | } | 214 | } |
215 | 215 | ||
216 | delete pixUp; | 216 | delete pixUp; |
217 | delete pixDn; | 217 | delete pixDn; |
218 | } | 218 | } |
219 | 219 | ||
220 | static bool videoSliderBeingMoved = FALSE; | 220 | static bool videoSliderBeingMoved = FALSE; |
221 | 221 | ||
222 | void VideoWidget::sliderPressed() { | 222 | void VideoWidget::sliderPressed() { |
223 | videoSliderBeingMoved = TRUE; | 223 | videoSliderBeingMoved = TRUE; |
224 | } | 224 | } |
225 | 225 | ||
226 | void VideoWidget::sliderReleased() { | 226 | void VideoWidget::sliderReleased() { |
227 | videoSliderBeingMoved = FALSE; | 227 | videoSliderBeingMoved = FALSE; |
228 | if ( slider->width() == 0 ) { | 228 | if ( slider->width() == 0 ) { |
229 | return; | 229 | return; |
230 | } | 230 | } |
231 | long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); | 231 | long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); |
232 | mediaPlayerState->setPosition( val ); | 232 | mediaPlayerState->setPosition( val ); |
233 | } | 233 | } |
234 | 234 | ||
235 | void VideoWidget::setPosition( long i ) { | 235 | void VideoWidget::setPosition( long i ) { |
236 | updateSlider( i, mediaPlayerState->length() ); | 236 | updateSlider( i, mediaPlayerState->length() ); |
237 | } | 237 | } |
238 | 238 | ||
239 | 239 | ||
240 | void VideoWidget::setLength( long max ) { | 240 | void VideoWidget::setLength( long max ) { |
241 | updateSlider( mediaPlayerState->position(), max ); | 241 | updateSlider( mediaPlayerState->position(), max ); |
242 | } | 242 | } |
243 | 243 | ||
244 | void VideoWidget::setView( char view ) { | 244 | void VideoWidget::setView( char view ) { |
245 | 245 | ||
246 | if ( view == 'v' ) { | 246 | if ( view == 'v' ) { |
247 | makeVisible(); | 247 | makeVisible(); |
248 | } else { | 248 | } else { |
249 | // Effectively blank the view next time we show it so it looks nicer | 249 | // Effectively blank the view next time we show it so it looks nicer |
250 | scaledWidth = 0; | 250 | scaledWidth = 0; |
251 | scaledHeight = 0; | 251 | scaledHeight = 0; |
252 | hide(); | 252 | hide(); |
253 | } | 253 | } |
254 | } | 254 | } |
255 | 255 | ||
256 | void VideoWidget::updateSlider( long i, long max ) { | 256 | void VideoWidget::updateSlider( long i, long max ) { |
257 | // Will flicker too much if we don't do this | 257 | // Will flicker too much if we don't do this |
258 | if ( max == 0 ) { | 258 | if ( max == 0 ) { |
259 | return; | 259 | return; |
260 | } | 260 | } |
261 | int width = slider->width(); | 261 | int width = slider->width(); |
262 | int val = int((double)i * width / max); | 262 | int val = int((double)i * width / max); |
263 | if ( !mediaPlayerState->fullscreen() && !videoSliderBeingMoved ) { | 263 | if ( !mediaPlayerState->fullscreen() && !videoSliderBeingMoved ) { |
264 | if ( slider->value() != val ) { | 264 | if ( slider->value() != val ) { |
265 | slider->setValue( val ); | 265 | slider->setValue( val ); |
266 | } | 266 | } |
267 | if ( slider->maxValue() != width ) { | 267 | if ( slider->maxValue() != width ) { |
268 | slider->setMaxValue( width ); | 268 | slider->setMaxValue( width ); |
269 | } | 269 | } |
270 | } | 270 | } |
271 | } | 271 | } |
272 | 272 | ||
273 | void VideoWidget::setToggleButton( int i, bool down ) { | 273 | void VideoWidget::setToggleButton( int i, bool down ) { |
274 | if ( down != videoButtons[i].isDown ) { | 274 | if ( down != videoButtons[i].isDown ) { |
275 | toggleButton( i ); | 275 | toggleButton( i ); |
276 | } | 276 | } |
277 | } | 277 | } |
278 | 278 | ||
279 | void VideoWidget::toggleButton( int i ) { | 279 | void VideoWidget::toggleButton( int i ) { |
280 | videoButtons[i].isDown = !videoButtons[i].isDown; | 280 | videoButtons[i].isDown = !videoButtons[i].isDown; |
281 | QPainter p(this); | 281 | QPainter p(this); |
282 | paintButton ( &p, i ); | 282 | paintButton ( &p, i ); |
283 | } | 283 | } |
284 | 284 | ||
285 | void VideoWidget::paintButton( QPainter *p, int i ) { | 285 | void VideoWidget::paintButton( QPainter *p, int i ) { |
286 | 286 | ||
287 | if ( videoButtons[i].isDown ) { | 287 | if ( videoButtons[i].isDown ) { |
288 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); | 288 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); |
289 | } else { | 289 | } else { |
290 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); | 290 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); |
291 | } | 291 | } |
292 | } | 292 | } |
293 | 293 | ||
294 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | 294 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { |
295 | for ( int i = 0; i < numVButtons; i++ ) { | 295 | for ( int i = 0; i < numVButtons; i++ ) { |
296 | if ( event->state() == QMouseEvent::LeftButton ) { | 296 | if ( event->state() == QMouseEvent::LeftButton ) { |
297 | // The test to see if the mouse click is inside the button or not | 297 | // The test to see if the mouse click is inside the button or not |
298 | int x = event->pos().x() - xoff; | 298 | int x = event->pos().x() - xoff; |
299 | int y = event->pos().y() - yoff; | 299 | int y = event->pos().y() - yoff; |
300 | 300 | ||
301 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() | 301 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() |
302 | && y < imgButtonMask->height() | 302 | && y < imgButtonMask->height() |
303 | && imgButtonMask->pixelIndex( x, y ) == i + 1 ); | 303 | && imgButtonMask->pixelIndex( x, y ) == i + 1 ); |
304 | 304 | ||
305 | if ( isOnButton && !videoButtons[i].isHeld ) { | 305 | if ( isOnButton && !videoButtons[i].isHeld ) { |
306 | videoButtons[i].isHeld = TRUE; | 306 | videoButtons[i].isHeld = TRUE; |
307 | toggleButton(i); | 307 | toggleButton(i); |
308 | 308 | ||
309 | switch (i) { | 309 | switch (i) { |
310 | case VideoVolUp: | 310 | case VideoVolUp: |
311 | emit moreClicked(); | 311 | emit moreClicked(); |
312 | return; | 312 | return; |
313 | case VideoVolDown: | 313 | case VideoVolDown: |
314 | emit lessClicked(); | 314 | emit lessClicked(); |
315 | return; | 315 | return; |
316 | } | 316 | } |
317 | } else if ( !isOnButton && videoButtons[i].isHeld ) { | 317 | } else if ( !isOnButton && videoButtons[i].isHeld ) { |
318 | videoButtons[i].isHeld = FALSE; | 318 | videoButtons[i].isHeld = FALSE; |
319 | toggleButton(i); | 319 | toggleButton(i); |
320 | } | 320 | } |
321 | } else { | 321 | } else { |
322 | 322 | ||
323 | if ( videoButtons[i].isHeld ) { | 323 | if ( videoButtons[i].isHeld ) { |
324 | videoButtons[i].isHeld = FALSE; | 324 | videoButtons[i].isHeld = FALSE; |
325 | if ( !videoButtons[i].isToggle ) { | 325 | if ( !videoButtons[i].isToggle ) { |
326 | setToggleButton( i, FALSE ); | 326 | setToggleButton( i, FALSE ); |
327 | } | 327 | } |
328 | 328 | ||
329 | switch(i) { | 329 | switch(i) { |
330 | 330 | ||
331 | case VideoPlay: { | 331 | case VideoPlay: { |
332 | if( mediaPlayerState->isPaused ) { | 332 | if( mediaPlayerState->isPaused ) { |
333 | setToggleButton( i, FALSE ); | 333 | setToggleButton( i, FALSE ); |
334 | mediaPlayerState->setPaused( FALSE ); | 334 | mediaPlayerState->setPaused( FALSE ); |
335 | return; | 335 | return; |
336 | } else if( !mediaPlayerState->isPaused ) { | 336 | } else if( !mediaPlayerState->isPaused ) { |
337 | setToggleButton( i, TRUE ); | 337 | setToggleButton( i, TRUE ); |
338 | mediaPlayerState->setPaused( TRUE ); | 338 | mediaPlayerState->setPaused( TRUE ); |
339 | return; | 339 | return; |
340 | } else { | 340 | } else { |
341 | return; | 341 | return; |
342 | } | 342 | } |
343 | } | 343 | } |
344 | 344 | ||
345 | case VideoStop: mediaPlayerState->setPlaying( FALSE ); return; | 345 | case VideoStop: mediaPlayerState->setPlaying( FALSE ); return; |
346 | case VideoNext: if(playList->whichList() ==0) mediaPlayerState->setNext(); return; | 346 | case VideoNext: if(playList->whichList() ==0) mediaPlayerState->setNext(); return; |
347 | case VideoPrevious: if(playList->whichList() ==0) mediaPlayerState->setPrev(); return; | 347 | case VideoPrevious: if(playList->whichList() ==0) mediaPlayerState->setPrev(); return; |
348 | case VideoVolUp: emit moreReleased(); return; | 348 | case VideoVolUp: emit moreReleased(); return; |
349 | case VideoVolDown: emit lessReleased(); return; | 349 | case VideoVolDown: emit lessReleased(); return; |
350 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; | 350 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; |
351 | } | 351 | } |
352 | } | 352 | } |
353 | } | 353 | } |
354 | } | 354 | } |
355 | } | 355 | } |
356 | 356 | ||
357 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { | 357 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { |
358 | mouseMoveEvent( event ); | 358 | mouseMoveEvent( event ); |
359 | } | 359 | } |
360 | 360 | ||
361 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { | 361 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { |
362 | if ( mediaPlayerState->fullscreen() ) { | 362 | if ( mediaPlayerState->fullscreen() ) { |
363 | mediaPlayerState->setFullscreen( FALSE ); | 363 | mediaPlayerState->setFullscreen( FALSE ); |
364 | makeVisible(); | 364 | makeVisible(); |
365 | } | 365 | } |
366 | mouseMoveEvent( event ); | 366 | mouseMoveEvent( event ); |
367 | } | 367 | } |
368 | 368 | ||
369 | void VideoWidget::showEvent( QShowEvent* ) { | 369 | void VideoWidget::showEvent( QShowEvent* ) { |
370 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); | 370 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); |
371 | mouseMoveEvent( &event ); | 371 | mouseMoveEvent( &event ); |
372 | } | 372 | } |
373 | 373 | ||
374 | 374 | ||
375 | void VideoWidget::backToNormal() { | 375 | void VideoWidget::backToNormal() { |
376 | mediaPlayerState->setFullscreen( FALSE ); | 376 | mediaPlayerState->setFullscreen( FALSE ); |
377 | makeVisible(); | 377 | makeVisible(); |
378 | } | 378 | } |
379 | 379 | ||
380 | void VideoWidget::makeVisible() { | 380 | void VideoWidget::makeVisible() { |
381 | if ( mediaPlayerState->fullscreen() ) { | 381 | if ( mediaPlayerState->fullscreen() ) { |
382 | setBackgroundMode( QWidget::NoBackground ); | 382 | setBackgroundMode( QWidget::NoBackground ); |
383 | showFullScreen(); | 383 | showFullScreen(); |
384 | resize( qApp->desktop()->size() ); | 384 | resize( qApp->desktop()->size() ); |
385 | slider->hide(); | 385 | slider->hide(); |
386 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); | 386 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); |
387 | // qApp->processEvents(); | 387 | // qApp->processEvents(); |
388 | } else { | 388 | } else { |
389 | showNormal(); | 389 | showNormal(); |
390 | showMaximized(); | 390 | showMaximized(); |
391 | setBackgroundPixmap( *pixBg ); | 391 | setBackgroundPixmap( *pixBg ); |
392 | if ( mediaPlayerState->streaming() ) { | 392 | if ( mediaPlayerState->streaming() ) { |
393 | slider->hide(); | 393 | slider->hide(); |
394 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 394 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
395 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 395 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
396 | } else { | 396 | } else { |
397 | slider->show(); | 397 | slider->show(); |
398 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 398 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
399 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 399 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
400 | } | 400 | } |
401 | QWidget *d = QApplication::desktop(); | 401 | QWidget *d = QApplication::desktop(); |
402 | int w=d->width(); | 402 | int w=d->width(); |
403 | int h=d->height(); | 403 | int h=d->height(); |
404 | 404 | ||
405 | if(w>h) { | 405 | if(w>h) { |
406 | int newW=(w/2)-(246/2); //this will only work with 320x240 | 406 | int newW=(w/2)-(246/2); //this will only work with 320x240 |
407 | videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); | 407 | videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); |
408 | } else | 408 | } else |
409 | videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); | 409 | videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); |
410 | 410 | ||
411 | // qApp->processEvents(); | 411 | // qApp->processEvents(); |
412 | } | 412 | } |
413 | } | 413 | } |
414 | 414 | ||
415 | 415 | ||
416 | void VideoWidget::paintEvent( QPaintEvent * pe) { | 416 | void VideoWidget::paintEvent( QPaintEvent * pe) { |
417 | QPainter p( this ); | 417 | QPainter p( this ); |
418 | 418 | ||
419 | if ( mediaPlayerState->fullscreen() ) { | 419 | if ( mediaPlayerState->fullscreen() ) { |
420 | // Clear the background | 420 | // Clear the background |
421 | p.setBrush( QBrush( Qt::black ) ); | 421 | p.setBrush( QBrush( Qt::black ) ); |
422 | } else { | 422 | } else { |
423 | if ( !pe->erased() ) { | 423 | if ( !pe->erased() ) { |
424 | // Combine with background and double buffer | 424 | // Combine with background and double buffer |
425 | QPixmap pix( pe->rect().size() ); | 425 | QPixmap pix( pe->rect().size() ); |
426 | QPainter p( &pix ); | 426 | QPainter p( &pix ); |
427 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 427 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
428 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); | 428 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); |
429 | for ( int i = 0; i < numVButtons; i++ ) { | 429 | for ( int i = 0; i < numVButtons; i++ ) { |
430 | paintButton( &p, i ); | 430 | paintButton( &p, i ); |
431 | } | 431 | } |
432 | QPainter p2( this ); | 432 | QPainter p2( this ); |
433 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 433 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
434 | } else { | 434 | } else { |
435 | QPainter p( this ); | 435 | QPainter p( this ); |
436 | for ( int i = 0; i < numVButtons; i++ ) | 436 | for ( int i = 0; i < numVButtons; i++ ) |
437 | paintButton( &p, i ); | 437 | paintButton( &p, i ); |
438 | } | 438 | } |
439 | slider->repaint( TRUE ); | 439 | //slider->repaint( TRUE ); |
440 | } | 440 | } |
441 | } | 441 | } |
442 | 442 | ||
443 | 443 | ||
444 | void VideoWidget::closeEvent( QCloseEvent* ) { | 444 | void VideoWidget::closeEvent( QCloseEvent* ) { |
445 | mediaPlayerState->setList(); | 445 | mediaPlayerState->setList(); |
446 | } | 446 | } |
447 | 447 | ||
448 | 448 | ||
449 | 449 | ||
450 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { | 450 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { |
451 | switch ( e->key() ) { | 451 | switch ( e->key() ) { |
452 | ////////////////////////////// Zaurus keys | 452 | ////////////////////////////// Zaurus keys |
453 | case Key_Home: | 453 | case Key_Home: |
454 | break; | 454 | break; |
455 | case Key_F9: //activity | 455 | case Key_F9: //activity |
456 | break; | 456 | break; |
457 | case Key_F10: //contacts | 457 | case Key_F10: //contacts |
458 | // hide(); | 458 | // hide(); |
459 | break; | 459 | break; |
460 | case Key_F11: //menu | 460 | case Key_F11: //menu |
461 | break; | 461 | break; |
462 | case Key_F12: //home | 462 | case Key_F12: //home |
463 | break; | 463 | break; |
464 | case Key_F13: //mail | 464 | case Key_F13: //mail |
465 | break; | 465 | break; |
466 | case Key_Space: { | 466 | case Key_Space: { |
467 | if(mediaPlayerState->playing()) { | 467 | if(mediaPlayerState->playing()) { |
468 | mediaPlayerState->setPlaying(FALSE); | 468 | mediaPlayerState->setPlaying(FALSE); |
469 | } else { | 469 | } else { |
470 | mediaPlayerState->setPlaying(TRUE); | 470 | mediaPlayerState->setPlaying(TRUE); |
471 | } | 471 | } |
472 | } | 472 | } |
473 | break; | 473 | break; |
474 | case Key_Down: | 474 | case Key_Down: |
475 | // toggleButton(6); | 475 | // toggleButton(6); |
476 | emit lessClicked(); | 476 | emit lessClicked(); |
477 | emit lessReleased(); | 477 | emit lessReleased(); |
478 | // toggleButton(6); | 478 | // toggleButton(6); |
479 | break; | 479 | break; |
480 | case Key_Up: | 480 | case Key_Up: |
481 | // toggleButton(5); | 481 | // toggleButton(5); |
482 | emit moreClicked(); | 482 | emit moreClicked(); |
483 | emit moreReleased(); | 483 | emit moreReleased(); |
484 | // toggleButton(5); | 484 | // toggleButton(5); |
485 | break; | 485 | break; |
486 | case Key_Right: | 486 | case Key_Right: |
487 | mediaPlayerState->setNext(); | 487 | mediaPlayerState->setNext(); |
488 | break; | 488 | break; |
489 | case Key_Left: | 489 | case Key_Left: |
490 | mediaPlayerState->setPrev(); | 490 | mediaPlayerState->setPrev(); |
491 | break; | 491 | break; |
492 | case Key_Escape: | 492 | case Key_Escape: |
493 | break; | 493 | break; |
494 | 494 | ||
495 | }; | 495 | }; |
496 | } | 496 | } |
497 | 497 | ||
498 | XineVideoWidget* VideoWidget::vidWidget() { | 498 | XineVideoWidget* VideoWidget::vidWidget() { |
499 | return videoFrame; | 499 | return videoFrame; |
500 | } | 500 | } |
501 | 501 | ||
502 | 502 | ||
503 | void VideoWidget::setFullscreen ( bool b ) { | 503 | void VideoWidget::setFullscreen ( bool b ) { |
504 | setToggleButton( VideoFullscreen, b ); | 504 | setToggleButton( VideoFullscreen, b ); |
505 | } | 505 | } |
506 | 506 | ||
507 | 507 | ||
508 | void VideoWidget::setPlaying( bool b) { | 508 | void VideoWidget::setPlaying( bool b) { |
509 | setToggleButton( VideoPlay, b ); | 509 | setToggleButton( VideoPlay, b ); |
510 | } | 510 | } |
511 | 511 | ||
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp index 81693e1..31ac9dc 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.cpp +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp | |||
@@ -1,242 +1,242 @@ | |||
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 | ..}^=.= = ; General Public License for more | 22 | ..}^=.= = ; 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 | -_. . . )=. = General Public License along with | 26 | -_. . . )=. = 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 | 34 | ||
35 | #include <qtimer.h> | 35 | #include <qtimer.h> |
36 | #include <qmessagebox.h> | 36 | #include <qmessagebox.h> |
37 | #include <qpe/qcopenvelope_qws.h> | 37 | #include <qpe/qcopenvelope_qws.h> |
38 | #include <qpe/qpeapplication.h> | 38 | #include <qpe/qpeapplication.h> |
39 | #include "xinecontrol.h" | 39 | #include "xinecontrol.h" |
40 | #include "mediaplayerstate.h" | 40 | #include "mediaplayerstate.h" |
41 | #include "videowidget.h" | 41 | #include "videowidget.h" |
42 | 42 | ||
43 | extern MediaPlayerState *mediaPlayerState; | 43 | extern MediaPlayerState *mediaPlayerState; |
44 | extern VideoWidget *videoUI; | 44 | extern VideoWidget *videoUI; |
45 | XineControl::XineControl( QObject *parent, const char *name ) | 45 | XineControl::XineControl( QObject *parent, const char *name ) |
46 | : QObject( parent, name ) { | 46 | : QObject( parent, name ) { |
47 | 47 | ||
48 | libXine = new XINE::Lib(videoUI->vidWidget() ); | 48 | libXine = new XINE::Lib( videoUI->vidWidget() ); |
49 | 49 | ||
50 | connect ( videoUI, SIGNAL( videoResized ( const QSize & )), this, SLOT( videoResized ( const QSize & ) ) ); | 50 | connect ( videoUI, SIGNAL( videoResized( const QSize & )), this, SLOT( videoResized ( const QSize & ) ) ); |
51 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) ); | 51 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) ); |
52 | connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) ); | 52 | connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) ); |
53 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); | 53 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); |
54 | connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); | 54 | connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); |
55 | connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); | 55 | connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); |
56 | connect( mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); | 56 | connect( mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); |
57 | connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); | 57 | connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); |
58 | 58 | ||
59 | disabledSuspendScreenSaver = FALSE; | 59 | disabledSuspendScreenSaver = FALSE; |
60 | } | 60 | } |
61 | 61 | ||
62 | XineControl::~XineControl() { | 62 | XineControl::~XineControl() { |
63 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 63 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
64 | if ( disabledSuspendScreenSaver ) { | 64 | if ( disabledSuspendScreenSaver ) { |
65 | disabledSuspendScreenSaver = FALSE; | 65 | disabledSuspendScreenSaver = FALSE; |
66 | // Re-enable the suspend mode | 66 | // Re-enable the suspend mode |
67 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | 67 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; |
68 | } | 68 | } |
69 | #endif | 69 | #endif |
70 | delete libXine; | 70 | delete libXine; |
71 | } | 71 | } |
72 | 72 | ||
73 | void XineControl::play( const QString& fileName ) { | 73 | void XineControl::play( const QString& fileName ) { |
74 | hasVideoChannel = FALSE; | 74 | hasVideoChannel = FALSE; |
75 | hasAudioChannel = FALSE; | 75 | hasAudioChannel = FALSE; |
76 | m_fileName = fileName; | 76 | m_fileName = fileName; |
77 | 77 | ||
78 | //qDebug("<<FILENAME: " + fileName + ">>>>"); | 78 | //qDebug("<<FILENAME: " + fileName + ">>>>"); |
79 | 79 | ||
80 | if ( !libXine->play( fileName ) ) { | 80 | if ( !libXine->play( fileName ) ) { |
81 | QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); | 81 | QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); |
82 | return; | 82 | return; |
83 | } | 83 | } |
84 | mediaPlayerState->setPlaying( true ); | 84 | mediaPlayerState->setPlaying( true ); |
85 | 85 | ||
86 | char whichGui; | 86 | char whichGui; |
87 | // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) ); | 87 | // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) ); |
88 | if ( !libXine->hasVideo() ) { | 88 | if ( !libXine->hasVideo() ) { |
89 | whichGui = 'a'; | 89 | whichGui = 'a'; |
90 | qDebug("HAS AUDIO"); | 90 | qDebug("HAS AUDIO"); |
91 | libXine->setShowVideo( false ); | 91 | libXine->setShowVideo( false ); |
92 | hasAudioChannel = TRUE; | 92 | hasAudioChannel = TRUE; |
93 | } else { | 93 | } else { |
94 | whichGui = 'v'; | 94 | whichGui = 'v'; |
95 | qDebug("HAS VIDEO"); | 95 | qDebug("HAS VIDEO"); |
96 | libXine->setShowVideo( true ); | 96 | libXine->setShowVideo( true ); |
97 | hasVideoChannel = TRUE; | 97 | hasVideoChannel = TRUE; |
98 | } | 98 | } |
99 | // determine if slider is shown | 99 | // determine if slider is shown |
100 | mediaPlayerState->setIsStreaming( !libXine->isSeekable() ); | 100 | mediaPlayerState->setIsStreaming( !libXine->isSeekable() ); |
101 | // which gui (video / audio) | 101 | // which gui (video / audio) |
102 | mediaPlayerState->setView( whichGui ); | 102 | mediaPlayerState->setView( whichGui ); |
103 | 103 | ||
104 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 104 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
105 | if ( !disabledSuspendScreenSaver ) { | 105 | if ( !disabledSuspendScreenSaver ) { |
106 | disabledSuspendScreenSaver = TRUE; | 106 | disabledSuspendScreenSaver = TRUE; |
107 | // Stop the screen from blanking and power saving state | 107 | // Stop the screen from blanking and power saving state |
108 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) | 108 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) |
109 | << ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend ); | 109 | << ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend ); |
110 | } | 110 | } |
111 | #endif | 111 | #endif |
112 | 112 | ||
113 | length(); | 113 | length(); |
114 | position(); | 114 | position(); |
115 | } | 115 | } |
116 | 116 | ||
117 | void XineControl::nextMedia() { | 117 | void XineControl::nextMedia() { |
118 | mediaPlayerState->setNext(); | 118 | mediaPlayerState->setNext(); |
119 | } | 119 | } |
120 | 120 | ||
121 | void XineControl::setGamma( int value ) { | 121 | void XineControl::setGamma( int value ) { |
122 | libXine->setGamma( value ); | 122 | libXine->setGamma( value ); |
123 | } | 123 | } |
124 | 124 | ||
125 | void XineControl::stop( bool isSet ) { | 125 | void XineControl::stop( bool isSet ) { |
126 | if ( !isSet ) { | 126 | if ( !isSet ) { |
127 | libXine->stop(); | 127 | libXine->stop(); |
128 | 128 | ||
129 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 129 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
130 | if ( disabledSuspendScreenSaver ) { | 130 | if ( disabledSuspendScreenSaver ) { |
131 | disabledSuspendScreenSaver = FALSE; | 131 | disabledSuspendScreenSaver = FALSE; |
132 | // Re-enable the suspend mode | 132 | // Re-enable the suspend mode |
133 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | 133 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; |
134 | } | 134 | } |
135 | #endif | 135 | #endif |
136 | } | 136 | } |
137 | } | 137 | } |
138 | 138 | ||
139 | /** | 139 | /** |
140 | * Pause playback | 140 | * Pause playback |
141 | * @isSet | 141 | * @isSet |
142 | */ | 142 | */ |
143 | void XineControl::pause( bool isSet) { | 143 | void XineControl::pause( bool isSet) { |
144 | if ( isSet ) { | 144 | if ( isSet ) { |
145 | libXine->pause(); | 145 | libXine->pause(); |
146 | } else { | 146 | } else { |
147 | libXine->play( m_fileName, 0, m_currentTime ); | 147 | libXine->play( m_fileName, 0, m_currentTime ); |
148 | } | 148 | } |
149 | } | 149 | } |
150 | 150 | ||
151 | 151 | ||
152 | /** | 152 | /** |
153 | * get current time in playback | 153 | * get current time in playback |
154 | */ | 154 | */ |
155 | long XineControl::currentTime() { | 155 | long XineControl::currentTime() { |
156 | // todo: jede sekunde überprüfen | 156 | // todo: jede sekunde überprüfen |
157 | m_currentTime = libXine->currentTime(); | 157 | m_currentTime = libXine->currentTime(); |
158 | return m_currentTime; | 158 | return m_currentTime; |
159 | QTimer::singleShot( 1000, this, SLOT( currentTime() ) ); | 159 | QTimer::singleShot( 1000, this, SLOT( currentTime() ) ); |
160 | } | 160 | } |
161 | 161 | ||
162 | /** | 162 | /** |
163 | * Set the length of the media file | 163 | * Set the length of the media file |
164 | */ | 164 | */ |
165 | void XineControl::length() { | 165 | void XineControl::length() { |
166 | m_length = libXine->length(); | 166 | m_length = libXine->length(); |
167 | mediaPlayerState->setLength( m_length ); | 167 | mediaPlayerState->setLength( m_length ); |
168 | } | 168 | } |
169 | 169 | ||
170 | 170 | ||
171 | /** | 171 | /** |
172 | * Reports the position the xine backend is at right now | 172 | * Reports the position the xine backend is at right now |
173 | * @return long the postion in seconds | 173 | * @return long the postion in seconds |
174 | */ | 174 | */ |
175 | long XineControl::position() { | 175 | long XineControl::position() { |
176 | m_position = ( currentTime() ); | 176 | m_position = ( currentTime() ); |
177 | mediaPlayerState->updatePosition( m_position ); | 177 | mediaPlayerState->updatePosition( m_position ); |
178 | long emitPos = (long)m_position; | 178 | long emitPos = (long)m_position; |
179 | emit positionChanged( emitPos ); | 179 | emit positionChanged( emitPos ); |
180 | if( mediaPlayerState->isPlaying ) { | 180 | if( mediaPlayerState->isPlaying ) { |
181 | // needs to be stopped the media is stopped | 181 | // needs to be stopped the media is stopped |
182 | QTimer::singleShot( 1000, this, SLOT( position() ) ); | 182 | QTimer::singleShot( 1000, this, SLOT( position() ) ); |
183 | } | 183 | } |
184 | // qDebug("POSITION : %d", m_position); | 184 | // qDebug("POSITION : %d", m_position); |
185 | return m_position; | 185 | return m_position; |
186 | } | 186 | } |
187 | 187 | ||
188 | /** | 188 | /** |
189 | * Set videoplayback to fullscreen | 189 | * Set videoplayback to fullscreen |
190 | * @param isSet | 190 | * @param isSet |
191 | */ | 191 | */ |
192 | void XineControl::setFullscreen( bool isSet ) { | 192 | void XineControl::setFullscreen( bool isSet ) { |
193 | libXine->showVideoFullScreen( isSet ); | 193 | libXine->showVideoFullScreen( isSet ); |
194 | } | 194 | } |
195 | 195 | ||
196 | 196 | ||
197 | QString XineControl::getMetaInfo() { | 197 | QString XineControl::getMetaInfo() { |
198 | 198 | ||
199 | QString returnString; | 199 | QString returnString; |
200 | 200 | ||
201 | if ( !libXine->metaInfo( 0 ).isEmpty() ) { | 201 | if ( !libXine->metaInfo( 0 ).isEmpty() ) { |
202 | returnString += tr( " Title: " + libXine->metaInfo( 0 ) ); | 202 | returnString += tr( " Title: " + libXine->metaInfo( 0 ) ); |
203 | } | 203 | } |
204 | 204 | ||
205 | if ( !libXine->metaInfo( 1 ).isEmpty() ) { | 205 | if ( !libXine->metaInfo( 1 ).isEmpty() ) { |
206 | returnString += tr( " Comment: " + libXine->metaInfo( 1 ) ); | 206 | returnString += tr( " Comment: " + libXine->metaInfo( 1 ) ); |
207 | } | 207 | } |
208 | 208 | ||
209 | if ( !libXine->metaInfo( 2 ).isEmpty() ) { | 209 | if ( !libXine->metaInfo( 2 ).isEmpty() ) { |
210 | returnString += tr( " Artist: " + libXine->metaInfo( 2 ) ); | 210 | returnString += tr( " Artist: " + libXine->metaInfo( 2 ) ); |
211 | } | 211 | } |
212 | 212 | ||
213 | if ( !libXine->metaInfo( 3 ).isEmpty() ) { | 213 | if ( !libXine->metaInfo( 3 ).isEmpty() ) { |
214 | returnString += tr( " Genre: " + libXine->metaInfo( 3 ) ); | 214 | returnString += tr( " Genre: " + libXine->metaInfo( 3 ) ); |
215 | } | 215 | } |
216 | 216 | ||
217 | if ( !libXine->metaInfo( 4 ).isEmpty() ) { | 217 | if ( !libXine->metaInfo( 4 ).isEmpty() ) { |
218 | returnString += tr( " Album: " + libXine->metaInfo( 4 ) ); | 218 | returnString += tr( " Album: " + libXine->metaInfo( 4 ) ); |
219 | } | 219 | } |
220 | 220 | ||
221 | if ( !libXine->metaInfo( 5 ).isEmpty() ) { | 221 | if ( !libXine->metaInfo( 5 ).isEmpty() ) { |
222 | returnString += tr( " Year: " + libXine->metaInfo( 5 ) ); | 222 | returnString += tr( " Year: " + libXine->metaInfo( 5 ) ); |
223 | } | 223 | } |
224 | return returnString; | 224 | return returnString; |
225 | } | 225 | } |
226 | 226 | ||
227 | QString XineControl::getErrorCode() { | 227 | QString XineControl::getErrorCode() { |
228 | int errorCode = libXine->error(); | 228 | int errorCode = libXine->error(); |
229 | 229 | ||
230 | if ( errorCode == 1 ) { | 230 | if ( errorCode == 1 ) { |
231 | return tr( "No input plugin found for this media type" ); | 231 | return tr( "No input plugin found for this media type" ); |
232 | } else { | 232 | } else { |
233 | return tr( "Some other error" ); | 233 | return tr( "Some other error" ); |
234 | } | 234 | } |
235 | } | 235 | } |
236 | 236 | ||
237 | /** | 237 | /** |
238 | * Seek to a position in the track | 238 | * Seek to a position in the track |
239 | * @param second the second to jump to | 239 | * @param second the second to jump to |
240 | */ | 240 | */ |
241 | void XineControl::seekTo( long second ) { | 241 | void XineControl::seekTo( long second ) { |
242 | libXine->seekTo( (int)second ); | 242 | libXine->seekTo( (int)second ); |
diff --git a/noncore/multimedia/opieplayer2/yuv2rgb.h b/noncore/multimedia/opieplayer2/yuv2rgb.h index 5b9c3f6..e453243 100644 --- a/noncore/multimedia/opieplayer2/yuv2rgb.h +++ b/noncore/multimedia/opieplayer2/yuv2rgb.h | |||
@@ -1,151 +1,152 @@ | |||
1 | 1 | ||
2 | #ifndef HAVE_YUV2RGB_H | 2 | #ifndef HAVE_YUV2RGB_H |
3 | #define HAVE_YUV2RGB_h | 3 | #define HAVE_YUV2RGB_h |
4 | 4 | ||
5 | #include <inttypes.h> | 5 | #include <inttypes.h> |
6 | 6 | ||
7 | typedef struct yuv2rgb_s yuv2rgb_t; | 7 | typedef struct yuv2rgb_s yuv2rgb_t; |
8 | 8 | ||
9 | typedef struct yuv2rgb_factory_s yuv2rgb_factory_t; | 9 | typedef struct yuv2rgb_factory_s yuv2rgb_factory_t; |
10 | 10 | ||
11 | /* | 11 | /* |
12 | * function types for functions which can be replaced | 12 | * function types for functions which can be replaced |
13 | * by hardware-accelerated versions | 13 | * by hardware-accelerated versions |
14 | */ | 14 | */ |
15 | 15 | ||
16 | /* internal function use to scale yuv data */ | 16 | /* internal function use to scale yuv data */ |
17 | typedef void (*scale_line_func_t) (uint8_t *source, uint8_t *dest, int width, int step); | 17 | typedef void (*scale_line_func_t) (uint8_t *source, uint8_t *dest, int width, int step); |
18 | 18 | ||
19 | typedef void (*yuv2rgb_fun_t) (yuv2rgb_t *this, uint8_t * image, uint8_t * py, uint8_t * pu, uint8_t * pv) ; | 19 | typedef void (*yuv2rgb_fun_t) (yuv2rgb_t *this, uint8_t * image, uint8_t * py, uint8_t * pu, uint8_t * pv) ; |
20 | 20 | ||
21 | typedef void (*yuy22rgb_fun_t) (yuv2rgb_t *this, uint8_t * image, uint8_t * p); | 21 | typedef void (*yuy22rgb_fun_t) (yuv2rgb_t *this, uint8_t * image, uint8_t * p); |
22 | 22 | ||
23 | typedef uint32_t (*yuv2rgb_single_pixel_fun_t) (yuv2rgb_t *this, uint8_t y, uint8_t u, uint8_t v); | 23 | typedef uint32_t (*yuv2rgb_single_pixel_fun_t) (yuv2rgb_t *this, uint8_t y, uint8_t u, uint8_t v); |
24 | 24 | ||
25 | 25 | ||
26 | /* | 26 | /* |
27 | * modes supported - feel free to implement yours | 27 | * modes supported - feel free to implement yours |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #define MODE_8_RGB 1 | 30 | #define MODE_8_RGB 1 |
31 | #define MODE_8_BGR 2 | 31 | #define MODE_8_BGR 2 |
32 | #define MODE_15_RGB 3 | 32 | #define MODE_15_RGB 3 |
33 | #define MODE_15_BGR 4 | 33 | #define MODE_15_BGR 4 |
34 | #define MODE_16_RGB 5 | 34 | #define MODE_16_RGB 5 |
35 | #define MODE_16_BGR 6 | 35 | #define MODE_16_BGR 6 |
36 | #define MODE_24_RGB 7 | 36 | #define MODE_24_RGB 7 |
37 | #define MODE_24_BGR 8 | 37 | #define MODE_24_BGR 8 |
38 | #define MODE_32_RGB 9 | 38 | #define MODE_32_RGB 9 |
39 | #define MODE_32_BGR 10 | 39 | #define MODE_32_BGR 10 |
40 | #defineMODE_8_GRAY 11 | 40 | #defineMODE_8_GRAY 11 |
41 | #define MODE_PALETTE 12 | 41 | #define MODE_PALETTE 12 |
42 | 42 | ||
43 | struct yuv2rgb_s { | 43 | struct yuv2rgb_s { |
44 | 44 | ||
45 | /* | 45 | /* |
46 | * configure converter for scaling factors | 46 | * configure converter for scaling factors |
47 | */ | 47 | */ |
48 | int (*configure) (yuv2rgb_t *this, | 48 | int (*configure) (yuv2rgb_t *this, |
49 | int source_width, int source_height, | 49 | int source_width, int source_height, |
50 | int y_stride, int uv_stride, | 50 | int y_stride, int uv_stride, |
51 | int dest_width, int dest_height, | 51 | int dest_width, int dest_height, |
52 | int rgb_stride); | 52 | int rgb_stride); |
53 | 53 | ||
54 | /* | 54 | /* |
55 | * this is the function to call for the yuv2rgb and scaling process | 55 | * this is the function to call for the yuv2rgb and scaling process |
56 | */ | 56 | */ |
57 | yuv2rgb_fun_t yuv2rgb_fun; | 57 | yuv2rgb_fun_t yuv2rgb_fun; |
58 | 58 | ||
59 | /* | 59 | /* |
60 | * this is the function to call for the yuy2->rgb and scaling process | 60 | * this is the function to call for the yuy2->rgb and scaling process |
61 | */ | 61 | */ |
62 | yuy22rgb_fun_t yuy22rgb_fun; | 62 | yuy22rgb_fun_t yuy22rgb_fun; |
63 | 63 | ||
64 | /* | 64 | /* |
65 | * this is the function to call for the yuv2rgb for a single pixel | 65 | * this is the function to call for the yuv2rgb for a single pixel |
66 | * (used for converting clut colors) | 66 | * (used for converting clut colors) |
67 | */ | 67 | */ |
68 | 68 | ||
69 | yuv2rgb_single_pixel_fun_t yuv2rgb_single_pixel_fun; | 69 | yuv2rgb_single_pixel_fun_t yuv2rgb_single_pixel_fun; |
70 | 70 | ||
71 | /* private stuff below */ | 71 | /* private stuff below */ |
72 | 72 | ||
73 | int source_width, source_height; | 73 | int source_width, source_height; |
74 | int y_stride, uv_stride; | 74 | int y_stride, uv_stride; |
75 | int dest_width, dest_height; | 75 | int dest_width, dest_height; |
76 | int rgb_stride; | 76 | int rgb_stride; |
77 | int step_dx, step_dy; | 77 | int step_dx, step_dy; |
78 | int do_scale; | 78 | int do_scale; |
79 | 79 | ||
80 | uint8_t *y_buffer; | 80 | uint8_t *y_buffer; |
81 | uint8_t *u_buffer; | 81 | uint8_t *u_buffer; |
82 | uint8_t *v_buffer; | 82 | uint8_t *v_buffer; |
83 | void *y_chunk; | 83 | void *y_chunk; |
84 | void *u_chunk; | 84 | void *u_chunk; |
85 | void *v_chunk; | 85 | void *v_chunk; |
86 | 86 | ||
87 | void **table_rV; | 87 | void **table_rV; |
88 | void **table_gU; | 88 | void **table_gU; |
89 | int *table_gV; | 89 | int *table_gV; |
90 | void **table_bU; | 90 | void **table_bU; |
91 | 91 | ||
92 | uint8_t *cmap; | 92 | uint8_t *cmap; |
93 | scale_line_func_t scale_line; | 93 | scale_line_func_t scale_line; |
94 | 94 | ||
95 | } ; | 95 | } ; |
96 | 96 | ||
97 | /* | 97 | /* |
98 | * convenience class to easily create a lot of converters | 98 | * convenience class to easily create a lot of converters |
99 | */ | 99 | */ |
100 | 100 | ||
101 | struct yuv2rgb_factory_s { | 101 | struct yuv2rgb_factory_s { |
102 | 102 | ||
103 | yuv2rgb_t* (*create_converter) (yuv2rgb_factory_t *this); | 103 | yuv2rgb_t* (*create_converter) (yuv2rgb_factory_t *this); |
104 | 104 | ||
105 | /* | 105 | /* |
106 | * adjust gamma (-100 to 100 looks fine) | 106 | * adjust gamma (-100 to 100 looks fine) |
107 | * for all converters produced by this factory | 107 | * for all converters produced by this factory |
108 | */ | 108 | */ |
109 | void (*set_gamma) (yuv2rgb_factory_t *this, int gamma); | 109 | void (*set_gamma) (yuv2rgb_factory_t *this, int gamma); |
110 | 110 | ||
111 | /* | 111 | /* |
112 | * get gamma value | 112 | * get gamma value |
113 | */ | 113 | */ |
114 | int (*get_gamma) (yuv2rgb_factory_t *this); | 114 | int (*get_gamma) (yuv2rgb_factory_t *this); |
115 | 115 | ||
116 | /* private data */ | 116 | /* private data */ |
117 | 117 | ||
118 | int mode; | 118 | int mode; |
119 | int swapped; | 119 | int swapped; |
120 | uint8_t *cmap; | 120 | uint8_t *cmap; |
121 | 121 | ||
122 | int gamma; | 122 | int gamma; |
123 | int entry_size; | 123 | int entry_size; |
124 | 124 | ||
125 | uint32_t matrix_coefficients; | 125 | uint32_t matrix_coefficients; |
126 | 126 | ||
127 | void *table_rV[256]; | 127 | void *table_rV[256]; |
128 | void *table_gU[256]; | 128 | void *table_gU[256]; |
129 | int table_gV[256]; | 129 | int table_gV[256]; |
130 | void *table_bU[256]; | 130 | void *table_bU[256]; |
131 | 131 | ||
132 | /* preselected functions for mode/swap/hardware */ | 132 | /* preselected functions for mode/swap/hardware */ |
133 | yuv2rgb_fun_t yuv2rgb_fun; | 133 | yuv2rgb_fun_t yuv2rgb_fun; |
134 | yuy22rgb_fun_t yuy22rgb_fun; | 134 | yuy22rgb_fun_t yuy22rgb_fun; |
135 | yuv2rgb_single_pixel_fun_t yuv2rgb_single_pixel_fun; | 135 | yuv2rgb_single_pixel_fun_t yuv2rgb_single_pixel_fun; |
136 | 136 | ||
137 | }; | 137 | }; |
138 | 138 | ||
139 | yuv2rgb_factory_t *yuv2rgb_factory_init (int mode, int swapped, uint8_t *colormap); | 139 | yuv2rgb_factory_t *yuv2rgb_factory_init (int mode, int swapped, uint8_t *colormap); |
140 | 140 | ||
141 | 141 | ||
142 | /* | 142 | /* |
143 | * internal stuff below this line | 143 | * internal stuff below this line |
144 | */ | 144 | */ |
145 | 145 | ||
146 | void mmx_yuv2rgb_set_gamma(int gamma); | 146 | void mmx_yuv2rgb_set_gamma(int gamma); |
147 | void yuv2rgb_init_mmxext (yuv2rgb_factory_t *this); | 147 | void yuv2rgb_init_mmxext (yuv2rgb_factory_t *this); |
148 | void yuv2rgb_init_mmx (yuv2rgb_factory_t *this); | 148 | void yuv2rgb_init_mmx (yuv2rgb_factory_t *this); |
149 | void yuv2rgb_init_mlib (yuv2rgb_factory_t *this); | 149 | void yuv2rgb_init_mlib (yuv2rgb_factory_t *this); |
150 | void yuv2rgb_init_arm (yuv2rgb_factory_t *this); | ||
150 | 151 | ||
151 | #endif | 152 | #endif |