예제 #1
0
void
DatabaseResolver::resolve( const Tomahawk::query_ptr& query )
{
    Tomahawk::DatabaseCommand_Resolve* cmd = new Tomahawk::DatabaseCommand_Resolve( query );

    connect( cmd, SIGNAL( results( Tomahawk::QID, QList< Tomahawk::result_ptr > ) ),
             SLOT( gotResults( Tomahawk::QID, QList< Tomahawk::result_ptr > ) ), Qt::QueuedConnection );
    connect( cmd, SIGNAL( albums( Tomahawk::QID, QList< Tomahawk::album_ptr > ) ),
             SLOT( gotAlbums( Tomahawk::QID, QList< Tomahawk::album_ptr > ) ), Qt::QueuedConnection );
    connect( cmd, SIGNAL( artists( Tomahawk::QID, QList< Tomahawk::artist_ptr > ) ),
             SLOT( gotArtists( Tomahawk::QID, QList< Tomahawk::artist_ptr > ) ), Qt::QueuedConnection );

    Tomahawk::Database::instance()->enqueue( Tomahawk::dbcmd_ptr( cmd ) );

}
예제 #2
0
void SearchDialog::databaseChanged( int ind ){

    delete database_;

    if(databaseComboBox->currentText()=="Discogs"){
        database_ = new Discogs( api_key_ );
        rolesTextEdit->show();
        notesTextEdit->show();
        genreLineEdit->show();
        rolesLabel->show();
        notesLabel->show();
        genreLabel->show();
    }else if(databaseComboBox->currentText()=="MusicBrainz" ){
        database_ = new MusicBrainz();
        rolesTextEdit->hide();
        notesTextEdit->hide();
        genreLineEdit->hide();
        rolesLabel->hide();
        notesLabel->hide();
        genreLabel->hide();
    }else{
        QMessageBox::critical(this,"","Unknown database, possible bug: "+databaseComboBox->currentText());
        return;
    }

    connect( database_, SIGNAL( resultsDownloaded( QHash<QString,Album> ) ), this, SLOT( getResults( QHash<QString,Album> ) ) );
    connect( database_, SIGNAL( albumDownloaded( Album ) ), this, SLOT( gotAlbum( Album ) ) );
    connect( database_, SIGNAL( albumsDownloaded( QHash<QString,Album> ) ), this, SLOT( gotAlbums( QHash<QString,Album> ) ) );

}