-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 5 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 19 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 2 |
3 files changed, 17 insertions, 9 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index c187f52..b2143a0 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp | |||
@@ -45,132 +45,133 @@ | |||
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\n"; | 81 | ts << "misc.memcpy_method:glibc\n"; |
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 | m_videoOutput = ::init_video_out_plugin( m_config, NULL ); | 90 | m_videoOutput = ::init_video_out_plugin( m_config, NULL ); |
91 | if (m_wid != 0 ) { | 91 | if (m_wid != 0 ) { |
92 | printf("!0\n" ); | 92 | printf("!0\n" ); |
93 | resize ( m_wid-> size ( )); | 93 | resize ( m_wid-> size ( )); |
94 | ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); | 94 | ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); |
95 | m_wid-> setImage ( new QImage ( Resource::loadImage(""))); | 95 | m_wid-> setImage ( new QImage ( Resource::loadImage(""))); |
96 | m_wid->repaint(); | 96 | m_wid->repaint(); |
97 | } | 97 | } |
98 | null_display_handler( m_videoOutput, | 98 | null_display_handler( m_videoOutput, |
99 | xine_display_frame, | 99 | xine_display_frame, |
100 | this ); | 100 | this ); |
101 | 101 | ||
102 | m_xine = xine_init( m_videoOutput, | 102 | m_xine = xine_init( m_videoOutput, |
103 | m_audioOutput, m_config ); | 103 | m_audioOutput, m_config ); |
104 | // install the event handler | 104 | // install the event handler |
105 | xine_register_event_listener( m_xine, xine_event_handler, this ); | 105 | xine_register_event_listener( m_xine, xine_event_handler, this ); |
106 | } | 106 | } |
107 | 107 | ||
108 | Lib::~Lib() { | 108 | Lib::~Lib() { |
109 | delete m_config; | 109 | free( m_config ); |
110 | xine_remove_event_listener( m_xine, xine_event_handler ); | 110 | xine_remove_event_listener( m_xine, xine_event_handler ); |
111 | xine_exit( m_xine ); | 111 | xine_exit( m_xine ); |
112 | delete m_videoOutput; | 112 | /* FIXME either free or delete but valgrind bitches against both */ |
113 | //free( m_videoOutput ); | ||
113 | //delete m_audioOutput; | 114 | //delete m_audioOutput; |
114 | 115 | ||
115 | } | 116 | } |
116 | 117 | ||
117 | void Lib::resize ( const QSize &s ) | 118 | void Lib::resize ( const QSize &s ) |
118 | { | 119 | { |
119 | if ( s. width ( ) && s. height ( )) { | 120 | if ( s. width ( ) && s. height ( )) { |
120 | ::null_set_gui_width( m_videoOutput, s. width() ); | 121 | ::null_set_gui_width( m_videoOutput, s. width() ); |
121 | ::null_set_gui_height(m_videoOutput, s. height() ); | 122 | ::null_set_gui_height(m_videoOutput, s. height() ); |
122 | } | 123 | } |
123 | } | 124 | } |
124 | 125 | ||
125 | QCString Lib::version() { | 126 | QCString Lib::version() { |
126 | QCString str( xine_get_str_version() ); | 127 | QCString str( xine_get_str_version() ); |
127 | return str; | 128 | return str; |
128 | }; | 129 | }; |
129 | 130 | ||
130 | int Lib::majorVersion() { | 131 | int Lib::majorVersion() { |
131 | return xine_get_major_version(); | 132 | return xine_get_major_version(); |
132 | } | 133 | } |
133 | int Lib::minorVersion() { | 134 | int Lib::minorVersion() { |
134 | return xine_get_minor_version(); | 135 | return xine_get_minor_version(); |
135 | }; | 136 | }; |
136 | 137 | ||
137 | int Lib::subVersion() { | 138 | int Lib::subVersion() { |
138 | return xine_get_sub_version(); | 139 | return xine_get_sub_version(); |
139 | } | 140 | } |
140 | int Lib::play( const QString& fileName, | 141 | int Lib::play( const QString& fileName, |
141 | int startPos, | 142 | int startPos, |
142 | int start_time ) { | 143 | int start_time ) { |
143 | QString str = fileName.stripWhiteSpace(); | 144 | QString str = fileName.stripWhiteSpace(); |
144 | //workaround OpiePlayer bug | 145 | //workaround OpiePlayer bug |
145 | //f (str.right(1) == QString::fromLatin1("/") ) | 146 | //f (str.right(1) == QString::fromLatin1("/") ) |
146 | // str = str.mid( str.length() -1 ); | 147 | // str = str.mid( str.length() -1 ); |
147 | return xine_play( m_xine, QFile::encodeName(str.utf8() ).data(), | 148 | return xine_play( m_xine, QFile::encodeName(str.utf8() ).data(), |
148 | startPos, start_time); | 149 | startPos, start_time); |
149 | } | 150 | } |
150 | void Lib::stop() { | 151 | void Lib::stop() { |
151 | qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); | 152 | qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); |
152 | xine_stop(m_xine ); | 153 | xine_stop(m_xine ); |
153 | } | 154 | } |
154 | void Lib::pause(){ | 155 | void Lib::pause(){ |
155 | xine_set_speed( m_xine, SPEED_PAUSE ); | 156 | xine_set_speed( m_xine, SPEED_PAUSE ); |
156 | } | 157 | } |
157 | int Lib::speed() { | 158 | int Lib::speed() { |
158 | return xine_get_speed( m_xine ); | 159 | return xine_get_speed( m_xine ); |
159 | } | 160 | } |
160 | void Lib::setSpeed( int speed ) { | 161 | void Lib::setSpeed( int speed ) { |
161 | xine_set_speed( m_xine, speed ); | 162 | xine_set_speed( m_xine, speed ); |
162 | } | 163 | } |
163 | int Lib::status(){ | 164 | int Lib::status(){ |
164 | return xine_get_status( m_xine ); | 165 | return xine_get_status( m_xine ); |
165 | } | 166 | } |
166 | int Lib::currentPosition(){ | 167 | int Lib::currentPosition(){ |
167 | return xine_get_current_position( m_xine ); | 168 | return xine_get_current_position( m_xine ); |
168 | } | 169 | } |
169 | int Lib::currentTime() { | 170 | int Lib::currentTime() { |
170 | return xine_get_current_time( m_xine ); | 171 | return xine_get_current_time( m_xine ); |
171 | }; | 172 | }; |
172 | int Lib::length() { | 173 | int Lib::length() { |
173 | return xine_get_stream_length( m_xine ); | 174 | return xine_get_stream_length( m_xine ); |
174 | } | 175 | } |
175 | bool Lib::isSeekable() { | 176 | bool Lib::isSeekable() { |
176 | return xine_is_stream_seekable(m_xine); | 177 | return xine_is_stream_seekable(m_xine); |
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 75e2979..098322b 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -1,72 +1,73 @@ | |||
1 | 1 | ||
2 | #define QTOPIA_INTERNAL_FSLP | 2 | #define QTOPIA_INTERNAL_FSLP |
3 | #include <qpe/qpemenubar.h> | 3 | #include <qpe/qpemenubar.h> |
4 | #include <qpe/qpetoolbar.h> | 4 | #include <qpe/qpetoolbar.h> |
5 | #include <qpe/fileselector.h> | 5 | #include <qpe/fileselector.h> |
6 | #include <qpe/qpeapplication.h> | 6 | #include <qpe/qpeapplication.h> |
7 | #include <qpe/lnkproperties.h> | 7 | #include <qpe/lnkproperties.h> |
8 | #include <qpe/storage.h> | 8 | #include <qpe/storage.h> |
9 | #include <qpe/mimetype.h> | ||
9 | 10 | ||
10 | #include <qpe/applnk.h> | 11 | #include <qpe/applnk.h> |
11 | #include <qpopupmenu.h> | 12 | #include <qpopupmenu.h> |
12 | #include <qpe/config.h> | 13 | #include <qpe/config.h> |
13 | #include <qpe/global.h> | 14 | #include <qpe/global.h> |
14 | #include <qpe/resource.h> | 15 | #include <qpe/resource.h> |
15 | #include <qaction.h> | 16 | #include <qaction.h> |
16 | #include <qcursor.h> | 17 | #include <qcursor.h> |
17 | #include <qimage.h> | 18 | #include <qimage.h> |
18 | #include <qfile.h> | 19 | #include <qfile.h> |
19 | #include <qdir.h> | 20 | #include <qdir.h> |
20 | #include <qlayout.h> | 21 | #include <qlayout.h> |
21 | #include <qlabel.h> | 22 | #include <qlabel.h> |
22 | #include <qlist.h> | 23 | #include <qlist.h> |
23 | #include <qlistbox.h> | 24 | #include <qlistbox.h> |
24 | #include <qmainwindow.h> | 25 | #include <qmainwindow.h> |
25 | #include <qmessagebox.h> | 26 | #include <qmessagebox.h> |
26 | #include <qtoolbutton.h> | 27 | #include <qtoolbutton.h> |
27 | #include <qtabwidget.h> | 28 | #include <qtabwidget.h> |
28 | #include <qlistview.h> | 29 | #include <qlistview.h> |
29 | #include <qpoint.h> | 30 | #include <qpoint.h> |
30 | #include <qlineedit.h> | 31 | #include <qlineedit.h> |
31 | #include <qpushbutton.h> | 32 | #include <qpushbutton.h> |
32 | #include <qregexp.h> | 33 | #include <qregexp.h> |
33 | #include <qtextstream.h> | 34 | #include <qtextstream.h> |
34 | 35 | ||
35 | 36 | ||
36 | #include "playlistselection.h" | 37 | #include "playlistselection.h" |
37 | #include "playlistwidget.h" | 38 | #include "playlistwidget.h" |
38 | #include "mediaplayerstate.h" | 39 | #include "mediaplayerstate.h" |
39 | 40 | ||
40 | #include "inputDialog.h" | 41 | #include "inputDialog.h" |
41 | 42 | ||
42 | #include <stdlib.h> | 43 | #include <stdlib.h> |
43 | #include "audiowidget.h" | 44 | #include "audiowidget.h" |
44 | #include "videowidget.h" | 45 | #include "videowidget.h" |
45 | 46 | ||
46 | #define BUTTONS_ON_TOOLBAR | 47 | #define BUTTONS_ON_TOOLBAR |
47 | #define SIDE_BUTTONS | 48 | #define SIDE_BUTTONS |
48 | #define CAN_SAVE_LOAD_PLAYLISTS | 49 | #define CAN_SAVE_LOAD_PLAYLISTS |
49 | 50 | ||
50 | extern MediaPlayerState *mediaPlayerState; | 51 | extern MediaPlayerState *mediaPlayerState; |
51 | 52 | ||
52 | 53 | ||
53 | class PlayListWidgetPrivate { | 54 | class PlayListWidgetPrivate { |
54 | public: | 55 | public: |
55 | QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; | 56 | QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; |
56 | QFrame *playListFrame; | 57 | QFrame *playListFrame; |
57 | FileSelector *files; | 58 | FileSelector *files; |
58 | PlayListSelection *selectedFiles; | 59 | PlayListSelection *selectedFiles; |
59 | bool setDocumentUsed; | 60 | bool setDocumentUsed; |
60 | DocLnk *current; | 61 | DocLnk *current; |
61 | }; | 62 | }; |
62 | 63 | ||
63 | 64 | ||
64 | class ToolButton : public QToolButton { | 65 | class ToolButton : public QToolButton { |
65 | public: | 66 | public: |
66 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) | 67 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) |
67 | : QToolButton( parent, name ) { | 68 | : QToolButton( parent, name ) { |
68 | setTextLabel( name ); | 69 | setTextLabel( name ); |
69 | setPixmap( Resource::loadPixmap( icon ) ); | 70 | setPixmap( Resource::loadPixmap( icon ) ); |
70 | setAutoRaise( TRUE ); | 71 | setAutoRaise( TRUE ); |
71 | setFocusPolicy( QWidget::NoFocus ); | 72 | setFocusPolicy( QWidget::NoFocus ); |
72 | setToggleButton( t ); | 73 | setToggleButton( t ); |
@@ -246,132 +247,136 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
246 | videoView->setAllColumnsShowFocus(TRUE); | 247 | videoView->setAllColumnsShowFocus(TRUE); |
247 | videoView->setSorting(0,TRUE); | 248 | videoView->setSorting(0,TRUE); |
248 | 249 | ||
249 | videoView->setMultiSelection( TRUE ); | 250 | videoView->setMultiSelection( TRUE ); |
250 | videoView->setSelectionMode( QListView::Extended); | 251 | videoView->setSelectionMode( QListView::Extended); |
251 | 252 | ||
252 | Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 ); | 253 | Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 ); |
253 | 254 | ||
254 | QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); | 255 | QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); |
255 | 256 | ||
256 | tabWidget->insertTab( vTab,tr("Video")); | 257 | tabWidget->insertTab( vTab,tr("Video")); |
257 | 258 | ||
258 | //playlists list | 259 | //playlists list |
259 | QWidget *LTab; | 260 | QWidget *LTab; |
260 | LTab = new QWidget( tabWidget, "LTab" ); | 261 | LTab = new QWidget( tabWidget, "LTab" ); |
261 | QGridLayout *Llayout = new QGridLayout( LTab ); | 262 | QGridLayout *Llayout = new QGridLayout( LTab ); |
262 | Llayout->setSpacing( 2); | 263 | Llayout->setSpacing( 2); |
263 | Llayout->setMargin( 2); | 264 | Llayout->setMargin( 2); |
264 | 265 | ||
265 | playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy | 266 | playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy |
266 | Llayout->addMultiCellWidget( playLists, 0, 0, 0, 1 ); | 267 | Llayout->addMultiCellWidget( playLists, 0, 0, 0, 1 ); |
267 | 268 | ||
268 | tabWidget->insertTab(LTab,tr("Lists")); | 269 | tabWidget->insertTab(LTab,tr("Lists")); |
269 | 270 | ||
270 | connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); | 271 | connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); |
271 | 272 | ||
272 | connect( pmView, SIGNAL( activated(int)), this, SLOT( pmViewActivated(int) ) ); | 273 | connect( pmView, SIGNAL( activated(int)), this, SLOT( pmViewActivated(int) ) ); |
273 | 274 | ||
274 | connect( skinsMenu, SIGNAL( activated(int)), this, SLOT(skinsMenuActivated(int) ) ); | 275 | connect( skinsMenu, SIGNAL( activated(int)), this, SLOT(skinsMenuActivated(int) ) ); |
275 | 276 | ||
276 | // connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled() ) ); | 277 | // connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled() ) ); |
277 | 278 | ||
278 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 279 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
279 | this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); | 280 | this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); |
280 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 281 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
281 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); | 282 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); |
282 | connect( audioView, SIGNAL( returnPressed( QListViewItem *)), | 283 | connect( audioView, SIGNAL( returnPressed( QListViewItem *)), |
283 | this,SLOT( playIt( QListViewItem *)) ); | 284 | this,SLOT( playIt( QListViewItem *)) ); |
284 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); | 285 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); |
285 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 286 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
286 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); | 287 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); |
287 | connect( videoView, SIGNAL( returnPressed( QListViewItem *)), | 288 | connect( videoView, SIGNAL( returnPressed( QListViewItem *)), |
288 | this,SLOT( playIt( QListViewItem *)) ); | 289 | this,SLOT( playIt( QListViewItem *)) ); |
289 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); | 290 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); |
290 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); | 291 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); |
291 | connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); | 292 | connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); |
292 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); | 293 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); |
293 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); | 294 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); |
294 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); | 295 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); |
295 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); | 296 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); |
296 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); | 297 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); |
297 | 298 | ||
298 | setCentralWidget( vbox5 ); | 299 | setCentralWidget( vbox5 ); |
299 | 300 | ||
300 | readConfig( cfg ); | 301 | readConfig( cfg ); |
301 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); | 302 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); |
302 | loadList(DocLnk( currentPlaylist)); | 303 | loadList(DocLnk( currentPlaylist)); |
303 | setCaption(tr("OpiePlayer: ")+ currentPlaylist ); | 304 | setCaption(tr("OpiePlayer: ")+ currentPlaylist ); |
304 | 305 | ||
305 | initializeStates(); | 306 | initializeStates(); |
306 | } | 307 | } |
307 | 308 | ||
308 | 309 | ||
309 | PlayListWidget::~PlayListWidget() { | 310 | PlayListWidget::~PlayListWidget() { |
310 | if ( d->current ) { | 311 | /* fixing symptoms and not sources is entirely stupid - zecke */ |
311 | delete d->current; | 312 | // Config cfg( "OpiePlayer" ); |
312 | } | 313 | // writeConfig( cfg ); |
313 | delete d; | 314 | |
315 | if ( d->current ) { | ||
316 | delete d->current; | ||
317 | } | ||
318 | delete d; | ||
314 | } | 319 | } |
315 | 320 | ||
316 | 321 | ||
317 | void PlayListWidget::initializeStates() { | 322 | void PlayListWidget::initializeStates() { |
318 | 323 | ||
319 | d->tbPlay->setOn( mediaPlayerState->playing() ); | 324 | d->tbPlay->setOn( mediaPlayerState->playing() ); |
320 | d->tbLoop->setOn( mediaPlayerState->looping() ); | 325 | d->tbLoop->setOn( mediaPlayerState->looping() ); |
321 | d->tbShuffle->setOn( mediaPlayerState->shuffled() ); | 326 | d->tbShuffle->setOn( mediaPlayerState->shuffled() ); |
322 | setPlaylist( true); | 327 | setPlaylist( true); |
323 | } | 328 | } |
324 | 329 | ||
325 | 330 | ||
326 | void PlayListWidget::readConfig( Config& cfg ) { | 331 | void PlayListWidget::readConfig( Config& cfg ) { |
327 | cfg.setGroup("PlayList"); | 332 | cfg.setGroup("PlayList"); |
328 | QString currentString = cfg.readEntry("current", "" ); | 333 | QString currentString = cfg.readEntry("current", "" ); |
329 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 334 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
330 | for ( int i = 0; i < noOfFiles; i++ ) { | 335 | for ( int i = 0; i < noOfFiles; i++ ) { |
331 | QString entryName; | 336 | QString entryName; |
332 | entryName.sprintf( "File%i", i + 1 ); | 337 | entryName.sprintf( "File%i", i + 1 ); |
333 | QString linkFile = cfg.readEntry( entryName ); | 338 | QString linkFile = cfg.readEntry( entryName ); |
334 | if(QFileInfo( linkFile).exists() ) { | 339 | if(QFileInfo( linkFile).exists() ) { |
335 | DocLnk lnk( linkFile ); | 340 | DocLnk lnk( linkFile ); |
336 | if ( QFileInfo( lnk.file()).exists() || linkFile.find("http",0,TRUE) != -1) { | 341 | if ( QFileInfo( lnk.file()).exists() || linkFile.find("http",0,TRUE) != -1) { |
337 | d->selectedFiles->addToSelection( lnk ); | 342 | d->selectedFiles->addToSelection( lnk ); |
338 | } | 343 | } |
339 | } | 344 | } |
340 | } | 345 | } |
341 | d->selectedFiles->setSelectedItem( currentString); | 346 | d->selectedFiles->setSelectedItem( currentString); |
342 | } | 347 | } |
343 | 348 | ||
344 | 349 | ||
345 | void PlayListWidget::writeConfig( Config& cfg ) const { | 350 | void PlayListWidget::writeConfig( Config& cfg ) const { |
346 | 351 | ||
347 | d->selectedFiles->writeCurrent( cfg); | 352 | d->selectedFiles->writeCurrent( cfg); |
348 | cfg.setGroup("PlayList"); | 353 | cfg.setGroup("PlayList"); |
349 | int noOfFiles = 0; | 354 | int noOfFiles = 0; |
350 | d->selectedFiles->first(); | 355 | d->selectedFiles->first(); |
351 | do { | 356 | do { |
352 | const DocLnk *lnk = d->selectedFiles->current(); | 357 | const DocLnk *lnk = d->selectedFiles->current(); |
353 | if ( lnk ) { | 358 | if ( lnk ) { |
354 | QString entryName; | 359 | QString entryName; |
355 | entryName.sprintf( "File%i", noOfFiles + 1 ); | 360 | entryName.sprintf( "File%i", noOfFiles + 1 ); |
356 | cfg.writeEntry( entryName, lnk->linkFile() ); | 361 | cfg.writeEntry( entryName, lnk->linkFile() ); |
357 | // if this link does exist, add it so we have the file | 362 | // if this link does exist, add it so we have the file |
358 | // next time... | 363 | // next time... |
359 | if ( !QFile::exists( lnk->linkFile() ) ) { | 364 | if ( !QFile::exists( lnk->linkFile() ) ) { |
360 | // the way writing lnks doesn't really check for out | 365 | // the way writing lnks doesn't really check for out |
361 | // of disk space, but check it anyway. | 366 | // of disk space, but check it anyway. |
362 | if ( !lnk->writeLink() ) { | 367 | if ( !lnk->writeLink() ) { |
363 | QMessageBox::critical( 0, tr("Out of space"), | 368 | QMessageBox::critical( 0, tr("Out of space"), |
364 | tr( "There was a problem saving " | 369 | tr( "There was a problem saving " |
365 | "the playlist.\n" | 370 | "the playlist.\n" |
366 | "Your playlist " | 371 | "Your playlist " |
367 | "may be missing some entries\n" | 372 | "may be missing some entries\n" |
368 | "the next time you start it." ) | 373 | "the next time you start it." ) |
369 | ); | 374 | ); |
370 | } | 375 | } |
371 | } | 376 | } |
372 | noOfFiles++; | 377 | noOfFiles++; |
373 | } | 378 | } |
374 | } | 379 | } |
375 | while ( d->selectedFiles->next() ); | 380 | while ( d->selectedFiles->next() ); |
376 | cfg.writeEntry("NumberOfFiles", noOfFiles ); | 381 | cfg.writeEntry("NumberOfFiles", noOfFiles ); |
377 | } | 382 | } |
@@ -891,133 +896,135 @@ void PlayListWidget::populateAudioView() { | |||
891 | 896 | ||
892 | QListIterator<DocLnk> dit( files.children() ); | 897 | QListIterator<DocLnk> dit( files.children() ); |
893 | QListIterator<FileSystem> it ( fs ); | 898 | QListIterator<FileSystem> it ( fs ); |
894 | 899 | ||
895 | QString storage; | 900 | QString storage; |
896 | for ( ; dit.current(); ++dit ) { | 901 | for ( ; dit.current(); ++dit ) { |
897 | for( ; it.current(); ++it ){ | 902 | for( ; it.current(); ++it ){ |
898 | const QString name = (*it)->name(); | 903 | const QString name = (*it)->name(); |
899 | const QString path = (*it)->path(); | 904 | const QString path = (*it)->path(); |
900 | if(dit.current()->file().find(path) != -1 ) storage=name; | 905 | if(dit.current()->file().find(path) != -1 ) storage=name; |
901 | } | 906 | } |
902 | 907 | ||
903 | QListViewItem * newItem; | 908 | QListViewItem * newItem; |
904 | if ( QFile( dit.current()->file()).exists() ) { | 909 | if ( QFile( dit.current()->file()).exists() ) { |
905 | // qDebug(dit.current()->name()); | 910 | // qDebug(dit.current()->name()); |
906 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), | 911 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), |
907 | QString::number( QFile( dit.current()->file()).size() ), storage); | 912 | QString::number( QFile( dit.current()->file()).size() ), storage); |
908 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/musicfile" )); | 913 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/musicfile" )); |
909 | } | 914 | } |
910 | } | 915 | } |
911 | 916 | ||
912 | } | 917 | } |
913 | 918 | ||
914 | void PlayListWidget::populateVideoView() { | 919 | void PlayListWidget::populateVideoView() { |
915 | videoView->clear(); | 920 | videoView->clear(); |
916 | StorageInfo storageInfo; | 921 | StorageInfo storageInfo; |
917 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 922 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
918 | 923 | ||
919 | if(!videoScan ) scanForVideo(); | 924 | if(!videoScan ) scanForVideo(); |
920 | 925 | ||
921 | QListIterator<DocLnk> Vdit( vFiles.children() ); | 926 | QListIterator<DocLnk> Vdit( vFiles.children() ); |
922 | QListIterator<FileSystem> it ( fs ); | 927 | QListIterator<FileSystem> it ( fs ); |
923 | videoView->clear(); | 928 | videoView->clear(); |
924 | QString storage; | 929 | QString storage; |
925 | for ( ; Vdit.current(); ++Vdit ) { | 930 | for ( ; Vdit.current(); ++Vdit ) { |
926 | for( ; it.current(); ++it ){ | 931 | for( ; it.current(); ++it ){ |
927 | const QString name = (*it)->name(); | 932 | const QString name = (*it)->name(); |
928 | const QString path = (*it)->path(); | 933 | const QString path = (*it)->path(); |
929 | if( Vdit.current()->file().find(path) != -1 ) storage=name; | 934 | if( Vdit.current()->file().find(path) != -1 ) storage=name; |
930 | } | 935 | } |
931 | 936 | ||
932 | QListViewItem * newItem; | 937 | QListViewItem * newItem; |
933 | if ( QFile( Vdit.current()->file()).exists() ) { | 938 | if ( QFile( Vdit.current()->file()).exists() ) { |
934 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), | 939 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), |
935 | QString::number( QFile( Vdit.current()->file()).size() ), storage); | 940 | QString::number( QFile( Vdit.current()->file()).size() ), storage); |
936 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" )); | 941 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" )); |
937 | } | 942 | } |
938 | } | 943 | } |
939 | } | 944 | } |
940 | 945 | ||
941 | void PlayListWidget::openFile() { | 946 | void PlayListWidget::openFile() { |
942 | QString filename, name; | 947 | QString filename, name; |
943 | InputDialog *fileDlg; | 948 | InputDialog *fileDlg; |
944 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); | 949 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); |
945 | fileDlg->exec(); | 950 | fileDlg->exec(); |
946 | if( fileDlg->result() == 1 ) { | 951 | if( fileDlg->result() == 1 ) { |
947 | filename = fileDlg->text(); | 952 | filename = fileDlg->text(); |
948 | 953 | ||
949 | qDebug("Selected filename is "+filename); | 954 | qDebug("Selected filename is "+filename); |
950 | if(filename.right(3) == "m3u") { | 955 | if(filename.right(3) == "m3u") { |
951 | readm3u( filename ); | 956 | readm3u( filename ); |
952 | } else if(filename.right(3) == "pls") { | 957 | } else if(filename.right(3) == "pls") { |
953 | readPls( filename ); | 958 | readPls( filename ); |
954 | } else { | 959 | } else { |
960 | /* FIXME ....... AUDIO/X-MPEGURL is bad*/ | ||
955 | DocLnk lnk; | 961 | DocLnk lnk; |
956 | 962 | ||
957 | lnk.setName(filename); //sets file name | 963 | lnk.setName(filename); //sets file name |
958 | lnk.setFile(filename); //sets File property | 964 | lnk.setFile(filename); //sets File property |
959 | lnk.setType("audio/x-mpegurl"); | 965 | //qWarning( "Mimetype: " + MimeType( QFile::encodeName(filename) ).id() ); |
966 | lnk.setType( MimeType( QFile::encodeName(filename) ).id() ); | ||
960 | lnk.setExec("opieplayer"); | 967 | lnk.setExec("opieplayer"); |
961 | lnk.setIcon("opieplayer2/MPEGPlayer"); | 968 | lnk.setIcon("opieplayer2/MPEGPlayer"); |
962 | 969 | ||
963 | if(!lnk.writeLink()) { | 970 | if(!lnk.writeLink()) { |
964 | qDebug("Writing doclink did not work"); | 971 | qDebug("Writing doclink did not work"); |
965 | } | 972 | } |
966 | d->selectedFiles->addToSelection( lnk); | 973 | d->selectedFiles->addToSelection( lnk); |
967 | } | 974 | } |
968 | } | 975 | } |
969 | if(fileDlg) { | 976 | if(fileDlg) { |
970 | delete fileDlg; | 977 | delete fileDlg; |
971 | } | 978 | } |
972 | } | 979 | } |
973 | 980 | ||
974 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e) | 981 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e) |
975 | { | 982 | { |
976 | switch ( e->key() ) { | 983 | switch ( e->key() ) { |
977 | ////////////////////////////// Zaurus keys | 984 | ////////////////////////////// Zaurus keys |
978 | case Key_F9: //activity | 985 | case Key_F9: //activity |
979 | // if(audioUI->isHidden()) | 986 | // if(audioUI->isHidden()) |
980 | // audioUI->showMaximized(); | 987 | // audioUI->showMaximized(); |
981 | break; | 988 | break; |
982 | case Key_F10: //contacts | 989 | case Key_F10: //contacts |
983 | // if( videoUI->isHidden()) | 990 | // if( videoUI->isHidden()) |
984 | // videoUI->showMaximized(); | 991 | // videoUI->showMaximized(); |
985 | break; | 992 | break; |
986 | case Key_F11: //menu | 993 | case Key_F11: //menu |
987 | break; | 994 | break; |
988 | case Key_F12: //home | 995 | case Key_F12: //home |
989 | // doBlank(); | 996 | // doBlank(); |
990 | break; | 997 | break; |
991 | case Key_F13: //mail | 998 | case Key_F13: //mail |
992 | // doUnblank(); | 999 | // doUnblank(); |
993 | break; | 1000 | break; |
994 | case Key_Q: //add to playlist | 1001 | case Key_Q: //add to playlist |
995 | addSelected(); | 1002 | addSelected(); |
996 | break; | 1003 | break; |
997 | case Key_R: //remove from playlist | 1004 | case Key_R: //remove from playlist |
998 | removeSelected(); | 1005 | removeSelected(); |
999 | break; | 1006 | break; |
1000 | // case Key_P: //play | 1007 | // case Key_P: //play |
1001 | // qDebug("Play"); | 1008 | // qDebug("Play"); |
1002 | // playSelected(); | 1009 | // playSelected(); |
1003 | // break; | 1010 | // break; |
1004 | case Key_Space: | 1011 | case Key_Space: |
1005 | // playSelected(); puh | 1012 | // playSelected(); puh |
1006 | break; | 1013 | break; |
1007 | case Key_1: | 1014 | case Key_1: |
1008 | tabWidget->setCurrentPage(0); | 1015 | tabWidget->setCurrentPage(0); |
1009 | break; | 1016 | break; |
1010 | case Key_2: | 1017 | case Key_2: |
1011 | tabWidget->setCurrentPage(1); | 1018 | tabWidget->setCurrentPage(1); |
1012 | break; | 1019 | break; |
1013 | case Key_3: | 1020 | case Key_3: |
1014 | tabWidget->setCurrentPage(2); | 1021 | tabWidget->setCurrentPage(2); |
1015 | break; | 1022 | break; |
1016 | case Key_4: | 1023 | case Key_4: |
1017 | tabWidget->setCurrentPage(3); | 1024 | tabWidget->setCurrentPage(3); |
1018 | break; | 1025 | break; |
1019 | case Key_Down: | 1026 | case Key_Down: |
1020 | if ( !d->selectedFiles->next() ) | 1027 | if ( !d->selectedFiles->next() ) |
1021 | d->selectedFiles->first(); | 1028 | d->selectedFiles->first(); |
1022 | 1029 | ||
1023 | break; | 1030 | break; |
@@ -1175,73 +1182,73 @@ void PlayListWidget::readPls(const QString &filename) { | |||
1175 | lnk.setName( name); | 1182 | lnk.setName( name); |
1176 | if(s.at(s.length()-4) == '.') // if this is probably a file | 1183 | if(s.at(s.length()-4) == '.') // if this is probably a file |
1177 | lnk.setFile( s); | 1184 | lnk.setFile( s); |
1178 | else { //if its a url | 1185 | else { //if its a url |
1179 | if( name.right(1).find('/') == -1) | 1186 | if( name.right(1).find('/') == -1) |
1180 | s+="/"; | 1187 | s+="/"; |
1181 | lnk.setFile( s); | 1188 | lnk.setFile( s); |
1182 | } | 1189 | } |
1183 | lnk.setType("audio/x-mpegurl"); | 1190 | lnk.setType("audio/x-mpegurl"); |
1184 | 1191 | ||
1185 | qDebug("DocLnk add "+name); | 1192 | qDebug("DocLnk add "+name); |
1186 | d->selectedFiles->addToSelection( lnk); | 1193 | d->selectedFiles->addToSelection( lnk); |
1187 | } | 1194 | } |
1188 | } | 1195 | } |
1189 | i++; | 1196 | i++; |
1190 | } | 1197 | } |
1191 | } | 1198 | } |
1192 | 1199 | ||
1193 | void PlayListWidget::pmViewActivated(int index) { | 1200 | void PlayListWidget::pmViewActivated(int index) { |
1194 | // qDebug("%d", index); | 1201 | // qDebug("%d", index); |
1195 | switch(index) { | 1202 | switch(index) { |
1196 | case -16: | 1203 | case -16: |
1197 | { | 1204 | { |
1198 | 1205 | ||
1199 | mediaPlayerState->toggleFullscreen(); | 1206 | mediaPlayerState->toggleFullscreen(); |
1200 | bool b=mediaPlayerState->fullscreen(); | 1207 | bool b=mediaPlayerState->fullscreen(); |
1201 | pmView->setItemChecked( index,b); | 1208 | pmView->setItemChecked( index,b); |
1202 | Config cfg( "OpiePlayer" ); | 1209 | Config cfg( "OpiePlayer" ); |
1203 | cfg.writeEntry("FullScreen", b); | 1210 | cfg.writeEntry("FullScreen", b); |
1204 | 1211 | ||
1205 | } | 1212 | } |
1206 | break; | 1213 | break; |
1207 | }; | 1214 | }; |
1208 | } | 1215 | } |
1209 | 1216 | ||
1210 | void PlayListWidget::populateSkinsMenu() { | 1217 | void PlayListWidget::populateSkinsMenu() { |
1211 | int item=0; | 1218 | int item=0; |
1212 | defaultSkinIndex=0; | 1219 | defaultSkinIndex=0; |
1213 | QString skinName; | 1220 | QString skinName; |
1214 | Config cfg( "OpiePlayer" ); | 1221 | Config cfg( "OpiePlayer" ); |
1215 | cfg.setGroup("Options"); | 1222 | cfg.setGroup("Options"); |
1216 | QString skin = cfg.readEntry("Skin","default"); | 1223 | QString skin = cfg.readEntry("Skin","default"); |
1217 | 1224 | ||
1218 | QDir skinsDir(QPEApplication::qpeDir()+"/pics/opieplayer2/skins"); | 1225 | QDir skinsDir(QPEApplication::qpeDir()+"/pics/opieplayer2/skins"); |
1219 | skinsDir.setFilter( QDir::Dirs); | 1226 | skinsDir.setFilter( QDir::Dirs); |
1220 | skinsDir.setSorting(QDir::Name); | 1227 | skinsDir.setSorting(QDir::Name); |
1221 | const QFileInfoList *skinslist = skinsDir.entryInfoList(); | 1228 | const QFileInfoList *skinslist = skinsDir.entryInfoList(); |
1222 | QFileInfoListIterator it( *skinslist ); | 1229 | QFileInfoListIterator it( *skinslist ); |
1223 | QFileInfo *fi; | 1230 | QFileInfo *fi; |
1224 | while ( (fi=it.current()) ) { | 1231 | while ( (fi=it.current()) ) { |
1225 | skinName = fi->fileName(); | 1232 | skinName = fi->fileName(); |
1226 | qDebug( fi->fileName()); | 1233 | qDebug( fi->fileName()); |
1227 | if( skinName != "." && skinName != ".." && skinName !="CVS") | 1234 | if( skinName != "." && skinName != ".." && skinName !="CVS") |
1228 | item = skinsMenu->insertItem( fi->fileName()); | 1235 | item = skinsMenu->insertItem( fi->fileName()); |
1229 | if( skinName == "default") | 1236 | if( skinName == "default") |
1230 | defaultSkinIndex = item; | 1237 | defaultSkinIndex = item; |
1231 | if( skinName == skin) | 1238 | if( skinName == skin) |
1232 | skinsMenu->setItemChecked( item, TRUE); | 1239 | skinsMenu->setItemChecked( item, TRUE); |
1233 | 1240 | ||
1234 | ++it; | 1241 | ++it; |
1235 | } | 1242 | } |
1236 | } | 1243 | } |
1237 | 1244 | ||
1238 | void PlayListWidget::skinsMenuActivated(int item) { | 1245 | void PlayListWidget::skinsMenuActivated(int item) { |
1239 | for(int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i--) { | 1246 | for(uint i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i--) { |
1240 | skinsMenu->setItemChecked( i, FALSE); | 1247 | skinsMenu->setItemChecked( i, FALSE); |
1241 | } | 1248 | } |
1242 | skinsMenu->setItemChecked( item, TRUE); | 1249 | skinsMenu->setItemChecked( item, TRUE); |
1243 | 1250 | ||
1244 | Config cfg( "OpiePlayer" ); | 1251 | Config cfg( "OpiePlayer" ); |
1245 | cfg.setGroup("Options"); | 1252 | cfg.setGroup("Options"); |
1246 | cfg.writeEntry("Skin", skinsMenu->text( item)); | 1253 | cfg.writeEntry("Skin", skinsMenu->text( item)); |
1247 | } | 1254 | } |
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 53837c7..ffda2e4 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -318,129 +318,129 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
318 | if ( videoButtons[i].isHeld ) { | 318 | if ( videoButtons[i].isHeld ) { |
319 | videoButtons[i].isHeld = FALSE; | 319 | videoButtons[i].isHeld = FALSE; |
320 | if ( !videoButtons[i].isToggle ) { | 320 | if ( !videoButtons[i].isToggle ) { |
321 | setToggleButton( i, FALSE ); | 321 | setToggleButton( i, FALSE ); |
322 | } | 322 | } |
323 | 323 | ||
324 | switch(i) { | 324 | switch(i) { |
325 | 325 | ||
326 | case VideoPlay: { | 326 | case VideoPlay: { |
327 | if( mediaPlayerState->isPaused ) { | 327 | if( mediaPlayerState->isPaused ) { |
328 | setToggleButton( i, FALSE ); | 328 | setToggleButton( i, FALSE ); |
329 | mediaPlayerState->setPaused( FALSE ); | 329 | mediaPlayerState->setPaused( FALSE ); |
330 | return; | 330 | return; |
331 | } else if( !mediaPlayerState->isPaused ) { | 331 | } else if( !mediaPlayerState->isPaused ) { |
332 | setToggleButton( i, TRUE ); | 332 | setToggleButton( i, TRUE ); |
333 | mediaPlayerState->setPaused( TRUE ); | 333 | mediaPlayerState->setPaused( TRUE ); |
334 | return; | 334 | return; |
335 | } else { | 335 | } else { |
336 | return; | 336 | return; |
337 | } | 337 | } |
338 | } | 338 | } |
339 | 339 | ||
340 | case VideoStop: mediaPlayerState->setPlaying( FALSE ); return; | 340 | case VideoStop: mediaPlayerState->setPlaying( FALSE ); return; |
341 | case VideoNext: mediaPlayerState->setNext(); return; | 341 | case VideoNext: mediaPlayerState->setNext(); return; |
342 | case VideoPrevious: mediaPlayerState->setPrev(); return; | 342 | case VideoPrevious: mediaPlayerState->setPrev(); return; |
343 | case VideoVolUp: emit moreReleased(); return; | 343 | case VideoVolUp: emit moreReleased(); return; |
344 | case VideoVolDown: emit lessReleased(); return; | 344 | case VideoVolDown: emit lessReleased(); return; |
345 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; | 345 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; |
346 | } | 346 | } |
347 | } | 347 | } |
348 | } | 348 | } |
349 | } | 349 | } |
350 | } | 350 | } |
351 | 351 | ||
352 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { | 352 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { |
353 | mouseMoveEvent( event ); | 353 | mouseMoveEvent( event ); |
354 | } | 354 | } |
355 | 355 | ||
356 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { | 356 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { |
357 | if ( mediaPlayerState->fullscreen() ) { | 357 | if ( mediaPlayerState->fullscreen() ) { |
358 | mediaPlayerState->setFullscreen( FALSE ); | 358 | mediaPlayerState->setFullscreen( FALSE ); |
359 | makeVisible(); | 359 | makeVisible(); |
360 | } | 360 | } |
361 | mouseMoveEvent( event ); | 361 | mouseMoveEvent( event ); |
362 | } | 362 | } |
363 | 363 | ||
364 | void VideoWidget::showEvent( QShowEvent* ) { | 364 | void VideoWidget::showEvent( QShowEvent* ) { |
365 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); | 365 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); |
366 | mouseMoveEvent( &event ); | 366 | mouseMoveEvent( &event ); |
367 | } | 367 | } |
368 | 368 | ||
369 | 369 | ||
370 | void VideoWidget::backToNormal() { | 370 | void VideoWidget::backToNormal() { |
371 | mediaPlayerState->setFullscreen( FALSE ); | 371 | mediaPlayerState->setFullscreen( FALSE ); |
372 | makeVisible(); | 372 | makeVisible(); |
373 | } | 373 | } |
374 | 374 | ||
375 | void VideoWidget::makeVisible() { | 375 | void VideoWidget::makeVisible() { |
376 | if ( mediaPlayerState->fullscreen() ) { | 376 | if ( mediaPlayerState->fullscreen() ) { |
377 | setBackgroundMode( QWidget::NoBackground ); | 377 | setBackgroundMode( QWidget::NoBackground ); |
378 | showFullScreen(); | 378 | showFullScreen(); |
379 | resize( qApp->desktop()->size() ); | 379 | resize( qApp->desktop()->size() ); |
380 | slider->hide(); | 380 | slider->hide(); |
381 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); | 381 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); |
382 | 382 | qApp->processEvents(); | |
383 | } else { | 383 | } else { |
384 | showNormal(); | 384 | showNormal(); |
385 | showMaximized(); | 385 | showMaximized(); |
386 | setBackgroundPixmap( *pixBg ); | 386 | setBackgroundPixmap( *pixBg ); |
387 | if ( mediaPlayerState->streaming() ) { | 387 | if ( mediaPlayerState->streaming() ) { |
388 | slider->hide(); | 388 | slider->hide(); |
389 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 389 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
390 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 390 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
391 | } else { | 391 | } else { |
392 | slider->show(); | 392 | slider->show(); |
393 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 393 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
394 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 394 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
395 | } | 395 | } |
396 | videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); | 396 | videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); |
397 | qApp->processEvents(); | 397 | qApp->processEvents(); |
398 | } | 398 | } |
399 | } | 399 | } |
400 | 400 | ||
401 | 401 | ||
402 | void VideoWidget::paintEvent( QPaintEvent * pe) { | 402 | void VideoWidget::paintEvent( QPaintEvent * pe) { |
403 | QPainter p( this ); | 403 | QPainter p( this ); |
404 | 404 | ||
405 | if ( mediaPlayerState->fullscreen() ) { | 405 | if ( mediaPlayerState->fullscreen() ) { |
406 | // Clear the background | 406 | // Clear the background |
407 | p.setBrush( QBrush( Qt::black ) ); | 407 | p.setBrush( QBrush( Qt::black ) ); |
408 | } else { | 408 | } else { |
409 | if ( !pe->erased() ) { | 409 | if ( !pe->erased() ) { |
410 | // Combine with background and double buffer | 410 | // Combine with background and double buffer |
411 | QPixmap pix( pe->rect().size() ); | 411 | QPixmap pix( pe->rect().size() ); |
412 | QPainter p( &pix ); | 412 | QPainter p( &pix ); |
413 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 413 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
414 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); | 414 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); |
415 | for ( int i = 0; i < numVButtons; i++ ) { | 415 | for ( int i = 0; i < numVButtons; i++ ) { |
416 | paintButton( &p, i ); | 416 | paintButton( &p, i ); |
417 | } | 417 | } |
418 | QPainter p2( this ); | 418 | QPainter p2( this ); |
419 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 419 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
420 | } else { | 420 | } else { |
421 | QPainter p( this ); | 421 | QPainter p( this ); |
422 | for ( int i = 0; i < numVButtons; i++ ) | 422 | for ( int i = 0; i < numVButtons; i++ ) |
423 | paintButton( &p, i ); | 423 | paintButton( &p, i ); |
424 | } | 424 | } |
425 | slider->repaint( TRUE ); | 425 | slider->repaint( TRUE ); |
426 | } | 426 | } |
427 | } | 427 | } |
428 | 428 | ||
429 | 429 | ||
430 | void VideoWidget::closeEvent( QCloseEvent* ) { | 430 | void VideoWidget::closeEvent( QCloseEvent* ) { |
431 | mediaPlayerState->setList(); | 431 | mediaPlayerState->setList(); |
432 | } | 432 | } |
433 | 433 | ||
434 | 434 | ||
435 | 435 | ||
436 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { | 436 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { |
437 | switch ( e->key() ) { | 437 | switch ( e->key() ) { |
438 | ////////////////////////////// Zaurus keys | 438 | ////////////////////////////// Zaurus keys |
439 | case Key_Home: | 439 | case Key_Home: |
440 | break; | 440 | break; |
441 | case Key_F9: //activity | 441 | case Key_F9: //activity |
442 | break; | 442 | break; |
443 | case Key_F10: //contacts | 443 | case Key_F10: //contacts |
444 | // hide(); | 444 | // hide(); |
445 | break; | 445 | break; |
446 | case Key_F11: //menu | 446 | case Key_F11: //menu |