author | mickeyl <mickeyl> | 2004-04-04 17:38:26 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-04-04 17:38:26 (UTC) |
commit | 4588425855268ce88a80ddbac7e1c3d4b87b03f4 (patch) (unidiff) | |
tree | cc2ba17458cd68592093e6c1bb216df3582cb6f5 | |
parent | ea3708cbc40ebc5f1db70546f0a93e8a23ba967c (diff) | |
download | opie-4588425855268ce88a80ddbac7e1c3d4b87b03f4.zip opie-4588425855268ce88a80ddbac7e1c3d4b87b03f4.tar.gz opie-4588425855268ce88a80ddbac7e1c3d4b87b03f4.tar.bz2 |
use odebug classes
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 5 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/lib.cpp | 16 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 16 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/om3u.cpp | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistselection.cpp | 9 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 19 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 12 |
7 files changed, 51 insertions, 30 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 36def67..95a0f45 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -1,135 +1,138 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | 4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> |
5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | 5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> |
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
7 | =. | 7 | =. |
8 | .=l. | 8 | .=l. |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This program is distributed in the hope that | 17 | .i_,=:_. -<s. This program is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; Library General Public License for more | 22 | ..}^=.= = ; Library General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = Library General Public License along with | 26 | -_. . . )=. = Library General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | 34 | ||
35 | #include "audiowidget.h" | 35 | #include "audiowidget.h" |
36 | 36 | ||
37 | /* OPIE */ | ||
38 | #include <opie2/odebug.h> | ||
37 | #include <qpe/qpeapplication.h> | 39 | #include <qpe/qpeapplication.h> |
38 | 40 | using namespace Opie::Core; | |
39 | using namespace Opie::Ui; | 41 | using namespace Opie::Ui; |
42 | |||
40 | namespace | 43 | namespace |
41 | { | 44 | { |
42 | 45 | ||
43 | const int xo = -2; // movable x offset | 46 | const int xo = -2; // movable x offset |
44 | const int yo = 22; // movable y offset | 47 | const int yo = 22; // movable y offset |
45 | 48 | ||
46 | const MediaWidget::SkinButtonInfo skinInfo[] = | 49 | const MediaWidget::SkinButtonInfo skinInfo[] = |
47 | { | 50 | { |
48 | { MediaWidget::Play, "play", MediaWidget::ToggleButton }, | 51 | { MediaWidget::Play, "play", MediaWidget::ToggleButton }, |
49 | { MediaWidget::Stop, "stop", MediaWidget::NormalButton }, | 52 | { MediaWidget::Stop, "stop", MediaWidget::NormalButton }, |
50 | { MediaWidget::Next, "next", MediaWidget::NormalButton }, | 53 | { MediaWidget::Next, "next", MediaWidget::NormalButton }, |
51 | { MediaWidget::Previous, "prev", MediaWidget::NormalButton }, | 54 | { MediaWidget::Previous, "prev", MediaWidget::NormalButton }, |
52 | { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton }, | 55 | { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton }, |
53 | { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton }, | 56 | { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton }, |
54 | { MediaWidget::Loop, "loop", MediaWidget::ToggleButton }, | 57 | { MediaWidget::Loop, "loop", MediaWidget::ToggleButton }, |
55 | { MediaWidget::PlayList, "playlist", MediaWidget::NormalButton }, | 58 | { MediaWidget::PlayList, "playlist", MediaWidget::NormalButton }, |
56 | { MediaWidget::Forward, "forward", MediaWidget::NormalButton }, | 59 | { MediaWidget::Forward, "forward", MediaWidget::NormalButton }, |
57 | { MediaWidget::Back, "back", MediaWidget::NormalButton } | 60 | { MediaWidget::Back, "back", MediaWidget::NormalButton } |
58 | }; | 61 | }; |
59 | 62 | ||
60 | const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] ); | 63 | const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] ); |
61 | 64 | ||
62 | void changeTextColor( QWidget * w) { | 65 | void changeTextColor( QWidget * w) { |
63 | QPalette p = w->palette(); | 66 | QPalette p = w->palette(); |
64 | p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); | 67 | p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); |
65 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); | 68 | p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); |
66 | w->setPalette( p ); | 69 | w->setPalette( p ); |
67 | } | 70 | } |
68 | 71 | ||
69 | } | 72 | } |
70 | 73 | ||
71 | AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : | 74 | AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : |
72 | 75 | ||
73 | MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ), | 76 | MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ), |
74 | audioSliderBeingMoved( false ) | 77 | audioSliderBeingMoved( false ) |
75 | { | 78 | { |
76 | setCaption( tr("OpiePlayer") ); | 79 | setCaption( tr("OpiePlayer") ); |
77 | 80 | ||
78 | loadSkin(); | 81 | loadSkin(); |
79 | 82 | ||
80 | connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); | 83 | connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); |
81 | connect( &mediaPlayerState, SIGNAL( isSeekableToggled(bool) ), this, SLOT( setSeekable(bool) ) ); | 84 | connect( &mediaPlayerState, SIGNAL( isSeekableToggled(bool) ), this, SLOT( setSeekable(bool) ) ); |
82 | 85 | ||
83 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); | 86 | connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); |
84 | connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); | 87 | connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); |
85 | connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); | 88 | connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); |
86 | connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); | 89 | connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); |
87 | 90 | ||
88 | // Intialise state | 91 | // Intialise state |
89 | setLength( mediaPlayerState.length() ); | 92 | setLength( mediaPlayerState.length() ); |
90 | setPosition( mediaPlayerState.position() ); | 93 | setPosition( mediaPlayerState.position() ); |
91 | setLooping( mediaPlayerState.isFullscreen() ); | 94 | setLooping( mediaPlayerState.isFullscreen() ); |
92 | // setPaused( mediaPlayerState->paused() ); | 95 | // setPaused( mediaPlayerState->paused() ); |
93 | setPlaying( mediaPlayerState.isPlaying() ); | 96 | setPlaying( mediaPlayerState.isPlaying() ); |
94 | } | 97 | } |
95 | 98 | ||
96 | AudioWidget::~AudioWidget() { | 99 | AudioWidget::~AudioWidget() { |
97 | 100 | ||
98 | // mediaPlayerState->setPlaying(false); | 101 | // mediaPlayerState->setPlaying(false); |
99 | } | 102 | } |
100 | 103 | ||
101 | MediaWidget::GUIInfo AudioWidget::guiInfo() | 104 | MediaWidget::GUIInfo AudioWidget::guiInfo() |
102 | { | 105 | { |
103 | return GUIInfo( QString::null /* infix */, ::skinInfo, ::buttonCount ); | 106 | return GUIInfo( QString::null /* infix */, ::skinInfo, ::buttonCount ); |
104 | } | 107 | } |
105 | 108 | ||
106 | void AudioWidget::resizeEvent( QResizeEvent *e ) { | 109 | void AudioWidget::resizeEvent( QResizeEvent *e ) { |
107 | int h = height(); | 110 | int h = height(); |
108 | int w = width(); | 111 | int w = width(); |
109 | 112 | ||
110 | songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) ); | 113 | songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) ); |
111 | slider.setFixedWidth( w - 110 ); | 114 | slider.setFixedWidth( w - 110 ); |
112 | slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); | 115 | slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); |
113 | slider.setBackgroundOrigin( QWidget::ParentOrigin ); | 116 | slider.setBackgroundOrigin( QWidget::ParentOrigin ); |
114 | time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); | 117 | time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); |
115 | 118 | ||
116 | upperLeftOfButtonMask.rx() = ( w - buttonUpImage.width() ) / 2; | 119 | upperLeftOfButtonMask.rx() = ( w - buttonUpImage.width() ) / 2; |
117 | upperLeftOfButtonMask.ry() = (( h - buttonUpImage.height() ) / 2) - 10; | 120 | upperLeftOfButtonMask.ry() = (( h - buttonUpImage.height() ) / 2) - 10; |
118 | 121 | ||
119 | MediaWidget::resizeEvent( e ); | 122 | MediaWidget::resizeEvent( e ); |
120 | } | 123 | } |
121 | 124 | ||
122 | void AudioWidget::sliderPressed() { | 125 | void AudioWidget::sliderPressed() { |
123 | audioSliderBeingMoved = TRUE; | 126 | audioSliderBeingMoved = TRUE; |
124 | } | 127 | } |
125 | 128 | ||
126 | 129 | ||
127 | void AudioWidget::sliderReleased() { | 130 | void AudioWidget::sliderReleased() { |
128 | audioSliderBeingMoved = FALSE; | 131 | audioSliderBeingMoved = FALSE; |
129 | if ( slider.width() == 0 ) | 132 | if ( slider.width() == 0 ) |
130 | return; | 133 | return; |
131 | long val = long((double)slider.value() * mediaPlayerState.length() / slider.width()); | 134 | long val = long((double)slider.value() * mediaPlayerState.length() / slider.width()); |
132 | mediaPlayerState.setPosition( val ); | 135 | mediaPlayerState.setPosition( val ); |
133 | } | 136 | } |
134 | 137 | ||
135 | void AudioWidget::setPosition( long i ) { | 138 | void AudioWidget::setPosition( long i ) { |
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp index 5c24dbe..1ab5c96 100644 --- a/noncore/multimedia/opieplayer2/lib.cpp +++ b/noncore/multimedia/opieplayer2/lib.cpp | |||
@@ -1,143 +1,145 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | 4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> |
5 | Copyright (c) 2002 LJP <> | 5 | Copyright (c) 2002 LJP <> |
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
7 | =. | 7 | =. |
8 | .=l. | 8 | .=l. |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This program is distributed in the hope that | 17 | .i_,=:_. -<s. This program is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; Library General Public License for more | 22 | ..}^=.= = ; Library General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = Library General Public License along with | 26 | -_. . . )=. = Library General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include "xinevideowidget.h" | ||
35 | #include "frame.h" | ||
36 | #include "lib.h" | ||
34 | 37 | ||
35 | #include <qtextstream.h> | 38 | /* OPIE */ |
39 | #include <opie2/odebug.h> | ||
40 | using namespace Opie::Core; | ||
36 | 41 | ||
42 | /* QT */ | ||
43 | #include <qtextstream.h> | ||
37 | #include <qdir.h> | 44 | #include <qdir.h> |
38 | |||
39 | #include <qgfx_qws.h> | 45 | #include <qgfx_qws.h> |
40 | 46 | ||
47 | /* STD */ | ||
41 | #include <assert.h> | 48 | #include <assert.h> |
42 | 49 | ||
43 | #include "xinevideowidget.h" | ||
44 | #include "frame.h" | ||
45 | #include "lib.h" | ||
46 | |||
47 | |||
48 | typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, | 50 | typedef void (*display_xine_frame_t) (void *user_data, uint8_t* frame, |
49 | int width, int height,int bytes ); | 51 | int width, int height,int bytes ); |
50 | 52 | ||
51 | extern "C" { | 53 | extern "C" { |
52 | xine_vo_driver_t* init_video_out_plugin( xine_t *xine, void* video, display_xine_frame_t, void * ); | 54 | xine_vo_driver_t* init_video_out_plugin( xine_t *xine, void* video, display_xine_frame_t, void * ); |
53 | int null_is_showing_video( const xine_vo_driver_t* self ); | 55 | int null_is_showing_video( const xine_vo_driver_t* self ); |
54 | void null_set_show_video( const xine_vo_driver_t* self, int show ); | 56 | void null_set_show_video( const xine_vo_driver_t* self, int show ); |
55 | int null_is_fullscreen( const xine_vo_driver_t* self ); | 57 | int null_is_fullscreen( const xine_vo_driver_t* self ); |
56 | void null_set_fullscreen( const xine_vo_driver_t* self, int screen ); | 58 | void null_set_fullscreen( const xine_vo_driver_t* self, int screen ); |
57 | int null_is_scaling( const xine_vo_driver_t* self ); | 59 | int null_is_scaling( const xine_vo_driver_t* self ); |
58 | void null_set_scaling( const xine_vo_driver_t* self, int scale ); | 60 | void null_set_scaling( const xine_vo_driver_t* self, int scale ); |
59 | void null_set_gui_width( const xine_vo_driver_t* self, int width ); | 61 | void null_set_gui_width( const xine_vo_driver_t* self, int width ); |
60 | void null_set_gui_height( const xine_vo_driver_t* self, int height ); | 62 | void null_set_gui_height( const xine_vo_driver_t* self, int height ); |
61 | void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb ); | 63 | void null_set_mode( const xine_vo_driver_t* self, int depth, int rgb ); |
62 | void null_set_videoGamma( const xine_vo_driver_t* self , int value ); | 64 | void null_set_videoGamma( const xine_vo_driver_t* self , int value ); |
63 | void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data ); | 65 | void null_display_handler( const xine_vo_driver_t* self, display_xine_frame_t t, void* user_data ); |
64 | 66 | ||
65 | void null_preload_decoders( xine_stream_t *stream ); | 67 | void null_preload_decoders( xine_stream_t *stream ); |
66 | } | 68 | } |
67 | 69 | ||
68 | using namespace XINE; | 70 | using namespace XINE; |
69 | 71 | ||
70 | Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) | 72 | Lib::Lib( InitializationMode initMode, XineVideoWidget* widget ) |
71 | { | 73 | { |
72 | m_initialized = false; | 74 | m_initialized = false; |
73 | m_duringInitialization = false; | 75 | m_duringInitialization = false; |
74 | m_video = false; | 76 | m_video = false; |
75 | m_wid = widget; | 77 | m_wid = widget; |
76 | printf("Lib"); | 78 | printf("Lib"); |
77 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; | 79 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; |
78 | // get the configuration | 80 | // get the configuration |
79 | 81 | ||
80 | // not really OO, should be an extra class, later | 82 | // not really OO, should be an extra class, later |
81 | if ( !QFile::exists(configPath) ) { | 83 | if ( !QFile::exists(configPath) ) { |
82 | QFile f(configPath); | 84 | QFile f(configPath); |
83 | f.open(IO_WriteOnly); | 85 | f.open(IO_WriteOnly); |
84 | QTextStream ts( &f ); | 86 | QTextStream ts( &f ); |
85 | ts << "misc.memcpy_method:glibc\n"; | 87 | ts << "misc.memcpy_method:glibc\n"; |
86 | ts << "# uncomment if you experience double speed audio \n #audio.oss_sync_method:softsync\n"; | 88 | ts << "# uncomment if you experience double speed audio \n #audio.oss_sync_method:softsync\n"; |
87 | ts << "codec.ffmpeg_pp_quality:3\n"; | 89 | ts << "codec.ffmpeg_pp_quality:3\n"; |
88 | ts << "audio.num_buffers:50\n"; | 90 | ts << "audio.num_buffers:50\n"; |
89 | ts << "audio.size_buffers:4096\n"; | 91 | ts << "audio.size_buffers:4096\n"; |
90 | ts << "video.num_buffers:20\n"; | 92 | ts << "video.num_buffers:20\n"; |
91 | ts << "video.size_buffers:4096\n"; | 93 | ts << "video.size_buffers:4096\n"; |
92 | ts << "audio.out_num_audio_buf:16\n"; | 94 | ts << "audio.out_num_audio_buf:16\n"; |
93 | ts << "audio.out_size_audio_buf:8096\n"; | 95 | ts << "audio.out_size_audio_buf:8096\n"; |
94 | ts << "audio.out_size_zero_buf:1024\n"; | 96 | ts << "audio.out_size_zero_buf:1024\n"; |
95 | ts << "audio.passthrough_offset:0\n"; | 97 | ts << "audio.passthrough_offset:0\n"; |
96 | f.close(); | 98 | f.close(); |
97 | } | 99 | } |
98 | 100 | ||
99 | if ( initMode == InitializeImmediately ) { | 101 | if ( initMode == InitializeImmediately ) { |
100 | initialize(); | 102 | initialize(); |
101 | m_initialized = true; | 103 | m_initialized = true; |
102 | } | 104 | } |
103 | else | 105 | else |
104 | start(); | 106 | start(); |
105 | } | 107 | } |
106 | 108 | ||
107 | void Lib::run() | 109 | void Lib::run() |
108 | { | 110 | { |
109 | odebug << "Lib::run() started" << oendl; | 111 | odebug << "Lib::run() started" << oendl; |
110 | initialize(); | 112 | initialize(); |
111 | m_initialized = true; | 113 | m_initialized = true; |
112 | odebug << "Lib::run() finished" << oendl; | 114 | odebug << "Lib::run() finished" << oendl; |
113 | } | 115 | } |
114 | 116 | ||
115 | void Lib::initialize() | 117 | void Lib::initialize() |
116 | { | 118 | { |
117 | m_duringInitialization = true; | 119 | m_duringInitialization = true; |
118 | m_xine = xine_new( ); | 120 | m_xine = xine_new( ); |
119 | 121 | ||
120 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; | 122 | QString configPath = QDir::homeDirPath() + "/Settings/opiexine.cf"; |
121 | xine_config_load( m_xine, QFile::encodeName( configPath ) ); | 123 | xine_config_load( m_xine, QFile::encodeName( configPath ) ); |
122 | 124 | ||
123 | xine_init( m_xine ); | 125 | xine_init( m_xine ); |
124 | 126 | ||
125 | // allocate oss for sound | 127 | // allocate oss for sound |
126 | // and fb for framebuffer | 128 | // and fb for framebuffer |
127 | m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); | 129 | m_audioOutput = xine_open_audio_driver( m_xine, "oss", NULL ); |
128 | m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this ); | 130 | m_videoOutput = ::init_video_out_plugin( m_xine, NULL, xine_display_frame, this ); |
129 | 131 | ||
130 | 132 | ||
131 | //xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL); | 133 | //xine_open_video_driver( m_xine, NULL, XINE_VISUAL_TYPE_FB, NULL); |
132 | 134 | ||
133 | 135 | ||
134 | // null_display_handler( m_videoOutput, xine_display_frame, this ); | 136 | // null_display_handler( m_videoOutput, xine_display_frame, this ); |
135 | 137 | ||
136 | m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); | 138 | m_stream = xine_stream_new (m_xine, m_audioOutput, m_videoOutput ); |
137 | 139 | ||
138 | if (m_wid != 0 ) { | 140 | if (m_wid != 0 ) { |
139 | printf( "!0\n" ); | 141 | printf( "!0\n" ); |
140 | setWidget( m_wid ); | 142 | setWidget( m_wid ); |
141 | } | 143 | } |
142 | 144 | ||
143 | m_queue = xine_event_new_queue (m_stream); | 145 | m_queue = xine_event_new_queue (m_stream); |
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 7e38fc7..7b4bfd9 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -1,113 +1,115 @@ | |||
1 | #include <qpe/qpeapplication.h> | ||
2 | #include <qpe/config.h> | ||
3 | #include <qfileinfo.h> | ||
4 | |||
5 | #include "mediaplayer.h" | 1 | #include "mediaplayer.h" |
6 | #include "audiowidget.h" | 2 | #include "audiowidget.h" |
7 | #include "videowidget.h" | 3 | #include "videowidget.h" |
8 | #include "volumecontrol.h" | 4 | #include "volumecontrol.h" |
9 | 5 | ||
6 | /* OPIE */ | ||
7 | #include <opie2/odebug.h> | ||
8 | #include <qpe/qpeapplication.h> | ||
9 | #include <qpe/config.h> | ||
10 | |||
11 | /* QT */ | ||
12 | #include <qfileinfo.h> | ||
10 | 13 | ||
11 | // for setBacklight() | 14 | /* STD */ |
12 | #include <linux/fb.h> | 15 | #include <linux/fb.h> |
13 | #include <sys/file.h> | 16 | #include <sys/file.h> |
14 | #include <sys/ioctl.h> | 17 | #include <sys/ioctl.h> |
15 | 18 | ||
16 | 19 | #define FBIOBLANK 0x4611 | |
17 | #define FBIOBLANK 0x4611 | ||
18 | 20 | ||
19 | MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) | 21 | MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) |
20 | : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) { | 22 | : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) { |
21 | 23 | ||
22 | m_audioUI = 0; | 24 | m_audioUI = 0; |
23 | m_videoUI = 0; | 25 | m_videoUI = 0; |
24 | m_xineControl = 0; | 26 | m_xineControl = 0; |
25 | xine = new XINE::Lib( XINE::Lib::InitializeInThread ); | 27 | xine = new XINE::Lib( XINE::Lib::InitializeInThread ); |
26 | 28 | ||
27 | fd=-1;fl=-1; | 29 | fd=-1;fl=-1; |
28 | playList.setCaption( tr( "OpiePlayer: Initializating" ) ); | 30 | playList.setCaption( tr( "OpiePlayer: Initializating" ) ); |
29 | 31 | ||
30 | qApp->processEvents(); | 32 | qApp->processEvents(); |
31 | // QPEApplication::grabKeyboard(); // EVIL | 33 | // QPEApplication::grabKeyboard(); // EVIL |
32 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 34 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
33 | 35 | ||
34 | connect( &mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); | 36 | connect( &mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) ); |
35 | 37 | ||
36 | // What is pauseCheck good for? (Simon) | 38 | // What is pauseCheck good for? (Simon) |
37 | // connect( &mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pauseCheck(bool) ) ); | 39 | // connect( &mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pauseCheck(bool) ) ); |
38 | 40 | ||
39 | connect( &mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); | 41 | connect( &mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); |
40 | connect( &mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); | 42 | connect( &mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); |
41 | connect( &mediaPlayerState, SIGNAL( blankToggled(bool) ), this, SLOT ( blank(bool) ) ); | 43 | connect( &mediaPlayerState, SIGNAL( blankToggled(bool) ), this, SLOT ( blank(bool) ) ); |
42 | 44 | ||
43 | volControl = new VolumeControl; | 45 | volControl = new VolumeControl; |
44 | Config cfg( "OpiePlayer" ); | 46 | Config cfg( "OpiePlayer" ); |
45 | cfg.setGroup("PlayList"); | 47 | cfg.setGroup("PlayList"); |
46 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); | 48 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); |
47 | playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); | 49 | playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); |
48 | 50 | ||
49 | m_skinLoader = new SkinLoader; | 51 | m_skinLoader = new SkinLoader; |
50 | m_skinLoader->schedule( AudioWidget::guiInfo() ); | 52 | m_skinLoader->schedule( AudioWidget::guiInfo() ); |
51 | m_skinLoader->schedule( VideoWidget::guiInfo() ); | 53 | m_skinLoader->schedule( VideoWidget::guiInfo() ); |
52 | m_skinLoader->start(); | 54 | m_skinLoader->start(); |
53 | } | 55 | } |
54 | 56 | ||
55 | MediaPlayer::~MediaPlayer() { | 57 | MediaPlayer::~MediaPlayer() { |
56 | // this shold never happen, but one never knows... | 58 | // this shold never happen, but one never knows... |
57 | if ( xine ) { | 59 | if ( xine ) { |
58 | xine->ensureInitialized(); | 60 | xine->ensureInitialized(); |
59 | delete xine; | 61 | delete xine; |
60 | } | 62 | } |
61 | delete m_xineControl; | 63 | delete m_xineControl; |
62 | delete m_audioUI; | 64 | delete m_audioUI; |
63 | delete m_videoUI; | 65 | delete m_videoUI; |
64 | delete volControl; | 66 | delete volControl; |
65 | } | 67 | } |
66 | 68 | ||
67 | void MediaPlayer::pauseCheck( bool b ) { | 69 | void MediaPlayer::pauseCheck( bool b ) { |
68 | if ( b && !mediaPlayerState.isPlaying() ) { | 70 | if ( b && !mediaPlayerState.isPlaying() ) { |
69 | mediaPlayerState.setPaused( FALSE ); | 71 | mediaPlayerState.setPaused( FALSE ); |
70 | } | 72 | } |
71 | } | 73 | } |
72 | 74 | ||
73 | void MediaPlayer::play() { | 75 | void MediaPlayer::play() { |
74 | mediaPlayerState.setPlaying( FALSE ); | 76 | mediaPlayerState.setPlaying( FALSE ); |
75 | mediaPlayerState.setPlaying( TRUE ); | 77 | mediaPlayerState.setPlaying( TRUE ); |
76 | } | 78 | } |
77 | 79 | ||
78 | void MediaPlayer::setPlaying( bool play ) { | 80 | void MediaPlayer::setPlaying( bool play ) { |
79 | if ( !play ) { | 81 | if ( !play ) { |
80 | return; | 82 | return; |
81 | } | 83 | } |
82 | 84 | ||
83 | if ( mediaPlayerState.isPaused() ) { | 85 | if ( mediaPlayerState.isPaused() ) { |
84 | mediaPlayerState.setPaused( FALSE ); | 86 | mediaPlayerState.setPaused( FALSE ); |
85 | return; | 87 | return; |
86 | } | 88 | } |
87 | 89 | ||
88 | QString tickerText, time, fileName; | 90 | QString tickerText, time, fileName; |
89 | if ( playList.currentTab() != PlayListWidget::CurrentPlayList ) { | 91 | if ( playList.currentTab() != PlayListWidget::CurrentPlayList ) { |
90 | //if playing in file list.. play in a different way | 92 | //if playing in file list.. play in a different way |
91 | // random and looping settings enabled causes problems here, | 93 | // random and looping settings enabled causes problems here, |
92 | // since there is no selected file in the playlist, but a selected file in the file list, | 94 | // since there is no selected file in the playlist, but a selected file in the file list, |
93 | // so we remember and shutoff | 95 | // so we remember and shutoff |
94 | l = mediaPlayerState.isLooping(); | 96 | l = mediaPlayerState.isLooping(); |
95 | if(l) { | 97 | if(l) { |
96 | mediaPlayerState.setLooping( false ); | 98 | mediaPlayerState.setLooping( false ); |
97 | } | 99 | } |
98 | r = mediaPlayerState.isShuffled(); | 100 | r = mediaPlayerState.isShuffled(); |
99 | mediaPlayerState.setShuffled( false ); | 101 | mediaPlayerState.setShuffled( false ); |
100 | } | 102 | } |
101 | 103 | ||
102 | PlayListWidget::Entry playListEntry = playList.currentEntry(); | 104 | PlayListWidget::Entry playListEntry = playList.currentEntry(); |
103 | fileName = playListEntry.name; | 105 | fileName = playListEntry.name; |
104 | xineControl()->play( playListEntry.file ); | 106 | xineControl()->play( playListEntry.file ); |
105 | 107 | ||
106 | long seconds = mediaPlayerState.length(); | 108 | long seconds = mediaPlayerState.length(); |
107 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); | 109 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); |
108 | 110 | ||
109 | if( fileName.left(4) == "http" ) { | 111 | if( fileName.left(4) == "http" ) { |
110 | fileName = QFileInfo( fileName ).baseName(); | 112 | fileName = QFileInfo( fileName ).baseName(); |
111 | if ( xineControl()->getMetaInfo().isEmpty() ) { | 113 | if ( xineControl()->getMetaInfo().isEmpty() ) { |
112 | tickerText = tr( " File: " ) + fileName; | 114 | tickerText = tr( " File: " ) + fileName; |
113 | } else { | 115 | } else { |
diff --git a/noncore/multimedia/opieplayer2/om3u.cpp b/noncore/multimedia/opieplayer2/om3u.cpp index 95dbab5..790fa09 100644 --- a/noncore/multimedia/opieplayer2/om3u.cpp +++ b/noncore/multimedia/opieplayer2/om3u.cpp | |||
@@ -1,130 +1,132 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | 4 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> |
5 | =. | 5 | =. |
6 | .=l. | 6 | .=l. |
7 | .>+-= | 7 | .>+-= |
8 | _;:, .> :=|. This program is free software; you can | 8 | _;:, .> :=|. This program is free software; you can |
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 10 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; General Public License for more | 20 | ..}^=.= = ; General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = General Public License along with | 24 | -_. . . )=. = General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | 29 | ||
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include "om3u.h" | 32 | #include "om3u.h" |
33 | 33 | ||
34 | 34 | /* OPIE */ | |
35 | #include <opie2/odebug.h> | ||
36 | using namespace Opie::Core; | ||
35 | 37 | ||
36 | //extern PlayListWidget *playList; | 38 | //extern PlayListWidget *playList; |
37 | 39 | ||
38 | Om3u::Om3u( const QString &filePath, int mode) | 40 | Om3u::Om3u( const QString &filePath, int mode) |
39 | : QStringList (){ | 41 | : QStringList (){ |
40 | odebug << "<<<<<<<new m3u "+filePath << oendl; | 42 | odebug << "<<<<<<<new m3u "+filePath << oendl; |
41 | f.setName(filePath); | 43 | f.setName(filePath); |
42 | f.open(mode); | 44 | f.open(mode); |
43 | } | 45 | } |
44 | 46 | ||
45 | Om3u::~Om3u(){} | 47 | Om3u::~Om3u(){} |
46 | 48 | ||
47 | void Om3u::readM3u() { | 49 | void Om3u::readM3u() { |
48 | // odebug << "<<<<<<reading m3u "+f.name() << oendl; | 50 | // odebug << "<<<<<<reading m3u "+f.name() << oendl; |
49 | QTextStream t(&f); | 51 | QTextStream t(&f); |
50 | t.setEncoding(QTextStream::UnicodeUTF8); | 52 | t.setEncoding(QTextStream::UnicodeUTF8); |
51 | QString s; | 53 | QString s; |
52 | while ( !t.atEnd() ) { | 54 | while ( !t.atEnd() ) { |
53 | s=t.readLine(); | 55 | s=t.readLine(); |
54 | // odebug << s << oendl; | 56 | // odebug << s << oendl; |
55 | if( s.find( "#", 0, TRUE) == -1 ) { | 57 | if( s.find( "#", 0, TRUE) == -1 ) { |
56 | if( s.left(2) == "E:" || s.left(2) == "P:" ) { | 58 | if( s.left(2) == "E:" || s.left(2) == "P:" ) { |
57 | s = s.right( s.length() -2 ); | 59 | s = s.right( s.length() -2 ); |
58 | QFileInfo f( s ); | 60 | QFileInfo f( s ); |
59 | QString name = f.baseName(); | 61 | QString name = f.baseName(); |
60 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); | 62 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); |
61 | s=s.replace( QRegExp( "\\" ), "/" ); | 63 | s=s.replace( QRegExp( "\\" ), "/" ); |
62 | append(s); | 64 | append(s); |
63 | // odebug << s << oendl; | 65 | // odebug << s << oendl; |
64 | } else { // is url | 66 | } else { // is url |
65 | QString name; | 67 | QString name; |
66 | name = s; | 68 | name = s; |
67 | append(name); | 69 | append(name); |
68 | } | 70 | } |
69 | } | 71 | } |
70 | } | 72 | } |
71 | } | 73 | } |
72 | 74 | ||
73 | void Om3u::readPls() { //it's a pls file | 75 | void Om3u::readPls() { //it's a pls file |
74 | QTextStream t( &f ); | 76 | QTextStream t( &f ); |
75 | t.setEncoding(QTextStream::UnicodeUTF8); | 77 | t.setEncoding(QTextStream::UnicodeUTF8); |
76 | QString s; | 78 | QString s; |
77 | while ( !t.atEnd() ) { | 79 | while ( !t.atEnd() ) { |
78 | s = t.readLine(); | 80 | s = t.readLine(); |
79 | if( s.left(4) == "File" ) { | 81 | if( s.left(4) == "File" ) { |
80 | s = s.right( s.length() - s.find("=",0,true)-1 ); | 82 | s = s.right( s.length() - s.find("=",0,true)-1 ); |
81 | s = s.stripWhiteSpace(); | 83 | s = s.stripWhiteSpace(); |
82 | s.replace( QRegExp( "%20" )," "); | 84 | s.replace( QRegExp( "%20" )," "); |
83 | // odebug << "adding " + s + " to playlist" << oendl; | 85 | // odebug << "adding " + s + " to playlist" << oendl; |
84 | // numberofentries=2 | 86 | // numberofentries=2 |
85 | // File1=http | 87 | // File1=http |
86 | // Title | 88 | // Title |
87 | // Length | 89 | // Length |
88 | // Version | 90 | // Version |
89 | // File2=http | 91 | // File2=http |
90 | s = s.replace( QRegExp( "\\" ), "/" ); | 92 | s = s.replace( QRegExp( "\\" ), "/" ); |
91 | QFileInfo f( s ); | 93 | QFileInfo f( s ); |
92 | QString name = f.baseName(); | 94 | QString name = f.baseName(); |
93 | if( name.left( 4 ) == "http" ) { | 95 | if( name.left( 4 ) == "http" ) { |
94 | name = s.right( s.length() - 7); | 96 | name = s.right( s.length() - 7); |
95 | } else { | 97 | } else { |
96 | name = s; | 98 | name = s; |
97 | } | 99 | } |
98 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); | 100 | name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 ); |
99 | if( s.at( s.length() - 4) == '.') // if this is probably a file | 101 | if( s.at( s.length() - 4) == '.') // if this is probably a file |
100 | append(s); | 102 | append(s); |
101 | else { //if its a url | 103 | else { //if its a url |
102 | // if( name.right( 1 ).find( '/' ) == -1) { | 104 | // if( name.right( 1 ).find( '/' ) == -1) { |
103 | // s += "/"; | 105 | // s += "/"; |
104 | // } | 106 | // } |
105 | append(s); | 107 | append(s); |
106 | } | 108 | } |
107 | } | 109 | } |
108 | } | 110 | } |
109 | } | 111 | } |
110 | 112 | ||
111 | void Om3u::write() { //writes list to m3u file | 113 | void Om3u::write() { //writes list to m3u file |
112 | QString list; | 114 | QString list; |
113 | QTextStream t(&f); | 115 | QTextStream t(&f); |
114 | t.setEncoding(QTextStream::UnicodeUTF8); | 116 | t.setEncoding(QTextStream::UnicodeUTF8); |
115 | if(count()>0) { | 117 | if(count()>0) { |
116 | for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { | 118 | for ( QStringList::ConstIterator it = begin(); it != end(); ++it ) { |
117 | // odebug << *it << oendl; | 119 | // odebug << *it << oendl; |
118 | t << *it << "\n"; | 120 | t << *it << "\n"; |
119 | } | 121 | } |
120 | } | 122 | } |
121 | // f.close(); | 123 | // f.close(); |
122 | } | 124 | } |
123 | 125 | ||
124 | void Om3u::add(const QString &filePath) { //adds to m3u file | 126 | void Om3u::add(const QString &filePath) { //adds to m3u file |
125 | append(filePath); | 127 | append(filePath); |
126 | } | 128 | } |
127 | 129 | ||
128 | void Om3u::remove(const QString &filePath) { //removes from m3u list | 130 | void Om3u::remove(const QString &filePath) { //removes from m3u list |
129 | QString list, currentFile; | 131 | QString list, currentFile; |
130 | if(count()>0) { | 132 | if(count()>0) { |
diff --git a/noncore/multimedia/opieplayer2/playlistselection.cpp b/noncore/multimedia/opieplayer2/playlistselection.cpp index 3499837..678ebdf 100644 --- a/noncore/multimedia/opieplayer2/playlistselection.cpp +++ b/noncore/multimedia/opieplayer2/playlistselection.cpp | |||
@@ -1,120 +1,125 @@ | |||
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 "playlistselection.h" | ||
20 | 21 | ||
21 | #include <qheader.h> | 22 | /* OPIE */ |
23 | #include <opie2/odebug.h> | ||
24 | using namespace Opie::Core; | ||
22 | 25 | ||
23 | #include "playlistselection.h" | 26 | /* QT */ |
27 | #include <qheader.h> | ||
24 | 28 | ||
29 | /* STD */ | ||
25 | #include <stdlib.h> | 30 | #include <stdlib.h> |
26 | 31 | ||
27 | class PlayListSelectionItem : public QListViewItem { | 32 | class PlayListSelectionItem : public QListViewItem { |
28 | public: | 33 | public: |
29 | PlayListSelectionItem( QListView *parent, const DocLnk *f ) : QListViewItem( parent ), fl( f ) { | 34 | PlayListSelectionItem( QListView *parent, const DocLnk *f ) : QListViewItem( parent ), fl( f ) { |
30 | setText( 0, f->name() ); | 35 | setText( 0, f->name() ); |
31 | setPixmap( 0, f->pixmap() ); | 36 | setPixmap( 0, f->pixmap() ); |
32 | } | 37 | } |
33 | 38 | ||
34 | ~PlayListSelectionItem() { | 39 | ~PlayListSelectionItem() { |
35 | }; | 40 | }; |
36 | 41 | ||
37 | const DocLnk *file() const { return fl; } | 42 | const DocLnk *file() const { return fl; } |
38 | 43 | ||
39 | private: | 44 | private: |
40 | const DocLnk *fl; | 45 | const DocLnk *fl; |
41 | }; | 46 | }; |
42 | 47 | ||
43 | 48 | ||
44 | PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) | 49 | PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) |
45 | : QListView( parent, name ) | 50 | : QListView( parent, name ) |
46 | { | 51 | { |
47 | // odebug << "starting playlistselector" << oendl; | 52 | // odebug << "starting playlistselector" << oendl; |
48 | // #ifdef USE_PLAYLIST_BACKGROUND | 53 | // #ifdef USE_PLAYLIST_BACKGROUND |
49 | // setStaticBackground( TRUE ); | 54 | // setStaticBackground( TRUE ); |
50 | // setBackgroundPixmap( Resource::loadPixmap( "opieplayer/background" ) ); | 55 | // setBackgroundPixmap( Resource::loadPixmap( "opieplayer/background" ) ); |
51 | 56 | ||
52 | // setBackgroundPixmap( Resource::loadPixmap( "launcher/opielogo" ) ); | 57 | // setBackgroundPixmap( Resource::loadPixmap( "launcher/opielogo" ) ); |
53 | // #endif | 58 | // #endif |
54 | // addColumn("Title",236); | 59 | // addColumn("Title",236); |
55 | // setAllColumnsShowFocus( TRUE ); | 60 | // setAllColumnsShowFocus( TRUE ); |
56 | addColumn( tr( "Playlist Selection" ) ); | 61 | addColumn( tr( "Playlist Selection" ) ); |
57 | header()->hide(); | 62 | header()->hide(); |
58 | setSorting( -1, FALSE ); | 63 | setSorting( -1, FALSE ); |
59 | } | 64 | } |
60 | 65 | ||
61 | 66 | ||
62 | PlayListSelection::~PlayListSelection() { | 67 | PlayListSelection::~PlayListSelection() { |
63 | } | 68 | } |
64 | 69 | ||
65 | 70 | ||
66 | // #ifdef USE_PLAYLIST_BACKGROUND | 71 | // #ifdef USE_PLAYLIST_BACKGROUND |
67 | void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) { | 72 | void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) { |
68 | // odebug << "drawBackground" << oendl; | 73 | // odebug << "drawBackground" << oendl; |
69 | p->fillRect( r, QBrush( white ) ); | 74 | p->fillRect( r, QBrush( white ) ); |
70 | // QImage logo = Resource::loadImage( "launcher/opielogo" ); | 75 | // QImage logo = Resource::loadImage( "launcher/opielogo" ); |
71 | // if ( !logo.isNull() ) | 76 | // if ( !logo.isNull() ) |
72 | // p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo ); | 77 | // p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo ); |
73 | } | 78 | } |
74 | // #endif | 79 | // #endif |
75 | 80 | ||
76 | 81 | ||
77 | void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { | 82 | void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { |
78 | if ( event->state() == QMouseEvent::LeftButton ) { | 83 | if ( event->state() == QMouseEvent::LeftButton ) { |
79 | QListViewItem *currentItem = selectedItem(); | 84 | QListViewItem *currentItem = selectedItem(); |
80 | QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) ); | 85 | QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) ); |
81 | if ( currentItem && currentItem->itemAbove() == itemUnder ) | 86 | if ( currentItem && currentItem->itemAbove() == itemUnder ) |
82 | moveSelectedUp(); | 87 | moveSelectedUp(); |
83 | else if ( currentItem && currentItem->itemBelow() == itemUnder ) | 88 | else if ( currentItem && currentItem->itemBelow() == itemUnder ) |
84 | moveSelectedDown(); | 89 | moveSelectedDown(); |
85 | } | 90 | } |
86 | } | 91 | } |
87 | 92 | ||
88 | 93 | ||
89 | const DocLnk *PlayListSelection::current() { | 94 | const DocLnk *PlayListSelection::current() { |
90 | PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem(); | 95 | PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem(); |
91 | if ( item ) | 96 | if ( item ) |
92 | return item->file(); | 97 | return item->file(); |
93 | return NULL; | 98 | return NULL; |
94 | } | 99 | } |
95 | 100 | ||
96 | 101 | ||
97 | void PlayListSelection::addToSelection( const DocLnk &lnk ) { | 102 | void PlayListSelection::addToSelection( const DocLnk &lnk ) { |
98 | PlayListSelectionItem *item = new PlayListSelectionItem( this, new DocLnk( lnk ) ); | 103 | PlayListSelectionItem *item = new PlayListSelectionItem( this, new DocLnk( lnk ) ); |
99 | QListViewItem *current = selectedItem(); | 104 | QListViewItem *current = selectedItem(); |
100 | if ( current ) | 105 | if ( current ) |
101 | item->moveItem( current ); | 106 | item->moveItem( current ); |
102 | setSelected( item, TRUE ); | 107 | setSelected( item, TRUE ); |
103 | ensureItemVisible( selectedItem() ); | 108 | ensureItemVisible( selectedItem() ); |
104 | } | 109 | } |
105 | 110 | ||
106 | 111 | ||
107 | void PlayListSelection::removeSelected() { | 112 | void PlayListSelection::removeSelected() { |
108 | QListViewItem *item = selectedItem(); | 113 | QListViewItem *item = selectedItem(); |
109 | delete item; | 114 | delete item; |
110 | setSelected( currentItem(), TRUE ); | 115 | setSelected( currentItem(), TRUE ); |
111 | ensureItemVisible( selectedItem() ); | 116 | ensureItemVisible( selectedItem() ); |
112 | } | 117 | } |
113 | 118 | ||
114 | 119 | ||
115 | void PlayListSelection::moveSelectedUp() { | 120 | void PlayListSelection::moveSelectedUp() { |
116 | QListViewItem *item = selectedItem(); | 121 | QListViewItem *item = selectedItem(); |
117 | if ( item && item->itemAbove() ) | 122 | if ( item && item->itemAbove() ) |
118 | item->itemAbove()->moveItem( item ); | 123 | item->itemAbove()->moveItem( item ); |
119 | ensureItemVisible( selectedItem() ); | 124 | ensureItemVisible( selectedItem() ); |
120 | } | 125 | } |
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 956d206..6a15134 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -1,146 +1,149 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002,2003 Max Reiss <harlekin@handhelds.org> | 4 | Copyright (c) 2002,2003 Max Reiss <harlekin@handhelds.org> |
5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | 5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> |
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
7 | =. | 7 | =. |
8 | .=l. | 8 | .=l. |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This program is distributed in the hope that | 17 | .i_,=:_. -<s. This program is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; General Public License for more | 22 | ..}^=.= = ; General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = General Public License along with | 26 | -_. . . )=. = General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include <qtoolbar.h> | ||
35 | |||
36 | #include <opie2/ofiledialog.h> | ||
37 | |||
38 | #include <qmessagebox.h> | ||
39 | |||
40 | #include "playlistselection.h" | 34 | #include "playlistselection.h" |
41 | #include "playlistwidget.h" | 35 | #include "playlistwidget.h" |
42 | #include "mediaplayer.h" | 36 | #include "mediaplayer.h" |
43 | #include "inputDialog.h" | 37 | #include "inputDialog.h" |
44 | #include "om3u.h" | 38 | #include "om3u.h" |
45 | #include "playlistfileview.h" | 39 | #include "playlistfileview.h" |
46 | 40 | ||
47 | //only needed for the random play | 41 | /* OPIE */ |
42 | #include <opie2/odebug.h> | ||
43 | #include <opie2/ofiledialog.h> | ||
44 | using namespace Opie::Core; | ||
45 | using namespace Opie::Ui; | ||
46 | |||
47 | /* QT */ | ||
48 | #include <qmessagebox.h> | ||
49 | #include <qtoolbar.h> | ||
50 | |||
51 | /* STD */ | ||
48 | #include <assert.h> | 52 | #include <assert.h> |
49 | 53 | ||
50 | using namespace Opie::Ui; | ||
51 | PlayListWidget::PlayListWidget(QWidget* parent, const char* name, WFlags fl ) | 54 | PlayListWidget::PlayListWidget(QWidget* parent, const char* name, WFlags fl ) |
52 | : PlayListWidgetGui( parent, "playList" ) , currentFileListView( 0 ) | 55 | : PlayListWidgetGui( parent, "playList" ) , currentFileListView( 0 ) |
53 | { | 56 | { |
54 | mediaPlayerState = new MediaPlayerState(0, "mediaPlayerState" ); | 57 | mediaPlayerState = new MediaPlayerState(0, "mediaPlayerState" ); |
55 | m_mp = new MediaPlayer(*this, *mediaPlayerState, 0, "mediaPlayer"); | 58 | m_mp = new MediaPlayer(*this, *mediaPlayerState, 0, "mediaPlayer"); |
56 | 59 | ||
57 | 60 | ||
58 | 61 | ||
59 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), | 62 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), |
60 | "opieplayer2/add_to_playlist", | 63 | "opieplayer2/add_to_playlist", |
61 | this , SLOT(addSelected() ) ); | 64 | this , SLOT(addSelected() ) ); |
62 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), | 65 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), |
63 | "opieplayer2/remove_from_playlist", | 66 | "opieplayer2/remove_from_playlist", |
64 | this , SLOT(removeSelected() ) ); | 67 | this , SLOT(removeSelected() ) ); |
65 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", | 68 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", |
66 | this , SLOT( btnPlay(bool) ), TRUE ); | 69 | this , SLOT( btnPlay(bool) ), TRUE ); |
67 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", | 70 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", |
68 | mediaPlayerState, SLOT( setShuffled(bool) ), TRUE ); | 71 | mediaPlayerState, SLOT( setShuffled(bool) ), TRUE ); |
69 | d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", | 72 | d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", |
70 | mediaPlayerState, SLOT( setLooping(bool) ), TRUE ); | 73 | mediaPlayerState, SLOT( setLooping(bool) ), TRUE ); |
71 | 74 | ||
72 | (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); | 75 | (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); |
73 | (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), | 76 | (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), |
74 | this, SLOT( addAllMusicToList() ) ); | 77 | this, SLOT( addAllMusicToList() ) ); |
75 | (void)new MenuItem( pmPlayList, tr( "Add all video files" ), | 78 | (void)new MenuItem( pmPlayList, tr( "Add all video files" ), |
76 | this, SLOT( addAllVideoToList() ) ); | 79 | this, SLOT( addAllVideoToList() ) ); |
77 | (void)new MenuItem( pmPlayList, tr( "Add all files" ), | 80 | (void)new MenuItem( pmPlayList, tr( "Add all files" ), |
78 | this, SLOT( addAllToList() ) ); | 81 | this, SLOT( addAllToList() ) ); |
79 | pmPlayList->insertSeparator(-1); | 82 | pmPlayList->insertSeparator(-1); |
80 | (void)new MenuItem( pmPlayList, tr( "Add File" ), | 83 | (void)new MenuItem( pmPlayList, tr( "Add File" ), |
81 | this,SLOT( openFile() ) ); | 84 | this,SLOT( openFile() ) ); |
82 | (void)new MenuItem( pmPlayList, tr("Add URL"), | 85 | (void)new MenuItem( pmPlayList, tr("Add URL"), |
83 | this,SLOT( openURL() ) ); | 86 | this,SLOT( openURL() ) ); |
84 | pmPlayList->insertSeparator(-1); | 87 | pmPlayList->insertSeparator(-1); |
85 | (void)new MenuItem( pmPlayList, tr( "Save Playlist" ), | 88 | (void)new MenuItem( pmPlayList, tr( "Save Playlist" ), |
86 | this, SLOT(writem3u() ) ); | 89 | this, SLOT(writem3u() ) ); |
87 | pmPlayList->insertSeparator(-1); | 90 | pmPlayList->insertSeparator(-1); |
88 | (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), | 91 | (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), |
89 | audioView, SLOT( scanFiles() ) ); | 92 | audioView, SLOT( scanFiles() ) ); |
90 | (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), | 93 | (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), |
91 | videoView, SLOT( scanFiles() ) ); | 94 | videoView, SLOT( scanFiles() ) ); |
92 | 95 | ||
93 | pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), | 96 | pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), |
94 | mediaPlayerState, SLOT( toggleFullscreen() ) ); | 97 | mediaPlayerState, SLOT( toggleFullscreen() ) ); |
95 | 98 | ||
96 | Config cfg( "OpiePlayer" ); | 99 | Config cfg( "OpiePlayer" ); |
97 | bool b= cfg.readBoolEntry("FullScreen", 0); | 100 | bool b= cfg.readBoolEntry("FullScreen", 0); |
98 | mediaPlayerState->setFullscreen( b ); | 101 | mediaPlayerState->setFullscreen( b ); |
99 | pmView->setItemChecked( -16, b ); | 102 | pmView->setItemChecked( -16, b ); |
100 | 103 | ||
101 | (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", | 104 | (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", |
102 | d->selectedFiles, SLOT(moveSelectedUp() ) ); | 105 | d->selectedFiles, SLOT(moveSelectedUp() ) ); |
103 | (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", | 106 | (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", |
104 | d->selectedFiles, SLOT(removeSelected() ) ); | 107 | d->selectedFiles, SLOT(removeSelected() ) ); |
105 | (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", | 108 | (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", |
106 | d->selectedFiles, SLOT(moveSelectedDown() ) ); | 109 | d->selectedFiles, SLOT(moveSelectedDown() ) ); |
107 | QVBox *stretch2 = new QVBox( vbox1 ); | 110 | QVBox *stretch2 = new QVBox( vbox1 ); |
108 | 111 | ||
109 | connect( tbDeletePlaylist, ( SIGNAL( released() ) ), | 112 | connect( tbDeletePlaylist, ( SIGNAL( released() ) ), |
110 | SLOT( deletePlaylist() ) ); | 113 | SLOT( deletePlaylist() ) ); |
111 | connect( pmView, SIGNAL( activated(int) ), | 114 | connect( pmView, SIGNAL( activated(int) ), |
112 | this, SLOT( pmViewActivated(int) ) ); | 115 | this, SLOT( pmViewActivated(int) ) ); |
113 | connect( skinsMenu, SIGNAL( activated(int) ) , | 116 | connect( skinsMenu, SIGNAL( activated(int) ) , |
114 | this, SLOT( skinsMenuActivated(int) ) ); | 117 | this, SLOT( skinsMenuActivated(int) ) ); |
115 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ), | 118 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ), |
116 | this,SLOT( playlistViewPressed(int,QListViewItem*,const QPoint&,int) ) ); | 119 | this,SLOT( playlistViewPressed(int,QListViewItem*,const QPoint&,int) ) ); |
117 | connect( audioView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ), | 120 | connect( audioView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ), |
118 | this,SLOT( viewPressed(int,QListViewItem*,const QPoint&,int) ) ); | 121 | this,SLOT( viewPressed(int,QListViewItem*,const QPoint&,int) ) ); |
119 | connect( audioView, SIGNAL( returnPressed(QListViewItem*) ), | 122 | connect( audioView, SIGNAL( returnPressed(QListViewItem*) ), |
120 | this,SLOT( playIt(QListViewItem*) ) ); | 123 | this,SLOT( playIt(QListViewItem*) ) ); |
121 | connect( audioView, SIGNAL( doubleClicked(QListViewItem*) ), | 124 | connect( audioView, SIGNAL( doubleClicked(QListViewItem*) ), |
122 | this, SLOT( addToSelection(QListViewItem*) ) ); | 125 | this, SLOT( addToSelection(QListViewItem*) ) ); |
123 | connect( videoView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ), | 126 | connect( videoView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ), |
124 | this,SLOT( viewPressed(int,QListViewItem*,const QPoint&,int) ) ); | 127 | this,SLOT( viewPressed(int,QListViewItem*,const QPoint&,int) ) ); |
125 | connect( videoView, SIGNAL( returnPressed(QListViewItem*) ), | 128 | connect( videoView, SIGNAL( returnPressed(QListViewItem*) ), |
126 | this,SLOT( playIt(QListViewItem*) ) ); | 129 | this,SLOT( playIt(QListViewItem*) ) ); |
127 | connect( videoView, SIGNAL( doubleClicked(QListViewItem*) ), | 130 | connect( videoView, SIGNAL( doubleClicked(QListViewItem*) ), |
128 | this, SLOT( addToSelection(QListViewItem*) ) ); | 131 | this, SLOT( addToSelection(QListViewItem*) ) ); |
129 | connect( playLists, SIGNAL( fileSelected(const DocLnk&) ), | 132 | connect( playLists, SIGNAL( fileSelected(const DocLnk&) ), |
130 | this, SLOT( loadList(const DocLnk&) ) ); | 133 | this, SLOT( loadList(const DocLnk&) ) ); |
131 | connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), | 134 | connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), |
132 | this, SLOT( tabChanged(QWidget*) ) ); | 135 | this, SLOT( tabChanged(QWidget*) ) ); |
133 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), | 136 | connect( mediaPlayerState, SIGNAL( playingToggled(bool) ), |
134 | d->tbPlay, SLOT( setOn(bool) ) ); | 137 | d->tbPlay, SLOT( setOn(bool) ) ); |
135 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), | 138 | connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ), |
136 | d->tbLoop, SLOT( setOn(bool) ) ); | 139 | d->tbLoop, SLOT( setOn(bool) ) ); |
137 | connect( mediaPlayerState, SIGNAL( shuffledToggled(bool) ), | 140 | connect( mediaPlayerState, SIGNAL( shuffledToggled(bool) ), |
138 | d->tbShuffle, SLOT( setOn(bool) ) ); | 141 | d->tbShuffle, SLOT( setOn(bool) ) ); |
139 | connect( d->selectedFiles, SIGNAL( doubleClicked(QListViewItem*) ), | 142 | connect( d->selectedFiles, SIGNAL( doubleClicked(QListViewItem*) ), |
140 | this, SLOT( playIt(QListViewItem*) ) ); | 143 | this, SLOT( playIt(QListViewItem*) ) ); |
141 | connect ( gammaSlider, SIGNAL( valueChanged(int) ), | 144 | connect ( gammaSlider, SIGNAL( valueChanged(int) ), |
142 | mediaPlayerState, SLOT( setVideoGamma(int) ) ); | 145 | mediaPlayerState, SLOT( setVideoGamma(int) ) ); |
143 | 146 | ||
144 | connect( this, SIGNAL(skinSelected() ), | 147 | connect( this, SIGNAL(skinSelected() ), |
145 | m_mp, SLOT( reloadSkins() ) ); | 148 | m_mp, SLOT( reloadSkins() ) ); |
146 | 149 | ||
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp index 94f99f8..9f944d7 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.cpp +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp | |||
@@ -1,137 +1,141 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | 4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> |
5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | 5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> |
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
7 | =. | 7 | =. |
8 | .=l. | 8 | .=l. |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This program is distributed in the hope that | 17 | .i_,=:_. -<s. This program is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; General Public License for more | 22 | ..}^=.= = ; General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = General Public License along with | 26 | -_. . . )=. = General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | #include "xinecontrol.h" | ||
35 | #include "xinevideowidget.h" | ||
34 | 36 | ||
35 | #include <qtimer.h> | 37 | /* OPIE */ |
36 | #include <qmessagebox.h> | 38 | #include <opie2/odebug.h> |
37 | #include <qpe/qcopenvelope_qws.h> | 39 | #include <qpe/qcopenvelope_qws.h> |
38 | #include <qpe/qpeapplication.h> | 40 | #include <qpe/qpeapplication.h> |
41 | using namespace Opie::Core; | ||
39 | 42 | ||
40 | #include "xinecontrol.h" | 43 | /* QT */ |
41 | #include "xinevideowidget.h" | 44 | #include <qtimer.h> |
45 | #include <qmessagebox.h> | ||
42 | 46 | ||
43 | XineControl::XineControl( XineVideoWidget *xineWidget, | 47 | XineControl::XineControl( XineVideoWidget *xineWidget, |
44 | MediaPlayerState &_mediaPlayerState, | 48 | MediaPlayerState &_mediaPlayerState, |
45 | QObject *parent, const char *name ) | 49 | QObject *parent, const char *name ) |
46 | : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) | 50 | : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) |
47 | { | 51 | { |
48 | libXine = new XINE::Lib( XINE::Lib::InitializeImmediately, xineWidget ); | 52 | libXine = new XINE::Lib( XINE::Lib::InitializeImmediately, xineWidget ); |
49 | 53 | ||
50 | init(); | 54 | init(); |
51 | } | 55 | } |
52 | 56 | ||
53 | XineControl::XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget, | 57 | XineControl::XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget, |
54 | MediaPlayerState &_mediaPlayerState, | 58 | MediaPlayerState &_mediaPlayerState, |
55 | QObject *parent, const char *name ) | 59 | QObject *parent, const char *name ) |
56 | : QObject( parent, name ), libXine( xine ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) | 60 | : QObject( parent, name ), libXine( xine ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) |
57 | { | 61 | { |
58 | xine->ensureInitialized(); | 62 | xine->ensureInitialized(); |
59 | 63 | ||
60 | xine->setWidget( xineWidget ); | 64 | xine->setWidget( xineWidget ); |
61 | 65 | ||
62 | init(); | 66 | init(); |
63 | } | 67 | } |
64 | 68 | ||
65 | void XineControl::init() | 69 | void XineControl::init() |
66 | { | 70 | { |
67 | connect( &mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) ); | 71 | connect( &mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) ); |
68 | connect( this, SIGNAL( positionChanged(long) ), &mediaPlayerState, SLOT( updatePosition(long) ) ); | 72 | connect( this, SIGNAL( positionChanged(long) ), &mediaPlayerState, SLOT( updatePosition(long) ) ); |
69 | connect( &mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( stop(bool) ) ); | 73 | connect( &mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( stop(bool) ) ); |
70 | connect( &mediaPlayerState, SIGNAL( fullscreenToggled(bool) ), this, SLOT( setFullscreen(bool) ) ); | 74 | connect( &mediaPlayerState, SIGNAL( fullscreenToggled(bool) ), this, SLOT( setFullscreen(bool) ) ); |
71 | connect( &mediaPlayerState, SIGNAL( positionChanged(long) ), this, SLOT( seekTo(long) ) ); | 75 | connect( &mediaPlayerState, SIGNAL( positionChanged(long) ), this, SLOT( seekTo(long) ) ); |
72 | connect( &mediaPlayerState, SIGNAL( videoGammaChanged(int) ), this, SLOT( setGamma(int) ) ); | 76 | connect( &mediaPlayerState, SIGNAL( videoGammaChanged(int) ), this, SLOT( setGamma(int) ) ); |
73 | connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); | 77 | connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); |
74 | connect( xineVideoWidget, SIGNAL( videoResized(const QSize&) ), this, SLOT( videoResized(const QSize&) ) ); | 78 | connect( xineVideoWidget, SIGNAL( videoResized(const QSize&) ), this, SLOT( videoResized(const QSize&) ) ); |
75 | 79 | ||
76 | disabledSuspendScreenSaver = FALSE; | 80 | disabledSuspendScreenSaver = FALSE; |
77 | } | 81 | } |
78 | 82 | ||
79 | XineControl::~XineControl() { | 83 | XineControl::~XineControl() { |
80 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 84 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
81 | if ( disabledSuspendScreenSaver ) { | 85 | if ( disabledSuspendScreenSaver ) { |
82 | disabledSuspendScreenSaver = FALSE; | 86 | disabledSuspendScreenSaver = FALSE; |
83 | // Re-enable the suspend mode | 87 | // Re-enable the suspend mode |
84 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | 88 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; |
85 | } | 89 | } |
86 | #endif | 90 | #endif |
87 | delete libXine; | 91 | delete libXine; |
88 | } | 92 | } |
89 | 93 | ||
90 | void XineControl::play( const QString& fileName ) { | 94 | void XineControl::play( const QString& fileName ) { |
91 | 95 | ||
92 | hasVideoChannel = FALSE; | 96 | hasVideoChannel = FALSE; |
93 | hasAudioChannel = FALSE; | 97 | hasAudioChannel = FALSE; |
94 | m_fileName = fileName; | 98 | m_fileName = fileName; |
95 | 99 | ||
96 | odebug << "<<FILENAME: " + fileName + ">>>>" << oendl; | 100 | odebug << "<<FILENAME: " + fileName + ">>>>" << oendl; |
97 | 101 | ||
98 | if ( !libXine->play( fileName, 0, 0 ) ) { | 102 | if ( !libXine->play( fileName, 0, 0 ) ) { |
99 | QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); | 103 | QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); |
100 | // toggle stop so the the play button is reset | 104 | // toggle stop so the the play button is reset |
101 | mediaPlayerState.setPlaying( false ); | 105 | mediaPlayerState.setPlaying( false ); |
102 | return; | 106 | return; |
103 | } | 107 | } |
104 | mediaPlayerState.setPlaying( true ); | 108 | mediaPlayerState.setPlaying( true ); |
105 | 109 | ||
106 | MediaPlayerState::DisplayType displayType; | 110 | MediaPlayerState::DisplayType displayType; |
107 | if ( !libXine->hasVideo() ) { | 111 | if ( !libXine->hasVideo() ) { |
108 | displayType = MediaPlayerState::Audio; | 112 | displayType = MediaPlayerState::Audio; |
109 | odebug << "HAS AUDIO" << oendl; | 113 | odebug << "HAS AUDIO" << oendl; |
110 | libXine->setShowVideo( false ); | 114 | libXine->setShowVideo( false ); |
111 | hasAudioChannel = TRUE; | 115 | hasAudioChannel = TRUE; |
112 | } else { | 116 | } else { |
113 | displayType = MediaPlayerState::Video; | 117 | displayType = MediaPlayerState::Video; |
114 | odebug << "HAS VIDEO" << oendl; | 118 | odebug << "HAS VIDEO" << oendl; |
115 | libXine->setShowVideo( true ); | 119 | libXine->setShowVideo( true ); |
116 | hasVideoChannel = TRUE; | 120 | hasVideoChannel = TRUE; |
117 | } | 121 | } |
118 | // determine if slider is shown | 122 | // determine if slider is shown |
119 | mediaPlayerState.setIsSeekable( libXine->isSeekable() ); | 123 | mediaPlayerState.setIsSeekable( libXine->isSeekable() ); |
120 | 124 | ||
121 | // which gui (video / audio) | 125 | // which gui (video / audio) |
122 | mediaPlayerState.setDisplayType( displayType ); | 126 | mediaPlayerState.setDisplayType( displayType ); |
123 | 127 | ||
124 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 128 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
125 | if ( !disabledSuspendScreenSaver ) { | 129 | if ( !disabledSuspendScreenSaver ) { |
126 | disabledSuspendScreenSaver = TRUE; | 130 | disabledSuspendScreenSaver = TRUE; |
127 | // Stop the screen from blanking and power saving state | 131 | // Stop the screen from blanking and power saving state |
128 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) | 132 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) |
129 | << ( displayType == MediaPlayerState::Video ? QPEApplication::Disable : QPEApplication::DisableSuspend ); | 133 | << ( displayType == MediaPlayerState::Video ? QPEApplication::Disable : QPEApplication::DisableSuspend ); |
130 | } | 134 | } |
131 | #endif | 135 | #endif |
132 | 136 | ||
133 | length(); | 137 | length(); |
134 | position(); | 138 | position(); |
135 | } | 139 | } |
136 | 140 | ||
137 | void XineControl::nextMedia() { | 141 | void XineControl::nextMedia() { |