コード例 #1
0
void RetroArchTools::on_addfilebutton_clicked()
{
    QString filetemp = QFileDialog::getOpenFileName(this,tr("Select a file to add to your m3u."));
    if (inputExists(filetemp) && fileExists(filetemp) && isFile(filetemp))
    {
        ui->m3u_listbox->addItem(filetemp);
        ui->m3u_listbox->sortItems();
    }
}
コード例 #2
0
void RetroArchTools::on_m3ugenbutton_clicked()
{
    m3udata_current.outpath = ui->m3u_outbox->text();
    m3udata_current.name = ui->dir2m3u_name->text();
    if (!inputExists(m3udata_current.name))
    {
        QMessageBox::warning(this,tr("Error!"),tr("Please input the name of the multi-disk game."));
        return;
    }
    if (!inputExists(m3udata_current.outpath))
    {
        QMessageBox::warning(this,tr("Error!"),tr("Please input the output path for the m3u."));
        return;
    }
    if (!fileExists(m3udata_current.outpath) || isFile(m3udata_current.outpath))
    {
        QMessageBox::warning(this,tr("Error!"),tr("Cannot find output directory!"));
        return;
    }
    QString m3ufile = QDir(m3udata_current.outpath).filePath(m3udata_current.name + ".m3u");
    QFile m3u2(m3ufile);
    if (m3u2.open(QFile::WriteOnly | QFile::Truncate))
    {
        QTextStream m3u2_out(&m3u2);
        for(int row = 0; row < ui->m3u_listbox->count(); row++)
        {
            QFileInfo tempfile(ui->m3u_listbox->item(row)->text());
            m3u2_out << tempfile.fileName() + "\n";
        }
        m3u2.close();
    }
    else
    {
        QMessageBox::warning(this,tr("Error!"),tr("Error writing to m3u (check the file isn't being used somewhere)"));
        return;
    }
    QMessageBox::information(this,tr("Finished!"),"m3u file created at " + m3ufile);
}
コード例 #3
0
ファイル: controller.cpp プロジェクト: r1k/vlc
/* Reemit some signals on status Change to activate some buttons */
void AbstractController::setStatus( int status )
{
    bool b_hasInput = THEMIM->getIM()->hasInput();
    /* Activate the interface buttons according to the presence of the input */
    emit inputExists( b_hasInput );

    emit inputPlaying( status == PLAYING_S );

    emit inputIsRecordable( b_hasInput &&
                            var_GetBool( THEMIM->getInput(), "can-record" ) );

    emit inputIsTrickPlayable( b_hasInput &&
                            var_GetBool( THEMIM->getInput(), "can-rewind" ) );
}
コード例 #4
0
int AbstractController::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QFrame::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: inputExists((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 1: inputPlaying((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 2: inputIsRecordable((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 3: inputIsTrickPlayable((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 4: setStatus((*reinterpret_cast< int(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 5;
    }
    return _id;
}
コード例 #5
0
void RetroArchTools::on_genPlaylistBtn_clicked()
{
    d2pdatacurrent.systemname = ui->nosinput->text();
    d2pdatacurrent.extension = ui->feinput->text();
    d2pdatacurrent.corename = ui->noecinput->text();
    d2pdatacurrent.corepath = ui->ptcinput->text();
    d2pdatacurrent.rompath = ui->ptrinput->text();

    if (!inputExists(d2pdatacurrent.systemname))
    {
        QMessageBox::warning(this,tr("Error!"),tr("Please input the name of the system."));
        return;
    }
    if (!inputExists(d2pdatacurrent.extension) || d2pdatacurrent.extension == ".")
    {
        QMessageBox::warning(this,tr("Error!"),tr("Please input the rom extension."));
        return;
    }
    if (!inputExists(d2pdatacurrent.corename))
    {
        d2pdatacurrent.corename = "DETECT";
    }
    if (d2pdatacurrent.extension[0] != '.')
    {
        QMessageBox::warning(this,tr("Error!"),tr("File extension must begin with a '.'"));
        return;
    }
    if (!fileExists(d2pdatacurrent.corepath) || !isFile(d2pdatacurrent.corepath))
    {
        if (inputExists(d2pdatacurrent.corepath))
        {
            QMessageBox::warning(this,tr("Error!"),tr("Cannot find emulator core file!"));
            return;
        }
        else
        {
            d2pdatacurrent.corepath = "DETECT";
        }
    }
    if (!fileExists(d2pdatacurrent.rompath) || isFile(d2pdatacurrent.rompath))
    {
        QMessageBox::warning(this,tr("Error!"),tr("Cannot find rom directory!"));
        return;
    }
    if (!fileExists(d2pdatacurrent.playlistpath) || isFile(d2pdatacurrent.playlistpath))
    {
        QMessageBox::warning(this,tr("Error!"),tr("Cannot find playlist directory!"));
        return;
    }
    QString playlistfile = QDir(d2pdatacurrent.playlistpath).filePath(d2pdatacurrent.systemname + ".lpl");
    QFile playlist(playlistfile);
    QDir romdir(d2pdatacurrent.rompath);
    QStringList filters;
    filters << "*" + d2pdatacurrent.extension;
    QFileInfoList *roms = new QFileInfoList(romdir.entryInfoList(filters));
    int crc = 1;
    if (playlist.open(QFile::WriteOnly | QFile::Truncate))
    {
        QTextStream out(&playlist);
        for(const auto &fileName : *roms)
        {
            out << QDir::toNativeSeparators(fileName.absoluteFilePath()) + "\n";
            out << fileName.baseName() + "\n";
            out << QDir::toNativeSeparators(d2pdatacurrent.corepath) + "\n";
            out << d2pdatacurrent.corename + "\n";
            out << QString::number(crc) + "|crc\n";
            out << d2pdatacurrent.systemname + ".lpl\n";
            crc++;
        }
        playlist.close();
    }
    else
    {
        QMessageBox::warning(this,tr("Error!"),tr("Error writing to playlist (check the file isn't being used somewhere)"));
        delete roms;
        return;
    }
    delete roms;
    QMessageBox::information(this,tr("Finished!"),"Playlist file created at " + playlistfile);
}
コード例 #6
0
void RetroArchTools::on_dir2m3u_genbutton_clicked()
{
    d2m3udata_current.extension = ui->dir2m3u_extbox->text();
    d2m3udata_current.outpath = ui->m3u_outbox->text();
    d2m3udata_current.rompath = ui->dir2m3u_rombox->text();
    d2m3udata_current.name = ui->dir2m3u_name->text();
    if (!inputExists(d2m3udata_current.name))
    {
        QMessageBox::warning(this,tr("Error!"),tr("Please input the name of the multi-disk game."));
        return;
    }
    if (!inputExists(d2m3udata_current.extension) || d2m3udata_current.extension == ".")
    {
        QMessageBox::warning(this,tr("Error!"),tr("Please input the rom extension."));
        return;
    }
    if (!inputExists(d2m3udata_current.outpath))
    {
        QMessageBox::warning(this,tr("Error!"),tr("Please input the output path for the m3u."));
        return;
    }
    if (!inputExists(d2m3udata_current.rompath))
    {
        QMessageBox::warning(this,tr("Error!"),tr("Please select the folder containing the rom/images used to create the m3u file."));
        return;
    }
    if (!fileExists(d2m3udata_current.outpath) || isFile(d2m3udata_current.outpath))
    {
        QMessageBox::warning(this,tr("Error!"),tr("Cannot find output directory!"));
        return;
    }
    if (!fileExists(d2m3udata_current.rompath) || isFile(d2m3udata_current.rompath))
    {
        QMessageBox::warning(this,tr("Error!"),tr("Cannot find rom directory!"));
        return;
    }
    if (d2m3udata_current.extension[0] != '.')
    {
        QMessageBox::warning(this,tr("Error!"),tr("File extension must begin with a '.'"));
        return;
    }
    QString m3ufile = QDir(d2m3udata_current.outpath).filePath(d2m3udata_current.name + ".m3u");
    QFile m3u(m3ufile);
    QDir d2m3u_romdir(d2m3udata_current.rompath);
    QStringList filters;
    filters << "*" + d2m3udata_current.extension;
    QFileInfoList *d2m3u_roms = new QFileInfoList(d2m3u_romdir.entryInfoList(filters));
    if (m3u.open(QFile::WriteOnly | QFile::Truncate))
    {
        QTextStream m3u_out(&m3u);
        for(const auto &romfile : *d2m3u_roms)
        {
            m3u_out << romfile.fileName() + "\n";
        }
        m3u.close();
    }
    else
    {
        QMessageBox::warning(this,tr("Error!"),tr("Error writing to m3u (check the file isn't being used somewhere)"));
        return;
    }
    delete d2m3u_roms;
    QMessageBox::information(this,tr("Finished!"),"m3u file created at " + m3ufile);
}