/****************************************************************************
**
** DCOP Stub Implementation created by dcopidl2cpp from kmplayer_backend.kidl
**
** WARNING! All changes made in this file will be lost!
**
*****************************************************************************/

#include "kmplayer_backend_stub.h"
#include <dcopclient.h>

#include <kdatastream.h>

namespace KMPlayer {

Backend_stub::Backend_stub( const TQCString& app, const TQCString& obj )
  : DCOPStub( app, obj )
{
}

Backend_stub::Backend_stub( DCOPClient* client, const TQCString& app, const TQCString& obj )
  : DCOPStub( client, app, obj )
{
}

Backend_stub::Backend_stub( const DCOPRef& ref )
  : DCOPStub( ref )
{
}

void Backend_stub::setURL( TQString arg0 )
{
    if ( !dcopClient()  ) {
	setStatus( CallFailed );
	return;
    }
    TQByteArray data;
    TQDataStream arg( data, IO_WriteOnly );
    arg << arg0;
    dcopClient()->send( app(), obj(), "setURL(TQString)", data );
    setStatus( CallSucceeded );
}

void Backend_stub::setSubTitleURL( TQString arg0 )
{
    if ( !dcopClient()  ) {
	setStatus( CallFailed );
	return;
    }
    TQByteArray data;
    TQDataStream arg( data, IO_WriteOnly );
    arg << arg0;
    dcopClient()->send( app(), obj(), "setSubTitleURL(TQString)", data );
    setStatus( CallSucceeded );
}

void Backend_stub::play( int arg0 )
{
    if ( !dcopClient()  ) {
	setStatus( CallFailed );
	return;
    }
    TQByteArray data;
    TQDataStream arg( data, IO_WriteOnly );
    arg << arg0;
    dcopClient()->send( app(), obj(), "play(int)", data );
    setStatus( CallSucceeded );
}

void Backend_stub::stop()
{
    if ( !dcopClient()  ) {
	setStatus( CallFailed );
	return;
    }
    TQByteArray data;
    dcopClient()->send( app(), obj(), "stop()", data );
    setStatus( CallSucceeded );
}

void Backend_stub::pause()
{
    if ( !dcopClient()  ) {
	setStatus( CallFailed );
	return;
    }
    TQByteArray data;
    dcopClient()->send( app(), obj(), "pause()", data );
    setStatus( CallSucceeded );
}

void Backend_stub::seek( int arg0, bool arg1 )
{
    if ( !dcopClient()  ) {
	setStatus( CallFailed );
	return;
    }
    TQByteArray data;
    TQDataStream arg( data, IO_WriteOnly );
    arg << arg0;
    arg << arg1;
    dcopClient()->send( app(), obj(), "seek(int,bool)", data );
    setStatus( CallSucceeded );
}

void Backend_stub::hue( int arg0, bool arg1 )
{
    if ( !dcopClient()  ) {
	setStatus( CallFailed );
	return;
    }
    TQByteArray data;
    TQDataStream arg( data, IO_WriteOnly );
    arg << arg0;
    arg << arg1;
    dcopClient()->send( app(), obj(), "hue(int,bool)", data );
    setStatus( CallSucceeded );
}

void Backend_stub::saturation( int arg0, bool arg1 )
{
    if ( !dcopClient()  ) {
	setStatus( CallFailed );
	return;
    }
    TQByteArray data;
    TQDataStream arg( data, IO_WriteOnly );
    arg << arg0;
    arg << arg1;
    dcopClient()->send( app(), obj(), "saturation(int,bool)", data );
    setStatus( CallSucceeded );
}

void Backend_stub::contrast( int arg0, bool arg1 )
{
    if ( !dcopClient()  ) {
	setStatus( CallFailed );
	return;
    }
    TQByteArray data;
    TQDataStream arg( data, IO_WriteOnly );
    arg << arg0;
    arg << arg1;
    dcopClient()->send( app(), obj(), "contrast(int,bool)", data );
    setStatus( CallSucceeded );
}

void Backend_stub::brightness( int arg0, bool arg1 )
{
    if ( !dcopClient()  ) {
	setStatus( CallFailed );
	return;
    }
    TQByteArray data;
    TQDataStream arg( data, IO_WriteOnly );
    arg << arg0;
    arg << arg1;
    dcopClient()->send( app(), obj(), "brightness(int,bool)", data );
    setStatus( CallSucceeded );
}

void Backend_stub::volume( int arg0, bool arg1 )
{
    if ( !dcopClient()  ) {
	setStatus( CallFailed );
	return;
    }
    TQByteArray data;
    TQDataStream arg( data, IO_WriteOnly );
    arg << arg0;
    arg << arg1;
    dcopClient()->send( app(), obj(), "volume(int,bool)", data );
    setStatus( CallSucceeded );
}

void Backend_stub::frequency( int arg0 )
{
    if ( !dcopClient()  ) {
	setStatus( CallFailed );
	return;
    }
    TQByteArray data;
    TQDataStream arg( data, IO_WriteOnly );
    arg << arg0;
    dcopClient()->send( app(), obj(), "frequency(int)", data );
    setStatus( CallSucceeded );
}

void Backend_stub::quit()
{
    if ( !dcopClient()  ) {
	setStatus( CallFailed );
	return;
    }
    TQByteArray data;
    dcopClient()->send( app(), obj(), "quit()", data );
    setStatus( CallSucceeded );
}

void Backend_stub::setConfig( TQByteArray arg0 )
{
    if ( !dcopClient()  ) {
	setStatus( CallFailed );
	return;
    }
    TQByteArray data;
    TQDataStream arg( data, IO_WriteOnly );
    arg << arg0;
    dcopClient()->send( app(), obj(), "setConfig(TQByteArray)", data );
    setStatus( CallSucceeded );
}

void Backend_stub::setAudioLang( int arg0, TQString arg1 )
{
    if ( !dcopClient()  ) {
	setStatus( CallFailed );
	return;
    }
    TQByteArray data;
    TQDataStream arg( data, IO_WriteOnly );
    arg << arg0;
    arg << arg1;
    dcopClient()->send( app(), obj(), "setAudioLang(int,TQString)", data );
    setStatus( CallSucceeded );
}

void Backend_stub::setSubtitle( int arg0, TQString arg1 )
{
    if ( !dcopClient()  ) {
	setStatus( CallFailed );
	return;
    }
    TQByteArray data;
    TQDataStream arg( data, IO_WriteOnly );
    arg << arg0;
    arg << arg1;
    dcopClient()->send( app(), obj(), "setSubtitle(int,TQString)", data );
    setStatus( CallSucceeded );
}

bool Backend_stub::isPlaying()
{
    bool result = false;
    if ( !dcopClient()  ) {
	setStatus( CallFailed );
	return result;
    }
    TQByteArray data, replyData;
    TQCString replyType;
    if ( dcopClient()->call( app(), obj(), "isPlaying()", data, replyType, replyData ) ) {
	if ( replyType == "bool" ) {
	    TQDataStream _reply_stream( replyData, IO_ReadOnly );
	    _reply_stream >> result;
	    setStatus( CallSucceeded );
	} else {
	    callFailed();
	}
    } else { 
	callFailed();
    }
    return result;
}

} // namespace

