summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-08-15 19:06:52 (UTC)
committer harlekin <harlekin>2002-08-15 19:06:52 (UTC)
commitcff42f8a8808ef9fd9b65376649857e0e0c2ccc3 (patch) (side-by-side diff)
tree7cf3cca6b2ebb35cd9ffc0ce8adc5568a27ad7d7
parent8cd40434c7011022a8e1706698e5c5075681bd1e (diff)
downloadopie-cff42f8a8808ef9fd9b65376649857e0e0c2ccc3.zip
opie-cff42f8a8808ef9fd9b65376649857e0e0c2ccc3.tar.gz
opie-cff42f8a8808ef9fd9b65376649857e0e0c2ccc3.tar.bz2
stop now working as supposed
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/lib.cpp1
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp4
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp8
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp2
4 files changed, 8 insertions, 7 deletions
diff --git a/noncore/multimedia/opieplayer2/lib.cpp b/noncore/multimedia/opieplayer2/lib.cpp
index 3b20873..d554141 100644
--- a/noncore/multimedia/opieplayer2/lib.cpp
+++ b/noncore/multimedia/opieplayer2/lib.cpp
@@ -78,171 +78,172 @@ Lib::Lib(XineVideoWidget* widget) {
QFile f(str);
f.open(IO_WriteOnly);
QTextStream ts( &f );
ts << "misc.memcpy_method:glibc";
f.close();
}
m_config = xine_config_file_init( str.data() );
// allocate oss for sound
// and fb for framebuffer
m_audioOutput= xine_load_audio_output_plugin( m_config, "oss") ;
if (m_audioOutput == NULL )
printf("Failure\n");
else
printf("Success\n");
// test code
/* m_videoOutput = xine_load_video_output_plugin(m_config, "fb",
VISUAL_TYPE_FB,
0 );
*/
char** files = xine_list_video_output_plugins(3);
char* out;
int i = 0;
while ( ( out = files[i] ) != 0 ) {
printf("Video %s\n", out );
i++;
}
// m_xine = xine_init( m_videoOutput,
// m_audioOutput,
// m_config );
// test loading
m_videoOutput = ::init_video_out_plugin( m_config, NULL );
if (m_wid != 0 ) {
printf("!0\n" );
resize ( m_wid-> size ( ));
::null_set_mode( m_videoOutput, qt_screen->depth(), qt_screen->pixelType() );
m_wid-> setImage ( new QImage ( Resource::loadImage("")));
m_wid->repaint();
}
null_display_handler( m_videoOutput,
xine_display_frame,
this );
m_xine = xine_init( m_videoOutput,
m_audioOutput, m_config );
// install the event handler
xine_register_event_listener( m_xine, xine_event_handler, this );
}
Lib::~Lib() {
delete m_config;
xine_remove_event_listener( m_xine, xine_event_handler );
xine_exit( m_xine );
delete m_videoOutput;
//delete m_audioOutput;
}
void Lib::resize ( const QSize &s )
{
if ( s. width ( ) && s. height ( )) {
::null_set_gui_width( m_videoOutput, s. width() );
::null_set_gui_height(m_videoOutput, s. height() );
}
}
QCString Lib::version() {
QCString str( xine_get_str_version() );
return str;
};
int Lib::majorVersion() {
return xine_get_major_version();
}
int Lib::minorVersion() {
return xine_get_minor_version();
};
int Lib::subVersion() {
return xine_get_sub_version();
}
int Lib::play( const QString& fileName,
int startPos,
int start_time ) {
QString str = fileName.stripWhiteSpace();
//workaround OpiePlayer bug
if (str.right(1) == QString::fromLatin1("/") )
str = str.mid( str.length() -1 );
return xine_play( m_xine, QFile::encodeName(str.utf8() ).data(),
startPos, start_time);
}
void Lib::stop() {
+ qDebug("<<<<<<<< STOP IN LIB TRIGGERED >>>>>>>");
xine_stop(m_xine );
}
void Lib::pause(){
xine_set_speed( m_xine, SPEED_PAUSE );
}
int Lib::speed() {
return xine_get_speed( m_xine );
}
void Lib::setSpeed( int speed ) {
xine_set_speed( m_xine, speed );
}
int Lib::status(){
return xine_get_status( m_xine );
}
int Lib::currentPosition(){
return xine_get_current_position( m_xine );
}
int Lib::currentTime() {
return xine_get_current_time( m_xine );
};
int Lib::length() {
return xine_get_stream_length( m_xine );
}
bool Lib::isSeekable() {
return xine_is_stream_seekable(m_xine);
}
Frame Lib::currentFrame() {
Frame frame;
return frame;
};
int Lib::error() {
return xine_get_error( m_xine );
};
void Lib::handleXineEvent( xine_event_t* t ) {
if ( t->type == XINE_EVENT_PLAYBACK_FINISHED )
emit stopped();
}
void Lib::setShowVideo( bool video ) {
m_video = video;
::null_set_show_video( m_videoOutput, video );
}
bool Lib::isShowingVideo() {
return ::null_is_showing_video( m_videoOutput );
}
void Lib::showVideoFullScreen( bool fullScreen ) {
::null_set_fullscreen( m_videoOutput, fullScreen );
}
bool Lib::isVideoFullScreen() {
return ::null_is_fullscreen( m_videoOutput );
}
void Lib::setScaling( bool scale ) {
::null_set_scaling( m_videoOutput, scale );
}
bool Lib::isScaling() {
return ::null_is_scaling( m_videoOutput );
}
void Lib::xine_event_handler( void* user_data, xine_event_t* t ) {
((Lib*)user_data)->handleXineEvent( t );
}
void Lib::xine_display_frame( void* user_data, uint8_t *frame,
int width, int height, int bytes ) {
((Lib*)user_data)->drawFrame( frame, width, height, bytes );
}
void Lib::drawFrame( uint8_t* frame, int width, int height, int bytes ) {
if (!m_video ) {
qWarning("not showing video now");
return;
}
// qWarning("called draw frame %d %d", width, height);
m_wid->setImage( frame, width, height, bytes );
// m_wid->repaint(false);
}
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index 51fbb8b..93819f2 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -1,170 +1,170 @@
#include <qpe/qpeapplication.h>
#include <qpe/qlibrary.h>
#include <qpe/resource.h>
#include <qpe/config.h>
#include <qmainwindow.h>
#include <qmessagebox.h>
#include <qwidgetstack.h>
#include <qfile.h>
#include "mediaplayer.h"
#include "playlistwidget.h"
#include "audiowidget.h"
#include "videowidget.h"
#include "volumecontrol.h"
#include "mediaplayerstate.h"
extern AudioWidget *audioUI;
extern VideoWidget *videoUI;
extern PlayListWidget *playList;
extern MediaPlayerState *mediaPlayerState;
MediaPlayer::MediaPlayer( QObject *parent, const char *name )
: QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) {
xineControl = new XineControl();
// QPEApplication::grabKeyboard(); // EVIL
connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) );
connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) );
connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) );
connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) );
connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
-
+
volControl = new VolumeControl;
}
MediaPlayer::~MediaPlayer() {
delete xineControl;
delete volControl;
}
void MediaPlayer::pauseCheck( bool b ) {
if ( b && !mediaPlayerState->playing() ) {
mediaPlayerState->setPaused( FALSE );
}
}
void MediaPlayer::play() {
mediaPlayerState->setPlaying( FALSE );
mediaPlayerState->setPlaying( TRUE );
}
void MediaPlayer::setPlaying( bool play ) {
if ( !play ) {
- mediaPlayerState->setPaused( FALSE );
+ //mediaPlayerState->setPaused( TRUE );
return;
}
if ( mediaPlayerState->paused() ) {
mediaPlayerState->setPaused( FALSE );
return;
}
const DocLnk *playListCurrent = playList->current();
if ( playListCurrent != NULL ) {
currentFile = playListCurrent;
}
xineControl->play( currentFile->file() );
xineControl->length();
long seconds = mediaPlayerState->length();//
QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
qDebug(time);
QString tickerText;
if( currentFile->file().left(4) == "http" )
tickerText= tr( " File: " ) + currentFile->name();
else
tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time;
// QString fileInfo = mediaPlayerState->curDecoder()->fileInfo();
// if ( !fileInfo.isEmpty() )
// tickerText += ", " + fileInfo;
// audioUI->setTickerText( tickerText + "." );
audioUI->setTickerText( currentFile->file( ) );
}
void MediaPlayer::prev() {
if ( playList->prev() ) {
play();
} else if ( mediaPlayerState->looping() ) {
if ( playList->last() ) {
play();
}
} else {
mediaPlayerState->setList();
}
}
void MediaPlayer::next() {
if ( playList->next() ) {
play();
} else if ( mediaPlayerState->looping() ) {
if ( playList->first() ) {
play();
}
} else {
mediaPlayerState->setList();
}
}
void MediaPlayer::startDecreasingVolume() {
volumeDirection = -1;
startTimer( 100 );
volControl->decVol(2);
}
void MediaPlayer::startIncreasingVolume() {
volumeDirection = +1;
startTimer( 100 );
volControl->incVol(2);
}
bool drawnOnScreenDisplay = FALSE;
unsigned int onScreenDisplayVolume = 0;
const int yoff = 110;
void MediaPlayer::stopChangingVolume() {
killTimers();
// Get rid of the on-screen display stuff
drawnOnScreenDisplay = FALSE;
onScreenDisplayVolume = 0;
int w=0;
int h=0;
if( !xineControl->hasVideo()) {
w = audioUI->width();
h = audioUI->height();
audioUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE );
} else {
w = videoUI->width();
h = videoUI->height();
videoUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE );
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index c210ffb..77e2095 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -592,193 +592,193 @@ void PlayListWidget::saveList() {
}
Config config( "OpiePlayer" );
config.writeEntry("CurrentPlaylist",filename);
setCaption(tr("OpiePlayer: ")+filename);
d->selectedFiles->first();
if(fileDlg) {
delete fileDlg;
}
}
void PlayListWidget::loadList( const DocLnk & lnk) {
QString name= lnk.name();
// qDebug("currentList is "+name);
if( name.length()>1) {
setCaption("OpiePlayer: "+name);
// qDebug("load list "+ name+".playlist");
clearList();
Config cfg( name+".playlist");
readConfig(cfg);
tabWidget->setCurrentPage(0);
Config config( "OpiePlayer" );
config.writeEntry("CurrentPlaylist", name);
// d->selectedFiles->first();
}
}
void PlayListWidget::setPlaylist( bool shown ) {
if ( shown ) {
d->playListFrame->show();
} else {
d->playListFrame->hide();
}
}
void PlayListWidget::setView( char view ) {
if ( view == 'l' )
showMaximized();
else
hide();
}
void PlayListWidget::addSelected() {
Config cfg( "OpiePlayer" );
cfg.setGroup("PlayList");
QString currentPlaylist = cfg.readEntry("CurrentPlaylist","");
// int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
switch (tabWidget->currentPageIndex()) {
case 0: //playlist
break;
case 1: { //audio
QListViewItemIterator it( audioView );
// iterate through all items of the listview
for ( ; it.current(); ++it ) {
if ( it.current()->isSelected() ) {
QListIterator<DocLnk> dit( files.children() );
for ( ; dit.current(); ++dit ) {
if( dit.current()->name() == it.current()->text(0) ) {
d->selectedFiles->addToSelection( **dit );
}
}
audioView->setSelected( it.current(),FALSE);
}
}
tabWidget->setCurrentPage(0);
}
break;
case 2: { // video
QListViewItemIterator it( videoView );
// iterate through all items of the listview
for ( ; it.current(); ++it ) {
if ( it.current()->isSelected() ) {
QListIterator<DocLnk> dit( vFiles.children() );
for ( ; dit.current(); ++dit ) {
if( dit.current()->name() == it.current()->text(0) ) {
d->selectedFiles->addToSelection( **dit );
}
}
videoView->setSelected( it.current(),FALSE);
}
}
tabWidget->setCurrentPage(0);
}
break;
};
}
void PlayListWidget::removeSelected() {
d->selectedFiles->removeSelected( );
}
void PlayListWidget::playIt( QListViewItem *it) {
- if(it==NULL) return;
+ // if(it==NULL) return;
qDebug("playIt");
mediaPlayerState->setPlaying(FALSE);
mediaPlayerState->setPlaying(TRUE);
d->selectedFiles->unSelect();
}
void PlayListWidget::addToSelection( QListViewItem *it) {
d->setDocumentUsed = FALSE;
if(it) {
switch (tabWidget->currentPageIndex()) {
case 1: {
QListIterator<DocLnk> dit( files.children() );
for ( ; dit.current(); ++dit ) {
if( dit.current()->name() == it->text(0)) {
d->selectedFiles->addToSelection( **dit );
}
}
}
break;
case 2: {
QListIterator<DocLnk> dit( vFiles.children() );
for ( ; dit.current(); ++dit ) {
if( dit.current()->name() == it->text(0)) {
d->selectedFiles->addToSelection( **dit );
}
}
}
break;
case 0:
break;
};
tabWidget->setCurrentPage(0);
}
}
void PlayListWidget::tabChanged(QWidget *) {
switch ( tabWidget->currentPageIndex()) {
case 0:
{
if( !tbDeletePlaylist->isHidden())
tbDeletePlaylist->hide();
d->tbRemoveFromList->setEnabled(TRUE);
d->tbAddToList->setEnabled(FALSE);
}
break;
case 1:
{
audioView->clear();
populateAudioView();
if( !tbDeletePlaylist->isHidden())
tbDeletePlaylist->hide();
d->tbRemoveFromList->setEnabled(FALSE);
d->tbAddToList->setEnabled(TRUE);
}
break;
case 2:
{
videoView->clear();
populateVideoView();
if( !tbDeletePlaylist->isHidden())
tbDeletePlaylist->hide();
d->tbRemoveFromList->setEnabled(FALSE);
d->tbAddToList->setEnabled(TRUE);
}
break;
case 3:
{
if( tbDeletePlaylist->isHidden())
tbDeletePlaylist->show();
playLists->reread();
}
break;
};
}
void PlayListWidget::btnPlay(bool b) {
// mediaPlayerState->setPlaying(b);
switch ( tabWidget->currentPageIndex()) {
case 0:
{
mediaPlayerState->setPlaying(b);
}
break;
case 1:
{
addToSelection( audioView->currentItem() );
mediaPlayerState->setPlaying(b);
d->selectedFiles->removeSelected( );
tabWidget->setCurrentPage(1);
d->selectedFiles->unSelect();
insanityBool=FALSE;
}// audioView->clearSelection();
@@ -1140,146 +1140,146 @@ void PlayListWidget::readm3u(const QString &filename) {
lnk.writeLink();
d->selectedFiles->addToSelection( lnk);
}
i++;
}
}
}
}
f.close();
}
void PlayListWidget::writem3u() {
InputDialog *fileDlg;
fileDlg = new InputDialog(this,tr("Save m3u Playlist "),TRUE, 0);
fileDlg->exec();
QString filename,list;
if( fileDlg->result() == 1 ) {
filename = fileDlg->LineEdit1->text();
qDebug(filename);
int noOfFiles = 0;
d->selectedFiles->first();
do {
// we dont check for existance because of url's
// qDebug(d->selectedFiles->current()->file());
list += d->selectedFiles->current()->file()+"\n";
noOfFiles++;
}
while ( d->selectedFiles->next() );
qDebug(list);
if(filename.left(1) != "/")
filename=QPEApplication::documentDir()+"/"+filename;
if(filename.right(3) != "m3u")
filename=filename+".m3u";
QFile f(filename);
f.open(IO_WriteOnly);
f.writeBlock(list, list.length());
f.close();
}
if(fileDlg) delete fileDlg;
}
void PlayListWidget::readPls(const QString &filename) {
qDebug("pls filename is "+filename);
QFile f(filename);
if(f.open(IO_ReadOnly)) {
QTextStream t(&f);
QString s;//, first, second;
int i=0;
while ( !t.atEnd()) {
s=t.readLine();
if(s.left(4) == "File") {
s=s.right(s.length() - 6);
s.replace(QRegExp("%20")," ");
qDebug("adding "+s+" to playlist");
// numberofentries=2
// File1=http
// Title
// Length
// Version
// File2=http
s=s.replace( QRegExp("\\"),"/");
DocLnk lnk( s );
QFileInfo f(s);
QString name = f.baseName();
if(name.left(4)=="http")
name = s.right( s.length() - 7);
else
name=s;
name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1);
lnk.setName( name);
if(s.at(s.length()-4) == '.') // if this is probably a file
lnk.setFile( s);
else { //if its a url
if( name.right(1).find('/') == -1)
s+="/";
lnk.setFile( s);
}
lnk.setType("audio/x-mpegurl");
qDebug("DocLnk add "+name);
d->selectedFiles->addToSelection( lnk);
}
}
i++;
}
}
void PlayListWidget::pmViewActivated(int index) {
qDebug("%d", index);
switch(index) {
case -16:
{
-
+
mediaPlayerState->toggleFullscreen();
bool b=mediaPlayerState->fullscreen();
pmView->setItemChecked( index,b);
Config cfg( "OpiePlayer" );
cfg.writeEntry("FullScreen", b);
-
+
}
break;
};
}
void PlayListWidget::populateSkinsMenu() {
int item=0;
defaultSkinIndex=0;
QString skinName;
Config cfg( "OpiePlayer" );
cfg.setGroup("Options");
QString skin = cfg.readEntry("Skin","default");
QDir skinsDir(QPEApplication::qpeDir()+"/pics/opieplayer2/skins");
skinsDir.setFilter( QDir::Dirs);
skinsDir.setSorting(QDir::Name);
const QFileInfoList *skinslist = skinsDir.entryInfoList();
QFileInfoListIterator it( *skinslist );
QFileInfo *fi;
while ( (fi=it.current()) ) {
skinName = fi->fileName();
qDebug( fi->fileName());
if( skinName != "." && skinName != ".." && skinName !="CVS")
item = skinsMenu->insertItem( fi->fileName());
if( skinName == "default")
defaultSkinIndex = item;
if( skinName == skin)
skinsMenu->setItemChecked( item, TRUE);
-
+
++it;
}
}
void PlayListWidget::skinsMenuActivated(int item) {
for(int i = defaultSkinIndex; i > defaultSkinIndex - skinsMenu->count(); i--) {
skinsMenu->setItemChecked( i, FALSE);
}
skinsMenu->setItemChecked( item, TRUE);
Config cfg( "OpiePlayer" );
cfg.setGroup("Options");
cfg.writeEntry("Skin", skinsMenu->text( item));
}
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index 17112a2..8fd2743 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -23,178 +23,178 @@
++=   -.     .`     .: details.
 :     =  ...= . :.=-
 -.   .:....=;==+<; You should have received a copy of the GNU
  -_. . .   )=.  = Library General Public License along with
    --        :-=` this library; see the file COPYING.LIB.
If not, write to the Free Software Foundation,
Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <qtimer.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/qpeapplication.h>
#include "xinecontrol.h"
#include "mediaplayerstate.h"
#include "videowidget.h"
extern MediaPlayerState *mediaPlayerState;
extern VideoWidget *videoUI;
XineControl::XineControl( QObject *parent, const char *name )
: QObject( parent, name ) {
libXine = new XINE::Lib(videoUI->vidWidget() );
connect ( videoUI, SIGNAL( videoResized ( const QSize & )), this, SLOT( videoResized ( const QSize & )));
connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) );
connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) );
connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) );
connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) );
connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) );
connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) );
disabledSuspendScreenSaver = FALSE;
}
XineControl::~XineControl() {
#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
if ( disabledSuspendScreenSaver ) {
disabledSuspendScreenSaver = FALSE;
// Re-enable the suspend mode
QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
}
#endif
delete libXine;
}
void XineControl::play( const QString& fileName ) {
hasVideoChannel=FALSE;
hasAudioChannel=FALSE;
m_fileName = fileName;
libXine->play( fileName );
mediaPlayerState->setPlaying( true );
// default to audio view until we know how to handle video
// MediaDetect mdetect;
char whichGui = mdetect.videoOrAudio( fileName );
if (whichGui == 'f') {
qDebug("Nicht erkannter Dateityp");
return;
}
if (whichGui == 'a') {
libXine->setShowVideo( false );
hasAudioChannel=TRUE;
} else {
libXine->setShowVideo( true );
hasVideoChannel=TRUE;
}
// determine if slider is shown
// mediaPlayerState->setIsStreaming( mdetect.isStreaming( fileName ) );
mediaPlayerState->setIsStreaming( !libXine->isSeekable() );
// which gui (video / audio)
mediaPlayerState->setView( whichGui );
#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
if ( !disabledSuspendScreenSaver ) {
disabledSuspendScreenSaver = TRUE;
// Stop the screen from blanking and power saving state
QCopEnvelope("QPE/System", "setScreenSaverMode(int)" )
<< ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend );
}
#endif
length();
position();
}
void XineControl::nextMedia() {
mediaPlayerState->setNext();
}
void XineControl::stop( bool isSet ) {
if ( !isSet) {
libXine->stop( );
mediaPlayerState->setList();
- //mediaPlayerState->setPlaying( false );
+ // mediaPlayerState->setPlaying( false );
#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
if ( disabledSuspendScreenSaver ) {
disabledSuspendScreenSaver = FALSE;
// Re-enable the suspend mode
QCopEnvelope("QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
}
#endif
} else {
// play again
}
}
/**
* Pause playback
* @isSet
*/
void XineControl::pause( bool isSet) {
if (isSet) {
libXine->pause();
} else {
libXine->play( m_fileName, 0, m_currentTime);
}
}
/**
* get current time in playback
*/
long XineControl::currentTime() {
// todo: jede sekunde überprüfen
m_currentTime = libXine->currentTime();
return m_currentTime;
QTimer::singleShot( 1000, this, SLOT( currentTime() ) );
}
/**
* Set the length of the media file
*/
void XineControl::length() {
m_length = libXine->length();
mediaPlayerState->setLength( m_length );
}
/**
* Reports the position the xine backend is at right now
* @return long the postion in seconds
*/
long XineControl::position() {
m_position = ( currentTime() );
mediaPlayerState->updatePosition( m_position );
long emitPos = (long)m_position;
emit positionChanged( emitPos );
if(mediaPlayerState->isPlaying)
// needs to be stopped the media is stopped
QTimer::singleShot( 1000, this, SLOT( position() ) );
// qDebug("POSITION : %d", m_position);
return m_position;
}
/**
* Set videoplayback to fullscreen
* @param isSet
*/
void XineControl::setFullscreen( bool isSet ) {
libXine->showVideoFullScreen( isSet);
}
/**
* Seek to a position in the track
* @param second the second to jump to
*/
void XineControl::seekTo( long second ) {
libXine->play( m_fileName , 0, (int)second );
}
void XineControl::videoResized ( const QSize &s ) {
libXine-> resize ( s );
}