-rw-r--r-- | core/multimedia/opieplayer/config.in | 3 | ||||
-rw-r--r-- | core/multimedia/opieplayer/inputDialog.cpp | 3 | ||||
-rw-r--r-- | core/multimedia/opieplayer/libmad/config.in | 2 | ||||
-rw-r--r-- | core/multimedia/opieplayer/libmad/libmadplugin.h | 1 | ||||
-rw-r--r-- | core/multimedia/opieplayer/libmpeg3/config.in | 2 | ||||
-rw-r--r-- | core/multimedia/opieplayer/main.cpp | 1 | ||||
-rw-r--r-- | core/multimedia/opieplayer/modplug/config.in | 2 | ||||
-rw-r--r-- | core/multimedia/opieplayer/modplug/load_j2b.cpp | 1 | ||||
-rw-r--r-- | core/multimedia/opieplayer/modplug/tables.cpp | 1 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 4 | ||||
-rw-r--r-- | core/multimedia/opieplayer/vorbis/config.in | 3 | ||||
-rw-r--r-- | core/multimedia/opieplayer/vorbis/libtremorplugin.cpp | 1 | ||||
-rw-r--r-- | core/multimedia/opieplayer/vorbis/tremor/config.in | 2 | ||||
-rw-r--r-- | core/multimedia/opieplayer/vorbis/vorbis.pro | 2 | ||||
-rw-r--r-- | core/multimedia/opieplayer/wavplugin/config.in | 2 |
15 files changed, 12 insertions, 18 deletions
diff --git a/core/multimedia/opieplayer/config.in b/core/multimedia/opieplayer/config.in index dc1b79a..a7ac444 100644 --- a/core/multimedia/opieplayer/config.in +++ b/core/multimedia/opieplayer/config.in | |||
@@ -1,12 +1,13 @@ | |||
1 | config OPIEPLAYER | 1 | config OPIEPLAYER |
2 | boolean "opie-mediaplayer (mediaplayer that plays mp3, mpeg, and wav)" | 2 | boolean "Opieplayer" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE |
5 | 5 | ||
6 | source core/multimedia/opieplayer/libflash/config.in | 6 | source core/multimedia/opieplayer/libflash/config.in |
7 | source core/multimedia/opieplayer/libmad/config.in | 7 | source core/multimedia/opieplayer/libmad/config.in |
8 | source core/multimedia/opieplayer/libmpeg3/config.in | 8 | source core/multimedia/opieplayer/libmpeg3/config.in |
9 | source core/multimedia/opieplayer/modplug/config.in | 9 | source core/multimedia/opieplayer/modplug/config.in |
10 | source core/multimedia/opieplayer/wavplugin/config.in | 10 | source core/multimedia/opieplayer/wavplugin/config.in |
11 | source core/multimedia/opieplayer/vorbis/tremor/config.in | 11 | source core/multimedia/opieplayer/vorbis/tremor/config.in |
12 | source core/multimedia/opieplayer/vorbis/config.in | 12 | source core/multimedia/opieplayer/vorbis/config.in |
13 | \ No newline at end of file | ||
diff --git a/core/multimedia/opieplayer/inputDialog.cpp b/core/multimedia/opieplayer/inputDialog.cpp index 62240b2..38b8f53 100644 --- a/core/multimedia/opieplayer/inputDialog.cpp +++ b/core/multimedia/opieplayer/inputDialog.cpp | |||
@@ -1,62 +1,59 @@ | |||
1 | #include "inputDialog.h" | 1 | #include "inputDialog.h" |
2 | 2 | ||
3 | #include <qpe/resource.h> | 3 | #include <qpe/resource.h> |
4 | 4 | ||
5 | #include <opie/ofiledialog.h> | 5 | #include <opie/ofiledialog.h> |
6 | 6 | ||
7 | #include <qlineedit.h> | 7 | #include <qlineedit.h> |
8 | #include <qlayout.h> | ||
9 | #include <qvariant.h> | ||
10 | #include <qpushbutton.h> | 8 | #include <qpushbutton.h> |
11 | #include <qwhatsthis.h> | ||
12 | 9 | ||
13 | InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) | 10 | InputDialog::InputDialog( QWidget* parent, const char* name, bool modal, WFlags fl ) |
14 | : QDialog( parent, name, modal, fl ) { | 11 | : QDialog( parent, name, modal, fl ) { |
15 | if ( !name ) { | 12 | if ( !name ) { |
16 | setName( "InputDialog" ); | 13 | setName( "InputDialog" ); |
17 | } | 14 | } |
18 | resize( 234, 115); | 15 | resize( 234, 115); |
19 | setMaximumSize( QSize( 240, 40)); | 16 | setMaximumSize( QSize( 240, 40)); |
20 | setCaption( tr( name ) ); | 17 | setCaption( tr( name ) ); |
21 | 18 | ||
22 | QPushButton *browserButton; | 19 | QPushButton *browserButton; |
23 | browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton"); | 20 | browserButton = new QPushButton( Resource::loadIconSet("fileopen"),"",this,"BrowseButton"); |
24 | browserButton->setGeometry( QRect( 205, 10, 22, 22)); | 21 | browserButton->setGeometry( QRect( 205, 10, 22, 22)); |
25 | connect( browserButton, SIGNAL(released()),this,SLOT(browse())); | 22 | connect( browserButton, SIGNAL(released()),this,SLOT(browse())); |
26 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); | 23 | LineEdit1 = new QLineEdit( this, "LineEdit1" ); |
27 | LineEdit1->setGeometry( QRect( 4, 10, 190, 22 ) ); | 24 | LineEdit1->setGeometry( QRect( 4, 10, 190, 22 ) ); |
28 | LineEdit1->setFocus(); | 25 | LineEdit1->setFocus(); |
29 | } | 26 | } |
30 | /* | 27 | /* |
31 | * return the current text(input) | 28 | * return the current text(input) |
32 | */ | 29 | */ |
33 | QString InputDialog::text() const { | 30 | QString InputDialog::text() const { |
34 | return LineEdit1->text(); | 31 | return LineEdit1->text(); |
35 | } | 32 | } |
36 | /* | 33 | /* |
37 | * Destroys the object and frees any allocated resources | 34 | * Destroys the object and frees any allocated resources |
38 | */ | 35 | */ |
39 | InputDialog::~InputDialog() { | 36 | InputDialog::~InputDialog() { |
40 | } | 37 | } |
41 | 38 | ||
42 | void InputDialog::browse() { | 39 | void InputDialog::browse() { |
43 | 40 | ||
44 | MimeTypes types; | 41 | MimeTypes types; |
45 | QStringList audio, video, all; | 42 | QStringList audio, video, all; |
46 | audio << "audio/*"; | 43 | audio << "audio/*"; |
47 | audio << "playlist/plain"; | 44 | audio << "playlist/plain"; |
48 | audio << "audio/x-mpegurl"; | 45 | audio << "audio/x-mpegurl"; |
49 | 46 | ||
50 | video << "video/*"; | 47 | video << "video/*"; |
51 | video << "playlist/plain"; | 48 | video << "playlist/plain"; |
52 | 49 | ||
53 | all += audio; | 50 | all += audio; |
54 | all += video; | 51 | all += video; |
55 | types.insert("All Media Files", all ); | 52 | types.insert("All Media Files", all ); |
56 | types.insert("Audio", audio ); | 53 | types.insert("Audio", audio ); |
57 | types.insert("Video", video ); | 54 | types.insert("Video", video ); |
58 | 55 | ||
59 | QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 ); | 56 | QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 ); |
60 | LineEdit1->setText(str); | 57 | LineEdit1->setText(str); |
61 | } | 58 | } |
62 | 59 | ||
diff --git a/core/multimedia/opieplayer/libmad/config.in b/core/multimedia/opieplayer/libmad/config.in index 72249dc..1239166 100644 --- a/core/multimedia/opieplayer/libmad/config.in +++ b/core/multimedia/opieplayer/libmad/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config LIBMAD | 1 | config LIBMAD |
2 | boolean "opieplayer1-libmadplugin (plugin with shoutcast/icecast support to play MP3 files)" | 2 | boolean "libmadplugin" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && OPIEPLAYER | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && OPIEPLAYER |
diff --git a/core/multimedia/opieplayer/libmad/libmadplugin.h b/core/multimedia/opieplayer/libmad/libmadplugin.h index 6747712..b05ba15 100644 --- a/core/multimedia/opieplayer/libmad/libmadplugin.h +++ b/core/multimedia/opieplayer/libmad/libmadplugin.h | |||
@@ -1,117 +1,116 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2001 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef LIBMAD_PLUGIN_H | 20 | #ifndef LIBMAD_PLUGIN_H |
21 | #define LIBMAD_PLUGIN_H | 21 | #define LIBMAD_PLUGIN_H |
22 | 22 | ||
23 | #include <qstring.h> | 23 | #include <qstring.h> |
24 | #include <qpe/mediaplayerplugininterface.h> | 24 | #include <qpe/mediaplayerplugininterface.h> |
25 | /* #include "../mediaplayerplugininterface.h" */ | 25 | /* #include "../mediaplayerplugininterface.h" */ |
26 | 26 | ||
27 | 27 | ||
28 | // #define OLD_MEDIAPLAYER_API | 28 | // #define OLD_MEDIAPLAYER_API |
29 | 29 | ||
30 | 30 | ||
31 | class LibMadPluginData; | 31 | class LibMadPluginData; |
32 | 32 | ||
33 | 33 | ||
34 | class LibMadPlugin : public MediaPlayerDecoder { | 34 | class LibMadPlugin : public MediaPlayerDecoder { |
35 | |||
36 | public: | 35 | public: |
37 | LibMadPlugin(); | 36 | LibMadPlugin(); |
38 | ~LibMadPlugin(); | 37 | ~LibMadPlugin(); |
39 | 38 | ||
40 | const char *pluginName() { return "LibMadPlugin"; } | 39 | const char *pluginName() { return "LibMadPlugin"; } |
41 | const char *pluginComment() { return "This is the libmad library that has been wrapped as a plugin"; } | 40 | const char *pluginComment() { return "This is the libmad library that has been wrapped as a plugin"; } |
42 | double pluginVersion() { return 1.0; } | 41 | double pluginVersion() { return 1.0; } |
43 | 42 | ||
44 | bool isFileSupported( const QString& ); | 43 | bool isFileSupported( const QString& ); |
45 | bool open( const QString& ); | 44 | bool open( const QString& ); |
46 | 45 | ||
47 | bool close(); | 46 | bool close(); |
48 | bool isOpen(); | 47 | bool isOpen(); |
49 | const QString &fileInfo() { return info; } | 48 | const QString &fileInfo() { return info; } |
50 | 49 | ||
51 | // If decoder doesn't support audio then return 0 here | 50 | // If decoder doesn't support audio then return 0 here |
52 | int audioStreams(); | 51 | int audioStreams(); |
53 | int audioChannels( int stream ); | 52 | int audioChannels( int stream ); |
54 | int audioFrequency( int stream ); | 53 | int audioFrequency( int stream ); |
55 | int audioSamples( int stream ); | 54 | int audioSamples( int stream ); |
56 | bool audioSetSample( long sample, int stream ); | 55 | bool audioSetSample( long sample, int stream ); |
57 | /* int audioBitsPerSample(int) {return 0;} */ | 56 | /* int audioBitsPerSample(int) {return 0;} */ |
58 | long audioGetSample( int stream ); | 57 | long audioGetSample( int stream ); |
59 | #ifdef OLD_MEDIAPLAYER_API | 58 | #ifdef OLD_MEDIAPLAYER_API |
60 | bool audioReadMonoSamples( short *output, long samples, long& samplesRead, int stream ); | 59 | bool audioReadMonoSamples( short *output, long samples, long& samplesRead, int stream ); |
61 | bool audioReadStereoSamples( short *output, long samples, long& samplesRead, int stream ); | 60 | bool audioReadStereoSamples( short *output, long samples, long& samplesRead, int stream ); |
62 | bool audioReadSamples( short *output, int channel, long samples, int stream ); | 61 | bool audioReadSamples( short *output, int channel, long samples, int stream ); |
63 | bool audioReReadSamples( short *output, int channel, long samples, int stream ); | 62 | bool audioReReadSamples( short *output, int channel, long samples, int stream ); |
64 | #else | 63 | #else |
65 | bool audioReadSamples( short *output, int channels, long samples, long& samplesRead, int stream ); | 64 | bool audioReadSamples( short *output, int channels, long samples, long& samplesRead, int stream ); |
66 | #endif | 65 | #endif |
67 | 66 | ||
68 | 67 | ||
69 | bool read(); | 68 | bool read(); |
70 | bool decode( short *output, long samples, long& samplesRead ); | 69 | bool decode( short *output, long samples, long& samplesRead ); |
71 | void printID3Tags(); | 70 | void printID3Tags(); |
72 | 71 | ||
73 | 72 | ||
74 | // If decoder doesn't support video then return 0 here | 73 | // If decoder doesn't support video then return 0 here |
75 | int videoStreams() { return 0; } | 74 | int videoStreams() { return 0; } |
76 | int videoWidth( int ) { return 0; } | 75 | int videoWidth( int ) { return 0; } |
77 | int videoHeight( int ) { return 0; } | 76 | int videoHeight( int ) { return 0; } |
78 | double videoFrameRate( int ) { return 0.0; } | 77 | double videoFrameRate( int ) { return 0.0; } |
79 | int videoFrames( int ) { return 0; } | 78 | int videoFrames( int ) { return 0; } |
80 | bool videoSetFrame( long, int ) { return FALSE; } | 79 | bool videoSetFrame( long, int ) { return FALSE; } |
81 | long videoGetFrame( int ) { return 0; } | 80 | long videoGetFrame( int ) { return 0; } |
82 | bool videoReadFrame( unsigned char **, int, int, int, int, ColorFormat, int ) { return FALSE; } | 81 | bool videoReadFrame( unsigned char **, int, int, int, int, ColorFormat, int ) { return FALSE; } |
83 | bool videoReadScaledFrame( unsigned char **, int, int, int, int, int, int, ColorFormat, int ) { return FALSE; } | 82 | bool videoReadScaledFrame( unsigned char **, int, int, int, int, int, int, ColorFormat, int ) { return FALSE; } |
84 | bool videoReadYUVFrame( char *, char *, char *, int, int, int, int, int ) { return FALSE; } | 83 | bool videoReadYUVFrame( char *, char *, char *, int, int, int, int, int ) { return FALSE; } |
85 | 84 | ||
86 | // Profiling | 85 | // Profiling |
87 | double getTime(); | 86 | double getTime(); |
88 | 87 | ||
89 | // Ignore if these aren't supported | 88 | // Ignore if these aren't supported |
90 | bool setSMP( int ) { return FALSE; } | 89 | bool setSMP( int ) { return FALSE; } |
91 | bool setMMX( bool ) { return FALSE; } | 90 | bool setMMX( bool ) { return FALSE; } |
92 | 91 | ||
93 | // Capabilities | 92 | // Capabilities |
94 | bool supportsAudio() { return TRUE; } | 93 | bool supportsAudio() { return TRUE; } |
95 | bool supportsVideo() { return FALSE; } | 94 | bool supportsVideo() { return FALSE; } |
96 | bool supportsYUV() { return FALSE; } | 95 | bool supportsYUV() { return FALSE; } |
97 | bool supportsMMX() { return TRUE; } | 96 | bool supportsMMX() { return TRUE; } |
98 | bool supportsSMP() { return FALSE; } | 97 | bool supportsSMP() { return FALSE; } |
99 | bool supportsStereo() { return TRUE; } | 98 | bool supportsStereo() { return TRUE; } |
100 | bool supportsScaling() { return FALSE; } | 99 | bool supportsScaling() { return FALSE; } |
101 | 100 | ||
102 | long getPlayTime() { return -1; } | 101 | long getPlayTime() { return -1; } |
103 | 102 | ||
104 | private: | 103 | private: |
105 | int is_address_multicast(unsigned long address); | 104 | int is_address_multicast(unsigned long address); |
106 | int udp_open(char *address, int port); | 105 | int udp_open(char *address, int port); |
107 | int tcp_open(char *address, int port); | 106 | int tcp_open(char *address, int port); |
108 | int http_read_line(int tcp_sock, char *buf, int size) ; | 107 | int http_read_line(int tcp_sock, char *buf, int size) ; |
109 | int http_open(const QString& path ); | 108 | int http_open(const QString& path ); |
110 | 109 | ||
111 | LibMadPluginData *d; | 110 | LibMadPluginData *d; |
112 | QString info; | 111 | QString info; |
113 | int bufferSize; | 112 | int bufferSize; |
114 | }; | 113 | }; |
115 | 114 | ||
116 | 115 | ||
117 | #endif | 116 | #endif |
diff --git a/core/multimedia/opieplayer/libmpeg3/config.in b/core/multimedia/opieplayer/libmpeg3/config.in index b965a40..b634594 100644 --- a/core/multimedia/opieplayer/libmpeg3/config.in +++ b/core/multimedia/opieplayer/libmpeg3/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config LIBMPEG3 | 1 | config LIBMPEG3 |
2 | boolean "opieplayer1-libmpeg3plugin (play MPEG3 video files)" | 2 | boolean "libmpeg3plugin" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && OPIEPLAYER | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && OPIEPLAYER |
diff --git a/core/multimedia/opieplayer/main.cpp b/core/multimedia/opieplayer/main.cpp index 18cd7a6..32dc1d5 100644 --- a/core/multimedia/opieplayer/main.cpp +++ b/core/multimedia/opieplayer/main.cpp | |||
@@ -1,56 +1,55 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include <qpe/qpeapplication.h> | ||
21 | #include "mediaplayerstate.h" | 20 | #include "mediaplayerstate.h" |
22 | #include "playlistwidget.h" | 21 | #include "playlistwidget.h" |
23 | #include "audiowidget.h" | 22 | #include "audiowidget.h" |
24 | #include "videowidget.h" | 23 | #include "videowidget.h" |
25 | #include "loopcontrol.h" | 24 | #include "loopcontrol.h" |
26 | #include "mediaplayer.h" | 25 | #include "mediaplayer.h" |
27 | 26 | ||
28 | MediaPlayerState *mediaPlayerState; | 27 | MediaPlayerState *mediaPlayerState; |
29 | PlayListWidget *playList; | 28 | PlayListWidget *playList; |
30 | AudioWidget *audioUI; | 29 | AudioWidget *audioUI; |
31 | VideoWidget *videoUI; | 30 | VideoWidget *videoUI; |
32 | LoopControl *loopControl; | 31 | LoopControl *loopControl; |
33 | 32 | ||
34 | 33 | ||
35 | int main(int argc, char **argv) { | 34 | int main(int argc, char **argv) { |
36 | QPEApplication a(argc,argv); | 35 | QPEApplication a(argc,argv); |
37 | 36 | ||
38 | MediaPlayerState st( 0, "mediaPlayerState" ); | 37 | MediaPlayerState st( 0, "mediaPlayerState" ); |
39 | mediaPlayerState = &st; | 38 | mediaPlayerState = &st; |
40 | PlayListWidget pl( 0, "playList" ); | 39 | PlayListWidget pl( 0, "playList" ); |
41 | playList = &pl; | 40 | playList = &pl; |
42 | AudioWidget aw( 0, "audioUI" ); | 41 | AudioWidget aw( 0, "audioUI" ); |
43 | audioUI = &aw; | 42 | audioUI = &aw; |
44 | VideoWidget vw( 0, "videoUI" ); | 43 | VideoWidget vw( 0, "videoUI" ); |
45 | videoUI = &vw; | 44 | videoUI = &vw; |
46 | LoopControl lc( 0, "loopControl" ); | 45 | LoopControl lc( 0, "loopControl" ); |
47 | loopControl = &lc; | 46 | loopControl = &lc; |
48 | MediaPlayer mp( 0, "mediaPlayer" ); | 47 | MediaPlayer mp( 0, "mediaPlayer" ); |
49 | 48 | ||
50 | // pl.setCaption( MediaPlayer::tr("OpiePlayer") ); | 49 | // pl.setCaption( MediaPlayer::tr("OpiePlayer") ); |
51 | a.showMainDocumentWidget(&pl); | 50 | a.showMainDocumentWidget(&pl); |
52 | 51 | ||
53 | return a.exec(); | 52 | return a.exec(); |
54 | } | 53 | } |
55 | 54 | ||
56 | 55 | ||
diff --git a/core/multimedia/opieplayer/modplug/config.in b/core/multimedia/opieplayer/modplug/config.in index 86e4725..769db1b 100644 --- a/core/multimedia/opieplayer/modplug/config.in +++ b/core/multimedia/opieplayer/modplug/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config MODPLUG | 1 | config MODPLUG |
2 | boolean "opieplayer1-modplugin (play MOD/XM/S3M/IT amiga tracker modules)" | 2 | boolean "modplugin" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && OPIEPLAYER | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && OPIEPLAYER |
diff --git a/core/multimedia/opieplayer/modplug/load_j2b.cpp b/core/multimedia/opieplayer/modplug/load_j2b.cpp index 5f60bbb..4f0b85c 100644 --- a/core/multimedia/opieplayer/modplug/load_j2b.cpp +++ b/core/multimedia/opieplayer/modplug/load_j2b.cpp | |||
@@ -1,18 +1,17 @@ | |||
1 | /* | 1 | /* |
2 | * This program is free software; you can redistribute it and modify it | 2 | * This program is free software; you can redistribute it and modify it |
3 | * under the terms of the GNU General Public License as published by the | 3 | * under the terms of the GNU General Public License as published by the |
4 | * Free Software Foundation; either version 2 of the license or (at your | 4 | * Free Software Foundation; either version 2 of the license or (at your |
5 | * option) any later version. | 5 | * option) any later version. |
6 | * | 6 | * |
7 | * Authors: Olivier Lapicque <olivierl@jps.net> | 7 | * Authors: Olivier Lapicque <olivierl@jps.net> |
8 | */ | 8 | */ |
9 | 9 | ||
10 | 10 | ||
11 | /////////////////////////////////////////////////// | 11 | /////////////////////////////////////////////////// |
12 | // | 12 | // |
13 | // J2B module loader | 13 | // J2B module loader |
14 | // | 14 | // |
15 | /////////////////////////////////////////////////// | 15 | /////////////////////////////////////////////////// |
16 | #include "stdafx.h" | 16 | #include "stdafx.h" |
17 | #include "sndfile.h" | ||
18 | 17 | ||
diff --git a/core/multimedia/opieplayer/modplug/tables.cpp b/core/multimedia/opieplayer/modplug/tables.cpp index e7198b2..baf4517 100644 --- a/core/multimedia/opieplayer/modplug/tables.cpp +++ b/core/multimedia/opieplayer/modplug/tables.cpp | |||
@@ -1,399 +1,398 @@ | |||
1 | /* | 1 | /* |
2 | * This program is free software; you can redistribute it and modify it | 2 | * This program is free software; you can redistribute it and modify it |
3 | * under the terms of the GNU General Public License as published by the | 3 | * under the terms of the GNU General Public License as published by the |
4 | * Free Software Foundation; either version 2 of the license or (at your | 4 | * Free Software Foundation; either version 2 of the license or (at your |
5 | * option) any later version. | 5 | * option) any later version. |
6 | * | 6 | * |
7 | * Authors: Olivier Lapicque <olivierl@jps.net> | 7 | * Authors: Olivier Lapicque <olivierl@jps.net> |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include "stdafx.h" | 10 | #include "stdafx.h" |
11 | #include "sndfile.h" | ||
12 | 11 | ||
13 | #ifndef FASTSOUNDLIB | 12 | #ifndef FASTSOUNDLIB |
14 | //#pragma data_seg(".tables") | 13 | //#pragma data_seg(".tables") |
15 | #endif | 14 | #endif |
16 | 15 | ||
17 | extern const BYTE ImpulseTrackerPortaVolCmd[16]; | 16 | extern const BYTE ImpulseTrackerPortaVolCmd[16]; |
18 | const BYTE ImpulseTrackerPortaVolCmd[16] = | 17 | const BYTE ImpulseTrackerPortaVolCmd[16] = |
19 | { | 18 | { |
20 | 0x00, 0x01, 0x04, 0x08, 0x10, 0x20, 0x40, 0x60, | 19 | 0x00, 0x01, 0x04, 0x08, 0x10, 0x20, 0x40, 0x60, |
21 | 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF | 20 | 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF |
22 | }; | 21 | }; |
23 | 22 | ||
24 | // Period table for Protracker octaves 0-5: | 23 | // Period table for Protracker octaves 0-5: |
25 | extern const WORD ProTrackerPeriodTable[6*12]; | 24 | extern const WORD ProTrackerPeriodTable[6*12]; |
26 | const WORD ProTrackerPeriodTable[6*12] = | 25 | const WORD ProTrackerPeriodTable[6*12] = |
27 | { | 26 | { |
28 | 1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,907, | 27 | 1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,907, |
29 | 856,808,762,720,678,640,604,570,538,508,480,453, | 28 | 856,808,762,720,678,640,604,570,538,508,480,453, |
30 | 428,404,381,360,339,320,302,285,269,254,240,226, | 29 | 428,404,381,360,339,320,302,285,269,254,240,226, |
31 | 214,202,190,180,170,160,151,143,135,127,120,113, | 30 | 214,202,190,180,170,160,151,143,135,127,120,113, |
32 | 107,101,95,90,85,80,75,71,67,63,60,56, | 31 | 107,101,95,90,85,80,75,71,67,63,60,56, |
33 | 53,50,47,45,42,40,37,35,33,31,30,28 | 32 | 53,50,47,45,42,40,37,35,33,31,30,28 |
34 | }; | 33 | }; |
35 | 34 | ||
36 | 35 | ||
37 | extern const WORD ProTrackerTunedPeriods[16*12]; | 36 | extern const WORD ProTrackerTunedPeriods[16*12]; |
38 | const WORD ProTrackerTunedPeriods[16*12] = | 37 | const WORD ProTrackerTunedPeriods[16*12] = |
39 | { | 38 | { |
40 | 1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,907, | 39 | 1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960,907, |
41 | 1700,1604,1514,1430,1348,1274,1202,1134,1070,1010,954,900, | 40 | 1700,1604,1514,1430,1348,1274,1202,1134,1070,1010,954,900, |
42 | 1688,1592,1504,1418,1340,1264,1194,1126,1064,1004,948,894, | 41 | 1688,1592,1504,1418,1340,1264,1194,1126,1064,1004,948,894, |
43 | 1676,1582,1492,1408,1330,1256,1184,1118,1056,996,940,888, | 42 | 1676,1582,1492,1408,1330,1256,1184,1118,1056,996,940,888, |
44 | 1664,1570,1482,1398,1320,1246,1176,1110,1048,990,934,882, | 43 | 1664,1570,1482,1398,1320,1246,1176,1110,1048,990,934,882, |
45 | 1652,1558,1472,1388,1310,1238,1168,1102,1040,982,926,874, | 44 | 1652,1558,1472,1388,1310,1238,1168,1102,1040,982,926,874, |
46 | 1640,1548,1460,1378,1302,1228,1160,1094,1032,974,920,868, | 45 | 1640,1548,1460,1378,1302,1228,1160,1094,1032,974,920,868, |
47 | 1628,1536,1450,1368,1292,1220,1150,1086,1026,968,914,862, | 46 | 1628,1536,1450,1368,1292,1220,1150,1086,1026,968,914,862, |
48 | 1814,1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960, | 47 | 1814,1712,1616,1524,1440,1356,1280,1208,1140,1076,1016,960, |
49 | 1800,1700,1604,1514,1430,1350,1272,1202,1134,1070,1010,954, | 48 | 1800,1700,1604,1514,1430,1350,1272,1202,1134,1070,1010,954, |
50 | 1788,1688,1592,1504,1418,1340,1264,1194,1126,1064,1004,948, | 49 | 1788,1688,1592,1504,1418,1340,1264,1194,1126,1064,1004,948, |
51 | 1774,1676,1582,1492,1408,1330,1256,1184,1118,1056,996,940, | 50 | 1774,1676,1582,1492,1408,1330,1256,1184,1118,1056,996,940, |
52 | 1762,1664,1570,1482,1398,1320,1246,1176,1110,1048,988,934, | 51 | 1762,1664,1570,1482,1398,1320,1246,1176,1110,1048,988,934, |
53 | 1750,1652,1558,1472,1388,1310,1238,1168,1102,1040,982,926, | 52 | 1750,1652,1558,1472,1388,1310,1238,1168,1102,1040,982,926, |
54 | 1736,1640,1548,1460,1378,1302,1228,1160,1094,1032,974,920, | 53 | 1736,1640,1548,1460,1378,1302,1228,1160,1094,1032,974,920, |
55 | 1724,1628,1536,1450,1368,1292,1220,1150,1086,1026,968,914 | 54 | 1724,1628,1536,1450,1368,1292,1220,1150,1086,1026,968,914 |
56 | }; | 55 | }; |
57 | 56 | ||
58 | 57 | ||
59 | // S3M C-4 periods | 58 | // S3M C-4 periods |
60 | extern const WORD FreqS3MTable[16]; | 59 | extern const WORD FreqS3MTable[16]; |
61 | const WORD FreqS3MTable[16] = | 60 | const WORD FreqS3MTable[16] = |
62 | { | 61 | { |
63 | 1712,1616,1524,1440,1356,1280, | 62 | 1712,1616,1524,1440,1356,1280, |
64 | 1208,1140,1076,1016,960,907, | 63 | 1208,1140,1076,1016,960,907, |
65 | 0,0,0,0 | 64 | 0,0,0,0 |
66 | }; | 65 | }; |
67 | 66 | ||
68 | 67 | ||
69 | // S3M FineTune frequencies | 68 | // S3M FineTune frequencies |
70 | extern const WORD S3MFineTuneTable[16]; | 69 | extern const WORD S3MFineTuneTable[16]; |
71 | const WORD S3MFineTuneTable[16] = | 70 | const WORD S3MFineTuneTable[16] = |
72 | { | 71 | { |
73 | 7895,7941,7985,8046,8107,8169,8232,8280, | 72 | 7895,7941,7985,8046,8107,8169,8232,8280, |
74 | 8363,8413,8463,8529,8581,8651,8723,8757,// 8363*2^((i-8)/(12*8)) | 73 | 8363,8413,8463,8529,8581,8651,8723,8757,// 8363*2^((i-8)/(12*8)) |
75 | }; | 74 | }; |
76 | 75 | ||
77 | 76 | ||
78 | // Sinus table | 77 | // Sinus table |
79 | extern const short int ModSinusTable[64]; | 78 | extern const short int ModSinusTable[64]; |
80 | const short int ModSinusTable[64] = | 79 | const short int ModSinusTable[64] = |
81 | { | 80 | { |
82 | 0,12,25,37,49,60,71,81,90,98,106,112,117,122,125,126, | 81 | 0,12,25,37,49,60,71,81,90,98,106,112,117,122,125,126, |
83 | 127,126,125,122,117,112,106,98,90,81,71,60,49,37,25,12, | 82 | 127,126,125,122,117,112,106,98,90,81,71,60,49,37,25,12, |
84 | 0,-12,-25,-37,-49,-60,-71,-81,-90,-98,-106,-112,-117,-122,-125,-126, | 83 | 0,-12,-25,-37,-49,-60,-71,-81,-90,-98,-106,-112,-117,-122,-125,-126, |
85 | -127,-126,-125,-122,-117,-112,-106,-98,-90,-81,-71,-60,-49,-37,-25,-12 | 84 | -127,-126,-125,-122,-117,-112,-106,-98,-90,-81,-71,-60,-49,-37,-25,-12 |
86 | }; | 85 | }; |
87 | 86 | ||
88 | // Triangle wave table (ramp down) | 87 | // Triangle wave table (ramp down) |
89 | extern const short int ModRampDownTable[64]; | 88 | extern const short int ModRampDownTable[64]; |
90 | const short int ModRampDownTable[64] = | 89 | const short int ModRampDownTable[64] = |
91 | { | 90 | { |
92 | 0,-4,-8,-12,-16,-20,-24,-28,-32,-36,-40,-44,-48,-52,-56,-60, | 91 | 0,-4,-8,-12,-16,-20,-24,-28,-32,-36,-40,-44,-48,-52,-56,-60, |
93 | -64,-68,-72,-76,-80,-84,-88,-92,-96,-100,-104,-108,-112,-116,-120,-124, | 92 | -64,-68,-72,-76,-80,-84,-88,-92,-96,-100,-104,-108,-112,-116,-120,-124, |
94 | 127,123,119,115,111,107,103,99,95,91,87,83,79,75,71,67, | 93 | 127,123,119,115,111,107,103,99,95,91,87,83,79,75,71,67, |
95 | 63,59,55,51,47,43,39,35,31,27,23,19,15,11,7,3 | 94 | 63,59,55,51,47,43,39,35,31,27,23,19,15,11,7,3 |
96 | }; | 95 | }; |
97 | 96 | ||
98 | // Square wave table | 97 | // Square wave table |
99 | extern const short int ModSquareTable[64]; | 98 | extern const short int ModSquareTable[64]; |
100 | const short int ModSquareTable[64] = | 99 | const short int ModSquareTable[64] = |
101 | { | 100 | { |
102 | 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127, | 101 | 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127, |
103 | 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127, | 102 | 127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127, |
104 | -127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127, | 103 | -127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127, |
105 | -127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127 | 104 | -127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127,-127 |
106 | }; | 105 | }; |
107 | 106 | ||
108 | // Random wave table | 107 | // Random wave table |
109 | extern const short int ModRandomTable[64]; | 108 | extern const short int ModRandomTable[64]; |
110 | const short int ModRandomTable[64] = | 109 | const short int ModRandomTable[64] = |
111 | { | 110 | { |
112 | 98,-127,-43,88,102,41,-65,-94,125,20,-71,-86,-70,-32,-16,-96, | 111 | 98,-127,-43,88,102,41,-65,-94,125,20,-71,-86,-70,-32,-16,-96, |
113 | 17,72,107,-5,116,-69,-62,-40,10,-61,65,109,-18,-38,-13,-76, | 112 | 17,72,107,-5,116,-69,-62,-40,10,-61,65,109,-18,-38,-13,-76, |
114 | -23,88,21,-94,8,106,21,-112,6,109,20,-88,-30,9,-127,118, | 113 | -23,88,21,-94,8,106,21,-112,6,109,20,-88,-30,9,-127,118, |
115 | 42,-34,89,-4,-51,-72,21,-29,112,123,84,-101,-92,98,-54,-95 | 114 | 42,-34,89,-4,-51,-72,21,-29,112,123,84,-101,-92,98,-54,-95 |
116 | }; | 115 | }; |
117 | 116 | ||
118 | 117 | ||
119 | // volume fade tables for Retrig Note: | 118 | // volume fade tables for Retrig Note: |
120 | extern const signed char retrigTable1[16]; | 119 | extern const signed char retrigTable1[16]; |
121 | const signed char retrigTable1[16] = | 120 | const signed char retrigTable1[16] = |
122 | { 0, 0, 0, 0, 0, 0, 10, 8, 0, 0, 0, 0, 0, 0, 24, 32 }; | 121 | { 0, 0, 0, 0, 0, 0, 10, 8, 0, 0, 0, 0, 0, 0, 24, 32 }; |
123 | 122 | ||
124 | extern const signed char retrigTable2[16]; | 123 | extern const signed char retrigTable2[16]; |
125 | const signed char retrigTable2[16] = | 124 | const signed char retrigTable2[16] = |
126 | { 0, -1, -2, -4, -8, -16, 0, 0, 0, 1, 2, 4, 8, 16, 0, 0 }; | 125 | { 0, -1, -2, -4, -8, -16, 0, 0, 0, 1, 2, 4, 8, 16, 0, 0 }; |
127 | 126 | ||
128 | 127 | ||
129 | 128 | ||
130 | 129 | ||
131 | extern const WORD XMPeriodTable[104]; | 130 | extern const WORD XMPeriodTable[104]; |
132 | const WORD XMPeriodTable[104] = | 131 | const WORD XMPeriodTable[104] = |
133 | { | 132 | { |
134 | 907,900,894,887,881,875,868,862,856,850,844,838,832,826,820,814, | 133 | 907,900,894,887,881,875,868,862,856,850,844,838,832,826,820,814, |
135 | 808,802,796,791,785,779,774,768,762,757,752,746,741,736,730,725, | 134 | 808,802,796,791,785,779,774,768,762,757,752,746,741,736,730,725, |
136 | 720,715,709,704,699,694,689,684,678,675,670,665,660,655,651,646, | 135 | 720,715,709,704,699,694,689,684,678,675,670,665,660,655,651,646, |
137 | 640,636,632,628,623,619,614,610,604,601,597,592,588,584,580,575, | 136 | 640,636,632,628,623,619,614,610,604,601,597,592,588,584,580,575, |
138 | 570,567,563,559,555,551,547,543,538,535,532,528,524,520,516,513, | 137 | 570,567,563,559,555,551,547,543,538,535,532,528,524,520,516,513, |
139 | 508,505,502,498,494,491,487,484,480,477,474,470,467,463,460,457, | 138 | 508,505,502,498,494,491,487,484,480,477,474,470,467,463,460,457, |
140 | 453,450,447,443,440,437,434,431 | 139 | 453,450,447,443,440,437,434,431 |
141 | }; | 140 | }; |
142 | 141 | ||
143 | 142 | ||
144 | extern const UINT XMLinearTable[768]; | 143 | extern const UINT XMLinearTable[768]; |
145 | const UINT XMLinearTable[768] = | 144 | const UINT XMLinearTable[768] = |
146 | { | 145 | { |
147 | 535232,534749,534266,533784,533303,532822,532341,531861, | 146 | 535232,534749,534266,533784,533303,532822,532341,531861, |
148 | 531381,530902,530423,529944,529466,528988,528511,528034, | 147 | 531381,530902,530423,529944,529466,528988,528511,528034, |
149 | 527558,527082,526607,526131,525657,525183,524709,524236, | 148 | 527558,527082,526607,526131,525657,525183,524709,524236, |
150 | 523763,523290,522818,522346,521875,521404,520934,520464, | 149 | 523763,523290,522818,522346,521875,521404,520934,520464, |
151 | 519994,519525,519057,518588,518121,517653,517186,516720, | 150 | 519994,519525,519057,518588,518121,517653,517186,516720, |
152 | 516253,515788,515322,514858,514393,513929,513465,513002, | 151 | 516253,515788,515322,514858,514393,513929,513465,513002, |
153 | 512539,512077,511615,511154,510692,510232,509771,509312, | 152 | 512539,512077,511615,511154,510692,510232,509771,509312, |
154 | 508852,508393,507934,507476,507018,506561,506104,505647, | 153 | 508852,508393,507934,507476,507018,506561,506104,505647, |
155 | 505191,504735,504280,503825,503371,502917,502463,502010, | 154 | 505191,504735,504280,503825,503371,502917,502463,502010, |
156 | 501557,501104,500652,500201,499749,499298,498848,498398, | 155 | 501557,501104,500652,500201,499749,499298,498848,498398, |
157 | 497948,497499,497050,496602,496154,495706,495259,494812, | 156 | 497948,497499,497050,496602,496154,495706,495259,494812, |
158 | 494366,493920,493474,493029,492585,492140,491696,491253, | 157 | 494366,493920,493474,493029,492585,492140,491696,491253, |
159 | 490809,490367,489924,489482,489041,488600,488159,487718, | 158 | 490809,490367,489924,489482,489041,488600,488159,487718, |
160 | 487278,486839,486400,485961,485522,485084,484647,484210, | 159 | 487278,486839,486400,485961,485522,485084,484647,484210, |
161 | 483773,483336,482900,482465,482029,481595,481160,480726, | 160 | 483773,483336,482900,482465,482029,481595,481160,480726, |
162 | 480292,479859,479426,478994,478562,478130,477699,477268, | 161 | 480292,479859,479426,478994,478562,478130,477699,477268, |
163 | 476837,476407,475977,475548,475119,474690,474262,473834, | 162 | 476837,476407,475977,475548,475119,474690,474262,473834, |
164 | 473407,472979,472553,472126,471701,471275,470850,470425, | 163 | 473407,472979,472553,472126,471701,471275,470850,470425, |
165 | 470001,469577,469153,468730,468307,467884,467462,467041, | 164 | 470001,469577,469153,468730,468307,467884,467462,467041, |
166 | 466619,466198,465778,465358,464938,464518,464099,463681, | 165 | 466619,466198,465778,465358,464938,464518,464099,463681, |
167 | 463262,462844,462427,462010,461593,461177,460760,460345, | 166 | 463262,462844,462427,462010,461593,461177,460760,460345, |
168 | 459930,459515,459100,458686,458272,457859,457446,457033, | 167 | 459930,459515,459100,458686,458272,457859,457446,457033, |
169 | 456621,456209,455797,455386,454975,454565,454155,453745, | 168 | 456621,456209,455797,455386,454975,454565,454155,453745, |
170 | 453336,452927,452518,452110,451702,451294,450887,450481, | 169 | 453336,452927,452518,452110,451702,451294,450887,450481, |
171 | 450074,449668,449262,448857,448452,448048,447644,447240, | 170 | 450074,449668,449262,448857,448452,448048,447644,447240, |
172 | 446836,446433,446030,445628,445226,444824,444423,444022, | 171 | 446836,446433,446030,445628,445226,444824,444423,444022, |
173 | 443622,443221,442821,442422,442023,441624,441226,440828, | 172 | 443622,443221,442821,442422,442023,441624,441226,440828, |
174 | 440430,440033,439636,439239,438843,438447,438051,437656, | 173 | 440430,440033,439636,439239,438843,438447,438051,437656, |
175 | 437261,436867,436473,436079,435686,435293,434900,434508, | 174 | 437261,436867,436473,436079,435686,435293,434900,434508, |
176 | 434116,433724,433333,432942,432551,432161,431771,431382, | 175 | 434116,433724,433333,432942,432551,432161,431771,431382, |
177 | 430992,430604,430215,429827,429439,429052,428665,428278, | 176 | 430992,430604,430215,429827,429439,429052,428665,428278, |
178 | 427892,427506,427120,426735,426350,425965,425581,425197, | 177 | 427892,427506,427120,426735,426350,425965,425581,425197, |
179 | 424813,424430,424047,423665,423283,422901,422519,422138, | 178 | 424813,424430,424047,423665,423283,422901,422519,422138, |
180 | 421757,421377,420997,420617,420237,419858,419479,419101, | 179 | 421757,421377,420997,420617,420237,419858,419479,419101, |
181 | 418723,418345,417968,417591,417214,416838,416462,416086, | 180 | 418723,418345,417968,417591,417214,416838,416462,416086, |
182 | 415711,415336,414961,414586,414212,413839,413465,413092, | 181 | 415711,415336,414961,414586,414212,413839,413465,413092, |
183 | 412720,412347,411975,411604,411232,410862,410491,410121, | 182 | 412720,412347,411975,411604,411232,410862,410491,410121, |
184 | 409751,409381,409012,408643,408274,407906,407538,407170, | 183 | 409751,409381,409012,408643,408274,407906,407538,407170, |
185 | 406803,406436,406069,405703,405337,404971,404606,404241, | 184 | 406803,406436,406069,405703,405337,404971,404606,404241, |
186 | 403876,403512,403148,402784,402421,402058,401695,401333, | 185 | 403876,403512,403148,402784,402421,402058,401695,401333, |
187 | 400970,400609,400247,399886,399525,399165,398805,398445, | 186 | 400970,400609,400247,399886,399525,399165,398805,398445, |
188 | 398086,397727,397368,397009,396651,396293,395936,395579, | 187 | 398086,397727,397368,397009,396651,396293,395936,395579, |
189 | 395222,394865,394509,394153,393798,393442,393087,392733, | 188 | 395222,394865,394509,394153,393798,393442,393087,392733, |
190 | 392378,392024,391671,391317,390964,390612,390259,389907, | 189 | 392378,392024,391671,391317,390964,390612,390259,389907, |
191 | 389556,389204,388853,388502,388152,387802,387452,387102, | 190 | 389556,389204,388853,388502,388152,387802,387452,387102, |
192 | 386753,386404,386056,385707,385359,385012,384664,384317, | 191 | 386753,386404,386056,385707,385359,385012,384664,384317, |
193 | 383971,383624,383278,382932,382587,382242,381897,381552, | 192 | 383971,383624,383278,382932,382587,382242,381897,381552, |
194 | 381208,380864,380521,380177,379834,379492,379149,378807, | 193 | 381208,380864,380521,380177,379834,379492,379149,378807, |
195 | 194 | ||
196 | 378466,378124,377783,377442,377102,376762,376422,376082, | 195 | 378466,378124,377783,377442,377102,376762,376422,376082, |
197 | 375743,375404,375065,374727,374389,374051,373714,373377, | 196 | 375743,375404,375065,374727,374389,374051,373714,373377, |
198 | 373040,372703,372367,372031,371695,371360,371025,370690, | 197 | 373040,372703,372367,372031,371695,371360,371025,370690, |
199 | 370356,370022,369688,369355,369021,368688,368356,368023, | 198 | 370356,370022,369688,369355,369021,368688,368356,368023, |
200 | 367691,367360,367028,366697,366366,366036,365706,365376, | 199 | 367691,367360,367028,366697,366366,366036,365706,365376, |
201 | 365046,364717,364388,364059,363731,363403,363075,362747, | 200 | 365046,364717,364388,364059,363731,363403,363075,362747, |
202 | 362420,362093,361766,361440,361114,360788,360463,360137, | 201 | 362420,362093,361766,361440,361114,360788,360463,360137, |
203 | 359813,359488,359164,358840,358516,358193,357869,357547, | 202 | 359813,359488,359164,358840,358516,358193,357869,357547, |
204 | 357224,356902,356580,356258,355937,355616,355295,354974, | 203 | 357224,356902,356580,356258,355937,355616,355295,354974, |
205 | 354654,354334,354014,353695,353376,353057,352739,352420, | 204 | 354654,354334,354014,353695,353376,353057,352739,352420, |
206 | 352103,351785,351468,351150,350834,350517,350201,349885, | 205 | 352103,351785,351468,351150,350834,350517,350201,349885, |
207 | 349569,349254,348939,348624,348310,347995,347682,347368, | 206 | 349569,349254,348939,348624,348310,347995,347682,347368, |
208 | 347055,346741,346429,346116,345804,345492,345180,344869, | 207 | 347055,346741,346429,346116,345804,345492,345180,344869, |
209 | 344558,344247,343936,343626,343316,343006,342697,342388, | 208 | 344558,344247,343936,343626,343316,343006,342697,342388, |
210 | 342079,341770,341462,341154,340846,340539,340231,339924, | 209 | 342079,341770,341462,341154,340846,340539,340231,339924, |
211 | 339618,339311,339005,338700,338394,338089,337784,337479, | 210 | 339618,339311,339005,338700,338394,338089,337784,337479, |
212 | 337175,336870,336566,336263,335959,335656,335354,335051, | 211 | 337175,336870,336566,336263,335959,335656,335354,335051, |
213 | 334749,334447,334145,333844,333542,333242,332941,332641, | 212 | 334749,334447,334145,333844,333542,333242,332941,332641, |
214 | 332341,332041,331741,331442,331143,330844,330546,330247, | 213 | 332341,332041,331741,331442,331143,330844,330546,330247, |
215 | 329950,329652,329355,329057,328761,328464,328168,327872, | 214 | 329950,329652,329355,329057,328761,328464,328168,327872, |
216 | 327576,327280,326985,326690,326395,326101,325807,325513, | 215 | 327576,327280,326985,326690,326395,326101,325807,325513, |
217 | 325219,324926,324633,324340,324047,323755,323463,323171, | 216 | 325219,324926,324633,324340,324047,323755,323463,323171, |
218 | 322879,322588,322297,322006,321716,321426,321136,320846, | 217 | 322879,322588,322297,322006,321716,321426,321136,320846, |
219 | 320557,320267,319978,319690,319401,319113,318825,318538, | 218 | 320557,320267,319978,319690,319401,319113,318825,318538, |
220 | 318250,317963,317676,317390,317103,316817,316532,316246, | 219 | 318250,317963,317676,317390,317103,316817,316532,316246, |
221 | 315961,315676,315391,315106,314822,314538,314254,313971, | 220 | 315961,315676,315391,315106,314822,314538,314254,313971, |
222 | 313688,313405,313122,312839,312557,312275,311994,311712, | 221 | 313688,313405,313122,312839,312557,312275,311994,311712, |
223 | 311431,311150,310869,310589,310309,310029,309749,309470, | 222 | 311431,311150,310869,310589,310309,310029,309749,309470, |
224 | 309190,308911,308633,308354,308076,307798,307521,307243, | 223 | 309190,308911,308633,308354,308076,307798,307521,307243, |
225 | 306966,306689,306412,306136,305860,305584,305308,305033, | 224 | 306966,306689,306412,306136,305860,305584,305308,305033, |
226 | 304758,304483,304208,303934,303659,303385,303112,302838, | 225 | 304758,304483,304208,303934,303659,303385,303112,302838, |
227 | 302565,302292,302019,301747,301475,301203,300931,300660, | 226 | 302565,302292,302019,301747,301475,301203,300931,300660, |
228 | 300388,300117,299847,299576,299306,299036,298766,298497, | 227 | 300388,300117,299847,299576,299306,299036,298766,298497, |
229 | 298227,297958,297689,297421,297153,296884,296617,296349, | 228 | 298227,297958,297689,297421,297153,296884,296617,296349, |
230 | 296082,295815,295548,295281,295015,294749,294483,294217, | 229 | 296082,295815,295548,295281,295015,294749,294483,294217, |
231 | 293952,293686,293421,293157,292892,292628,292364,292100, | 230 | 293952,293686,293421,293157,292892,292628,292364,292100, |
232 | 291837,291574,291311,291048,290785,290523,290261,289999, | 231 | 291837,291574,291311,291048,290785,290523,290261,289999, |
233 | 289737,289476,289215,288954,288693,288433,288173,287913, | 232 | 289737,289476,289215,288954,288693,288433,288173,287913, |
234 | 287653,287393,287134,286875,286616,286358,286099,285841, | 233 | 287653,287393,287134,286875,286616,286358,286099,285841, |
235 | 285583,285326,285068,284811,284554,284298,284041,283785, | 234 | 285583,285326,285068,284811,284554,284298,284041,283785, |
236 | 283529,283273,283017,282762,282507,282252,281998,281743, | 235 | 283529,283273,283017,282762,282507,282252,281998,281743, |
237 | 281489,281235,280981,280728,280475,280222,279969,279716, | 236 | 281489,281235,280981,280728,280475,280222,279969,279716, |
238 | 279464,279212,278960,278708,278457,278206,277955,277704, | 237 | 279464,279212,278960,278708,278457,278206,277955,277704, |
239 | 277453,277203,276953,276703,276453,276204,275955,275706, | 238 | 277453,277203,276953,276703,276453,276204,275955,275706, |
240 | 275457,275209,274960,274712,274465,274217,273970,273722, | 239 | 275457,275209,274960,274712,274465,274217,273970,273722, |
241 | 273476,273229,272982,272736,272490,272244,271999,271753, | 240 | 273476,273229,272982,272736,272490,272244,271999,271753, |
242 | 271508,271263,271018,270774,270530,270286,270042,269798, | 241 | 271508,271263,271018,270774,270530,270286,270042,269798, |
243 | 269555,269312,269069,268826,268583,268341,268099,267857 | 242 | 269555,269312,269069,268826,268583,268341,268099,267857 |
244 | }; | 243 | }; |
245 | 244 | ||
246 | 245 | ||
247 | extern const signed char ft2VibratoTable[256]; | 246 | extern const signed char ft2VibratoTable[256]; |
248 | const signed char ft2VibratoTable[256] = | 247 | const signed char ft2VibratoTable[256] = |
249 | { | 248 | { |
250 | 0,-2,-3,-5,-6,-8,-9,-11,-12,-14,-16,-17,-19,-20,-22,-23, | 249 | 0,-2,-3,-5,-6,-8,-9,-11,-12,-14,-16,-17,-19,-20,-22,-23, |
251 | -24,-26,-27,-29,-30,-32,-33,-34,-36,-37,-38,-39,-41,-42, | 250 | -24,-26,-27,-29,-30,-32,-33,-34,-36,-37,-38,-39,-41,-42, |
252 | -43,-44,-45,-46,-47,-48,-49,-50,-51,-52,-53,-54,-55,-56, | 251 | -43,-44,-45,-46,-47,-48,-49,-50,-51,-52,-53,-54,-55,-56, |
253 | -56,-57,-58,-59,-59,-60,-60,-61,-61,-62,-62,-62,-63,-63, | 252 | -56,-57,-58,-59,-59,-60,-60,-61,-61,-62,-62,-62,-63,-63, |
254 | -63,-64,-64,-64,-64,-64,-64,-64,-64,-64,-64,-64,-63,-63, | 253 | -63,-64,-64,-64,-64,-64,-64,-64,-64,-64,-64,-64,-63,-63, |
255 | -63,-62,-62,-62,-61,-61,-60,-60,-59,-59,-58,-57,-56,-56, | 254 | -63,-62,-62,-62,-61,-61,-60,-60,-59,-59,-58,-57,-56,-56, |
256 | -55,-54,-53,-52,-51,-50,-49,-48,-47,-46,-45,-44,-43,-42, | 255 | -55,-54,-53,-52,-51,-50,-49,-48,-47,-46,-45,-44,-43,-42, |
257 | -41,-39,-38,-37,-36,-34,-33,-32,-30,-29,-27,-26,-24,-23, | 256 | -41,-39,-38,-37,-36,-34,-33,-32,-30,-29,-27,-26,-24,-23, |
258 | -22,-20,-19,-17,-16,-14,-12,-11,-9,-8,-6,-5,-3,-2,0, | 257 | -22,-20,-19,-17,-16,-14,-12,-11,-9,-8,-6,-5,-3,-2,0, |
259 | 2,3,5,6,8,9,11,12,14,16,17,19,20,22,23,24,26,27,29,30, | 258 | 2,3,5,6,8,9,11,12,14,16,17,19,20,22,23,24,26,27,29,30, |
260 | 32,33,34,36,37,38,39,41,42,43,44,45,46,47,48,49,50,51, | 259 | 32,33,34,36,37,38,39,41,42,43,44,45,46,47,48,49,50,51, |
261 | 52,53,54,55,56,56,57,58,59,59,60,60,61,61,62,62,62,63, | 260 | 52,53,54,55,56,56,57,58,59,59,60,60,61,61,62,62,62,63, |
262 | 63,63,64,64,64,64,64,64,64,64,64,64,64,63,63,63,62,62, | 261 | 63,63,64,64,64,64,64,64,64,64,64,64,64,63,63,63,62,62, |
263 | 62,61,61,60,60,59,59,58,57,56,56,55,54,53,52,51,50,49, | 262 | 62,61,61,60,60,59,59,58,57,56,56,55,54,53,52,51,50,49, |
264 | 48,47,46,45,44,43,42,41,39,38,37,36,34,33,32,30,29,27, | 263 | 48,47,46,45,44,43,42,41,39,38,37,36,34,33,32,30,29,27, |
265 | 26,24,23,22,20,19,17,16,14,12,11,9,8,6,5,3,2 | 264 | 26,24,23,22,20,19,17,16,14,12,11,9,8,6,5,3,2 |
266 | }; | 265 | }; |
267 | 266 | ||
268 | 267 | ||
269 | 268 | ||
270 | extern const DWORD FineLinearSlideUpTable[16]; | 269 | extern const DWORD FineLinearSlideUpTable[16]; |
271 | const DWORD FineLinearSlideUpTable[16] = | 270 | const DWORD FineLinearSlideUpTable[16] = |
272 | { | 271 | { |
273 | 65536, 65595, 65654, 65714,65773, 65832, 65892, 65951, | 272 | 65536, 65595, 65654, 65714,65773, 65832, 65892, 65951, |
274 | 66011, 66071, 66130, 66190, 66250, 66309, 66369, 66429 | 273 | 66011, 66071, 66130, 66190, 66250, 66309, 66369, 66429 |
275 | }; | 274 | }; |
276 | 275 | ||
277 | 276 | ||
278 | extern const DWORD FineLinearSlideDownTable[16]; | 277 | extern const DWORD FineLinearSlideDownTable[16]; |
279 | const DWORD FineLinearSlideDownTable[16] = | 278 | const DWORD FineLinearSlideDownTable[16] = |
280 | { | 279 | { |
281 | 65535, 65477, 65418, 65359, 65300, 65241, 65182, 65123, | 280 | 65535, 65477, 65418, 65359, 65300, 65241, 65182, 65123, |
282 | 65065, 65006, 64947, 64888, 64830, 64772, 64713, 64645 | 281 | 65065, 65006, 64947, 64888, 64830, 64772, 64713, 64645 |
283 | }; | 282 | }; |
284 | 283 | ||
285 | 284 | ||
286 | extern const DWORD LinearSlideUpTable[256]; | 285 | extern const DWORD LinearSlideUpTable[256]; |
287 | const DWORD LinearSlideUpTable[256] = | 286 | const DWORD LinearSlideUpTable[256] = |
288 | { | 287 | { |
289 | 65536, 65773, 66010, 66249, 66489, 66729, 66971, 67213, | 288 | 65536, 65773, 66010, 66249, 66489, 66729, 66971, 67213, |
290 | 67456, 67700, 67945, 68190, 68437, 68685, 68933, 69182, | 289 | 67456, 67700, 67945, 68190, 68437, 68685, 68933, 69182, |
291 | 69432, 69684, 69936, 70189, 70442, 70697, 70953, 71209, | 290 | 69432, 69684, 69936, 70189, 70442, 70697, 70953, 71209, |
292 | 71467, 71725, 71985, 72245, 72507, 72769, 73032, 73296, | 291 | 71467, 71725, 71985, 72245, 72507, 72769, 73032, 73296, |
293 | 73561, 73827, 74094, 74362, 74631, 74901, 75172, 75444, | 292 | 73561, 73827, 74094, 74362, 74631, 74901, 75172, 75444, |
294 | 75717, 75991, 76265, 76541, 76818, 77096, 77375, 77655, | 293 | 75717, 75991, 76265, 76541, 76818, 77096, 77375, 77655, |
295 | 77935, 78217, 78500, 78784, 79069, 79355, 79642, 79930, | 294 | 77935, 78217, 78500, 78784, 79069, 79355, 79642, 79930, |
296 | 80219, 80509, 80800, 81093, 81386, 81680, 81976, 82272, | 295 | 80219, 80509, 80800, 81093, 81386, 81680, 81976, 82272, |
297 | 82570, 82868, 83168, 83469, 83771, 84074, 84378, 84683, | 296 | 82570, 82868, 83168, 83469, 83771, 84074, 84378, 84683, |
298 | 84989, 85297, 85605, 85915, 86225, 86537, 86850, 87164, | 297 | 84989, 85297, 85605, 85915, 86225, 86537, 86850, 87164, |
299 | 87480, 87796, 88113, 88432, 88752, 89073, 89395, 89718, | 298 | 87480, 87796, 88113, 88432, 88752, 89073, 89395, 89718, |
300 | 90043, 90369, 90695, 91023, 91353, 91683, 92015, 92347, | 299 | 90043, 90369, 90695, 91023, 91353, 91683, 92015, 92347, |
301 | 92681, 93017, 93353, 93691, 94029, 94370, 94711, 95053, | 300 | 92681, 93017, 93353, 93691, 94029, 94370, 94711, 95053, |
302 | 95397, 95742, 96088, 96436, 96785, 97135, 97486, 97839, | 301 | 95397, 95742, 96088, 96436, 96785, 97135, 97486, 97839, |
303 | 98193, 98548, 98904, 99262, 99621, 99981, 100343, 100706, | 302 | 98193, 98548, 98904, 99262, 99621, 99981, 100343, 100706, |
304 | 101070, 101435, 101802, 102170, 102540, 102911, 103283, 103657, | 303 | 101070, 101435, 101802, 102170, 102540, 102911, 103283, 103657, |
305 | 104031, 104408, 104785, 105164, 105545, 105926, 106309, 106694, | 304 | 104031, 104408, 104785, 105164, 105545, 105926, 106309, 106694, |
306 | 107080, 107467, 107856, 108246, 108637, 109030, 109425, 109820, | 305 | 107080, 107467, 107856, 108246, 108637, 109030, 109425, 109820, |
307 | 110217, 110616, 111016, 111418, 111821, 112225, 112631, 113038, | 306 | 110217, 110616, 111016, 111418, 111821, 112225, 112631, 113038, |
308 | 113447, 113857, 114269, 114682, 115097, 115514, 115931, 116351, | 307 | 113447, 113857, 114269, 114682, 115097, 115514, 115931, 116351, |
309 | 116771, 117194, 117618, 118043, 118470, 118898, 119328, 119760, | 308 | 116771, 117194, 117618, 118043, 118470, 118898, 119328, 119760, |
310 | 120193, 120628, 121064, 121502, 121941, 122382, 122825, 123269, | 309 | 120193, 120628, 121064, 121502, 121941, 122382, 122825, 123269, |
311 | 123715, 124162, 124611, 125062, 125514, 125968, 126424, 126881, | 310 | 123715, 124162, 124611, 125062, 125514, 125968, 126424, 126881, |
312 | 127340, 127801, 128263, 128727, 129192, 129660, 130129, 130599, | 311 | 127340, 127801, 128263, 128727, 129192, 129660, 130129, 130599, |
313 | 131072, 131546, 132021, 132499, 132978, 133459, 133942, 134426, | 312 | 131072, 131546, 132021, 132499, 132978, 133459, 133942, 134426, |
314 | 134912, 135400, 135890, 136381, 136875, 137370, 137866, 138365, | 313 | 134912, 135400, 135890, 136381, 136875, 137370, 137866, 138365, |
315 | 138865, 139368, 139872, 140378, 140885, 141395, 141906, 142419, | 314 | 138865, 139368, 139872, 140378, 140885, 141395, 141906, 142419, |
316 | 142935, 143451, 143970, 144491, 145014, 145538, 146064, 146593, | 315 | 142935, 143451, 143970, 144491, 145014, 145538, 146064, 146593, |
317 | 147123, 147655, 148189, 148725, 149263, 149803, 150344, 150888, | 316 | 147123, 147655, 148189, 148725, 149263, 149803, 150344, 150888, |
318 | 151434, 151982, 152531, 153083, 153637, 154192, 154750, 155310, | 317 | 151434, 151982, 152531, 153083, 153637, 154192, 154750, 155310, |
319 | 155871, 156435, 157001, 157569, 158138, 158710, 159284, 159860, | 318 | 155871, 156435, 157001, 157569, 158138, 158710, 159284, 159860, |
320 | 160439, 161019, 161601, 162186, 162772, 163361, 163952, 164545, | 319 | 160439, 161019, 161601, 162186, 162772, 163361, 163952, 164545, |
321 | }; | 320 | }; |
322 | 321 | ||
323 | 322 | ||
324 | extern const DWORD LinearSlideDownTable[256]; | 323 | extern const DWORD LinearSlideDownTable[256]; |
325 | const DWORD LinearSlideDownTable[256] = | 324 | const DWORD LinearSlideDownTable[256] = |
326 | { | 325 | { |
327 | 65536, 65299, 65064, 64830, 64596, 64363, 64131, 63900, | 326 | 65536, 65299, 65064, 64830, 64596, 64363, 64131, 63900, |
328 | 63670, 63440, 63212, 62984, 62757, 62531, 62305, 62081, | 327 | 63670, 63440, 63212, 62984, 62757, 62531, 62305, 62081, |
329 | 61857, 61634, 61412, 61191, 60970, 60751, 60532, 60314, | 328 | 61857, 61634, 61412, 61191, 60970, 60751, 60532, 60314, |
330 | 60096, 59880, 59664, 59449, 59235, 59021, 58809, 58597, | 329 | 60096, 59880, 59664, 59449, 59235, 59021, 58809, 58597, |
331 | 58385, 58175, 57965, 57757, 57548, 57341, 57134, 56928, | 330 | 58385, 58175, 57965, 57757, 57548, 57341, 57134, 56928, |
332 | 56723, 56519, 56315, 56112, 55910, 55709, 55508, 55308, | 331 | 56723, 56519, 56315, 56112, 55910, 55709, 55508, 55308, |
333 | 55108, 54910, 54712, 54515, 54318, 54123, 53928, 53733, | 332 | 55108, 54910, 54712, 54515, 54318, 54123, 53928, 53733, |
334 | 333 | ||
335 | 53540, 53347, 53154, 52963, 52772, 52582, 52392, 52204, | 334 | 53540, 53347, 53154, 52963, 52772, 52582, 52392, 52204, |
336 | 52015, 51828, 51641, 51455, 51270, 51085, 50901, 50717, | 335 | 52015, 51828, 51641, 51455, 51270, 51085, 50901, 50717, |
337 | 50535, 50353, 50171, 49990, 49810, 49631, 49452, 49274, | 336 | 50535, 50353, 50171, 49990, 49810, 49631, 49452, 49274, |
338 | 49096, 48919, 48743, 48567, 48392, 48218, 48044, 47871, | 337 | 49096, 48919, 48743, 48567, 48392, 48218, 48044, 47871, |
339 | 47698, 47526, 47355, 47185, 47014, 46845, 46676, 46508, | 338 | 47698, 47526, 47355, 47185, 47014, 46845, 46676, 46508, |
340 | 46340, 46173, 46007, 45841, 45676, 45511, 45347, 45184, | 339 | 46340, 46173, 46007, 45841, 45676, 45511, 45347, 45184, |
341 | 45021, 44859, 44697, 44536, 44376, 44216, 44056, 43898, | 340 | 45021, 44859, 44697, 44536, 44376, 44216, 44056, 43898, |
342 | 43740, 43582, 43425, 43268, 43112, 42957, 42802, 42648, | 341 | 43740, 43582, 43425, 43268, 43112, 42957, 42802, 42648, |
343 | 42494, 42341, 42189, 42037, 41885, 41734, 41584, 41434, | 342 | 42494, 42341, 42189, 42037, 41885, 41734, 41584, 41434, |
344 | 41285, 41136, 40988, 40840, 40693, 40546, 40400, 40254, | 343 | 41285, 41136, 40988, 40840, 40693, 40546, 40400, 40254, |
345 | 40109, 39965, 39821, 39677, 39534, 39392, 39250, 39108, | 344 | 40109, 39965, 39821, 39677, 39534, 39392, 39250, 39108, |
346 | 38967, 38827, 38687, 38548, 38409, 38270, 38132, 37995, | 345 | 38967, 38827, 38687, 38548, 38409, 38270, 38132, 37995, |
347 | 37858, 37722, 37586, 37450, 37315, 37181, 37047, 36913, | 346 | 37858, 37722, 37586, 37450, 37315, 37181, 37047, 36913, |
348 | 36780, 36648, 36516, 36384, 36253, 36122, 35992, 35862, | 347 | 36780, 36648, 36516, 36384, 36253, 36122, 35992, 35862, |
349 | 35733, 35604, 35476, 35348, 35221, 35094, 34968, 34842, | 348 | 35733, 35604, 35476, 35348, 35221, 35094, 34968, 34842, |
350 | 34716, 34591, 34466, 34342, 34218, 34095, 33972, 33850, | 349 | 34716, 34591, 34466, 34342, 34218, 34095, 33972, 33850, |
351 | 33728, 33606, 33485, 33364, 33244, 33124, 33005, 32886, | 350 | 33728, 33606, 33485, 33364, 33244, 33124, 33005, 32886, |
352 | 32768, 32649, 32532, 32415, 32298, 32181, 32065, 31950, | 351 | 32768, 32649, 32532, 32415, 32298, 32181, 32065, 31950, |
353 | 31835, 31720, 31606, 31492, 31378, 31265, 31152, 31040, | 352 | 31835, 31720, 31606, 31492, 31378, 31265, 31152, 31040, |
354 | 30928, 30817, 30706, 30595, 30485, 30375, 30266, 30157, | 353 | 30928, 30817, 30706, 30595, 30485, 30375, 30266, 30157, |
355 | 30048, 29940, 29832, 29724, 29617, 29510, 29404, 29298, | 354 | 30048, 29940, 29832, 29724, 29617, 29510, 29404, 29298, |
356 | 29192, 29087, 28982, 28878, 28774, 28670, 28567, 28464, | 355 | 29192, 29087, 28982, 28878, 28774, 28670, 28567, 28464, |
357 | 28361, 28259, 28157, 28056, 27955, 27854, 27754, 27654, | 356 | 28361, 28259, 28157, 28056, 27955, 27854, 27754, 27654, |
358 | 27554, 27455, 27356, 27257, 27159, 27061, 26964, 26866, | 357 | 27554, 27455, 27356, 27257, 27159, 27061, 26964, 26866, |
359 | 26770, 26673, 26577, 26481, 26386, 26291, 26196, 26102, | 358 | 26770, 26673, 26577, 26481, 26386, 26291, 26196, 26102, |
360 | }; | 359 | }; |
361 | 360 | ||
362 | 361 | ||
363 | extern const int SpectrumSinusTable[256*2]; | 362 | extern const int SpectrumSinusTable[256*2]; |
364 | const int SpectrumSinusTable[256*2] = | 363 | const int SpectrumSinusTable[256*2] = |
365 | { | 364 | { |
366 | 0, 1, 1, 2, 3, 3, 4, 5, 6, 7, 7, 8, 9, 10, 10, 11, | 365 | 0, 1, 1, 2, 3, 3, 4, 5, 6, 7, 7, 8, 9, 10, 10, 11, |
367 | 12, 13, 14, 14, 15, 16, 17, 17, 18, 19, 20, 20, 21, 22, 22, 23, | 366 | 12, 13, 14, 14, 15, 16, 17, 17, 18, 19, 20, 20, 21, 22, 22, 23, |
368 | 24, 25, 25, 26, 27, 28, 28, 29, 30, 30, 31, 32, 32, 33, 34, 34, | 367 | 24, 25, 25, 26, 27, 28, 28, 29, 30, 30, 31, 32, 32, 33, 34, 34, |
369 | 35, 36, 36, 37, 38, 38, 39, 39, 40, 41, 41, 42, 42, 43, 44, 44, | 368 | 35, 36, 36, 37, 38, 38, 39, 39, 40, 41, 41, 42, 42, 43, 44, 44, |
370 | 45, 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 51, 51, 52, 52, | 369 | 45, 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 51, 51, 52, 52, |
371 | 53, 53, 53, 54, 54, 55, 55, 55, 56, 56, 57, 57, 57, 58, 58, 58, | 370 | 53, 53, 53, 54, 54, 55, 55, 55, 56, 56, 57, 57, 57, 58, 58, 58, |
372 | 59, 59, 59, 59, 60, 60, 60, 60, 61, 61, 61, 61, 61, 62, 62, 62, | 371 | 59, 59, 59, 59, 60, 60, 60, 60, 61, 61, 61, 61, 61, 62, 62, 62, |
373 | 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, | 372 | 62, 62, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, |
374 | 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, | 373 | 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 62, 62, |
375 | 62, 62, 62, 62, 61, 61, 61, 61, 61, 60, 60, 60, 60, 59, 59, 59, | 374 | 62, 62, 62, 62, 61, 61, 61, 61, 61, 60, 60, 60, 60, 59, 59, 59, |
376 | 59, 58, 58, 58, 57, 57, 57, 56, 56, 55, 55, 55, 54, 54, 53, 53, | 375 | 59, 58, 58, 58, 57, 57, 57, 56, 56, 55, 55, 55, 54, 54, 53, 53, |
377 | 53, 52, 52, 51, 51, 50, 50, 49, 49, 48, 48, 47, 47, 46, 46, 45, | 376 | 53, 52, 52, 51, 51, 50, 50, 49, 49, 48, 48, 47, 47, 46, 46, 45, |
378 | 45, 44, 44, 43, 42, 42, 41, 41, 40, 39, 39, 38, 38, 37, 36, 36, | 377 | 45, 44, 44, 43, 42, 42, 41, 41, 40, 39, 39, 38, 38, 37, 36, 36, |
379 | 35, 34, 34, 33, 32, 32, 31, 30, 30, 29, 28, 28, 27, 26, 25, 25, | 378 | 35, 34, 34, 33, 32, 32, 31, 30, 30, 29, 28, 28, 27, 26, 25, 25, |
380 | 24, 23, 22, 22, 21, 20, 20, 19, 18, 17, 17, 16, 15, 14, 14, 13, | 379 | 24, 23, 22, 22, 21, 20, 20, 19, 18, 17, 17, 16, 15, 14, 14, 13, |
381 | 12, 11, 10, 10, 9, 8, 7, 7, 6, 5, 4, 3, 3, 2, 1, 0, | 380 | 12, 11, 10, 10, 9, 8, 7, 7, 6, 5, 4, 3, 3, 2, 1, 0, |
382 | 0, -1, -1, -2, -3, -3, -4, -5, -6, -7, -7, -8, -9, -10, -10, -11, | 381 | 0, -1, -1, -2, -3, -3, -4, -5, -6, -7, -7, -8, -9, -10, -10, -11, |
383 | -12, -13, -14, -14, -15, -16, -17, -17, -18, -19, -20, -20, -21, -22, -22, -23, | 382 | -12, -13, -14, -14, -15, -16, -17, -17, -18, -19, -20, -20, -21, -22, -22, -23, |
384 | -24, -25, -25, -26, -27, -28, -28, -29, -30, -30, -31, -32, -32, -33, -34, -34, | 383 | -24, -25, -25, -26, -27, -28, -28, -29, -30, -30, -31, -32, -32, -33, -34, -34, |
385 | -35, -36, -36, -37, -38, -38, -39, -39, -40, -41, -41, -42, -42, -43, -44, -44, | 384 | -35, -36, -36, -37, -38, -38, -39, -39, -40, -41, -41, -42, -42, -43, -44, -44, |
386 | -45, -45, -46, -46, -47, -47, -48, -48, -49, -49, -50, -50, -51, -51, -52, -52, | 385 | -45, -45, -46, -46, -47, -47, -48, -48, -49, -49, -50, -50, -51, -51, -52, -52, |
387 | -53, -53, -53, -54, -54, -55, -55, -55, -56, -56, -57, -57, -57, -58, -58, -58, | 386 | -53, -53, -53, -54, -54, -55, -55, -55, -56, -56, -57, -57, -57, -58, -58, -58, |
388 | -59, -59, -59, -59, -60, -60, -60, -60, -61, -61, -61, -61, -61, -62, -62, -62, | 387 | -59, -59, -59, -59, -60, -60, -60, -60, -61, -61, -61, -61, -61, -62, -62, -62, |
389 | -62, -62, -62, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, | 388 | -62, -62, -62, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, |
390 | -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -62, -62, | 389 | -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, -62, -62, |
391 | -62, -62, -62, -62, -61, -61, -61, -61, -61, -60, -60, -60, -60, -59, -59, -59, | 390 | -62, -62, -62, -62, -61, -61, -61, -61, -61, -60, -60, -60, -60, -59, -59, -59, |
392 | -59, -58, -58, -58, -57, -57, -57, -56, -56, -55, -55, -55, -54, -54, -53, -53, | 391 | -59, -58, -58, -58, -57, -57, -57, -56, -56, -55, -55, -55, -54, -54, -53, -53, |
393 | -53, -52, -52, -51, -51, -50, -50, -49, -49, -48, -48, -47, -47, -46, -46, -45, | 392 | -53, -52, -52, -51, -51, -50, -50, -49, -49, -48, -48, -47, -47, -46, -46, -45, |
394 | -45, -44, -44, -43, -42, -42, -41, -41, -40, -39, -39, -38, -38, -37, -36, -36, | 393 | -45, -44, -44, -43, -42, -42, -41, -41, -40, -39, -39, -38, -38, -37, -36, -36, |
395 | -35, -34, -34, -33, -32, -32, -31, -30, -30, -29, -28, -28, -27, -26, -25, -25, | 394 | -35, -34, -34, -33, -32, -32, -31, -30, -30, -29, -28, -28, -27, -26, -25, -25, |
396 | -24, -23, -22, -22, -21, -20, -20, -19, -18, -17, -17, -16, -15, -14, -14, -13, | 395 | -24, -23, -22, -22, -21, -20, -20, -19, -18, -17, -17, -16, -15, -14, -14, -13, |
397 | -12, -11, -10, -10, -9, -8, -7, -7, -6, -5, -4, -3, -3, -2, -1, 0, | 396 | -12, -11, -10, -10, -9, -8, -7, -7, -6, -5, -4, -3, -3, -2, -1, 0, |
398 | }; | 397 | }; |
399 | 398 | ||
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index b393230..8016d8e 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -1,1482 +1,1482 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | // code added by L. J. Potter Sat 03-02-2002 06:17:54 | 20 | // code added by L. J. Potter Sat 03-02-2002 06:17:54 |
21 | #define QTOPIA_INTERNAL_FSLP | 21 | #define QTOPIA_INTERNAL_FSLP |
22 | #include <qpe/qcopenvelope_qws.h> | 22 | #include <qpe/qcopenvelope_qws.h> |
23 | 23 | ||
24 | #include <qpe/qpemenubar.h> | 24 | #include <qpe/qpemenubar.h> |
25 | #include <qpe/qpetoolbar.h> | 25 | #include <qpe/qpetoolbar.h> |
26 | #include <qpe/fileselector.h> | 26 | #include <qpe/fileselector.h> |
27 | #include <qpe/qpeapplication.h> | 27 | #include <qpe/qpeapplication.h> |
28 | #include <qpe/lnkproperties.h> | 28 | #include <qpe/lnkproperties.h> |
29 | #include <qpe/storage.h> | 29 | #include <qpe/storage.h> |
30 | 30 | ||
31 | #include <qpe/applnk.h> | 31 | #include <qpe/applnk.h> |
32 | #include <qpe/config.h> | 32 | #include <qpe/config.h> |
33 | #include <qpe/global.h> | 33 | #include <qpe/global.h> |
34 | #include <qpe/resource.h> | 34 | #include <qpe/resource.h> |
35 | #include <qaction.h> | 35 | #include <qaction.h> |
36 | #include <qcursor.h> | 36 | #include <qcursor.h> |
37 | #include <qimage.h> | 37 | #include <qimage.h> |
38 | #include <qfile.h> | 38 | #include <qfile.h> |
39 | #include <qdir.h> | 39 | #include <qdir.h> |
40 | #include <qlayout.h> | 40 | #include <qlayout.h> |
41 | #include <qlabel.h> | 41 | #include <qlabel.h> |
42 | #include <qlist.h> | 42 | #include <qlist.h> |
43 | #include <qlistbox.h> | 43 | #include <qlistbox.h> |
44 | #include <qmainwindow.h> | 44 | #include <qmainwindow.h> |
45 | #include <qmessagebox.h> | 45 | #include <qmessagebox.h> |
46 | #include <qtoolbutton.h> | 46 | #include <qtoolbutton.h> |
47 | #include <qtabwidget.h> | 47 | #include <qtabwidget.h> |
48 | #include <qlistview.h> | 48 | #include <qlistview.h> |
49 | #include <qpoint.h> | 49 | #include <qpoint.h> |
50 | #include <qlineedit.h> | 50 | #include <qlineedit.h> |
51 | #include <qpushbutton.h> | 51 | #include <qpushbutton.h> |
52 | #include <qregexp.h> | 52 | #include <qregexp.h> |
53 | #include <qtextstream.h> | 53 | #include <qtextstream.h> |
54 | 54 | ||
55 | //#include <qtimer.h> | 55 | //#include <qtimer.h> |
56 | 56 | ||
57 | #include "playlistselection.h" | 57 | #include "playlistselection.h" |
58 | #include "playlistwidget.h" | 58 | #include "playlistwidget.h" |
59 | #include "mediaplayerstate.h" | 59 | #include "mediaplayerstate.h" |
60 | 60 | ||
61 | #include "inputDialog.h" | 61 | #include "inputDialog.h" |
62 | 62 | ||
63 | #include <stdlib.h> | 63 | #include <stdlib.h> |
64 | #include "audiowidget.h" | 64 | #include "audiowidget.h" |
65 | #include "videowidget.h" | 65 | #include "videowidget.h" |
66 | 66 | ||
67 | #include <unistd.h> | 67 | #include <unistd.h> |
68 | #include <sys/file.h> | 68 | #include <sys/file.h> |
69 | #include <sys/ioctl.h> | 69 | #include <sys/ioctl.h> |
70 | #include <sys/soundcard.h> | 70 | #include <sys/soundcard.h> |
71 | 71 | ||
72 | // for setBacklight() | 72 | // for setBacklight() |
73 | #include <linux/fb.h> | 73 | #include <linux/fb.h> |
74 | #include <sys/types.h> | 74 | #include <sys/types.h> |
75 | #include <sys/stat.h> | 75 | #include <sys/stat.h> |
76 | #include <stdlib.h> | 76 | #include <stdlib.h> |
77 | 77 | ||
78 | #define BUTTONS_ON_TOOLBAR | 78 | #define BUTTONS_ON_TOOLBAR |
79 | #define SIDE_BUTTONS | 79 | #define SIDE_BUTTONS |
80 | #define CAN_SAVE_LOAD_PLAYLISTS | 80 | #define CAN_SAVE_LOAD_PLAYLISTS |
81 | 81 | ||
82 | extern AudioWidget *audioUI; | 82 | extern AudioWidget *audioUI; |
83 | extern VideoWidget *videoUI; | 83 | extern VideoWidget *videoUI; |
84 | extern MediaPlayerState *mediaPlayerState; | 84 | extern MediaPlayerState *mediaPlayerState; |
85 | 85 | ||
86 | static inline QString fullBaseName ( const QFileInfo &fi ) | 86 | static inline QString fullBaseName ( const QFileInfo &fi ) |
87 | { | 87 | { |
88 | QString str = fi. fileName ( ); | 88 | QString str = fi. fileName ( ); |
89 | return str. left ( str. findRev ( '.' )); | 89 | return str. left ( str. findRev ( '.' )); |
90 | } | 90 | } |
91 | 91 | ||
92 | 92 | ||
93 | QString audioMimes ="audio/mpeg;audio/x-wav;audio/x-ogg;audio/x-mod;audio/x-ogg"; | 93 | QString audioMimes ="audio/mpeg;audio/x-wav;application/ogg;audio/x-mod"; |
94 | // class myFileSelector { | 94 | // class myFileSelector { |
95 | 95 | ||
96 | // }; | 96 | // }; |
97 | class PlayListWidgetPrivate { | 97 | class PlayListWidgetPrivate { |
98 | public: | 98 | public: |
99 | QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; | 99 | QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; |
100 | QFrame *playListFrame; | 100 | QFrame *playListFrame; |
101 | FileSelector *files; | 101 | FileSelector *files; |
102 | PlayListSelection *selectedFiles; | 102 | PlayListSelection *selectedFiles; |
103 | bool setDocumentUsed; | 103 | bool setDocumentUsed; |
104 | DocLnk *current; | 104 | DocLnk *current; |
105 | }; | 105 | }; |
106 | 106 | ||
107 | 107 | ||
108 | class ToolButton : public QToolButton { | 108 | class ToolButton : public QToolButton { |
109 | public: | 109 | public: |
110 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) | 110 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) |
111 | : QToolButton( parent, name ) { | 111 | : QToolButton( parent, name ) { |
112 | setTextLabel( name ); | 112 | setTextLabel( name ); |
113 | setPixmap( Resource::loadPixmap( icon ) ); | 113 | setPixmap( Resource::loadPixmap( icon ) ); |
114 | setAutoRaise( TRUE ); | 114 | setAutoRaise( TRUE ); |
115 | setFocusPolicy( QWidget::NoFocus ); | 115 | setFocusPolicy( QWidget::NoFocus ); |
116 | setToggleButton( t ); | 116 | setToggleButton( t ); |
117 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); | 117 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); |
118 | QPEMenuToolFocusManager::manager()->addWidget( this ); | 118 | QPEMenuToolFocusManager::manager()->addWidget( this ); |
119 | } | 119 | } |
120 | }; | 120 | }; |
121 | 121 | ||
122 | 122 | ||
123 | class MenuItem : public QAction { | 123 | class MenuItem : public QAction { |
124 | public: | 124 | public: |
125 | MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) | 125 | MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) |
126 | : QAction( text, QString::null, 0, 0 ) { | 126 | : QAction( text, QString::null, 0, 0 ) { |
127 | connect( this, SIGNAL( activated() ), handler, slot ); | 127 | connect( this, SIGNAL( activated() ), handler, slot ); |
128 | addTo( parent ); | 128 | addTo( parent ); |
129 | } | 129 | } |
130 | }; | 130 | }; |
131 | 131 | ||
132 | 132 | ||
133 | PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | 133 | PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) |
134 | : QMainWindow( parent, name, fl ) { | 134 | : QMainWindow( parent, name, fl ) { |
135 | 135 | ||
136 | d = new PlayListWidgetPrivate; | 136 | d = new PlayListWidgetPrivate; |
137 | d->setDocumentUsed = FALSE; | 137 | d->setDocumentUsed = FALSE; |
138 | d->current = NULL; | 138 | d->current = NULL; |
139 | fromSetDocument = FALSE; | 139 | fromSetDocument = FALSE; |
140 | insanityBool=FALSE; | 140 | insanityBool=FALSE; |
141 | audioScan = FALSE; | 141 | audioScan = FALSE; |
142 | videoScan = FALSE; | 142 | videoScan = FALSE; |
143 | // menuTimer = new QTimer( this ,"menu timer"), | 143 | // menuTimer = new QTimer( this ,"menu timer"), |
144 | // connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); | 144 | // connect( menuTimer, SIGNAL( timeout() ), SLOT( addSelected() ) ); |
145 | channel = new QCopChannel( "QPE/Application/opieplayer", this ); | 145 | channel = new QCopChannel( "QPE/Application/opieplayer", this ); |
146 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), | 146 | connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), |
147 | this, SLOT( qcopReceive(const QCString&, const QByteArray&)) ); | 147 | this, SLOT( qcopReceive(const QCString&, const QByteArray&)) ); |
148 | 148 | ||
149 | setBackgroundMode( PaletteButton ); | 149 | setBackgroundMode( PaletteButton ); |
150 | 150 | ||
151 | setCaption( tr("OpiePlayer") ); | 151 | setCaption( tr("OpiePlayer") ); |
152 | setIcon( Resource::loadPixmap( "opieplayer/MPEGPlayer" ) ); | 152 | setIcon( Resource::loadPixmap( "opieplayer/MPEGPlayer" ) ); |
153 | 153 | ||
154 | setToolBarsMovable( FALSE ); | 154 | setToolBarsMovable( FALSE ); |
155 | 155 | ||
156 | // Create Toolbar | 156 | // Create Toolbar |
157 | QPEToolBar *toolbar = new QPEToolBar( this ); | 157 | QPEToolBar *toolbar = new QPEToolBar( this ); |
158 | toolbar->setHorizontalStretchable( TRUE ); | 158 | toolbar->setHorizontalStretchable( TRUE ); |
159 | 159 | ||
160 | // Create Menubar | 160 | // Create Menubar |
161 | QPEMenuBar *menu = new QPEMenuBar( toolbar ); | 161 | QPEMenuBar *menu = new QPEMenuBar( toolbar ); |
162 | menu->setMargin( 0 ); | 162 | menu->setMargin( 0 ); |
163 | 163 | ||
164 | QPEToolBar *bar = new QPEToolBar( this ); | 164 | QPEToolBar *bar = new QPEToolBar( this ); |
165 | bar->setLabel( tr( "Play Operations" ) ); | 165 | bar->setLabel( tr( "Play Operations" ) ); |
166 | // d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "opieplayer/play_current_list", | 166 | // d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "opieplayer/play_current_list", |
167 | // this , SLOT( addSelected()) ); | 167 | // this , SLOT( addSelected()) ); |
168 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); | 168 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); |
169 | tbDeletePlaylist->setFlat(TRUE); | 169 | tbDeletePlaylist->setFlat(TRUE); |
170 | 170 | ||
171 | tbDeletePlaylist->setFixedSize(20,20); | 171 | tbDeletePlaylist->setFixedSize(20,20); |
172 | 172 | ||
173 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist", | 173 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist", |
174 | this , SLOT(addSelected()) ); | 174 | this , SLOT(addSelected()) ); |
175 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist", | 175 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist", |
176 | this , SLOT(removeSelected()) ); | 176 | this , SLOT(removeSelected()) ); |
177 | // d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool) /* btnPlay() */), TRUE ); | 177 | // d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool) /* btnPlay() */), TRUE ); |
178 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", | 178 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", |
179 | this , SLOT( btnPlay(bool) ), TRUE ); | 179 | this , SLOT( btnPlay(bool) ), TRUE ); |
180 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle", | 180 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle", |
181 | mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); | 181 | mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); |
182 | d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer/loop", | 182 | d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer/loop", |
183 | mediaPlayerState, SLOT(setLooping(bool)), TRUE ); | 183 | mediaPlayerState, SLOT(setLooping(bool)), TRUE ); |
184 | tbDeletePlaylist->hide(); | 184 | tbDeletePlaylist->hide(); |
185 | 185 | ||
186 | QPopupMenu *pmPlayList = new QPopupMenu( this ); | 186 | QPopupMenu *pmPlayList = new QPopupMenu( this ); |
187 | menu->insertItem( tr( "File" ), pmPlayList ); | 187 | menu->insertItem( tr( "File" ), pmPlayList ); |
188 | new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); | 188 | new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); |
189 | new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); | 189 | new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); |
190 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); | 190 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); |
191 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); | 191 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); |
192 | pmPlayList->insertSeparator(-1); | 192 | pmPlayList->insertSeparator(-1); |
193 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); | 193 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); |
194 | new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); | 194 | new MenuItem( pmPlayList, tr( "Open File or URL" ), this,SLOT( openFile() ) ); |
195 | pmPlayList->insertSeparator(-1); | 195 | pmPlayList->insertSeparator(-1); |
196 | new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); | 196 | new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), this,SLOT( scanForAudio() ) ); |
197 | new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); | 197 | new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), this,SLOT( scanForVideo() ) ); |
198 | 198 | ||
199 | QPopupMenu *pmView = new QPopupMenu( this ); | 199 | QPopupMenu *pmView = new QPopupMenu( this ); |
200 | menu->insertItem( tr( "View" ), pmView ); | 200 | menu->insertItem( tr( "View" ), pmView ); |
201 | 201 | ||
202 | fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); | 202 | fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0); |
203 | fullScreenButton->addTo(pmView); | 203 | fullScreenButton->addTo(pmView); |
204 | scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0); | 204 | scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("opieplayer/scale"), QString::null, 0, this, 0); |
205 | scaleButton->addTo(pmView); | 205 | scaleButton->addTo(pmView); |
206 | 206 | ||
207 | 207 | ||
208 | skinsMenu = new QPopupMenu( this ); | 208 | skinsMenu = new QPopupMenu( this ); |
209 | menu->insertItem( tr( "Skins" ), skinsMenu ); | 209 | menu->insertItem( tr( "Skins" ), skinsMenu ); |
210 | skinsMenu->isCheckable(); | 210 | skinsMenu->isCheckable(); |
211 | connect( skinsMenu, SIGNAL( activated( int ) ) , | 211 | connect( skinsMenu, SIGNAL( activated( int ) ) , |
212 | this, SLOT( skinsMenuActivated( int ) ) ); | 212 | this, SLOT( skinsMenuActivated( int ) ) ); |
213 | populateSkinsMenu(); | 213 | populateSkinsMenu(); |
214 | 214 | ||
215 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); | 215 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); |
216 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); | 216 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); |
217 | 217 | ||
218 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); | 218 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); |
219 | 219 | ||
220 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); | 220 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); |
221 | // tabWidget->setTabShape(QTabWidget::Triangular); | 221 | // tabWidget->setTabShape(QTabWidget::Triangular); |
222 | 222 | ||
223 | QWidget *pTab; | 223 | QWidget *pTab; |
224 | pTab = new QWidget( tabWidget, "pTab" ); | 224 | pTab = new QWidget( tabWidget, "pTab" ); |
225 | // playlistView = new QListView( pTab, "playlistview" ); | 225 | // playlistView = new QListView( pTab, "playlistview" ); |
226 | // playlistView->setMinimumSize(236,260); | 226 | // playlistView->setMinimumSize(236,260); |
227 | tabWidget->insertTab( pTab,"Playlist"); | 227 | tabWidget->insertTab( pTab,"Playlist"); |
228 | 228 | ||
229 | 229 | ||
230 | // Add the playlist area | 230 | // Add the playlist area |
231 | 231 | ||
232 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); | 232 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); |
233 | d->playListFrame = vbox3; | 233 | d->playListFrame = vbox3; |
234 | 234 | ||
235 | QGridLayout *layoutF = new QGridLayout( pTab ); | 235 | QGridLayout *layoutF = new QGridLayout( pTab ); |
236 | layoutF->setSpacing( 2); | 236 | layoutF->setSpacing( 2); |
237 | layoutF->setMargin( 2); | 237 | layoutF->setMargin( 2); |
238 | layoutF->addMultiCellWidget( d->playListFrame , 0, 0, 0, 1 ); | 238 | layoutF->addMultiCellWidget( d->playListFrame , 0, 0, 0, 1 ); |
239 | 239 | ||
240 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); | 240 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); |
241 | 241 | ||
242 | d->selectedFiles = new PlayListSelection( hbox2); | 242 | d->selectedFiles = new PlayListSelection( hbox2); |
243 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); | 243 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); |
244 | 244 | ||
245 | QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); | 245 | QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); |
246 | 246 | ||
247 | 247 | ||
248 | 248 | ||
249 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch | 249 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch |
250 | new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); | 250 | new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); |
251 | new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); | 251 | new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); |
252 | new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); | 252 | new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); |
253 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch | 253 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch |
254 | 254 | ||
255 | QWidget *aTab; | 255 | QWidget *aTab; |
256 | aTab = new QWidget( tabWidget, "aTab" ); | 256 | aTab = new QWidget( tabWidget, "aTab" ); |
257 | audioView = new QListView( aTab, "Audioview" ); | 257 | audioView = new QListView( aTab, "Audioview" ); |
258 | 258 | ||
259 | QGridLayout *layoutA = new QGridLayout( aTab ); | 259 | QGridLayout *layoutA = new QGridLayout( aTab ); |
260 | layoutA->setSpacing( 2); | 260 | layoutA->setSpacing( 2); |
261 | layoutA->setMargin( 2); | 261 | layoutA->setMargin( 2); |
262 | layoutA->addMultiCellWidget( audioView, 0, 0, 0, 1 ); | 262 | layoutA->addMultiCellWidget( audioView, 0, 0, 0, 1 ); |
263 | 263 | ||
264 | audioView->addColumn( tr("Title"),-1); | 264 | audioView->addColumn( tr("Title"),-1); |
265 | audioView->addColumn(tr("Size"), -1); | 265 | audioView->addColumn(tr("Size"), -1); |
266 | audioView->addColumn(tr("Media"),-1); | 266 | audioView->addColumn(tr("Media"),-1); |
267 | audioView->addColumn( tr( "Path" ), -1 ); | 267 | audioView->addColumn( tr( "Path" ), -1 ); |
268 | 268 | ||
269 | audioView->setColumnAlignment(1, Qt::AlignRight); | 269 | audioView->setColumnAlignment(1, Qt::AlignRight); |
270 | audioView->setColumnAlignment(2, Qt::AlignRight); | 270 | audioView->setColumnAlignment(2, Qt::AlignRight); |
271 | audioView->setAllColumnsShowFocus(TRUE); | 271 | audioView->setAllColumnsShowFocus(TRUE); |
272 | 272 | ||
273 | audioView->setMultiSelection( TRUE ); | 273 | audioView->setMultiSelection( TRUE ); |
274 | audioView->setSelectionMode( QListView::Extended); | 274 | audioView->setSelectionMode( QListView::Extended); |
275 | audioView->setSorting( 3, TRUE ); | 275 | audioView->setSorting( 3, TRUE ); |
276 | 276 | ||
277 | tabWidget->insertTab(aTab,tr("Audio")); | 277 | tabWidget->insertTab(aTab,tr("Audio")); |
278 | 278 | ||
279 | QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); | 279 | QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); |
280 | 280 | ||
281 | // audioView | 281 | // audioView |
282 | // populateAudioView(); | 282 | // populateAudioView(); |
283 | // videowidget | 283 | // videowidget |
284 | 284 | ||
285 | QWidget *vTab; | 285 | QWidget *vTab; |
286 | vTab = new QWidget( tabWidget, "vTab" ); | 286 | vTab = new QWidget( tabWidget, "vTab" ); |
287 | videoView = new QListView( vTab, "Videoview" ); | 287 | videoView = new QListView( vTab, "Videoview" ); |
288 | 288 | ||
289 | QGridLayout *layoutV = new QGridLayout( vTab ); | 289 | QGridLayout *layoutV = new QGridLayout( vTab ); |
290 | layoutV->setSpacing( 2); | 290 | layoutV->setSpacing( 2); |
291 | layoutV->setMargin( 2); | 291 | layoutV->setMargin( 2); |
292 | layoutV->addMultiCellWidget( videoView, 0, 0, 0, 1 ); | 292 | layoutV->addMultiCellWidget( videoView, 0, 0, 0, 1 ); |
293 | 293 | ||
294 | videoView->addColumn(tr("Title"),-1); | 294 | videoView->addColumn(tr("Title"),-1); |
295 | videoView->addColumn(tr("Size"),-1); | 295 | videoView->addColumn(tr("Size"),-1); |
296 | videoView->addColumn(tr("Media"),-1); | 296 | videoView->addColumn(tr("Media"),-1); |
297 | videoView->addColumn(tr( "Path" ), -1 ); | 297 | videoView->addColumn(tr( "Path" ), -1 ); |
298 | videoView->setColumnAlignment(1, Qt::AlignRight); | 298 | videoView->setColumnAlignment(1, Qt::AlignRight); |
299 | videoView->setColumnAlignment(2, Qt::AlignRight); | 299 | videoView->setColumnAlignment(2, Qt::AlignRight); |
300 | videoView->setAllColumnsShowFocus(TRUE); | 300 | videoView->setAllColumnsShowFocus(TRUE); |
301 | videoView->setMultiSelection( TRUE ); | 301 | videoView->setMultiSelection( TRUE ); |
302 | videoView->setSelectionMode( QListView::Extended); | 302 | videoView->setSelectionMode( QListView::Extended); |
303 | 303 | ||
304 | QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); | 304 | QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); |
305 | 305 | ||
306 | tabWidget->insertTab( vTab,tr("Video")); | 306 | tabWidget->insertTab( vTab,tr("Video")); |
307 | 307 | ||
308 | QWidget *LTab; | 308 | QWidget *LTab; |
309 | LTab = new QWidget( tabWidget, "LTab" ); | 309 | LTab = new QWidget( tabWidget, "LTab" ); |
310 | playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE); | 310 | playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE); |
311 | 311 | ||
312 | QGridLayout *layoutL = new QGridLayout( LTab ); | 312 | QGridLayout *layoutL = new QGridLayout( LTab ); |
313 | layoutL->setSpacing( 2); | 313 | layoutL->setSpacing( 2); |
314 | layoutL->setMargin( 2); | 314 | layoutL->setMargin( 2); |
315 | layoutL->addMultiCellWidget( playLists, 0, 0, 0, 1 ); | 315 | layoutL->addMultiCellWidget( playLists, 0, 0, 0, 1 ); |
316 | 316 | ||
317 | tabWidget->insertTab(LTab,tr("Lists")); | 317 | tabWidget->insertTab(LTab,tr("Lists")); |
318 | 318 | ||
319 | connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); | 319 | connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); |
320 | connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); | 320 | connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); |
321 | connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); | 321 | connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); |
322 | 322 | ||
323 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 323 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
324 | this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); | 324 | this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); |
325 | 325 | ||
326 | 326 | ||
327 | ///audioView | 327 | ///audioView |
328 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 328 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
329 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); | 329 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); |
330 | 330 | ||
331 | connect( audioView, SIGNAL( returnPressed( QListViewItem *)), | 331 | connect( audioView, SIGNAL( returnPressed( QListViewItem *)), |
332 | this,SLOT( playIt( QListViewItem *)) ); | 332 | this,SLOT( playIt( QListViewItem *)) ); |
333 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); | 333 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); |
334 | 334 | ||
335 | 335 | ||
336 | //videoView | 336 | //videoView |
337 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 337 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
338 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); | 338 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); |
339 | connect( videoView, SIGNAL( returnPressed( QListViewItem *)), | 339 | connect( videoView, SIGNAL( returnPressed( QListViewItem *)), |
340 | this,SLOT( playIt( QListViewItem *)) ); | 340 | this,SLOT( playIt( QListViewItem *)) ); |
341 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); | 341 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); |
342 | 342 | ||
343 | //playlists | 343 | //playlists |
344 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); | 344 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); |
345 | 345 | ||
346 | connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); | 346 | connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); |
347 | 347 | ||
348 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); | 348 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); |
349 | 349 | ||
350 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); | 350 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); |
351 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); | 351 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); |
352 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); | 352 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); |
353 | 353 | ||
354 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); | 354 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); |
355 | 355 | ||
356 | setCentralWidget( vbox5 ); | 356 | setCentralWidget( vbox5 ); |
357 | 357 | ||
358 | Config cfg( "OpiePlayer" ); | 358 | Config cfg( "OpiePlayer" ); |
359 | readConfig( cfg ); | 359 | readConfig( cfg ); |
360 | 360 | ||
361 | currentPlayList = cfg.readEntry("CurrentPlaylist","default"); | 361 | currentPlayList = cfg.readEntry("CurrentPlaylist","default"); |
362 | loadList(DocLnk( currentPlayList)); | 362 | loadList(DocLnk( currentPlayList)); |
363 | setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(currentPlayList))); | 363 | setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(currentPlayList))); |
364 | 364 | ||
365 | initializeStates(); | 365 | initializeStates(); |
366 | } | 366 | } |
367 | 367 | ||
368 | 368 | ||
369 | PlayListWidget::~PlayListWidget() { | 369 | PlayListWidget::~PlayListWidget() { |
370 | Config cfg( "OpiePlayer" ); | 370 | Config cfg( "OpiePlayer" ); |
371 | writeConfig( cfg ); | 371 | writeConfig( cfg ); |
372 | 372 | ||
373 | if ( d->current ) | 373 | if ( d->current ) |
374 | delete d->current; | 374 | delete d->current; |
375 | if(d) delete d; | 375 | if(d) delete d; |
376 | } | 376 | } |
377 | 377 | ||
378 | 378 | ||
379 | void PlayListWidget::initializeStates() { | 379 | void PlayListWidget::initializeStates() { |
380 | 380 | ||
381 | d->tbPlay->setOn( mediaPlayerState->playing() ); | 381 | d->tbPlay->setOn( mediaPlayerState->playing() ); |
382 | d->tbLoop->setOn( mediaPlayerState->looping() ); | 382 | d->tbLoop->setOn( mediaPlayerState->looping() ); |
383 | d->tbShuffle->setOn( mediaPlayerState->shuffled() ); | 383 | d->tbShuffle->setOn( mediaPlayerState->shuffled() ); |
384 | setPlaylist( true); | 384 | setPlaylist( true); |
385 | } | 385 | } |
386 | 386 | ||
387 | 387 | ||
388 | void PlayListWidget::readConfig( Config& cfg ) { | 388 | void PlayListWidget::readConfig( Config& cfg ) { |
389 | cfg.setGroup("PlayList"); | 389 | cfg.setGroup("PlayList"); |
390 | QString currentString = cfg.readEntry("current", "" ); | 390 | QString currentString = cfg.readEntry("current", "" ); |
391 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 391 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
392 | for ( int i = 0; i < noOfFiles; i++ ) { | 392 | for ( int i = 0; i < noOfFiles; i++ ) { |
393 | QString entryName; | 393 | QString entryName; |
394 | entryName.sprintf( "File%i", i + 1 ); | 394 | entryName.sprintf( "File%i", i + 1 ); |
395 | QString linkFile = cfg.readEntry( entryName ); | 395 | QString linkFile = cfg.readEntry( entryName ); |
396 | DocLnk lnk( linkFile ); | 396 | DocLnk lnk( linkFile ); |
397 | if ( lnk.isValid() ) { | 397 | if ( lnk.isValid() ) { |
398 | d->selectedFiles->addToSelection( lnk ); | 398 | d->selectedFiles->addToSelection( lnk ); |
399 | } | 399 | } |
400 | } | 400 | } |
401 | d->selectedFiles->setSelectedItem( currentString); | 401 | d->selectedFiles->setSelectedItem( currentString); |
402 | } | 402 | } |
403 | 403 | ||
404 | 404 | ||
405 | void PlayListWidget::writeConfig( Config& cfg ) const { | 405 | void PlayListWidget::writeConfig( Config& cfg ) const { |
406 | 406 | ||
407 | d->selectedFiles->writeCurrent( cfg); | 407 | d->selectedFiles->writeCurrent( cfg); |
408 | cfg.setGroup("PlayList"); | 408 | cfg.setGroup("PlayList"); |
409 | int noOfFiles = 0; | 409 | int noOfFiles = 0; |
410 | d->selectedFiles->first(); | 410 | d->selectedFiles->first(); |
411 | do { | 411 | do { |
412 | const DocLnk *lnk = d->selectedFiles->current(); | 412 | const DocLnk *lnk = d->selectedFiles->current(); |
413 | if ( lnk ) { | 413 | if ( lnk ) { |
414 | QString entryName; | 414 | QString entryName; |
415 | entryName.sprintf( "File%i", noOfFiles + 1 ); | 415 | entryName.sprintf( "File%i", noOfFiles + 1 ); |
416 | // qDebug(entryName); | 416 | // qDebug(entryName); |
417 | cfg.writeEntry( entryName, lnk->linkFile() ); | 417 | cfg.writeEntry( entryName, lnk->linkFile() ); |
418 | // if this link does exist, add it so we have the file | 418 | // if this link does exist, add it so we have the file |
419 | // next time... | 419 | // next time... |
420 | if ( !QFile::exists( lnk->linkFile() ) ) { | 420 | if ( !QFile::exists( lnk->linkFile() ) ) { |
421 | // the way writing lnks doesn't really check for out | 421 | // the way writing lnks doesn't really check for out |
422 | // of disk space, but check it anyway. | 422 | // of disk space, but check it anyway. |
423 | // if ( !lnk->writeLink() ) { | 423 | // if ( !lnk->writeLink() ) { |
424 | // QMessageBox::critical( 0, tr("Out of space"), | 424 | // QMessageBox::critical( 0, tr("Out of space"), |
425 | // tr( "There was a problem saving " | 425 | // tr( "There was a problem saving " |
426 | // "the playlist.\n" | 426 | // "the playlist.\n" |
427 | // "Your playlist " | 427 | // "Your playlist " |
428 | // "may be missing some entries\n" | 428 | // "may be missing some entries\n" |
429 | // "the next time you start it." ) | 429 | // "the next time you start it." ) |
430 | // ); | 430 | // ); |
431 | // } | 431 | // } |
432 | 432 | ||
433 | } | 433 | } |
434 | noOfFiles++; | 434 | noOfFiles++; |
435 | } | 435 | } |
436 | } | 436 | } |
437 | while ( d->selectedFiles->next() ); | 437 | while ( d->selectedFiles->next() ); |
438 | cfg.writeEntry("NumberOfFiles", noOfFiles ); | 438 | cfg.writeEntry("NumberOfFiles", noOfFiles ); |
439 | } | 439 | } |
440 | 440 | ||
441 | 441 | ||
442 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { | 442 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { |
443 | d->setDocumentUsed = false; | 443 | d->setDocumentUsed = false; |
444 | if ( mediaPlayerState->playlist() ) { | 444 | if ( mediaPlayerState->playlist() ) { |
445 | if(QFileInfo(lnk.file()).exists() || lnk.file().left(4) == "http" ) | 445 | if(QFileInfo(lnk.file()).exists() || lnk.file().left(4) == "http" ) |
446 | d->selectedFiles->addToSelection( lnk ); | 446 | d->selectedFiles->addToSelection( lnk ); |
447 | } | 447 | } |
448 | else | 448 | else |
449 | mediaPlayerState->setPlaying( true); | 449 | mediaPlayerState->setPlaying( true); |
450 | 450 | ||
451 | } | 451 | } |
452 | 452 | ||
453 | 453 | ||
454 | void PlayListWidget::clearList() { | 454 | void PlayListWidget::clearList() { |
455 | while ( first() ) | 455 | while ( first() ) |
456 | d->selectedFiles->removeSelected(); | 456 | d->selectedFiles->removeSelected(); |
457 | Config cfg( "OpiePlayer" ); | 457 | Config cfg( "OpiePlayer" ); |
458 | cfg.setGroup("PlayList"); | 458 | cfg.setGroup("PlayList"); |
459 | cfg.writeEntry("CurrentPlaylist",""); | 459 | cfg.writeEntry("CurrentPlaylist",""); |
460 | currentPlayList=""; | 460 | currentPlayList=""; |
461 | 461 | ||
462 | } | 462 | } |
463 | 463 | ||
464 | 464 | ||
465 | void PlayListWidget::addAllToList() { | 465 | void PlayListWidget::addAllToList() { |
466 | DocLnkSet filesAll; | 466 | DocLnkSet filesAll; |
467 | Global::findDocuments(&filesAll, "video/*;audio/*"); | 467 | Global::findDocuments(&filesAll, "video/*;audio/*"); |
468 | QListIterator<DocLnk> Adit( filesAll.children() ); | 468 | QListIterator<DocLnk> Adit( filesAll.children() ); |
469 | for ( ; Adit.current(); ++Adit ) | 469 | for ( ; Adit.current(); ++Adit ) |
470 | if(QFileInfo(Adit.current()->file()).exists()) | 470 | if(QFileInfo(Adit.current()->file()).exists()) |
471 | d->selectedFiles->addToSelection( **Adit ); | 471 | d->selectedFiles->addToSelection( **Adit ); |
472 | tabWidget->setCurrentPage(0); | 472 | tabWidget->setCurrentPage(0); |
473 | 473 | ||
474 | writeCurrentM3u(); | 474 | writeCurrentM3u(); |
475 | d->selectedFiles->first(); | 475 | d->selectedFiles->first(); |
476 | } | 476 | } |
477 | 477 | ||
478 | 478 | ||
479 | void PlayListWidget::addAllMusicToList() { | 479 | void PlayListWidget::addAllMusicToList() { |
480 | QListIterator<DocLnk> dit( files.children() ); | 480 | QListIterator<DocLnk> dit( files.children() ); |
481 | for ( ; dit.current(); ++dit ) | 481 | for ( ; dit.current(); ++dit ) |
482 | if(QFileInfo(dit.current()->file()).exists()) | 482 | if(QFileInfo(dit.current()->file()).exists()) |
483 | d->selectedFiles->addToSelection( **dit ); | 483 | d->selectedFiles->addToSelection( **dit ); |
484 | tabWidget->setCurrentPage(0); | 484 | tabWidget->setCurrentPage(0); |
485 | 485 | ||
486 | writeCurrentM3u(); | 486 | writeCurrentM3u(); |
487 | d->selectedFiles->first(); | 487 | d->selectedFiles->first(); |
488 | } | 488 | } |
489 | 489 | ||
490 | 490 | ||
491 | void PlayListWidget::addAllVideoToList() { | 491 | void PlayListWidget::addAllVideoToList() { |
492 | QListIterator<DocLnk> dit( vFiles.children() ); | 492 | QListIterator<DocLnk> dit( vFiles.children() ); |
493 | for ( ; dit.current(); ++dit ) | 493 | for ( ; dit.current(); ++dit ) |
494 | if(QFileInfo( dit.current()->file()).exists()) | 494 | if(QFileInfo( dit.current()->file()).exists()) |
495 | d->selectedFiles->addToSelection( **dit ); | 495 | d->selectedFiles->addToSelection( **dit ); |
496 | tabWidget->setCurrentPage(0); | 496 | tabWidget->setCurrentPage(0); |
497 | 497 | ||
498 | writeCurrentM3u(); | 498 | writeCurrentM3u(); |
499 | d->selectedFiles->first(); | 499 | d->selectedFiles->first(); |
500 | } | 500 | } |
501 | 501 | ||
502 | 502 | ||
503 | void PlayListWidget::setDocument(const QString& fileref) { | 503 | void PlayListWidget::setDocument(const QString& fileref) { |
504 | fromSetDocument = true; | 504 | fromSetDocument = true; |
505 | d->setDocumentUsed = TRUE; | 505 | d->setDocumentUsed = TRUE; |
506 | setDocumentEx(fileref); | 506 | setDocumentEx(fileref); |
507 | } | 507 | } |
508 | 508 | ||
509 | void PlayListWidget::setDocumentEx(const QString& fileref) { | 509 | void PlayListWidget::setDocumentEx(const QString& fileref) { |
510 | qDebug("opieplayer receive "+fileref); | 510 | qDebug("opieplayer receive "+fileref); |
511 | clearList(); | 511 | clearList(); |
512 | DocLnk lnk; | 512 | DocLnk lnk; |
513 | QFileInfo fileInfo(fileref); | 513 | QFileInfo fileInfo(fileref); |
514 | if ( !fileInfo.exists() ) { | 514 | if ( !fileInfo.exists() ) { |
515 | QMessageBox::critical( 0, tr( "Invalid File" ), | 515 | QMessageBox::critical( 0, tr( "Invalid File" ), |
516 | tr( "There was a problem in getting the file." ) ); | 516 | tr( "There was a problem in getting the file." ) ); |
517 | return; | 517 | return; |
518 | } | 518 | } |
519 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<setDocument "+fileref); | 519 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<setDocument "+fileref); |
520 | QString extension = fileInfo.extension(false); | 520 | QString extension = fileInfo.extension(false); |
521 | if( extension.find( "m3u", 0, false) != -1) { //is m3u | 521 | if( extension.find( "m3u", 0, false) != -1) { //is m3u |
522 | readm3u( fileref); | 522 | readm3u( fileref); |
523 | } | 523 | } |
524 | else if( extension.find( "pls", 0, false) != -1 ) { //is pls | 524 | else if( extension.find( "pls", 0, false) != -1 ) { //is pls |
525 | readPls( fileref); | 525 | readPls( fileref); |
526 | } | 526 | } |
527 | else if( fileref.find("playlist",0,TRUE) != -1) {//is playlist | 527 | else if( fileref.find("playlist",0,TRUE) != -1) {//is playlist |
528 | clearList(); | 528 | clearList(); |
529 | lnk.setName( fileInfo.baseName() ); //sets name | 529 | lnk.setName( fileInfo.baseName() ); //sets name |
530 | lnk.setFile( fileref ); //sets file name | 530 | lnk.setFile( fileref ); //sets file name |
531 | lnk.setIcon("Sound"); | 531 | lnk.setIcon("Sound"); |
532 | //addToSelection( lnk ); | 532 | //addToSelection( lnk ); |
533 | 533 | ||
534 | loadList( lnk); | 534 | loadList( lnk); |
535 | d->selectedFiles->first(); | 535 | d->selectedFiles->first(); |
536 | } else { | 536 | } else { |
537 | if( fileref.find(".desktop",0,TRUE) != -1) { | 537 | if( fileref.find(".desktop",0,TRUE) != -1) { |
538 | lnk = DocLnk(fileref); | 538 | lnk = DocLnk(fileref); |
539 | } else { | 539 | } else { |
540 | lnk.setName( fileInfo.baseName() ); //sets name | 540 | lnk.setName( fileInfo.baseName() ); //sets name |
541 | lnk.setFile( fileref ); //sets file name | 541 | lnk.setFile( fileref ); //sets file name |
542 | lnk.setIcon("Sound"); | 542 | lnk.setIcon("Sound"); |
543 | } | 543 | } |
544 | 544 | ||
545 | addToSelection( lnk ); | 545 | addToSelection( lnk ); |
546 | // addToSelection( DocLnk( fileref ) ); | 546 | // addToSelection( DocLnk( fileref ) ); |
547 | lnk.removeLinkFile(); | 547 | lnk.removeLinkFile(); |
548 | // qApp->processEvents(); | 548 | // qApp->processEvents(); |
549 | } | 549 | } |
550 | setCaption(tr("OpiePlayer")); | 550 | setCaption(tr("OpiePlayer")); |
551 | d->setDocumentUsed = TRUE; | 551 | d->setDocumentUsed = TRUE; |
552 | d->selectedFiles->setSelected(d->selectedFiles->firstChild(),true ); | 552 | d->selectedFiles->setSelected(d->selectedFiles->firstChild(),true ); |
553 | mediaPlayerState->setPlaying( FALSE ); | 553 | mediaPlayerState->setPlaying( FALSE ); |
554 | qApp->processEvents(); | 554 | qApp->processEvents(); |
555 | mediaPlayerState->setPlaying( TRUE ); | 555 | mediaPlayerState->setPlaying( TRUE ); |
556 | 556 | ||
557 | } | 557 | } |
558 | 558 | ||
559 | 559 | ||
560 | void PlayListWidget::setActiveWindow() { | 560 | void PlayListWidget::setActiveWindow() { |
561 | // qDebug("SETTING active window"); | 561 | // qDebug("SETTING active window"); |
562 | // When we get raised we need to ensure that it switches views | 562 | // When we get raised we need to ensure that it switches views |
563 | char origView = mediaPlayerState->view(); | 563 | char origView = mediaPlayerState->view(); |
564 | mediaPlayerState->setView( 'l' ); // invalidate | 564 | mediaPlayerState->setView( 'l' ); // invalidate |
565 | mediaPlayerState->setView( origView ); // now switch back | 565 | mediaPlayerState->setView( origView ); // now switch back |
566 | } | 566 | } |
567 | 567 | ||
568 | 568 | ||
569 | void PlayListWidget::useSelectedDocument() { | 569 | void PlayListWidget::useSelectedDocument() { |
570 | d->setDocumentUsed = FALSE; | 570 | d->setDocumentUsed = FALSE; |
571 | } | 571 | } |
572 | 572 | ||
573 | 573 | ||
574 | const DocLnk *PlayListWidget::current() { // this is fugly | 574 | const DocLnk *PlayListWidget::current() { // this is fugly |
575 | switch (tabWidget->currentPageIndex()) { | 575 | switch (tabWidget->currentPageIndex()) { |
576 | case 0: //playlist | 576 | case 0: //playlist |
577 | { | 577 | { |
578 | // qDebug("playlist"); | 578 | // qDebug("playlist"); |
579 | if ( mediaPlayerState->playlist() ) { | 579 | if ( mediaPlayerState->playlist() ) { |
580 | return d->selectedFiles->current(); | 580 | return d->selectedFiles->current(); |
581 | } | 581 | } |
582 | else if ( d->setDocumentUsed && d->current ) { | 582 | else if ( d->setDocumentUsed && d->current ) { |
583 | return d->current; | 583 | return d->current; |
584 | } else { | 584 | } else { |
585 | return &(d->files->selectedDocument()); | 585 | return &(d->files->selectedDocument()); |
586 | } | 586 | } |
587 | } | 587 | } |
588 | break; | 588 | break; |
589 | case 1://audio | 589 | case 1://audio |
590 | { | 590 | { |
591 | // qDebug("audioView"); | 591 | // qDebug("audioView"); |
592 | QListIterator<DocLnk> dit( files.children() ); | 592 | QListIterator<DocLnk> dit( files.children() ); |
593 | for ( ; dit.current(); ++dit ) { | 593 | for ( ; dit.current(); ++dit ) { |
594 | if( dit.current()->name() == audioView->currentItem()->text(0) && !insanityBool) { | 594 | if( dit.current()->name() == audioView->currentItem()->text(0) && !insanityBool) { |
595 | insanityBool=TRUE; | 595 | insanityBool=TRUE; |
596 | return dit; | 596 | return dit; |
597 | } | 597 | } |
598 | } | 598 | } |
599 | } | 599 | } |
600 | break; | 600 | break; |
601 | case 2: // video | 601 | case 2: // video |
602 | { | 602 | { |
603 | QListIterator<DocLnk> Vdit( vFiles.children() ); | 603 | QListIterator<DocLnk> Vdit( vFiles.children() ); |
604 | for ( ; Vdit.current(); ++Vdit ) { | 604 | for ( ; Vdit.current(); ++Vdit ) { |
605 | if( Vdit.current()->name() == videoView->currentItem()->text(0) && !insanityBool) { | 605 | if( Vdit.current()->name() == videoView->currentItem()->text(0) && !insanityBool) { |
606 | insanityBool=TRUE; | 606 | insanityBool=TRUE; |
607 | return Vdit; | 607 | return Vdit; |
608 | } | 608 | } |
609 | } | 609 | } |
610 | } | 610 | } |
611 | break; | 611 | break; |
612 | }; | 612 | }; |
613 | return 0; | 613 | return 0; |
614 | } | 614 | } |
615 | 615 | ||
616 | bool PlayListWidget::prev() { | 616 | bool PlayListWidget::prev() { |
617 | if ( mediaPlayerState->playlist() ) { | 617 | if ( mediaPlayerState->playlist() ) { |
618 | if ( mediaPlayerState->shuffled() ) { | 618 | if ( mediaPlayerState->shuffled() ) { |
619 | const DocLnk *cur = current(); | 619 | const DocLnk *cur = current(); |
620 | int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); | 620 | int j = 1 + (int)(97.0 * rand() / (RAND_MAX + 1.0)); |
621 | for ( int i = 0; i < j; i++ ) { | 621 | for ( int i = 0; i < j; i++ ) { |
622 | if ( !d->selectedFiles->next() ) | 622 | if ( !d->selectedFiles->next() ) |
623 | d->selectedFiles->first(); | 623 | d->selectedFiles->first(); |
624 | } | 624 | } |
625 | if ( cur == current() ) | 625 | if ( cur == current() ) |
626 | if ( !d->selectedFiles->next() ) | 626 | if ( !d->selectedFiles->next() ) |
627 | d->selectedFiles->first(); | 627 | d->selectedFiles->first(); |
628 | return TRUE; | 628 | return TRUE; |
629 | } else { | 629 | } else { |
630 | if ( !d->selectedFiles->prev() ) { | 630 | if ( !d->selectedFiles->prev() ) { |
631 | if ( mediaPlayerState->looping() ) { | 631 | if ( mediaPlayerState->looping() ) { |
632 | return d->selectedFiles->last(); | 632 | return d->selectedFiles->last(); |
633 | } else { | 633 | } else { |
634 | return FALSE; | 634 | return FALSE; |
635 | } | 635 | } |
636 | } | 636 | } |
637 | return TRUE; | 637 | return TRUE; |
638 | } | 638 | } |
639 | } else { | 639 | } else { |
640 | return mediaPlayerState->looping(); | 640 | return mediaPlayerState->looping(); |
641 | } | 641 | } |
642 | } | 642 | } |
643 | 643 | ||
644 | 644 | ||
645 | bool PlayListWidget::next() { | 645 | bool PlayListWidget::next() { |
646 | if ( mediaPlayerState->playlist() ) { | 646 | if ( mediaPlayerState->playlist() ) { |
647 | if ( mediaPlayerState->shuffled() ) { | 647 | if ( mediaPlayerState->shuffled() ) { |
648 | return prev(); | 648 | return prev(); |
649 | } else { | 649 | } else { |
650 | if ( !d->selectedFiles->next() ) { | 650 | if ( !d->selectedFiles->next() ) { |
651 | if ( mediaPlayerState->looping() ) { | 651 | if ( mediaPlayerState->looping() ) { |
652 | return d->selectedFiles->first(); | 652 | return d->selectedFiles->first(); |
653 | } else { | 653 | } else { |
654 | return FALSE; | 654 | return FALSE; |
655 | } | 655 | } |
656 | } | 656 | } |
657 | return TRUE; | 657 | return TRUE; |
658 | } | 658 | } |
659 | } else { | 659 | } else { |
660 | return mediaPlayerState->looping(); | 660 | return mediaPlayerState->looping(); |
661 | } | 661 | } |
662 | } | 662 | } |
663 | 663 | ||
664 | 664 | ||
665 | bool PlayListWidget::first() { | 665 | bool PlayListWidget::first() { |
666 | if ( mediaPlayerState->playlist() ) | 666 | if ( mediaPlayerState->playlist() ) |
667 | return d->selectedFiles->first(); | 667 | return d->selectedFiles->first(); |
668 | else | 668 | else |
669 | return mediaPlayerState->looping(); | 669 | return mediaPlayerState->looping(); |
670 | } | 670 | } |
671 | 671 | ||
672 | 672 | ||
673 | bool PlayListWidget::last() { | 673 | bool PlayListWidget::last() { |
674 | if ( mediaPlayerState->playlist() ) | 674 | if ( mediaPlayerState->playlist() ) |
675 | return d->selectedFiles->last(); | 675 | return d->selectedFiles->last(); |
676 | else | 676 | else |
677 | return mediaPlayerState->looping(); | 677 | return mediaPlayerState->looping(); |
678 | } | 678 | } |
679 | 679 | ||
680 | 680 | ||
681 | void PlayListWidget::saveList() { | 681 | void PlayListWidget::saveList() { |
682 | writem3u(); | 682 | writem3u(); |
683 | } | 683 | } |
684 | 684 | ||
685 | void PlayListWidget::loadList( const DocLnk & lnk) { | 685 | void PlayListWidget::loadList( const DocLnk & lnk) { |
686 | QString name = lnk.name(); | 686 | QString name = lnk.name(); |
687 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name); | 687 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name); |
688 | 688 | ||
689 | if( name.length()>0) { | 689 | if( name.length()>0) { |
690 | setCaption("OpiePlayer: "+name); | 690 | setCaption("OpiePlayer: "+name); |
691 | // qDebug("<<<<<<<<<<<<load list "+ lnk.file()); | 691 | // qDebug("<<<<<<<<<<<<load list "+ lnk.file()); |
692 | clearList(); | 692 | clearList(); |
693 | readm3u(lnk.file()); | 693 | readm3u(lnk.file()); |
694 | tabWidget->setCurrentPage(0); | 694 | tabWidget->setCurrentPage(0); |
695 | } | 695 | } |
696 | } | 696 | } |
697 | 697 | ||
698 | void PlayListWidget::setPlaylist( bool shown ) { | 698 | void PlayListWidget::setPlaylist( bool shown ) { |
699 | if ( shown ) | 699 | if ( shown ) |
700 | d->playListFrame->show(); | 700 | d->playListFrame->show(); |
701 | else | 701 | else |
702 | d->playListFrame->hide(); | 702 | d->playListFrame->hide(); |
703 | } | 703 | } |
704 | 704 | ||
705 | void PlayListWidget::setView( char view ) { | 705 | void PlayListWidget::setView( char view ) { |
706 | if ( view == 'l' ) | 706 | if ( view == 'l' ) |
707 | showMaximized(); | 707 | showMaximized(); |
708 | else | 708 | else |
709 | hide(); | 709 | hide(); |
710 | } | 710 | } |
711 | 711 | ||
712 | void PlayListWidget::addSelected() { | 712 | void PlayListWidget::addSelected() { |
713 | DocLnk lnk; | 713 | DocLnk lnk; |
714 | QString filename; | 714 | QString filename; |
715 | switch (tabWidget->currentPageIndex()) { | 715 | switch (tabWidget->currentPageIndex()) { |
716 | 716 | ||
717 | case 0: //playlist | 717 | case 0: //playlist |
718 | return; | 718 | return; |
719 | break; | 719 | break; |
720 | case 1: { //audio | 720 | case 1: { //audio |
721 | QListViewItemIterator it( audioView ); | 721 | QListViewItemIterator it( audioView ); |
722 | for ( ; it.current(); ++it ) { | 722 | for ( ; it.current(); ++it ) { |
723 | if ( it.current()->isSelected() ) { | 723 | if ( it.current()->isSelected() ) { |
724 | filename = it.current()->text(3); | 724 | filename = it.current()->text(3); |
725 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 725 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
726 | lnk.setFile( filename ); //sets file name | 726 | lnk.setFile( filename ); //sets file name |
727 | d->selectedFiles->addToSelection( lnk); | 727 | d->selectedFiles->addToSelection( lnk); |
728 | } | 728 | } |
729 | } | 729 | } |
730 | audioView->clearSelection(); | 730 | audioView->clearSelection(); |
731 | // d->selectedFiles->next(); | 731 | // d->selectedFiles->next(); |
732 | } | 732 | } |
733 | break; | 733 | break; |
734 | 734 | ||
735 | case 2: { // video | 735 | case 2: { // video |
736 | QListViewItemIterator it( videoView ); | 736 | QListViewItemIterator it( videoView ); |
737 | for ( ; it.current(); ++it ) { | 737 | for ( ; it.current(); ++it ) { |
738 | if ( it.current()->isSelected() ) { | 738 | if ( it.current()->isSelected() ) { |
739 | 739 | ||
740 | filename = it.current()->text(3); | 740 | filename = it.current()->text(3); |
741 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 741 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
742 | lnk.setFile( filename ); //sets file name | 742 | lnk.setFile( filename ); //sets file name |
743 | d->selectedFiles->addToSelection( lnk); | 743 | d->selectedFiles->addToSelection( lnk); |
744 | } | 744 | } |
745 | } | 745 | } |
746 | videoView->clearSelection(); | 746 | videoView->clearSelection(); |
747 | } | 747 | } |
748 | break; | 748 | break; |
749 | }; | 749 | }; |
750 | // tabWidget->setCurrentPage(0); | 750 | // tabWidget->setCurrentPage(0); |
751 | writeCurrentM3u(); | 751 | writeCurrentM3u(); |
752 | 752 | ||
753 | } | 753 | } |
754 | 754 | ||
755 | void PlayListWidget::removeSelected() { | 755 | void PlayListWidget::removeSelected() { |
756 | d->selectedFiles->removeSelected( ); | 756 | d->selectedFiles->removeSelected( ); |
757 | } | 757 | } |
758 | 758 | ||
759 | void PlayListWidget::playIt( QListViewItem *) { | 759 | void PlayListWidget::playIt( QListViewItem *) { |
760 | // d->setDocumentUsed = FALSE; | 760 | // d->setDocumentUsed = FALSE; |
761 | // mediaPlayerState->curPosition =0; | 761 | // mediaPlayerState->curPosition =0; |
762 | // mediaPlayerState->setPlaying(FALSE); | 762 | // mediaPlayerState->setPlaying(FALSE); |
763 | mediaPlayerState->setPlaying(TRUE); | 763 | mediaPlayerState->setPlaying(TRUE); |
764 | d->selectedFiles->unSelect(); | 764 | d->selectedFiles->unSelect(); |
765 | } | 765 | } |
766 | 766 | ||
767 | void PlayListWidget::addToSelection( QListViewItem *it) { | 767 | void PlayListWidget::addToSelection( QListViewItem *it) { |
768 | d->setDocumentUsed = FALSE; | 768 | d->setDocumentUsed = FALSE; |
769 | 769 | ||
770 | if(it) { | 770 | if(it) { |
771 | switch ( tabWidget->currentPageIndex()) { | 771 | switch ( tabWidget->currentPageIndex()) { |
772 | case 0: //playlist | 772 | case 0: //playlist |
773 | return; | 773 | return; |
774 | break; | 774 | break; |
775 | }; | 775 | }; |
776 | // case 1: { | 776 | // case 1: { |
777 | DocLnk lnk; | 777 | DocLnk lnk; |
778 | QString filename; | 778 | QString filename; |
779 | 779 | ||
780 | filename=it->text(3); | 780 | filename=it->text(3); |
781 | lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name | 781 | lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name |
782 | lnk.setFile( filename ); //sets file name | 782 | lnk.setFile( filename ); //sets file name |
783 | d->selectedFiles->addToSelection( lnk); | 783 | d->selectedFiles->addToSelection( lnk); |
784 | 784 | ||
785 | if(tabWidget->currentPageIndex() == 0) | 785 | if(tabWidget->currentPageIndex() == 0) |
786 | writeCurrentM3u(); | 786 | writeCurrentM3u(); |
787 | // tabWidget->setCurrentPage(0); | 787 | // tabWidget->setCurrentPage(0); |
788 | 788 | ||
789 | } | 789 | } |
790 | } | 790 | } |
791 | 791 | ||
792 | void PlayListWidget::tabChanged(QWidget *) { | 792 | void PlayListWidget::tabChanged(QWidget *) { |
793 | 793 | ||
794 | switch ( tabWidget->currentPageIndex()) { | 794 | switch ( tabWidget->currentPageIndex()) { |
795 | case 0: | 795 | case 0: |
796 | { | 796 | { |
797 | if( !tbDeletePlaylist->isHidden()) | 797 | if( !tbDeletePlaylist->isHidden()) |
798 | tbDeletePlaylist->hide(); | 798 | tbDeletePlaylist->hide(); |
799 | d->tbRemoveFromList->setEnabled(TRUE); | 799 | d->tbRemoveFromList->setEnabled(TRUE); |
800 | d->tbAddToList->setEnabled(FALSE); | 800 | d->tbAddToList->setEnabled(FALSE); |
801 | } | 801 | } |
802 | break; | 802 | break; |
803 | case 1: | 803 | case 1: |
804 | { | 804 | { |
805 | audioView->clear(); | 805 | audioView->clear(); |
806 | populateAudioView(); | 806 | populateAudioView(); |
807 | 807 | ||
808 | if( !tbDeletePlaylist->isHidden()) | 808 | if( !tbDeletePlaylist->isHidden()) |
809 | tbDeletePlaylist->hide(); | 809 | tbDeletePlaylist->hide(); |
810 | d->tbRemoveFromList->setEnabled(FALSE); | 810 | d->tbRemoveFromList->setEnabled(FALSE); |
811 | d->tbAddToList->setEnabled(TRUE); | 811 | d->tbAddToList->setEnabled(TRUE); |
812 | } | 812 | } |
813 | break; | 813 | break; |
814 | case 2: | 814 | case 2: |
815 | { | 815 | { |
816 | videoView->clear(); | 816 | videoView->clear(); |
817 | populateVideoView(); | 817 | populateVideoView(); |
818 | if( !tbDeletePlaylist->isHidden()) | 818 | if( !tbDeletePlaylist->isHidden()) |
819 | tbDeletePlaylist->hide(); | 819 | tbDeletePlaylist->hide(); |
820 | d->tbRemoveFromList->setEnabled(FALSE); | 820 | d->tbRemoveFromList->setEnabled(FALSE); |
821 | d->tbAddToList->setEnabled(TRUE); | 821 | d->tbAddToList->setEnabled(TRUE); |
822 | } | 822 | } |
823 | break; | 823 | break; |
824 | case 3: | 824 | case 3: |
825 | { | 825 | { |
826 | if( tbDeletePlaylist->isHidden()) | 826 | if( tbDeletePlaylist->isHidden()) |
827 | tbDeletePlaylist->show(); | 827 | tbDeletePlaylist->show(); |
828 | playLists->reread(); | 828 | playLists->reread(); |
829 | } | 829 | } |
830 | break; | 830 | break; |
831 | }; | 831 | }; |
832 | } | 832 | } |
833 | 833 | ||
834 | void PlayListWidget::btnPlay(bool b) { | 834 | void PlayListWidget::btnPlay(bool b) { |
835 | // mediaPlayerState->setPlaying(b); | 835 | // mediaPlayerState->setPlaying(b); |
836 | switch ( tabWidget->currentPageIndex()) { | 836 | switch ( tabWidget->currentPageIndex()) { |
837 | case 0: | 837 | case 0: |
838 | { | 838 | { |
839 | // if( d->selectedFiles->current()->file().find(" ",0,TRUE) != -1 | 839 | // if( d->selectedFiles->current()->file().find(" ",0,TRUE) != -1 |
840 | // if( d->selectedFiles->current()->file().find("%20",0,TRUE) != -1) { | 840 | // if( d->selectedFiles->current()->file().find("%20",0,TRUE) != -1) { |
841 | // QMessageBox::message("Note","You are trying to play\na malformed url."); | 841 | // QMessageBox::message("Note","You are trying to play\na malformed url."); |
842 | // } else { | 842 | // } else { |
843 | mediaPlayerState->setPlaying(b); | 843 | mediaPlayerState->setPlaying(b); |
844 | insanityBool=FALSE; | 844 | insanityBool=FALSE; |
845 | qDebug("insanity"); | 845 | qDebug("insanity"); |
846 | // } | 846 | // } |
847 | } | 847 | } |
848 | break; | 848 | break; |
849 | case 1: | 849 | case 1: |
850 | { | 850 | { |
851 | // d->selectedFiles->unSelect(); | 851 | // d->selectedFiles->unSelect(); |
852 | addToSelection( audioView->currentItem() ); | 852 | addToSelection( audioView->currentItem() ); |
853 | mediaPlayerState->setPlaying( b); | 853 | mediaPlayerState->setPlaying( b); |
854 | d->selectedFiles->removeSelected( ); | 854 | d->selectedFiles->removeSelected( ); |
855 | d->selectedFiles->unSelect(); | 855 | d->selectedFiles->unSelect(); |
856 | tabWidget->setCurrentPage(1); | 856 | tabWidget->setCurrentPage(1); |
857 | insanityBool=FALSE; | 857 | insanityBool=FALSE; |
858 | }// audioView->clearSelection(); | 858 | }// audioView->clearSelection(); |
859 | break; | 859 | break; |
860 | case 2: | 860 | case 2: |
861 | { | 861 | { |
862 | 862 | ||
863 | addToSelection( videoView->currentItem() ); | 863 | addToSelection( videoView->currentItem() ); |
864 | mediaPlayerState->setPlaying( b); | 864 | mediaPlayerState->setPlaying( b); |
865 | // qApp->processEvents(); | 865 | // qApp->processEvents(); |
866 | d->selectedFiles->removeSelected( ); | 866 | d->selectedFiles->removeSelected( ); |
867 | d->selectedFiles->unSelect(); | 867 | d->selectedFiles->unSelect(); |
868 | tabWidget->setCurrentPage(2); | 868 | tabWidget->setCurrentPage(2); |
869 | insanityBool=FALSE; | 869 | insanityBool=FALSE; |
870 | }// videoView->clearSelection(); | 870 | }// videoView->clearSelection(); |
871 | break; | 871 | break; |
872 | }; | 872 | }; |
873 | 873 | ||
874 | } | 874 | } |
875 | 875 | ||
876 | void PlayListWidget::deletePlaylist() { | 876 | void PlayListWidget::deletePlaylist() { |
877 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), | 877 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), |
878 | (tr("You really want to delete\nthis playlist?")), | 878 | (tr("You really want to delete\nthis playlist?")), |
879 | (tr("Yes")), (tr("No")), 0 )){ | 879 | (tr("Yes")), (tr("No")), 0 )){ |
880 | case 0: // Yes clicked, | 880 | case 0: // Yes clicked, |
881 | QFile().remove(playLists->selectedDocument().file()); | 881 | QFile().remove(playLists->selectedDocument().file()); |
882 | QFile().remove(playLists->selectedDocument().linkFile()); | 882 | QFile().remove(playLists->selectedDocument().linkFile()); |
883 | playLists->reread(); | 883 | playLists->reread(); |
884 | break; | 884 | break; |
885 | case 1: // Cancel | 885 | case 1: // Cancel |
886 | break; | 886 | break; |
887 | }; | 887 | }; |
888 | } | 888 | } |
889 | 889 | ||
890 | void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint&, int ) | 890 | void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint&, int ) |
891 | { | 891 | { |
892 | switch (mouse) { | 892 | switch (mouse) { |
893 | case 1: | 893 | case 1: |
894 | break; | 894 | break; |
895 | case 2:{ | 895 | case 2:{ |
896 | 896 | ||
897 | QPopupMenu m; | 897 | QPopupMenu m; |
898 | m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); | 898 | m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); |
899 | m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); | 899 | m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); |
900 | m.insertSeparator(); | 900 | m.insertSeparator(); |
901 | if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) | 901 | if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) |
902 | m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); | 902 | m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); |
903 | 903 | ||
904 | m.exec( QCursor::pos() ); | 904 | m.exec( QCursor::pos() ); |
905 | } | 905 | } |
906 | break; | 906 | break; |
907 | }; | 907 | }; |
908 | } | 908 | } |
909 | 909 | ||
910 | void PlayListWidget::playSelected() | 910 | void PlayListWidget::playSelected() |
911 | { | 911 | { |
912 | btnPlay( true); | 912 | btnPlay( true); |
913 | // d->selectedFiles->unSelect(); | 913 | // d->selectedFiles->unSelect(); |
914 | } | 914 | } |
915 | 915 | ||
916 | void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint&, int) | 916 | void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint&, int) |
917 | { | 917 | { |
918 | switch (mouse) { | 918 | switch (mouse) { |
919 | case 1: | 919 | case 1: |
920 | 920 | ||
921 | break; | 921 | break; |
922 | case 2:{ | 922 | case 2:{ |
923 | QPopupMenu m; | 923 | QPopupMenu m; |
924 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); | 924 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); |
925 | m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); | 925 | m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); |
926 | // m.insertSeparator(); | 926 | // m.insertSeparator(); |
927 | // m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); | 927 | // m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); |
928 | m.exec( QCursor::pos() ); | 928 | m.exec( QCursor::pos() ); |
929 | } | 929 | } |
930 | break; | 930 | break; |
931 | }; | 931 | }; |
932 | 932 | ||
933 | } | 933 | } |
934 | 934 | ||
935 | void PlayListWidget::listDelete() { | 935 | void PlayListWidget::listDelete() { |
936 | Config cfg( "OpiePlayer" ); | 936 | Config cfg( "OpiePlayer" ); |
937 | cfg.setGroup("PlayList"); | 937 | cfg.setGroup("PlayList"); |
938 | currentPlayList = cfg.readEntry("CurrentPlaylist",""); | 938 | currentPlayList = cfg.readEntry("CurrentPlaylist",""); |
939 | QString file; | 939 | QString file; |
940 | // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 940 | // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
941 | switch ( tabWidget->currentPageIndex()) { | 941 | switch ( tabWidget->currentPageIndex()) { |
942 | case 0: | 942 | case 0: |
943 | break; | 943 | break; |
944 | case 1: | 944 | case 1: |
945 | { | 945 | { |
946 | file = audioView->currentItem()->text(0); | 946 | file = audioView->currentItem()->text(0); |
947 | QListIterator<DocLnk> Pdit( files.children() ); | 947 | QListIterator<DocLnk> Pdit( files.children() ); |
948 | for ( ; Pdit.current(); ++Pdit ) { | 948 | for ( ; Pdit.current(); ++Pdit ) { |
949 | if( Pdit.current()->name() == file) { | 949 | if( Pdit.current()->name() == file) { |
950 | LnkProperties prop( Pdit.current() ); | 950 | LnkProperties prop( Pdit.current() ); |
951 | prop.showMaximized(); | 951 | prop.showMaximized(); |
952 | prop.exec(); | 952 | prop.exec(); |
953 | } | 953 | } |
954 | } | 954 | } |
955 | populateAudioView(); | 955 | populateAudioView(); |
956 | } | 956 | } |
957 | break; | 957 | break; |
958 | case 2: | 958 | case 2: |
959 | { | 959 | { |
960 | // file = videoView->selectedItem()->text(0); | 960 | // file = videoView->selectedItem()->text(0); |
961 | // for ( int i = 0; i < noOfFiles; i++ ) { | 961 | // for ( int i = 0; i < noOfFiles; i++ ) { |
962 | // QString entryName; | 962 | // QString entryName; |
963 | // entryName.sprintf( "File%i", i + 1 ); | 963 | // entryName.sprintf( "File%i", i + 1 ); |
964 | // QString linkFile = cfg.readEntry( entryName ); | 964 | // QString linkFile = cfg.readEntry( entryName ); |
965 | // AppLnk lnk( AppLnk(linkFile)); | 965 | // AppLnk lnk( AppLnk(linkFile)); |
966 | // if( lnk.name() == file ) { | 966 | // if( lnk.name() == file ) { |
967 | // LnkProperties prop( &lnk); | 967 | // LnkProperties prop( &lnk); |
968 | // // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); | 968 | // // connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); |
969 | // prop.showMaximized(); | 969 | // prop.showMaximized(); |
970 | // prop.exec(); | 970 | // prop.exec(); |
971 | // } | 971 | // } |
972 | // } | 972 | // } |
973 | } | 973 | } |
974 | break; | 974 | break; |
975 | }; | 975 | }; |
976 | } | 976 | } |
977 | 977 | ||
978 | void PlayListWidget::scanForAudio() { | 978 | void PlayListWidget::scanForAudio() { |
979 | // qDebug("scan for audio"); | 979 | // qDebug("scan for audio"); |
980 | files.detachChildren(); | 980 | files.detachChildren(); |
981 | QListIterator<DocLnk> sdit( files.children() ); | 981 | QListIterator<DocLnk> sdit( files.children() ); |
982 | for ( ; sdit.current(); ++sdit ) { | 982 | for ( ; sdit.current(); ++sdit ) { |
983 | delete sdit.current(); | 983 | delete sdit.current(); |
984 | } | 984 | } |
985 | Global::findDocuments( &files, audioMimes); | 985 | Global::findDocuments( &files, audioMimes); |
986 | audioScan = true; | 986 | audioScan = true; |
987 | } | 987 | } |
988 | void PlayListWidget::scanForVideo() { | 988 | void PlayListWidget::scanForVideo() { |
989 | // qDebug("scan for video"); | 989 | // qDebug("scan for video"); |
990 | vFiles.detachChildren(); | 990 | vFiles.detachChildren(); |
991 | QListIterator<DocLnk> sdit( vFiles.children() ); | 991 | QListIterator<DocLnk> sdit( vFiles.children() ); |
992 | for ( ; sdit.current(); ++sdit ) { | 992 | for ( ; sdit.current(); ++sdit ) { |
993 | delete sdit.current(); | 993 | delete sdit.current(); |
994 | } | 994 | } |
995 | Global::findDocuments(&vFiles, "video/*"); | 995 | Global::findDocuments(&vFiles, "video/*"); |
996 | videoScan = true; | 996 | videoScan = true; |
997 | } | 997 | } |
998 | 998 | ||
999 | void PlayListWidget::populateAudioView() { | 999 | void PlayListWidget::populateAudioView() { |
1000 | 1000 | ||
1001 | audioView->clear(); | 1001 | audioView->clear(); |
1002 | StorageInfo storageInfo; | 1002 | StorageInfo storageInfo; |
1003 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 1003 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
1004 | if(!audioScan) scanForAudio(); | 1004 | if(!audioScan) scanForAudio(); |
1005 | 1005 | ||
1006 | QListIterator<DocLnk> dit( files.children() ); | 1006 | QListIterator<DocLnk> dit( files.children() ); |
1007 | QListIterator<FileSystem> it ( fs ); | 1007 | QListIterator<FileSystem> it ( fs ); |
1008 | 1008 | ||
1009 | QString storage; | 1009 | QString storage; |
1010 | for ( ; dit.current(); ++dit ) { | 1010 | for ( ; dit.current(); ++dit ) { |
1011 | for( ; it.current(); ++it ){ | 1011 | for( ; it.current(); ++it ){ |
1012 | const QString name = (*it)->name(); | 1012 | const QString name = (*it)->name(); |
1013 | const QString path = (*it)->path(); | 1013 | const QString path = (*it)->path(); |
1014 | if(dit.current()->file().find(path) != -1 ) storage=name; | 1014 | if(dit.current()->file().find(path) != -1 ) storage=name; |
1015 | } | 1015 | } |
1016 | 1016 | ||
1017 | QListViewItem * newItem; | 1017 | QListViewItem * newItem; |
1018 | if ( QFile( dit.current()->file()).exists() || dit.current()->file().left(4) == "http" ) { | 1018 | if ( QFile( dit.current()->file()).exists() || dit.current()->file().left(4) == "http" ) { |
1019 | long size; | 1019 | long size; |
1020 | if( dit.current()->file().left(4) == "http" ) | 1020 | if( dit.current()->file().left(4) == "http" ) |
1021 | size=0; | 1021 | size=0; |
1022 | else | 1022 | else |
1023 | size = QFile( dit.current()->file() ).size(); | 1023 | size = QFile( dit.current()->file() ).size(); |
1024 | // qDebug(dit.current()->name()); | 1024 | // qDebug(dit.current()->name()); |
1025 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), | 1025 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), |
1026 | QString::number(size ), storage, dit.current()->file()); | 1026 | QString::number(size ), storage, dit.current()->file()); |
1027 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/musicfile" )); | 1027 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/musicfile" )); |
1028 | } | 1028 | } |
1029 | } | 1029 | } |
1030 | 1030 | ||
1031 | } | 1031 | } |
1032 | 1032 | ||
1033 | void PlayListWidget::populateVideoView() { | 1033 | void PlayListWidget::populateVideoView() { |
1034 | videoView->clear(); | 1034 | videoView->clear(); |
1035 | StorageInfo storageInfo; | 1035 | StorageInfo storageInfo; |
1036 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 1036 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
1037 | 1037 | ||
1038 | if(!videoScan ) scanForVideo(); | 1038 | if(!videoScan ) scanForVideo(); |
1039 | 1039 | ||
1040 | QListIterator<DocLnk> Vdit( vFiles.children() ); | 1040 | QListIterator<DocLnk> Vdit( vFiles.children() ); |
1041 | QListIterator<FileSystem> it ( fs ); | 1041 | QListIterator<FileSystem> it ( fs ); |
1042 | videoView->clear(); | 1042 | videoView->clear(); |
1043 | QString storage; | 1043 | QString storage; |
1044 | for ( ; Vdit.current(); ++Vdit ) { | 1044 | for ( ; Vdit.current(); ++Vdit ) { |
1045 | for( ; it.current(); ++it ){ | 1045 | for( ; it.current(); ++it ){ |
1046 | const QString name = (*it)->name(); | 1046 | const QString name = (*it)->name(); |
1047 | const QString path = (*it)->path(); | 1047 | const QString path = (*it)->path(); |
1048 | if( Vdit.current()->file().find(path) != -1 ) storage=name; | 1048 | if( Vdit.current()->file().find(path) != -1 ) storage=name; |
1049 | } | 1049 | } |
1050 | 1050 | ||
1051 | QListViewItem * newItem; | 1051 | QListViewItem * newItem; |
1052 | if ( QFile( Vdit.current()->file()).exists() ) { | 1052 | if ( QFile( Vdit.current()->file()).exists() ) { |
1053 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), | 1053 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), |
1054 | QString::number( QFile( Vdit.current()->file() ).size() ), | 1054 | QString::number( QFile( Vdit.current()->file() ).size() ), |
1055 | storage, Vdit.current()->file()); | 1055 | storage, Vdit.current()->file()); |
1056 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/videofile" )); | 1056 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/videofile" )); |
1057 | } | 1057 | } |
1058 | } | 1058 | } |
1059 | } | 1059 | } |
1060 | 1060 | ||
1061 | void PlayListWidget::openFile() { | 1061 | void PlayListWidget::openFile() { |
1062 | QString filename, name; | 1062 | QString filename, name; |
1063 | InputDialog *fileDlg; | 1063 | InputDialog *fileDlg; |
1064 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); | 1064 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); |
1065 | fileDlg->exec(); | 1065 | fileDlg->exec(); |
1066 | if( fileDlg->result() == 1 ) { | 1066 | if( fileDlg->result() == 1 ) { |
1067 | filename = fileDlg->text(); | 1067 | filename = fileDlg->text(); |
1068 | // qDebug( "Selected filename is " + filename ); | 1068 | // qDebug( "Selected filename is " + filename ); |
1069 | DocLnk lnk; | 1069 | DocLnk lnk; |
1070 | Config cfg( "OpiePlayer" ); | 1070 | Config cfg( "OpiePlayer" ); |
1071 | cfg.setGroup("PlayList"); | 1071 | cfg.setGroup("PlayList"); |
1072 | 1072 | ||
1073 | QString m3uFile; | 1073 | QString m3uFile; |
1074 | m3uFile = filename; | 1074 | m3uFile = filename; |
1075 | if(filename.left(4) == "http") { | 1075 | if(filename.left(4) == "http") { |
1076 | if(filename.find(":",8,TRUE) != -1) { //found a port | 1076 | if(filename.find(":",8,TRUE) != -1) { //found a port |
1077 | 1077 | ||
1078 | m3uFile = filename; | 1078 | m3uFile = filename; |
1079 | if( m3uFile.right( 1 ).find( '/' ) == -1) { | 1079 | if( m3uFile.right( 1 ).find( '/' ) == -1) { |
1080 | m3uFile += "/"; | 1080 | m3uFile += "/"; |
1081 | } | 1081 | } |
1082 | filename = m3uFile; | 1082 | filename = m3uFile; |
1083 | } | 1083 | } |
1084 | lnk.setName( m3uFile ); //sets name | 1084 | lnk.setName( m3uFile ); //sets name |
1085 | lnk.setFile( filename ); //sets file name | 1085 | lnk.setFile( filename ); //sets file name |
1086 | lnk.setIcon("opieplayer2/musicfile"); | 1086 | lnk.setIcon("opieplayer2/musicfile"); |
1087 | d->selectedFiles->addToSelection( lnk ); | 1087 | d->selectedFiles->addToSelection( lnk ); |
1088 | writeCurrentM3u(); | 1088 | writeCurrentM3u(); |
1089 | } | 1089 | } |
1090 | else if( filename.right( 3) == "m3u" ) { | 1090 | else if( filename.right( 3) == "m3u" ) { |
1091 | readm3u( filename ); | 1091 | readm3u( filename ); |
1092 | 1092 | ||
1093 | } else if( filename.right(3) == "pls" ) { | 1093 | } else if( filename.right(3) == "pls" ) { |
1094 | readPls( filename ); | 1094 | readPls( filename ); |
1095 | } else { | 1095 | } else { |
1096 | lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name | 1096 | lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name |
1097 | lnk.setFile( filename ); //sets file name | 1097 | lnk.setFile( filename ); //sets file name |
1098 | d->selectedFiles->addToSelection( lnk); | 1098 | d->selectedFiles->addToSelection( lnk); |
1099 | lnk.removeLinkFile(); | 1099 | lnk.removeLinkFile(); |
1100 | writeCurrentM3u(); | 1100 | writeCurrentM3u(); |
1101 | } | 1101 | } |
1102 | } | 1102 | } |
1103 | 1103 | ||
1104 | if( fileDlg ) { | 1104 | if( fileDlg ) { |
1105 | delete fileDlg; | 1105 | delete fileDlg; |
1106 | } | 1106 | } |
1107 | } | 1107 | } |
1108 | 1108 | ||
1109 | 1109 | ||
1110 | /* | 1110 | /* |
1111 | reads m3u and shows files/urls to playlist widget */ | 1111 | reads m3u and shows files/urls to playlist widget */ |
1112 | void PlayListWidget::readm3u( const QString &filename ) { | 1112 | void PlayListWidget::readm3u( const QString &filename ) { |
1113 | // qDebug( "read m3u filename " + filename ); | 1113 | // qDebug( "read m3u filename " + filename ); |
1114 | 1114 | ||
1115 | Om3u *m3uList; | 1115 | Om3u *m3uList; |
1116 | QString s, name; | 1116 | QString s, name; |
1117 | m3uList = new Om3u( filename, IO_ReadOnly ); | 1117 | m3uList = new Om3u( filename, IO_ReadOnly ); |
1118 | m3uList->readM3u(); | 1118 | m3uList->readM3u(); |
1119 | DocLnk lnk; | 1119 | DocLnk lnk; |
1120 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { | 1120 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { |
1121 | s = *it; | 1121 | s = *it; |
1122 | // qDebug("reading "+ s); | 1122 | // qDebug("reading "+ s); |
1123 | if(s.left(4)=="http") { | 1123 | if(s.left(4)=="http") { |
1124 | lnk.setName( s ); //sets file name | 1124 | lnk.setName( s ); //sets file name |
1125 | lnk.setIcon("opieplayer2/musicfile"); | 1125 | lnk.setIcon("opieplayer2/musicfile"); |
1126 | 1126 | ||
1127 | // if(s.right(4) != '.' || s.right(5) != '.') | 1127 | // if(s.right(4) != '.' || s.right(5) != '.') |
1128 | if(s.right(4) != '.' || s.right(5) != '.' ) | 1128 | if(s.right(4) != '.' || s.right(5) != '.' ) |
1129 | if( s.right(1) != "/") | 1129 | if( s.right(1) != "/") |
1130 | lnk.setFile( s+"/"); //if url with no extension | 1130 | lnk.setFile( s+"/"); //if url with no extension |
1131 | else | 1131 | else |
1132 | lnk.setFile( s ); //sets file name | 1132 | lnk.setFile( s ); //sets file name |
1133 | 1133 | ||
1134 | } else { | 1134 | } else { |
1135 | // if( QFileInfo( s ).exists() ) { | 1135 | // if( QFileInfo( s ).exists() ) { |
1136 | lnk.setName( fullBaseName ( QFileInfo(s))); | 1136 | lnk.setName( fullBaseName ( QFileInfo(s))); |
1137 | // if(s.right(4) == '.') {//if regular file | 1137 | // if(s.right(4) == '.') {//if regular file |
1138 | if(s.left(1) != "/") { | 1138 | if(s.left(1) != "/") { |
1139 | // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); | 1139 | // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); |
1140 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); | 1140 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); |
1141 | lnk.setIcon("SoundPlayer"); | 1141 | lnk.setIcon("SoundPlayer"); |
1142 | } else { | 1142 | } else { |
1143 | // qDebug("set link2 "+s); | 1143 | // qDebug("set link2 "+s); |
1144 | lnk.setFile( s); | 1144 | lnk.setFile( s); |
1145 | lnk.setIcon("SoundPlayer"); | 1145 | lnk.setIcon("SoundPlayer"); |
1146 | } | 1146 | } |
1147 | } | 1147 | } |
1148 | d->selectedFiles->addToSelection( lnk ); | 1148 | d->selectedFiles->addToSelection( lnk ); |
1149 | } | 1149 | } |
1150 | Config config( "OpiePlayer" ); | 1150 | Config config( "OpiePlayer" ); |
1151 | config.setGroup( "PlayList" ); | 1151 | config.setGroup( "PlayList" ); |
1152 | 1152 | ||
1153 | config.writeEntry("CurrentPlaylist",filename); | 1153 | config.writeEntry("CurrentPlaylist",filename); |
1154 | config.write(); | 1154 | config.write(); |
1155 | currentPlayList=filename; | 1155 | currentPlayList=filename; |
1156 | 1156 | ||
1157 | // m3uList->write(); | 1157 | // m3uList->write(); |
1158 | m3uList->close(); | 1158 | m3uList->close(); |
1159 | if(m3uList) delete m3uList; | 1159 | if(m3uList) delete m3uList; |
1160 | 1160 | ||
1161 | d->selectedFiles->setSelectedItem( s); | 1161 | d->selectedFiles->setSelectedItem( s); |
1162 | setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(filename))); | 1162 | setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(filename))); |
1163 | 1163 | ||
1164 | } | 1164 | } |
1165 | 1165 | ||
1166 | /* | 1166 | /* |
1167 | reads pls and adds files/urls to playlist */ | 1167 | reads pls and adds files/urls to playlist */ |
1168 | void PlayListWidget::readPls( const QString &filename ) { | 1168 | void PlayListWidget::readPls( const QString &filename ) { |
1169 | 1169 | ||
1170 | // qDebug( "pls filename is " + filename ); | 1170 | // qDebug( "pls filename is " + filename ); |
1171 | Om3u *m3uList; | 1171 | Om3u *m3uList; |
1172 | QString s, name; | 1172 | QString s, name; |
1173 | m3uList = new Om3u( filename, IO_ReadOnly ); | 1173 | m3uList = new Om3u( filename, IO_ReadOnly ); |
1174 | m3uList->readPls(); | 1174 | m3uList->readPls(); |
1175 | 1175 | ||
1176 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { | 1176 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { |
1177 | s = *it; | 1177 | s = *it; |
1178 | // s.replace( QRegExp( "%20" )," " ); | 1178 | // s.replace( QRegExp( "%20" )," " ); |
1179 | DocLnk lnk( s ); | 1179 | DocLnk lnk( s ); |
1180 | QFileInfo f( s ); | 1180 | QFileInfo f( s ); |
1181 | QString name = fullBaseName ( f); | 1181 | QString name = fullBaseName ( f); |
1182 | 1182 | ||
1183 | if( name.left( 4 ) == "http" ) { | 1183 | if( name.left( 4 ) == "http" ) { |
1184 | name = s.right( s.length() - 7); | 1184 | name = s.right( s.length() - 7); |
1185 | } else { | 1185 | } else { |
1186 | name = s; | 1186 | name = s; |
1187 | } | 1187 | } |
1188 | 1188 | ||
1189 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); | 1189 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); |
1190 | 1190 | ||
1191 | lnk.setName( name ); | 1191 | lnk.setName( name ); |
1192 | if( s.at( s.length() - 4) == '.') {// if this is probably a file | 1192 | if( s.at( s.length() - 4) == '.') {// if this is probably a file |
1193 | lnk.setFile( s ); | 1193 | lnk.setFile( s ); |
1194 | } else { //if its a url | 1194 | } else { //if its a url |
1195 | if( name.right( 1 ).find( '/' ) == -1) { | 1195 | if( name.right( 1 ).find( '/' ) == -1) { |
1196 | s += "/"; | 1196 | s += "/"; |
1197 | } | 1197 | } |
1198 | lnk.setFile( s ); | 1198 | lnk.setFile( s ); |
1199 | } | 1199 | } |
1200 | lnk.setType( "audio/x-mpegurl" ); | 1200 | lnk.setType( "audio/x-mpegurl" ); |
1201 | 1201 | ||
1202 | lnk.writeLink(); | 1202 | lnk.writeLink(); |
1203 | d->selectedFiles->addToSelection( lnk ); | 1203 | d->selectedFiles->addToSelection( lnk ); |
1204 | } | 1204 | } |
1205 | 1205 | ||
1206 | m3uList->close(); | 1206 | m3uList->close(); |
1207 | if(m3uList) delete m3uList; | 1207 | if(m3uList) delete m3uList; |
1208 | } | 1208 | } |
1209 | 1209 | ||
1210 | /* | 1210 | /* |
1211 | writes current playlist to current m3u file */ | 1211 | writes current playlist to current m3u file */ |
1212 | void PlayListWidget::writeCurrentM3u() { | 1212 | void PlayListWidget::writeCurrentM3u() { |
1213 | // qDebug("writing to current m3u"); | 1213 | // qDebug("writing to current m3u"); |
1214 | Config cfg( "OpiePlayer" ); | 1214 | Config cfg( "OpiePlayer" ); |
1215 | cfg.setGroup("PlayList"); | 1215 | cfg.setGroup("PlayList"); |
1216 | currentPlayList = cfg.readEntry("CurrentPlaylist",""); | 1216 | currentPlayList = cfg.readEntry("CurrentPlaylist",""); |
1217 | Om3u *m3uList; | 1217 | Om3u *m3uList; |
1218 | m3uList = new Om3u( currentPlayList, IO_ReadWrite | IO_Truncate ); | 1218 | m3uList = new Om3u( currentPlayList, IO_ReadWrite | IO_Truncate ); |
1219 | 1219 | ||
1220 | if( d->selectedFiles->first()) { | 1220 | if( d->selectedFiles->first()) { |
1221 | do { | 1221 | do { |
1222 | // qDebug( "writeCurrentM3u " +d->selectedFiles->current()->file()); | 1222 | // qDebug( "writeCurrentM3u " +d->selectedFiles->current()->file()); |
1223 | m3uList->add( d->selectedFiles->current()->file() ); | 1223 | m3uList->add( d->selectedFiles->current()->file() ); |
1224 | } | 1224 | } |
1225 | while ( d->selectedFiles->next() ); | 1225 | while ( d->selectedFiles->next() ); |
1226 | // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); | 1226 | // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); |
1227 | m3uList->write(); | 1227 | m3uList->write(); |
1228 | m3uList->close(); | 1228 | m3uList->close(); |
1229 | 1229 | ||
1230 | if(m3uList) delete m3uList; | 1230 | if(m3uList) delete m3uList; |
1231 | } | 1231 | } |
1232 | } | 1232 | } |
1233 | 1233 | ||
1234 | /* | 1234 | /* |
1235 | writes current playlist to m3u file */ | 1235 | writes current playlist to m3u file */ |
1236 | void PlayListWidget::writem3u() { | 1236 | void PlayListWidget::writem3u() { |
1237 | InputDialog *fileDlg; | 1237 | InputDialog *fileDlg; |
1238 | fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); | 1238 | fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); |
1239 | fileDlg->exec(); | 1239 | fileDlg->exec(); |
1240 | QString name, filename, list; | 1240 | QString name, filename, list; |
1241 | Om3u *m3uList; | 1241 | Om3u *m3uList; |
1242 | 1242 | ||
1243 | if( fileDlg->result() == 1 ) { | 1243 | if( fileDlg->result() == 1 ) { |
1244 | name = fileDlg->text(); | 1244 | name = fileDlg->text(); |
1245 | // qDebug( filename ); | 1245 | // qDebug( filename ); |
1246 | if( name.find("/",0,true) != -1) {// assume they specify a file path | 1246 | if( name.find("/",0,true) != -1) {// assume they specify a file path |
1247 | filename = name; | 1247 | filename = name; |
1248 | name = name.right(name.length()- name.findRev("/",-1,true) - 1 ); | 1248 | name = name.right(name.length()- name.findRev("/",-1,true) - 1 ); |
1249 | } | 1249 | } |
1250 | else //otherwise dump it somewhere noticable | 1250 | else //otherwise dump it somewhere noticable |
1251 | filename = QPEApplication::documentDir() + "/" + name; | 1251 | filename = QPEApplication::documentDir() + "/" + name; |
1252 | 1252 | ||
1253 | if( filename.right( 3 ) != "m3u" ) //needs filename extension | 1253 | if( filename.right( 3 ) != "m3u" ) //needs filename extension |
1254 | filename += ".m3u"; | 1254 | filename += ".m3u"; |
1255 | 1255 | ||
1256 | if( d->selectedFiles->first()) { | 1256 | if( d->selectedFiles->first()) { |
1257 | m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); | 1257 | m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); |
1258 | 1258 | ||
1259 | do { | 1259 | do { |
1260 | m3uList->add( d->selectedFiles->current()->file()); | 1260 | m3uList->add( d->selectedFiles->current()->file()); |
1261 | } | 1261 | } |
1262 | while ( d->selectedFiles->next() ); | 1262 | while ( d->selectedFiles->next() ); |
1263 | // qDebug( list ); | 1263 | // qDebug( list ); |
1264 | m3uList->write(); | 1264 | m3uList->write(); |
1265 | m3uList->close(); | 1265 | m3uList->close(); |
1266 | if(m3uList) delete m3uList; | 1266 | if(m3uList) delete m3uList; |
1267 | 1267 | ||
1268 | if(fileDlg) delete fileDlg; | 1268 | if(fileDlg) delete fileDlg; |
1269 | 1269 | ||
1270 | DocLnk lnk; | 1270 | DocLnk lnk; |
1271 | lnk.setFile( filename); | 1271 | lnk.setFile( filename); |
1272 | lnk.setIcon("opieplayer2/playlist2"); | 1272 | lnk.setIcon("opieplayer2/playlist2"); |
1273 | lnk.setName( name); //sets file name | 1273 | lnk.setName( name); //sets file name |
1274 | 1274 | ||
1275 | // qDebug(filename); | 1275 | // qDebug(filename); |
1276 | Config config( "OpiePlayer" ); | 1276 | Config config( "OpiePlayer" ); |
1277 | config.setGroup( "PlayList" ); | 1277 | config.setGroup( "PlayList" ); |
1278 | 1278 | ||
1279 | config.writeEntry("CurrentPlaylist",filename); | 1279 | config.writeEntry("CurrentPlaylist",filename); |
1280 | currentPlayList=filename; | 1280 | currentPlayList=filename; |
1281 | 1281 | ||
1282 | if(!lnk.writeLink()) { | 1282 | if(!lnk.writeLink()) { |
1283 | // qDebug("Writing doclink did not work"); | 1283 | // qDebug("Writing doclink did not work"); |
1284 | } | 1284 | } |
1285 | 1285 | ||
1286 | setCaption(tr("OpiePlayer: ") + name); | 1286 | setCaption(tr("OpiePlayer: ") + name); |
1287 | } | 1287 | } |
1288 | } | 1288 | } |
1289 | } | 1289 | } |
1290 | 1290 | ||
1291 | 1291 | ||
1292 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e) | 1292 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e) |
1293 | { | 1293 | { |
1294 | switch ( e->key() ) { | 1294 | switch ( e->key() ) { |
1295 | ////////////////////////////// Zaurus keys | 1295 | ////////////////////////////// Zaurus keys |
1296 | case Key_F9: //activity | 1296 | case Key_F9: //activity |
1297 | // if(audioUI->isHidden()) | 1297 | // if(audioUI->isHidden()) |
1298 | // audioUI->showMaximized(); | 1298 | // audioUI->showMaximized(); |
1299 | break; | 1299 | break; |
1300 | case Key_F10: //contacts | 1300 | case Key_F10: //contacts |
1301 | // if( videoUI->isHidden()) | 1301 | // if( videoUI->isHidden()) |
1302 | // videoUI->showMaximized(); | 1302 | // videoUI->showMaximized(); |
1303 | break; | 1303 | break; |
1304 | case Key_F11: //menu | 1304 | case Key_F11: //menu |
1305 | break; | 1305 | break; |
1306 | case Key_F12: //home | 1306 | case Key_F12: //home |
1307 | // doBlank(); | 1307 | // doBlank(); |
1308 | break; | 1308 | break; |
1309 | case Key_F13: //mail | 1309 | case Key_F13: //mail |
1310 | // doUnblank(); | 1310 | // doUnblank(); |
1311 | break; | 1311 | break; |
1312 | case Key_Q: //add to playlist | 1312 | case Key_Q: //add to playlist |
1313 | addSelected(); | 1313 | addSelected(); |
1314 | break; | 1314 | break; |
1315 | case Key_R: //remove from playlist | 1315 | case Key_R: //remove from playlist |
1316 | removeSelected(); | 1316 | removeSelected(); |
1317 | break; | 1317 | break; |
1318 | // case Key_P: //play | 1318 | // case Key_P: //play |
1319 | // qDebug("Play"); | 1319 | // qDebug("Play"); |
1320 | // playSelected(); | 1320 | // playSelected(); |
1321 | // break; | 1321 | // break; |
1322 | case Key_Space: | 1322 | case Key_Space: |
1323 | // playSelected(); puh | 1323 | // playSelected(); puh |
1324 | break; | 1324 | break; |
1325 | case Key_1: | 1325 | case Key_1: |
1326 | tabWidget->setCurrentPage(0); | 1326 | tabWidget->setCurrentPage(0); |
1327 | break; | 1327 | break; |
1328 | case Key_2: | 1328 | case Key_2: |
1329 | tabWidget->setCurrentPage(1); | 1329 | tabWidget->setCurrentPage(1); |
1330 | break; | 1330 | break; |
1331 | case Key_3: | 1331 | case Key_3: |
1332 | tabWidget->setCurrentPage(2); | 1332 | tabWidget->setCurrentPage(2); |
1333 | break; | 1333 | break; |
1334 | case Key_4: | 1334 | case Key_4: |
1335 | tabWidget->setCurrentPage(3); | 1335 | tabWidget->setCurrentPage(3); |
1336 | break; | 1336 | break; |
1337 | case Key_Down: | 1337 | case Key_Down: |
1338 | if ( !d->selectedFiles->next() ) | 1338 | if ( !d->selectedFiles->next() ) |
1339 | d->selectedFiles->first(); | 1339 | d->selectedFiles->first(); |
1340 | 1340 | ||
1341 | break; | 1341 | break; |
1342 | case Key_Up: | 1342 | case Key_Up: |
1343 | if ( !d->selectedFiles->prev() ) | 1343 | if ( !d->selectedFiles->prev() ) |
1344 | // d->selectedFiles->last(); | 1344 | // d->selectedFiles->last(); |
1345 | 1345 | ||
1346 | break; | 1346 | break; |
1347 | 1347 | ||
1348 | } | 1348 | } |
1349 | } | 1349 | } |
1350 | 1350 | ||
1351 | void PlayListWidget::keyPressEvent( QKeyEvent *) | 1351 | void PlayListWidget::keyPressEvent( QKeyEvent *) |
1352 | { | 1352 | { |
1353 | // qDebug("Key press"); | 1353 | // qDebug("Key press"); |
1354 | // switch ( e->key() ) { | 1354 | // switch ( e->key() ) { |
1355 | // ////////////////////////////// Zaurus keys | 1355 | // ////////////////////////////// Zaurus keys |
1356 | // case Key_A: //add to playlist | 1356 | // case Key_A: //add to playlist |
1357 | // qDebug("Add"); | 1357 | // qDebug("Add"); |
1358 | // addSelected(); | 1358 | // addSelected(); |
1359 | // break; | 1359 | // break; |
1360 | // case Key_R: //remove from playlist | 1360 | // case Key_R: //remove from playlist |
1361 | // removeSelected(); | 1361 | // removeSelected(); |
1362 | // break; | 1362 | // break; |
1363 | // case Key_P: //play | 1363 | // case Key_P: //play |
1364 | // qDebug("Play"); | 1364 | // qDebug("Play"); |
1365 | // playSelected(); | 1365 | // playSelected(); |
1366 | // break; | 1366 | // break; |
1367 | // case Key_Space: | 1367 | // case Key_Space: |
1368 | // qDebug("Play"); | 1368 | // qDebug("Play"); |
1369 | // playSelected(); | 1369 | // playSelected(); |
1370 | // break; | 1370 | // break; |
1371 | // } | 1371 | // } |
1372 | } | 1372 | } |
1373 | 1373 | ||
1374 | void PlayListWidget::doBlank() { | 1374 | void PlayListWidget::doBlank() { |
1375 | // TODO: why do we blank this way, why don't we use ODevice or ScreenSaver? | 1375 | // qDebug("do blanking"); |
1376 | #ifdef QT_QWS_DEVFS | 1376 | #ifdef QT_QWS_DEVFS |
1377 | fd=open("/dev/fb/0",O_RDWR); | 1377 | fd=open("/dev/fb/0",O_RDWR); |
1378 | #else | 1378 | #else |
1379 | fd=open("/dev/fb0",O_RDWR); | 1379 | fd=open("/dev/fb0",O_RDWR); |
1380 | #endif | 1380 | #endif |
1381 | if (fd != -1) { | 1381 | if (fd != -1) { |
1382 | ioctl(fd,FBIOBLANK,1); | 1382 | ioctl(fd,FBIOBLANK,1); |
1383 | // close(fd); | 1383 | // close(fd); |
1384 | } | 1384 | } |
1385 | } | 1385 | } |
1386 | 1386 | ||
1387 | void PlayListWidget::doUnblank() { | 1387 | void PlayListWidget::doUnblank() { |
1388 | // this crashes opieplayer with a segfault | 1388 | // this crashes opieplayer with a segfault |
1389 | // int fd; | 1389 | // int fd; |
1390 | // fd=open("/dev/fb0",O_RDWR); | 1390 | // fd=open("/dev/fb0",O_RDWR); |
1391 | // qDebug("do unblanking"); | 1391 | // qDebug("do unblanking"); |
1392 | if (fd != -1) { | 1392 | if (fd != -1) { |
1393 | ioctl(fd,FBIOBLANK,0); | 1393 | ioctl(fd,FBIOBLANK,0); |
1394 | close(fd); | 1394 | close(fd); |
1395 | } | 1395 | } |
1396 | QCopEnvelope h("QPE/System", "setBacklight(int)"); | 1396 | QCopEnvelope h("QPE/System", "setBacklight(int)"); |
1397 | h <<-3;// v[1]; // -3 Force on | 1397 | h <<-3;// v[1]; // -3 Force on |
1398 | } | 1398 | } |
1399 | 1399 | ||
1400 | void PlayListWidget::populateSkinsMenu() { | 1400 | void PlayListWidget::populateSkinsMenu() { |
1401 | int item = 0; | 1401 | int item = 0; |
1402 | defaultSkinIndex = 0; | 1402 | defaultSkinIndex = 0; |
1403 | QString skinName; | 1403 | QString skinName; |
1404 | Config cfg( "OpiePlayer" ); | 1404 | Config cfg( "OpiePlayer" ); |
1405 | cfg.setGroup("Options" ); | 1405 | cfg.setGroup("Options" ); |
1406 | QString skin = cfg.readEntry( "Skin", "default" ); | 1406 | QString skin = cfg.readEntry( "Skin", "default" ); |
1407 | 1407 | ||
1408 | QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); | 1408 | QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); |
1409 | skinsDir.setFilter( QDir::Dirs ); | 1409 | skinsDir.setFilter( QDir::Dirs ); |
1410 | skinsDir.setSorting(QDir::Name ); | 1410 | skinsDir.setSorting(QDir::Name ); |
1411 | const QFileInfoList *skinslist = skinsDir.entryInfoList(); | 1411 | const QFileInfoList *skinslist = skinsDir.entryInfoList(); |
1412 | QFileInfoListIterator it( *skinslist ); | 1412 | QFileInfoListIterator it( *skinslist ); |
1413 | QFileInfo *fi; | 1413 | QFileInfo *fi; |
1414 | while ( ( fi = it.current() ) ) { | 1414 | while ( ( fi = it.current() ) ) { |
1415 | skinName = fi->fileName(); | 1415 | skinName = fi->fileName(); |
1416 | // qDebug( fi->fileName() ); | 1416 | // qDebug( fi->fileName() ); |
1417 | if( skinName != "." && skinName != ".." && skinName !="CVS" ) { | 1417 | if( skinName != "." && skinName != ".." && skinName !="CVS" ) { |
1418 | item = skinsMenu->insertItem( fi->fileName() ) ; | 1418 | item = skinsMenu->insertItem( fi->fileName() ) ; |
1419 | } | 1419 | } |
1420 | if( skinName == "default" ) { | 1420 | if( skinName == "default" ) { |
1421 | defaultSkinIndex = item; | 1421 | defaultSkinIndex = item; |
1422 | } | 1422 | } |
1423 | if( skinName == skin ) { | 1423 | if( skinName == skin ) { |
1424 | skinsMenu->setItemChecked( item, TRUE ); | 1424 | skinsMenu->setItemChecked( item, TRUE ); |
1425 | } | 1425 | } |
1426 | ++it; | 1426 | ++it; |
1427 | } | 1427 | } |
1428 | } | 1428 | } |
1429 | 1429 | ||
1430 | void PlayListWidget::skinsMenuActivated( int item ) { | 1430 | void PlayListWidget::skinsMenuActivated( int item ) { |
1431 | for( int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { | 1431 | for( int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i-- ) { |
1432 | skinsMenu->setItemChecked( i, FALSE ); | 1432 | skinsMenu->setItemChecked( i, FALSE ); |
1433 | } | 1433 | } |
1434 | skinsMenu->setItemChecked( item, TRUE ); | 1434 | skinsMenu->setItemChecked( item, TRUE ); |
1435 | 1435 | ||
1436 | Config cfg( "OpiePlayer" ); | 1436 | Config cfg( "OpiePlayer" ); |
1437 | cfg.setGroup("Options"); | 1437 | cfg.setGroup("Options"); |
1438 | cfg.writeEntry("Skin", skinsMenu->text( item ) ); | 1438 | cfg.writeEntry("Skin", skinsMenu->text( item ) ); |
1439 | } | 1439 | } |
1440 | 1440 | ||
1441 | void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) { | 1441 | void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) { |
1442 | // qDebug("qcop message "+msg ); | 1442 | // qDebug("qcop message "+msg ); |
1443 | QDataStream stream ( data, IO_ReadOnly ); | 1443 | QDataStream stream ( data, IO_ReadOnly ); |
1444 | if ( msg == "play()" ) { //plays current selection | 1444 | if ( msg == "play()" ) { //plays current selection |
1445 | btnPlay( true); | 1445 | btnPlay( true); |
1446 | } else if ( msg == "stop()" ) { | 1446 | } else if ( msg == "stop()" ) { |
1447 | mediaPlayerState->setPlaying( false); | 1447 | mediaPlayerState->setPlaying( false); |
1448 | } else if ( msg == "togglePause()" ) { | 1448 | } else if ( msg == "togglePause()" ) { |
1449 | mediaPlayerState->togglePaused(); | 1449 | mediaPlayerState->togglePaused(); |
1450 | } else if ( msg == "next()" ) { //select next in lis | 1450 | } else if ( msg == "next()" ) { //select next in lis |
1451 | mediaPlayerState->setNext(); | 1451 | mediaPlayerState->setNext(); |
1452 | } else if ( msg == "prev()" ) { //select previous in list | 1452 | } else if ( msg == "prev()" ) { //select previous in list |
1453 | mediaPlayerState->setPrev(); | 1453 | mediaPlayerState->setPrev(); |
1454 | } else if ( msg == "toggleLooping()" ) { //loop or not loop | 1454 | } else if ( msg == "toggleLooping()" ) { //loop or not loop |
1455 | mediaPlayerState->toggleLooping(); | 1455 | mediaPlayerState->toggleLooping(); |
1456 | } else if ( msg == "toggleShuffled()" ) { //shuffled or not shuffled | 1456 | } else if ( msg == "toggleShuffled()" ) { //shuffled or not shuffled |
1457 | mediaPlayerState->toggleShuffled(); | 1457 | mediaPlayerState->toggleShuffled(); |
1458 | } else if ( msg == "volUp()" ) { //volume more | 1458 | } else if ( msg == "volUp()" ) { //volume more |
1459 | // emit moreClicked(); | 1459 | // emit moreClicked(); |
1460 | // emit moreReleased(); | 1460 | // emit moreReleased(); |
1461 | } else if ( msg == "volDown()" ) { //volume less | 1461 | } else if ( msg == "volDown()" ) { //volume less |
1462 | // emit lessClicked(); | 1462 | // emit lessClicked(); |
1463 | // emit lessReleased(); | 1463 | // emit lessReleased(); |
1464 | } else if ( msg == "play(QString)" ) { //play this now | 1464 | } else if ( msg == "play(QString)" ) { //play this now |
1465 | QString file; | 1465 | QString file; |
1466 | stream >> file; | 1466 | stream >> file; |
1467 | setDocumentEx( (const QString &) file); | 1467 | setDocumentEx( (const QString &) file); |
1468 | } else if ( msg == "add(QString)" ) { //add to playlist | 1468 | } else if ( msg == "add(QString)" ) { //add to playlist |
1469 | QString file; | 1469 | QString file; |
1470 | stream >> file; | 1470 | stream >> file; |
1471 | QFileInfo fileInfo(file); | 1471 | QFileInfo fileInfo(file); |
1472 | DocLnk lnk; | 1472 | DocLnk lnk; |
1473 | lnk.setName( fileInfo.baseName() ); //sets name | 1473 | lnk.setName( fileInfo.baseName() ); //sets name |
1474 | lnk.setFile( file ); //sets file name | 1474 | lnk.setFile( file ); //sets file name |
1475 | addToSelection( lnk ); | 1475 | addToSelection( lnk ); |
1476 | } else if ( msg == "rem(QString)" ) { //remove from playlist | 1476 | } else if ( msg == "rem(QString)" ) { //remove from playlist |
1477 | QString file; | 1477 | QString file; |
1478 | stream >> file; | 1478 | stream >> file; |
1479 | } else if ( msg == "setDocument(QString)" ) { //loop or not loop | 1479 | } else if ( msg == "setDocument(QString)" ) { //loop or not loop |
1480 | QCopEnvelope h("QPE/Application/opieplayer", "raise()"); | 1480 | QCopEnvelope h("QPE/Application/opieplayer", "raise()"); |
1481 | } | 1481 | } |
1482 | } | 1482 | } |
diff --git a/core/multimedia/opieplayer/vorbis/config.in b/core/multimedia/opieplayer/vorbis/config.in index bad9922..d66ec88 100644 --- a/core/multimedia/opieplayer/vorbis/config.in +++ b/core/multimedia/opieplayer/vorbis/config.in | |||
@@ -1,5 +1,6 @@ | |||
1 | config LIBTREMORPLUGIN | 1 | config LIBTREMORPLUGIN |
2 | boolean "opieplayer1-libtremorplugin (play OGG vorbis files)" | 2 | boolean "libtremorplugin" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && OPIEPLAYER | 4 | depends ( LIBQPE || LIBQPE-X11 ) && OPIEPLAYER |
5 | comment "tremor is ogg vorbis!!" | ||
5 | \ No newline at end of file | 6 | \ No newline at end of file |
diff --git a/core/multimedia/opieplayer/vorbis/libtremorplugin.cpp b/core/multimedia/opieplayer/vorbis/libtremorplugin.cpp index c1e1a23..53c4b2b 100644 --- a/core/multimedia/opieplayer/vorbis/libtremorplugin.cpp +++ b/core/multimedia/opieplayer/vorbis/libtremorplugin.cpp | |||
@@ -1,274 +1,273 @@ | |||
1 | /**************************************************************************** | 1 | /**************************************************************************** |
2 | * libtremorplugin.cpp | 2 | * libtremorplugin.cpp |
3 | * | 3 | * |
4 | * Copyright (C) 2002 Latchesar Ionkov <lucho@ionkov.net> | 4 | * Copyright (C) 2002 Latchesar Ionkov <lucho@ionkov.net> |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
8 | * the Free Software Foundation; either version 2 of the License, or | 8 | * the Free Software Foundation; either version 2 of the License, or |
9 | * (at your option) any later version. | 9 | * (at your option) any later version. |
10 | * | 10 | * |
11 | * This program is distributed in the hope that it will be useful, | 11 | * This program is distributed in the hope that it will be useful, |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | * GNU General Public License for more details. | 14 | * GNU General Public License for more details. |
15 | * | 15 | * |
16 | * You should have received a copy of the GNU General Public License | 16 | * You should have received a copy of the GNU General Public License |
17 | * along with this program; if not, write to the Free Software | 17 | * along with this program; if not, write to the Free Software |
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 | ****************************************************************************/ | 19 | ****************************************************************************/ |
20 | // fixed and adapted for opieplayer 2003 ljp <llornkcor@handhelds.org> | 20 | // fixed and adapted for opieplayer 2003 ljp <llornkcor@handhelds.org> |
21 | 21 | ||
22 | #include <stdio.h> | 22 | #include <stdio.h> |
23 | #include <stdarg.h> | 23 | #include <stdarg.h> |
24 | #include <stdlib.h> | 24 | #include <stdlib.h> |
25 | #include <sys/types.h> | 25 | #include <sys/types.h> |
26 | #include <sys/stat.h> | 26 | #include <sys/stat.h> |
27 | #include <fcntl.h> | 27 | #include <fcntl.h> |
28 | #include <unistd.h> | 28 | #include <unistd.h> |
29 | #include <string.h> | 29 | #include <string.h> |
30 | #include <errno.h> | 30 | #include <errno.h> |
31 | #include <time.h> | 31 | #include <time.h> |
32 | #include <locale.h> | 32 | #include <locale.h> |
33 | #include <math.h> | 33 | #include <math.h> |
34 | #include <assert.h> | 34 | #include <assert.h> |
35 | 35 | ||
36 | #include <qmap.h> | 36 | #include <qmap.h> |
37 | 37 | ||
38 | #include "libtremorplugin.h" | 38 | #include "libtremorplugin.h" |
39 | 39 | ||
40 | 40 | ||
41 | extern "C" { | 41 | extern "C" { |
42 | #include "tremor/ivorbiscodec.h" | ||
43 | #include "tremor/ivorbisfile.h" | 42 | #include "tremor/ivorbisfile.h" |
44 | } | 43 | } |
45 | 44 | ||
46 | 45 | ||
47 | #define MPEG_BUFFER_SIZE 65536 | 46 | #define MPEG_BUFFER_SIZE 65536 |
48 | //#define debugMsg(a) qDebug(a) | 47 | //#define debugMsg(a) qDebug(a) |
49 | #define debugMsg(a) | 48 | #define debugMsg(a) |
50 | 49 | ||
51 | 50 | ||
52 | class LibTremorPluginData { | 51 | class LibTremorPluginData { |
53 | public: | 52 | public: |
54 | char* filename; | 53 | char* filename; |
55 | FILE* f; | 54 | FILE* f; |
56 | OggVorbis_File vf; | 55 | OggVorbis_File vf; |
57 | vorbis_info* vi; | 56 | vorbis_info* vi; |
58 | vorbis_comment* vc; | 57 | vorbis_comment* vc; |
59 | bool bos; | 58 | bool bos; |
60 | int csection; | 59 | int csection; |
61 | QString finfo; | 60 | QString finfo; |
62 | }; | 61 | }; |
63 | 62 | ||
64 | 63 | ||
65 | LibTremorPlugin::LibTremorPlugin() { | 64 | LibTremorPlugin::LibTremorPlugin() { |
66 | qDebug("<<<<<<<<<<<<<TREMOR!!!!!>>>>>>>>>>>>>>>>>>"); | 65 | qDebug("<<<<<<<<<<<<<TREMOR!!!!!>>>>>>>>>>>>>>>>>>"); |
67 | d = new LibTremorPluginData; | 66 | d = new LibTremorPluginData; |
68 | d->f = 0; | 67 | d->f = 0; |
69 | d->vi = 0; | 68 | d->vi = 0; |
70 | d->vc = 0; | 69 | d->vc = 0; |
71 | d->bos = 0; | 70 | d->bos = 0; |
72 | d->csection = 0; | 71 | d->csection = 0; |
73 | d->finfo = ""; | 72 | d->finfo = ""; |
74 | } | 73 | } |
75 | 74 | ||
76 | 75 | ||
77 | LibTremorPlugin::~LibTremorPlugin() { | 76 | LibTremorPlugin::~LibTremorPlugin() { |
78 | close(); | 77 | close(); |
79 | delete d; | 78 | delete d; |
80 | } | 79 | } |
81 | 80 | ||
82 | 81 | ||
83 | bool LibTremorPlugin::isFileSupported( const QString& path ) { | 82 | bool LibTremorPlugin::isFileSupported( const QString& path ) { |
84 | debugMsg( "LibTremorPlugin::isFileSupported" ); | 83 | debugMsg( "LibTremorPlugin::isFileSupported" ); |
85 | 84 | ||
86 | // Mpeg file extensions | 85 | // Mpeg file extensions |
87 | // "mp2","mp3","m1v","m2v","m2s","mpg","vob","mpeg",ac3" | 86 | // "mp2","mp3","m1v","m2v","m2s","mpg","vob","mpeg",ac3" |
88 | // Other media extensions | 87 | // Other media extensions |
89 | // "wav","mid","mod","s3m","ogg","avi","mov","sid" | 88 | // "wav","mid","mod","s3m","ogg","avi","mov","sid" |
90 | 89 | ||
91 | char *ext = strrchr( path.latin1(), '.' ); | 90 | char *ext = strrchr( path.latin1(), '.' ); |
92 | 91 | ||
93 | // Test file extension | 92 | // Test file extension |
94 | if ( ext ) { | 93 | if ( ext ) { |
95 | if ( strncasecmp(ext, ".ogg", 4) == 0 ) | 94 | if ( strncasecmp(ext, ".ogg", 4) == 0 ) |
96 | return TRUE; | 95 | return TRUE; |
97 | } | 96 | } |
98 | 97 | ||
99 | return FALSE; | 98 | return FALSE; |
100 | } | 99 | } |
101 | 100 | ||
102 | 101 | ||
103 | bool LibTremorPlugin::open( const QString& path ) { | 102 | bool LibTremorPlugin::open( const QString& path ) { |
104 | debugMsg( "LibTremorPlugin::open" ); | 103 | debugMsg( "LibTremorPlugin::open" ); |
105 | 104 | ||
106 | d->filename = (char*) path.latin1(); | 105 | d->filename = (char*) path.latin1(); |
107 | d->f = fopen( d->filename, "r" ); | 106 | d->f = fopen( d->filename, "r" ); |
108 | if (d->f == 0) { | 107 | if (d->f == 0) { |
109 | qDebug("error opening %s", d->filename ); | 108 | qDebug("error opening %s", d->filename ); |
110 | return FALSE; | 109 | return FALSE; |
111 | } | 110 | } |
112 | 111 | ||
113 | if (ov_open(d->f, &d->vf, NULL, 0) < 0) { | 112 | if (ov_open(d->f, &d->vf, NULL, 0) < 0) { |
114 | qDebug("error opening %s", d->filename); | 113 | qDebug("error opening %s", d->filename); |
115 | return FALSE; | 114 | return FALSE; |
116 | } | 115 | } |
117 | 116 | ||
118 | d->vc = ov_comment(&d->vf, -1); | 117 | d->vc = ov_comment(&d->vf, -1); |
119 | d->vi = ov_info(&d->vf, -1); | 118 | d->vi = ov_info(&d->vf, -1); |
120 | d->bos = false; | 119 | d->bos = false; |
121 | 120 | ||
122 | QString comments[] = { "title", "artist", "album", "year", "tracknumber", "" }; | 121 | QString comments[] = { "title", "artist", "album", "year", "tracknumber", "" }; |
123 | QString cdescr[] = { "Title", "Artist", "Album", "Year", "Track", "" }; | 122 | QString cdescr[] = { "Title", "Artist", "Album", "Year", "Track", "" }; |
124 | 123 | ||
125 | 124 | ||
126 | QMap<QString, QString> cmap; | 125 | QMap<QString, QString> cmap; |
127 | char** cptr = d->vc->user_comments; | 126 | char** cptr = d->vc->user_comments; |
128 | 127 | ||
129 | while (*cptr != 0) { | 128 | while (*cptr != 0) { |
130 | QString s(*cptr); | 129 | QString s(*cptr); |
131 | int n = s.find('='); | 130 | int n = s.find('='); |
132 | 131 | ||
133 | if (n < 0) { | 132 | if (n < 0) { |
134 | continue; | 133 | continue; |
135 | } | 134 | } |
136 | 135 | ||
137 | QString key = s.left(n).lower(); | 136 | QString key = s.left(n).lower(); |
138 | QString value = s.mid(n+1); | 137 | QString value = s.mid(n+1); |
139 | 138 | ||
140 | cmap[key] = value; | 139 | cmap[key] = value; |
141 | cptr++; | 140 | cptr++; |
142 | } | 141 | } |
143 | 142 | ||
144 | d->finfo = ""; | 143 | d->finfo = ""; |
145 | for(int i = 0; !comments[i].isEmpty(); i++) { | 144 | for(int i = 0; !comments[i].isEmpty(); i++) { |
146 | QString v = cmap[comments[i].lower()]; | 145 | QString v = cmap[comments[i].lower()]; |
147 | 146 | ||
148 | if (!v.isEmpty()) { | 147 | if (!v.isEmpty()) { |
149 | if (!d->finfo.isEmpty()) { | 148 | if (!d->finfo.isEmpty()) { |
150 | d->finfo += ", "; | 149 | d->finfo += ", "; |
151 | } | 150 | } |
152 | 151 | ||
153 | d->finfo += cdescr[i] + ": " + v; | 152 | d->finfo += cdescr[i] + ": " + v; |
154 | } | 153 | } |
155 | } | 154 | } |
156 | 155 | ||
157 | qDebug("finfo: " + d->finfo); | 156 | qDebug("finfo: " + d->finfo); |
158 | 157 | ||
159 | return TRUE; | 158 | return TRUE; |
160 | } | 159 | } |
161 | 160 | ||
162 | 161 | ||
163 | bool LibTremorPlugin::close() { | 162 | bool LibTremorPlugin::close() { |
164 | debugMsg( "LibTremorPlugin::close" ); | 163 | debugMsg( "LibTremorPlugin::close" ); |
165 | 164 | ||
166 | int result = TRUE; | 165 | int result = TRUE; |
167 | 166 | ||
168 | if (fclose(d->f) == -1) { | 167 | if (fclose(d->f) == -1) { |
169 | qDebug("error closing file %s", d->filename); | 168 | qDebug("error closing file %s", d->filename); |
170 | result = FALSE; | 169 | result = FALSE; |
171 | } | 170 | } |
172 | 171 | ||
173 | d->f = 0; | 172 | d->f = 0; |
174 | d->finfo = ""; | 173 | d->finfo = ""; |
175 | 174 | ||
176 | return result; | 175 | return result; |
177 | } | 176 | } |
178 | 177 | ||
179 | 178 | ||
180 | bool LibTremorPlugin::isOpen() { | 179 | bool LibTremorPlugin::isOpen() { |
181 | debugMsg( "LibTremorPlugin::isOpen" ); | 180 | debugMsg( "LibTremorPlugin::isOpen" ); |
182 | return ( d->f != 0 ); | 181 | return ( d->f != 0 ); |
183 | } | 182 | } |
184 | 183 | ||
185 | 184 | ||
186 | const QString &LibTremorPlugin::fileInfo() { | 185 | const QString &LibTremorPlugin::fileInfo() { |
187 | return d->finfo; | 186 | return d->finfo; |
188 | } | 187 | } |
189 | 188 | ||
190 | int LibTremorPlugin::audioStreams() { | 189 | int LibTremorPlugin::audioStreams() { |
191 | debugMsg( "LibTremorPlugin::audioStreams" ); | 190 | debugMsg( "LibTremorPlugin::audioStreams" ); |
192 | return 1; | 191 | return 1; |
193 | } | 192 | } |
194 | 193 | ||
195 | 194 | ||
196 | int LibTremorPlugin::audioChannels( int ) { | 195 | int LibTremorPlugin::audioChannels( int ) { |
197 | qDebug( "LibTremorPlugin::audioChannels: %i", d->vi->channels ); | 196 | qDebug( "LibTremorPlugin::audioChannels: %i", d->vi->channels ); |
198 | return d->vi->channels; | 197 | return d->vi->channels; |
199 | } | 198 | } |
200 | 199 | ||
201 | 200 | ||
202 | int LibTremorPlugin::audioFrequency( int ) { | 201 | int LibTremorPlugin::audioFrequency( int ) { |
203 | qDebug( "LibTremorPlugin::audioFrequency: %ld", d->vi->rate ); | 202 | qDebug( "LibTremorPlugin::audioFrequency: %ld", d->vi->rate ); |
204 | return d->vi->rate; | 203 | return d->vi->rate; |
205 | } | 204 | } |
206 | 205 | ||
207 | 206 | ||
208 | int LibTremorPlugin::audioSamples( int ) { | 207 | int LibTremorPlugin::audioSamples( int ) { |
209 | debugMsg( "LibTremorPlugin::audioSamples" ); | 208 | debugMsg( "LibTremorPlugin::audioSamples" ); |
210 | return (int) ov_pcm_total(&d->vf,-1); | 209 | return (int) ov_pcm_total(&d->vf,-1); |
211 | } | 210 | } |
212 | 211 | ||
213 | 212 | ||
214 | bool LibTremorPlugin::audioSetSample( long, int ) { | 213 | bool LibTremorPlugin::audioSetSample( long, int ) { |
215 | debugMsg( "LibTremorPlugin::audioSetSample" ); | 214 | debugMsg( "LibTremorPlugin::audioSetSample" ); |
216 | return FALSE; | 215 | return FALSE; |
217 | } | 216 | } |
218 | 217 | ||
219 | 218 | ||
220 | long LibTremorPlugin::audioGetSample( int ) { | 219 | long LibTremorPlugin::audioGetSample( int ) { |
221 | debugMsg( "LibTremorPlugin::audioGetSample" ); | 220 | debugMsg( "LibTremorPlugin::audioGetSample" ); |
222 | return 0; | 221 | return 0; |
223 | } | 222 | } |
224 | 223 | ||
225 | 224 | ||
226 | bool LibTremorPlugin::audioReadSamples( short *output, int, long samples, long& samplesMade, int ) { | 225 | bool LibTremorPlugin::audioReadSamples( short *output, int, long samples, long& samplesMade, int ) { |
227 | // qDebug( "<<<<<<<<<<<<LibTremorPlugin::audioReadStereoSamples %d", samples ); | 226 | // qDebug( "<<<<<<<<<<<<LibTremorPlugin::audioReadStereoSamples %d", samples ); |
228 | 227 | ||
229 | int old_section = d->csection; | 228 | int old_section = d->csection; |
230 | 229 | ||
231 | char* buf = (char*) output; | 230 | char* buf = (char*) output; |
232 | int length = samples * 4; | 231 | int length = samples * 4; |
233 | 232 | ||
234 | if ( samples == 0 ) | 233 | if ( samples == 0 ) |
235 | return false; | 234 | return false; |
236 | 235 | ||
237 | while (length > 0) { | 236 | while (length > 0) { |
238 | if (d->bos) { | 237 | if (d->bos) { |
239 | d->vi = ov_info(&d->vf, -1); | 238 | d->vi = ov_info(&d->vf, -1); |
240 | d->vc = ov_comment(&d->vf, -1); | 239 | d->vc = ov_comment(&d->vf, -1); |
241 | } | 240 | } |
242 | 241 | ||
243 | int n = 4096; | 242 | int n = 4096; |
244 | if (length < n) { | 243 | if (length < n) { |
245 | n = length; | 244 | n = length; |
246 | } | 245 | } |
247 | 246 | ||
248 | long ret = ov_read(&d->vf, buf, n, &d->csection); | 247 | long ret = ov_read(&d->vf, buf, n, &d->csection); |
249 | // qDebug("%d", ret); | 248 | // qDebug("%d", ret); |
250 | if (ret == 0) { | 249 | if (ret == 0) { |
251 | break; | 250 | break; |
252 | } else if (ret < 0) { | 251 | } else if (ret < 0) { |
253 | return true; | 252 | return true; |
254 | } | 253 | } |
255 | 254 | ||
256 | if (old_section != d->csection) { | 255 | if (old_section != d->csection) { |
257 | d->bos = true; | 256 | d->bos = true; |
258 | } | 257 | } |
259 | 258 | ||
260 | buf += ret; | 259 | buf += ret; |
261 | length -= ret; | 260 | length -= ret; |
262 | 261 | ||
263 | } | 262 | } |
264 | 263 | ||
265 | samplesMade = samples; | 264 | samplesMade = samples; |
266 | 265 | ||
267 | return true; | 266 | return true; |
268 | } | 267 | } |
269 | 268 | ||
270 | double LibTremorPlugin::getTime() { | 269 | double LibTremorPlugin::getTime() { |
271 | debugMsg( "LibTremorPlugin::getTime" ); | 270 | debugMsg( "LibTremorPlugin::getTime" ); |
272 | return 0.0; | 271 | return 0.0; |
273 | } | 272 | } |
274 | 273 | ||
diff --git a/core/multimedia/opieplayer/vorbis/tremor/config.in b/core/multimedia/opieplayer/vorbis/tremor/config.in index 8ee753c..f803d16 100644 --- a/core/multimedia/opieplayer/vorbis/tremor/config.in +++ b/core/multimedia/opieplayer/vorbis/tremor/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config LIBTREMOR | 1 | config LIBTREMOR |
2 | boolean "libtremor (library needed to play OGG files)" | 2 | boolean "libtremor" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && OPIEPLAYER | 4 | depends ( LIBQPE || LIBQPE-X11 ) && OPIEPLAYER |
diff --git a/core/multimedia/opieplayer/vorbis/vorbis.pro b/core/multimedia/opieplayer/vorbis/vorbis.pro index a15cf9c..d566003 100644 --- a/core/multimedia/opieplayer/vorbis/vorbis.pro +++ b/core/multimedia/opieplayer/vorbis/vorbis.pro | |||
@@ -1,11 +1,11 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | HEADERS = libtremorplugin.h libtremorinimpl.h | 3 | HEADERS = libtremorplugin.h libtremorpluginimpl.h |
4 | SOURCES = libtremorplugin.cpp libtremorpluginimpl.cpp | 4 | SOURCES = libtremorplugin.cpp libtremorpluginimpl.cpp |
5 | TARGET = tremorplugin | 5 | TARGET = tremorplugin |
6 | DESTDIR = $(OPIEDIR)/plugins/codecs | 6 | DESTDIR = $(OPIEDIR)/plugins/codecs |
7 | INCLUDEPATH += $(OPIEDIR)/include .. tremor | 7 | INCLUDEPATH += $(OPIEDIR)/include .. tremor |
8 | DEPENDPATH += $(OPIEDIR)/include .. tremor | 8 | DEPENDPATH += $(OPIEDIR)/include .. tremor |
9 | LIBS += -lqpe -lm -ltremor | 9 | LIBS += -lqpe -lm -ltremor |
10 | VERSION = 1.0.0 | 10 | VERSION = 1.0.0 |
11 | include ( $(OPIEDIR)/include.pro ) | 11 | include ( $(OPIEDIR)/include.pro ) |
diff --git a/core/multimedia/opieplayer/wavplugin/config.in b/core/multimedia/opieplayer/wavplugin/config.in index 56bdfab..6e4c4b3 100644 --- a/core/multimedia/opieplayer/wavplugin/config.in +++ b/core/multimedia/opieplayer/wavplugin/config.in | |||
@@ -1,4 +1,4 @@ | |||
1 | config WAVPLUGIN | 1 | config WAVPLUGIN |
2 | boolean "opieplayer1-wavplugin (play WAV files)" | 2 | boolean "wavplugin" |
3 | default "y" | 3 | default "y" |
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && OPIEPLAYER | 4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE && OPIEPLAYER |