summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-08-19 18:54:10 (UTC)
committer harlekin <harlekin>2002-08-19 18:54:10 (UTC)
commitaaa640a47a707b4d4e6aff37bf78c11bfc903b3c (patch) (unidiff)
tree5aa2412688ce1c81f724e9d70ddf5cdc42e02618
parent719dda9280813d323eebe3d2323271f953ed1144 (diff)
downloadopie-aaa640a47a707b4d4e6aff37bf78c11bfc903b3c.zip
opie-aaa640a47a707b4d4e6aff37bf78c11bfc903b3c.tar.gz
opie-aaa640a47a707b4d4e6aff37bf78c11bfc903b3c.tar.bz2
cleanups
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h1
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp23
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp1
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.cpp1
-rw-r--r--noncore/multimedia/opieplayer2/opieplayer2.pro5
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp24
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp1
7 files changed, 15 insertions, 41 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h
index e7da6c5..626004a 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.h
+++ b/noncore/multimedia/opieplayer2/audiowidget.h
@@ -1,148 +1,147 @@
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#ifndef AUDIO_WIDGET_H 34#ifndef AUDIO_WIDGET_H
35#define AUDIO_WIDGET_H 35#define AUDIO_WIDGET_H
36 36
37#include <qwidget.h> 37#include <qwidget.h>
38#include <qpainter.h> 38#include <qpainter.h>
39#include <qdrawutil.h> 39#include <qdrawutil.h>
40#include <qpixmap.h> 40#include <qpixmap.h>
41#include <qstring.h> 41#include <qstring.h>
42#include <qslider.h> 42#include <qslider.h>
43#include <qframe.h> 43#include <qframe.h>
44#include <qlineedit.h> 44#include <qlineedit.h>
45 45
46 46
47class QPixmap; 47class QPixmap;
48 48
49enum AudioButtons { 49enum AudioButtons {
50 AudioPlay=0, 50 AudioPlay=0,
51 AudioStop, 51 AudioStop,
52 AudioNext, 52 AudioNext,
53 AudioPrevious, 53 AudioPrevious,
54 AudioVolumeUp, 54 AudioVolumeUp,
55 AudioVolumeDown, 55 AudioVolumeDown,
56 AudioLoop, 56 AudioLoop,
57 AudioPlayList, 57 AudioPlayList,
58 AudioForward, 58 AudioForward,
59 AudioBack 59 AudioBack
60}; 60};
61 61
62 62
63class Ticker : public QFrame { 63class Ticker : public QFrame {
64 Q_OBJECT 64 Q_OBJECT
65 65
66public: 66public:
67 Ticker( QWidget* parent=0 ); 67 Ticker( QWidget* parent=0 );
68 ~Ticker(); 68 ~Ticker();
69 void setText( const QString& text ) ; 69 void setText( const QString& text ) ;
70 70
71protected: 71protected:
72 void timerEvent( QTimerEvent * ); 72 void timerEvent( QTimerEvent * );
73 void drawContents( QPainter *p ); 73 void drawContents( QPainter *p );
74private: 74private:
75 QString scrollText; 75 QString scrollText;
76 int pos, pixelLen; 76 int pos, pixelLen;
77}; 77};
78 78
79 79
80class AudioWidget : public QWidget { 80class AudioWidget : public QWidget {
81 Q_OBJECT 81 Q_OBJECT
82public: 82public:
83 AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 ); 83 AudioWidget( QWidget* parent=0, const char* name=0, WFlags f=0 );
84 ~AudioWidget(); 84 ~AudioWidget();
85 void setTickerText( const QString &text ) { songInfo.setText( text ); } 85 void setTickerText( const QString &text ) { songInfo.setText( text ); }
86 bool isStreaming;
87public slots: 86public slots:
88 void updateSlider( long, long ); 87 void updateSlider( long, long );
89 void sliderPressed( ); 88 void sliderPressed( );
90 void sliderReleased( ); 89 void sliderReleased( );
91// void setPaused( bool b) { setToggleButton( AudioPause, b ); } 90// void setPaused( bool b) { setToggleButton( AudioPause, b ); }
92 void setLooping( bool b) { setToggleButton( AudioLoop, b ); } 91 void setLooping( bool b) { setToggleButton( AudioLoop, b ); }
93 void setPlaying( bool b) { setToggleButton( AudioPlay, b ); } 92 void setPlaying( bool b) { setToggleButton( AudioPlay, b ); }
94 void setPosition( long ); 93 void setPosition( long );
95 void setLength( long ); 94 void setLength( long );
96 void setView( char ); 95 void setView( char );
97 96
98signals: 97signals:
99 void moreClicked(); 98 void moreClicked();
100 void lessClicked(); 99 void lessClicked();
101 void moreReleased(); 100 void moreReleased();
102 void lessReleased(); 101 void lessReleased();
103 void forwardClicked(); 102 void forwardClicked();
104 void backClicked(); 103 void backClicked();
105 void forwardReleased(); 104 void forwardReleased();
106 void backReleased(); 105 void backReleased();
107 void sliderMoved(long); 106 void sliderMoved(long);
108 107
109protected: 108protected:
110 void doBlank(); 109 void doBlank();
111 void doUnblank(); 110 void doUnblank();
112 void paintEvent( QPaintEvent *pe ); 111 void paintEvent( QPaintEvent *pe );
113 void showEvent( QShowEvent *se ); 112 void showEvent( QShowEvent *se );
114 void resizeEvent( QResizeEvent *re ); 113 void resizeEvent( QResizeEvent *re );
115 void mouseMoveEvent( QMouseEvent *event ); 114 void mouseMoveEvent( QMouseEvent *event );
116 void mousePressEvent( QMouseEvent *event ); 115 void mousePressEvent( QMouseEvent *event );
117 void mouseReleaseEvent( QMouseEvent *event ); 116 void mouseReleaseEvent( QMouseEvent *event );
118 void timerEvent( QTimerEvent *event ); 117 void timerEvent( QTimerEvent *event );
119 void closeEvent( QCloseEvent *event ); 118 void closeEvent( QCloseEvent *event );
120 void keyReleaseEvent( QKeyEvent *e); 119 void keyReleaseEvent( QKeyEvent *e);
121private slots: 120private slots:
122 void skipFor(); 121 void skipFor();
123 void skipBack(); 122 void skipBack();
124 void stopSkip(); 123 void stopSkip();
125private: 124private:
126 void toggleButton( int ); 125 void toggleButton( int );
127 void setToggleButton( int, bool ); 126 void setToggleButton( int, bool );
128 void paintButton( QPainter *p, int i ); 127 void paintButton( QPainter *p, int i );
129 int skipDirection; 128 int skipDirection;
130 QString skin; 129 QString skin;
131 QPixmap *pixBg; 130 QPixmap *pixBg;
132 QImage *imgUp; 131 QImage *imgUp;
133 QImage *imgDn; 132 QImage *imgDn;
134 QImage *imgButtonMask; 133 QImage *imgButtonMask;
135 QBitmap *masks[10]; 134 QBitmap *masks[10];
136 QPixmap *buttonPixUp[10]; 135 QPixmap *buttonPixUp[10];
137 QPixmap *buttonPixDown[10]; 136 QPixmap *buttonPixDown[10];
138 137
139 QPixmap *pixmaps[4]; 138 QPixmap *pixmaps[4];
140 Ticker songInfo; 139 Ticker songInfo;
141 QSlider slider; 140 QSlider slider;
142 QLineEdit time; 141 QLineEdit time;
143 int xoff, yoff; 142 int xoff, yoff;
144}; 143};
145 144
146 145
147#endif // AUDIO_WIDGET_H 146#endif // AUDIO_WIDGET_H
148 147
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index 3a82a50..c187f52 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -1,249 +1,226 @@
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
49typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, 49typedef 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
52extern "C" { 52extern "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
66using namespace XINE; 66using namespace XINE;
67 67
68Lib::Lib(XineVideoWidget* widget) { 68Lib::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 if (m_audioOutput == NULL )
91 printf("Failure\n");
92 else
93 printf("Success\n");
94
95
96 // test code
97/* m_videoOutput = xine_load_video_output_plugin(m_config, "fb",
98 VISUAL_TYPE_FB,
99 0 );
100*/
101
102 char** files = xine_list_video_output_plugins(3);
103 char* out;
104 int i = 0;
105 while ( ( out = files[i] ) != 0 ) {
106 printf("Video %s\n", out );
107 i++;
108 }
109// m_xine = xine_init( m_videoOutput,
110// m_audioOutput,
111// m_config );
112 // test loading
113 m_videoOutput = ::init_video_out_plugin( m_config, NULL ); 90 m_videoOutput = ::init_video_out_plugin( m_config, NULL );
114 if (m_wid != 0 ) { 91 if (m_wid != 0 ) {
115 printf("!0\n" ); 92 printf("!0\n" );
116 resize ( m_wid-> size ( )); 93 resize ( m_wid-> size ( ));
117 ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() ); 94 ::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() );
118 m_wid-> setImage ( new QImage ( Resource::loadImage(""))); 95 m_wid-> setImage ( new QImage ( Resource::loadImage("")));
119 m_wid->repaint(); 96 m_wid->repaint();
120 } 97 }
121 null_display_handler( m_videoOutput, 98 null_display_handler( m_videoOutput,
122 xine_display_frame, 99 xine_display_frame,
123 this ); 100 this );
124 101
125 m_xine = xine_init( m_videoOutput, 102 m_xine = xine_init( m_videoOutput,
126 m_audioOutput, m_config ); 103 m_audioOutput, m_config );
127 // install the event handler 104 // install the event handler
128 xine_register_event_listener( m_xine, xine_event_handler, this ); 105 xine_register_event_listener( m_xine, xine_event_handler, this );
129} 106}
130 107
131Lib::~Lib() { 108Lib::~Lib() {
132 delete m_config; 109 delete m_config;
133 xine_remove_event_listener( m_xine, xine_event_handler ); 110 xine_remove_event_listener( m_xine, xine_event_handler );
134 xine_exit( m_xine ); 111 xine_exit( m_xine );
135 delete m_videoOutput; 112 delete m_videoOutput;
136 //delete m_audioOutput; 113 //delete m_audioOutput;
137 114
138} 115}
139 116
140void Lib::resize ( const QSize &s ) 117void Lib::resize ( const QSize &s )
141{ 118{
142 if ( s. width ( ) && s. height ( )) { 119 if ( s. width ( ) && s. height ( )) {
143 ::null_set_gui_width( m_videoOutput, s. width() ); 120 ::null_set_gui_width( m_videoOutput, s. width() );
144 ::null_set_gui_height(m_videoOutput, s. height() ); 121 ::null_set_gui_height(m_videoOutput, s. height() );
145 } 122 }
146} 123}
147 124
148QCString Lib::version() { 125QCString Lib::version() {
149 QCString str( xine_get_str_version() ); 126 QCString str( xine_get_str_version() );
150 return str; 127 return str;
151}; 128};
152 129
153int Lib::majorVersion() { 130int Lib::majorVersion() {
154 return xine_get_major_version(); 131 return xine_get_major_version();
155} 132}
156int Lib::minorVersion() { 133int Lib::minorVersion() {
157 return xine_get_minor_version(); 134 return xine_get_minor_version();
158}; 135};
159 136
160int Lib::subVersion() { 137int Lib::subVersion() {
161 return xine_get_sub_version(); 138 return xine_get_sub_version();
162} 139}
163int Lib::play( const QString& fileName, 140int Lib::play( const QString& fileName,
164 int startPos, 141 int startPos,
165 int start_time ) { 142 int start_time ) {
166 QString str = fileName.stripWhiteSpace(); 143 QString str = fileName.stripWhiteSpace();
167 //workaround OpiePlayer bug 144 //workaround OpiePlayer bug
168 //f (str.right(1) == QString::fromLatin1("/") ) 145 //f (str.right(1) == QString::fromLatin1("/") )
169 // str = str.mid( str.length() -1 ); 146 // str = str.mid( str.length() -1 );
170 return xine_play( m_xine, QFile::encodeName(str.utf8() ).data(), 147 return xine_play( m_xine, QFile::encodeName(str.utf8() ).data(),
171 startPos, start_time); 148 startPos, start_time);
172} 149}
173void Lib::stop() { 150void Lib::stop() {
174 qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>"); 151 qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>");
175 xine_stop(m_xine ); 152 xine_stop(m_xine );
176} 153}
177void Lib::pause(){ 154void Lib::pause(){
178 xine_set_speed( m_xine, SPEED_PAUSE ); 155 xine_set_speed( m_xine, SPEED_PAUSE );
179} 156}
180int Lib::speed() { 157int Lib::speed() {
181 return xine_get_speed( m_xine ); 158 return xine_get_speed( m_xine );
182} 159}
183void Lib::setSpeed( int speed ) { 160void Lib::setSpeed( int speed ) {
184 xine_set_speed( m_xine, speed ); 161 xine_set_speed( m_xine, speed );
185} 162}
186int Lib::status(){ 163int Lib::status(){
187 return xine_get_status( m_xine ); 164 return xine_get_status( m_xine );
188} 165}
189int Lib::currentPosition(){ 166int Lib::currentPosition(){
190 return xine_get_current_position( m_xine ); 167 return xine_get_current_position( m_xine );
191} 168}
192int Lib::currentTime() { 169int Lib::currentTime() {
193 return xine_get_current_time( m_xine ); 170 return xine_get_current_time( m_xine );
194}; 171};
195int Lib::length() { 172int Lib::length() {
196 return xine_get_stream_length( m_xine ); 173 return xine_get_stream_length( m_xine );
197} 174}
198bool Lib::isSeekable() { 175bool Lib::isSeekable() {
199 return xine_is_stream_seekable(m_xine); 176 return xine_is_stream_seekable(m_xine);
200} 177}
201Frame Lib::currentFrame() { 178Frame Lib::currentFrame() {
202 Frame frame; 179 Frame frame;
203 return frame; 180 return frame;
204}; 181};
205int Lib::error() { 182int Lib::error() {
206 return xine_get_error( m_xine ); 183 return xine_get_error( m_xine );
207}; 184};
208void Lib::handleXineEvent( xine_event_t* t ) { 185void Lib::handleXineEvent( xine_event_t* t ) {
209 if ( t->type == XINE_EVENT_PLAYBACK_FINISHED ) 186 if ( t->type == XINE_EVENT_PLAYBACK_FINISHED )
210 emit stopped(); 187 emit stopped();
211} 188}
212void Lib::setShowVideo( bool video ) { 189void Lib::setShowVideo( bool video ) {
213 m_video = video; 190 m_video = video;
214 ::null_set_show_video( m_videoOutput, video ); 191 ::null_set_show_video( m_videoOutput, video );
215} 192}
216bool Lib::isShowingVideo() { 193bool Lib::isShowingVideo() {
217 return ::null_is_showing_video( m_videoOutput ); 194 return ::null_is_showing_video( m_videoOutput );
218} 195}
219void Lib::showVideoFullScreen( bool fullScreen ) { 196void Lib::showVideoFullScreen( bool fullScreen ) {
220 ::null_set_fullscreen( m_videoOutput, fullScreen ); 197 ::null_set_fullscreen( m_videoOutput, fullScreen );
221} 198}
222bool Lib::isVideoFullScreen() { 199bool Lib::isVideoFullScreen() {
223 return ::null_is_fullscreen( m_videoOutput ); 200 return ::null_is_fullscreen( m_videoOutput );
224} 201}
225void Lib::setScaling( bool scale ) { 202void Lib::setScaling( bool scale ) {
226 ::null_set_scaling( m_videoOutput, scale ); 203 ::null_set_scaling( m_videoOutput, scale );
227} 204}
228bool Lib::isScaling() { 205bool Lib::isScaling() {
229 return ::null_is_scaling( m_videoOutput ); 206 return ::null_is_scaling( m_videoOutput );
230} 207}
231void Lib::xine_event_handler( void* user_data, xine_event_t* t ) { 208void Lib::xine_event_handler( void* user_data, xine_event_t* t ) {
232 ((Lib*)user_data)->handleXineEvent( t ); 209 ((Lib*)user_data)->handleXineEvent( t );
233} 210}
234void Lib::xine_display_frame( void* user_data, uint8_t *frame, 211void Lib::xine_display_frame( void* user_data, uint8_t *frame,
235 int width, int height, int bytes ) { 212 int width, int height, int bytes ) {
236 213
237 ((Lib*)user_data)->drawFrame( frame, width, height, bytes ); 214 ((Lib*)user_data)->drawFrame( frame, width, height, bytes );
238} 215}
239void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) { 216void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) {
240 if (!m_video ) { 217 if (!m_video ) {
241 qWarning("not showing video now"); 218 qWarning("not showing video now");
242 return; 219 return;
243 } 220 }
244// qWarning("called draw frame %d %d", width, height); 221// qWarning("called draw frame %d %d", width, height);
245 222
246 m_wid->setImage( frame, width, height, bytes ); 223 m_wid->setImage( frame, width, height, bytes );
247// m_wid->repaint(false); 224// m_wid->repaint(false);
248 225
249} 226}
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index 5531e81..18caaad 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -1,296 +1,295 @@
1#include <qpe/qpeapplication.h> 1#include <qpe/qpeapplication.h>
2#include <qpe/qlibrary.h> 2#include <qpe/qlibrary.h>
3#include <qpe/resource.h> 3#include <qpe/resource.h>
4#include <qpe/config.h> 4#include <qpe/config.h>
5#include <qpe/qcopenvelope_qws.h> 5#include <qpe/qcopenvelope_qws.h>
6 6
7#include <qmainwindow.h> 7#include <qmainwindow.h>
8#include <qmessagebox.h> 8#include <qmessagebox.h>
9#include <qwidgetstack.h> 9#include <qwidgetstack.h>
10#include <qfile.h> 10#include <qfile.h>
11 11
12#include "mediaplayer.h" 12#include "mediaplayer.h"
13#include "playlistwidget.h" 13#include "playlistwidget.h"
14#include "audiowidget.h" 14#include "audiowidget.h"
15#include "videowidget.h" 15#include "videowidget.h"
16#include "volumecontrol.h" 16#include "volumecontrol.h"
17 17
18#include "mediaplayerstate.h" 18#include "mediaplayerstate.h"
19 19
20// for setBacklight() 20// for setBacklight()
21#include <linux/fb.h> 21#include <linux/fb.h>
22#include <sys/file.h> 22#include <sys/file.h>
23#include <sys/ioctl.h> 23#include <sys/ioctl.h>
24 24
25 25
26extern AudioWidget *audioUI; 26extern AudioWidget *audioUI;
27extern VideoWidget *videoUI; 27extern VideoWidget *videoUI;
28extern PlayListWidget *playList; 28extern PlayListWidget *playList;
29extern MediaPlayerState *mediaPlayerState; 29extern MediaPlayerState *mediaPlayerState;
30 30
31 31
32#define FBIOBLANK 0x4611 32#define FBIOBLANK 0x4611
33 33
34MediaPlayer::MediaPlayer( QObject *parent, const char *name ) 34MediaPlayer::MediaPlayer( QObject *parent, const char *name )
35 : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { 35 : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) {
36 36
37 qApp->processEvents(); 37 qApp->processEvents();
38 // QPEApplication::grabKeyboard(); // EVIL 38 // QPEApplication::grabKeyboard(); // EVIL
39 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 39 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
40 40
41 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); 41 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) );
42 42
43 connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); 43 connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) );
44 44
45 connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); 45 connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) );
46 connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); 46 connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) );
47 connect( mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); 47 connect( mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) );
48 48
49 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 49 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
50 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 50 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
51 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 51 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
52 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 52 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
53 53
54 connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); 54 connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
55 connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); 55 connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
56 connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); 56 connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
57 connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); 57 connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
58 58
59 volControl = new VolumeControl; 59 volControl = new VolumeControl;
60 xineControl = new XineControl(); 60 xineControl = new XineControl();
61} 61}
62 62
63MediaPlayer::~MediaPlayer() { 63MediaPlayer::~MediaPlayer() {
64 delete xineControl; 64 delete xineControl;
65 delete volControl; 65 delete volControl;
66} 66}
67 67
68void MediaPlayer::pauseCheck( bool b ) { 68void MediaPlayer::pauseCheck( bool b ) {
69 if ( b && !mediaPlayerState->playing() ) { 69 if ( b && !mediaPlayerState->playing() ) {
70 mediaPlayerState->setPaused( FALSE ); 70 mediaPlayerState->setPaused( FALSE );
71 } 71 }
72} 72}
73 73
74void MediaPlayer::play() { 74void MediaPlayer::play() {
75 mediaPlayerState->setPlaying( FALSE ); 75 mediaPlayerState->setPlaying( FALSE );
76 mediaPlayerState->setPlaying( TRUE ); 76 mediaPlayerState->setPlaying( TRUE );
77} 77}
78 78
79void MediaPlayer::setPlaying( bool play ) { 79void MediaPlayer::setPlaying( bool play ) {
80 if ( !play ) { 80 if ( !play ) {
81 return; 81 return;
82 } 82 }
83 83
84 if ( mediaPlayerState->paused() ) { 84 if ( mediaPlayerState->paused() ) {
85 mediaPlayerState->setPaused( FALSE ); 85 mediaPlayerState->setPaused( FALSE );
86 return; 86 return;
87 } 87 }
88 88
89 const DocLnk *playListCurrent = playList->current(); 89 const DocLnk *playListCurrent = playList->current();
90 if ( playListCurrent != NULL ) { 90 if ( playListCurrent != NULL ) {
91 currentFile = playListCurrent; 91 currentFile = playListCurrent;
92 } 92 }
93 93
94 xineControl->play( currentFile->file() ); 94 xineControl->play( currentFile->file() );
95 95
96 xineControl->length();
97 long seconds = mediaPlayerState->length();// 96 long seconds = mediaPlayerState->length();//
98 QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); 97 QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
99 qDebug(time); 98 qDebug(time);
100 99
101 QString tickerText; 100 QString tickerText;
102 if( currentFile->file().left(4) == "http" ) 101 if( currentFile->file().left(4) == "http" )
103 tickerText= tr( " File: " ) + currentFile->name(); 102 tickerText= tr( " File: " ) + currentFile->name();
104 else 103 else
105 tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time; 104 tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time;
106 105
107 audioUI->setTickerText( currentFile->file( ) ); 106 audioUI->setTickerText( currentFile->file( ) );
108 107
109} 108}
110 109
111 110
112void MediaPlayer::prev() { 111void MediaPlayer::prev() {
113 if ( playList->prev() ) { 112 if ( playList->prev() ) {
114 play(); 113 play();
115 } else if ( mediaPlayerState->looping() ) { 114 } else if ( mediaPlayerState->looping() ) {
116 if ( playList->last() ) { 115 if ( playList->last() ) {
117 play(); 116 play();
118 } 117 }
119 } else { 118 } else {
120 mediaPlayerState->setList(); 119 mediaPlayerState->setList();
121 } 120 }
122} 121}
123 122
124 123
125void MediaPlayer::next() { 124void MediaPlayer::next() {
126 if ( playList->next() ) { 125 if ( playList->next() ) {
127 play(); 126 play();
128 } else if ( mediaPlayerState->looping() ) { 127 } else if ( mediaPlayerState->looping() ) {
129 if ( playList->first() ) { 128 if ( playList->first() ) {
130 play(); 129 play();
131 } 130 }
132 } else { 131 } else {
133 mediaPlayerState->setList(); 132 mediaPlayerState->setList();
134 } 133 }
135} 134}
136 135
137 136
138void MediaPlayer::startDecreasingVolume() { 137void MediaPlayer::startDecreasingVolume() {
139 volumeDirection = -1; 138 volumeDirection = -1;
140 startTimer( 100 ); 139 startTimer( 100 );
141 volControl->decVol(2); 140 volControl->decVol(2);
142} 141}
143 142
144 143
145void MediaPlayer::startIncreasingVolume() { 144void MediaPlayer::startIncreasingVolume() {
146 volumeDirection = +1; 145 volumeDirection = +1;
147 startTimer( 100 ); 146 startTimer( 100 );
148 volControl->incVol(2); 147 volControl->incVol(2);
149} 148}
150 149
151 150
152bool drawnOnScreenDisplay = FALSE; 151bool drawnOnScreenDisplay = FALSE;
153unsigned int onScreenDisplayVolume = 0; 152unsigned int onScreenDisplayVolume = 0;
154const int yoff = 110; 153const int yoff = 110;
155 154
156void MediaPlayer::stopChangingVolume() { 155void MediaPlayer::stopChangingVolume() {
157 killTimers(); 156 killTimers();
158 // Get rid of the on-screen display stuff 157 // Get rid of the on-screen display stuff
159 drawnOnScreenDisplay = FALSE; 158 drawnOnScreenDisplay = FALSE;
160 onScreenDisplayVolume = 0; 159 onScreenDisplayVolume = 0;
161 int w=0; 160 int w=0;
162 int h=0; 161 int h=0;
163 if( !xineControl->hasVideo()) { 162 if( !xineControl->hasVideo()) {
164 w = audioUI->width(); 163 w = audioUI->width();
165 h = audioUI->height(); 164 h = audioUI->height();
166 audioUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); 165 audioUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE );
167 } else { 166 } else {
168 w = videoUI->width(); 167 w = videoUI->width();
169 h = videoUI->height(); 168 h = videoUI->height();
170 videoUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); 169 videoUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE );
171 } 170 }
172} 171}
173 172
174 173
175void MediaPlayer::timerEvent( QTimerEvent * ) { 174void MediaPlayer::timerEvent( QTimerEvent * ) {
176 if ( volumeDirection == +1 ) { 175 if ( volumeDirection == +1 ) {
177 volControl->incVol(2); 176 volControl->incVol(2);
178 } else if ( volumeDirection == -1 ) { 177 } else if ( volumeDirection == -1 ) {
179 volControl->decVol(2); 178 volControl->decVol(2);
180 } 179 }
181 180
182 181
183 // TODO FIXME 182 // TODO FIXME
184 unsigned int v; 183 unsigned int v;
185 v = volControl->getVolume(); 184 v = volControl->getVolume();
186 v = v / 10; 185 v = v / 10;
187 186
188 if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { 187 if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) {
189 return; 188 return;
190 } 189 }
191 190
192 int w=0; int h=0; 191 int w=0; int h=0;
193 if( !xineControl->hasVideo()) { 192 if( !xineControl->hasVideo()) {
194 w = audioUI->width(); 193 w = audioUI->width();
195 h = audioUI->height(); 194 h = audioUI->height();
196 195
197 if ( drawnOnScreenDisplay ) { 196 if ( drawnOnScreenDisplay ) {
198 if ( onScreenDisplayVolume > v ) { 197 if ( onScreenDisplayVolume > v ) {
199 audioUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); 198 audioUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE );
200 } 199 }
201 } 200 }
202 drawnOnScreenDisplay = TRUE; 201 drawnOnScreenDisplay = TRUE;
203 onScreenDisplayVolume = v; 202 onScreenDisplayVolume = v;
204 QPainter p( audioUI ); 203 QPainter p( audioUI );
205 p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); 204 p.setPen( QColor( 0x10, 0xD0, 0x10 ) );
206 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); 205 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) );
207 206
208 QFont f; 207 QFont f;
209 f.setPixelSize( 20 ); 208 f.setPixelSize( 20 );
210 f.setBold( TRUE ); 209 f.setBold( TRUE );
211 p.setFont( f ); 210 p.setFont( f );
212 p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); 211 p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") );
213 212
214 for ( unsigned int i = 0; i < 10; i++ ) { 213 for ( unsigned int i = 0; i < 10; i++ ) {
215 if ( v > i ) { 214 if ( v > i ) {
216 p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); 215 p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 );
217 } else { 216 } else {
218 p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); 217 p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 );
219 } 218 }
220 } 219 }
221 } else { 220 } else {
222 w = videoUI->width(); 221 w = videoUI->width();
223 h = videoUI->height(); 222 h = videoUI->height();
224 223
225 if ( drawnOnScreenDisplay ) { 224 if ( drawnOnScreenDisplay ) {
226 if ( onScreenDisplayVolume > v ) { 225 if ( onScreenDisplayVolume > v ) {
227 videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); 226 videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE );
228 } 227 }
229 } 228 }
230 drawnOnScreenDisplay = TRUE; 229 drawnOnScreenDisplay = TRUE;
231 onScreenDisplayVolume = v; 230 onScreenDisplayVolume = v;
232 QPainter p( videoUI ); 231 QPainter p( videoUI );
233 p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); 232 p.setPen( QColor( 0x10, 0xD0, 0x10 ) );
234 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); 233 p.setBrush( QColor( 0x10, 0xD0, 0x10 ) );
235 234
236 QFont f; 235 QFont f;
237 f.setPixelSize( 20 ); 236 f.setPixelSize( 20 );
238 f.setBold( TRUE ); 237 f.setBold( TRUE );
239 p.setFont( f ); 238 p.setFont( f );
240 p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); 239 p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") );
241 240
242 for ( unsigned int i = 0; i < 10; i++ ) { 241 for ( unsigned int i = 0; i < 10; i++ ) {
243 if ( v > i ) { 242 if ( v > i ) {
244 p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); 243 p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 );
245 } else { 244 } else {
246 p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); 245 p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 );
247 } 246 }
248 } 247 }
249 } 248 }
250} 249}
251 250
252 251
253void MediaPlayer::blank( bool b ) { 252void MediaPlayer::blank( bool b ) {
254 fd=open("/dev/fb0",O_RDWR); 253 fd=open("/dev/fb0",O_RDWR);
255 if (fd != -1) { 254 if (fd != -1) {
256 if ( b ) { 255 if ( b ) {
257 qDebug("do blanking"); 256 qDebug("do blanking");
258 ioctl( fd, FBIOBLANK, 3 ); 257 ioctl( fd, FBIOBLANK, 3 );
259 isBlanked = TRUE; 258 isBlanked = TRUE;
260 } else { 259 } else {
261 qDebug("do unblanking"); 260 qDebug("do unblanking");
262 ioctl( fd, FBIOBLANK, 0); 261 ioctl( fd, FBIOBLANK, 0);
263 isBlanked = FALSE; 262 isBlanked = FALSE;
264 } 263 }
265 close( fd ); 264 close( fd );
266 } else { 265 } else {
267 qDebug("<< /dev/fb0 could not be opend >>"); 266 qDebug("<< /dev/fb0 could not be opend >>");
268 } 267 }
269} 268}
270 269
271void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { 270void MediaPlayer::keyReleaseEvent( QKeyEvent *e) {
272 switch ( e->key() ) { 271 switch ( e->key() ) {
273////////////////////////////// Zaurus keys 272////////////////////////////// Zaurus keys
274 case Key_Home: 273 case Key_Home:
275 break; 274 break;
276 case Key_F9: //activity 275 case Key_F9: //activity
277 break; 276 break;
278 case Key_F10: //contacts 277 case Key_F10: //contacts
279 break; 278 break;
280 case Key_F11: //menu 279 case Key_F11: //menu
281 break; 280 break;
282 case Key_F12: //home 281 case Key_F12: //home
283 qDebug("Blank here"); 282 qDebug("Blank here");
284// mediaPlayerState->toggleBlank(); 283// mediaPlayerState->toggleBlank();
285 break; 284 break;
286 case Key_F13: //mail 285 case Key_F13: //mail
287 qDebug("Blank here"); 286 qDebug("Blank here");
288 // mediaPlayerState->toggleBlank(); 287 // mediaPlayerState->toggleBlank();
289 break; 288 break;
290 } 289 }
291} 290}
292 291
293void MediaPlayer::cleanUp() { 292void MediaPlayer::cleanUp() {
294// QPEApplication::grabKeyboard(); 293// QPEApplication::grabKeyboard();
295// QPEApplication::ungrabKeyboard(); 294// QPEApplication::ungrabKeyboard();
296} 295}
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
index 6833e07..8366ab4 100644
--- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
@@ -1,281 +1,282 @@
1#include <qpe/qpeapplication.h> 1#include <qpe/qpeapplication.h>
2#include <qpe/qlibrary.h> 2#include <qpe/qlibrary.h>
3#include <qpe/config.h> 3#include <qpe/config.h>
4#include <qvaluelist.h> 4#include <qvaluelist.h>
5#include <qobject.h> 5#include <qobject.h>
6#include <qdir.h> 6#include <qdir.h>
7#include "mediaplayerstate.h" 7#include "mediaplayerstate.h"
8 8
9 9
10 10
11//#define MediaPlayerDebug(x) qDebug x 11//#define MediaPlayerDebug(x) qDebug x
12#define MediaPlayerDebug(x) 12#define MediaPlayerDebug(x)
13 13
14 14
15MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) 15MediaPlayerState::MediaPlayerState( QObject *parent, const char *name )
16 : QObject( parent, name ) { 16 : QObject( parent, name ) {
17 Config cfg( "OpiePlayer" ); 17 Config cfg( "OpiePlayer" );
18 readConfig( cfg ); 18 readConfig( cfg );
19 19
20} 20}
21 21
22 22
23MediaPlayerState::~MediaPlayerState() { 23MediaPlayerState::~MediaPlayerState() {
24 Config cfg( "OpiePlayer" ); 24 Config cfg( "OpiePlayer" );
25 writeConfig( cfg ); 25 writeConfig( cfg );
26 26
27} 27}
28 28
29 29
30void MediaPlayerState::readConfig( Config& cfg ) { 30void MediaPlayerState::readConfig( Config& cfg ) {
31 cfg.setGroup("Options"); 31 cfg.setGroup("Options");
32 isFullscreen = cfg.readBoolEntry( "FullScreen" ); 32 isFullscreen = cfg.readBoolEntry( "FullScreen" );
33 isScaled = cfg.readBoolEntry( "Scaling" ); 33 isScaled = cfg.readBoolEntry( "Scaling" );
34 isLooping = cfg.readBoolEntry( "Looping" ); 34 isLooping = cfg.readBoolEntry( "Looping" );
35 isShuffled = cfg.readBoolEntry( "Shuffle" ); 35 isShuffled = cfg.readBoolEntry( "Shuffle" );
36 usePlaylist = cfg.readBoolEntry( "UsePlayList" ); 36 usePlaylist = cfg.readBoolEntry( "UsePlayList" );
37 usePlaylist = TRUE; 37 usePlaylist = TRUE;
38 isPlaying = FALSE; 38 isPlaying = FALSE;
39 isStreaming = FALSE;
39 isPaused = FALSE; 40 isPaused = FALSE;
40 curPosition = 0; 41 curPosition = 0;
41 curLength = 0; 42 curLength = 0;
42 curView = 'l'; 43 curView = 'l';
43} 44}
44 45
45 46
46void MediaPlayerState::writeConfig( Config& cfg ) const { 47void MediaPlayerState::writeConfig( Config& cfg ) const {
47 cfg.setGroup("Options"); 48 cfg.setGroup("Options");
48 cfg.writeEntry("FullScreen", isFullscreen ); 49 cfg.writeEntry("FullScreen", isFullscreen );
49 cfg.writeEntry("Scaling", isScaled ); 50 cfg.writeEntry("Scaling", isScaled );
50 cfg.writeEntry("Looping", isLooping ); 51 cfg.writeEntry("Looping", isLooping );
51 cfg.writeEntry("Shuffle", isShuffled ); 52 cfg.writeEntry("Shuffle", isShuffled );
52 cfg.writeEntry("UsePlayList", usePlaylist ); 53 cfg.writeEntry("UsePlayList", usePlaylist );
53} 54}
54 55
55 56
56// public stuff 57// public stuff
57 58
58 59
59bool MediaPlayerState::streaming() { 60bool MediaPlayerState::streaming() {
60 return isStreaming; 61 return isStreaming;
61} 62}
62 63
63bool MediaPlayerState::fullscreen() { 64bool MediaPlayerState::fullscreen() {
64 return isFullscreen; 65 return isFullscreen;
65} 66}
66 67
67bool MediaPlayerState::scaled() { 68bool MediaPlayerState::scaled() {
68 return isScaled; 69 return isScaled;
69} 70}
70 71
71bool MediaPlayerState::looping() { 72bool MediaPlayerState::looping() {
72 return isLooping; 73 return isLooping;
73} 74}
74 75
75bool MediaPlayerState::shuffled() { 76bool MediaPlayerState::shuffled() {
76 return isShuffled; 77 return isShuffled;
77} 78}
78 79
79 80
80bool MediaPlayerState:: playlist() { 81bool MediaPlayerState:: playlist() {
81 return usePlaylist; 82 return usePlaylist;
82} 83}
83 84
84bool MediaPlayerState::paused() { 85bool MediaPlayerState::paused() {
85 return isPaused; 86 return isPaused;
86} 87}
87 88
88bool MediaPlayerState::playing() { 89bool MediaPlayerState::playing() {
89 return isPlaying; 90 return isPlaying;
90} 91}
91 92
92bool MediaPlayerState::stop() { 93bool MediaPlayerState::stop() {
93 return isStoped; 94 return isStoped;
94} 95}
95 96
96long MediaPlayerState::position() { 97long MediaPlayerState::position() {
97 return curPosition; 98 return curPosition;
98} 99}
99 100
100long MediaPlayerState::length() { 101long MediaPlayerState::length() {
101 return curLength; 102 return curLength;
102} 103}
103 104
104char MediaPlayerState::view() { 105char MediaPlayerState::view() {
105 return curView; 106 return curView;
106} 107}
107 108
108// slots 109// slots
109void MediaPlayerState::setIsStreaming( bool b ) { 110void MediaPlayerState::setIsStreaming( bool b ) {
110 111
111 if ( isStreaming == b ) { 112 if ( isStreaming == b ) {
112 return; 113 return;
113 } 114 }
114 isStreaming = b; 115 isStreaming = b;
115} 116}
116 117
117 118
118void MediaPlayerState::setFullscreen( bool b ) { 119void MediaPlayerState::setFullscreen( bool b ) {
119 if ( isFullscreen == b ) { 120 if ( isFullscreen == b ) {
120 return; 121 return;
121 } 122 }
122 isFullscreen = b; 123 isFullscreen = b;
123 emit fullscreenToggled(b); 124 emit fullscreenToggled(b);
124} 125}
125 126
126 127
127void MediaPlayerState::setBlanked( bool b ) { 128void MediaPlayerState::setBlanked( bool b ) {
128 if ( isBlanked == b ) { 129 if ( isBlanked == b ) {
129 return; 130 return;
130 } 131 }
131 isBlanked = b; 132 isBlanked = b;
132 emit blankToggled(b); 133 emit blankToggled(b);
133} 134}
134 135
135 136
136void MediaPlayerState::setScaled( bool b ) { 137void MediaPlayerState::setScaled( bool b ) {
137 if ( isScaled == b ) { 138 if ( isScaled == b ) {
138 return; 139 return;
139 } 140 }
140 isScaled = b; 141 isScaled = b;
141 emit scaledToggled(b); 142 emit scaledToggled(b);
142} 143}
143 144
144void MediaPlayerState::setLooping( bool b ) { 145void MediaPlayerState::setLooping( bool b ) {
145 if ( isLooping == b ) { 146 if ( isLooping == b ) {
146 return; 147 return;
147 } 148 }
148 isLooping = b; 149 isLooping = b;
149 emit loopingToggled(b); 150 emit loopingToggled(b);
150} 151}
151 152
152void MediaPlayerState::setShuffled( bool b ) { 153void MediaPlayerState::setShuffled( bool b ) {
153 if ( isShuffled == b ) { 154 if ( isShuffled == b ) {
154 return; 155 return;
155 } 156 }
156 isShuffled = b; 157 isShuffled = b;
157 emit shuffledToggled(b); 158 emit shuffledToggled(b);
158} 159}
159 160
160void MediaPlayerState::setPlaylist( bool b ) { 161void MediaPlayerState::setPlaylist( bool b ) {
161 if ( usePlaylist == b ) { 162 if ( usePlaylist == b ) {
162 return; 163 return;
163 } 164 }
164 usePlaylist = b; 165 usePlaylist = b;
165 emit playlistToggled(b); 166 emit playlistToggled(b);
166} 167}
167 168
168void MediaPlayerState::setPaused( bool b ) { 169void MediaPlayerState::setPaused( bool b ) {
169 if ( isPaused == b ) { 170 if ( isPaused == b ) {
170 isPaused = FALSE; 171 isPaused = FALSE;
171 emit pausedToggled(FALSE); 172 emit pausedToggled(FALSE);
172 return; 173 return;
173 } 174 }
174 isPaused = b; 175 isPaused = b;
175 emit pausedToggled(b); 176 emit pausedToggled(b);
176} 177}
177 178
178void MediaPlayerState::setPlaying( bool b ) { 179void MediaPlayerState::setPlaying( bool b ) {
179 if ( isPlaying == b ) { 180 if ( isPlaying == b ) {
180 return; 181 return;
181 } 182 }
182 isPlaying = b; 183 isPlaying = b;
183 isStoped = !b; 184 isStoped = !b;
184 emit playingToggled(b); 185 emit playingToggled(b);
185} 186}
186 187
187void MediaPlayerState::setStop( bool b ) { 188void MediaPlayerState::setStop( bool b ) {
188 if ( isStoped == b ) { 189 if ( isStoped == b ) {
189 return; 190 return;
190 } 191 }
191 isStoped = b; 192 isStoped = b;
192 emit stopToggled(b); 193 emit stopToggled(b);
193} 194}
194 195
195void MediaPlayerState::setPosition( long p ) { 196void MediaPlayerState::setPosition( long p ) {
196 if ( curPosition == p ) { 197 if ( curPosition == p ) {
197 return; 198 return;
198 } 199 }
199 curPosition = p; 200 curPosition = p;
200 emit positionChanged(p); 201 emit positionChanged(p);
201} 202}
202 203
203void MediaPlayerState::updatePosition( long p ){ 204void MediaPlayerState::updatePosition( long p ){
204 if ( curPosition == p ) { 205 if ( curPosition == p ) {
205 return; 206 return;
206 } 207 }
207 curPosition = p; 208 curPosition = p;
208 emit positionUpdated(p); 209 emit positionUpdated(p);
209} 210}
210 211
211void MediaPlayerState::setLength( long l ) { 212void MediaPlayerState::setLength( long l ) {
212 if ( curLength == l ) { 213 if ( curLength == l ) {
213 return; 214 return;
214 } 215 }
215 curLength = l; 216 curLength = l;
216 emit lengthChanged(l); 217 emit lengthChanged(l);
217} 218}
218 219
219void MediaPlayerState::setView( char v ) { 220void MediaPlayerState::setView( char v ) {
220 if ( curView == v ) { 221 if ( curView == v ) {
221 return; 222 return;
222 } 223 }
223 curView = v; 224 curView = v;
224 emit viewChanged(v); 225 emit viewChanged(v);
225} 226}
226 227
227void MediaPlayerState::setPrev(){ 228void MediaPlayerState::setPrev(){
228 emit prev(); 229 emit prev();
229} 230}
230 231
231void MediaPlayerState::setNext() { 232void MediaPlayerState::setNext() {
232 emit next(); 233 emit next();
233} 234}
234 235
235void MediaPlayerState::setList() { 236void MediaPlayerState::setList() {
236 setPlaying( FALSE ); 237 setPlaying( FALSE );
237 setView('l'); 238 setView('l');
238} 239}
239 240
240void MediaPlayerState::setVideo() { 241void MediaPlayerState::setVideo() {
241 setView('v'); 242 setView('v');
242} 243}
243 244
244void MediaPlayerState::setAudio() { 245void MediaPlayerState::setAudio() {
245 setView('a'); 246 setView('a');
246} 247}
247 248
248void MediaPlayerState::toggleFullscreen() { 249void MediaPlayerState::toggleFullscreen() {
249 setFullscreen( !isFullscreen ); 250 setFullscreen( !isFullscreen );
250} 251}
251 252
252void MediaPlayerState::toggleScaled() { 253void MediaPlayerState::toggleScaled() {
253 setScaled( !isScaled); 254 setScaled( !isScaled);
254} 255}
255 256
256void MediaPlayerState::toggleLooping() { 257void MediaPlayerState::toggleLooping() {
257 setLooping( !isLooping); 258 setLooping( !isLooping);
258} 259}
259 260
260void MediaPlayerState::toggleShuffled() { 261void MediaPlayerState::toggleShuffled() {
261 setShuffled( !isShuffled); 262 setShuffled( !isShuffled);
262} 263}
263 264
264void MediaPlayerState::togglePlaylist() { 265void MediaPlayerState::togglePlaylist() {
265 setPlaylist( !usePlaylist); 266 setPlaylist( !usePlaylist);
266} 267}
267 268
268void MediaPlayerState::togglePaused() { 269void MediaPlayerState::togglePaused() {
269 setPaused( !isPaused); 270 setPaused( !isPaused);
270} 271}
271 272
272void MediaPlayerState::togglePlaying() { 273void MediaPlayerState::togglePlaying() {
273 setPlaying( !isPlaying); 274 setPlaying( !isPlaying);
274} 275}
275 276
276void MediaPlayerState::toggleBlank() { 277void MediaPlayerState::toggleBlank() {
277 setBlanked( !isBlanked); 278 setBlanked( !isBlanked);
278} 279}
279 280
280 281
281 282
diff --git a/noncore/multimedia/opieplayer2/opieplayer2.pro b/noncore/multimedia/opieplayer2/opieplayer2.pro
index 03540a1..8cbac06 100644
--- a/noncore/multimedia/opieplayer2/opieplayer2.pro
+++ b/noncore/multimedia/opieplayer2/opieplayer2.pro
@@ -1,24 +1,23 @@
1TEMPLATE = app 1TEMPLATE = app
2CONFIG = qt warn_on release 2#CONFIG = qt warn_on release
3#CONFIG = qt warn_on debug 3CONFIG = qt warn_on debug
4#release
5DESTDIR = $(OPIEDIR)/bin 4DESTDIR = $(OPIEDIR)/bin
6HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h mediadetect.h\ 5HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h mediadetect.h\
7 videowidget.h audiowidget.h playlistwidget.h mediaplayer.h inputDialog.h \ 6 videowidget.h audiowidget.h playlistwidget.h mediaplayer.h inputDialog.h \
8 frame.h lib.h xinevideowidget.h volumecontrol.h\ 7 frame.h lib.h xinevideowidget.h volumecontrol.h\
9 alphablend.h yuv2rgb.h 8 alphablend.h yuv2rgb.h
10SOURCES = main.cpp \ 9SOURCES = main.cpp \
11 playlistselection.cpp mediaplayerstate.cpp xinecontrol.cpp mediadetect.cpp\ 10 playlistselection.cpp mediaplayerstate.cpp xinecontrol.cpp mediadetect.cpp\
12 videowidget.cpp audiowidget.cpp playlistwidget.cpp mediaplayer.cpp inputDialog.cpp \ 11 videowidget.cpp audiowidget.cpp playlistwidget.cpp mediaplayer.cpp inputDialog.cpp \
13 frame.cpp lib.cpp nullvideo.c xinevideowidget.cpp volumecontrol.cpp\ 12 frame.cpp lib.cpp nullvideo.c xinevideowidget.cpp volumecontrol.cpp\
14 alphablend.c yuv2rgb.c yuv2rgb_arm.c yuv2rgb_arm4l.S 13 alphablend.c yuv2rgb.c yuv2rgb_arm.c yuv2rgb_arm4l.S
15TARGET = opieplayer2 14TARGET = opieplayer2
16INCLUDEPATH += $(OPIEDIR)/include 15INCLUDEPATH += $(OPIEDIR)/include
17DEPENDPATH += $(OPIEDIR)/include 16DEPENDPATH += $(OPIEDIR)/include
18LIBS += -lqpe -lpthread -lopie -lxine -lxineutils 17LIBS += -lqpe -lpthread -lopie -lxine -lxineutils
19MOC_DIR=qpeobj 18MOC_DIR=qpeobj
20OBJECTS_DIR=qpeobj 19OBJECTS_DIR=qpeobj
21 20
22INCLUDEPATH += $(OPIEDIR)/include 21INCLUDEPATH += $(OPIEDIR)/include
23DEPENDPATH += $(OPIEDIR)/include 22DEPENDPATH += $(OPIEDIR)/include
24 23
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 39f5090..262b685 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -1,1286 +1,1286 @@
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 9
10#include <qpe/applnk.h> 10#include <qpe/applnk.h>
11#include <qpopupmenu.h> 11#include <qpopupmenu.h>
12#include <qpe/config.h> 12#include <qpe/config.h>
13#include <qpe/global.h> 13#include <qpe/global.h>
14#include <qpe/resource.h> 14#include <qpe/resource.h>
15#include <qaction.h> 15#include <qaction.h>
16#include <qcursor.h> 16#include <qcursor.h>
17#include <qimage.h> 17#include <qimage.h>
18#include <qfile.h> 18#include <qfile.h>
19#include <qdir.h> 19#include <qdir.h>
20#include <qlayout.h> 20#include <qlayout.h>
21#include <qlabel.h> 21#include <qlabel.h>
22#include <qlist.h> 22#include <qlist.h>
23#include <qlistbox.h> 23#include <qlistbox.h>
24#include <qmainwindow.h> 24#include <qmainwindow.h>
25#include <qmessagebox.h> 25#include <qmessagebox.h>
26#include <qtoolbutton.h> 26#include <qtoolbutton.h>
27#include <qtabwidget.h> 27#include <qtabwidget.h>
28#include <qlistview.h> 28#include <qlistview.h>
29#include <qpoint.h> 29#include <qpoint.h>
30#include <qlineedit.h> 30#include <qlineedit.h>
31#include <qpushbutton.h> 31#include <qpushbutton.h>
32#include <qregexp.h> 32#include <qregexp.h>
33#include <qtextstream.h> 33#include <qtextstream.h>
34 34
35 35
36#include "playlistselection.h" 36#include "playlistselection.h"
37#include "playlistwidget.h" 37#include "playlistwidget.h"
38#include "mediaplayerstate.h" 38#include "mediaplayerstate.h"
39 39
40#include "inputDialog.h" 40#include "inputDialog.h"
41 41
42#include <stdlib.h> 42#include <stdlib.h>
43#include "audiowidget.h" 43#include "audiowidget.h"
44#include "videowidget.h" 44#include "videowidget.h"
45 45
46#define BUTTONS_ON_TOOLBAR 46#define BUTTONS_ON_TOOLBAR
47#define SIDE_BUTTONS 47#define SIDE_BUTTONS
48#define CAN_SAVE_LOAD_PLAYLISTS 48#define CAN_SAVE_LOAD_PLAYLISTS
49 49
50extern MediaPlayerState *mediaPlayerState; 50extern MediaPlayerState *mediaPlayerState;
51 51
52 52
53class PlayListWidgetPrivate { 53class PlayListWidgetPrivate {
54public: 54public:
55 QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; 55 QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove;
56 QFrame *playListFrame; 56 QFrame *playListFrame;
57 FileSelector *files; 57 FileSelector *files;
58 PlayListSelection *selectedFiles; 58 PlayListSelection *selectedFiles;
59 bool setDocumentUsed; 59 bool setDocumentUsed;
60 DocLnk *current; 60 DocLnk *current;
61}; 61};
62 62
63 63
64class ToolButton : public QToolButton { 64class ToolButton : public QToolButton {
65public: 65public:
66 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) 66 ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE )
67 : QToolButton( parent, name ) { 67 : QToolButton( parent, name ) {
68 setTextLabel( name ); 68 setTextLabel( name );
69 setPixmap( Resource::loadPixmap( icon ) ); 69 setPixmap( Resource::loadPixmap( icon ) );
70 setAutoRaise( TRUE ); 70 setAutoRaise( TRUE );
71 setFocusPolicy( QWidget::NoFocus ); 71 setFocusPolicy( QWidget::NoFocus );
72 setToggleButton( t ); 72 setToggleButton( t );
73 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); 73 connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot );
74 QPEMenuToolFocusManager::manager()->addWidget( this ); 74 QPEMenuToolFocusManager::manager()->addWidget( this );
75 } 75 }
76}; 76};
77 77
78 78
79class MenuItem : public QAction { 79class MenuItem : public QAction {
80public: 80public:
81 MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) 81 MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot )
82 : QAction( text, QString::null, 0, 0 ) { 82 : QAction( text, QString::null, 0, 0 ) {
83 connect( this, SIGNAL( activated() ), handler, slot ); 83 connect( this, SIGNAL( activated() ), handler, slot );
84 addTo( parent ); 84 addTo( parent );
85 } 85 }
86}; 86};
87 87
88 88
89PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) 89PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
90 : QMainWindow( parent, name, fl ) { 90 : QMainWindow( parent, name, fl ) {
91 91
92 d = new PlayListWidgetPrivate; 92 d = new PlayListWidgetPrivate;
93 d->setDocumentUsed = FALSE; 93 d->setDocumentUsed = FALSE;
94 d->current = NULL; 94 d->current = NULL;
95 fromSetDocument = FALSE; 95 fromSetDocument = FALSE;
96 insanityBool=FALSE; 96 insanityBool=FALSE;
97 audioScan = FALSE; 97 audioScan = FALSE;
98 videoScan = FALSE; 98 videoScan = FALSE;
99 99
100 setBackgroundMode( PaletteButton ); 100 setBackgroundMode( PaletteButton );
101 101
102 setCaption( tr("OpiePlayer") ); 102 setCaption( tr("OpiePlayer") );
103 setIcon( Resource::loadPixmap( "opieplayer2/MPEGPlayer" ) ); 103 setIcon( Resource::loadPixmap( "opieplayer2/MPEGPlayer" ) );
104 104
105 setToolBarsMovable( FALSE ); 105 setToolBarsMovable( FALSE );
106 106
107 // Create Toolbar 107 // Create Toolbar
108 QPEToolBar *toolbar = new QPEToolBar( this ); 108 QPEToolBar *toolbar = new QPEToolBar( this );
109 toolbar->setHorizontalStretchable( TRUE ); 109 toolbar->setHorizontalStretchable( TRUE );
110 110
111 // Create Menubar 111 // Create Menubar
112 QPEMenuBar *menu = new QPEMenuBar( toolbar ); 112 QPEMenuBar *menu = new QPEMenuBar( toolbar );
113 menu->setMargin( 0 ); 113 menu->setMargin( 0 );
114 114
115 QPEToolBar *bar = new QPEToolBar( this ); 115 QPEToolBar *bar = new QPEToolBar( this );
116 bar->setLabel( tr( "Play Operations" ) ); 116 bar->setLabel( tr( "Play Operations" ) );
117 117
118 tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); 118 tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close");
119 tbDeletePlaylist->setFlat(TRUE); 119 tbDeletePlaylist->setFlat(TRUE);
120 tbDeletePlaylist->setFixedSize(20,20); 120 tbDeletePlaylist->setFixedSize(20,20);
121 121
122 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer2/add_to_playlist", 122 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer2/add_to_playlist",
123 this , SLOT(addSelected()) ); 123 this , SLOT(addSelected()) );
124 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer2/remove_from_playlist", 124 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer2/remove_from_playlist",
125 this , SLOT(removeSelected()) ); 125 this , SLOT(removeSelected()) );
126 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", 126 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play",
127 this , SLOT( btnPlay(bool) ), TRUE ); 127 this , SLOT( btnPlay(bool) ), TRUE );
128 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", 128 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle",
129 mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); 129 mediaPlayerState, SLOT(setShuffled(bool)), TRUE );
130 d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer2/loop", 130 d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer2/loop",
131 mediaPlayerState, SLOT(setLooping(bool)), TRUE ); 131 mediaPlayerState, SLOT(setLooping(bool)), TRUE );
132 tbDeletePlaylist->hide(); 132 tbDeletePlaylist->hide();
133 133
134 QPopupMenu *pmPlayList = new QPopupMenu( this ); 134 QPopupMenu *pmPlayList = new QPopupMenu( this );
135 menu->insertItem( tr( "File" ), pmPlayList ); 135 menu->insertItem( tr( "File" ), pmPlayList );
136 new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); 136 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
137 new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); 137 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) );
138 new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); 138 (void)new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) );
139 new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); 139 (void)new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) );
140 pmPlayList->insertSeparator(-1); 140 pmPlayList->insertSeparator(-1);
141 new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); 141 (void)new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) );
142 new MenuItem( pmPlayList, tr( "Export playlist to m3u" ), this, SLOT(writem3u() ) ); 142 (void)new MenuItem( pmPlayList, tr( "Export playlist to m3u" ), this, SLOT(writem3u() ) );
143 pmPlayList->insertSeparator(-1); 143 pmPlayList->insertSeparator(-1);
144 new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); 144 (void)new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) );
145 pmPlayList->insertSeparator(-1); 145 pmPlayList->insertSeparator(-1);
146 new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); 146 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) );
147 new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); 147 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) );
148 148
149 149
150 pmView = new QPopupMenu( this ); 150 pmView = new QPopupMenu( this );
151 menu->insertItem( tr( "View" ), pmView ); 151 menu->insertItem( tr( "View" ), pmView );
152 pmView->isCheckable(); 152 pmView->isCheckable();
153 153
154 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), mediaPlayerState, SLOT( toggleFullscreen() ) ); 154 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), mediaPlayerState, SLOT( toggleFullscreen() ) );
155 155
156 Config cfg( "OpiePlayer" ); 156 Config cfg( "OpiePlayer" );
157 bool b= cfg.readBoolEntry("FullScreen", 0); 157 bool b= cfg.readBoolEntry("FullScreen", 0);
158 mediaPlayerState->setFullscreen( b ); 158 mediaPlayerState->setFullscreen( b );
159 pmView->setItemChecked( -16, b ); 159 pmView->setItemChecked( -16, b );
160 160
161 // pmView->insertItem( Resource::loadPixmap("opieplayer/scale") , tr( "Scale"), mediaPlayerState, SLOT(toggleScaled() ) ); 161 // pmView->insertItem( Resource::loadPixmap("opieplayer/scale") , tr( "Scale"), mediaPlayerState, SLOT(toggleScaled() ) );
162 162
163 pmView->insertSeparator(-1); 163 pmView->insertSeparator(-1);
164 164
165 skinsMenu = new QPopupMenu( this ); 165 skinsMenu = new QPopupMenu( this );
166 pmView->insertItem( tr( "Skins" ), skinsMenu ); 166 pmView->insertItem( tr( "Skins" ), skinsMenu );
167 skinsMenu->isCheckable(); 167 skinsMenu->isCheckable();
168 populateSkinsMenu(); 168 populateSkinsMenu();
169 169
170 QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); 170 QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton );
171 QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); 171 QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton );
172 172
173 QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); 173 QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton );
174 174
175 tabWidget = new QTabWidget( hbox6, "tabWidget" ); 175 tabWidget = new QTabWidget( hbox6, "tabWidget" );
176 // tabWidget->setTabShape(QTabWidget::Triangular); 176 // tabWidget->setTabShape(QTabWidget::Triangular);
177 177
178 QWidget *pTab; 178 QWidget *pTab;
179 pTab = new QWidget( tabWidget, "pTab" ); 179 pTab = new QWidget( tabWidget, "pTab" );
180 tabWidget->insertTab( pTab,"Playlist"); 180 tabWidget->insertTab( pTab,"Playlist");
181 181
182 182
183 QGridLayout *Playout = new QGridLayout( pTab ); 183 QGridLayout *Playout = new QGridLayout( pTab );
184 Playout->setSpacing( 2); 184 Playout->setSpacing( 2);
185 Playout->setMargin( 2); 185 Playout->setMargin( 2);
186 186
187 // Add the playlist area 187 // Add the playlist area
188 188
189 QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); 189 QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton );
190 d->playListFrame = vbox3; 190 d->playListFrame = vbox3;
191 191
192 QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); 192 QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton );
193 193
194 d->selectedFiles = new PlayListSelection( hbox2); 194 d->selectedFiles = new PlayListSelection( hbox2);
195 QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); 195 QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton );
196 196
197 QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); 197 QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold);
198 198
199 QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch 199 QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch
200 new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", d->selectedFiles, SLOT(moveSelectedUp()) ); 200 (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", d->selectedFiles, SLOT(moveSelectedUp()) );
201 new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", d->selectedFiles, SLOT(removeSelected()) ); 201 (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", d->selectedFiles, SLOT(removeSelected()) );
202 new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", d->selectedFiles, SLOT(moveSelectedDown()) ); 202 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", d->selectedFiles, SLOT(moveSelectedDown()) );
203 QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch 203 QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch
204 204
205 205
206 Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 ); 206 Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 );
207 207
208 QWidget *aTab; 208 QWidget *aTab;
209 aTab = new QWidget( tabWidget, "aTab" ); 209 aTab = new QWidget( tabWidget, "aTab" );
210 210
211 QGridLayout *Alayout = new QGridLayout( aTab ); 211 QGridLayout *Alayout = new QGridLayout( aTab );
212 Alayout->setSpacing( 2); 212 Alayout->setSpacing( 2);
213 Alayout->setMargin( 2); 213 Alayout->setMargin( 2);
214 214
215 audioView = new QListView( aTab, "Audioview" ); 215 audioView = new QListView( aTab, "Audioview" );
216 audioView->addColumn( tr("Title"),140); 216 audioView->addColumn( tr("Title"),140);
217 audioView->addColumn(tr("Size"), -1); 217 audioView->addColumn(tr("Size"), -1);
218 audioView->addColumn(tr("Media"),-1); 218 audioView->addColumn(tr("Media"),-1);
219 audioView->setColumnAlignment(1, Qt::AlignRight); 219 audioView->setColumnAlignment(1, Qt::AlignRight);
220 audioView->setColumnAlignment(2, Qt::AlignRight); 220 audioView->setColumnAlignment(2, Qt::AlignRight);
221 audioView->setAllColumnsShowFocus(TRUE); 221 audioView->setAllColumnsShowFocus(TRUE);
222 audioView->setSorting(0,TRUE); 222 audioView->setSorting(0,TRUE);
223 223
224 audioView->setMultiSelection( TRUE ); 224 audioView->setMultiSelection( TRUE );
225 audioView->setSelectionMode( QListView::Extended); 225 audioView->setSelectionMode( QListView::Extended);
226 226
227 Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 ); 227 Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 );
228 228
229 tabWidget->insertTab(aTab,tr("Audio")); 229 tabWidget->insertTab(aTab,tr("Audio"));
230 230
231 QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); 231 QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold);
232 232
233 QWidget *vTab; 233 QWidget *vTab;
234 vTab = new QWidget( tabWidget, "vTab" ); 234 vTab = new QWidget( tabWidget, "vTab" );
235 235
236 QGridLayout *Vlayout = new QGridLayout( vTab ); 236 QGridLayout *Vlayout = new QGridLayout( vTab );
237 Vlayout->setSpacing( 2); 237 Vlayout->setSpacing( 2);
238 Vlayout->setMargin( 2); 238 Vlayout->setMargin( 2);
239 239
240 videoView = new QListView( vTab, "Videoview" ); 240 videoView = new QListView( vTab, "Videoview" );
241 241
242 videoView->addColumn(tr("Title"),140); 242 videoView->addColumn(tr("Title"),140);
243 videoView->addColumn(tr("Size"),-1); 243 videoView->addColumn(tr("Size"),-1);
244 videoView->addColumn(tr("Media"),-1); 244 videoView->addColumn(tr("Media"),-1);
245 videoView->setColumnAlignment(1, Qt::AlignRight); 245 videoView->setColumnAlignment(1, Qt::AlignRight);
246 videoView->setColumnAlignment(2, Qt::AlignRight); 246 videoView->setColumnAlignment(2, Qt::AlignRight);
247 videoView->setAllColumnsShowFocus(TRUE); 247 videoView->setAllColumnsShowFocus(TRUE);
248 videoView->setSorting(0,TRUE); 248 videoView->setSorting(0,TRUE);
249 249
250 videoView->setMultiSelection( TRUE ); 250 videoView->setMultiSelection( TRUE );
251 videoView->setSelectionMode( QListView::Extended); 251 videoView->setSelectionMode( QListView::Extended);
252 252
253 Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 ); 253 Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 );
254 254
255 QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); 255 QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold);
256 256
257 tabWidget->insertTab( vTab,tr("Video")); 257 tabWidget->insertTab( vTab,tr("Video"));
258 258
259 //playlists list 259 //playlists list
260 QWidget *LTab; 260 QWidget *LTab;
261 LTab = new QWidget( tabWidget, "LTab" ); 261 LTab = new QWidget( tabWidget, "LTab" );
262 QGridLayout *Llayout = new QGridLayout( LTab ); 262 QGridLayout *Llayout = new QGridLayout( LTab );
263 Llayout->setSpacing( 2); 263 Llayout->setSpacing( 2);
264 Llayout->setMargin( 2); 264 Llayout->setMargin( 2);
265 265
266 playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy 266 playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy
267 Llayout->addMultiCellWidget( playLists, 0, 0, 0, 1 ); 267 Llayout->addMultiCellWidget( playLists, 0, 0, 0, 1 );
268 268
269 tabWidget->insertTab(LTab,tr("Lists")); 269 tabWidget->insertTab(LTab,tr("Lists"));
270 270
271 connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); 271 connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist()));
272 272
273 connect( pmView, SIGNAL( activated(int)), this, SLOT( pmViewActivated(int) ) ); 273 connect( pmView, SIGNAL( activated(int)), this, SLOT( pmViewActivated(int) ) );
274 274
275 connect( skinsMenu, SIGNAL( activated(int)), this, SLOT(skinsMenuActivated(int) ) ); 275 connect( skinsMenu, SIGNAL( activated(int)), this, SLOT(skinsMenuActivated(int) ) );
276 276
277 // connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled() ) ); 277 // connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled() ) );
278 278
279 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 279 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
280 this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); 280 this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) );
281 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 281 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
282 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); 282 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
283 connect( audioView, SIGNAL( returnPressed( QListViewItem *)), 283 connect( audioView, SIGNAL( returnPressed( QListViewItem *)),
284 this,SLOT( playIt( QListViewItem *)) ); 284 this,SLOT( playIt( QListViewItem *)) );
285 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 285 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
286 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 286 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
287 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); 287 this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) );
288 connect( videoView, SIGNAL( returnPressed( QListViewItem *)), 288 connect( videoView, SIGNAL( returnPressed( QListViewItem *)),
289 this,SLOT( playIt( QListViewItem *)) ); 289 this,SLOT( playIt( QListViewItem *)) );
290 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); 290 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) );
291 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); 291 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) );
292 connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); 292 connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*)));
293 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); 293 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) );
294 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); 294 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) );
295 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); 295 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) );
296 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); 296 connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) );
297 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); 297 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) );
298 298
299 setCentralWidget( vbox5 ); 299 setCentralWidget( vbox5 );
300 300
301 readConfig( cfg ); 301 readConfig( cfg );
302 QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); 302 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","");
303 loadList(DocLnk( currentPlaylist)); 303 loadList(DocLnk( currentPlaylist));
304 setCaption(tr("OpiePlayer: ")+ currentPlaylist ); 304 setCaption(tr("OpiePlayer: ")+ currentPlaylist );
305 305
306 initializeStates(); 306 initializeStates();
307} 307}
308 308
309 309
310PlayListWidget::~PlayListWidget() { 310PlayListWidget::~PlayListWidget() {
311 Config cfg( "OpiePlayer" ); 311 Config cfg( "OpiePlayer" );
312 writeConfig( cfg ); 312 writeConfig( cfg );
313 313
314 if ( d->current ) { 314 if ( d->current ) {
315 delete d->current; 315 delete d->current;
316 } 316 }
317 delete d; 317 delete d;
318} 318}
319 319
320 320
321void PlayListWidget::initializeStates() { 321void PlayListWidget::initializeStates() {
322 322
323 d->tbPlay->setOn( mediaPlayerState->playing() ); 323 d->tbPlay->setOn( mediaPlayerState->playing() );
324 d->tbLoop->setOn( mediaPlayerState->looping() ); 324 d->tbLoop->setOn( mediaPlayerState->looping() );
325 d->tbShuffle->setOn( mediaPlayerState->shuffled() ); 325 d->tbShuffle->setOn( mediaPlayerState->shuffled() );
326 setPlaylist( true); 326 setPlaylist( true);
327} 327}
328 328
329 329
330void PlayListWidget::readConfig( Config& cfg ) { 330void PlayListWidget::readConfig( Config& cfg ) {
331 cfg.setGroup("PlayList"); 331 cfg.setGroup("PlayList");
332 QString currentString = cfg.readEntry("current", "" ); 332 QString currentString = cfg.readEntry("current", "" );
333 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); 333 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
334 for ( int i = 0; i < noOfFiles; i++ ) { 334 for ( int i = 0; i < noOfFiles; i++ ) {
335 QString entryName; 335 QString entryName;
336 entryName.sprintf( "File%i", i + 1 ); 336 entryName.sprintf( "File%i", i + 1 );
337 QString linkFile = cfg.readEntry( entryName ); 337 QString linkFile = cfg.readEntry( entryName );
338 if(QFileInfo( linkFile).exists() ) { 338 if(QFileInfo( linkFile).exists() ) {
339 DocLnk lnk( linkFile ); 339 DocLnk lnk( linkFile );
340 if ( QFileInfo( lnk.file()).exists() || linkFile.find("http",0,TRUE) != -1) { 340 if ( QFileInfo( lnk.file()).exists() || linkFile.find("http",0,TRUE) != -1) {
341 d->selectedFiles->addToSelection( lnk ); 341 d->selectedFiles->addToSelection( lnk );
342 } 342 }
343 } 343 }
344 } 344 }
345 d->selectedFiles->setSelectedItem( currentString); 345 d->selectedFiles->setSelectedItem( currentString);
346} 346}
347 347
348 348
349void PlayListWidget::writeConfig( Config& cfg ) const { 349void PlayListWidget::writeConfig( Config& cfg ) const {
350 350
351 d->selectedFiles->writeCurrent( cfg); 351 d->selectedFiles->writeCurrent( cfg);
352 cfg.setGroup("PlayList"); 352 cfg.setGroup("PlayList");
353 int noOfFiles = 0; 353 int noOfFiles = 0;
354 d->selectedFiles->first(); 354 d->selectedFiles->first();
355 do { 355 do {
356 const DocLnk *lnk = d->selectedFiles->current(); 356 const DocLnk *lnk = d->selectedFiles->current();
357 if ( lnk ) { 357 if ( lnk ) {
358 QString entryName; 358 QString entryName;
359 entryName.sprintf( "File%i", noOfFiles + 1 ); 359 entryName.sprintf( "File%i", noOfFiles + 1 );
360 cfg.writeEntry( entryName, lnk->linkFile() ); 360 cfg.writeEntry( entryName, lnk->linkFile() );
361 // if this link does exist, add it so we have the file 361 // if this link does exist, add it so we have the file
362 // next time... 362 // next time...
363 if ( !QFile::exists( lnk->linkFile() ) ) { 363 if ( !QFile::exists( lnk->linkFile() ) ) {
364 // the way writing lnks doesn't really check for out 364 // the way writing lnks doesn't really check for out
365 // of disk space, but check it anyway. 365 // of disk space, but check it anyway.
366 if ( !lnk->writeLink() ) { 366 if ( !lnk->writeLink() ) {
367 QMessageBox::critical( 0, tr("Out of space"), 367 QMessageBox::critical( 0, tr("Out of space"),
368 tr( "There was a problem saving " 368 tr( "There was a problem saving "
369 "the playlist.\n" 369 "the playlist.\n"
370 "Your playlist " 370 "Your playlist "
371 "may be missing some entries\n" 371 "may be missing some entries\n"
372 "the next time you start it." ) 372 "the next time you start it." )
373 ); 373 );
374 } 374 }
375 } 375 }
376 noOfFiles++; 376 noOfFiles++;
377 } 377 }
378 } 378 }
379 while ( d->selectedFiles->next() ); 379 while ( d->selectedFiles->next() );
380 cfg.writeEntry("NumberOfFiles", noOfFiles ); 380 cfg.writeEntry("NumberOfFiles", noOfFiles );
381} 381}
382 382
383 383
384void PlayListWidget::addToSelection( const DocLnk& lnk ) { 384void PlayListWidget::addToSelection( const DocLnk& lnk ) {
385 d->setDocumentUsed = FALSE; 385 d->setDocumentUsed = FALSE;
386 if ( mediaPlayerState->playlist() ) { 386 if ( mediaPlayerState->playlist() ) {
387 if(QFileInfo(lnk.file()).exists() || lnk.file().left(4) == "http" ) 387 if(QFileInfo(lnk.file()).exists() || lnk.file().left(4) == "http" )
388 d->selectedFiles->addToSelection( lnk ); 388 d->selectedFiles->addToSelection( lnk );
389 } 389 }
390 else 390 else
391 mediaPlayerState->setPlaying( TRUE ); 391 mediaPlayerState->setPlaying( TRUE );
392} 392}
393 393
394 394
395void PlayListWidget::clearList() { 395void PlayListWidget::clearList() {
396 while ( first() ) { 396 while ( first() ) {
397 d->selectedFiles->removeSelected(); 397 d->selectedFiles->removeSelected();
398 } 398 }
399} 399}
400 400
401 401
402void PlayListWidget::addAllToList() { 402void PlayListWidget::addAllToList() {
403 DocLnkSet filesAll; 403 DocLnkSet filesAll;
404 Global::findDocuments(&filesAll, "video/*;audio/*"); 404 Global::findDocuments(&filesAll, "video/*;audio/*");
405 QListIterator<DocLnk> Adit( filesAll.children() ); 405 QListIterator<DocLnk> Adit( filesAll.children() );
406 for ( ; Adit.current(); ++Adit ) { 406 for ( ; Adit.current(); ++Adit ) {
407 if(QFileInfo(Adit.current()->file()).exists()) { 407 if(QFileInfo(Adit.current()->file()).exists()) {
408 d->selectedFiles->addToSelection( **Adit ); 408 d->selectedFiles->addToSelection( **Adit );
409 } 409 }
410 } 410 }
411} 411}
412 412
413 413
414void PlayListWidget::addAllMusicToList() { 414void PlayListWidget::addAllMusicToList() {
415 QListIterator<DocLnk> dit( files.children() ); 415 QListIterator<DocLnk> dit( files.children() );
416 for ( ; dit.current(); ++dit ) { 416 for ( ; dit.current(); ++dit ) {
417 if(QFileInfo(dit.current()->file()).exists()) { 417 if(QFileInfo(dit.current()->file()).exists()) {
418 d->selectedFiles->addToSelection( **dit ); 418 d->selectedFiles->addToSelection( **dit );
419 } 419 }
420 } 420 }
421} 421}
422 422
423 423
424void PlayListWidget::addAllVideoToList() { 424void PlayListWidget::addAllVideoToList() {
425 QListIterator<DocLnk> dit( vFiles.children() ); 425 QListIterator<DocLnk> dit( vFiles.children() );
426 for ( ; dit.current(); ++dit ) 426 for ( ; dit.current(); ++dit )
427 if(QFileInfo( dit.current()->file()).exists()) 427 if(QFileInfo( dit.current()->file()).exists())
428 d->selectedFiles->addToSelection( **dit ); 428 d->selectedFiles->addToSelection( **dit );
429} 429}
430 430
431 431
432void PlayListWidget::setDocument(const QString& fileref) { 432void PlayListWidget::setDocument(const QString& fileref) {
433 qDebug(fileref); 433 qDebug(fileref);
434 fromSetDocument = TRUE; 434 fromSetDocument = TRUE;
435 if ( fileref.isNull() ) { 435 if ( fileref.isNull() ) {
436 QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); 436 QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) );
437 return; 437 return;
438 } 438 }
439 439
440 if(fileref.find("m3u",0,TRUE) != -1) { //is m3u 440 if(fileref.find("m3u",0,TRUE) != -1) { //is m3u
441 readm3u( fileref); 441 readm3u( fileref);
442 } else if(fileref.find("pls",0,TRUE) != -1) { //is pls 442 } else if(fileref.find("pls",0,TRUE) != -1) { //is pls
443 readPls( fileref); 443 readPls( fileref);
444 } else if(fileref.find("playlist",0,TRUE) != -1) {//is playlist 444 } else if(fileref.find("playlist",0,TRUE) != -1) {//is playlist
445 clearList(); 445 clearList();
446 loadList(DocLnk(fileref)); 446 loadList(DocLnk(fileref));
447 d->selectedFiles->first(); 447 d->selectedFiles->first();
448 } else { 448 } else {
449 clearList(); 449 clearList();
450 addToSelection( DocLnk( fileref ) ); 450 addToSelection( DocLnk( fileref ) );
451 d->setDocumentUsed = TRUE; 451 d->setDocumentUsed = TRUE;
452 mediaPlayerState->setPlaying( FALSE ); 452 mediaPlayerState->setPlaying( FALSE );
453 qApp->processEvents(); 453 qApp->processEvents();
454 mediaPlayerState->setPlaying( TRUE ); 454 mediaPlayerState->setPlaying( TRUE );
455 qApp->processEvents(); 455 qApp->processEvents();
456 setCaption(tr("OpiePlayer")); 456 setCaption(tr("OpiePlayer"));
457 } 457 }
458} 458}
459 459
460 460
461void PlayListWidget::setActiveWindow() { 461void PlayListWidget::setActiveWindow() {
462 qDebug("SETTING active window"); 462 qDebug("SETTING active window");
463 // When we get raised we need to ensure that it switches views 463 // When we get raised we need to ensure that it switches views
464 char origView = mediaPlayerState->view(); 464 char origView = mediaPlayerState->view();
465 mediaPlayerState->setView( 'l' ); // invalidate 465 mediaPlayerState->setView( 'l' ); // invalidate
466 mediaPlayerState->setView( origView ); // now switch back 466 mediaPlayerState->setView( origView ); // now switch back
467} 467}
468 468
469 469
470void PlayListWidget::useSelectedDocument() { 470void PlayListWidget::useSelectedDocument() {
471 d->setDocumentUsed = FALSE; 471 d->setDocumentUsed = FALSE;
472} 472}
473 473
474 474
475const DocLnk *PlayListWidget::current() { // this is fugly 475const DocLnk *PlayListWidget::current() { // this is fugly
476 476
477 switch (tabWidget->currentPageIndex()) { 477 switch (tabWidget->currentPageIndex()) {
478 case 0: //playlist 478 case 0: //playlist
479 { 479 {
480 qDebug("playlist"); 480 qDebug("playlist");
481 if ( mediaPlayerState->playlist() ) { 481 if ( mediaPlayerState->playlist() ) {
482 return d->selectedFiles->current(); 482 return d->selectedFiles->current();
483 } else if ( d->setDocumentUsed && d->current ) { 483 } else if ( d->setDocumentUsed && d->current ) {
484 return d->current; 484 return d->current;
485 } else { 485 } else {
486 return d->files->selected(); 486 return d->files->selected();
487 } 487 }
488 } 488 }
489 break; 489 break;
490 case 1://audio 490 case 1://audio
491 { 491 {
492 qDebug("audioView"); 492 qDebug("audioView");
493 QListIterator<DocLnk> dit( files.children() ); 493 QListIterator<DocLnk> dit( files.children() );
494 for ( ; dit.current(); ++dit ) { 494 for ( ; dit.current(); ++dit ) {
495 if( dit.current()->name() == audioView->currentItem()->text(0) && !insanityBool) { 495 if( dit.current()->name() == audioView->currentItem()->text(0) && !insanityBool) {
496 qDebug("here"); 496 qDebug("here");
497 insanityBool=TRUE; 497 insanityBool=TRUE;
498 return dit; 498 return dit;
499 } 499 }
500 } 500 }
501 } 501 }
502 break; 502 break;
503 case 2: // video 503 case 2: // video
504 { 504 {
505 qDebug("videoView"); 505 qDebug("videoView");
506 QListIterator<DocLnk> Vdit( vFiles.children() ); 506 QListIterator<DocLnk> Vdit( vFiles.children() );
507 for ( ; Vdit.current(); ++Vdit ) { 507 for ( ; Vdit.current(); ++Vdit ) {
508 if( Vdit.current()->name() == videoView->currentItem()->text(0) && !insanityBool) { 508 if( Vdit.current()->name() == videoView->currentItem()->text(0) && !insanityBool) {
509 insanityBool=TRUE; 509 insanityBool=TRUE;
510 return Vdit; 510 return Vdit;
511 } 511 }
512 } 512 }
513 } 513 }
514 break; 514 break;
515 }; 515 };
516 return 0; 516 return 0;
517} 517}
518 518
519bool PlayListWidget::prev() { 519bool PlayListWidget::prev() {
520 if ( mediaPlayerState->playlist() ) { 520 if ( mediaPlayerState->playlist() ) {
521 if ( mediaPlayerState->shuffled() ) { 521 if ( mediaPlayerState->shuffled() ) {
522 const DocLnk *cur = current(); 522 const DocLnk *cur = current();
523 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); 523 int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0));
524 for ( int i = 0; i < j; i++ ) { 524 for ( int i = 0; i < j; i++ ) {
525 if ( !d->selectedFiles->next() ) 525 if ( !d->selectedFiles->next() )
526 d->selectedFiles->first(); 526 d->selectedFiles->first();
527 } 527 }
528 if ( cur == current() ) 528 if ( cur == current() )
529 if ( !d->selectedFiles->next() ) 529 if ( !d->selectedFiles->next() )
530 d->selectedFiles->first(); 530 d->selectedFiles->first();
531 return TRUE; 531 return TRUE;
532 } else { 532 } else {
533 if ( !d->selectedFiles->prev() ) { 533 if ( !d->selectedFiles->prev() ) {
534 if ( mediaPlayerState->looping() ) { 534 if ( mediaPlayerState->looping() ) {
535 return d->selectedFiles->last(); 535 return d->selectedFiles->last();
536 } else { 536 } else {
537 return FALSE; 537 return FALSE;
538 } 538 }
539 } 539 }
540 return TRUE; 540 return TRUE;
541 } 541 }
542 } else { 542 } else {
543 return mediaPlayerState->looping(); 543 return mediaPlayerState->looping();
544 } 544 }
545} 545}
546 546
547 547
548bool PlayListWidget::next() { 548bool PlayListWidget::next() {
549 if ( mediaPlayerState->playlist() ) { 549 if ( mediaPlayerState->playlist() ) {
550 if ( mediaPlayerState->shuffled() ) { 550 if ( mediaPlayerState->shuffled() ) {
551 return prev(); 551 return prev();
552 } else { 552 } else {
553 if ( !d->selectedFiles->next() ) { 553 if ( !d->selectedFiles->next() ) {
554 if ( mediaPlayerState->looping() ) { 554 if ( mediaPlayerState->looping() ) {
555 return d->selectedFiles->first(); 555 return d->selectedFiles->first();
556 } else { 556 } else {
557 return FALSE; 557 return FALSE;
558 } 558 }
559 } 559 }
560 return TRUE; 560 return TRUE;
561 } 561 }
562 } else { 562 } else {
563 return mediaPlayerState->looping(); 563 return mediaPlayerState->looping();
564 } 564 }
565} 565}
566 566
567 567
568bool PlayListWidget::first() { 568bool PlayListWidget::first() {
569 if ( mediaPlayerState->playlist() ) 569 if ( mediaPlayerState->playlist() )
570 return d->selectedFiles->first(); 570 return d->selectedFiles->first();
571 else 571 else
572 return mediaPlayerState->looping(); 572 return mediaPlayerState->looping();
573} 573}
574 574
575 575
576bool PlayListWidget::last() { 576bool PlayListWidget::last() {
577 if ( mediaPlayerState->playlist() ) 577 if ( mediaPlayerState->playlist() )
578 return d->selectedFiles->last(); 578 return d->selectedFiles->last();
579 else 579 else
580 return mediaPlayerState->looping(); 580 return mediaPlayerState->looping();
581} 581}
582 582
583 583
584void PlayListWidget::saveList() { 584void PlayListWidget::saveList() {
585 585
586 QString filename; 586 QString filename;
587 InputDialog *fileDlg; 587 InputDialog *fileDlg;
588 fileDlg = new InputDialog(this,tr("Save Playlist"),TRUE, 0); 588 fileDlg = new InputDialog(this,tr("Save Playlist"),TRUE, 0);
589 fileDlg->exec(); 589 fileDlg->exec();
590 if( fileDlg->result() == 1 ) { 590 if( fileDlg->result() == 1 ) {
591 if ( d->current ) 591 if ( d->current )
592 delete d->current; 592 delete d->current;
593 filename = fileDlg->LineEdit1->text();//+".playlist"; 593 filename = fileDlg->LineEdit1->text();//+".playlist";
594 // qDebug("saving playlist "+filename+".playlist"); 594 // qDebug("saving playlist "+filename+".playlist");
595 Config cfg( filename +".playlist"); 595 Config cfg( filename +".playlist");
596 writeConfig( cfg ); 596 writeConfig( cfg );
597 597
598 DocLnk lnk; 598 DocLnk lnk;
599 lnk.setFile(QDir::homeDirPath()+"/Settings/"+filename+".playlist.conf"); //sets File property 599 lnk.setFile(QDir::homeDirPath()+"/Settings/"+filename+".playlist.conf"); //sets File property
600 lnk.setType("playlist/plain");// hey is this a REGISTERED mime type?!?!? ;D 600 lnk.setType("playlist/plain");// hey is this a REGISTERED mime type?!?!? ;D
601 lnk.setIcon("opieplayer2/playlist2"); 601 lnk.setIcon("opieplayer2/playlist2");
602 lnk.setName( filename); //sets file name 602 lnk.setName( filename); //sets file name
603 // qDebug(filename); 603 // qDebug(filename);
604 if(!lnk.writeLink()) { 604 if(!lnk.writeLink()) {
605 qDebug("Writing doclink did not work"); 605 qDebug("Writing doclink did not work");
606 } 606 }
607 } 607 }
608 Config config( "OpiePlayer" ); 608 Config config( "OpiePlayer" );
609 config.writeEntry("CurrentPlaylist",filename); 609 config.writeEntry("CurrentPlaylist",filename);
610 setCaption(tr("OpiePlayer: ")+filename); 610 setCaption(tr("OpiePlayer: ")+filename);
611 d->selectedFiles->first(); 611 d->selectedFiles->first();
612 if(fileDlg) { 612 if(fileDlg) {
613 delete fileDlg; 613 delete fileDlg;
614 } 614 }
615} 615}
616 616
617void PlayListWidget::loadList( const DocLnk & lnk) { 617void PlayListWidget::loadList( const DocLnk & lnk) {
618 QString name= lnk.name(); 618 QString name= lnk.name();
619 // qDebug("currentList is "+name); 619 // qDebug("currentList is "+name);
620 if( name.length()>1) { 620 if( name.length()>1) {
621 setCaption("OpiePlayer: "+name); 621 setCaption("OpiePlayer: "+name);
622 // qDebug("load list "+ name+".playlist"); 622 // qDebug("load list "+ name+".playlist");
623 clearList(); 623 clearList();
624 Config cfg( name+".playlist"); 624 Config cfg( name+".playlist");
625 readConfig(cfg); 625 readConfig(cfg);
626 626
627 tabWidget->setCurrentPage(0); 627 tabWidget->setCurrentPage(0);
628 628
629 Config config( "OpiePlayer" ); 629 Config config( "OpiePlayer" );
630 config.writeEntry("CurrentPlaylist", name); 630 config.writeEntry("CurrentPlaylist", name);
631 // d->selectedFiles->first(); 631 // d->selectedFiles->first();
632 } 632 }
633 633
634} 634}
635 635
636void PlayListWidget::setPlaylist( bool shown ) { 636void PlayListWidget::setPlaylist( bool shown ) {
637 if ( shown ) { 637 if ( shown ) {
638 d->playListFrame->show(); 638 d->playListFrame->show();
639 } else { 639 } else {
640 d->playListFrame->hide(); 640 d->playListFrame->hide();
641 } 641 }
642} 642}
643 643
644void PlayListWidget::setView( char view ) { 644void PlayListWidget::setView( char view ) {
645 if ( view == 'l' ) 645 if ( view == 'l' )
646 showMaximized(); 646 showMaximized();
647 else 647 else
648 hide(); 648 hide();
649} 649}
650 650
651void PlayListWidget::addSelected() { 651void PlayListWidget::addSelected() {
652 652
653 Config cfg( "OpiePlayer" ); 653 Config cfg( "OpiePlayer" );
654 cfg.setGroup("PlayList"); 654 cfg.setGroup("PlayList");
655 QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); 655 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","");
656 // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); 656 // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
657 657
658 switch (tabWidget->currentPageIndex()) { 658 switch (tabWidget->currentPageIndex()) {
659 case 0: //playlist 659 case 0: //playlist
660 break; 660 break;
661 case 1: { //audio 661 case 1: { //audio
662 QListViewItemIterator it( audioView ); 662 QListViewItemIterator it( audioView );
663 // iterate through all items of the listview 663 // iterate through all items of the listview
664 for ( ; it.current(); ++it ) { 664 for ( ; it.current(); ++it ) {
665 if ( it.current()->isSelected() ) { 665 if ( it.current()->isSelected() ) {
666 QListIterator<DocLnk> dit( files.children() ); 666 QListIterator<DocLnk> dit( files.children() );
667 for ( ; dit.current(); ++dit ) { 667 for ( ; dit.current(); ++dit ) {
668 if( dit.current()->name() == it.current()->text(0) ) { 668 if( dit.current()->name() == it.current()->text(0) ) {
669 if(QFileInfo( dit.current()->file()).exists()) 669 if(QFileInfo( dit.current()->file()).exists())
670 d->selectedFiles->addToSelection( **dit ); 670 d->selectedFiles->addToSelection( **dit );
671 } 671 }
672 } 672 }
673 audioView->setSelected( it.current(),FALSE); 673 audioView->setSelected( it.current(),FALSE);
674 } 674 }
675 } 675 }
676 tabWidget->setCurrentPage(0); 676 tabWidget->setCurrentPage(0);
677 } 677 }
678 break; 678 break;
679 case 2: { // video 679 case 2: { // video
680 QListViewItemIterator it( videoView ); 680 QListViewItemIterator it( videoView );
681 // iterate through all items of the listview 681 // iterate through all items of the listview
682 for ( ; it.current(); ++it ) { 682 for ( ; it.current(); ++it ) {
683 if ( it.current()->isSelected() ) { 683 if ( it.current()->isSelected() ) {
684 QListIterator<DocLnk> dit( vFiles.children() ); 684 QListIterator<DocLnk> dit( vFiles.children() );
685 for ( ; dit.current(); ++dit ) { 685 for ( ; dit.current(); ++dit ) {
686 if( dit.current()->name() == it.current()->text(0) ) { 686 if( dit.current()->name() == it.current()->text(0) ) {
687 if(QFileInfo( dit.current()->file()).exists()) 687 if(QFileInfo( dit.current()->file()).exists())
688 d->selectedFiles->addToSelection( **dit ); 688 d->selectedFiles->addToSelection( **dit );
689 } 689 }
690 } 690 }
691 videoView->setSelected( it.current(),FALSE); 691 videoView->setSelected( it.current(),FALSE);
692 } 692 }
693 } 693 }
694 tabWidget->setCurrentPage(0); 694 tabWidget->setCurrentPage(0);
695 } 695 }
696 break; 696 break;
697 }; 697 };
698} 698}
699 699
700void PlayListWidget::removeSelected() { 700void PlayListWidget::removeSelected() {
701 d->selectedFiles->removeSelected( ); 701 d->selectedFiles->removeSelected( );
702} 702}
703 703
704void PlayListWidget::playIt( QListViewItem *it) { 704void PlayListWidget::playIt( QListViewItem *it) {
705 if(!it) return; 705 if(!it) return;
706 mediaPlayerState->setPlaying(FALSE); 706 mediaPlayerState->setPlaying(FALSE);
707 mediaPlayerState->setPlaying(TRUE); 707 mediaPlayerState->setPlaying(TRUE);
708 d->selectedFiles->unSelect(); 708 d->selectedFiles->unSelect();
709} 709}
710 710
711void PlayListWidget::addToSelection( QListViewItem *it) { 711void PlayListWidget::addToSelection( QListViewItem *it) {
712 d->setDocumentUsed = FALSE; 712 d->setDocumentUsed = FALSE;
713 713
714 if(it) { 714 if(it) {
715 switch (tabWidget->currentPageIndex()) { 715 switch (tabWidget->currentPageIndex()) {
716 case 1: { 716 case 1: {
717 QListIterator<DocLnk> dit( files.children() ); 717 QListIterator<DocLnk> dit( files.children() );
718 for ( ; dit.current(); ++dit ) { 718 for ( ; dit.current(); ++dit ) {
719 if( dit.current()->name() == it->text(0)) { 719 if( dit.current()->name() == it->text(0)) {
720 if(QFileInfo( dit.current()->file()).exists()) 720 if(QFileInfo( dit.current()->file()).exists())
721 d->selectedFiles->addToSelection( **dit ); 721 d->selectedFiles->addToSelection( **dit );
722 } 722 }
723 } 723 }
724 } 724 }
725 break; 725 break;
726 case 2: { 726 case 2: {
727 QListIterator<DocLnk> dit( vFiles.children() ); 727 QListIterator<DocLnk> dit( vFiles.children() );
728 for ( ; dit.current(); ++dit ) { 728 for ( ; dit.current(); ++dit ) {
729 if( dit.current()->name() == it->text(0)) { 729 if( dit.current()->name() == it->text(0)) {
730 if(QFileInfo( dit.current()->file()).exists()) 730 if(QFileInfo( dit.current()->file()).exists())
731 d->selectedFiles->addToSelection( **dit ); 731 d->selectedFiles->addToSelection( **dit );
732 } 732 }
733 } 733 }
734 } 734 }
735 break; 735 break;
736 case 0: 736 case 0:
737 break; 737 break;
738 }; 738 };
739 tabWidget->setCurrentPage(0); 739 tabWidget->setCurrentPage(0);
740 } 740 }
741} 741}
742 742
743void PlayListWidget::tabChanged(QWidget *) { 743void PlayListWidget::tabChanged(QWidget *) {
744 744
745 switch ( tabWidget->currentPageIndex()) { 745 switch ( tabWidget->currentPageIndex()) {
746 case 0: 746 case 0:
747 { 747 {
748 if( !tbDeletePlaylist->isHidden()) 748 if( !tbDeletePlaylist->isHidden())
749 tbDeletePlaylist->hide(); 749 tbDeletePlaylist->hide();
750 d->tbRemoveFromList->setEnabled(TRUE); 750 d->tbRemoveFromList->setEnabled(TRUE);
751 d->tbAddToList->setEnabled(FALSE); 751 d->tbAddToList->setEnabled(FALSE);
752 } 752 }
753 break; 753 break;
754 case 1: 754 case 1:
755 { 755 {
756 audioView->clear(); 756 audioView->clear();
757 populateAudioView(); 757 populateAudioView();
758 758
759 if( !tbDeletePlaylist->isHidden()) 759 if( !tbDeletePlaylist->isHidden())
760 tbDeletePlaylist->hide(); 760 tbDeletePlaylist->hide();
761 d->tbRemoveFromList->setEnabled(FALSE); 761 d->tbRemoveFromList->setEnabled(FALSE);
762 d->tbAddToList->setEnabled(TRUE); 762 d->tbAddToList->setEnabled(TRUE);
763 } 763 }
764 break; 764 break;
765 case 2: 765 case 2:
766 { 766 {
767 videoView->clear(); 767 videoView->clear();
768 populateVideoView(); 768 populateVideoView();
769 if( !tbDeletePlaylist->isHidden()) 769 if( !tbDeletePlaylist->isHidden())
770 tbDeletePlaylist->hide(); 770 tbDeletePlaylist->hide();
771 d->tbRemoveFromList->setEnabled(FALSE); 771 d->tbRemoveFromList->setEnabled(FALSE);
772 d->tbAddToList->setEnabled(TRUE); 772 d->tbAddToList->setEnabled(TRUE);
773 } 773 }
774 break; 774 break;
775 case 3: 775 case 3:
776 { 776 {
777 if( tbDeletePlaylist->isHidden()) 777 if( tbDeletePlaylist->isHidden())
778 tbDeletePlaylist->show(); 778 tbDeletePlaylist->show();
779 playLists->reread(); 779 playLists->reread();
780 } 780 }
781 break; 781 break;
782 }; 782 };
783} 783}
784 784
785void PlayListWidget::btnPlay(bool b) { 785void PlayListWidget::btnPlay(bool b) {
786 786
787 // mediaPlayerState->setPlaying(b); 787 // mediaPlayerState->setPlaying(b);
788 switch ( tabWidget->currentPageIndex()) { 788 switch ( tabWidget->currentPageIndex()) {
789 case 0: 789 case 0:
790 { 790 {
791 mediaPlayerState->setPlaying(b); 791 mediaPlayerState->setPlaying(b);
792 } 792 }
793 break; 793 break;
794 case 1: 794 case 1:
795 { 795 {
796 addToSelection( audioView->currentItem() ); 796 addToSelection( audioView->currentItem() );
797 mediaPlayerState->setPlaying(b); 797 mediaPlayerState->setPlaying(b);
798 d->selectedFiles->removeSelected( ); 798 d->selectedFiles->removeSelected( );
799 tabWidget->setCurrentPage(1); 799 tabWidget->setCurrentPage(1);
800 d->selectedFiles->unSelect(); 800 d->selectedFiles->unSelect();
801 insanityBool=FALSE; 801 insanityBool=FALSE;
802 }// audioView->clearSelection(); 802 }// audioView->clearSelection();
803 break; 803 break;
804 case 2: 804 case 2:
805 { 805 {
806 addToSelection( videoView->currentItem() ); 806 addToSelection( videoView->currentItem() );
807 mediaPlayerState->setPlaying(b); 807 mediaPlayerState->setPlaying(b);
808 qApp->processEvents(); 808 qApp->processEvents();
809 d->selectedFiles->removeSelected( ); 809 d->selectedFiles->removeSelected( );
810 tabWidget->setCurrentPage(2); 810 tabWidget->setCurrentPage(2);
811 d->selectedFiles->unSelect(); 811 d->selectedFiles->unSelect();
812 insanityBool=FALSE; 812 insanityBool=FALSE;
813 }// videoView->clearSelection(); 813 }// videoView->clearSelection();
814 break; 814 break;
815 }; 815 };
816 816
817} 817}
818 818
819void PlayListWidget::deletePlaylist() { 819void PlayListWidget::deletePlaylist() {
820 switch( QMessageBox::information( this, (tr("Remove Playlist?")), 820 switch( QMessageBox::information( this, (tr("Remove Playlist?")),
821 (tr("You really want to delete\nthis playlist?")), 821 (tr("You really want to delete\nthis playlist?")),
822 (tr("Yes")), (tr("No")), 0 )){ 822 (tr("Yes")), (tr("No")), 0 )){
823 case 0: // Yes clicked, 823 case 0: // Yes clicked,
824 QFile().remove(playLists->selected()->file()); 824 QFile().remove(playLists->selected()->file());
825 QFile().remove(playLists->selected()->linkFile()); 825 QFile().remove(playLists->selected()->linkFile());
826 playLists->reread(); 826 playLists->reread();
827 break; 827 break;
828 case 1: // Cancel 828 case 1: // Cancel
829 break; 829 break;
830 }; 830 };
831} 831}
832 832
833void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) { 833void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) {
834 switch (mouse) { 834 switch (mouse) {
835 case 1: 835 case 1:
836 break; 836 break;
837 case 2:{ 837 case 2:{
838 QPopupMenu m; 838 QPopupMenu m;
839 m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); 839 m.insertItem( tr( "Play" ), this, SLOT( playSelected() ));
840 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); 840 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() ));
841 m.insertSeparator(); 841 m.insertSeparator();
842 m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); 842 m.insertItem( tr( "Properties" ), this, SLOT( listDelete() ));
843 m.exec( QCursor::pos() ); 843 m.exec( QCursor::pos() );
844 } 844 }
845 break; 845 break;
846 }; 846 };
847} 847}
848 848
849void PlayListWidget::playSelected() { 849void PlayListWidget::playSelected() {
850 btnPlay( TRUE); 850 btnPlay( TRUE);
851} 851}
852 852
853void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) { 853void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) {
854 switch (mouse) { 854 switch (mouse) {
855 case 1: 855 case 1:
856 856
857 break; 857 break;
858 case 2: 858 case 2:
859 { 859 {
860 QPopupMenu m; 860 QPopupMenu m;
861 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); 861 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() ));
862 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); 862 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() ));
863 m.exec( QCursor::pos() ); 863 m.exec( QCursor::pos() );
864 } 864 }
865 break; 865 break;
866 }; 866 };
867} 867}
868 868
869void PlayListWidget::listDelete() { 869void PlayListWidget::listDelete() {
870 Config cfg( "OpiePlayer" ); 870 Config cfg( "OpiePlayer" );
871 cfg.setGroup("PlayList"); 871 cfg.setGroup("PlayList");
872 QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); 872 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","");
873 QString file; 873 QString file;
874 // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); 874 // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
875 switch ( tabWidget->currentPageIndex()) { 875 switch ( tabWidget->currentPageIndex()) {
876 case 0: 876 case 0:
877 break; 877 break;
878 case 1: 878 case 1:
879 { 879 {
880 file = audioView->currentItem()->text(0); 880 file = audioView->currentItem()->text(0);
881 QListIterator<DocLnk> Pdit( files.children() ); 881 QListIterator<DocLnk> Pdit( files.children() );
882 for ( ; Pdit.current(); ++Pdit ) { 882 for ( ; Pdit.current(); ++Pdit ) {
883 if( Pdit.current()->name() == file) { 883 if( Pdit.current()->name() == file) {
884 LnkProperties prop( Pdit.current() ); 884 LnkProperties prop( Pdit.current() );
885 prop.showMaximized(); 885 prop.showMaximized();
886 prop.exec(); 886 prop.exec();
887 } 887 }
888 } 888 }
889 populateAudioView(); 889 populateAudioView();
890 } 890 }
891 break; 891 break;
892 case 2: 892 case 2:
893 { 893 {
894 894
895 } 895 }
896 break; 896 break;
897 }; 897 };
898} 898}
899 899
900void PlayListWidget::scanForAudio() { 900void PlayListWidget::scanForAudio() {
901 qDebug("scan for audio"); 901 qDebug("scan for audio");
902 files.detachChildren(); 902 files.detachChildren();
903 QListIterator<DocLnk> sdit( files.children() ); 903 QListIterator<DocLnk> sdit( files.children() );
904 for ( ; sdit.current(); ++sdit ) { 904 for ( ; sdit.current(); ++sdit ) {
905 delete sdit.current(); 905 delete sdit.current();
906 } 906 }
907 Global::findDocuments(&files, "audio/*"); 907 Global::findDocuments(&files, "audio/*");
908 audioScan = TRUE; 908 audioScan = TRUE;
909} 909}
910 910
911void PlayListWidget::scanForVideo() { 911void PlayListWidget::scanForVideo() {
912 qDebug("scan for video"); 912 qDebug("scan for video");
913 vFiles.detachChildren(); 913 vFiles.detachChildren();
914 QListIterator<DocLnk> sdit( vFiles.children() ); 914 QListIterator<DocLnk> sdit( vFiles.children() );
915 for ( ; sdit.current(); ++sdit ) { 915 for ( ; sdit.current(); ++sdit ) {
916 delete sdit.current(); 916 delete sdit.current();
917 } 917 }
918 Global::findDocuments(&vFiles, "video/*"); 918 Global::findDocuments(&vFiles, "video/*");
919 videoScan = TRUE; 919 videoScan = TRUE;
920} 920}
921 921
922void PlayListWidget::populateAudioView() { 922void PlayListWidget::populateAudioView() {
923 923
924 audioView->clear(); 924 audioView->clear();
925 StorageInfo storageInfo; 925 StorageInfo storageInfo;
926 const QList<FileSystem> &fs = storageInfo.fileSystems(); 926 const QList<FileSystem> &fs = storageInfo.fileSystems();
927 if(!audioScan) scanForAudio(); 927 if(!audioScan) scanForAudio();
928 928
929 QListIterator<DocLnk> dit( files.children() ); 929 QListIterator<DocLnk> dit( files.children() );
930 QListIterator<FileSystem> it ( fs ); 930 QListIterator<FileSystem> it ( fs );
931 931
932 QString storage; 932 QString storage;
933 for ( ; dit.current(); ++dit ) { 933 for ( ; dit.current(); ++dit ) {
934 for( ; it.current(); ++it ){ 934 for( ; it.current(); ++it ){
935 const QString name = (*it)->name(); 935 const QString name = (*it)->name();
936 const QString path = (*it)->path(); 936 const QString path = (*it)->path();
937 if(dit.current()->file().find(path) != -1 ) storage=name; 937 if(dit.current()->file().find(path) != -1 ) storage=name;
938 } 938 }
939 939
940 QListViewItem * newItem; 940 QListViewItem * newItem;
941 if ( QFile( dit.current()->file()).exists() ) { 941 if ( QFile( dit.current()->file()).exists() ) {
942 // qDebug(dit.current()->name()); 942 // qDebug(dit.current()->name());
943 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), 943 newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(),
944 QString::number( QFile( dit.current()->file()).size() ), storage); 944 QString::number( QFile( dit.current()->file()).size() ), storage);
945 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/musicfile" )); 945 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/musicfile" ));
946 } 946 }
947 } 947 }
948 948
949} 949}
950 950
951void PlayListWidget::populateVideoView() { 951void PlayListWidget::populateVideoView() {
952 videoView->clear(); 952 videoView->clear();
953 StorageInfo storageInfo; 953 StorageInfo storageInfo;
954 const QList<FileSystem> &fs = storageInfo.fileSystems(); 954 const QList<FileSystem> &fs = storageInfo.fileSystems();
955 955
956 if(!videoScan ) scanForVideo(); 956 if(!videoScan ) scanForVideo();
957 957
958 QListIterator<DocLnk> Vdit( vFiles.children() ); 958 QListIterator<DocLnk> Vdit( vFiles.children() );
959 QListIterator<FileSystem> it ( fs ); 959 QListIterator<FileSystem> it ( fs );
960 videoView->clear(); 960 videoView->clear();
961 QString storage; 961 QString storage;
962 for ( ; Vdit.current(); ++Vdit ) { 962 for ( ; Vdit.current(); ++Vdit ) {
963 for( ; it.current(); ++it ){ 963 for( ; it.current(); ++it ){
964 const QString name = (*it)->name(); 964 const QString name = (*it)->name();
965 const QString path = (*it)->path(); 965 const QString path = (*it)->path();
966 if( Vdit.current()->file().find(path) != -1 ) storage=name; 966 if( Vdit.current()->file().find(path) != -1 ) storage=name;
967 } 967 }
968 968
969 QListViewItem * newItem; 969 QListViewItem * newItem;
970 if ( QFile( Vdit.current()->file()).exists() ) { 970 if ( QFile( Vdit.current()->file()).exists() ) {
971 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), 971 newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(),
972 QString::number( QFile( Vdit.current()->file()).size() ), storage); 972 QString::number( QFile( Vdit.current()->file()).size() ), storage);
973 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" )); 973 newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ));
974 } 974 }
975 } 975 }
976} 976}
977 977
978void PlayListWidget::openFile() { 978void PlayListWidget::openFile() {
979 QString filename, name; 979 QString filename, name;
980 InputDialog *fileDlg; 980 InputDialog *fileDlg;
981 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); 981 fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0);
982 fileDlg->exec(); 982 fileDlg->exec();
983 if( fileDlg->result() == 1 ) { 983 if( fileDlg->result() == 1 ) {
984 filename = fileDlg->LineEdit1->text(); 984 filename = fileDlg->LineEdit1->text();
985 985
986 qDebug("Selected filename is "+filename); 986 qDebug("Selected filename is "+filename);
987 if(filename.right(3) == "m3u") { 987 if(filename.right(3) == "m3u") {
988 readm3u( filename ); 988 readm3u( filename );
989 } else if(filename.right(3) == "pls") { 989 } else if(filename.right(3) == "pls") {
990 readPls( filename ); 990 readPls( filename );
991 } else { 991 } else {
992 DocLnk lnk; 992 DocLnk lnk;
993 993
994 lnk.setName(filename); //sets file name 994 lnk.setName(filename); //sets file name
995 lnk.setFile(filename); //sets File property 995 lnk.setFile(filename); //sets File property
996 lnk.setType("audio/x-mpegurl"); 996 lnk.setType("audio/x-mpegurl");
997 lnk.setExec("opieplayer"); 997 lnk.setExec("opieplayer");
998 lnk.setIcon("opieplayer2/MPEGPlayer"); 998 lnk.setIcon("opieplayer2/MPEGPlayer");
999 999
1000 if(!lnk.writeLink()) { 1000 if(!lnk.writeLink()) {
1001 qDebug("Writing doclink did not work"); 1001 qDebug("Writing doclink did not work");
1002 } 1002 }
1003 d->selectedFiles->addToSelection( lnk); 1003 d->selectedFiles->addToSelection( lnk);
1004 } 1004 }
1005 } 1005 }
1006 if(fileDlg) { 1006 if(fileDlg) {
1007 delete fileDlg; 1007 delete fileDlg;
1008 } 1008 }
1009} 1009}
1010 1010
1011void PlayListWidget::keyReleaseEvent( QKeyEvent *e) 1011void PlayListWidget::keyReleaseEvent( QKeyEvent *e)
1012{ 1012{
1013 switch ( e->key() ) { 1013 switch ( e->key() ) {
1014 ////////////////////////////// Zaurus keys 1014 ////////////////////////////// Zaurus keys
1015 case Key_F9: //activity 1015 case Key_F9: //activity
1016 // if(audioUI->isHidden()) 1016 // if(audioUI->isHidden())
1017 // audioUI->showMaximized(); 1017 // audioUI->showMaximized();
1018 break; 1018 break;
1019 case Key_F10: //contacts 1019 case Key_F10: //contacts
1020 // if( videoUI->isHidden()) 1020 // if( videoUI->isHidden())
1021 // videoUI->showMaximized(); 1021 // videoUI->showMaximized();
1022 break; 1022 break;
1023 case Key_F11: //menu 1023 case Key_F11: //menu
1024 break; 1024 break;
1025 case Key_F12: //home 1025 case Key_F12: //home
1026 // doBlank(); 1026 // doBlank();
1027 break; 1027 break;
1028 case Key_F13: //mail 1028 case Key_F13: //mail
1029 // doUnblank(); 1029 // doUnblank();
1030 break; 1030 break;
1031 case Key_Q: //add to playlist 1031 case Key_Q: //add to playlist
1032 qDebug("Add"); 1032 qDebug("Add");
1033 addSelected(); 1033 addSelected();
1034 break; 1034 break;
1035 case Key_R: //remove from playlist 1035 case Key_R: //remove from playlist
1036 removeSelected(); 1036 removeSelected();
1037 break; 1037 break;
1038 // case Key_P: //play 1038 // case Key_P: //play
1039 // qDebug("Play"); 1039 // qDebug("Play");
1040 // playSelected(); 1040 // playSelected();
1041 // break; 1041 // break;
1042 case Key_Space: 1042 case Key_Space:
1043 qDebug("Play"); 1043 qDebug("Play");
1044 // playSelected(); puh 1044 // playSelected(); puh
1045 break; 1045 break;
1046 case Key_1: 1046 case Key_1:
1047 tabWidget->setCurrentPage(0); 1047 tabWidget->setCurrentPage(0);
1048 break; 1048 break;
1049 case Key_2: 1049 case Key_2:
1050 tabWidget->setCurrentPage(1); 1050 tabWidget->setCurrentPage(1);
1051 break; 1051 break;
1052 case Key_3: 1052 case Key_3:
1053 tabWidget->setCurrentPage(2); 1053 tabWidget->setCurrentPage(2);
1054 break; 1054 break;
1055 case Key_4: 1055 case Key_4:
1056 tabWidget->setCurrentPage(3); 1056 tabWidget->setCurrentPage(3);
1057 break; 1057 break;
1058 case Key_Down: 1058 case Key_Down:
1059 if ( !d->selectedFiles->next() ) 1059 if ( !d->selectedFiles->next() )
1060 d->selectedFiles->first(); 1060 d->selectedFiles->first();
1061 1061
1062 break; 1062 break;
1063 case Key_Up: 1063 case Key_Up:
1064 if ( !d->selectedFiles->prev() ) 1064 if ( !d->selectedFiles->prev() )
1065 // d->selectedFiles->last(); 1065 // d->selectedFiles->last();
1066 1066
1067 break; 1067 break;
1068 1068
1069 } 1069 }
1070} 1070}
1071 1071
1072void PlayListWidget::keyPressEvent( QKeyEvent *) 1072void PlayListWidget::keyPressEvent( QKeyEvent *)
1073{ 1073{
1074 // qDebug("Key press"); 1074 // qDebug("Key press");
1075 // switch ( e->key() ) { 1075 // switch ( e->key() ) {
1076 // ////////////////////////////// Zaurus keys 1076 // ////////////////////////////// Zaurus keys
1077 // case Key_A: //add to playlist 1077 // case Key_A: //add to playlist
1078 // qDebug("Add"); 1078 // qDebug("Add");
1079 // addSelected(); 1079 // addSelected();
1080 // break; 1080 // break;
1081 // case Key_R: //remove from playlist 1081 // case Key_R: //remove from playlist
1082 // removeSelected(); 1082 // removeSelected();
1083 // break; 1083 // break;
1084 // case Key_P: //play 1084 // case Key_P: //play
1085 // qDebug("Play"); 1085 // qDebug("Play");
1086 // playSelected(); 1086 // playSelected();
1087 // break; 1087 // break;
1088 // case Key_Space: 1088 // case Key_Space:
1089 // qDebug("Play"); 1089 // qDebug("Play");
1090 // playSelected(); 1090 // playSelected();
1091 // break; 1091 // break;
1092 // } 1092 // }
1093} 1093}
1094 1094
1095 1095
1096 1096
1097void PlayListWidget::readm3u(const QString &filename) { 1097void PlayListWidget::readm3u(const QString &filename) {
1098 1098
1099 qDebug("m3u filename is "+filename); 1099 qDebug("m3u filename is "+filename);
1100 QFile f(filename); 1100 QFile f(filename);
1101 1101
1102 if(f.open(IO_ReadOnly)) { 1102 if(f.open(IO_ReadOnly)) {
1103 QTextStream t(&f); 1103 QTextStream t(&f);
1104 QString s;//, first, second; 1104 QString s;//, first, second;
1105 int i=0; 1105 int i=0;
1106 while ( !t.atEnd()) { 1106 while ( !t.atEnd()) {
1107 s=t.readLine(); 1107 s=t.readLine();
1108 1108
1109 if(s.find("#",0,TRUE) == -1) { 1109 if(s.find("#",0,TRUE) == -1) {
1110 if(s.find(" ",0,TRUE) == -1) { // not sure if this is neede since cf uses vfat 1110 if(s.find(" ",0,TRUE) == -1) { // not sure if this is neede since cf uses vfat
1111 if(s.left(2) == "E:" || s.left(2) == "P:") { 1111 if(s.left(2) == "E:" || s.left(2) == "P:") {
1112 s=s.right(s.length()-2); 1112 s=s.right(s.length()-2);
1113 // if(QFile(s).exists()) { 1113 // if(QFile(s).exists()) {
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 // } 1124 // }
1125 } else { // is url 1125 } else { // is url
1126 s.replace(QRegExp("%20")," "); 1126 s.replace(QRegExp("%20")," ");
1127 DocLnk lnk( s ); 1127 DocLnk lnk( s );
1128 QString name; 1128 QString name;
1129 if(name.left(4)=="http") { 1129 if(name.left(4)=="http") {
1130 name = s.right( s.length() - 7); 1130 name = s.right( s.length() - 7);
1131 } else { 1131 } else {
1132 name = s; 1132 name = s;
1133 } 1133 }
1134 lnk.setName(name); 1134 lnk.setName(name);
1135 if(s.at(s.length()-4) == '.') { 1135 if(s.at(s.length()-4) == '.') {
1136 lnk.setFile( s); 1136 lnk.setFile( s);
1137 } else { 1137 } else {
1138 lnk.setFile( s+"/"); 1138 lnk.setFile( s+"/");
1139 } 1139 }
1140 lnk.setType("audio/x-mpegurl"); 1140 lnk.setType("audio/x-mpegurl");
1141 lnk.writeLink(); 1141 lnk.writeLink();
1142 d->selectedFiles->addToSelection( lnk); 1142 d->selectedFiles->addToSelection( lnk);
1143 } 1143 }
1144 i++; 1144 i++;
1145 } 1145 }
1146 } 1146 }
1147 } 1147 }
1148 } 1148 }
1149 f.close(); 1149 f.close();
1150} 1150}
1151 1151
1152void PlayListWidget::writem3u() { 1152void PlayListWidget::writem3u() {
1153 1153
1154 InputDialog *fileDlg; 1154 InputDialog *fileDlg;
1155 fileDlg = new InputDialog(this,tr("Save m3u Playlist "),TRUE, 0); 1155 fileDlg = new InputDialog(this,tr("Save m3u Playlist "),TRUE, 0);
1156 fileDlg->exec(); 1156 fileDlg->exec();
1157 QString filename,list; 1157 QString filename,list;
1158 if( fileDlg->result() == 1 ) { 1158 if( fileDlg->result() == 1 ) {
1159 filename = fileDlg->LineEdit1->text(); 1159 filename = fileDlg->LineEdit1->text();
1160 qDebug(filename); 1160 qDebug(filename);
1161 int noOfFiles = 0; 1161 int noOfFiles = 0;
1162 d->selectedFiles->first(); 1162 d->selectedFiles->first();
1163 do { 1163 do {
1164 // we dont check for existance because of url's 1164 // we dont check for existance because of url's
1165 // qDebug(d->selectedFiles->current()->file()); 1165 // qDebug(d->selectedFiles->current()->file());
1166 list += d->selectedFiles->current()->file()+"\n"; 1166 list += d->selectedFiles->current()->file()+"\n";
1167 noOfFiles++; 1167 noOfFiles++;
1168 } 1168 }
1169 while ( d->selectedFiles->next() ); 1169 while ( d->selectedFiles->next() );
1170 qDebug(list); 1170 qDebug(list);
1171 if(filename.left(1) != "/") 1171 if(filename.left(1) != "/")
1172 filename=QPEApplication::documentDir()+"/"+filename; 1172 filename=QPEApplication::documentDir()+"/"+filename;
1173 if(filename.right(3) != "m3u") 1173 if(filename.right(3) != "m3u")
1174 filename=filename+".m3u"; 1174 filename=filename+".m3u";
1175 1175
1176 QFile f(filename); 1176 QFile f(filename);
1177 f.open(IO_WriteOnly); 1177 f.open(IO_WriteOnly);
1178 f.writeBlock(list, list.length()); 1178 f.writeBlock(list, list.length());
1179 f.close(); 1179 f.close();
1180 } 1180 }
1181 if(fileDlg) delete fileDlg; 1181 if(fileDlg) delete fileDlg;
1182} 1182}
1183 1183
1184void PlayListWidget::readPls(const QString &filename) { 1184void PlayListWidget::readPls(const QString &filename) {
1185 1185
1186 qDebug("pls filename is "+filename); 1186 qDebug("pls filename is "+filename);
1187 QFile f(filename); 1187 QFile f(filename);
1188 1188
1189 if(f.open(IO_ReadOnly)) { 1189 if(f.open(IO_ReadOnly)) {
1190 QTextStream t(&f); 1190 QTextStream t(&f);
1191 QString s;//, first, second; 1191 QString s;//, first, second;
1192 int i=0; 1192 int i=0;
1193 while ( !t.atEnd()) { 1193 while ( !t.atEnd()) {
1194 s=t.readLine(); 1194 s=t.readLine();
1195 if(s.left(4) == "File") { 1195 if(s.left(4) == "File") {
1196 s=s.right(s.length() - 6); 1196 s=s.right(s.length() - 6);
1197 s.replace(QRegExp("%20")," "); 1197 s.replace(QRegExp("%20")," ");
1198 qDebug("adding "+s+" to playlist"); 1198 qDebug("adding "+s+" to playlist");
1199 // numberofentries=2 1199 // numberofentries=2
1200 // File1=http 1200 // File1=http
1201 // Title 1201 // Title
1202 // Length 1202 // Length
1203 // Version 1203 // Version
1204 // File2=http 1204 // File2=http
1205 s=s.replace( QRegExp("\\"),"/"); 1205 s=s.replace( QRegExp("\\"),"/");
1206 DocLnk lnk( s ); 1206 DocLnk lnk( s );
1207 QFileInfo f(s); 1207 QFileInfo f(s);
1208 QString name = f.baseName(); 1208 QString name = f.baseName();
1209 if(name.left(4)=="http") 1209 if(name.left(4)=="http")
1210 name = s.right( s.length() - 7); 1210 name = s.right( s.length() - 7);
1211 else 1211 else
1212 name=s; 1212 name=s;
1213 name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); 1213 name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1);
1214 lnk.setName( name); 1214 lnk.setName( name);
1215 if(s.at(s.length()-4) == '.') // if this is probably a file 1215 if(s.at(s.length()-4) == '.') // if this is probably a file
1216 lnk.setFile( s); 1216 lnk.setFile( s);
1217 else { //if its a url 1217 else { //if its a url
1218 if( name.right(1).find('/') == -1) 1218 if( name.right(1).find('/') == -1)
1219 s+="/"; 1219 s+="/";
1220 lnk.setFile( s); 1220 lnk.setFile( s);
1221 } 1221 }
1222 lnk.setType("audio/x-mpegurl"); 1222 lnk.setType("audio/x-mpegurl");
1223 1223
1224 qDebug("DocLnk add "+name); 1224 qDebug("DocLnk add "+name);
1225 d->selectedFiles->addToSelection( lnk); 1225 d->selectedFiles->addToSelection( lnk);
1226 } 1226 }
1227 } 1227 }
1228 i++; 1228 i++;
1229 } 1229 }
1230} 1230}
1231 1231
1232void PlayListWidget::pmViewActivated(int index) { 1232void PlayListWidget::pmViewActivated(int index) {
1233 qDebug("%d", index); 1233 qDebug("%d", index);
1234 switch(index) { 1234 switch(index) {
1235 case -16: 1235 case -16:
1236 { 1236 {
1237 1237
1238 mediaPlayerState->toggleFullscreen(); 1238 mediaPlayerState->toggleFullscreen();
1239 bool b=mediaPlayerState->fullscreen(); 1239 bool b=mediaPlayerState->fullscreen();
1240 pmView->setItemChecked( index,b); 1240 pmView->setItemChecked( index,b);
1241 Config cfg( "OpiePlayer" ); 1241 Config cfg( "OpiePlayer" );
1242 cfg.writeEntry("FullScreen", b); 1242 cfg.writeEntry("FullScreen", b);
1243 1243
1244 } 1244 }
1245 break; 1245 break;
1246 }; 1246 };
1247} 1247}
1248 1248
1249void PlayListWidget::populateSkinsMenu() { 1249void PlayListWidget::populateSkinsMenu() {
1250 int item=0; 1250 int item=0;
1251 defaultSkinIndex=0; 1251 defaultSkinIndex=0;
1252 QString skinName; 1252 QString skinName;
1253 Config cfg( "OpiePlayer" ); 1253 Config cfg( "OpiePlayer" );
1254 cfg.setGroup("Options"); 1254 cfg.setGroup("Options");
1255 QString skin = cfg.readEntry("Skin","default"); 1255 QString skin = cfg.readEntry("Skin","default");
1256 1256
1257 QDir skinsDir(QPEApplication::qpeDir()+"/pics/opieplayer2/skins"); 1257 QDir skinsDir(QPEApplication::qpeDir()+"/pics/opieplayer2/skins");
1258 skinsDir.setFilter( QDir::Dirs); 1258 skinsDir.setFilter( QDir::Dirs);
1259 skinsDir.setSorting(QDir::Name); 1259 skinsDir.setSorting(QDir::Name);
1260 const QFileInfoList *skinslist = skinsDir.entryInfoList(); 1260 const QFileInfoList *skinslist = skinsDir.entryInfoList();
1261 QFileInfoListIterator it( *skinslist ); 1261 QFileInfoListIterator it( *skinslist );
1262 QFileInfo *fi; 1262 QFileInfo *fi;
1263 while ( (fi=it.current()) ) { 1263 while ( (fi=it.current()) ) {
1264 skinName = fi->fileName(); 1264 skinName = fi->fileName();
1265 qDebug( fi->fileName()); 1265 qDebug( fi->fileName());
1266 if( skinName != "." && skinName != ".." && skinName !="CVS") 1266 if( skinName != "." && skinName != ".." && skinName !="CVS")
1267 item = skinsMenu->insertItem( fi->fileName()); 1267 item = skinsMenu->insertItem( fi->fileName());
1268 if( skinName == "default") 1268 if( skinName == "default")
1269 defaultSkinIndex = item; 1269 defaultSkinIndex = item;
1270 if( skinName == skin) 1270 if( skinName == skin)
1271 skinsMenu->setItemChecked( item, TRUE); 1271 skinsMenu->setItemChecked( item, TRUE);
1272 1272
1273 ++it; 1273 ++it;
1274 } 1274 }
1275} 1275}
1276 1276
1277void PlayListWidget::skinsMenuActivated(int item) { 1277void PlayListWidget::skinsMenuActivated(int item) {
1278 for(int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i--) { 1278 for(int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i--) {
1279 skinsMenu->setItemChecked( i, FALSE); 1279 skinsMenu->setItemChecked( i, FALSE);
1280 } 1280 }
1281 skinsMenu->setItemChecked( item, TRUE); 1281 skinsMenu->setItemChecked( item, TRUE);
1282 1282
1283 Config cfg( "OpiePlayer" ); 1283 Config cfg( "OpiePlayer" );
1284 cfg.setGroup("Options"); 1284 cfg.setGroup("Options");
1285 cfg.writeEntry("Skin", skinsMenu->text( item)); 1285 cfg.writeEntry("Skin", skinsMenu->text( item));
1286} 1286}
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index c03ea16..766ece2 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -1,201 +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
42extern MediaPlayerState *mediaPlayerState; 42extern MediaPlayerState *mediaPlayerState;
43extern VideoWidget *videoUI; 43extern VideoWidget *videoUI;
44XineControl::XineControl( QObject *parent, const char *name ) 44XineControl::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
59XineControl::~XineControl() { 59XineControl::~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
70void XineControl::play( const QString& fileName ) { 70void 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 qDebug("<<FILENAME: " + fileName + ">>>>"); 74 qDebug("<<FILENAME: " + fileName + ">>>>");
75 libXine->play( fileName ); 75 libXine->play( fileName );
76 mediaPlayerState->setPlaying( true ); 76 mediaPlayerState->setPlaying( true );
77 // default to audio view until we know how to handle video 77 // default to audio view until we know how to handle video
78 // MediaDetect mdetect; 78 // MediaDetect mdetect;
79 char whichGui = mdetect.videoOrAudio( fileName ); 79 char whichGui = mdetect.videoOrAudio( fileName );
80 if (whichGui == 'f') { 80 if (whichGui == 'f') {
81 qDebug("Nicht erkannter Dateityp"); 81 qDebug("Nicht erkannter Dateityp");
82 return; 82 return;
83 } 83 }
84 84
85 if (whichGui == 'a') { 85 if (whichGui == 'a') {
86 libXine->setShowVideo( false ); 86 libXine->setShowVideo( false );
87 hasAudioChannel=TRUE; 87 hasAudioChannel=TRUE;
88 } else { 88 } else {
89 libXine->setShowVideo( true ); 89 libXine->setShowVideo( true );
90 hasVideoChannel=TRUE; 90 hasVideoChannel=TRUE;
91 } 91 }
92 92
93 // determine if slider is shown 93 // determine if slider is shown
94 // mediaPlayerState->setIsStreaming( mdetect.isStreaming( fileName ) );
95 mediaPlayerState->setIsStreaming( !libXine->isSeekable() ); 94 mediaPlayerState->setIsStreaming( !libXine->isSeekable() );
96 // which gui (video / audio) 95 // which gui (video / audio)
97 mediaPlayerState->setView( whichGui ); 96 mediaPlayerState->setView( whichGui );
98 97
99#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 98#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
100 if ( !disabledSuspendScreenSaver ) { 99 if ( !disabledSuspendScreenSaver ) {
101 disabledSuspendScreenSaver = TRUE; 100 disabledSuspendScreenSaver = TRUE;
102 // Stop the screen from blanking and power saving state 101 // Stop the screen from blanking and power saving state
103 QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) 102 QCopEnvelope("QPE/System", "setScreenSaverMode(int)" )
104 << ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend ); 103 << ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend );
105 } 104 }
106#endif 105#endif
107 106
108 length(); 107 length();
109 position(); 108 position();
110} 109}
111 110
112void XineControl::nextMedia() { 111void XineControl::nextMedia() {
113 mediaPlayerState->setNext(); 112 mediaPlayerState->setNext();
114} 113}
115 114
116void XineControl::stop( bool isSet ) { 115void XineControl::stop( bool isSet ) {
117 if ( !isSet) { 116 if ( !isSet) {
118 libXine->stop( ); 117 libXine->stop( );
119 mediaPlayerState->setList(); 118 mediaPlayerState->setList();
120 // mediaPlayerState->setPlaying( false ); 119 // mediaPlayerState->setPlaying( false );
121 120
122#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 121#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
123 if ( disabledSuspendScreenSaver ) { 122 if ( disabledSuspendScreenSaver ) {
124 disabledSuspendScreenSaver = FALSE; 123 disabledSuspendScreenSaver = FALSE;
125 // Re-enable the suspend mode 124 // Re-enable the suspend mode
126 QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 125 QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
127 } 126 }
128#endif 127#endif
129 128
130 } else { 129 } else {
131 // play again 130 // play again
132 } 131 }
133} 132}
134 133
135/** 134/**
136 * Pause playback 135 * Pause playback
137 * @isSet 136 * @isSet
138 */ 137 */
139void XineControl::pause( bool isSet) { 138void XineControl::pause( bool isSet) {
140 if (isSet) { 139 if (isSet) {
141 libXine->pause(); 140 libXine->pause();
142 } else { 141 } else {
143 libXine->play( m_fileName, 0, m_currentTime); 142 libXine->play( m_fileName, 0, m_currentTime);
144 } 143 }
145} 144}
146 145
147 146
148/** 147/**
149 * get current time in playback 148 * get current time in playback
150 */ 149 */
151long XineControl::currentTime() { 150long XineControl::currentTime() {
152 // todo: jede sekunde überprüfen 151 // todo: jede sekunde überprüfen
153 m_currentTime = libXine->currentTime(); 152 m_currentTime = libXine->currentTime();
154 return m_currentTime; 153 return m_currentTime;
155 QTimer::singleShot( 1000, this, SLOT( currentTime() ) ); 154 QTimer::singleShot( 1000, this, SLOT( currentTime() ) );
156} 155}
157 156
158/** 157/**
159 * Set the length of the media file 158 * Set the length of the media file
160 */ 159 */
161void XineControl::length() { 160void XineControl::length() {
162 m_length = libXine->length(); 161 m_length = libXine->length();
163 mediaPlayerState->setLength( m_length ); 162 mediaPlayerState->setLength( m_length );
164} 163}
165 164
166 165
167/** 166/**
168 * Reports the position the xine backend is at right now 167 * Reports the position the xine backend is at right now
169 * @return long the postion in seconds 168 * @return long the postion in seconds
170 */ 169 */
171long XineControl::position() { 170long XineControl::position() {
172 m_position = ( currentTime() ); 171 m_position = ( currentTime() );
173 mediaPlayerState->updatePosition( m_position ); 172 mediaPlayerState->updatePosition( m_position );
174 long emitPos = (long)m_position; 173 long emitPos = (long)m_position;
175 emit positionChanged( emitPos ); 174 emit positionChanged( emitPos );
176 if(mediaPlayerState->isPlaying) 175 if(mediaPlayerState->isPlaying)
177 // needs to be stopped the media is stopped 176 // needs to be stopped the media is stopped
178 QTimer::singleShot( 1000, this, SLOT( position() ) ); 177 QTimer::singleShot( 1000, this, SLOT( position() ) );
179// qDebug("POSITION : %d", m_position); 178// qDebug("POSITION : %d", m_position);
180 return m_position; 179 return m_position;
181} 180}
182 181
183/** 182/**
184 * Set videoplayback to fullscreen 183 * Set videoplayback to fullscreen
185 * @param isSet 184 * @param isSet
186 */ 185 */
187void XineControl::setFullscreen( bool isSet ) { 186void XineControl::setFullscreen( bool isSet ) {
188 libXine->showVideoFullScreen( isSet); 187 libXine->showVideoFullScreen( isSet);
189} 188}
190 189
191/** 190/**
192 * Seek to a position in the track 191 * Seek to a position in the track
193 * @param second the second to jump to 192 * @param second the second to jump to
194 */ 193 */
195void XineControl::seekTo( long second ) { 194void XineControl::seekTo( long second ) {
196 libXine->play( m_fileName , 0, (int)second ); 195 libXine->play( m_fileName , 0, (int)second );
197} 196}
198 197
199void XineControl::videoResized ( const QSize &s ) { 198void XineControl::videoResized ( const QSize &s ) {
200 libXine-> resize ( s ); 199 libXine-> resize ( s );
201} 200}