示例#1
0
bool booksList::query()
{
    _currentStrip.clear();
    _workorder_lister.query();
    job        *current_job;
    if(_workorder_lister.first()){
        do{
            //only select from lista
            //qDebug() << ;
            workorder w = _workorder_lister.item();
            if(!w.lista()) continue;
            qDebug() << "lista!";
            booksWorks work;
            current_job = job::fromWorkorder(&(w));
            //qDebug() << current_job;
            books bk  = *(current_job->currentBook());
            if(_currentStrip.contains(bk))
                work = _currentStrip.value(bk);

            if(w.doComplete())
                work.first.append(w);
            else
                work.second.append(w);
            _currentStrip.insert(bk, work);
            delete current_job;
        }while(_workorder_lister.next());
    };
    /*qDebug() << _currentStrip.count();
    for(int i = 0; i < _currentStrip.count(); i++){
        qDebug() << _currentStrip.keys().at(i).internalID();
    };*/
    emit queryDone();
}
示例#2
0
void
IpodCopyTracksJob::slotStartDuplicateTrackSearch( const Meta::TrackPtr &track )
{
    Collections::QueryMaker *qm = m_coll.data()->queryMaker();
    qm->setQueryType( Collections::QueryMaker::Track );

    // we cannot qm->addMatch( track ) - it matches by uidUrl()
    qm->addFilter( Meta::valTitle, track->name(), true, true );
    qm->addMatch( track->album() );
    qm->setArtistQueryMode( Collections::QueryMaker::TrackArtists );
    qm->addMatch( track->artist() );
    qm->addMatch( track->composer() );
    qm->addMatch( track->genre() );
    qm->addMatch( track->year() );
    qm->addNumberFilter( Meta::valTrackNr, track->trackNumber(), Collections::QueryMaker::Equals );
    qm->addNumberFilter( Meta::valDiscNr, track->discNumber(), Collections::QueryMaker::Equals );
    // we don't want to match by filesize, track length, filetype etc - these change during
    // transcoding. We don't match album artist because handling of it is inconsistent

    connect( qm, SIGNAL(newResultReady(Meta::TrackList)),
             SLOT(slotDuplicateTrackSearchNewResult(Meta::TrackList)) );
    connect( qm, SIGNAL(queryDone()), SLOT(slotDuplicateTrackSearchQueryDone()) );
    qm->setAutoDelete( true );
    m_duplicateTrack = Meta::TrackPtr(); // reset duplicate track from previous query
    qm->run();
}
示例#3
0
void
APG::ConstraintSolver::receiveQueryMakerDone()
{
    m_qm->deleteLater();
    m_qm = 0;

    if (( m_domain.size() > 0 ) || m_domainReductionFailed ) {
        if ( m_domain.size() <= 0 ) {
            Amarok::Components::logger()->shortMessage( i18n("The playlist generator failed to load any tracks from the collection.") );
        }
        m_readyToRun = true;
        emit readyToRun();
    } else {
        Amarok::Components::logger()->longMessage(
                    i18n("There are no tracks that match all constraints. " \
                         "The playlist generator will find the tracks that match best, " \
                "but you may want to consider loosening the constraints to find more tracks.") );
        m_domainReductionFailed = true;

        // need a new query maker without constraints
        m_qm = CollectionManager::instance()->queryMaker();
        if ( m_qm ) {
            connect( m_qm, SIGNAL(newResultReady(Meta::TrackList)), this, SLOT(receiveQueryMakerData(Meta::TrackList)), Qt::QueuedConnection );
            connect( m_qm, SIGNAL(queryDone()), this, SLOT(receiveQueryMakerDone()), Qt::QueuedConnection );

            m_qm->setQueryType( Collections::QueryMaker::Track );
            m_qm->run();
        }
    }
}
示例#4
0
CoverManager::CoverManager( QWidget *parent )
        : KDialog( parent )
        , m_currentView( AllAlbums )
        , m_timer( new QTimer( this ) )    //search filter timer
        , m_fetchingCovers( false )
        , m_coversFetched( 0 )
        , m_coverErrors( 0 )
        , m_isLoadingCancelled( false )
{
    DEBUG_BLOCK

    setObjectName( "TheCoverManager" );

    s_instance = this;

    // Sets caption and icon correctly (needed e.g. for GNOME)
    kapp->setTopWidget( this );
    setButtons( 0 );
    setCaption( i18n("Cover Manager") );
    setAttribute( Qt::WA_DeleteOnClose );

    connect( this, SIGNAL(hidden()), SLOT(delayedDestruct()) );
    connect( this, SIGNAL(closeClicked()), SLOT(delayedDestruct()) );

    m_splitter = new QSplitter( this );
    setMainWidget( m_splitter );

    //artist listview
    m_artistView = new QTreeWidget( m_splitter );
    m_artistView->setHeaderLabel( i18n( "Albums By" ) );
    m_artistView->setSortingEnabled( false );
    m_artistView->setTextElideMode( Qt::ElideRight );
    m_artistView->setMinimumWidth( 200 );
    m_artistView->setColumnCount( 1 );
    m_artistView->setAlternatingRowColors( true );
    m_artistView->setUniformRowHeights( true );
    m_artistView->setSelectionMode( QAbstractItemView::ExtendedSelection );

    ArtistItem *item = 0;
    item = new ArtistItem( i18n( "All Artists" ) );
    item->setIcon(0, SmallIcon( "media-optical-audio-amarok" ) );
    m_items.append( item );

    Collections::Collection *coll = CollectionManager::instance()->primaryCollection();
    Collections::QueryMaker *qm = coll->queryMaker();
    qm->setAutoDelete( true );
    qm->setQueryType( Collections::QueryMaker::Artist );
    qm->setAlbumQueryMode( Collections::QueryMaker::OnlyNormalAlbums );
    qm->orderBy( Meta::valArtist );

    connect( qm, SIGNAL(newResultReady(Meta::ArtistList)),
             this, SLOT(slotArtistQueryResult(Meta::ArtistList)) );

    connect( qm, SIGNAL(queryDone()), this, SLOT(slotContinueConstruction()) );

    qm->run();
}
示例#5
0
void ImageViewer::connectWidgets(){
	connect(startBtn, SIGNAL(clicked()), model, SLOT(doRegistration()));
	connect(model, SIGNAL(processingDone()), this, SLOT(enableQuery()));
	connect(queryBtn, SIGNAL(clicked()), model, SLOT(doQuery()));
	connect(model, SIGNAL(queryDone()), this, SLOT(showCorrespondingPoints()));
	connect(matchingBtn, SIGNAL(clicked()), model, SLOT(doMatching()));
	connect(model, SIGNAL(matchingDone()), this, SLOT(showMatchingResult()));

}
示例#6
0
void BaaSModel::onQuerySucceeded(const QHash<int, QByteArray>& _roles, const QVector<QVariantMap>& _data)
{
    beginResetModel();
    m_rows.clear();
    m_roles.clear();

    m_roles= _roles;
    for (auto elem : _data)
        m_rows.push_back( BaaSModelItem( elem) );

    endResetModel();
    emit queryDone();
}
示例#7
0
void
TagDialog::musicbrainzQuery() //SLOT
{
#if HAVE_TUNEPIMP
    kdDebug() << k_funcinfo << endl;

    m_mbTrack = m_bundle.url().path();
    KTRMLookup* ktrm = new KTRMLookup( m_mbTrack, true );
    connect( ktrm, SIGNAL( sigResult( KTRMResultList, QString ) ), SLOT( queryDone( KTRMResultList, QString ) ) );

    pushButton_musicbrainz->setEnabled( false );
    pushButton_musicbrainz->setText( i18n( "Generating audio fingerprint..." ) );
    QApplication::setOverrideCursor( KCursor::workingCursor() );
#endif
}
示例#8
0
DBusQueryHelper::DBusQueryHelper( QObject *parent, Collections::QueryMaker *qm, const QDBusConnection &conn, const QDBusMessage &msg, bool mprisCompatible )
    : QObject( parent )
    , m_connection( conn )
    , m_message( msg )
    , m_mprisCompatibleResult( mprisCompatible )
    , m_timeout( false )
{
    qm->setAutoDelete( true );
    qm->setQueryType( Collections::QueryMaker::Track );
    connect( qm, SIGNAL(newResultReady(Meta::TrackList)), this, SLOT(slotResultReady(Meta::TrackList)), Qt::QueuedConnection );
    connect( qm, SIGNAL(queryDone()), this, SLOT(slotQueryDone()), Qt::QueuedConnection );
    qm->run();

    //abort query after 15 seconds in case the query does not return
    QTimer::singleShot( 15000, this, SLOT(abortQuery()) );
}
示例#9
0
void
Dynamic::SearchQueryBias::newQuery()
{
    DEBUG_BLOCK;

    // ok, I need a new query maker
    m_qm.reset( CollectionManager::instance()->queryMaker() );
    Collections::addTextualFilter( m_qm.data(), m_filter );
    m_qm->setQueryType( Collections::QueryMaker::Custom );
    m_qm->addReturnValue( Meta::valUniqueId );

    connect( m_qm.data(), SIGNAL(newResultReady(QStringList)),
             this, SLOT(updateReady(QStringList)), Qt::QueuedConnection );
    connect( m_qm.data(), SIGNAL(queryDone()),
             this, SLOT(updateFinished()), Qt::QueuedConnection );
    m_qm.data()->run();
}
示例#10
0
void toTemplateSQLObject::expand(void)
{
    try
    {
        delete Query;
        Query = NULL;
        Query = new toEventQuery(this
                                 , Parent->connection()
                                 , Parent->SQL
                                 , toQueryParams()
                                 , toEventQuery::READ_ALL
                                );
        connect(Query, SIGNAL(dataAvailable()), this, SLOT(poll()));
        connect(Query, SIGNAL(done()), this, SLOT(queryDone()));
        Query->start();
    }
    TOCATCH
}
示例#11
0
void toResultLine::query(const QString &sql, const toQueryParams &param, bool first)
{
    if (!handled() || Query)
        return ;
#if 0
    start();
#endif
    setSqlAndParams(sql, param);

    try
    {
        First = first;
        Query = new toEventQuery(this, connection(), sql, param, toEventQuery::READ_ALL);
        connect(Query, SIGNAL(dataAvailable()), this, SLOT(poll()));
        connect(Query, SIGNAL(done()), this, SLOT(queryDone()));
        Query->start();
    }
    TOCATCH
}
示例#12
0
void
Dynamic::QuizPlayBias::newQuery()
{
    // ok, I need a new query maker
    m_qm.reset( CollectionManager::instance()->queryMaker() );

    uint field = 0;
    switch( m_follow )
    {
    case Dynamic::QuizPlayBias::TitleToTitle:   field = Meta::valTitle; break;
    case Dynamic::QuizPlayBias::ArtistToArtist: field = Meta::valArtist; break;
    case Dynamic::QuizPlayBias::AlbumToAlbum:   field = Meta::valAlbum; break;
    }
    m_qm->addFilter( field,  QString(m_currentCharacter), true, false );

    m_qm->setQueryType( Collections::QueryMaker::Custom );
    m_qm->addReturnValue( Meta::valUniqueId );

    connect( m_qm.data(), SIGNAL(newResultReady( QStringList )),
             this, SLOT(updateReady( QStringList )) );
    connect( m_qm.data(), SIGNAL(queryDone()),
             this, SLOT(updateFinished()) );
    m_qm.data()->run();
}
示例#13
0
APG::ConstraintSolver::ConstraintSolver( ConstraintNode* r, int qualityFactor )
        : m_satisfactionThreshold( 0.95 )
        , m_finalSatisfaction( 0.0 )
        , m_constraintTreeRoot( r )
        , m_domainReductionFailed( false )
        , m_readyToRun( false )
        , m_abortRequested( false )
        , m_maxGenerations( 100 )
        , m_populationSize( 40 )
        , m_suggestedPlaylistSize( 15 )
{
    Q_UNUSED( qualityFactor); // FIXME

    m_serialNumber = KRandom::random();

    if ( !m_constraintTreeRoot ) {
        error() << "No constraint tree was passed to the solver.  Aborting.";
        m_readyToRun = true;
        m_abortRequested = true;
        return;
    }

    m_qm = CollectionManager::instance()->queryMaker();
    if ( m_qm ) {
        debug() << "New ConstraintSolver with serial number" << m_serialNumber;
        m_qm->setQueryType( Collections::QueryMaker::Track );
        connect( m_qm, SIGNAL(newResultReady(Meta::TrackList)), this, SLOT(receiveQueryMakerData(Meta::TrackList)), Qt::QueuedConnection );
        connect( m_qm, SIGNAL(queryDone()), this, SLOT(receiveQueryMakerDone()), Qt::QueuedConnection );
        m_constraintTreeRoot->initQueryMaker( m_qm );
        m_qm->run();
    } else {
        debug() << "The ConstraintSolver could not find any queryable collections.  No results will be returned.";
        m_readyToRun = true;
        m_abortRequested = true;
    }
}
示例#14
0
    // - construct the query
    m_qm->beginOr();
    foreach( const QString &artist, artists )
    {
        // debug() << "adding artist to query:" << artist;
        m_qm->addFilter( Meta::valArtist, artist, true, true );
    }
    m_qm->endAndOr();

    m_qm->setQueryType( Collections::QueryMaker::Custom );
    m_qm->addReturnValue( Meta::valUniqueId );

    connect( m_qm.data(), SIGNAL(newResultReady( QStringList )),
             this, SLOT(updateReady( QStringList )) );
    connect( m_qm.data(), SIGNAL(queryDone()),
             this, SLOT(updateFinished()) );

    // - run the query
    m_qm.data()->run();
}

void
Dynamic::WeeklyTopBias::newWeeklyTimesQuery()
{
    DEBUG_BLOCK

    QMap< QString, QString > params;
    params[ "method" ] = "user.getWeeklyChartList" ;
    params[ "user" ] = lastfm::ws::Username;
示例#15
0
void
Dynamic::TagMatchBias::newQuery()
{
    DEBUG_BLOCK;

    // ok, I need a new query maker
    m_qm.reset( CollectionManager::instance()->queryMaker() );

    // -- set the querymaker
    if( m_filter.isDate() )
    {
        switch( m_filter.condition )
        {
        case MetaQueryWidget::LessThan:
        case MetaQueryWidget::Equals:
        case MetaQueryWidget::GreaterThan:
            m_qm->addNumberFilter( m_filter.field(), m_filter.numValue,
                                (Collections::QueryMaker::NumberComparison)m_filter.condition );
            break;
        case MetaQueryWidget::Between:
            m_qm->beginAnd();
            m_qm->addNumberFilter( m_filter.field(), qMin(m_filter.numValue, m_filter.numValue2)-1,
                                Collections::QueryMaker::GreaterThan );
            m_qm->addNumberFilter( m_filter.field(), qMax(m_filter.numValue, m_filter.numValue2)+1,
                                Collections::QueryMaker::LessThan );
            m_qm->endAndOr();
            break;
        case MetaQueryWidget::OlderThan:
            m_qm->addNumberFilter( m_filter.field(), QDateTime::currentDateTime().toTime_t() - m_filter.numValue,
                                Collections::QueryMaker::LessThan );
            break;
        default:
            ;
        }
    }
    else if( m_filter.isNumeric() )
    {
        switch( m_filter.condition )
        {
        case MetaQueryWidget::LessThan:
        case MetaQueryWidget::Equals:
        case MetaQueryWidget::GreaterThan:
            m_qm->addNumberFilter( m_filter.field(), m_filter.numValue,
                                (Collections::QueryMaker::NumberComparison)m_filter.condition );
            break;
        case MetaQueryWidget::Between:
            m_qm->beginAnd();
            m_qm->addNumberFilter( m_filter.field(), qMin(m_filter.numValue, m_filter.numValue2)-1,
                                Collections::QueryMaker::GreaterThan );
            m_qm->addNumberFilter( m_filter.field(), qMax(m_filter.numValue, m_filter.numValue2)+1,
                                Collections::QueryMaker::LessThan );
            m_qm->endAndOr();
            break;
        default:
            ;
        }
    }
    else
    {
        switch( m_filter.condition )
        {
        case MetaQueryWidget::Equals:
            m_qm->addFilter( m_filter.field(), m_filter.value, true, true );
            break;
        case MetaQueryWidget::Contains:
            if( m_filter.field() == 0 )
            {
                // simple search
                // TODO: split different words and make separate searches
                m_qm->beginOr();
                m_qm->addFilter( Meta::valArtist,  m_filter.value );
                m_qm->addFilter( Meta::valTitle,   m_filter.value );
                m_qm->addFilter( Meta::valAlbum,   m_filter.value );
                m_qm->addFilter( Meta::valGenre,   m_filter.value );
                m_qm->addFilter( Meta::valUrl,     m_filter.value );
                m_qm->addFilter( Meta::valComment, m_filter.value );
                m_qm->addFilter( Meta::valLabel,   m_filter.value );
                m_qm->endAndOr();
            }
            else
            {
                m_qm->addFilter( m_filter.field(), m_filter.value );
            }
            break;
        default:
            ;
        }
    }

    m_qm->setQueryType( Collections::QueryMaker::Custom );
    m_qm->addReturnValue( Meta::valUniqueId );

    connect( m_qm.data(), SIGNAL(newResultReady(QStringList)),
             this, SLOT(updateReady(QStringList)), Qt::QueuedConnection );
    connect( m_qm.data(), SIGNAL(queryDone()),
             this, SLOT(updateFinished()), Qt::QueuedConnection );
    m_qm.data()->run();
}