#include "dcopiface.h"
#include <player.h>
#include <noatunapp.h>

extern "C"
{
	NIF *create_plugin()
	{
		return new NIF();
	}
}


NIF::NIF() : Plugin(), DCOPObject("Noatun")
{
        NOATUNPLUGINC(NIF);
}
void NIF::toggleListView()
{
	napp->player()->toggleListView();
}

void NIF::handleButtons()
{
	napp->player()->handleButtons();
}

void NIF::removeCurrent()
{
	napp->player()->removeCurrent();
}
			 
void NIF::back()
{
	napp->player()->back();
}

void NIF::stop()
{
	napp->player()->stop();
}

void NIF::play()
{
	napp->player()->play();
}

void NIF::playpause()
{
	napp->player()->playpause();
}

void NIF::fastForward()
{
	napp->player()->fastForward();
}

void NIF::skipTo(int perMille)
{
	napp->player()->skipTo(perMille);
}

void NIF::loop()
{
	napp->player()->loop();
}

void NIF::newCurrent()
{
	napp->player()->newCurrent();
}

void NIF::playCurrent()
{
	napp->player()->playCurrent();
}

void NIF::setVolume(int i)
{
	napp->player()->setVolume(i);
}

int NIF::length()
{
	if (!napp->player()->current())
		return -1;
	return napp->player()->current()->length();
}

int NIF::position()
{
	return napp->player()->getTime();
}

int NIF::state()
{
	if (napp->player()->isPlaying())
		return 2;
	if (napp->player()->isPaused())
		return 1;
	if (napp->player()->isStopped());
		return 0;
}

QString NIF::lengthString()
{
	return napp->player()->current()->lengthString();
}

QString NIF::title()
{
	return napp->player()->current()->title();
}


