-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 8 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 2 |
4 files changed, 8 insertions, 7 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index 3b20873..d554141 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp | |||
@@ -1,248 +1,249 @@ | |||
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 LJP <> | 5 | Copyright (c) 2002 LJP <> |
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 <stdio.h> | 34 | #include <stdio.h> |
35 | #include <stdlib.h> | 35 | #include <stdlib.h> |
36 | #include <qimage.h> | 36 | #include <qimage.h> |
37 | #include <qtextstream.h> | 37 | #include <qtextstream.h> |
38 | #include <qpe/resource.h> | 38 | #include <qpe/resource.h> |
39 | 39 | ||
40 | #include <qfile.h> | 40 | #include <qfile.h> |
41 | 41 | ||
42 | #include <qgfx_qws.h> | 42 | #include <qgfx_qws.h> |
43 | #include <qdirectpainter_qws.h> | 43 | #include <qdirectpainter_qws.h> |
44 | 44 | ||
45 | #include "xinevideowidget.h" | 45 | #include "xinevideowidget.h" |
46 | #include "frame.h" | 46 | #include "frame.h" |
47 | #include "lib.h" | 47 | #include "lib.h" |
48 | 48 | ||
49 | typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, | 49 | typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, |
50 | int width, int height,int bytes ); | 50 | int width, int height,int bytes ); |
51 | 51 | ||
52 | extern "C" { | 52 | extern "C" { |
53 | vo_driver_t* init_video_out_plugin( config_values_t* conf, void* video); | 53 | vo_driver_t* init_video_out_plugin( config_values_t* conf, void* video); |
54 | int null_is_showing_video( vo_driver_t* self ); | 54 | int null_is_showing_video( vo_driver_t* self ); |
55 | void null_set_show_video( vo_driver_t* self, int show ); | 55 | void null_set_show_video( vo_driver_t* self, int show ); |
56 | int null_is_fullscreen( vo_driver_t* self ); | 56 | int null_is_fullscreen( vo_driver_t* self ); |
57 | void null_set_fullscreen( vo_driver_t* self, int screen ); | 57 | void null_set_fullscreen( vo_driver_t* self, int screen ); |
58 | int null_is_scaling( vo_driver_t* self ); | 58 | int null_is_scaling( vo_driver_t* self ); |
59 | void null_set_scaling( vo_driver_t* self, int scale ); | 59 | void null_set_scaling( vo_driver_t* self, int scale ); |
60 | void null_set_gui_width( vo_driver_t* self, int width ); | 60 | void null_set_gui_width( vo_driver_t* self, int width ); |
61 | void null_set_gui_height( vo_driver_t* self, int height ); | 61 | void null_set_gui_height( vo_driver_t* self, int height ); |
62 | void null_set_mode( vo_driver_t* self, int depth, int rgb ); | 62 | void null_set_mode( vo_driver_t* self, int depth, int rgb ); |
63 | void null_display_handler(vo_driver_t* self, display_xine_frame_t t, void* user_data); | 63 | void null_display_handler(vo_driver_t* self, display_xine_frame_t t, void* user_data); |
64 | } | 64 | } |
65 | 65 | ||
66 | using namespace XINE; | 66 | using namespace XINE; |
67 | 67 | ||
68 | Lib::Lib(XineVideoWidget* widget) { | 68 | Lib::Lib(XineVideoWidget* widget) { |
69 | m_video = false; | 69 | m_video = false; |
70 | m_wid = widget; | 70 | m_wid = widget; |
71 | printf("Lib"); | 71 | printf("Lib"); |
72 | QCString str( getenv("HOME") ); | 72 | QCString str( getenv("HOME") ); |
73 | str += "/Settings/opiexine.cf"; | 73 | str += "/Settings/opiexine.cf"; |
74 | // get the configuration | 74 | // get the configuration |
75 | 75 | ||
76 | // not really OO, should be an extra class, later | 76 | // not really OO, should be an extra class, later |
77 | if ( !QFile(str).exists() ) { | 77 | if ( !QFile(str).exists() ) { |
78 | QFile f(str); | 78 | QFile f(str); |
79 | f.open(IO_WriteOnly); | 79 | f.open(IO_WriteOnly); |
80 | QTextStream ts( &f ); | 80 | QTextStream ts( &f ); |
81 | ts << "misc.memcpy_method:glibc"; | 81 | ts << "misc.memcpy_method:glibc"; |
82 | f.close(); | 82 | f.close(); |
83 | } | 83 | } |
84 | 84 | ||
85 | m_config = xine_config_file_init( str.data() ); | 85 | m_config = xine_config_file_init( str.data() ); |
86 | 86 | ||
87 | // allocate oss for sound | 87 | // allocate oss for sound |
88 | // and fb for framebuffer | 88 | // and fb for framebuffer |
89 | m_audioOutput= xine_load_audio_output_plugin( m_config, "oss") ; | 89 | m_audioOutput= xine_load_audio_output_plugin( m_config, "oss") ; |
90 | if (m_audioOutput == NULL ) | 90 | if (m_audioOutput == NULL ) |
91 | printf("Failure\n"); | 91 | printf("Failure\n"); |
92 | else | 92 | else |
93 | printf("Success\n"); | 93 | printf("Success\n"); |
94 | 94 | ||
95 | 95 | ||
96 | // test code | 96 | // test code |
97 | /* m_videoOutput = xine_load_video_output_plugin(m_config, "fb", | 97 | /* m_videoOutput = xine_load_video_output_plugin(m_config, "fb", |
98 | VISUAL_TYPE_FB, | 98 | VISUAL_TYPE_FB, |
99 | 0 ); | 99 | 0 ); |
100 | */ | 100 | */ |
101 | 101 | ||
102 | char** files = xine_list_video_output_plugins(3); | 102 | char** files = xine_list_video_output_plugins(3); |
103 | char* out; | 103 | char* out; |
104 | int i = 0; | 104 | int i = 0; |
105 | while ( ( out = files[i] ) != 0 ) { | 105 | while ( ( out = files[i] ) != 0 ) { |
106 | printf("Video %s\n", out ); | 106 | printf("Video %s\n", out ); |
107 | i++; | 107 | i++; |
108 | } | 108 | } |
109 | // m_xine = xine_init( m_videoOutput, | 109 | // m_xine = xine_init( m_videoOutput, |
110 | // m_audioOutput, | 110 | // m_audioOutput, |
111 | // m_config ); | 111 | // m_config ); |
112 | // test loading | 112 | // test loading |
113 | m_videoOutput = ::init_video_out_plugin( m_config, NULL ); | 113 | m_videoOutput = ::init_video_out_plugin( m_config, NULL ); |
114 | if (m_wid != 0 ) { | 114 | if (m_wid != 0 ) { |
115 | printf("!0\n" ); | 115 | printf("!0\n" ); |
116 | resize ( m_wid-> size ( )); | 116 | resize ( m_wid-> size ( )); |
117 | ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); | 117 | ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); |
118 | m_wid-> setImage ( new QImage ( Resource::loadImage(""))); | 118 | m_wid-> setImage ( new QImage ( Resource::loadImage(""))); |
119 | m_wid->repaint(); | 119 | m_wid->repaint(); |
120 | } | 120 | } |
121 | null_display_handler( m_videoOutput, | 121 | null_display_handler( m_videoOutput, |
122 | xine_display_frame, | 122 | xine_display_frame, |
123 | this ); | 123 | this ); |
124 | 124 | ||
125 | m_xine = xine_init( m_videoOutput, | 125 | m_xine = xine_init( m_videoOutput, |
126 | m_audioOutput, m_config ); | 126 | m_audioOutput, m_config ); |
127 | // install the event handler | 127 | // install the event handler |
128 | xine_register_event_listener( m_xine, xine_event_handler, this ); | 128 | xine_register_event_listener( m_xine, xine_event_handler, this ); |
129 | } | 129 | } |
130 | 130 | ||
131 | Lib::~Lib() { | 131 | Lib::~Lib() { |
132 | delete m_config; | 132 | delete m_config; |
133 | xine_remove_event_listener( m_xine, xine_event_handler ); | 133 | xine_remove_event_listener( m_xine, xine_event_handler ); |
134 | xine_exit( m_xine ); | 134 | xine_exit( m_xine ); |
135 | delete m_videoOutput; | 135 | delete m_videoOutput; |
136 | //delete m_audioOutput; | 136 | //delete m_audioOutput; |
137 | 137 | ||
138 | } | 138 | } |
139 | 139 | ||
140 | void Lib::resize ( const QSize &s ) | 140 | void Lib::resize ( const QSize &s ) |
141 | { | 141 | { |
142 | if ( s. width ( ) && s. height ( )) { | 142 | if ( s. width ( ) && s. height ( )) { |
143 | ::null_set_gui_width( m_videoOutput, s. width() ); | 143 | ::null_set_gui_width( m_videoOutput, s. width() ); |
144 | ::null_set_gui_height(m_videoOutput, s. height() ); | 144 | ::null_set_gui_height(m_videoOutput, s. height() ); |
145 | } | 145 | } |
146 | } | 146 | } |
147 | 147 | ||
148 | QCString Lib::version() { | 148 | QCString Lib::version() { |
149 | QCString str( xine_get_str_version() ); | 149 | QCString str( xine_get_str_version() ); |
150 | return str; | 150 | return str; |
151 | }; | 151 | }; |
152 | 152 | ||
153 | int Lib::majorVersion() { | 153 | int Lib::majorVersion() { |
154 | return xine_get_major_version(); | 154 | return xine_get_major_version(); |
155 | } | 155 | } |
156 | int Lib::minorVersion() { | 156 | int Lib::minorVersion() { |
157 | return xine_get_minor_version(); | 157 | return xine_get_minor_version(); |
158 | }; | 158 | }; |
159 | 159 | ||
160 | int Lib::subVersion() { | 160 | int Lib::subVersion() { |
161 | return xine_get_sub_version(); | 161 | return xine_get_sub_version(); |
162 | } | 162 | } |
163 | int Lib::play( const QString& fileName, | 163 | int Lib::play( const QString& fileName, |
164 | int startPos, | 164 | int startPos, |
165 | int start_time ) { | 165 | int start_time ) { |
166 | QString str = fileName.stripWhiteSpace(); | 166 | QString str = fileName.stripWhiteSpace(); |
167 | //workaround OpiePlayer bug | 167 | //workaround OpiePlayer bug |
168 | if (str.right(1) == QString::fromLatin1("/") ) | 168 | if (str.right(1) == QString::fromLatin1("/") ) |
169 | str = str.mid( str.length() -1 ); | 169 | str = str.mid( str.length() -1 ); |
170 | return xine_play( m_xine, QFile::encodeName(str.utf8() ).data(), | 170 | return xine_play( m_xine, QFile::encodeName(str.utf8() ).data(), |
171 | startPos, start_time); | 171 | startPos, start_time); |
172 | } | 172 | } |
173 | void Lib::stop() { | 173 | void Lib::stop() { |
174 | qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); | ||
174 | xine_stop(m_xine ); | 175 | xine_stop(m_xine ); |
175 | } | 176 | } |
176 | void Lib::pause(){ | 177 | void Lib::pause(){ |
177 | xine_set_speed( m_xine, SPEED_PAUSE ); | 178 | xine_set_speed( m_xine, SPEED_PAUSE ); |
178 | } | 179 | } |
179 | int Lib::speed() { | 180 | int Lib::speed() { |
180 | return xine_get_speed( m_xine ); | 181 | return xine_get_speed( m_xine ); |
181 | } | 182 | } |
182 | void Lib::setSpeed( int speed ) { | 183 | void Lib::setSpeed( int speed ) { |
183 | xine_set_speed( m_xine, speed ); | 184 | xine_set_speed( m_xine, speed ); |
184 | } | 185 | } |
185 | int Lib::status(){ | 186 | int Lib::status(){ |
186 | return xine_get_status( m_xine ); | 187 | return xine_get_status( m_xine ); |
187 | } | 188 | } |
188 | int Lib::currentPosition(){ | 189 | int Lib::currentPosition(){ |
189 | return xine_get_current_position( m_xine ); | 190 | return xine_get_current_position( m_xine ); |
190 | } | 191 | } |
191 | int Lib::currentTime() { | 192 | int Lib::currentTime() { |
192 | return xine_get_current_time( m_xine ); | 193 | return xine_get_current_time( m_xine ); |
193 | }; | 194 | }; |
194 | int Lib::length() { | 195 | int Lib::length() { |
195 | return xine_get_stream_length( m_xine ); | 196 | return xine_get_stream_length( m_xine ); |
196 | } | 197 | } |
197 | bool Lib::isSeekable() { | 198 | bool Lib::isSeekable() { |
198 | return xine_is_stream_seekable(m_xine); | 199 | return xine_is_stream_seekable(m_xine); |
199 | } | 200 | } |
200 | Frame Lib::currentFrame() { | 201 | Frame Lib::currentFrame() { |
201 | Frame frame; | 202 | Frame frame; |
202 | return frame; | 203 | return frame; |
203 | }; | 204 | }; |
204 | int Lib::error() { | 205 | int Lib::error() { |
205 | return xine_get_error( m_xine ); | 206 | return xine_get_error( m_xine ); |
206 | }; | 207 | }; |
207 | void Lib::handleXineEvent( xine_event_t* t ) { | 208 | void Lib::handleXineEvent( xine_event_t* t ) { |
208 | if ( t->type == XINE_EVENT_PLAYBACK_FINISHED ) | 209 | if ( t->type == XINE_EVENT_PLAYBACK_FINISHED ) |
209 | emit stopped(); | 210 | emit stopped(); |
210 | } | 211 | } |
211 | void Lib::setShowVideo( bool video ) { | 212 | void Lib::setShowVideo( bool video ) { |
212 | m_video = video; | 213 | m_video = video; |
213 | ::null_set_show_video( m_videoOutput, video ); | 214 | ::null_set_show_video( m_videoOutput, video ); |
214 | } | 215 | } |
215 | bool Lib::isShowingVideo() { | 216 | bool Lib::isShowingVideo() { |
216 | return ::null_is_showing_video( m_videoOutput ); | 217 | return ::null_is_showing_video( m_videoOutput ); |
217 | } | 218 | } |
218 | void Lib::showVideoFullScreen( bool fullScreen ) { | 219 | void Lib::showVideoFullScreen( bool fullScreen ) { |
219 | ::null_set_fullscreen( m_videoOutput, fullScreen ); | 220 | ::null_set_fullscreen( m_videoOutput, fullScreen ); |
220 | } | 221 | } |
221 | bool Lib::isVideoFullScreen() { | 222 | bool Lib::isVideoFullScreen() { |
222 | return ::null_is_fullscreen( m_videoOutput ); | 223 | return ::null_is_fullscreen( m_videoOutput ); |
223 | } | 224 | } |
224 | void Lib::setScaling( bool scale ) { | 225 | void Lib::setScaling( bool scale ) { |
225 | ::null_set_scaling( m_videoOutput, scale ); | 226 | ::null_set_scaling( m_videoOutput, scale ); |
226 | } | 227 | } |
227 | bool Lib::isScaling() { | 228 | bool Lib::isScaling() { |
228 | return ::null_is_scaling( m_videoOutput ); | 229 | return ::null_is_scaling( m_videoOutput ); |
229 | } | 230 | } |
230 | void Lib::xine_event_handler( void* user_data, xine_event_t* t ) { | 231 | void Lib::xine_event_handler( void* user_data, xine_event_t* t ) { |
231 | ((Lib*)user_data)->handleXineEvent( t ); | 232 | ((Lib*)user_data)->handleXineEvent( t ); |
232 | } | 233 | } |
233 | void Lib::xine_display_frame( void* user_data, uint8_t *frame, | 234 | void Lib::xine_display_frame( void* user_data, uint8_t *frame, |
234 | int width, int height, int bytes ) { | 235 | int width, int height, int bytes ) { |
235 | 236 | ||
236 | ((Lib*)user_data)->drawFrame( frame, width, height, bytes ); | 237 | ((Lib*)user_data)->drawFrame( frame, width, height, bytes ); |
237 | } | 238 | } |
238 | void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { | 239 | void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { |
239 | if (!m_video ) { | 240 | if (!m_video ) { |
240 | qWarning("not showing video now"); | 241 | qWarning("not showing video now"); |
241 | return; | 242 | return; |
242 | } | 243 | } |
243 | // qWarning("called draw frame %d %d", width, height); | 244 | // qWarning("called draw frame %d %d", width, height); |
244 | 245 | ||
245 | m_wid->setImage( frame, width, height, bytes ); | 246 | m_wid->setImage( frame, width, height, bytes ); |
246 | // m_wid->repaint(false); | 247 | // m_wid->repaint(false); |
247 | 248 | ||
248 | } | 249 | } |
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 51fbb8b..93819f2 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -1,266 +1,266 @@ | |||
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 | 5 | ||
6 | #include <qmainwindow.h> | 6 | #include <qmainwindow.h> |
7 | #include <qmessagebox.h> | 7 | #include <qmessagebox.h> |
8 | #include <qwidgetstack.h> | 8 | #include <qwidgetstack.h> |
9 | #include <qfile.h> | 9 | #include <qfile.h> |
10 | 10 | ||
11 | #include "mediaplayer.h" | 11 | #include "mediaplayer.h" |
12 | #include "playlistwidget.h" | 12 | #include "playlistwidget.h" |
13 | #include "audiowidget.h" | 13 | #include "audiowidget.h" |
14 | #include "videowidget.h" | 14 | #include "videowidget.h" |
15 | #include "volumecontrol.h" | 15 | #include "volumecontrol.h" |
16 | 16 | ||
17 | #include "mediaplayerstate.h" | 17 | #include "mediaplayerstate.h" |
18 | 18 | ||
19 | 19 | ||
20 | 20 | ||
21 | extern AudioWidget *audioUI; | 21 | extern AudioWidget *audioUI; |
22 | extern VideoWidget *videoUI; | 22 | extern VideoWidget *videoUI; |
23 | extern PlayListWidget *playList; | 23 | extern PlayListWidget *playList; |
24 | extern MediaPlayerState *mediaPlayerState; | 24 | extern MediaPlayerState *mediaPlayerState; |
25 | 25 | ||
26 | 26 | ||
27 | MediaPlayer::MediaPlayer( QObject *parent, const char *name ) | 27 | MediaPlayer::MediaPlayer( QObject *parent, const char *name ) |
28 | : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { | 28 | : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { |
29 | 29 | ||
30 | 30 | ||
31 | xineControl = new XineControl(); | 31 | xineControl = new XineControl(); |
32 | // QPEApplication::grabKeyboard(); // EVIL | 32 | // QPEApplication::grabKeyboard(); // EVIL |
33 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 33 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
34 | 34 | ||
35 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); | 35 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); |
36 | 36 | ||
37 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); | 37 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); |
38 | 38 | ||
39 | connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); | 39 | connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); |
40 | connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); | 40 | connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); |
41 | 41 | ||
42 | connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | 42 | connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); |
43 | connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | 43 | connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); |
44 | connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | 44 | connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); |
45 | connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | 45 | connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); |
46 | 46 | ||
47 | connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | 47 | connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); |
48 | connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | 48 | connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); |
49 | connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | 49 | connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); |
50 | connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | 50 | connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); |
51 | 51 | ||
52 | volControl = new VolumeControl; | 52 | volControl = new VolumeControl; |
53 | 53 | ||
54 | } | 54 | } |
55 | 55 | ||
56 | MediaPlayer::~MediaPlayer() { | 56 | MediaPlayer::~MediaPlayer() { |
57 | delete xineControl; | 57 | delete xineControl; |
58 | delete volControl; | 58 | delete volControl; |
59 | } | 59 | } |
60 | 60 | ||
61 | void MediaPlayer::pauseCheck( bool b ) { | 61 | void MediaPlayer::pauseCheck( bool b ) { |
62 | if ( b && !mediaPlayerState->playing() ) { | 62 | if ( b && !mediaPlayerState->playing() ) { |
63 | mediaPlayerState->setPaused( FALSE ); | 63 | mediaPlayerState->setPaused( FALSE ); |
64 | } | 64 | } |
65 | } | 65 | } |
66 | 66 | ||
67 | void MediaPlayer::play() { | 67 | void MediaPlayer::play() { |
68 | mediaPlayerState->setPlaying( FALSE ); | 68 | mediaPlayerState->setPlaying( FALSE ); |
69 | mediaPlayerState->setPlaying( TRUE ); | 69 | mediaPlayerState->setPlaying( TRUE ); |
70 | } | 70 | } |
71 | 71 | ||
72 | void MediaPlayer::setPlaying( bool play ) { | 72 | void MediaPlayer::setPlaying( bool play ) { |
73 | if ( !play ) { | 73 | if ( !play ) { |
74 | mediaPlayerState->setPaused( FALSE ); | 74 | //mediaPlayerState->setPaused( TRUE ); |
75 | return; | 75 | return; |
76 | } | 76 | } |
77 | 77 | ||
78 | if ( mediaPlayerState->paused() ) { | 78 | if ( mediaPlayerState->paused() ) { |
79 | mediaPlayerState->setPaused( FALSE ); | 79 | mediaPlayerState->setPaused( FALSE ); |
80 | return; | 80 | return; |
81 | } | 81 | } |
82 | 82 | ||
83 | const DocLnk *playListCurrent = playList->current(); | 83 | const DocLnk *playListCurrent = playList->current(); |
84 | if ( playListCurrent != NULL ) { | 84 | if ( playListCurrent != NULL ) { |
85 | currentFile = playListCurrent; | 85 | currentFile = playListCurrent; |
86 | } | 86 | } |
87 | 87 | ||
88 | xineControl->play( currentFile->file() ); | 88 | xineControl->play( currentFile->file() ); |
89 | 89 | ||
90 | xineControl->length(); | 90 | xineControl->length(); |
91 | long seconds = mediaPlayerState->length();// | 91 | long seconds = mediaPlayerState->length();// |
92 | QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); | 92 | QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); |
93 | qDebug(time); | 93 | qDebug(time); |
94 | 94 | ||
95 | QString tickerText; | 95 | QString tickerText; |
96 | if( currentFile->file().left(4) == "http" ) | 96 | if( currentFile->file().left(4) == "http" ) |
97 | tickerText= tr( " File: " ) + currentFile->name(); | 97 | tickerText= tr( " File: " ) + currentFile->name(); |
98 | else | 98 | else |
99 | tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time; | 99 | tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time; |
100 | 100 | ||
101 | // QString fileInfo = mediaPlayerState->curDecoder()->fileInfo(); | 101 | // QString fileInfo = mediaPlayerState->curDecoder()->fileInfo(); |
102 | 102 | ||
103 | // if ( !fileInfo.isEmpty() ) | 103 | // if ( !fileInfo.isEmpty() ) |
104 | // tickerText += ", " + fileInfo; | 104 | // tickerText += ", " + fileInfo; |
105 | // audioUI->setTickerText( tickerText + "." ); | 105 | // audioUI->setTickerText( tickerText + "." ); |
106 | 106 | ||
107 | audioUI->setTickerText( currentFile->file( ) ); | 107 | audioUI->setTickerText( currentFile->file( ) ); |
108 | 108 | ||
109 | } | 109 | } |
110 | 110 | ||
111 | 111 | ||
112 | void MediaPlayer::prev() { | 112 | void MediaPlayer::prev() { |
113 | if ( playList->prev() ) { | 113 | if ( playList->prev() ) { |
114 | play(); | 114 | play(); |
115 | } else if ( mediaPlayerState->looping() ) { | 115 | } else if ( mediaPlayerState->looping() ) { |
116 | if ( playList->last() ) { | 116 | if ( playList->last() ) { |
117 | play(); | 117 | play(); |
118 | } | 118 | } |
119 | } else { | 119 | } else { |
120 | mediaPlayerState->setList(); | 120 | mediaPlayerState->setList(); |
121 | } | 121 | } |
122 | } | 122 | } |
123 | 123 | ||
124 | 124 | ||
125 | void MediaPlayer::next() { | 125 | void MediaPlayer::next() { |
126 | if ( playList->next() ) { | 126 | if ( playList->next() ) { |
127 | play(); | 127 | play(); |
128 | } else if ( mediaPlayerState->looping() ) { | 128 | } else if ( mediaPlayerState->looping() ) { |
129 | if ( playList->first() ) { | 129 | if ( playList->first() ) { |
130 | play(); | 130 | play(); |
131 | } | 131 | } |
132 | } else { | 132 | } else { |
133 | mediaPlayerState->setList(); | 133 | mediaPlayerState->setList(); |
134 | } | 134 | } |
135 | } | 135 | } |
136 | 136 | ||
137 | 137 | ||
138 | void MediaPlayer::startDecreasingVolume() { | 138 | void MediaPlayer::startDecreasingVolume() { |
139 | volumeDirection = -1; | 139 | volumeDirection = -1; |
140 | startTimer( 100 ); | 140 | startTimer( 100 ); |
141 | volControl->decVol(2); | 141 | volControl->decVol(2); |
142 | } | 142 | } |
143 | 143 | ||
144 | 144 | ||
145 | void MediaPlayer::startIncreasingVolume() { | 145 | void MediaPlayer::startIncreasingVolume() { |
146 | volumeDirection = +1; | 146 | volumeDirection = +1; |
147 | startTimer( 100 ); | 147 | startTimer( 100 ); |
148 | volControl->incVol(2); | 148 | volControl->incVol(2); |
149 | } | 149 | } |
150 | 150 | ||
151 | 151 | ||
152 | bool drawnOnScreenDisplay = FALSE; | 152 | bool drawnOnScreenDisplay = FALSE; |
153 | unsigned int onScreenDisplayVolume = 0; | 153 | unsigned int onScreenDisplayVolume = 0; |
154 | const int yoff = 110; | 154 | const int yoff = 110; |
155 | 155 | ||
156 | void MediaPlayer::stopChangingVolume() { | 156 | void MediaPlayer::stopChangingVolume() { |
157 | killTimers(); | 157 | killTimers(); |
158 | // Get rid of the on-screen display stuff | 158 | // Get rid of the on-screen display stuff |
159 | drawnOnScreenDisplay = FALSE; | 159 | drawnOnScreenDisplay = FALSE; |
160 | onScreenDisplayVolume = 0; | 160 | onScreenDisplayVolume = 0; |
161 | int w=0; | 161 | int w=0; |
162 | int h=0; | 162 | int h=0; |
163 | if( !xineControl->hasVideo()) { | 163 | if( !xineControl->hasVideo()) { |
164 | w = audioUI->width(); | 164 | w = audioUI->width(); |
165 | h = audioUI->height(); | 165 | h = audioUI->height(); |
166 | audioUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); | 166 | audioUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); |
167 | } else { | 167 | } else { |
168 | w = videoUI->width(); | 168 | w = videoUI->width(); |
169 | h = videoUI->height(); | 169 | h = videoUI->height(); |
170 | videoUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); | 170 | videoUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); |
171 | } | 171 | } |
172 | } | 172 | } |
173 | 173 | ||
174 | 174 | ||
175 | void MediaPlayer::timerEvent( QTimerEvent * ) { | 175 | void MediaPlayer::timerEvent( QTimerEvent * ) { |
176 | if ( volumeDirection == +1 ) { | 176 | if ( volumeDirection == +1 ) { |
177 | volControl->incVol(2); | 177 | volControl->incVol(2); |
178 | } else if ( volumeDirection == -1 ) { | 178 | } else if ( volumeDirection == -1 ) { |
179 | volControl->decVol(2); | 179 | volControl->decVol(2); |
180 | } | 180 | } |
181 | 181 | ||
182 | 182 | ||
183 | // TODO FIXME | 183 | // TODO FIXME |
184 | int v; | 184 | int v; |
185 | v = volControl->getVolume(); | 185 | v = volControl->getVolume(); |
186 | v = v / 10; | 186 | v = v / 10; |
187 | 187 | ||
188 | if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { | 188 | if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { |
189 | return; | 189 | return; |
190 | } | 190 | } |
191 | 191 | ||
192 | int w=0; int h=0; | 192 | int w=0; int h=0; |
193 | if( !xineControl->hasVideo()) { | 193 | if( !xineControl->hasVideo()) { |
194 | w = audioUI->width(); | 194 | w = audioUI->width(); |
195 | h = audioUI->height(); | 195 | h = audioUI->height(); |
196 | 196 | ||
197 | if ( drawnOnScreenDisplay ) { | 197 | if ( drawnOnScreenDisplay ) { |
198 | if ( onScreenDisplayVolume > v ) { | 198 | if ( onScreenDisplayVolume > v ) { |
199 | audioUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); | 199 | audioUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); |
200 | } | 200 | } |
201 | } | 201 | } |
202 | drawnOnScreenDisplay = TRUE; | 202 | drawnOnScreenDisplay = TRUE; |
203 | onScreenDisplayVolume = v; | 203 | onScreenDisplayVolume = v; |
204 | QPainter p( audioUI ); | 204 | QPainter p( audioUI ); |
205 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); | 205 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); |
206 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); | 206 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); |
207 | 207 | ||
208 | QFont f; | 208 | QFont f; |
209 | f.setPixelSize( 20 ); | 209 | f.setPixelSize( 20 ); |
210 | f.setBold( TRUE ); | 210 | f.setBold( TRUE ); |
211 | p.setFont( f ); | 211 | p.setFont( f ); |
212 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); | 212 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); |
213 | 213 | ||
214 | for ( unsigned int i = 0; i < 10; i++ ) { | 214 | for ( unsigned int i = 0; i < 10; i++ ) { |
215 | if ( v > i ) { | 215 | if ( v > i ) { |
216 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); | 216 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); |
217 | } else { | 217 | } else { |
218 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); | 218 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); |
219 | } | 219 | } |
220 | } | 220 | } |
221 | } else { | 221 | } else { |
222 | w = videoUI->width(); | 222 | w = videoUI->width(); |
223 | h = videoUI->height(); | 223 | h = videoUI->height(); |
224 | 224 | ||
225 | if ( drawnOnScreenDisplay ) { | 225 | if ( drawnOnScreenDisplay ) { |
226 | if ( onScreenDisplayVolume > v ) { | 226 | if ( onScreenDisplayVolume > v ) { |
227 | videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); | 227 | videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); |
228 | } | 228 | } |
229 | } | 229 | } |
230 | drawnOnScreenDisplay = TRUE; | 230 | drawnOnScreenDisplay = TRUE; |
231 | onScreenDisplayVolume = v; | 231 | onScreenDisplayVolume = v; |
232 | QPainter p( videoUI ); | 232 | QPainter p( videoUI ); |
233 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); | 233 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); |
234 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); | 234 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); |
235 | 235 | ||
236 | QFont f; | 236 | QFont f; |
237 | f.setPixelSize( 20 ); | 237 | f.setPixelSize( 20 ); |
238 | f.setBold( TRUE ); | 238 | f.setBold( TRUE ); |
239 | p.setFont( f ); | 239 | p.setFont( f ); |
240 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); | 240 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); |
241 | 241 | ||
242 | for ( unsigned int i = 0; i < 10; i++ ) { | 242 | for ( unsigned int i = 0; i < 10; i++ ) { |
243 | if ( v > i ) { | 243 | if ( v > i ) { |
244 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); | 244 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); |
245 | } else { | 245 | } else { |
246 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); | 246 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); |
247 | } | 247 | } |
248 | } | 248 | } |
249 | } | 249 | } |
250 | } | 250 | } |
251 | 251 | ||
252 | void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { | 252 | void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { |
253 | switch ( e->key() ) { | 253 | switch ( e->key() ) { |
254 | ////////////////////////////// Zaurus keys | 254 | ////////////////////////////// Zaurus keys |
255 | case Key_Home: | 255 | case Key_Home: |
256 | break; | 256 | break; |
257 | case Key_F9: //activity | 257 | case Key_F9: //activity |
258 | break; | 258 | break; |
259 | case Key_F10: //contacts | 259 | case Key_F10: //contacts |
260 | break; | 260 | break; |
261 | case Key_F11: //menu | 261 | case Key_F11: //menu |
262 | break; | 262 | break; |
263 | case Key_F12: //home | 263 | case Key_F12: //home |
264 | qDebug("Blank here"); | 264 | qDebug("Blank here"); |
265 | break; | 265 | break; |
266 | case Key_F13: //mail | 266 | case Key_F13: //mail |
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index c210ffb..77e2095 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -496,385 +496,385 @@ const DocLnk *PlayListWidget::current() { // this is fugly | |||
496 | } | 496 | } |
497 | } | 497 | } |
498 | } | 498 | } |
499 | break; | 499 | break; |
500 | }; | 500 | }; |
501 | return 0; | 501 | return 0; |
502 | } | 502 | } |
503 | 503 | ||
504 | bool PlayListWidget::prev() { | 504 | bool PlayListWidget::prev() { |
505 | if ( mediaPlayerState->playlist() ) { | 505 | if ( mediaPlayerState->playlist() ) { |
506 | if ( mediaPlayerState->shuffled() ) { | 506 | if ( mediaPlayerState->shuffled() ) { |
507 | const DocLnk *cur = current(); | 507 | const DocLnk *cur = current(); |
508 | int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); | 508 | int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); |
509 | for ( int i = 0; i < j; i++ ) { | 509 | for ( int i = 0; i < j; i++ ) { |
510 | if ( !d->selectedFiles->next() ) | 510 | if ( !d->selectedFiles->next() ) |
511 | d->selectedFiles->first(); | 511 | d->selectedFiles->first(); |
512 | } | 512 | } |
513 | if ( cur == current() ) | 513 | if ( cur == current() ) |
514 | if ( !d->selectedFiles->next() ) | 514 | if ( !d->selectedFiles->next() ) |
515 | d->selectedFiles->first(); | 515 | d->selectedFiles->first(); |
516 | return TRUE; | 516 | return TRUE; |
517 | } else { | 517 | } else { |
518 | if ( !d->selectedFiles->prev() ) { | 518 | if ( !d->selectedFiles->prev() ) { |
519 | if ( mediaPlayerState->looping() ) { | 519 | if ( mediaPlayerState->looping() ) { |
520 | return d->selectedFiles->last(); | 520 | return d->selectedFiles->last(); |
521 | } else { | 521 | } else { |
522 | return FALSE; | 522 | return FALSE; |
523 | } | 523 | } |
524 | } | 524 | } |
525 | return TRUE; | 525 | return TRUE; |
526 | } | 526 | } |
527 | } else { | 527 | } else { |
528 | return mediaPlayerState->looping(); | 528 | return mediaPlayerState->looping(); |
529 | } | 529 | } |
530 | } | 530 | } |
531 | 531 | ||
532 | 532 | ||
533 | bool PlayListWidget::next() { | 533 | bool PlayListWidget::next() { |
534 | if ( mediaPlayerState->playlist() ) { | 534 | if ( mediaPlayerState->playlist() ) { |
535 | if ( mediaPlayerState->shuffled() ) { | 535 | if ( mediaPlayerState->shuffled() ) { |
536 | return prev(); | 536 | return prev(); |
537 | } else { | 537 | } else { |
538 | if ( !d->selectedFiles->next() ) { | 538 | if ( !d->selectedFiles->next() ) { |
539 | if ( mediaPlayerState->looping() ) { | 539 | if ( mediaPlayerState->looping() ) { |
540 | return d->selectedFiles->first(); | 540 | return d->selectedFiles->first(); |
541 | } else { | 541 | } else { |
542 | return FALSE; | 542 | return FALSE; |
543 | } | 543 | } |
544 | } | 544 | } |
545 | return TRUE; | 545 | return TRUE; |
546 | } | 546 | } |
547 | } else { | 547 | } else { |
548 | return mediaPlayerState->looping(); | 548 | return mediaPlayerState->looping(); |
549 | } | 549 | } |
550 | } | 550 | } |
551 | 551 | ||
552 | 552 | ||
553 | bool PlayListWidget::first() { | 553 | bool PlayListWidget::first() { |
554 | if ( mediaPlayerState->playlist() ) | 554 | if ( mediaPlayerState->playlist() ) |
555 | return d->selectedFiles->first(); | 555 | return d->selectedFiles->first(); |
556 | else | 556 | else |
557 | return mediaPlayerState->looping(); | 557 | return mediaPlayerState->looping(); |
558 | } | 558 | } |
559 | 559 | ||
560 | 560 | ||
561 | bool PlayListWidget::last() { | 561 | bool PlayListWidget::last() { |
562 | if ( mediaPlayerState->playlist() ) | 562 | if ( mediaPlayerState->playlist() ) |
563 | return d->selectedFiles->last(); | 563 | return d->selectedFiles->last(); |
564 | else | 564 | else |
565 | return mediaPlayerState->looping(); | 565 | return mediaPlayerState->looping(); |
566 | } | 566 | } |
567 | 567 | ||
568 | 568 | ||
569 | void PlayListWidget::saveList() { | 569 | void PlayListWidget::saveList() { |
570 | 570 | ||
571 | QString filename; | 571 | QString filename; |
572 | InputDialog *fileDlg; | 572 | InputDialog *fileDlg; |
573 | fileDlg = new InputDialog(this,tr("Save Playlist"),TRUE, 0); | 573 | fileDlg = new InputDialog(this,tr("Save Playlist"),TRUE, 0); |
574 | fileDlg->exec(); | 574 | fileDlg->exec(); |
575 | if( fileDlg->result() == 1 ) { | 575 | if( fileDlg->result() == 1 ) { |
576 | if ( d->current ) | 576 | if ( d->current ) |
577 | delete d->current; | 577 | delete d->current; |
578 | filename = fileDlg->LineEdit1->text();//+".playlist"; | 578 | filename = fileDlg->LineEdit1->text();//+".playlist"; |
579 | // qDebug("saving playlist "+filename+".playlist"); | 579 | // qDebug("saving playlist "+filename+".playlist"); |
580 | Config cfg( filename +".playlist"); | 580 | Config cfg( filename +".playlist"); |
581 | writeConfig( cfg ); | 581 | writeConfig( cfg ); |
582 | 582 | ||
583 | DocLnk lnk; | 583 | DocLnk lnk; |
584 | lnk.setFile(QDir::homeDirPath()+"/Settings/"+filename+".playlist.conf"); //sets File property | 584 | lnk.setFile(QDir::homeDirPath()+"/Settings/"+filename+".playlist.conf"); //sets File property |
585 | lnk.setType("playlist/plain");// hey is this a REGISTERED mime type?!?!? ;D | 585 | lnk.setType("playlist/plain");// hey is this a REGISTERED mime type?!?!? ;D |
586 | lnk.setIcon("opieplayer/playlist2"); | 586 | lnk.setIcon("opieplayer/playlist2"); |
587 | lnk.setName( filename); //sets file name | 587 | lnk.setName( filename); //sets file name |
588 | // qDebug(filename); | 588 | // qDebug(filename); |
589 | if(!lnk.writeLink()) { | 589 | if(!lnk.writeLink()) { |
590 | qDebug("Writing doclink did not work"); | 590 | qDebug("Writing doclink did not work"); |
591 | } | 591 | } |
592 | } | 592 | } |
593 | Config config( "OpiePlayer" ); | 593 | Config config( "OpiePlayer" ); |
594 | config.writeEntry("CurrentPlaylist",filename); | 594 | config.writeEntry("CurrentPlaylist",filename); |
595 | setCaption(tr("OpiePlayer: ")+filename); | 595 | setCaption(tr("OpiePlayer: ")+filename); |
596 | d->selectedFiles->first(); | 596 | d->selectedFiles->first(); |
597 | if(fileDlg) { | 597 | if(fileDlg) { |
598 | delete fileDlg; | 598 | delete fileDlg; |
599 | } | 599 | } |
600 | } | 600 | } |
601 | 601 | ||
602 | void PlayListWidget::loadList( const DocLnk & lnk) { | 602 | void PlayListWidget::loadList( const DocLnk & lnk) { |
603 | QString name= lnk.name(); | 603 | QString name= lnk.name(); |
604 | // qDebug("currentList is "+name); | 604 | // qDebug("currentList is "+name); |
605 | if( name.length()>1) { | 605 | if( name.length()>1) { |
606 | setCaption("OpiePlayer: "+name); | 606 | setCaption("OpiePlayer: "+name); |
607 | // qDebug("load list "+ name+".playlist"); | 607 | // qDebug("load list "+ name+".playlist"); |
608 | clearList(); | 608 | clearList(); |
609 | Config cfg( name+".playlist"); | 609 | Config cfg( name+".playlist"); |
610 | readConfig(cfg); | 610 | readConfig(cfg); |
611 | 611 | ||
612 | tabWidget->setCurrentPage(0); | 612 | tabWidget->setCurrentPage(0); |
613 | 613 | ||
614 | Config config( "OpiePlayer" ); | 614 | Config config( "OpiePlayer" ); |
615 | config.writeEntry("CurrentPlaylist", name); | 615 | config.writeEntry("CurrentPlaylist", name); |
616 | // d->selectedFiles->first(); | 616 | // d->selectedFiles->first(); |
617 | } | 617 | } |
618 | 618 | ||
619 | } | 619 | } |
620 | 620 | ||
621 | void PlayListWidget::setPlaylist( bool shown ) { | 621 | void PlayListWidget::setPlaylist( bool shown ) { |
622 | if ( shown ) { | 622 | if ( shown ) { |
623 | d->playListFrame->show(); | 623 | d->playListFrame->show(); |
624 | } else { | 624 | } else { |
625 | d->playListFrame->hide(); | 625 | d->playListFrame->hide(); |
626 | } | 626 | } |
627 | } | 627 | } |
628 | 628 | ||
629 | void PlayListWidget::setView( char view ) { | 629 | void PlayListWidget::setView( char view ) { |
630 | if ( view == 'l' ) | 630 | if ( view == 'l' ) |
631 | showMaximized(); | 631 | showMaximized(); |
632 | else | 632 | else |
633 | hide(); | 633 | hide(); |
634 | } | 634 | } |
635 | 635 | ||
636 | void PlayListWidget::addSelected() { | 636 | void PlayListWidget::addSelected() { |
637 | 637 | ||
638 | Config cfg( "OpiePlayer" ); | 638 | Config cfg( "OpiePlayer" ); |
639 | cfg.setGroup("PlayList"); | 639 | cfg.setGroup("PlayList"); |
640 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); | 640 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); |
641 | // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 641 | // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
642 | 642 | ||
643 | switch (tabWidget->currentPageIndex()) { | 643 | switch (tabWidget->currentPageIndex()) { |
644 | case 0: //playlist | 644 | case 0: //playlist |
645 | break; | 645 | break; |
646 | case 1: { //audio | 646 | case 1: { //audio |
647 | QListViewItemIterator it( audioView ); | 647 | QListViewItemIterator it( audioView ); |
648 | // iterate through all items of the listview | 648 | // iterate through all items of the listview |
649 | for ( ; it.current(); ++it ) { | 649 | for ( ; it.current(); ++it ) { |
650 | if ( it.current()->isSelected() ) { | 650 | if ( it.current()->isSelected() ) { |
651 | QListIterator<DocLnk> dit( files.children() ); | 651 | QListIterator<DocLnk> dit( files.children() ); |
652 | for ( ; dit.current(); ++dit ) { | 652 | for ( ; dit.current(); ++dit ) { |
653 | if( dit.current()->name() == it.current()->text(0) ) { | 653 | if( dit.current()->name() == it.current()->text(0) ) { |
654 | d->selectedFiles->addToSelection( **dit ); | 654 | d->selectedFiles->addToSelection( **dit ); |
655 | } | 655 | } |
656 | } | 656 | } |
657 | audioView->setSelected( it.current(),FALSE); | 657 | audioView->setSelected( it.current(),FALSE); |
658 | } | 658 | } |
659 | } | 659 | } |
660 | tabWidget->setCurrentPage(0); | 660 | tabWidget->setCurrentPage(0); |
661 | } | 661 | } |
662 | break; | 662 | break; |
663 | case 2: { // video | 663 | case 2: { // video |
664 | QListViewItemIterator it( videoView ); | 664 | QListViewItemIterator it( videoView ); |
665 | // iterate through all items of the listview | 665 | // iterate through all items of the listview |
666 | for ( ; it.current(); ++it ) { | 666 | for ( ; it.current(); ++it ) { |
667 | if ( it.current()->isSelected() ) { | 667 | if ( it.current()->isSelected() ) { |
668 | QListIterator<DocLnk> dit( vFiles.children() ); | 668 | QListIterator<DocLnk> dit( vFiles.children() ); |
669 | for ( ; dit.current(); ++dit ) { | 669 | for ( ; dit.current(); ++dit ) { |
670 | if( dit.current()->name() == it.current()->text(0) ) { | 670 | if( dit.current()->name() == it.current()->text(0) ) { |
671 | d->selectedFiles->addToSelection( **dit ); | 671 | d->selectedFiles->addToSelection( **dit ); |
672 | } | 672 | } |
673 | } | 673 | } |
674 | videoView->setSelected( it.current(),FALSE); | 674 | videoView->setSelected( it.current(),FALSE); |
675 | } | 675 | } |
676 | } | 676 | } |
677 | tabWidget->setCurrentPage(0); | 677 | tabWidget->setCurrentPage(0); |
678 | } | 678 | } |
679 | break; | 679 | break; |
680 | }; | 680 | }; |
681 | } | 681 | } |
682 | 682 | ||
683 | void PlayListWidget::removeSelected() { | 683 | void PlayListWidget::removeSelected() { |
684 | d->selectedFiles->removeSelected( ); | 684 | d->selectedFiles->removeSelected( ); |
685 | } | 685 | } |
686 | 686 | ||
687 | void PlayListWidget::playIt( QListViewItem *it) { | 687 | void PlayListWidget::playIt( QListViewItem *it) { |
688 | if(it==NULL) return; | 688 | // if(it==NULL) return; |
689 | qDebug("playIt"); | 689 | qDebug("playIt"); |
690 | mediaPlayerState->setPlaying(FALSE); | 690 | mediaPlayerState->setPlaying(FALSE); |
691 | mediaPlayerState->setPlaying(TRUE); | 691 | mediaPlayerState->setPlaying(TRUE); |
692 | d->selectedFiles->unSelect(); | 692 | d->selectedFiles->unSelect(); |
693 | } | 693 | } |
694 | 694 | ||
695 | void PlayListWidget::addToSelection( QListViewItem *it) { | 695 | void PlayListWidget::addToSelection( QListViewItem *it) { |
696 | d->setDocumentUsed = FALSE; | 696 | d->setDocumentUsed = FALSE; |
697 | 697 | ||
698 | if(it) { | 698 | if(it) { |
699 | switch (tabWidget->currentPageIndex()) { | 699 | switch (tabWidget->currentPageIndex()) { |
700 | case 1: { | 700 | case 1: { |
701 | QListIterator<DocLnk> dit( files.children() ); | 701 | QListIterator<DocLnk> dit( files.children() ); |
702 | for ( ; dit.current(); ++dit ) { | 702 | for ( ; dit.current(); ++dit ) { |
703 | if( dit.current()->name() == it->text(0)) { | 703 | if( dit.current()->name() == it->text(0)) { |
704 | d->selectedFiles->addToSelection( **dit ); | 704 | d->selectedFiles->addToSelection( **dit ); |
705 | } | 705 | } |
706 | } | 706 | } |
707 | } | 707 | } |
708 | break; | 708 | break; |
709 | case 2: { | 709 | case 2: { |
710 | QListIterator<DocLnk> dit( vFiles.children() ); | 710 | QListIterator<DocLnk> dit( vFiles.children() ); |
711 | for ( ; dit.current(); ++dit ) { | 711 | for ( ; dit.current(); ++dit ) { |
712 | if( dit.current()->name() == it->text(0)) { | 712 | if( dit.current()->name() == it->text(0)) { |
713 | d->selectedFiles->addToSelection( **dit ); | 713 | d->selectedFiles->addToSelection( **dit ); |
714 | } | 714 | } |
715 | } | 715 | } |
716 | } | 716 | } |
717 | break; | 717 | break; |
718 | case 0: | 718 | case 0: |
719 | break; | 719 | break; |
720 | }; | 720 | }; |
721 | tabWidget->setCurrentPage(0); | 721 | tabWidget->setCurrentPage(0); |
722 | } | 722 | } |
723 | } | 723 | } |
724 | 724 | ||
725 | void PlayListWidget::tabChanged(QWidget *) { | 725 | void PlayListWidget::tabChanged(QWidget *) { |
726 | 726 | ||
727 | switch ( tabWidget->currentPageIndex()) { | 727 | switch ( tabWidget->currentPageIndex()) { |
728 | case 0: | 728 | case 0: |
729 | { | 729 | { |
730 | if( !tbDeletePlaylist->isHidden()) | 730 | if( !tbDeletePlaylist->isHidden()) |
731 | tbDeletePlaylist->hide(); | 731 | tbDeletePlaylist->hide(); |
732 | d->tbRemoveFromList->setEnabled(TRUE); | 732 | d->tbRemoveFromList->setEnabled(TRUE); |
733 | d->tbAddToList->setEnabled(FALSE); | 733 | d->tbAddToList->setEnabled(FALSE); |
734 | } | 734 | } |
735 | break; | 735 | break; |
736 | case 1: | 736 | case 1: |
737 | { | 737 | { |
738 | audioView->clear(); | 738 | audioView->clear(); |
739 | populateAudioView(); | 739 | populateAudioView(); |
740 | 740 | ||
741 | if( !tbDeletePlaylist->isHidden()) | 741 | if( !tbDeletePlaylist->isHidden()) |
742 | tbDeletePlaylist->hide(); | 742 | tbDeletePlaylist->hide(); |
743 | d->tbRemoveFromList->setEnabled(FALSE); | 743 | d->tbRemoveFromList->setEnabled(FALSE); |
744 | d->tbAddToList->setEnabled(TRUE); | 744 | d->tbAddToList->setEnabled(TRUE); |
745 | } | 745 | } |
746 | break; | 746 | break; |
747 | case 2: | 747 | case 2: |
748 | { | 748 | { |
749 | videoView->clear(); | 749 | videoView->clear(); |
750 | populateVideoView(); | 750 | populateVideoView(); |
751 | if( !tbDeletePlaylist->isHidden()) | 751 | if( !tbDeletePlaylist->isHidden()) |
752 | tbDeletePlaylist->hide(); | 752 | tbDeletePlaylist->hide(); |
753 | d->tbRemoveFromList->setEnabled(FALSE); | 753 | d->tbRemoveFromList->setEnabled(FALSE); |
754 | d->tbAddToList->setEnabled(TRUE); | 754 | d->tbAddToList->setEnabled(TRUE); |
755 | } | 755 | } |
756 | break; | 756 | break; |
757 | case 3: | 757 | case 3: |
758 | { | 758 | { |
759 | if( tbDeletePlaylist->isHidden()) | 759 | if( tbDeletePlaylist->isHidden()) |
760 | tbDeletePlaylist->show(); | 760 | tbDeletePlaylist->show(); |
761 | playLists->reread(); | 761 | playLists->reread(); |
762 | } | 762 | } |
763 | break; | 763 | break; |
764 | }; | 764 | }; |
765 | } | 765 | } |
766 | 766 | ||
767 | void PlayListWidget::btnPlay(bool b) { | 767 | void PlayListWidget::btnPlay(bool b) { |
768 | 768 | ||
769 | // mediaPlayerState->setPlaying(b); | 769 | // mediaPlayerState->setPlaying(b); |
770 | switch ( tabWidget->currentPageIndex()) { | 770 | switch ( tabWidget->currentPageIndex()) { |
771 | case 0: | 771 | case 0: |
772 | { | 772 | { |
773 | mediaPlayerState->setPlaying(b); | 773 | mediaPlayerState->setPlaying(b); |
774 | } | 774 | } |
775 | break; | 775 | break; |
776 | case 1: | 776 | case 1: |
777 | { | 777 | { |
778 | addToSelection( audioView->currentItem() ); | 778 | addToSelection( audioView->currentItem() ); |
779 | mediaPlayerState->setPlaying(b); | 779 | mediaPlayerState->setPlaying(b); |
780 | d->selectedFiles->removeSelected( ); | 780 | d->selectedFiles->removeSelected( ); |
781 | tabWidget->setCurrentPage(1); | 781 | tabWidget->setCurrentPage(1); |
782 | d->selectedFiles->unSelect(); | 782 | d->selectedFiles->unSelect(); |
783 | insanityBool=FALSE; | 783 | insanityBool=FALSE; |
784 | }// audioView->clearSelection(); | 784 | }// audioView->clearSelection(); |
785 | break; | 785 | break; |
786 | case 2: | 786 | case 2: |
787 | { | 787 | { |
788 | addToSelection( videoView->currentItem() ); | 788 | addToSelection( videoView->currentItem() ); |
789 | mediaPlayerState->setPlaying(b); | 789 | mediaPlayerState->setPlaying(b); |
790 | qApp->processEvents(); | 790 | qApp->processEvents(); |
791 | d->selectedFiles->removeSelected( ); | 791 | d->selectedFiles->removeSelected( ); |
792 | tabWidget->setCurrentPage(2); | 792 | tabWidget->setCurrentPage(2); |
793 | d->selectedFiles->unSelect(); | 793 | d->selectedFiles->unSelect(); |
794 | insanityBool=FALSE; | 794 | insanityBool=FALSE; |
795 | }// videoView->clearSelection(); | 795 | }// videoView->clearSelection(); |
796 | break; | 796 | break; |
797 | }; | 797 | }; |
798 | 798 | ||
799 | } | 799 | } |
800 | 800 | ||
801 | void PlayListWidget::deletePlaylist() { | 801 | void PlayListWidget::deletePlaylist() { |
802 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), | 802 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), |
803 | (tr("You really want to delete\nthis playlist?")), | 803 | (tr("You really want to delete\nthis playlist?")), |
804 | (tr("Yes")), (tr("No")), 0 )){ | 804 | (tr("Yes")), (tr("No")), 0 )){ |
805 | case 0: // Yes clicked, | 805 | case 0: // Yes clicked, |
806 | QFile().remove(playLists->selected()->file()); | 806 | QFile().remove(playLists->selected()->file()); |
807 | QFile().remove(playLists->selected()->linkFile()); | 807 | QFile().remove(playLists->selected()->linkFile()); |
808 | playLists->reread(); | 808 | playLists->reread(); |
809 | break; | 809 | break; |
810 | case 1: // Cancel | 810 | case 1: // Cancel |
811 | break; | 811 | break; |
812 | }; | 812 | }; |
813 | } | 813 | } |
814 | 814 | ||
815 | void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) { | 815 | void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) { |
816 | switch (mouse) { | 816 | switch (mouse) { |
817 | case 1: | 817 | case 1: |
818 | break; | 818 | break; |
819 | case 2:{ | 819 | case 2:{ |
820 | QPopupMenu m; | 820 | QPopupMenu m; |
821 | m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); | 821 | m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); |
822 | m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); | 822 | m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); |
823 | m.insertSeparator(); | 823 | m.insertSeparator(); |
824 | m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); | 824 | m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); |
825 | m.exec( QCursor::pos() ); | 825 | m.exec( QCursor::pos() ); |
826 | } | 826 | } |
827 | break; | 827 | break; |
828 | }; | 828 | }; |
829 | } | 829 | } |
830 | 830 | ||
831 | void PlayListWidget::playSelected() { | 831 | void PlayListWidget::playSelected() { |
832 | btnPlay( TRUE); | 832 | btnPlay( TRUE); |
833 | } | 833 | } |
834 | 834 | ||
835 | void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) { | 835 | void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) { |
836 | switch (mouse) { | 836 | switch (mouse) { |
837 | case 1: | 837 | case 1: |
838 | 838 | ||
839 | break; | 839 | break; |
840 | case 2: | 840 | case 2: |
841 | { | 841 | { |
842 | QPopupMenu m; | 842 | QPopupMenu m; |
843 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); | 843 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); |
844 | m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); | 844 | m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); |
845 | m.exec( QCursor::pos() ); | 845 | m.exec( QCursor::pos() ); |
846 | } | 846 | } |
847 | break; | 847 | break; |
848 | }; | 848 | }; |
849 | } | 849 | } |
850 | 850 | ||
851 | void PlayListWidget::listDelete() { | 851 | void PlayListWidget::listDelete() { |
852 | Config cfg( "OpiePlayer" ); | 852 | Config cfg( "OpiePlayer" ); |
853 | cfg.setGroup("PlayList"); | 853 | cfg.setGroup("PlayList"); |
854 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); | 854 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); |
855 | QString file; | 855 | QString file; |
856 | // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 856 | // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
857 | switch ( tabWidget->currentPageIndex()) { | 857 | switch ( tabWidget->currentPageIndex()) { |
858 | case 0: | 858 | case 0: |
859 | break; | 859 | break; |
860 | case 1: | 860 | case 1: |
861 | { | 861 | { |
862 | file = audioView->currentItem()->text(0); | 862 | file = audioView->currentItem()->text(0); |
863 | QListIterator<DocLnk> Pdit( files.children() ); | 863 | QListIterator<DocLnk> Pdit( files.children() ); |
864 | for ( ; Pdit.current(); ++Pdit ) { | 864 | for ( ; Pdit.current(); ++Pdit ) { |
865 | if( Pdit.current()->name() == file) { | 865 | if( Pdit.current()->name() == file) { |
866 | LnkProperties prop( Pdit.current() ); | 866 | LnkProperties prop( Pdit.current() ); |
867 | prop.showMaximized(); | 867 | prop.showMaximized(); |
868 | prop.exec(); | 868 | prop.exec(); |
869 | } | 869 | } |
870 | } | 870 | } |
871 | populateAudioView(); | 871 | populateAudioView(); |
872 | } | 872 | } |
873 | break; | 873 | break; |
874 | case 2: | 874 | case 2: |
875 | { | 875 | { |
876 | 876 | ||
877 | } | 877 | } |
878 | break; | 878 | break; |
879 | }; | 879 | }; |
880 | } | 880 | } |
@@ -1044,242 +1044,242 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e) | |||
1044 | case Key_Up: | 1044 | case Key_Up: |
1045 | if ( !d->selectedFiles->prev() ) | 1045 | if ( !d->selectedFiles->prev() ) |
1046 | // d->selectedFiles->last(); | 1046 | // d->selectedFiles->last(); |
1047 | 1047 | ||
1048 | break; | 1048 | break; |
1049 | 1049 | ||
1050 | } | 1050 | } |
1051 | } | 1051 | } |
1052 | 1052 | ||
1053 | void PlayListWidget::keyPressEvent( QKeyEvent *) | 1053 | void PlayListWidget::keyPressEvent( QKeyEvent *) |
1054 | { | 1054 | { |
1055 | // qDebug("Key press"); | 1055 | // qDebug("Key press"); |
1056 | // switch ( e->key() ) { | 1056 | // switch ( e->key() ) { |
1057 | // ////////////////////////////// Zaurus keys | 1057 | // ////////////////////////////// Zaurus keys |
1058 | // case Key_A: //add to playlist | 1058 | // case Key_A: //add to playlist |
1059 | // qDebug("Add"); | 1059 | // qDebug("Add"); |
1060 | // addSelected(); | 1060 | // addSelected(); |
1061 | // break; | 1061 | // break; |
1062 | // case Key_R: //remove from playlist | 1062 | // case Key_R: //remove from playlist |
1063 | // removeSelected(); | 1063 | // removeSelected(); |
1064 | // break; | 1064 | // break; |
1065 | // case Key_P: //play | 1065 | // case Key_P: //play |
1066 | // qDebug("Play"); | 1066 | // qDebug("Play"); |
1067 | // playSelected(); | 1067 | // playSelected(); |
1068 | // break; | 1068 | // break; |
1069 | // case Key_Space: | 1069 | // case Key_Space: |
1070 | // qDebug("Play"); | 1070 | // qDebug("Play"); |
1071 | // playSelected(); | 1071 | // playSelected(); |
1072 | // break; | 1072 | // break; |
1073 | // } | 1073 | // } |
1074 | } | 1074 | } |
1075 | 1075 | ||
1076 | void PlayListWidget::doBlank() { | 1076 | void PlayListWidget::doBlank() { |
1077 | qDebug("do blanking"); | 1077 | qDebug("do blanking"); |
1078 | fd=open("/dev/fb0",O_RDWR); | 1078 | fd=open("/dev/fb0",O_RDWR); |
1079 | if (fd != -1) { | 1079 | if (fd != -1) { |
1080 | ioctl(fd,FBIOBLANK,1); | 1080 | ioctl(fd,FBIOBLANK,1); |
1081 | // close(fd); | 1081 | // close(fd); |
1082 | } | 1082 | } |
1083 | } | 1083 | } |
1084 | 1084 | ||
1085 | void PlayListWidget::doUnblank() { | 1085 | void PlayListWidget::doUnblank() { |
1086 | // this crashes opieplayer with a segfault | 1086 | // this crashes opieplayer with a segfault |
1087 | // int fd; | 1087 | // int fd; |
1088 | // fd=open("/dev/fb0",O_RDWR); | 1088 | // fd=open("/dev/fb0",O_RDWR); |
1089 | qDebug("do unblanking"); | 1089 | qDebug("do unblanking"); |
1090 | if (fd != -1) { | 1090 | if (fd != -1) { |
1091 | ioctl(fd,FBIOBLANK,0); | 1091 | ioctl(fd,FBIOBLANK,0); |
1092 | close(fd); | 1092 | close(fd); |
1093 | } | 1093 | } |
1094 | QCopEnvelope h("QPE/System", "setBacklight(int)"); | 1094 | QCopEnvelope h("QPE/System", "setBacklight(int)"); |
1095 | h <<-3;// v[1]; // -3 Force on | 1095 | h <<-3;// v[1]; // -3 Force on |
1096 | } | 1096 | } |
1097 | 1097 | ||
1098 | void PlayListWidget::readm3u(const QString &filename) { | 1098 | void PlayListWidget::readm3u(const QString &filename) { |
1099 | 1099 | ||
1100 | qDebug("m3u filename is "+filename); | 1100 | qDebug("m3u filename is "+filename); |
1101 | QFile f(filename); | 1101 | QFile f(filename); |
1102 | 1102 | ||
1103 | if(f.open(IO_ReadOnly)) { | 1103 | if(f.open(IO_ReadOnly)) { |
1104 | QTextStream t(&f); | 1104 | QTextStream t(&f); |
1105 | QString s;//, first, second; | 1105 | QString s;//, first, second; |
1106 | int i=0; | 1106 | int i=0; |
1107 | while ( !t.atEnd()) { | 1107 | while ( !t.atEnd()) { |
1108 | s=t.readLine(); | 1108 | s=t.readLine(); |
1109 | 1109 | ||
1110 | if(s.find("#",0,TRUE) == -1) { | 1110 | if(s.find("#",0,TRUE) == -1) { |
1111 | if(s.find(" ",0,TRUE) == -1) { // not sure if this is neede since cf uses vfat | 1111 | if(s.find(" ",0,TRUE) == -1) { // not sure if this is neede since cf uses vfat |
1112 | if(s.left(2) == "E:" || s.left(2) == "P:") { | 1112 | if(s.left(2) == "E:" || s.left(2) == "P:") { |
1113 | s=s.right(s.length()-2); | 1113 | s=s.right(s.length()-2); |
1114 | DocLnk lnk( s ); | 1114 | DocLnk lnk( s ); |
1115 | QFileInfo f(s); | 1115 | QFileInfo f(s); |
1116 | QString name = f.baseName(); | 1116 | QString name = f.baseName(); |
1117 | name = name.right( name.length()-name.findRev( "\\",-1,TRUE ) -1 ); | 1117 | name = name.right( name.length()-name.findRev( "\\",-1,TRUE ) -1 ); |
1118 | lnk.setName( name ); | 1118 | lnk.setName( name ); |
1119 | s=s.replace( QRegExp("\\"),"/"); | 1119 | s=s.replace( QRegExp("\\"),"/"); |
1120 | lnk.setFile( s ); | 1120 | lnk.setFile( s ); |
1121 | lnk.writeLink(); | 1121 | lnk.writeLink(); |
1122 | qDebug("add "+name); | 1122 | qDebug("add "+name); |
1123 | d->selectedFiles->addToSelection( lnk); | 1123 | d->selectedFiles->addToSelection( lnk); |
1124 | } else { // is url | 1124 | } else { // is url |
1125 | s.replace(QRegExp("%20")," "); | 1125 | s.replace(QRegExp("%20")," "); |
1126 | DocLnk lnk( s ); | 1126 | DocLnk lnk( s ); |
1127 | QString name; | 1127 | QString name; |
1128 | if(name.left(4)=="http") { | 1128 | if(name.left(4)=="http") { |
1129 | name = s.right( s.length() - 7); | 1129 | name = s.right( s.length() - 7); |
1130 | } else { | 1130 | } else { |
1131 | name = s; | 1131 | name = s; |
1132 | } | 1132 | } |
1133 | lnk.setName(name); | 1133 | lnk.setName(name); |
1134 | if(s.at(s.length()-4) == '.') { | 1134 | if(s.at(s.length()-4) == '.') { |
1135 | lnk.setFile( s); | 1135 | lnk.setFile( s); |
1136 | } else { | 1136 | } else { |
1137 | lnk.setFile( s+"/"); | 1137 | lnk.setFile( s+"/"); |
1138 | } | 1138 | } |
1139 | lnk.setType("audio/x-mpegurl"); | 1139 | lnk.setType("audio/x-mpegurl"); |
1140 | lnk.writeLink(); | 1140 | lnk.writeLink(); |
1141 | d->selectedFiles->addToSelection( lnk); | 1141 | d->selectedFiles->addToSelection( lnk); |
1142 | } | 1142 | } |
1143 | i++; | 1143 | i++; |
1144 | } | 1144 | } |
1145 | } | 1145 | } |
1146 | } | 1146 | } |
1147 | } | 1147 | } |
1148 | f.close(); | 1148 | f.close(); |
1149 | } | 1149 | } |
1150 | 1150 | ||
1151 | void PlayListWidget::writem3u() { | 1151 | void PlayListWidget::writem3u() { |
1152 | 1152 | ||
1153 | InputDialog *fileDlg; | 1153 | InputDialog *fileDlg; |
1154 | fileDlg = new InputDialog(this,tr("Save m3u Playlist "),TRUE, 0); | 1154 | fileDlg = new InputDialog(this,tr("Save m3u Playlist "),TRUE, 0); |
1155 | fileDlg->exec(); | 1155 | fileDlg->exec(); |
1156 | QString filename,list; | 1156 | QString filename,list; |
1157 | if( fileDlg->result() == 1 ) { | 1157 | if( fileDlg->result() == 1 ) { |
1158 | filename = fileDlg->LineEdit1->text(); | 1158 | filename = fileDlg->LineEdit1->text(); |
1159 | qDebug(filename); | 1159 | qDebug(filename); |
1160 | int noOfFiles = 0; | 1160 | int noOfFiles = 0; |
1161 | d->selectedFiles->first(); | 1161 | d->selectedFiles->first(); |
1162 | do { | 1162 | do { |
1163 | // we dont check for existance because of url's | 1163 | // we dont check for existance because of url's |
1164 | // qDebug(d->selectedFiles->current()->file()); | 1164 | // qDebug(d->selectedFiles->current()->file()); |
1165 | list += d->selectedFiles->current()->file()+"\n"; | 1165 | list += d->selectedFiles->current()->file()+"\n"; |
1166 | noOfFiles++; | 1166 | noOfFiles++; |
1167 | } | 1167 | } |
1168 | while ( d->selectedFiles->next() ); | 1168 | while ( d->selectedFiles->next() ); |
1169 | qDebug(list); | 1169 | qDebug(list); |
1170 | if(filename.left(1) != "/") | 1170 | if(filename.left(1) != "/") |
1171 | filename=QPEApplication::documentDir()+"/"+filename; | 1171 | filename=QPEApplication::documentDir()+"/"+filename; |
1172 | if(filename.right(3) != "m3u") | 1172 | if(filename.right(3) != "m3u") |
1173 | filename=filename+".m3u"; | 1173 | filename=filename+".m3u"; |
1174 | 1174 | ||
1175 | QFile f(filename); | 1175 | QFile f(filename); |
1176 | f.open(IO_WriteOnly); | 1176 | f.open(IO_WriteOnly); |
1177 | f.writeBlock(list, list.length()); | 1177 | f.writeBlock(list, list.length()); |
1178 | f.close(); | 1178 | f.close(); |
1179 | } | 1179 | } |
1180 | if(fileDlg) delete fileDlg; | 1180 | if(fileDlg) delete fileDlg; |
1181 | } | 1181 | } |
1182 | 1182 | ||
1183 | void PlayListWidget::readPls(const QString &filename) { | 1183 | void PlayListWidget::readPls(const QString &filename) { |
1184 | 1184 | ||
1185 | qDebug("pls filename is "+filename); | 1185 | qDebug("pls filename is "+filename); |
1186 | QFile f(filename); | 1186 | QFile f(filename); |
1187 | 1187 | ||
1188 | if(f.open(IO_ReadOnly)) { | 1188 | if(f.open(IO_ReadOnly)) { |
1189 | QTextStream t(&f); | 1189 | QTextStream t(&f); |
1190 | QString s;//, first, second; | 1190 | QString s;//, first, second; |
1191 | int i=0; | 1191 | int i=0; |
1192 | while ( !t.atEnd()) { | 1192 | while ( !t.atEnd()) { |
1193 | s=t.readLine(); | 1193 | s=t.readLine(); |
1194 | if(s.left(4) == "File") { | 1194 | if(s.left(4) == "File") { |
1195 | s=s.right(s.length() - 6); | 1195 | s=s.right(s.length() - 6); |
1196 | s.replace(QRegExp("%20")," "); | 1196 | s.replace(QRegExp("%20")," "); |
1197 | qDebug("adding "+s+" to playlist"); | 1197 | qDebug("adding "+s+" to playlist"); |
1198 | // numberofentries=2 | 1198 | // numberofentries=2 |
1199 | // File1=http | 1199 | // File1=http |
1200 | // Title | 1200 | // Title |
1201 | // Length | 1201 | // Length |
1202 | // Version | 1202 | // Version |
1203 | // File2=http | 1203 | // File2=http |
1204 | s=s.replace( QRegExp("\\"),"/"); | 1204 | s=s.replace( QRegExp("\\"),"/"); |
1205 | DocLnk lnk( s ); | 1205 | DocLnk lnk( s ); |
1206 | QFileInfo f(s); | 1206 | QFileInfo f(s); |
1207 | QString name = f.baseName(); | 1207 | QString name = f.baseName(); |
1208 | if(name.left(4)=="http") | 1208 | if(name.left(4)=="http") |
1209 | name = s.right( s.length() - 7); | 1209 | name = s.right( s.length() - 7); |
1210 | else | 1210 | else |
1211 | name=s; | 1211 | name=s; |
1212 | name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); | 1212 | name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); |
1213 | lnk.setName( name); | 1213 | lnk.setName( name); |
1214 | if(s.at(s.length()-4) == '.') // if this is probably a file | 1214 | if(s.at(s.length()-4) == '.') // if this is probably a file |
1215 | lnk.setFile( s); | 1215 | lnk.setFile( s); |
1216 | else { //if its a url | 1216 | else { //if its a url |
1217 | if( name.right(1).find('/') == -1) | 1217 | if( name.right(1).find('/') == -1) |
1218 | s+="/"; | 1218 | s+="/"; |
1219 | lnk.setFile( s); | 1219 | lnk.setFile( s); |
1220 | } | 1220 | } |
1221 | lnk.setType("audio/x-mpegurl"); | 1221 | lnk.setType("audio/x-mpegurl"); |
1222 | 1222 | ||
1223 | qDebug("DocLnk add "+name); | 1223 | qDebug("DocLnk add "+name); |
1224 | d->selectedFiles->addToSelection( lnk); | 1224 | d->selectedFiles->addToSelection( lnk); |
1225 | } | 1225 | } |
1226 | } | 1226 | } |
1227 | i++; | 1227 | i++; |
1228 | } | 1228 | } |
1229 | } | 1229 | } |
1230 | 1230 | ||
1231 | void PlayListWidget::pmViewActivated(int index) { | 1231 | void PlayListWidget::pmViewActivated(int index) { |
1232 | qDebug("%d", index); | 1232 | qDebug("%d", index); |
1233 | switch(index) { | 1233 | switch(index) { |
1234 | case -16: | 1234 | case -16: |
1235 | { | 1235 | { |
1236 | 1236 | ||
1237 | mediaPlayerState->toggleFullscreen(); | 1237 | mediaPlayerState->toggleFullscreen(); |
1238 | bool b=mediaPlayerState->fullscreen(); | 1238 | bool b=mediaPlayerState->fullscreen(); |
1239 | pmView->setItemChecked( index,b); | 1239 | pmView->setItemChecked( index,b); |
1240 | Config cfg( "OpiePlayer" ); | 1240 | Config cfg( "OpiePlayer" ); |
1241 | cfg.writeEntry("FullScreen", b); | 1241 | cfg.writeEntry("FullScreen", b); |
1242 | 1242 | ||
1243 | } | 1243 | } |
1244 | break; | 1244 | break; |
1245 | }; | 1245 | }; |
1246 | } | 1246 | } |
1247 | 1247 | ||
1248 | void PlayListWidget::populateSkinsMenu() { | 1248 | void PlayListWidget::populateSkinsMenu() { |
1249 | int item=0; | 1249 | int item=0; |
1250 | defaultSkinIndex=0; | 1250 | defaultSkinIndex=0; |
1251 | QString skinName; | 1251 | QString skinName; |
1252 | Config cfg( "OpiePlayer" ); | 1252 | Config cfg( "OpiePlayer" ); |
1253 | cfg.setGroup("Options"); | 1253 | cfg.setGroup("Options"); |
1254 | QString skin = cfg.readEntry("Skin","default"); | 1254 | QString skin = cfg.readEntry("Skin","default"); |
1255 | 1255 | ||
1256 | QDir skinsDir(QPEApplication::qpeDir()+"/pics/opieplayer2/skins"); | 1256 | QDir skinsDir(QPEApplication::qpeDir()+"/pics/opieplayer2/skins"); |
1257 | skinsDir.setFilter( QDir::Dirs); | 1257 | skinsDir.setFilter( QDir::Dirs); |
1258 | skinsDir.setSorting(QDir::Name); | 1258 | skinsDir.setSorting(QDir::Name); |
1259 | const QFileInfoList *skinslist = skinsDir.entryInfoList(); | 1259 | const QFileInfoList *skinslist = skinsDir.entryInfoList(); |
1260 | QFileInfoListIterator it( *skinslist ); | 1260 | QFileInfoListIterator it( *skinslist ); |
1261 | QFileInfo *fi; | 1261 | QFileInfo *fi; |
1262 | while ( (fi=it.current()) ) { | 1262 | while ( (fi=it.current()) ) { |
1263 | skinName = fi->fileName(); | 1263 | skinName = fi->fileName(); |
1264 | qDebug( fi->fileName()); | 1264 | qDebug( fi->fileName()); |
1265 | if( skinName != "." && skinName != ".." && skinName !="CVS") | 1265 | if( skinName != "." && skinName != ".." && skinName !="CVS") |
1266 | item = skinsMenu->insertItem( fi->fileName()); | 1266 | item = skinsMenu->insertItem( fi->fileName()); |
1267 | if( skinName == "default") | 1267 | if( skinName == "default") |
1268 | defaultSkinIndex = item; | 1268 | defaultSkinIndex = item; |
1269 | if( skinName == skin) | 1269 | if( skinName == skin) |
1270 | skinsMenu->setItemChecked( item, TRUE); | 1270 | skinsMenu->setItemChecked( item, TRUE); |
1271 | 1271 | ||
1272 | ++it; | 1272 | ++it; |
1273 | } | 1273 | } |
1274 | } | 1274 | } |
1275 | 1275 | ||
1276 | void PlayListWidget::skinsMenuActivated(int item) { | 1276 | void PlayListWidget::skinsMenuActivated(int item) { |
1277 | for(int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i--) { | 1277 | for(int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i--) { |
1278 | skinsMenu->setItemChecked( i, FALSE); | 1278 | skinsMenu->setItemChecked( i, FALSE); |
1279 | } | 1279 | } |
1280 | skinsMenu->setItemChecked( item, TRUE); | 1280 | skinsMenu->setItemChecked( item, TRUE); |
1281 | 1281 | ||
1282 | Config cfg( "OpiePlayer" ); | 1282 | Config cfg( "OpiePlayer" ); |
1283 | cfg.setGroup("Options"); | 1283 | cfg.setGroup("Options"); |
1284 | cfg.writeEntry("Skin", skinsMenu->text( item)); | 1284 | cfg.writeEntry("Skin", skinsMenu->text( item)); |
1285 | } | 1285 | } |
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp index 17112a2..8fd2743 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.cpp +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp | |||
@@ -1,200 +1,200 @@ | |||
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 | 34 | ||
35 | #include <qtimer.h> | 35 | #include <qtimer.h> |
36 | #include <qpe/qcopenvelope_qws.h> | 36 | #include <qpe/qcopenvelope_qws.h> |
37 | #include <qpe/qpeapplication.h> | 37 | #include <qpe/qpeapplication.h> |
38 | #include "xinecontrol.h" | 38 | #include "xinecontrol.h" |
39 | #include "mediaplayerstate.h" | 39 | #include "mediaplayerstate.h" |
40 | #include "videowidget.h" | 40 | #include "videowidget.h" |
41 | 41 | ||
42 | extern MediaPlayerState *mediaPlayerState; | 42 | extern MediaPlayerState *mediaPlayerState; |
43 | extern VideoWidget *videoUI; | 43 | extern VideoWidget *videoUI; |
44 | XineControl::XineControl( QObject *parent, const char *name ) | 44 | XineControl::XineControl( QObject *parent, const char *name ) |
45 | : QObject( parent, name ) { | 45 | : QObject( parent, name ) { |
46 | libXine = new XINE::Lib(videoUI->vidWidget() ); | 46 | libXine = new XINE::Lib(videoUI->vidWidget() ); |
47 | 47 | ||
48 | connect ( videoUI, SIGNAL( videoResized ( const QSize & )), this, SLOT( videoResized ( const QSize & ))); | 48 | connect ( videoUI, SIGNAL( videoResized ( const QSize & )), this, SLOT( videoResized ( const QSize & ))); |
49 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) ); | 49 | connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) ); |
50 | connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) ); | 50 | connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) ); |
51 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); | 51 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); |
52 | connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); | 52 | connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); |
53 | connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); | 53 | connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); |
54 | connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); | 54 | connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); |
55 | 55 | ||
56 | disabledSuspendScreenSaver = FALSE; | 56 | disabledSuspendScreenSaver = FALSE; |
57 | } | 57 | } |
58 | 58 | ||
59 | XineControl::~XineControl() { | 59 | XineControl::~XineControl() { |
60 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 60 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
61 | if ( disabledSuspendScreenSaver ) { | 61 | if ( disabledSuspendScreenSaver ) { |
62 | disabledSuspendScreenSaver = FALSE; | 62 | disabledSuspendScreenSaver = FALSE; |
63 | // Re-enable the suspend mode | 63 | // Re-enable the suspend mode |
64 | QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | 64 | QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; |
65 | } | 65 | } |
66 | #endif | 66 | #endif |
67 | delete libXine; | 67 | delete libXine; |
68 | } | 68 | } |
69 | 69 | ||
70 | void XineControl::play( const QString& fileName ) { | 70 | void XineControl::play( const QString& fileName ) { |
71 | hasVideoChannel=FALSE; | 71 | hasVideoChannel=FALSE; |
72 | hasAudioChannel=FALSE; | 72 | hasAudioChannel=FALSE; |
73 | m_fileName = fileName; | 73 | m_fileName = fileName; |
74 | libXine->play( fileName ); | 74 | libXine->play( fileName ); |
75 | mediaPlayerState->setPlaying( true ); | 75 | mediaPlayerState->setPlaying( true ); |
76 | // default to audio view until we know how to handle video | 76 | // default to audio view until we know how to handle video |
77 | // MediaDetect mdetect; | 77 | // MediaDetect mdetect; |
78 | char whichGui = mdetect.videoOrAudio( fileName ); | 78 | char whichGui = mdetect.videoOrAudio( fileName ); |
79 | if (whichGui == 'f') { | 79 | if (whichGui == 'f') { |
80 | qDebug("Nicht erkannter Dateityp"); | 80 | qDebug("Nicht erkannter Dateityp"); |
81 | return; | 81 | return; |
82 | } | 82 | } |
83 | 83 | ||
84 | if (whichGui == 'a') { | 84 | if (whichGui == 'a') { |
85 | libXine->setShowVideo( false ); | 85 | libXine->setShowVideo( false ); |
86 | hasAudioChannel=TRUE; | 86 | hasAudioChannel=TRUE; |
87 | } else { | 87 | } else { |
88 | libXine->setShowVideo( true ); | 88 | libXine->setShowVideo( true ); |
89 | hasVideoChannel=TRUE; | 89 | hasVideoChannel=TRUE; |
90 | } | 90 | } |
91 | 91 | ||
92 | // determine if slider is shown | 92 | // determine if slider is shown |
93 | // mediaPlayerState->setIsStreaming( mdetect.isStreaming( fileName ) ); | 93 | // mediaPlayerState->setIsStreaming( mdetect.isStreaming( fileName ) ); |
94 | mediaPlayerState->setIsStreaming( !libXine->isSeekable() ); | 94 | mediaPlayerState->setIsStreaming( !libXine->isSeekable() ); |
95 | // which gui (video / audio) | 95 | // which gui (video / audio) |
96 | mediaPlayerState->setView( whichGui ); | 96 | mediaPlayerState->setView( whichGui ); |
97 | 97 | ||
98 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 98 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
99 | if ( !disabledSuspendScreenSaver ) { | 99 | if ( !disabledSuspendScreenSaver ) { |
100 | disabledSuspendScreenSaver = TRUE; | 100 | disabledSuspendScreenSaver = TRUE; |
101 | // Stop the screen from blanking and power saving state | 101 | // Stop the screen from blanking and power saving state |
102 | QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) | 102 | QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) |
103 | << ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend ); | 103 | << ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend ); |
104 | } | 104 | } |
105 | #endif | 105 | #endif |
106 | 106 | ||
107 | length(); | 107 | length(); |
108 | position(); | 108 | position(); |
109 | } | 109 | } |
110 | 110 | ||
111 | void XineControl::nextMedia() { | 111 | void XineControl::nextMedia() { |
112 | mediaPlayerState->setNext(); | 112 | mediaPlayerState->setNext(); |
113 | } | 113 | } |
114 | 114 | ||
115 | void XineControl::stop( bool isSet ) { | 115 | void XineControl::stop( bool isSet ) { |
116 | if ( !isSet) { | 116 | if ( !isSet) { |
117 | libXine->stop( ); | 117 | libXine->stop( ); |
118 | mediaPlayerState->setList(); | 118 | mediaPlayerState->setList(); |
119 | //mediaPlayerState->setPlaying( false ); | 119 | // mediaPlayerState->setPlaying( false ); |
120 | 120 | ||
121 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 121 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
122 | if ( disabledSuspendScreenSaver ) { | 122 | if ( disabledSuspendScreenSaver ) { |
123 | disabledSuspendScreenSaver = FALSE; | 123 | disabledSuspendScreenSaver = FALSE; |
124 | // Re-enable the suspend mode | 124 | // Re-enable the suspend mode |
125 | QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | 125 | QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; |
126 | } | 126 | } |
127 | #endif | 127 | #endif |
128 | 128 | ||
129 | } else { | 129 | } else { |
130 | // play again | 130 | // play again |
131 | } | 131 | } |
132 | } | 132 | } |
133 | 133 | ||
134 | /** | 134 | /** |
135 | * Pause playback | 135 | * Pause playback |
136 | * @isSet | 136 | * @isSet |
137 | */ | 137 | */ |
138 | void XineControl::pause( bool isSet) { | 138 | void XineControl::pause( bool isSet) { |
139 | if (isSet) { | 139 | if (isSet) { |
140 | libXine->pause(); | 140 | libXine->pause(); |
141 | } else { | 141 | } else { |
142 | libXine->play( m_fileName, 0, m_currentTime); | 142 | libXine->play( m_fileName, 0, m_currentTime); |
143 | } | 143 | } |
144 | } | 144 | } |
145 | 145 | ||
146 | 146 | ||
147 | /** | 147 | /** |
148 | * get current time in playback | 148 | * get current time in playback |
149 | */ | 149 | */ |
150 | long XineControl::currentTime() { | 150 | long XineControl::currentTime() { |
151 | // todo: jede sekunde überprüfen | 151 | // todo: jede sekunde überprüfen |
152 | m_currentTime = libXine->currentTime(); | 152 | m_currentTime = libXine->currentTime(); |
153 | return m_currentTime; | 153 | return m_currentTime; |
154 | QTimer::singleShot( 1000, this, SLOT( currentTime() ) ); | 154 | QTimer::singleShot( 1000, this, SLOT( currentTime() ) ); |
155 | } | 155 | } |
156 | 156 | ||
157 | /** | 157 | /** |
158 | * Set the length of the media file | 158 | * Set the length of the media file |
159 | */ | 159 | */ |
160 | void XineControl::length() { | 160 | void XineControl::length() { |
161 | m_length = libXine->length(); | 161 | m_length = libXine->length(); |
162 | mediaPlayerState->setLength( m_length ); | 162 | mediaPlayerState->setLength( m_length ); |
163 | } | 163 | } |
164 | 164 | ||
165 | 165 | ||
166 | /** | 166 | /** |
167 | * Reports the position the xine backend is at right now | 167 | * Reports the position the xine backend is at right now |
168 | * @return long the postion in seconds | 168 | * @return long the postion in seconds |
169 | */ | 169 | */ |
170 | long XineControl::position() { | 170 | long XineControl::position() { |
171 | m_position = ( currentTime() ); | 171 | m_position = ( currentTime() ); |
172 | mediaPlayerState->updatePosition( m_position ); | 172 | mediaPlayerState->updatePosition( m_position ); |
173 | long emitPos = (long)m_position; | 173 | long emitPos = (long)m_position; |
174 | emit positionChanged( emitPos ); | 174 | emit positionChanged( emitPos ); |
175 | if(mediaPlayerState->isPlaying) | 175 | if(mediaPlayerState->isPlaying) |
176 | // needs to be stopped the media is stopped | 176 | // needs to be stopped the media is stopped |
177 | QTimer::singleShot( 1000, this, SLOT( position() ) ); | 177 | QTimer::singleShot( 1000, this, SLOT( position() ) ); |
178 | // qDebug("POSITION : %d", m_position); | 178 | // qDebug("POSITION : %d", m_position); |
179 | return m_position; | 179 | return m_position; |
180 | } | 180 | } |
181 | 181 | ||
182 | /** | 182 | /** |
183 | * Set videoplayback to fullscreen | 183 | * Set videoplayback to fullscreen |
184 | * @param isSet | 184 | * @param isSet |
185 | */ | 185 | */ |
186 | void XineControl::setFullscreen( bool isSet ) { | 186 | void XineControl::setFullscreen( bool isSet ) { |
187 | libXine->showVideoFullScreen( isSet); | 187 | libXine->showVideoFullScreen( isSet); |
188 | } | 188 | } |
189 | 189 | ||
190 | /** | 190 | /** |
191 | * Seek to a position in the track | 191 | * Seek to a position in the track |
192 | * @param second the second to jump to | 192 | * @param second the second to jump to |
193 | */ | 193 | */ |
194 | void XineControl::seekTo( long second ) { | 194 | void XineControl::seekTo( long second ) { |
195 | libXine->play( m_fileName , 0, (int)second ); | 195 | libXine->play( m_fileName , 0, (int)second ); |
196 | } | 196 | } |
197 | 197 | ||
198 | void XineControl::videoResized ( const QSize &s ) { | 198 | void XineControl::videoResized ( const QSize &s ) { |
199 | libXine-> resize ( s ); | 199 | libXine-> resize ( s ); |
200 | } | 200 | } |