Exemplo n.º 1
0
bool SmlAllModel::setData(const QModelIndex &index, const QVariant &value, int /* role */)
{
    if (index.column() == 0)
        return false;

    QModelIndex smlIdIndex = QSqlQueryModel::index(index.row(), 0);
    int smlId = data(smlIdIndex,0).toInt();

    clear();

    bool ok = true;
    switch (index.column()) {
    case 1:
        ok = setAuthor(smlId, value.toString());
        break;
    case 2:
        ok = setTitle(smlId, value.toString());
        break;
    case 3:
        ok = setPublisher(smlId, value.toString());
        break;
    }
    refresh();
    return ok;
}
BookRecord::BookRecord(string title, string author, string publisher, int ISBN)
{

	setTitle(title);
	setAuthor(author);
	setPublisher(publisher);
	setISBN(ISBN);

}
Exemplo n.º 3
0
void RomInfo::fillData()
{
    if (m_gamename == "")
    {
        return;
    }

    MSqlQuery query(MSqlQuery::InitCon());

    QString systemtype;
    if (m_system != "") {
        systemtype  += " AND system = :SYSTEM ";
    }

    QString thequery = "SELECT system,gamename,genre,year,romname,favorite,"
                       "rompath,country,crc_value,diskcount,gametype,plot,publisher,"
                       "version,screenshot,fanart,boxart,inetref,intid FROM gamemetadata "
                       "WHERE gamename = :GAMENAME "
                       + systemtype + " ORDER BY diskcount DESC";

    query.prepare(thequery);
    query.bindValue(":SYSTEM", m_system);
    query.bindValue(":GAMENAME", m_gamename);

    if (query.exec() && query.next())
    {
        setSystem(query.value(0).toString());
        setGamename(query.value(1).toString());
        setGenre(query.value(2).toString());
        setYear(query.value(3).toString());
        setRomname(query.value(4).toString());
        setField("favorite",query.value(5).toString());
        setRompath(query.value(6).toString());
        setCountry(query.value(7).toString());
        setCRC_VALUE(query.value(8).toString());
        setDiskCount(query.value(9).toInt());
        setGameType(query.value(10).toString());
        setPlot(query.value(11).toString());
        setPublisher(query.value(12).toString());
        setVersion(query.value(13).toString());
        setScreenshot(query.value(14).toString());
        setFanart(query.value(15).toString());
        setBoxart(query.value(16).toString());
        setInetref(query.value(17).toString());
        setId(query.value(18).toInt());
    }

    setRomCount(romInDB(m_romname,m_gametype));

    // If we have more than one instance of this rom in the DB fill in all
    // systems available to play it.
    if (RomCount() > 1)
    {
        query.prepare("SELECT DISTINCT system FROM gamemetadata "
                      "WHERE romname = :ROMNAME");
        query.bindValue(":ROMNAME", Romname());
        if (!query.exec())
            MythDB::DBError("RomInfo::fillData - selecting systems", query);

        while (query.next())
        {
            if (m_allsystems.isEmpty())
                m_allsystems = query.value(0).toString();
            else
                m_allsystems += "," + query.value(0).toString();
        }
    }
    else
    {
        m_allsystems = m_system;
    }
}
Exemplo n.º 4
0
LibraryUI::LibraryUI( const QString & name , SApplication *parent )
    : SPage( name , parent )
{
    this->setAcceptDrops( true );

    QDir conf_dir( Silicon::config() + "/Library" );
        conf_dir.mkpath( conf_dir.path() );

    QString path = conf_dir.path() + "/library";
    library = new Librarydb( path );

    item_list = new ItemList();
        item_list->setLibrary( library );
        item_list->setIconSize( QSize(32,32) );
        item_list->setContextMenuPolicy( Qt::CustomContextMenu );

    tags_list = new TagsList();
        tags_list->setLibrary( library );
        //tags_list->setFixedWidth( 235 );

    char_list = new CharList();
        char_list->setFixedWidth( 43 );
        char_list->setLibrary( library );
        char_list->setFilterList( tags_list );

    format_list = new FormatList();
        format_list->setFixedWidth( 73 );
        format_list->setFilterList( char_list );


    filters_box = new QGroupBox( tr("Filters") );
        filters_box->setFixedWidth( 313 );

    filters_layout = new QHBoxLayout( filters_box );
        filters_layout->addWidget( format_list );
        filters_layout->addWidget( char_list );
        filters_layout->addWidget( tags_list );

    list_widget_box = new QGroupBox( "Result List" );
    list_widget_layout = new QVBoxLayout( list_widget_box );
        list_widget_layout->addWidget( item_list );

    item_preview = new ItemPreview();
    toolbar = new QToolBar();
        toolbar->setToolButtonStyle( Qt::ToolButtonTextBesideIcon );
        toolbar->setStyleSheet( "QToolBar{border-style:solid}" );

    lists_layout = new QHBoxLayout();
        lists_layout->addWidget( filters_box );
        lists_layout->addWidget( list_widget_box );

    base_layout = new QVBoxLayout( this );
        //base_layout->addWidget( toolbar );
        base_layout->addLayout( lists_layout );
        base_layout->addWidget( item_preview );


    mounter = SiDiTools::createImageMounter( this );
    isoinfo = new SIsoInfo( this );

    QObject::connect( isoinfo , SIGNAL(copyrightUpdated(QString)) , item_preview , SLOT(setCopyright(QString)) );
    QObject::connect( isoinfo , SIGNAL(volumeUpdated(QString)) , item_preview , SLOT(setVolumeID(QString)) );
    QObject::connect( isoinfo , SIGNAL(applicationIdReaded(QString)) , item_preview , SLOT(setApplicationID(QString)) );
    QObject::connect( isoinfo , SIGNAL(systemUpdated(QString)) , item_preview , SLOT(setSystemID(QString)) );
    QObject::connect( isoinfo , SIGNAL(publisherUpdated(QString)) , item_preview , SLOT(setPublisher(QString)) );
    QObject::connect( isoinfo , SIGNAL(formatUpdated(QString)) , item_preview , SLOT(setFormat(QString)) );

    QObject::connect( tags_list , SIGNAL(rowChenged(QStringList)) , item_list , SLOT(setItems(QStringList)) );
    QObject::connect( item_list , SIGNAL(currentRowChanged(int)) , this , SLOT(itemChanged(int)) );
    QObject::connect( item_list , SIGNAL(itemDoubleClicked(QListWidgetItem*)) , this , SLOT(mountCurrentItem()) );

    setupActions();
    reload();

    setToolBar( toolbar );
    setMinimumSize( QSize(720,350) );
}