Esempio n. 1
0
void QMplayer::backClicked()
{
    if(screen == QMplayer::ScreenInit)
    {
        close();
    }
    else if(screen == QMplayer::ScreenPlay)
    {
        showScreen(QMplayer::ScreenFullscreen);
    }
    else if(screen == QMplayer::ScreenStopped)
    {
        process->write("q");
        process->waitForFinished(4000);
        delete(process);
        process = NULL;
        playerStopped();
    }
    else if(screen == QMplayer::ScreenConnect)
    {
        showScreen(QMplayer::ScreenInit);
    }
    else if(screen == QMplayer::ScreenTube)
    {
        close();
    }
    else if(screen == ScreenEncodingInProgress)
    {
        process->terminate();
    }
    else
    {
        abort = true;
    }
}
Esempio n. 2
0
void NoatunInterface::appRemoved(const QCString &appId)
{
	if (appId.contains("noatun",false))
	{
	 	// is there still another noatun alive?
		if (findRunningNoatun())
			return;
		mNoatunTimer->stop();
		emit playerStopped();
		emit newSliderPosition(0,0);
	}
}
Esempio n. 3
0
void QMplayer::processFinished(int exitCode, QProcess::ExitStatus exitStatus)
{
    Q_UNUSED(exitCode);
    Q_UNUSED(exitStatus);

    if(screen == ScreenEncodingInProgress)
    {
        delete(process);
        process = NULL;
        showScreen(ScreenInit);
        return;
    }
    playerStopped();
}
Esempio n. 4
0
void NoatunInterface::myInit()
{
	// Start the timer if noatun is already running
	// Needed if user adds applet while running noatun
	if ( findRunningNoatun() )
	{
		emit playerStarted();
		mNoatunTimer->start(mTimerValue);
	}
	else
	{
		emit playerStopped();
		emit newSliderPosition(0,0);
	}
}
Esempio n. 5
0
void MediaControl::reparseConfig()
{
//	kdDebug(90200) << "reparseConfig();" << endl;
    _configFrontend->reparseConfiguration();

    if (_player != 0L) // make sure there is no player-object
    {
        _player->disconnect(); // disconnect from all things

        time_slider->disconnect();
        prev_button->disconnect();
        playpause_button->disconnect();
        stop_button->disconnect();
        next_button->disconnect();

        delete slider_tooltip; // tooltip depends on _player : delete it before _player gets deleted
        slider_tooltip = 0L;

        delete _player;
        _player = 0L;
    }

    mLastLen = -1;
    mLastTime = -1;
    mLastStatus = -1;

    QString playerString = _configFrontend->player();


#ifdef HAVE_XMMS
    if (playerString == "XMMS")
    {
        _player = new XmmsInterface ();
        time_slider->setSteps((_configFrontend->mouseWheelSpeed()*1000),
                              (_configFrontend->mouseWheelSpeed()*1000));
    }
    else
#endif
        if (playerString == "JuK")
        {
            _player = new JuKInterface();
            time_slider->setSteps((_configFrontend->mouseWheelSpeed()),
                                  (_configFrontend->mouseWheelSpeed()));
        }
        else if (playerString == "Amarok")
        {
            _player = new AmarokInterface();
            time_slider->setSteps((_configFrontend->mouseWheelSpeed()),
                                  (_configFrontend->mouseWheelSpeed()));
        }
        else if (playerString == "KsCD")
        {
            _player = new KsCDInterface();
            time_slider->setSteps((_configFrontend->mouseWheelSpeed()),
                                  (_configFrontend->mouseWheelSpeed()));
        }
        else if (playerString == "mpd")
        {
            _player = new MpdInterface();
            time_slider->setSteps((_configFrontend->mouseWheelSpeed()),
                                  (_configFrontend->mouseWheelSpeed()));
        }
        else // Fallback is Noatun
        {
            _player = new NoatunInterface();
            time_slider->setSteps((_configFrontend->mouseWheelSpeed()),
                                  (_configFrontend->mouseWheelSpeed()));
        }

    //  this signal gets emitted by a playerInterface when the player's playtime changed
    connect(_player, SIGNAL(newSliderPosition(int,int)),
            this, SLOT(setSliderPosition(int,int)));

    connect(_player, SIGNAL(playerStarted()), SLOT(enableAll()));
    connect(_player, SIGNAL(playerStopped()), SLOT(disableAll()));
    connect(_player, SIGNAL(playingStatusChanged(int)), SLOT(slotPlayingStatusChanged(int)));

    // do we use our icons or the default ones from KDE?
    if(_configFrontend->useCustomTheme())
    {
        // load theme
        QString skindir = locate("data", "mediacontrol/"+_configFrontend->theme()+"/");

        // the user has to take care if all pixmaps are there, we only check for one of them
        if (QFile(skindir+"play.png").exists())
        {
            prev_button->setIconSet(SmallIconSet(locate("data",skindir+"prev.png")));
            if (_player->playingStatus() == PlayerInterface::Playing)
                playpause_button->setIconSet(SmallIconSet(locate("data",skindir+"play.png")));
            else
                playpause_button->setIconSet(SmallIconSet(locate("data",skindir+"pause.png")));
            stop_button->setIconSet(SmallIconSet(locate("data",skindir+"stop.png")));
            next_button->setIconSet(SmallIconSet(locate("data",skindir+"next.png")));
        }
        else // icon-theme is invalid or not there
        {
            KNotifyClient::event(winId(), KNotifyClient::warning,
                                 i18n("There was trouble loading theme %1. Please choose" \
                                      " a different theme.").arg(skindir));

            // default to kde-icons, they have to be installed :)
            slotIconChanged();

            // and open prefs-dialog
            preferences();
        }
    }
    else // KDE default-icons, assuming that these icons exist!
    {
        // sets icons from kde
        slotIconChanged();
    }

    slider_tooltip = new MediaControlToolTip(time_slider, _player);

    connect(prev_button, SIGNAL(clicked()), _player, SLOT(prev()));
    connect(playpause_button, SIGNAL(clicked()), _player, SLOT(playpause()));
    connect(stop_button, SIGNAL(clicked()), _player, SLOT(stop()));
    connect(next_button, SIGNAL(clicked()), _player, SLOT(next()));

    connect(time_slider, SIGNAL(sliderPressed()), _player, SLOT(sliderStartDrag()));
    connect(time_slider, SIGNAL(sliderReleased()), _player, SLOT(sliderStopDrag()));
    connect(time_slider, SIGNAL(valueChanged(int)), this, SLOT(adjustTime(int)));
    connect(time_slider, SIGNAL(volumeUp()), _player, SLOT(volumeUp()));
    connect(time_slider, SIGNAL(volumeDown()), _player, SLOT(volumeDown()));
    connect(this, SIGNAL(newJumpToTime(int)), _player, SLOT(jumpToTime(int)));
}