summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2
Unidiff
Diffstat (limited to 'noncore/multimedia/opieplayer2') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp6
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp12
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp88
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/threadutil.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp4
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp14
8 files changed, 65 insertions, 65 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 870b4f3..f3eafab 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -1,178 +1,178 @@
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#include "mediaplayerstate.h" 36#include "mediaplayerstate.h"
37#include "playlistwidget.h" 37#include "playlistwidget.h"
38 38
39#include <qpe/qpeapplication.h> 39#include <qpe/qpeapplication.h>
40 40
41namespace 41namespace
42{ 42{
43 43
44const int xo = -2; // movable x offset 44const int xo = -2; // movable x offset
45const int yo = 22; // movable y offset 45const int yo = 22; // movable y offset
46 46
47const MediaWidget::SkinButtonInfo skinInfo[] = 47const MediaWidget::SkinButtonInfo skinInfo[] =
48{ 48{
49 { MediaWidget::Play, "play", MediaWidget::ToggleButton }, 49 { MediaWidget::Play, "play", MediaWidget::ToggleButton },
50 { MediaWidget::Stop, "stop", MediaWidget::NormalButton }, 50 { MediaWidget::Stop, "stop", MediaWidget::NormalButton },
51 { MediaWidget::Next, "next", MediaWidget::NormalButton }, 51 { MediaWidget::Next, "next", MediaWidget::NormalButton },
52 { MediaWidget::Previous, "prev", MediaWidget::NormalButton }, 52 { MediaWidget::Previous, "prev", MediaWidget::NormalButton },
53 { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton }, 53 { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton },
54 { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton }, 54 { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton },
55 { MediaWidget::Loop, "loop", MediaWidget::ToggleButton }, 55 { MediaWidget::Loop, "loop", MediaWidget::ToggleButton },
56 { MediaWidget::PlayList, "playlist", MediaWidget::NormalButton }, 56 { MediaWidget::PlayList, "playlist", MediaWidget::NormalButton },
57 { MediaWidget::Forward, "forward", MediaWidget::NormalButton }, 57 { MediaWidget::Forward, "forward", MediaWidget::NormalButton },
58 { MediaWidget::Back, "back", MediaWidget::NormalButton } 58 { MediaWidget::Back, "back", MediaWidget::NormalButton }
59}; 59};
60 60
61const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] ); 61const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] );
62 62
63void changeTextColor( QWidget * w) { 63void changeTextColor( QWidget * w) {
64 QPalette p = w->palette(); 64 QPalette p = w->palette();
65 p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); 65 p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) );
66 p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); 66 p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) );
67 w->setPalette( p ); 67 w->setPalette( p );
68} 68}
69 69
70} 70}
71 71
72AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : 72AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) :
73 73
74 MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ), 74 MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ),
75 audioSliderBeingMoved( false ) 75 audioSliderBeingMoved( false )
76{ 76{
77 setCaption( tr("OpiePlayer") ); 77 setCaption( tr("OpiePlayer") );
78 78
79 loadSkin(); 79 loadSkin();
80 80
81 connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) ); 81 connect( &mediaPlayerState, SIGNAL( loopingToggled(bool) ), this, SLOT( setLooping(bool) ) );
82 connect( &mediaPlayerState, SIGNAL( isSeekableToggled( bool ) ), this, SLOT( setSeekable( bool ) ) ); 82 connect( &mediaPlayerState, SIGNAL( isSeekableToggled(bool) ), this, SLOT( setSeekable(bool) ) );
83 83
84 connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) ); 84 connect( this, SIGNAL( forwardClicked() ), this, SLOT( skipFor() ) );
85 connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) ); 85 connect( this, SIGNAL( backClicked() ), this, SLOT( skipBack() ) );
86 connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) ); 86 connect( this, SIGNAL( forwardReleased() ), this, SLOT( stopSkip() ) );
87 connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) ); 87 connect( this, SIGNAL( backReleased() ), this, SLOT( stopSkip() ) );
88 88
89 // Intialise state 89 // Intialise state
90 setLength( mediaPlayerState.length() ); 90 setLength( mediaPlayerState.length() );
91 setPosition( mediaPlayerState.position() ); 91 setPosition( mediaPlayerState.position() );
92 setLooping( mediaPlayerState.isFullscreen() ); 92 setLooping( mediaPlayerState.isFullscreen() );
93 // setPaused( mediaPlayerState->paused() ); 93 // setPaused( mediaPlayerState->paused() );
94 setPlaying( mediaPlayerState.isPlaying() ); 94 setPlaying( mediaPlayerState.isPlaying() );
95} 95}
96 96
97AudioWidget::~AudioWidget() { 97AudioWidget::~AudioWidget() {
98 98
99// mediaPlayerState->setPlaying(false); 99// mediaPlayerState->setPlaying(false);
100} 100}
101 101
102MediaWidget::GUIInfo AudioWidget::guiInfo() 102MediaWidget::GUIInfo AudioWidget::guiInfo()
103{ 103{
104 return GUIInfo( QString::null /* infix */, ::skinInfo, ::buttonCount ); 104 return GUIInfo( QString::null /* infix */, ::skinInfo, ::buttonCount );
105} 105}
106 106
107void AudioWidget::resizeEvent( QResizeEvent *e ) { 107void AudioWidget::resizeEvent( QResizeEvent *e ) {
108 int h = height(); 108 int h = height();
109 int w = width(); 109 int w = width();
110 110
111 songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) ); 111 songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) );
112 slider.setFixedWidth( w - 110 ); 112 slider.setFixedWidth( w - 110 );
113 slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); 113 slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) );
114 slider.setBackgroundOrigin( QWidget::ParentOrigin ); 114 slider.setBackgroundOrigin( QWidget::ParentOrigin );
115 time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); 115 time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) );
116 116
117 upperLeftOfButtonMask.rx() = ( w - buttonUpImage.width() ) / 2; 117 upperLeftOfButtonMask.rx() = ( w - buttonUpImage.width() ) / 2;
118 upperLeftOfButtonMask.ry() = (( h - buttonUpImage.height() ) / 2) - 10; 118 upperLeftOfButtonMask.ry() = (( h - buttonUpImage.height() ) / 2) - 10;
119 119
120 MediaWidget::resizeEvent( e ); 120 MediaWidget::resizeEvent( e );
121} 121}
122 122
123void AudioWidget::sliderPressed() { 123void AudioWidget::sliderPressed() {
124 audioSliderBeingMoved = TRUE; 124 audioSliderBeingMoved = TRUE;
125} 125}
126 126
127 127
128void AudioWidget::sliderReleased() { 128void AudioWidget::sliderReleased() {
129 audioSliderBeingMoved = FALSE; 129 audioSliderBeingMoved = FALSE;
130 if ( slider.width() == 0 ) 130 if ( slider.width() == 0 )
131 return; 131 return;
132 long val = long((double)slider.value() * mediaPlayerState.length() / slider.width()); 132 long val = long((double)slider.value() * mediaPlayerState.length() / slider.width());
133 mediaPlayerState.setPosition( val ); 133 mediaPlayerState.setPosition( val );
134} 134}
135 135
136void AudioWidget::setPosition( long i ) { 136void AudioWidget::setPosition( long i ) {
137 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i); 137 // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<set position %d",i);
138 updateSlider( i, mediaPlayerState.length() ); 138 updateSlider( i, mediaPlayerState.length() );
139} 139}
140 140
141 141
142void AudioWidget::setLength( long max ) { 142void AudioWidget::setLength( long max ) {
143 updateSlider( mediaPlayerState.position(), max ); 143 updateSlider( mediaPlayerState.position(), max );
144} 144}
145 145
146 146
147void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) { 147void AudioWidget::setDisplayType( MediaPlayerState::DisplayType mediaType ) {
148 if ( mediaType == MediaPlayerState::Audio ) { 148 if ( mediaType == MediaPlayerState::Audio ) {
149 // startTimer( 150 ); 149 // startTimer( 150 );
150 QPEApplication::showWidget( this ); 150 QPEApplication::showWidget( this );
151 return; 151 return;
152 } 152 }
153 153
154 killTimers(); 154 killTimers();
155 hide(); 155 hide();
156} 156}
157 157
158void AudioWidget::loadSkin() 158void AudioWidget::loadSkin()
159{ 159{
160 loadDefaultSkin( guiInfo() ); 160 loadDefaultSkin( guiInfo() );
161 161
162 songInfo.setFocusPolicy( QWidget::NoFocus ); 162 songInfo.setFocusPolicy( QWidget::NoFocus );
163// changeTextColor( &songInfo ); 163// changeTextColor( &songInfo );
164// songInfo.setBackgroundColor( QColor( 167, 212, 167 )); 164// songInfo.setBackgroundColor( QColor( 167, 212, 167 ));
165// songInfo.setFrameStyle( QFrame::NoFrame); 165// songInfo.setFrameStyle( QFrame::NoFrame);
166 songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken ); 166 songInfo.setFrameStyle( QFrame::WinPanel | QFrame::Sunken );
167// songInfo.setForegroundColor(Qt::white); 167// songInfo.setForegroundColor(Qt::white);
168 168
169 slider.setFixedHeight( 20 ); 169 slider.setFixedHeight( 20 );
170 slider.setMinValue( 0 ); 170 slider.setMinValue( 0 );
171 slider.setMaxValue( 1 ); 171 slider.setMaxValue( 1 );
172 slider.setFocusPolicy( QWidget::NoFocus ); 172 slider.setFocusPolicy( QWidget::NoFocus );
173 slider.setBackgroundPixmap( backgroundPixmap ); 173 slider.setBackgroundPixmap( backgroundPixmap );
174 174
175// Config cofg("qpe"); 175// Config cofg("qpe");
176// cofg.setGroup("Appearance"); 176// cofg.setGroup("Appearance");
177// QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) ); 177// QColor backgroundcolor = QColor( cofg.readEntry( "Background", "#E5E1D5" ) );
178 178
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index 9f51006..1e6bc4d 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -1,141 +1,141 @@
1#include <qpe/qpeapplication.h> 1#include <qpe/qpeapplication.h>
2#include <qpe/config.h> 2#include <qpe/config.h>
3#include <qpe/qcopenvelope_qws.h> 3#include <qpe/qcopenvelope_qws.h>
4#include <qfileinfo.h> 4#include <qfileinfo.h>
5 5
6#include "mediaplayer.h" 6#include "mediaplayer.h"
7#include "playlistwidget.h" 7#include "playlistwidget.h"
8#include "audiowidget.h" 8#include "audiowidget.h"
9#include "videowidget.h" 9#include "videowidget.h"
10#include "volumecontrol.h" 10#include "volumecontrol.h"
11#include "lib.h" 11#include "lib.h"
12 12
13#include "mediaplayerstate.h" 13#include "mediaplayerstate.h"
14 14
15 // for setBacklight() 15 // for setBacklight()
16#include <linux/fb.h> 16#include <linux/fb.h>
17#include <sys/file.h> 17#include <sys/file.h>
18#include <sys/ioctl.h> 18#include <sys/ioctl.h>
19 19
20 20
21#define FBIOBLANK 0x4611 21#define FBIOBLANK 0x4611
22 22
23MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name ) 23MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QObject *parent, const char *name )
24 : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) { 24 : QObject( parent, name ), volumeDirection( 0 ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) {
25 25
26 m_audioUI = 0; 26 m_audioUI = 0;
27 m_videoUI = 0; 27 m_videoUI = 0;
28 m_xineControl = 0; 28 m_xineControl = 0;
29 xine = new XINE::Lib( XINE::Lib::InitializeInThread ); 29 xine = new XINE::Lib( XINE::Lib::InitializeInThread );
30 30
31 fd=-1;fl=-1; 31 fd=-1;fl=-1;
32 playList.setCaption( tr( "OpiePlayer: Initializating" ) ); 32 playList.setCaption( tr( "OpiePlayer: Initializating" ) );
33 33
34 qApp->processEvents(); 34 qApp->processEvents();
35 // QPEApplication::grabKeyboard(); // EVIL 35 // QPEApplication::grabKeyboard(); // EVIL
36 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 36 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
37 37
38 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); 38 connect( &mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( setPlaying(bool) ) );
39 39
40// What is pauseCheck good for? (Simon) 40// What is pauseCheck good for? (Simon)
41// connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); 41// connect( &mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pauseCheck(bool) ) );
42 42
43 connect( &mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); 43 connect( &mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) );
44 connect( &mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); 44 connect( &mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) );
45 connect( &mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); 45 connect( &mediaPlayerState, SIGNAL( blankToggled(bool) ), this, SLOT ( blank(bool) ) );
46 46
47 volControl = new VolumeControl; 47 volControl = new VolumeControl;
48 Config cfg( "OpiePlayer" ); 48 Config cfg( "OpiePlayer" );
49 cfg.setGroup("PlayList"); 49 cfg.setGroup("PlayList");
50 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); 50 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default");
51 playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); 51 playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() );
52 52
53 m_skinLoader = new SkinLoader; 53 m_skinLoader = new SkinLoader;
54 m_skinLoader->schedule( AudioWidget::guiInfo() ); 54 m_skinLoader->schedule( AudioWidget::guiInfo() );
55 m_skinLoader->schedule( VideoWidget::guiInfo() ); 55 m_skinLoader->schedule( VideoWidget::guiInfo() );
56 m_skinLoader->start(); 56 m_skinLoader->start();
57} 57}
58 58
59MediaPlayer::~MediaPlayer() { 59MediaPlayer::~MediaPlayer() {
60 // this shold never happen, but one never knows... 60 // this shold never happen, but one never knows...
61 if ( xine ) { 61 if ( xine ) {
62 xine->ensureInitialized(); 62 xine->ensureInitialized();
63 delete xine; 63 delete xine;
64 } 64 }
65 delete m_xineControl; 65 delete m_xineControl;
66 delete m_audioUI; 66 delete m_audioUI;
67 delete m_videoUI; 67 delete m_videoUI;
68 delete volControl; 68 delete volControl;
69} 69}
70 70
71void MediaPlayer::pauseCheck( bool b ) { 71void MediaPlayer::pauseCheck( bool b ) {
72 if ( b && !mediaPlayerState.isPlaying() ) { 72 if ( b && !mediaPlayerState.isPlaying() ) {
73 mediaPlayerState.setPaused( FALSE ); 73 mediaPlayerState.setPaused( FALSE );
74 } 74 }
75} 75}
76 76
77void MediaPlayer::play() { 77void MediaPlayer::play() {
78 mediaPlayerState.setPlaying( FALSE ); 78 mediaPlayerState.setPlaying( FALSE );
79 mediaPlayerState.setPlaying( TRUE ); 79 mediaPlayerState.setPlaying( TRUE );
80} 80}
81 81
82void MediaPlayer::setPlaying( bool play ) { 82void MediaPlayer::setPlaying( bool play ) {
83 if ( !play ) { 83 if ( !play ) {
84 return; 84 return;
85 } 85 }
86 86
87 if ( mediaPlayerState.isPaused() ) { 87 if ( mediaPlayerState.isPaused() ) {
88 mediaPlayerState.setPaused( FALSE ); 88 mediaPlayerState.setPaused( FALSE );
89 return; 89 return;
90 } 90 }
91 91
92 QString tickerText, time, fileName; 92 QString tickerText, time, fileName;
93 if ( playList.currentTab() != PlayListWidget::CurrentPlayList ) { 93 if ( playList.currentTab() != PlayListWidget::CurrentPlayList ) {
94 //if playing in file list.. play in a different way 94 //if playing in file list.. play in a different way
95 // random and looping settings enabled causes problems here, 95 // random and looping settings enabled causes problems here,
96 // since there is no selected file in the playlist, but a selected file in the file list, 96 // since there is no selected file in the playlist, but a selected file in the file list,
97 // so we remember and shutoff 97 // so we remember and shutoff
98 l = mediaPlayerState.isLooping(); 98 l = mediaPlayerState.isLooping();
99 if(l) { 99 if(l) {
100 mediaPlayerState.setLooping( false ); 100 mediaPlayerState.setLooping( false );
101 } 101 }
102 r = mediaPlayerState.isShuffled(); 102 r = mediaPlayerState.isShuffled();
103 mediaPlayerState.setShuffled( false ); 103 mediaPlayerState.setShuffled( false );
104 } 104 }
105 105
106 PlayListWidget::Entry playListEntry = playList.currentEntry(); 106 PlayListWidget::Entry playListEntry = playList.currentEntry();
107 fileName = playListEntry.name; 107 fileName = playListEntry.name;
108 xineControl()->play( playListEntry.file ); 108 xineControl()->play( playListEntry.file );
109 109
110 long seconds = mediaPlayerState.length(); 110 long seconds = mediaPlayerState.length();
111 time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); 111 time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
112 112
113 if( fileName.left(4) == "http" ) { 113 if( fileName.left(4) == "http" ) {
114 fileName = QFileInfo( fileName ).baseName(); 114 fileName = QFileInfo( fileName ).baseName();
115 if ( xineControl()->getMetaInfo().isEmpty() ) { 115 if ( xineControl()->getMetaInfo().isEmpty() ) {
116 tickerText = tr( " File: " ) + fileName; 116 tickerText = tr( " File: " ) + fileName;
117 } else { 117 } else {
118 tickerText = xineControl()->getMetaInfo(); 118 tickerText = xineControl()->getMetaInfo();
119 } 119 }
120 } else { 120 } else {
121 if ( xineControl()->getMetaInfo().isEmpty() ) { 121 if ( xineControl()->getMetaInfo().isEmpty() ) {
122 tickerText = tr( " File: " ) + fileName + tr( ", Length: " ) + time + " "; 122 tickerText = tr( " File: " ) + fileName + tr( ", Length: " ) + time + " ";
123 } else { 123 } else {
124 tickerText = xineControl()->getMetaInfo() + " Length: " + time + " "; 124 tickerText = xineControl()->getMetaInfo() + " Length: " + time + " ";
125 } 125 }
126 } 126 }
127 audioUI()->setTickerText( tickerText ); 127 audioUI()->setTickerText( tickerText );
128} 128}
129 129
130 130
131void MediaPlayer::prev() { 131void MediaPlayer::prev() {
132 if( playList.currentTab() == PlayListWidget::CurrentPlayList ) { //if using the playlist 132 if( playList.currentTab() == PlayListWidget::CurrentPlayList ) { //if using the playlist
133 if ( playList.prev() ) { 133 if ( playList.prev() ) {
134 play(); 134 play();
135 } else if ( mediaPlayerState.isLooping() ) { 135 } else if ( mediaPlayerState.isLooping() ) {
136 if ( playList.last() ) { 136 if ( playList.last() ) {
137 play(); 137 play();
138 } 138 }
139 } else { 139 } else {
140 mediaPlayerState.setList(); 140 mediaPlayerState.setList();
141 } 141 }
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp
index f193001..08c62a2 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.cpp
+++ b/noncore/multimedia/opieplayer2/mediawidget.cpp
@@ -1,133 +1,133 @@
1/* 1/*
2 Copyright (C) 2002 Simon Hausmann <simon@lst.de> 2 Copyright (C) 2002 Simon Hausmann <simon@lst.de>
3 (C) 2002 Max Reiss <harlekin@handhelds.org> 3 (C) 2002 Max Reiss <harlekin@handhelds.org>
4 (C) 2002 L. Potter <ljp@llornkcor.com> 4 (C) 2002 L. Potter <ljp@llornkcor.com>
5 (C) 2002 Holger Freyther <zecke@handhelds.org> 5 (C) 2002 Holger Freyther <zecke@handhelds.org>
6 6
7 This program is free software; you can redistribute it and/or 7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public 8 modify it under the terms of the GNU General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
11 11
12 This program is distributed in the hope that it will be useful, 12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details. 15 General Public License for more details.
16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; see the file COPYING. If not, write to 18 along with this program; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. 20 Boston, MA 02111-1307, USA.
21*/ 21*/
22 22
23#include <assert.h> 23#include <assert.h>
24 24
25#include "mediawidget.h" 25#include "mediawidget.h"
26#include "playlistwidget.h" 26#include "playlistwidget.h"
27#include "skin.h" 27#include "skin.h"
28 28
29MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name ) 29MediaWidget::MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent, const char *name )
30 : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList ) 30 : QWidget( parent, name ), mediaPlayerState( _mediaPlayerState ), playList( _playList )
31{ 31{
32 connect( &mediaPlayerState, SIGNAL( displayTypeChanged( MediaPlayerState::DisplayType ) ), 32 connect( &mediaPlayerState, SIGNAL( displayTypeChanged(MediaPlayerState::DisplayType) ),
33 this, SLOT( setDisplayType( MediaPlayerState::DisplayType ) ) ); 33 this, SLOT( setDisplayType(MediaPlayerState::DisplayType) ) );
34 connect( &mediaPlayerState, SIGNAL( lengthChanged( long ) ), 34 connect( &mediaPlayerState, SIGNAL( lengthChanged(long) ),
35 this, SLOT( setLength( long ) ) ); 35 this, SLOT( setLength(long) ) );
36 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), 36 connect( &mediaPlayerState, SIGNAL( playingToggled(bool) ),
37 this, SLOT( setPlaying( bool ) ) ); 37 this, SLOT( setPlaying(bool) ) );
38 38
39 setBackgroundMode( NoBackground ); 39 setBackgroundMode( NoBackground );
40} 40}
41 41
42MediaWidget::~MediaWidget() 42MediaWidget::~MediaWidget()
43{ 43{
44} 44}
45 45
46void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount, 46void MediaWidget::setupButtons( const SkinButtonInfo *skinInfo, uint buttonCount,
47 const Skin &skin ) 47 const Skin &skin )
48{ 48{
49 buttonMask = skin.buttonMask( skinInfo, buttonCount ); 49 buttonMask = skin.buttonMask( skinInfo, buttonCount );
50 50
51 buttons.clear(); 51 buttons.clear();
52 buttons.reserve( buttonCount ); 52 buttons.reserve( buttonCount );
53 53
54 for ( uint i = 0; i < buttonCount; ++i ) { 54 for ( uint i = 0; i < buttonCount; ++i ) {
55 Button button = setupButton( skinInfo[ i ], skin ); 55 Button button = setupButton( skinInfo[ i ], skin );
56 buttons.push_back( button ); 56 buttons.push_back( button );
57 } 57 }
58} 58}
59 59
60MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin ) 60MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, const Skin &skin )
61{ 61{
62 Button button; 62 Button button;
63 button.command = buttonInfo.command; 63 button.command = buttonInfo.command;
64 button.type = buttonInfo.type; 64 button.type = buttonInfo.type;
65 button.mask = skin.buttonMaskImage( buttonInfo.fileName ); 65 button.mask = skin.buttonMaskImage( buttonInfo.fileName );
66 66
67 return button; 67 return button;
68} 68}
69 69
70void MediaWidget::loadDefaultSkin( const GUIInfo &guiInfo ) 70void MediaWidget::loadDefaultSkin( const GUIInfo &guiInfo )
71{ 71{
72 Skin skin( guiInfo.fileNameInfix ); 72 Skin skin( guiInfo.fileNameInfix );
73 skin.setCachable( false ); 73 skin.setCachable( false );
74 loadSkin( guiInfo.buttonInfo, guiInfo.buttonCount, skin ); 74 loadSkin( guiInfo.buttonInfo, guiInfo.buttonCount, skin );
75} 75}
76 76
77void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const Skin &skin ) 77void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const Skin &skin )
78{ 78{
79 backgroundPixmap = skin.backgroundPixmap(); 79 backgroundPixmap = skin.backgroundPixmap();
80 buttonUpImage = skin.buttonUpImage(); 80 buttonUpImage = skin.buttonUpImage();
81 buttonDownImage = skin.buttonDownImage(); 81 buttonDownImage = skin.buttonDownImage();
82 82
83 setupButtons( skinInfo, buttonCount, skin ); 83 setupButtons( skinInfo, buttonCount, skin );
84} 84}
85 85
86void MediaWidget::closeEvent( QCloseEvent * ) 86void MediaWidget::closeEvent( QCloseEvent * )
87{ 87{
88 mediaPlayerState.setList(); 88 mediaPlayerState.setList();
89} 89}
90 90
91void MediaWidget::paintEvent( QPaintEvent *pe ) 91void MediaWidget::paintEvent( QPaintEvent *pe )
92{ 92{
93 QPainter p( this ); 93 QPainter p( this );
94 94
95 if ( mediaPlayerState.isFullscreen() ) { 95 if ( mediaPlayerState.isFullscreen() ) {
96 // Clear the background 96 // Clear the background
97 p.setBrush( QBrush( Qt::black ) ); 97 p.setBrush( QBrush( Qt::black ) );
98 return; 98 return;
99 } 99 }
100 100
101 QPixmap buffer( size() ); 101 QPixmap buffer( size() );
102 QPainter bufferedPainter( &buffer ); 102 QPainter bufferedPainter( &buffer );
103 bufferedPainter.drawTiledPixmap( rect(), backgroundPixmap, QPoint( 0, 0 ) ); 103 bufferedPainter.drawTiledPixmap( rect(), backgroundPixmap, QPoint( 0, 0 ) );
104 paintAllButtons( bufferedPainter ); 104 paintAllButtons( bufferedPainter );
105 p.drawPixmap( 0, 0, buffer ); 105 p.drawPixmap( 0, 0, buffer );
106} 106}
107 107
108void MediaWidget::resizeEvent( QResizeEvent *e ) 108void MediaWidget::resizeEvent( QResizeEvent *e )
109{ 109{
110 QPixmap pixUp = combineImageWithBackground( buttonUpImage, backgroundPixmap, upperLeftOfButtonMask ); 110 QPixmap pixUp = combineImageWithBackground( buttonUpImage, backgroundPixmap, upperLeftOfButtonMask );
111 QPixmap pixDn = combineImageWithBackground( buttonDownImage, backgroundPixmap, upperLeftOfButtonMask ); 111 QPixmap pixDn = combineImageWithBackground( buttonDownImage, backgroundPixmap, upperLeftOfButtonMask );
112 112
113 for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) { 113 for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) {
114 Button &button = *it; 114 Button &button = *it;
115 115
116 if ( button.mask.isNull() ) 116 if ( button.mask.isNull() )
117 continue; 117 continue;
118 button.pixUp = addMaskToPixmap( pixUp, button.mask ); 118 button.pixUp = addMaskToPixmap( pixUp, button.mask );
119 button.pixDown = addMaskToPixmap( pixDn, button.mask ); 119 button.pixDown = addMaskToPixmap( pixDn, button.mask );
120 } 120 }
121 121
122 QWidget::resizeEvent( e ); 122 QWidget::resizeEvent( e );
123} 123}
124 124
125MediaWidget::Button *MediaWidget::buttonAt( const QPoint &position ) 125MediaWidget::Button *MediaWidget::buttonAt( const QPoint &position )
126{ 126{
127 if ( position.x() <= 0 || position.y() <= 0 || 127 if ( position.x() <= 0 || position.y() <= 0 ||
128 position.x() >= buttonMask.width() || 128 position.x() >= buttonMask.width() ||
129 position.y() >= buttonMask.height() ) 129 position.y() >= buttonMask.height() )
130 return 0; 130 return 0;
131 131
132 int pixelIdx = buttonMask.pixelIndex( position.x(), position.y() ); 132 int pixelIdx = buttonMask.pixelIndex( position.x(), position.y() );
133 for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) 133 for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it )
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 9a9e1ec..0a84268 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -1,249 +1,249 @@
1/* 1/*
2                This file is part of the Opie Project 2                This file is part of the Opie Project
3 3
4              Copyright (c) 2002,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> 34#include <qtoolbar.h>
35 35
36#include <opie/ofiledialog.h> 36#include <opie/ofiledialog.h>
37 37
38#include <qmessagebox.h> 38#include <qmessagebox.h>
39 39
40#include "playlistselection.h" 40#include "playlistselection.h"
41#include "playlistwidget.h" 41#include "playlistwidget.h"
42#include "mediaplayer.h" 42#include "mediaplayer.h"
43#include "mediaplayerstate.h" 43#include "mediaplayerstate.h"
44#include "inputDialog.h" 44#include "inputDialog.h"
45#include "om3u.h" 45#include "om3u.h"
46#include "playlistfileview.h" 46#include "playlistfileview.h"
47 47
48//only needed for the random play 48//only needed for the random play
49#include <assert.h> 49#include <assert.h>
50 50
51PlayListWidget::PlayListWidget(QWidget* parent, const char* name, WFlags fl ) 51PlayListWidget::PlayListWidget(QWidget* parent, const char* name, WFlags fl )
52 : PlayListWidgetGui( parent, "playList" ) , currentFileListView( 0 ) 52 : PlayListWidgetGui( parent, "playList" ) , currentFileListView( 0 )
53{ 53{
54 mediaPlayerState = new MediaPlayerState(0, "mediaPlayerState" ); 54 mediaPlayerState = new MediaPlayerState(0, "mediaPlayerState" );
55 m_mp = new MediaPlayer(*this, *mediaPlayerState, 0, "mediaPlayer"); 55 m_mp = new MediaPlayer(*this, *mediaPlayerState, 0, "mediaPlayer");
56 56
57 57
58 58
59 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), 59 d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ),
60 "opieplayer2/add_to_playlist", 60 "opieplayer2/add_to_playlist",
61 this , SLOT(addSelected() ) ); 61 this , SLOT(addSelected() ) );
62 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), 62 d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ),
63 "opieplayer2/remove_from_playlist", 63 "opieplayer2/remove_from_playlist",
64 this , SLOT(removeSelected() ) ); 64 this , SLOT(removeSelected() ) );
65 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", 65 d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play",
66 this , SLOT( btnPlay( bool) ), TRUE ); 66 this , SLOT( btnPlay(bool) ), TRUE );
67 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", 67 d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle",
68 mediaPlayerState, SLOT( setShuffled( bool ) ), TRUE ); 68 mediaPlayerState, SLOT( setShuffled(bool) ), TRUE );
69 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop", 69 d->tbLoop = new ToolButton( bar, tr( "Loop" ), "opieplayer2/loop",
70 mediaPlayerState, SLOT( setLooping( bool ) ), TRUE ); 70 mediaPlayerState, SLOT( setLooping(bool) ), TRUE );
71 71
72 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); 72 (void)new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
73 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ), 73 (void)new MenuItem( pmPlayList, tr( "Add all audio files" ),
74 this, SLOT( addAllMusicToList() ) ); 74 this, SLOT( addAllMusicToList() ) );
75 (void)new MenuItem( pmPlayList, tr( "Add all video files" ), 75 (void)new MenuItem( pmPlayList, tr( "Add all video files" ),
76 this, SLOT( addAllVideoToList() ) ); 76 this, SLOT( addAllVideoToList() ) );
77 (void)new MenuItem( pmPlayList, tr( "Add all files" ), 77 (void)new MenuItem( pmPlayList, tr( "Add all files" ),
78 this, SLOT( addAllToList() ) ); 78 this, SLOT( addAllToList() ) );
79 pmPlayList->insertSeparator(-1); 79 pmPlayList->insertSeparator(-1);
80 (void)new MenuItem( pmPlayList, tr( "Add File" ), 80 (void)new MenuItem( pmPlayList, tr( "Add File" ),
81 this,SLOT( openFile() ) ); 81 this,SLOT( openFile() ) );
82 (void)new MenuItem( pmPlayList, tr("Add URL"), 82 (void)new MenuItem( pmPlayList, tr("Add URL"),
83 this,SLOT( openURL() ) ); 83 this,SLOT( openURL() ) );
84 pmPlayList->insertSeparator(-1); 84 pmPlayList->insertSeparator(-1);
85 (void)new MenuItem( pmPlayList, tr( "Save Playlist" ), 85 (void)new MenuItem( pmPlayList, tr( "Save Playlist" ),
86 this, SLOT(writem3u() ) ); 86 this, SLOT(writem3u() ) );
87 pmPlayList->insertSeparator(-1); 87 pmPlayList->insertSeparator(-1);
88 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), 88 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ),
89 audioView, SLOT( scanFiles() ) ); 89 audioView, SLOT( scanFiles() ) );
90 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), 90 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ),
91 videoView, SLOT( scanFiles() ) ); 91 videoView, SLOT( scanFiles() ) );
92 92
93 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), 93 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"),
94 mediaPlayerState, SLOT( toggleFullscreen() ) ); 94 mediaPlayerState, SLOT( toggleFullscreen() ) );
95 95
96 Config cfg( "OpiePlayer" ); 96 Config cfg( "OpiePlayer" );
97 bool b= cfg.readBoolEntry("FullScreen", 0); 97 bool b= cfg.readBoolEntry("FullScreen", 0);
98 mediaPlayerState->setFullscreen( b ); 98 mediaPlayerState->setFullscreen( b );
99 pmView->setItemChecked( -16, b ); 99 pmView->setItemChecked( -16, b );
100 100
101 (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", 101 (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up",
102 d->selectedFiles, SLOT(moveSelectedUp() ) ); 102 d->selectedFiles, SLOT(moveSelectedUp() ) );
103 (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", 103 (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut",
104 d->selectedFiles, SLOT(removeSelected() ) ); 104 d->selectedFiles, SLOT(removeSelected() ) );
105 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", 105 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down",
106 d->selectedFiles, SLOT(moveSelectedDown() ) ); 106 d->selectedFiles, SLOT(moveSelectedDown() ) );
107 QVBox *stretch2 = new QVBox( vbox1 ); 107 QVBox *stretch2 = new QVBox( vbox1 );
108 108
109 connect( tbDeletePlaylist, ( SIGNAL( released() ) ), 109 connect( tbDeletePlaylist, ( SIGNAL( released() ) ),
110 SLOT( deletePlaylist() ) ); 110 SLOT( deletePlaylist() ) );
111 connect( pmView, SIGNAL( activated( int ) ), 111 connect( pmView, SIGNAL( activated(int) ),
112 this, SLOT( pmViewActivated( int ) ) ); 112 this, SLOT( pmViewActivated(int) ) );
113 connect( skinsMenu, SIGNAL( activated( int ) ) , 113 connect( skinsMenu, SIGNAL( activated(int) ) ,
114 this, SLOT( skinsMenuActivated( int ) ) ); 114 this, SLOT( skinsMenuActivated(int) ) );
115 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), 115 connect( d->selectedFiles, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),
116 this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) ); 116 this,SLOT( playlistViewPressed(int,QListViewItem*,const QPoint&,int) ) );
117 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ), 117 connect( audioView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),
118 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) ); 118 this,SLOT( viewPressed(int,QListViewItem*,const QPoint&,int) ) );
119 connect( audioView, SIGNAL( returnPressed( QListViewItem *) ), 119 connect( audioView, SIGNAL( returnPressed(QListViewItem*) ),
120 this,SLOT( playIt( QListViewItem *) ) ); 120 this,SLOT( playIt(QListViewItem*) ) );
121 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), 121 connect( audioView, SIGNAL( doubleClicked(QListViewItem*) ),
122 this, SLOT( addToSelection( QListViewItem *) ) ); 122 this, SLOT( addToSelection(QListViewItem*) ) );
123 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), 123 connect( videoView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),
124 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) ); 124 this,SLOT( viewPressed(int,QListViewItem*,const QPoint&,int) ) );
125 connect( videoView, SIGNAL( returnPressed( QListViewItem *) ), 125 connect( videoView, SIGNAL( returnPressed(QListViewItem*) ),
126 this,SLOT( playIt( QListViewItem *) ) ); 126 this,SLOT( playIt(QListViewItem*) ) );
127 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), 127 connect( videoView, SIGNAL( doubleClicked(QListViewItem*) ),
128 this, SLOT( addToSelection( QListViewItem *) ) ); 128 this, SLOT( addToSelection(QListViewItem*) ) );
129 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), 129 connect( playLists, SIGNAL( fileSelected(const DocLnk&) ),
130 this, SLOT( loadList( const DocLnk & ) ) ); 130 this, SLOT( loadList(const DocLnk&) ) );
131 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), 131 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ),
132 this, SLOT( tabChanged( QWidget* ) ) ); 132 this, SLOT( tabChanged(QWidget*) ) );
133 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), 133 connect( mediaPlayerState, SIGNAL( playingToggled(bool) ),
134 d->tbPlay, SLOT( setOn( bool ) ) ); 134 d->tbPlay, SLOT( setOn(bool) ) );
135 connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), 135 connect( mediaPlayerState, SIGNAL( loopingToggled(bool) ),
136 d->tbLoop, SLOT( setOn( bool ) ) ); 136 d->tbLoop, SLOT( setOn(bool) ) );
137 connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), 137 connect( mediaPlayerState, SIGNAL( shuffledToggled(bool) ),
138 d->tbShuffle, SLOT( setOn( bool ) ) ); 138 d->tbShuffle, SLOT( setOn(bool) ) );
139 connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), 139 connect( d->selectedFiles, SIGNAL( doubleClicked(QListViewItem*) ),
140 this, SLOT( playIt( QListViewItem *) ) ); 140 this, SLOT( playIt(QListViewItem*) ) );
141 connect ( gammaSlider, SIGNAL( valueChanged( int ) ), 141 connect ( gammaSlider, SIGNAL( valueChanged(int) ),
142 mediaPlayerState, SLOT( setVideoGamma( int ) ) ); 142 mediaPlayerState, SLOT( setVideoGamma(int) ) );
143 143
144 connect( this, SIGNAL(skinSelected() ), 144 connect( this, SIGNAL(skinSelected() ),
145 m_mp, SLOT( reloadSkins() ) ); 145 m_mp, SLOT( reloadSkins() ) );
146 146
147 // see which skins are installed 147 // see which skins are installed
148 populateSkinsMenu(); 148 populateSkinsMenu();
149 initializeStates(); 149 initializeStates();
150 150
151 channel = new QCopChannel( "QPE/Application/opieplayer2", this ); 151 channel = new QCopChannel( "QPE/Application/opieplayer2", this );
152 connect( channel, SIGNAL(received(const QCString&, const QByteArray&)), 152 connect( channel, SIGNAL(received(const QCString&,const QByteArray&)),
153 this, SLOT( qcopReceive(const QCString&, const QByteArray&)) ); 153 this, SLOT( qcopReceive(const QCString&,const QByteArray&)) );
154 154
155 155
156 cfg.setGroup("PlayList"); 156 cfg.setGroup("PlayList");
157 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); 157 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default");
158 loadList(DocLnk( currentPlaylist ) ); 158 loadList(DocLnk( currentPlaylist ) );
159 159
160 tabWidget->showPage( playListTab ); 160 tabWidget->showPage( playListTab );
161} 161}
162 162
163 163
164PlayListWidget::~PlayListWidget() { 164PlayListWidget::~PlayListWidget() {
165 delete d; 165 delete d;
166 delete m_mp; 166 delete m_mp;
167} 167}
168 168
169 169
170void PlayListWidget::initializeStates() { 170void PlayListWidget::initializeStates() {
171 d->tbPlay->setOn( mediaPlayerState->isPlaying() ); 171 d->tbPlay->setOn( mediaPlayerState->isPlaying() );
172 d->tbLoop->setOn( mediaPlayerState->isLooping() ); 172 d->tbLoop->setOn( mediaPlayerState->isLooping() );
173 d->tbShuffle->setOn( mediaPlayerState->isShuffled() ); 173 d->tbShuffle->setOn( mediaPlayerState->isShuffled() );
174 d->playListFrame->show(); 174 d->playListFrame->show();
175} 175}
176 176
177void PlayListWidget::writeDefaultPlaylist() { 177void PlayListWidget::writeDefaultPlaylist() {
178 178
179 Config config( "OpiePlayer" ); 179 Config config( "OpiePlayer" );
180 config.setGroup( "PlayList" ); 180 config.setGroup( "PlayList" );
181 QString filename=QPEApplication::documentDir() + "/default.m3u"; 181 QString filename=QPEApplication::documentDir() + "/default.m3u";
182 QString currentString = config.readEntry( "CurrentPlaylist", filename); 182 QString currentString = config.readEntry( "CurrentPlaylist", filename);
183 if( currentString == filename) { 183 if( currentString == filename) {
184 Om3u *m3uList; 184 Om3u *m3uList;
185 // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>"); 185 // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>");
186 if( d->selectedFiles->first() ) { 186 if( d->selectedFiles->first() ) {
187 m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); 187 m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate);
188 do { 188 do {
189 // qDebug(d->selectedFiles->current()->file()); 189 // qDebug(d->selectedFiles->current()->file());
190 m3uList->add( d->selectedFiles->current()->file() ); 190 m3uList->add( d->selectedFiles->current()->file() );
191 } 191 }
192 while ( d->selectedFiles->next() ); 192 while ( d->selectedFiles->next() );
193 193
194 m3uList->write(); 194 m3uList->write();
195 m3uList->close(); 195 m3uList->close();
196 delete m3uList; 196 delete m3uList;
197 197
198 } 198 }
199 } 199 }
200} 200}
201 201
202void PlayListWidget::addToSelection( const DocLnk& lnk ) { 202void PlayListWidget::addToSelection( const DocLnk& lnk ) {
203 d->setDocumentUsed = FALSE; 203 d->setDocumentUsed = FALSE;
204 if( QFileInfo( lnk.file() ).exists() || 204 if( QFileInfo( lnk.file() ).exists() ||
205 lnk.file().left(4) == "http" ) { 205 lnk.file().left(4) == "http" ) {
206 d->selectedFiles->addToSelection( lnk ); 206 d->selectedFiles->addToSelection( lnk );
207 } 207 }
208// writeCurrentM3u(); 208// writeCurrentM3u();
209} 209}
210 210
211 211
212void PlayListWidget::clearList() { 212void PlayListWidget::clearList() {
213 while ( first() ) { 213 while ( first() ) {
214 d->selectedFiles->removeSelected(); 214 d->selectedFiles->removeSelected();
215 } 215 }
216 Config cfg( "OpiePlayer" ); 216 Config cfg( "OpiePlayer" );
217 cfg.setGroup("PlayList"); 217 cfg.setGroup("PlayList");
218 cfg.writeEntry("CurrentPlaylist","default"); 218 cfg.writeEntry("CurrentPlaylist","default");
219 setCaption("OpiePlayer"); 219 setCaption("OpiePlayer");
220} 220}
221 221
222void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) { 222void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , int) {
223 switch (mouse) { 223 switch (mouse) {
224 case LeftButton: 224 case LeftButton:
225 break; 225 break;
226 case RightButton: 226 case RightButton:
227 { 227 {
228 QPopupMenu m; 228 QPopupMenu m;
229 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); 229 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() ));
230 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); 230 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() ));
231 m.exec( QCursor::pos() ); 231 m.exec( QCursor::pos() );
232 } 232 }
233 break; 233 break;
234 } 234 }
235} 235}
236 236
237 237
238void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) { 238void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) {
239 switch (mouse) { 239 switch (mouse) {
240 case LeftButton: 240 case LeftButton:
241 break; 241 break;
242 case RightButton: 242 case RightButton:
243 { 243 {
244 QPopupMenu m; 244 QPopupMenu m;
245 m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); 245 m.insertItem( tr( "Play" ), this, SLOT( playSelected() ));
246 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); 246 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() ));
247 m.exec( QCursor::pos() ); 247 m.exec( QCursor::pos() );
248 } 248 }
249 break; 249 break;
@@ -410,240 +410,240 @@ bool PlayListWidget::next() {
410 return d->selectedFiles->first(); 410 return d->selectedFiles->first();
411 } else { 411 } else {
412 return FALSE; 412 return FALSE;
413 } 413 }
414 } 414 }
415 return TRUE; 415 return TRUE;
416 } 416 }
417} 417}
418 418
419 419
420bool PlayListWidget::first() { 420bool PlayListWidget::first() {
421 return d->selectedFiles->first(); 421 return d->selectedFiles->first();
422} 422}
423 423
424 424
425bool PlayListWidget::last() { 425bool PlayListWidget::last() {
426 return d->selectedFiles->last(); 426 return d->selectedFiles->last();
427} 427}
428 428
429 429
430 void PlayListWidget::saveList() { 430 void PlayListWidget::saveList() {
431 writem3u(); 431 writem3u();
432 } 432 }
433 433
434 434
435void PlayListWidget::loadList( const DocLnk & lnk) { 435void PlayListWidget::loadList( const DocLnk & lnk) {
436 QString name = lnk.name(); 436 QString name = lnk.name();
437 437
438 if( name.length()>0) { 438 if( name.length()>0) {
439 setCaption("OpiePlayer: "+name); 439 setCaption("OpiePlayer: "+name);
440 clearList(); 440 clearList();
441 readListFromFile(lnk.file()); 441 readListFromFile(lnk.file());
442 tabWidget->setCurrentPage(0); 442 tabWidget->setCurrentPage(0);
443 } 443 }
444} 444}
445 445
446void PlayListWidget::addSelected() { 446void PlayListWidget::addSelected() {
447 assert( inFileListMode() ); 447 assert( inFileListMode() );
448 448
449 QListViewItemIterator it( currentFileListView ); 449 QListViewItemIterator it( currentFileListView );
450 for ( ; it.current(); ++it ) 450 for ( ; it.current(); ++it )
451 if ( it.current()->isSelected() ) { 451 if ( it.current()->isSelected() ) {
452 QString filename = it.current()->text(3); 452 QString filename = it.current()->text(3);
453 453
454 DocLnk lnk; 454 DocLnk lnk;
455 lnk.setName( QFileInfo( filename ).baseName() ); //sets name 455 lnk.setName( QFileInfo( filename ).baseName() ); //sets name
456 lnk.setFile( filename ); //sets file name 456 lnk.setFile( filename ); //sets file name
457 457
458 d->selectedFiles->addToSelection( lnk ); 458 d->selectedFiles->addToSelection( lnk );
459 } 459 }
460 460
461 currentFileListView->clearSelection(); 461 currentFileListView->clearSelection();
462 462
463 writeCurrentM3u(); 463 writeCurrentM3u();
464} 464}
465 465
466 466
467void PlayListWidget::removeSelected() { 467void PlayListWidget::removeSelected() {
468 d->selectedFiles->removeSelected( ); 468 d->selectedFiles->removeSelected( );
469 writeCurrentM3u(); 469 writeCurrentM3u();
470} 470}
471 471
472 472
473void PlayListWidget::playIt( QListViewItem *it) { 473void PlayListWidget::playIt( QListViewItem *it) {
474 if(!it) return; 474 if(!it) return;
475 mediaPlayerState->setPlaying(FALSE); 475 mediaPlayerState->setPlaying(FALSE);
476 mediaPlayerState->setPlaying(TRUE); 476 mediaPlayerState->setPlaying(TRUE);
477 d->selectedFiles->unSelect(); 477 d->selectedFiles->unSelect();
478} 478}
479 479
480 480
481void PlayListWidget::addToSelection( QListViewItem *it) { 481void PlayListWidget::addToSelection( QListViewItem *it) {
482 d->setDocumentUsed = FALSE; 482 d->setDocumentUsed = FALSE;
483 483
484 if(it) { 484 if(it) {
485 if ( currentTab() == CurrentPlayList ) 485 if ( currentTab() == CurrentPlayList )
486 return; 486 return;
487 DocLnk lnk; 487 DocLnk lnk;
488 QString filename; 488 QString filename;
489 489
490 filename=it->text(3); 490 filename=it->text(3);
491 lnk.setName( QFileInfo(filename).baseName() ); //sets name 491 lnk.setName( QFileInfo(filename).baseName() ); //sets name
492 lnk.setFile( filename ); //sets file name 492 lnk.setFile( filename ); //sets file name
493 d->selectedFiles->addToSelection( lnk); 493 d->selectedFiles->addToSelection( lnk);
494 494
495 writeCurrentM3u(); 495 writeCurrentM3u();
496// tabWidget->setCurrentPage(0); 496// tabWidget->setCurrentPage(0);
497 497
498 } 498 }
499} 499}
500 500
501 501
502void PlayListWidget::tabChanged(QWidget *) { 502void PlayListWidget::tabChanged(QWidget *) {
503 503
504 d->tbPlay->setEnabled( true ); 504 d->tbPlay->setEnabled( true );
505 505
506 disconnect( audioView, SIGNAL( itemsSelected( bool ) ), 506 disconnect( audioView, SIGNAL( itemsSelected(bool) ),
507 d->tbPlay, SLOT( setEnabled( bool ) ) ); 507 d->tbPlay, SLOT( setEnabled(bool) ) );
508 disconnect( videoView, SIGNAL( itemsSelected( bool ) ), 508 disconnect( videoView, SIGNAL( itemsSelected(bool) ),
509 d->tbPlay, SLOT( setEnabled( bool ) ) ); 509 d->tbPlay, SLOT( setEnabled(bool) ) );
510 510
511 currentFileListView = 0; 511 currentFileListView = 0;
512 512
513 switch ( currentTab() ) { 513 switch ( currentTab() ) {
514 case CurrentPlayList: 514 case CurrentPlayList:
515 { 515 {
516 if( !tbDeletePlaylist->isHidden() ) { 516 if( !tbDeletePlaylist->isHidden() ) {
517 tbDeletePlaylist->hide(); 517 tbDeletePlaylist->hide();
518 } 518 }
519 d->tbRemoveFromList->setEnabled(TRUE); 519 d->tbRemoveFromList->setEnabled(TRUE);
520 d->tbAddToList->setEnabled(FALSE); 520 d->tbAddToList->setEnabled(FALSE);
521 521
522 d->tbPlay->setEnabled( !d->selectedFiles->isEmpty() ); 522 d->tbPlay->setEnabled( !d->selectedFiles->isEmpty() );
523 } 523 }
524 break; 524 break;
525 case AudioFiles: 525 case AudioFiles:
526 { 526 {
527 audioView->populateView(); 527 audioView->populateView();
528 528
529 if( !tbDeletePlaylist->isHidden() ) { 529 if( !tbDeletePlaylist->isHidden() ) {
530 tbDeletePlaylist->hide(); 530 tbDeletePlaylist->hide();
531 } 531 }
532 d->tbRemoveFromList->setEnabled(FALSE); 532 d->tbRemoveFromList->setEnabled(FALSE);
533 d->tbAddToList->setEnabled(TRUE); 533 d->tbAddToList->setEnabled(TRUE);
534 534
535 connect( audioView, SIGNAL( itemsSelected( bool ) ), 535 connect( audioView, SIGNAL( itemsSelected(bool) ),
536 d->tbPlay, SLOT( setEnabled( bool ) ) ); 536 d->tbPlay, SLOT( setEnabled(bool) ) );
537 537
538 d->tbPlay->setEnabled( audioView->hasSelection() ); 538 d->tbPlay->setEnabled( audioView->hasSelection() );
539 539
540 currentFileListView = audioView; 540 currentFileListView = audioView;
541 } 541 }
542 break; 542 break;
543 case VideoFiles: 543 case VideoFiles:
544 { 544 {
545 videoView->populateView(); 545 videoView->populateView();
546 if( !tbDeletePlaylist->isHidden() ) { 546 if( !tbDeletePlaylist->isHidden() ) {
547 tbDeletePlaylist->hide(); 547 tbDeletePlaylist->hide();
548 } 548 }
549 d->tbRemoveFromList->setEnabled(FALSE); 549 d->tbRemoveFromList->setEnabled(FALSE);
550 d->tbAddToList->setEnabled(TRUE); 550 d->tbAddToList->setEnabled(TRUE);
551 551
552 connect( videoView, SIGNAL( itemsSelected( bool ) ), 552 connect( videoView, SIGNAL( itemsSelected(bool) ),
553 d->tbPlay, SLOT( setEnabled( bool ) ) ); 553 d->tbPlay, SLOT( setEnabled(bool) ) );
554 554
555 d->tbPlay->setEnabled( videoView->hasSelection() ); 555 d->tbPlay->setEnabled( videoView->hasSelection() );
556 556
557 currentFileListView = videoView; 557 currentFileListView = videoView;
558 } 558 }
559 break; 559 break;
560 case PlayLists: 560 case PlayLists:
561 { 561 {
562 if( tbDeletePlaylist->isHidden() ) { 562 if( tbDeletePlaylist->isHidden() ) {
563 tbDeletePlaylist->show(); 563 tbDeletePlaylist->show();
564 } 564 }
565 playLists->reread(); 565 playLists->reread();
566 d->tbAddToList->setEnabled(FALSE); 566 d->tbAddToList->setEnabled(FALSE);
567 567
568 d->tbPlay->setEnabled( false ); 568 d->tbPlay->setEnabled( false );
569 } 569 }
570 break; 570 break;
571 }; 571 };
572} 572}
573 573
574 574
575void PlayListWidget::btnPlay(bool b) { 575void PlayListWidget::btnPlay(bool b) {
576// mediaPlayerState->setPlaying(false); 576// mediaPlayerState->setPlaying(false);
577 mediaPlayerState->setPlaying(b); 577 mediaPlayerState->setPlaying(b);
578 insanityBool=FALSE; 578 insanityBool=FALSE;
579} 579}
580 580
581void PlayListWidget::deletePlaylist() { 581void PlayListWidget::deletePlaylist() {
582 switch( QMessageBox::information( this, (tr("Remove Playlist?")), 582 switch( QMessageBox::information( this, (tr("Remove Playlist?")),
583 (tr("You really want to delete\nthis playlist?")), 583 (tr("You really want to delete\nthis playlist?")),
584 (tr("Yes")), (tr("No")), 0 )){ 584 (tr("Yes")), (tr("No")), 0 )){
585 case 0: // Yes clicked, 585 case 0: // Yes clicked,
586 QFile().remove(playLists->selectedDocument().file()); 586 QFile().remove(playLists->selectedDocument().file());
587 QFile().remove(playLists->selectedDocument().linkFile()); 587 QFile().remove(playLists->selectedDocument().linkFile());
588 playLists->reread(); 588 playLists->reread();
589 break; 589 break;
590 case 1: // Cancel 590 case 1: // Cancel
591 break; 591 break;
592 }; 592 };
593} 593}
594 594
595 595
596void PlayListWidget::playSelected() { 596void PlayListWidget::playSelected() {
597 btnPlay( TRUE); 597 btnPlay( TRUE);
598} 598}
599 599
600bool PlayListWidget::inFileListMode() const 600bool PlayListWidget::inFileListMode() const
601{ 601{
602 TabType tab = currentTab(); 602 TabType tab = currentTab();
603 return tab == AudioFiles || tab == VideoFiles; 603 return tab == AudioFiles || tab == VideoFiles;
604} 604}
605 605
606void PlayListWidget::openURL() { 606void PlayListWidget::openURL() {
607 // http://66.28.164.33:2080 607 // http://66.28.164.33:2080
608 // http://somafm.com/star0242.m3u 608 // http://somafm.com/star0242.m3u
609 QString filename, name; 609 QString filename, name;
610 InputDialog *fileDlg; 610 InputDialog *fileDlg;
611 fileDlg = new InputDialog(this,tr("Add URL"),TRUE, 0); 611 fileDlg = new InputDialog(this,tr("Add URL"),TRUE, 0);
612 fileDlg->exec(); 612 fileDlg->exec();
613 if( fileDlg->result() == 1 ) { 613 if( fileDlg->result() == 1 ) {
614 filename = fileDlg->text(); 614 filename = fileDlg->text();
615 qDebug( "Selected filename is " + filename ); 615 qDebug( "Selected filename is " + filename );
616 // Om3u *m3uList; 616 // Om3u *m3uList;
617 DocLnk lnk; 617 DocLnk lnk;
618 Config cfg( "OpiePlayer" ); 618 Config cfg( "OpiePlayer" );
619 cfg.setGroup("PlayList"); 619 cfg.setGroup("PlayList");
620 620
621 if(filename.left(4) == "http") { 621 if(filename.left(4) == "http") {
622 QString m3uFile, m3uFilePath; 622 QString m3uFile, m3uFilePath;
623 if(filename.find(":",8,TRUE) != -1) { //found a port 623 if(filename.find(":",8,TRUE) != -1) { //found a port
624 m3uFile = filename.left( filename.find( ":",8,TRUE)); 624 m3uFile = filename.left( filename.find( ":",8,TRUE));
625 m3uFile = m3uFile.right( 7); 625 m3uFile = m3uFile.right( 7);
626 } else if(filename.left(4) == "http"){ 626 } else if(filename.left(4) == "http"){
627 m3uFile=filename; 627 m3uFile=filename;
628 m3uFile = m3uFile.right( m3uFile.length() - 7); 628 m3uFile = m3uFile.right( m3uFile.length() - 7);
629 } else{ 629 } else{
630 m3uFile=filename; 630 m3uFile=filename;
631 } 631 }
632 632
633 lnk.setName( filename ); //sets name 633 lnk.setName( filename ); //sets name
634 lnk.setFile( filename ); //sets file name 634 lnk.setFile( filename ); //sets file name
635 635
636// lnk.setIcon("opieplayer2/musicfile"); 636// lnk.setIcon("opieplayer2/musicfile");
637 637
638 d->selectedFiles->addToSelection( lnk ); 638 d->selectedFiles->addToSelection( lnk );
639 writeCurrentM3u(); 639 writeCurrentM3u();
640 d->selectedFiles->setSelectedItem( lnk.name()); 640 d->selectedFiles->setSelectedItem( lnk.name());
641 } 641 }
642 else if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) { 642 else if( filename.right( 3) == "m3u" || filename.right(3) == "pls" ) {
643 readListFromFile( filename ); 643 readListFromFile( filename );
644 } else { 644 } else {
645 lnk.setName( QFileInfo(filename).baseName() ); //sets name 645 lnk.setName( QFileInfo(filename).baseName() ); //sets name
646 lnk.setFile( filename ); //sets file name 646 lnk.setFile( filename ); //sets file name
647 d->selectedFiles->addToSelection( lnk); 647 d->selectedFiles->addToSelection( lnk);
648 writeCurrentM3u(); 648 writeCurrentM3u();
649 d->selectedFiles->setSelectedItem( lnk.name()); 649 d->selectedFiles->setSelectedItem( lnk.name());
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
index fec91ea..33fe188 100644
--- a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
@@ -8,187 +8,187 @@
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 34
35#include <qtoolbar.h> 35#include <qtoolbar.h>
36#include <qpe/qpeapplication.h> 36#include <qpe/qpeapplication.h>
37 37
38#include <qlayout.h> 38#include <qlayout.h>
39#include <qmenubar.h> 39#include <qmenubar.h>
40 40
41#include "playlistselection.h" 41#include "playlistselection.h"
42#include "playlistwidget.h" 42#include "playlistwidget.h"
43#include "mediaplayerstate.h" 43#include "mediaplayerstate.h"
44#include "inputDialog.h" 44#include "inputDialog.h"
45#include "playlistfileview.h" 45#include "playlistfileview.h"
46 46
47#include "mediaplayerstate.h" 47#include "mediaplayerstate.h"
48 48
49PlayListWidgetGui::PlayListWidgetGui(QWidget* parent, const char* name ) 49PlayListWidgetGui::PlayListWidgetGui(QWidget* parent, const char* name )
50 : QMainWindow( parent, name ) { 50 : QMainWindow( parent, name ) {
51 51
52 d = new PlayListWidgetPrivate; 52 d = new PlayListWidgetPrivate;
53 d->setDocumentUsed = FALSE; 53 d->setDocumentUsed = FALSE;
54 54
55 setBackgroundMode( PaletteButton ); 55 setBackgroundMode( PaletteButton );
56 setToolBarsMovable( FALSE ); 56 setToolBarsMovable( FALSE );
57 57
58 // Create Toolbar 58 // Create Toolbar
59 QToolBar *toolbar = new QToolBar( this ); 59 QToolBar *toolbar = new QToolBar( this );
60 toolbar->setHorizontalStretchable( TRUE ); 60 toolbar->setHorizontalStretchable( TRUE );
61 61
62 // Create Menubar 62 // Create Menubar
63 QMenuBar *menu = new QMenuBar( toolbar ); 63 QMenuBar *menu = new QMenuBar( toolbar );
64 menu->setMargin( 0 ); 64 menu->setMargin( 0 );
65 65
66 bar = new QToolBar( this ); 66 bar = new QToolBar( this );
67 bar->setLabel( tr( "Play Operations" ) ); 67 bar->setLabel( tr( "Play Operations" ) );
68 68
69 tbDeletePlaylist = new QPushButton( Resource::loadIconSet( "trash" ), "", bar, "close" ); 69 tbDeletePlaylist = new QPushButton( Resource::loadIconSet( "trash" ), "", bar, "close" );
70 tbDeletePlaylist->setFlat( TRUE ); 70 tbDeletePlaylist->setFlat( TRUE );
71 tbDeletePlaylist->setFixedSize( 20, 20 ); 71 tbDeletePlaylist->setFixedSize( 20, 20 );
72 72
73 tbDeletePlaylist->hide(); 73 tbDeletePlaylist->hide();
74 74
75 pmPlayList = new QPopupMenu( this ); 75 pmPlayList = new QPopupMenu( this );
76 menu->insertItem( tr( "File" ), pmPlayList ); 76 menu->insertItem( tr( "File" ), pmPlayList );
77 77
78 pmView = new QPopupMenu( this ); 78 pmView = new QPopupMenu( this );
79 menu->insertItem( tr( "View" ), pmView ); 79 menu->insertItem( tr( "View" ), pmView );
80 pmView->isCheckable(); 80 pmView->isCheckable();
81 81
82 skinsMenu = new QPopupMenu( this ); 82 skinsMenu = new QPopupMenu( this );
83 pmView->insertItem( tr( "Skins" ), skinsMenu ); 83 pmView->insertItem( tr( "Skins" ), skinsMenu );
84 skinsMenu->isCheckable(); 84 skinsMenu->isCheckable();
85 85
86 gammaMenu = new QPopupMenu( this ); 86 gammaMenu = new QPopupMenu( this );
87 pmView->insertItem( tr( "Gamma (Video)" ), gammaMenu ); 87 pmView->insertItem( tr( "Gamma (Video)" ), gammaMenu );
88 88
89 gammaSlider = new QSlider( QSlider::Vertical, gammaMenu ); 89 gammaSlider = new QSlider( QSlider::Vertical, gammaMenu );
90 gammaSlider->setRange( -40, 40 ); 90 gammaSlider->setRange( -40, 40 );
91 gammaSlider->setTickmarks( QSlider::Left ); 91 gammaSlider->setTickmarks( QSlider::Left );
92 gammaSlider->setTickInterval( 20 ); 92 gammaSlider->setTickInterval( 20 );
93 gammaSlider->setFocusPolicy( QWidget::StrongFocus ); 93 gammaSlider->setFocusPolicy( QWidget::StrongFocus );
94 gammaSlider->setValue( 0 ); 94 gammaSlider->setValue( 0 );
95 gammaSlider->setMinimumHeight( 50 ); 95 gammaSlider->setMinimumHeight( 50 );
96 96
97 gammaLCD = new QLCDNumber( 3, gammaMenu ); 97 gammaLCD = new QLCDNumber( 3, gammaMenu );
98 gammaLCD-> setFrameShape ( QFrame::NoFrame ); 98 gammaLCD-> setFrameShape ( QFrame::NoFrame );
99 gammaLCD-> setSegmentStyle ( QLCDNumber::Flat ); 99 gammaLCD-> setSegmentStyle ( QLCDNumber::Flat );
100 100
101 gammaMenu->insertItem( gammaSlider ); 101 gammaMenu->insertItem( gammaSlider );
102 gammaMenu->insertItem( gammaLCD ); 102 gammaMenu->insertItem( gammaLCD );
103 103
104 connect( gammaSlider, SIGNAL( valueChanged( int ) ), gammaLCD, SLOT( display( int ) ) ); 104 connect( gammaSlider, SIGNAL( valueChanged(int) ), gammaLCD, SLOT( display(int) ) );
105 105
106 vbox5 = new QVBox( this ); 106 vbox5 = new QVBox( this );
107 QVBox *vbox4 = new QVBox( vbox5 ); 107 QVBox *vbox4 = new QVBox( vbox5 );
108 QHBox *hbox6 = new QHBox( vbox4 ); 108 QHBox *hbox6 = new QHBox( vbox4 );
109 109
110 tabWidget = new QTabWidget( hbox6, "tabWidget" ); 110 tabWidget = new QTabWidget( hbox6, "tabWidget" );
111 111
112 playListTab = new QWidget( tabWidget, "PlayListTab" ); 112 playListTab = new QWidget( tabWidget, "PlayListTab" );
113 tabWidget->insertTab( playListTab, "Playlist"); 113 tabWidget->insertTab( playListTab, "Playlist");
114 114
115 QGridLayout *Playout = new QGridLayout( playListTab ); 115 QGridLayout *Playout = new QGridLayout( playListTab );
116 Playout->setSpacing( 2); 116 Playout->setSpacing( 2);
117 Playout->setMargin( 2); 117 Playout->setMargin( 2);
118 118
119 // Add the playlist area 119 // Add the playlist area
120 QVBox *vbox3 = new QVBox( playListTab ); 120 QVBox *vbox3 = new QVBox( playListTab );
121 d->playListFrame = vbox3; 121 d->playListFrame = vbox3;
122 122
123 QHBox *hbox2 = new QHBox( vbox3 ); 123 QHBox *hbox2 = new QHBox( vbox3 );
124 d->selectedFiles = new PlayListSelection( hbox2 ); 124 d->selectedFiles = new PlayListSelection( hbox2 );
125 125
126 vbox1 = new QVBox( hbox2 ); 126 vbox1 = new QVBox( hbox2 );
127 QPEApplication::setStylusOperation( d->selectedFiles->viewport(), QPEApplication::RightOnHold ); 127 QPEApplication::setStylusOperation( d->selectedFiles->viewport(), QPEApplication::RightOnHold );
128 QVBox *stretch1 = new QVBox( vbox1 ); // add stretch 128 QVBox *stretch1 = new QVBox( vbox1 ); // add stretch
129 129
130 Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 ); 130 Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 );
131 131
132 QWidget *aTab; 132 QWidget *aTab;
133 aTab = new QWidget( tabWidget, "aTab" ); 133 aTab = new QWidget( tabWidget, "aTab" );
134 134
135 QGridLayout *Alayout = new QGridLayout( aTab ); 135 QGridLayout *Alayout = new QGridLayout( aTab );
136 Alayout->setSpacing( 2 ); 136 Alayout->setSpacing( 2 );
137 Alayout->setMargin( 2 ); 137 Alayout->setMargin( 2 );
138 // no m3u's here please 138 // no m3u's here please
139 audioView = new PlayListFileView( "audio/mpeg;audio/x-wav;application/ogg", "opieplayer2/musicfile", aTab, "Audioview" ); 139 audioView = new PlayListFileView( "audio/mpeg;audio/x-wav;application/ogg", "opieplayer2/musicfile", aTab, "Audioview" );
140 Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 ); 140 Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 );
141 tabWidget->insertTab( aTab, tr( "Audio" ) ); 141 tabWidget->insertTab( aTab, tr( "Audio" ) );
142 142
143 QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold ); 143 QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold );
144 144
145 QWidget *vTab; 145 QWidget *vTab;
146 vTab = new QWidget( tabWidget, "vTab" ); 146 vTab = new QWidget( tabWidget, "vTab" );
147 147
148 QGridLayout *Vlayout = new QGridLayout( vTab ); 148 QGridLayout *Vlayout = new QGridLayout( vTab );
149 Vlayout->setSpacing( 2 ); 149 Vlayout->setSpacing( 2 );
150 Vlayout->setMargin( 2 ); 150 Vlayout->setMargin( 2 );
151 videoView = new PlayListFileView( "video/*", "opieplayer2/videofile", vTab, "Videoview" ); 151 videoView = new PlayListFileView( "video/*", "opieplayer2/videofile", vTab, "Videoview" );
152 Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 ); 152 Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 );
153 153
154 QPEApplication::setStylusOperation( videoView->viewport(), QPEApplication::RightOnHold ); 154 QPEApplication::setStylusOperation( videoView->viewport(), QPEApplication::RightOnHold );
155 155
156 tabWidget->insertTab( vTab, tr( "Video" ) ); 156 tabWidget->insertTab( vTab, tr( "Video" ) );
157 157
158 //playlists list 158 //playlists list
159 QWidget *LTab; 159 QWidget *LTab;
160 LTab = new QWidget( tabWidget, "LTab" ); 160 LTab = new QWidget( tabWidget, "LTab" );
161 QGridLayout *Llayout = new QGridLayout( LTab ); 161 QGridLayout *Llayout = new QGridLayout( LTab );
162 Llayout->setSpacing( 2 ); 162 Llayout->setSpacing( 2 );
163 Llayout->setMargin( 2 ); 163 Llayout->setMargin( 2 );
164 164
165 playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE ); 165 playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE );
166 Llayout->addMultiCellWidget( playLists, 0, 0, 0, 1 ); 166 Llayout->addMultiCellWidget( playLists, 0, 0, 0, 1 );
167 167
168 tabWidget->insertTab( LTab, tr( "Lists" ) ); 168 tabWidget->insertTab( LTab, tr( "Lists" ) );
169 169
170 setCentralWidget( vbox5 ); 170 setCentralWidget( vbox5 );
171} 171}
172 172
173 173
174 174
175PlayListWidgetGui::~PlayListWidgetGui() { 175PlayListWidgetGui::~PlayListWidgetGui() {
176} 176}
177 177
178void PlayListWidgetGui::setView( char view ) { 178void PlayListWidgetGui::setView( char view ) {
179 if ( view == 'l' ) 179 if ( view == 'l' )
180 showMaximized(); 180 showMaximized();
181 else 181 else
182 hide(); 182 hide();
183} 183}
184 184
185 185
186void PlayListWidgetGui::setActiveWindow() { 186void PlayListWidgetGui::setActiveWindow() {
187 // qDebug("SETTING active window"); 187 // qDebug("SETTING active window");
188 // When we get raised we need to ensure that it switches views 188 // When we get raised we need to ensure that it switches views
189 MediaPlayerState::DisplayType origDisplayType = mediaPlayerState->displayType(); 189 MediaPlayerState::DisplayType origDisplayType = mediaPlayerState->displayType();
190 mediaPlayerState->setDisplayType( MediaPlayerState::MediaSelection ); // invalidate 190 mediaPlayerState->setDisplayType( MediaPlayerState::MediaSelection ); // invalidate
191 mediaPlayerState->setDisplayType( origDisplayType ); // now switch back 191 mediaPlayerState->setDisplayType( origDisplayType ); // now switch back
192} 192}
193 193
194 194
diff --git a/noncore/multimedia/opieplayer2/threadutil.cpp b/noncore/multimedia/opieplayer2/threadutil.cpp
index ff38b1e..fb951b4 100644
--- a/noncore/multimedia/opieplayer2/threadutil.cpp
+++ b/noncore/multimedia/opieplayer2/threadutil.cpp
@@ -147,193 +147,193 @@ static void terminate_thread( void *arg )
147 Thread::Data *data = ( Thread::Data* )arg; 147 Thread::Data *data = ( Thread::Data* )arg;
148 148
149 assert( data ); 149 assert( data );
150 150
151 AutoLock locker( data->guard ); 151 AutoLock locker( data->guard );
152 data->isRunning = false; 152 data->isRunning = false;
153 data->finishCondition.wakeAll(); 153 data->finishCondition.wakeAll();
154} 154}
155 155
156static void *start_thread( void *arg ) 156static void *start_thread( void *arg )
157{ 157{
158 Thread::Data *data = ( Thread::Data* )arg; 158 Thread::Data *data = ( Thread::Data* )arg;
159 159
160 pthread_cleanup_push( terminate_thread, data ); 160 pthread_cleanup_push( terminate_thread, data );
161 161
162 data->isRunning = true; 162 data->isRunning = true;
163 data->run(); 163 data->run();
164 164
165 pthread_cleanup_pop( true ); 165 pthread_cleanup_pop( true );
166 166
167 Thread::exit(); 167 Thread::exit();
168 return 0; // never reached 168 return 0; // never reached
169} 169}
170 170
171} 171}
172 172
173Thread::Thread() 173Thread::Thread()
174 : d( new Data ) 174 : d( new Data )
175{ 175{
176 d->thr = this; 176 d->thr = this;
177} 177}
178 178
179Thread::~Thread() 179Thread::~Thread()
180{ 180{
181 assert( d->isRunning == false ); 181 assert( d->isRunning == false );
182 delete d; 182 delete d;
183} 183}
184 184
185void Thread::start() 185void Thread::start()
186{ 186{
187 AutoLock lock( d->guard ); 187 AutoLock lock( d->guard );
188 188
189 if ( d->isRunning ) { 189 if ( d->isRunning ) {
190 qDebug( "ThreadUtil::Thread::start() called for running thread." ); 190 qDebug( "ThreadUtil::Thread::start() called for running thread." );
191 return; 191 return;
192 } 192 }
193 193
194 pthread_attr_t attributes; 194 pthread_attr_t attributes;
195 pthread_attr_init( &attributes ); 195 pthread_attr_init( &attributes );
196 pthread_attr_setscope( &attributes, PTHREAD_SCOPE_SYSTEM ); 196 pthread_attr_setscope( &attributes, PTHREAD_SCOPE_SYSTEM );
197 int err = pthread_create( &d->self, &attributes, start_thread, ( void* )d ); 197 int err = pthread_create( &d->self, &attributes, start_thread, ( void* )d );
198 if ( err != 0 ) { 198 if ( err != 0 ) {
199 qDebug( "ThreadUtil::Thread::start() : can't create thread: %s", strerror( err ) ); 199 qDebug( "ThreadUtil::Thread::start() : can't create thread: %s", strerror( err ) );
200 pthread_attr_destroy( &attributes ); 200 pthread_attr_destroy( &attributes );
201 return; 201 return;
202 } 202 }
203 pthread_attr_destroy( &attributes ); 203 pthread_attr_destroy( &attributes );
204} 204}
205 205
206void Thread::terminate() 206void Thread::terminate()
207{ 207{
208 AutoLock lock( d->guard ); 208 AutoLock lock( d->guard );
209 if ( !d->isRunning ) 209 if ( !d->isRunning )
210 return; 210 return;
211 211
212 pthread_cancel( d->self ); 212 pthread_cancel( d->self );
213} 213}
214 214
215bool Thread::wait() 215bool Thread::wait()
216{ 216{
217 AutoLock lock( d->guard ); 217 AutoLock lock( d->guard );
218 if ( !d->isRunning ) 218 if ( !d->isRunning )
219 return true; 219 return true;
220 220
221 return d->finishCondition.wait( d->guard ); 221 return d->finishCondition.wait( d->guard );
222} 222}
223 223
224bool Thread::isRunning() const 224bool Thread::isRunning() const
225{ 225{
226 AutoLock lock( d->guard ); 226 AutoLock lock( d->guard );
227 return d->isRunning; 227 return d->isRunning;
228} 228}
229 229
230void Thread::exit() 230void Thread::exit()
231{ 231{
232 pthread_exit( 0 ); 232 pthread_exit( 0 );
233} 233}
234 234
235OnewayNotifier::OnewayNotifier() 235OnewayNotifier::OnewayNotifier()
236{ 236{
237 int fds[ 2 ]; 237 int fds[ 2 ];
238 pipe( fds ); 238 pipe( fds );
239 m_readFd = fds[ 0 ]; 239 m_readFd = fds[ 0 ];
240 m_writeFd = fds[ 1 ]; 240 m_writeFd = fds[ 1 ];
241 241
242 m_notifier = new QSocketNotifier( m_readFd, QSocketNotifier::Read ); 242 m_notifier = new QSocketNotifier( m_readFd, QSocketNotifier::Read );
243 connect( m_notifier, SIGNAL( activated( int ) ), 243 connect( m_notifier, SIGNAL( activated(int) ),
244 this, SLOT( wakeUp() ) ); 244 this, SLOT( wakeUp() ) );
245} 245}
246 246
247OnewayNotifier::~OnewayNotifier() 247OnewayNotifier::~OnewayNotifier()
248{ 248{
249 delete m_notifier; 249 delete m_notifier;
250 250
251 ::close( m_readFd ); 251 ::close( m_readFd );
252 ::close( m_writeFd ); 252 ::close( m_writeFd );
253} 253}
254 254
255void OnewayNotifier::notify() 255void OnewayNotifier::notify()
256{ 256{
257 const char c = 42; 257 const char c = 42;
258 ::write( m_writeFd, &c, 1 ); 258 ::write( m_writeFd, &c, 1 );
259} 259}
260 260
261void OnewayNotifier::wakeUp() 261void OnewayNotifier::wakeUp()
262{ 262{
263 char c = 0; 263 char c = 0;
264 264
265 if ( ::read( m_readFd, &c, 1 ) != 1 ) 265 if ( ::read( m_readFd, &c, 1 ) != 1 )
266 return; 266 return;
267 267
268 emit awake(); 268 emit awake();
269} 269}
270 270
271ChannelMessage::ChannelMessage( int type ) 271ChannelMessage::ChannelMessage( int type )
272 : m_type( type ), m_isCall( false ), m_replied( false ), 272 : m_type( type ), m_isCall( false ), m_replied( false ),
273 m_inEventHandler( false ) 273 m_inEventHandler( false )
274{ 274{
275} 275}
276 276
277ChannelMessage::~ChannelMessage() 277ChannelMessage::~ChannelMessage()
278{ 278{
279 if ( m_guard.isLocked() ) 279 if ( m_guard.isLocked() )
280 m_guard.unlock(); 280 m_guard.unlock();
281} 281}
282 282
283void ChannelMessage::reply() 283void ChannelMessage::reply()
284{ 284{
285 if ( !m_isCall ) 285 if ( !m_isCall )
286 { 286 {
287 qDebug( "ChannelMessage::reply() - can't reply oneway message!" ); 287 qDebug( "ChannelMessage::reply() - can't reply oneway message!" );
288 return; 288 return;
289 } 289 }
290 290
291 if ( m_inEventHandler ) 291 if ( m_inEventHandler )
292 { 292 {
293 m_replied = true; 293 m_replied = true;
294 return; 294 return;
295 } 295 }
296 296
297 m_condition.wakeOne(); 297 m_condition.wakeOne();
298 m_guard.unlock(); 298 m_guard.unlock();
299} 299}
300 300
301struct Channel::Private 301struct Channel::Private
302{ 302{
303 Private() 303 Private()
304 { 304 {
305 ownerThread = pthread_self(); 305 ownerThread = pthread_self();
306 } 306 }
307 307
308 pthread_t ownerThread; 308 pthread_t ownerThread;
309}; 309};
310 310
311Channel::Channel( QObject *parent, const char *name ) 311Channel::Channel( QObject *parent, const char *name )
312 : QObject( parent, name ), d( new Private ) 312 : QObject( parent, name ), d( new Private )
313{ 313{
314 connect( &m_notifier, SIGNAL( awake() ), 314 connect( &m_notifier, SIGNAL( awake() ),
315 this, SLOT( deliver() ) ); 315 this, SLOT( deliver() ) );
316} 316}
317 317
318Channel::~Channel() 318Channel::~Channel()
319{ 319{
320 delete d; 320 delete d;
321} 321}
322 322
323void Channel::send( ChannelMessage *message, SendType type ) 323void Channel::send( ChannelMessage *message, SendType type )
324{ 324{
325 if ( type == WaitForReply ) 325 if ( type == WaitForReply )
326 { 326 {
327 message->m_guard.lock(); 327 message->m_guard.lock();
328 message->m_isCall = true; 328 message->m_isCall = true;
329 } 329 }
330 330
331 m_pendingMessagesGuard.lock(); 331 m_pendingMessagesGuard.lock();
332 m_pendingMessages << MsgEnvelope( type, message ); 332 m_pendingMessages << MsgEnvelope( type, message );
333 m_pendingMessagesGuard.unlock(); 333 m_pendingMessagesGuard.unlock();
334 334
335 if ( d->ownerThread == pthread_self() ) { 335 if ( d->ownerThread == pthread_self() ) {
336 assert( type != WaitForReply ); 336 assert( type != WaitForReply );
337 337
338 deliver(); 338 deliver();
339 } 339 }
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index c829e03..a4d09f5 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -1,171 +1,171 @@
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#include "videowidget.h" 34#include "videowidget.h"
35#include "mediaplayerstate.h" 35#include "mediaplayerstate.h"
36#include "playlistwidget.h" 36#include "playlistwidget.h"
37 37
38 38
39#ifdef Q_WS_QWS 39#ifdef Q_WS_QWS
40# define USE_DIRECT_PAINTER 40# define USE_DIRECT_PAINTER
41# include <qdirectpainter_qws.h> 41# include <qdirectpainter_qws.h>
42# include <qgfxraster_qws.h> 42# include <qgfxraster_qws.h>
43#endif 43#endif
44 44
45 45
46namespace 46namespace
47{ 47{
48 48
49const int xo = 2; // movable x offset 49const int xo = 2; // movable x offset
50const int yo = 0; // movable y offset 50const int yo = 0; // movable y offset
51 51
52const MediaWidget::SkinButtonInfo skinInfo[] = 52const MediaWidget::SkinButtonInfo skinInfo[] =
53{ 53{
54 { MediaWidget::Play, "play", MediaWidget::ToggleButton }, 54 { MediaWidget::Play, "play", MediaWidget::ToggleButton },
55 { MediaWidget::Stop, "stop", MediaWidget::NormalButton }, 55 { MediaWidget::Stop, "stop", MediaWidget::NormalButton },
56 { MediaWidget::Next, "fwd", MediaWidget::NormalButton }, 56 { MediaWidget::Next, "fwd", MediaWidget::NormalButton },
57 { MediaWidget::Previous, "back", MediaWidget::NormalButton }, 57 { MediaWidget::Previous, "back", MediaWidget::NormalButton },
58 { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton }, 58 { MediaWidget::VolumeUp, "up", MediaWidget::NormalButton },
59 { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton }, 59 { MediaWidget::VolumeDown, "down", MediaWidget::NormalButton },
60 { MediaWidget::FullScreen, "full", MediaWidget::ToggleButton } 60 { MediaWidget::FullScreen, "full", MediaWidget::ToggleButton }
61}; 61};
62 62
63const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] ); 63const uint buttonCount = sizeof( skinInfo ) / sizeof( skinInfo[ 0 ] );
64 64
65} 65}
66 66
67VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) 67VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name )
68 : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ), videoSliderBeingMoved( false ) 68 : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ), videoSliderBeingMoved( false )
69{ 69{
70 setCaption( tr("OpiePlayer - Video") ); 70 setCaption( tr("OpiePlayer - Video") );
71 71
72 videoFrame = new XineVideoWidget ( this, "Video frame" ); 72 videoFrame = new XineVideoWidget ( this, "Video frame" );
73 73
74 connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); 74 connect ( videoFrame, SIGNAL( videoResized(const QSize&)), this, SIGNAL( videoResized(const QSize&)));
75 connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); 75 connect ( videoFrame, SIGNAL( clicked() ), this, SLOT ( backToNormal() ) );
76 76
77 slider = 0; 77 slider = 0;
78 78
79 loadSkin(); 79 loadSkin();
80 80
81 setLength( mediaPlayerState.length() ); 81 setLength( mediaPlayerState.length() );
82 setPosition( mediaPlayerState.position() ); 82 setPosition( mediaPlayerState.position() );
83 setFullscreen( mediaPlayerState.isFullscreen() ); 83 setFullscreen( mediaPlayerState.isFullscreen() );
84 setPlaying( mediaPlayerState.isPlaying() ); 84 setPlaying( mediaPlayerState.isPlaying() );
85} 85}
86 86
87 87
88VideoWidget::~VideoWidget() 88VideoWidget::~VideoWidget()
89{ 89{
90} 90}
91 91
92MediaWidget::GUIInfo VideoWidget::guiInfo() 92MediaWidget::GUIInfo VideoWidget::guiInfo()
93{ 93{
94 return GUIInfo( "V" /* infix */, ::skinInfo, ::buttonCount ); 94 return GUIInfo( "V" /* infix */, ::skinInfo, ::buttonCount );
95} 95}
96 96
97void VideoWidget::resizeEvent( QResizeEvent *e ) { 97void VideoWidget::resizeEvent( QResizeEvent *e ) {
98 int h = height(); 98 int h = height();
99 int w = width(); 99 int w = width();
100 //int Vh = 160; 100 //int Vh = 160;
101 //int Vw = 220; 101 //int Vw = 220;
102 102
103 slider->setFixedWidth( w - 20 ); 103 slider->setFixedWidth( w - 20 );
104 slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); 104 slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) );
105 slider->setBackgroundOrigin( QWidget::ParentOrigin ); 105 slider->setBackgroundOrigin( QWidget::ParentOrigin );
106 slider->setFocusPolicy( QWidget::NoFocus ); 106 slider->setFocusPolicy( QWidget::NoFocus );
107 slider->setBackgroundPixmap( backgroundPixmap ); 107 slider->setBackgroundPixmap( backgroundPixmap );
108 108
109 upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2; 109 upperLeftOfButtonMask.rx() = 0;// ( imgUp->width() ) / 2;
110 if(w>h) 110 if(w>h)
111 upperLeftOfButtonMask.ry() = 0; 111 upperLeftOfButtonMask.ry() = 0;
112 else 112 else
113 upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10; 113 upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10;
114 114
115 MediaWidget::resizeEvent( e ); 115 MediaWidget::resizeEvent( e );
116} 116}
117 117
118void VideoWidget::sliderPressed() { 118void VideoWidget::sliderPressed() {
119 videoSliderBeingMoved = TRUE; 119 videoSliderBeingMoved = TRUE;
120} 120}
121 121
122void VideoWidget::sliderReleased() { 122void VideoWidget::sliderReleased() {
123 videoSliderBeingMoved = FALSE; 123 videoSliderBeingMoved = FALSE;
124 if ( slider->width() == 0 ) { 124 if ( slider->width() == 0 ) {
125 return; 125 return;
126 } 126 }
127 long val = long((double)slider->value() * mediaPlayerState.length() / slider->width()); 127 long val = long((double)slider->value() * mediaPlayerState.length() / slider->width());
128 mediaPlayerState.setPosition( val ); 128 mediaPlayerState.setPosition( val );
129} 129}
130 130
131void VideoWidget::setPosition( long i ) { 131void VideoWidget::setPosition( long i ) {
132 updateSlider( i, mediaPlayerState.length() ); 132 updateSlider( i, mediaPlayerState.length() );
133} 133}
134 134
135 135
136void VideoWidget::setLength( long max ) { 136void VideoWidget::setLength( long max ) {
137 updateSlider( mediaPlayerState.position(), max ); 137 updateSlider( mediaPlayerState.position(), max );
138} 138}
139 139
140void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType ) 140void VideoWidget::setDisplayType( MediaPlayerState::DisplayType displayType )
141{ 141{
142 if ( displayType == MediaPlayerState::Video ) { 142 if ( displayType == MediaPlayerState::Video ) {
143 makeVisible(); 143 makeVisible();
144 return; 144 return;
145 } 145 }
146 146
147 // Effectively blank the view next time we show it so it looks nicer 147 // Effectively blank the view next time we show it so it looks nicer
148 scaledWidth = 0; 148 scaledWidth = 0;
149 scaledHeight = 0; 149 scaledHeight = 0;
150 hide(); 150 hide();
151} 151}
152 152
153void VideoWidget::loadSkin() 153void VideoWidget::loadSkin()
154{ 154{
155 loadDefaultSkin( guiInfo() ); 155 loadDefaultSkin( guiInfo() );
156 156
157 delete slider; 157 delete slider;
158 slider = new QSlider( Qt::Horizontal, this ); 158 slider = new QSlider( Qt::Horizontal, this );
159 slider->setMinValue( 0 ); 159 slider->setMinValue( 0 );
160 slider->setMaxValue( 1 ); 160 slider->setMaxValue( 1 );
161 slider->setBackgroundPixmap( backgroundPixmap ); 161 slider->setBackgroundPixmap( backgroundPixmap );
162 //slider->setFocusPolicy( QWidget::NoFocus ); 162 //slider->setFocusPolicy( QWidget::NoFocus );
163 163
164 resizeEvent( 0 ); 164 resizeEvent( 0 );
165} 165}
166 166
167void VideoWidget::updateSlider( long i, long max ) { 167void VideoWidget::updateSlider( long i, long max ) {
168 // Will flicker too much if we don't do this 168 // Will flicker too much if we don't do this
169 if ( max == 0 ) { 169 if ( max == 0 ) {
170 return; 170 return;
171 } 171 }
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index a392f4a..70f2ffd 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -1,171 +1,171 @@
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 34
35#include <qtimer.h> 35#include <qtimer.h>
36#include <qmessagebox.h> 36#include <qmessagebox.h>
37#include <qpe/qcopenvelope_qws.h> 37#include <qpe/qcopenvelope_qws.h>
38#include <qpe/qpeapplication.h> 38#include <qpe/qpeapplication.h>
39 39
40#include "xinecontrol.h" 40#include "xinecontrol.h"
41#include "mediaplayerstate.h" 41#include "mediaplayerstate.h"
42#include "xinevideowidget.h" 42#include "xinevideowidget.h"
43 43
44XineControl::XineControl( XineVideoWidget *xineWidget, 44XineControl::XineControl( XineVideoWidget *xineWidget,
45 MediaPlayerState &_mediaPlayerState, 45 MediaPlayerState &_mediaPlayerState,
46 QObject *parent, const char *name ) 46 QObject *parent, const char *name )
47 : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) 47 : QObject( parent, name ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget )
48{ 48{
49 libXine = new XINE::Lib( XINE::Lib::InitializeImmediately, xineWidget ); 49 libXine = new XINE::Lib( XINE::Lib::InitializeImmediately, xineWidget );
50 50
51 init(); 51 init();
52} 52}
53 53
54XineControl::XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget, 54XineControl::XineControl( XINE::Lib *xine, XineVideoWidget *xineWidget,
55 MediaPlayerState &_mediaPlayerState, 55 MediaPlayerState &_mediaPlayerState,
56 QObject *parent, const char *name ) 56 QObject *parent, const char *name )
57 : QObject( parent, name ), libXine( xine ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget ) 57 : QObject( parent, name ), libXine( xine ), mediaPlayerState( _mediaPlayerState ), xineVideoWidget( xineWidget )
58{ 58{
59 xine->ensureInitialized(); 59 xine->ensureInitialized();
60 60
61 xine->setWidget( xineWidget ); 61 xine->setWidget( xineWidget );
62 62
63 init(); 63 init();
64} 64}
65 65
66void XineControl::init() 66void XineControl::init()
67{ 67{
68 connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) ); 68 connect( &mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) );
69 connect( this, SIGNAL( positionChanged( long ) ), &mediaPlayerState, SLOT( updatePosition( long ) ) ); 69 connect( this, SIGNAL( positionChanged(long) ), &mediaPlayerState, SLOT( updatePosition(long) ) );
70 connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); 70 connect( &mediaPlayerState, SIGNAL( playingToggled(bool) ), this, SLOT( stop(bool) ) );
71 connect( &mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); 71 connect( &mediaPlayerState, SIGNAL( fullscreenToggled(bool) ), this, SLOT( setFullscreen(bool) ) );
72 connect( &mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); 72 connect( &mediaPlayerState, SIGNAL( positionChanged(long) ), this, SLOT( seekTo(long) ) );
73 connect( &mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); 73 connect( &mediaPlayerState, SIGNAL( videoGammaChanged(int) ), this, SLOT( setGamma(int) ) );
74 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); 74 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) );
75 connect( xineVideoWidget, SIGNAL( videoResized( const QSize & ) ), this, SLOT( videoResized ( const QSize & ) ) ); 75 connect( xineVideoWidget, SIGNAL( videoResized(const QSize&) ), this, SLOT( videoResized(const QSize&) ) );
76 76
77 disabledSuspendScreenSaver = FALSE; 77 disabledSuspendScreenSaver = FALSE;
78} 78}
79 79
80XineControl::~XineControl() { 80XineControl::~XineControl() {
81#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 81#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
82 if ( disabledSuspendScreenSaver ) { 82 if ( disabledSuspendScreenSaver ) {
83 disabledSuspendScreenSaver = FALSE; 83 disabledSuspendScreenSaver = FALSE;
84 // Re-enable the suspend mode 84 // Re-enable the suspend mode
85 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 85 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
86 } 86 }
87#endif 87#endif
88 delete libXine; 88 delete libXine;
89} 89}
90 90
91void XineControl::play( const QString& fileName ) { 91void XineControl::play( const QString& fileName ) {
92 92
93 hasVideoChannel = FALSE; 93 hasVideoChannel = FALSE;
94 hasAudioChannel = FALSE; 94 hasAudioChannel = FALSE;
95 m_fileName = fileName; 95 m_fileName = fileName;
96 96
97 qDebug("<<FILENAME: " + fileName + ">>>>"); 97 qDebug("<<FILENAME: " + fileName + ">>>>");
98 98
99 if ( !libXine->play( fileName, 0, 0 ) ) { 99 if ( !libXine->play( fileName, 0, 0 ) ) {
100 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); 100 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() );
101 // toggle stop so the the play button is reset 101 // toggle stop so the the play button is reset
102 mediaPlayerState.setPlaying( false ); 102 mediaPlayerState.setPlaying( false );
103 return; 103 return;
104 } 104 }
105 mediaPlayerState.setPlaying( true ); 105 mediaPlayerState.setPlaying( true );
106 106
107 MediaPlayerState::DisplayType displayType; 107 MediaPlayerState::DisplayType displayType;
108 if ( !libXine->hasVideo() ) { 108 if ( !libXine->hasVideo() ) {
109 displayType = MediaPlayerState::Audio; 109 displayType = MediaPlayerState::Audio;
110 qDebug("HAS AUDIO"); 110 qDebug("HAS AUDIO");
111 libXine->setShowVideo( false ); 111 libXine->setShowVideo( false );
112 hasAudioChannel = TRUE; 112 hasAudioChannel = TRUE;
113 } else { 113 } else {
114 displayType = MediaPlayerState::Video; 114 displayType = MediaPlayerState::Video;
115 qDebug("HAS VIDEO"); 115 qDebug("HAS VIDEO");
116 libXine->setShowVideo( true ); 116 libXine->setShowVideo( true );
117 hasVideoChannel = TRUE; 117 hasVideoChannel = TRUE;
118 } 118 }
119 // determine if slider is shown 119 // determine if slider is shown
120 mediaPlayerState.setIsSeekable( libXine->isSeekable() ); 120 mediaPlayerState.setIsSeekable( libXine->isSeekable() );
121 121
122 // which gui (video / audio) 122 // which gui (video / audio)
123 mediaPlayerState.setDisplayType( displayType ); 123 mediaPlayerState.setDisplayType( displayType );
124 124
125#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 125#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
126 if ( !disabledSuspendScreenSaver ) { 126 if ( !disabledSuspendScreenSaver ) {
127 disabledSuspendScreenSaver = TRUE; 127 disabledSuspendScreenSaver = TRUE;
128 // Stop the screen from blanking and power saving state 128 // Stop the screen from blanking and power saving state
129 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) 129 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" )
130 << ( displayType == MediaPlayerState::Video ? QPEApplication::Disable : QPEApplication::DisableSuspend ); 130 << ( displayType == MediaPlayerState::Video ? QPEApplication::Disable : QPEApplication::DisableSuspend );
131 } 131 }
132#endif 132#endif
133 133
134 length(); 134 length();
135 position(); 135 position();
136} 136}
137 137
138void XineControl::nextMedia() { 138void XineControl::nextMedia() {
139 mediaPlayerState.setNext(); 139 mediaPlayerState.setNext();
140} 140}
141 141
142void XineControl::setGamma( int value ) { 142void XineControl::setGamma( int value ) {
143 libXine->setGamma( value ); 143 libXine->setGamma( value );
144} 144}
145 145
146void XineControl::stop( bool isSet ) { 146void XineControl::stop( bool isSet ) {
147 if ( !isSet ) { 147 if ( !isSet ) {
148 libXine->stop(); 148 libXine->stop();
149 149
150#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 150#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
151 if ( disabledSuspendScreenSaver ) { 151 if ( disabledSuspendScreenSaver ) {
152 disabledSuspendScreenSaver = FALSE; 152 disabledSuspendScreenSaver = FALSE;
153 // Re-enable the suspend mode 153 // Re-enable the suspend mode
154 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 154 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
155 } 155 }
156#endif 156#endif
157 } 157 }
158} 158}
159 159
160/** 160/**
161 * Pause playback 161 * Pause playback
162 * @isSet 162 * @isSet
163 */ 163 */
164void XineControl::pause( bool isSet) { 164void XineControl::pause( bool isSet) {
165 libXine->pause( isSet ); 165 libXine->pause( isSet );
166} 166}
167 167
168 168
169/** 169/**
170 * get current time in playback 170 * get current time in playback
171 */ 171 */