Ejemplo n.º 1
0
void QMplayer::play(QStringList const& args)
{
    showScreen(QMplayer::ScreenPlay);

    process = new QProcess(this);
    connect(process, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(processFinished(int, QProcess::ExitStatus)));
    process->setProcessChannelMode(QProcess::ForwardedChannels);
    process->start("mplayer", args, QIODevice::ReadWrite);

    if(!process->waitForStarted(5000))
    {
       delete(process);
       process = NULL;

       if(QMessageBox::question(this, tr("qmplayer"),
                             tr("Program MPlayer must be downloaded. Please make sure you have internet connection and press yes to confirm download"),
                             QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
       {
           showScreen(QMplayer::ScreenDownload);
           if(installMplayer())
           {
               QMessageBox::information(this, tr("qmplayer"), tr("MPlayer installed sucessfully"));
               play(args);
               return;
           }
           QMessageBox::warning(this, tr("qmplayer"), tr("Failed to install MPlayer"));
           showScreen(QMplayer::ScreenInit);
       }
       return;
    }
}
Ejemplo n.º 2
0
void QMplayer::play(QStringList & args)
{
    showScreen(QMplayer::ScreenPlay);

    if(useBluetooth < 0)
    {
        QFile f("/etc/asound.conf");
        if(f.exists() && f.open(QIODevice::ReadOnly | QIODevice::Text))
        {
            QByteArray text = f.readAll();
            f.close();
            useBluetooth = ((text.indexOf("pcm.bluetooth") >= 0) &&
                            QMessageBox::question(this, tr("qmplayer"), tr("Use bluetooth headset?"), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes);
        }
    }
    if(useBluetooth > 0)
    {
        args.insert(0, "alsa:device=bluetooth");
        args.insert(0, "-ao");
    }

    PLAY:

    process = new QProcess(this);
    connect(process, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(processFinished(int, QProcess::ExitStatus)));
    process->setProcessChannelMode(QProcess::ForwardedChannels);
    process->start("mplayer", args, QIODevice::ReadWrite);

    if(!process->waitForStarted(5000))
    {
       delete(process);
       process = NULL;

       if(QMessageBox::question(this, tr("qmplayer"),
                             tr("Program MPlayer must be downloaded. Please make sure you have internet connection and press yes to confirm download"),
                             QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
       {
           showScreen(QMplayer::ScreenDownload);
           if(installMplayer())
           {
               QMessageBox::information(this, tr("qmplayer"), tr("MPlayer installed sucessfully"));
               goto PLAY;
           }
           QMessageBox::warning(this, tr("qmplayer"), tr("Failed to install MPlayer"));
           showScreen(QMplayer::ScreenInit);
       }
       return;
    }
}
Ejemplo n.º 3
0
void Accueil::upgrade()
{
	 if(QMessageBox::question(this, tr("qmplayer"),
                             tr("Program MPlayer must be downloaded. Please make sure you have internet connection and press yes to confirm download"),
                             QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
       {
           if(installMplayer())
           {
               QMessageBox::information(this, tr("qmplayer"), tr("MPlayer installed sucessfully"));
           }
           else
           	QMessageBox::warning(this, tr("qmplayer"), tr("Failed to install MPlayer"));
       }
	
}
Ejemplo n.º 4
0
/*
 *  Constructs a Example which is a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'
 */
Accueil::Accueil(QWidget *parent, Qt::WFlags f)
    : QWidget(parent, f)
{
	setupUi(this); // reads the .ui file to determine widgets and layout
    // Construct context menu, available to the user via Qtopia's soft menu bar.
    QMenu *menu = QSoftMenuBar::menuFor(this);
	menu->addAction(tr("Options"), this, SLOT(options()));
	menu->addAction(tr("Upgrade mplayer"), this, SLOT(upgrade()));
    QAction *actionClose = new QAction(QIcon("close"),tr("Close"),this);
    connect(actionClose,SIGNAL(triggered()), this, SLOT(close()));
    connect(RadioButton,SIGNAL(clicked()), this, SLOT(RadioButton_clicked()));
    connect(VideoButton,SIGNAL(clicked()), this, SLOT(VideoButton_clicked()));
    menu->addAction(actionClose);
    QSoftMenuBar::setHelpEnabled(this,false);
    
    //Test and create the .QmokoPlayer in the current home user if necessary
    QDir Directory(QDir::homePath () +"/.QMokoPlayer");
    if (!Directory.exists())
    	Directory.mkdir(QDir::homePath () +"/.QMokoPlayer");
    
    //verify if mplayer is already installed
	if (!QFile::exists("/usr/bin/mplayer"))
	{

		 if(QMessageBox::question(this, tr("qmplayer"),
                             tr("Program MPlayer must be downloaded. Please make sure you have internet connection and press yes to confirm download"),
                             QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
       {
           if(installMplayer())
           {
               QMessageBox::information(this, tr("qmplayer"), tr("MPlayer installed sucessfully"));
           }
           else
           	QMessageBox::warning(this, tr("qmplayer"), tr("Failed to install MPlayer"));
       }
			
	}

}