Logo Search packages:      
Sourcecode: bangarang version File versions  Download package

void MediaItemModel::load (  ) 

Loads list of MediaItems as specified by the MediaListProperties.lri

Note: Loading is asynchronous. Use mediaListChanged() signal to detect when loading is complete.

Definition at line 115 of file mediaitemmodel.cpp.

References ListEngineFactory::availableListEngine(), MediaListProperties::engine(), ListEngineFactory::engineExists(), ListEngineFactory::generateRequestSignature(), MediaListCache::isInCache(), MediaListProperties::lri, ListEngine::setMediaListProperties(), and ListEngine::setRequestSignature().

Referenced by reload().

{
    if (!m_mediaListProperties.lri.isEmpty()) {
        if (m_mediaListCache->isInCache(m_mediaListProperties.lri) && !m_forceRefreshFromSource) {
            setLoadingState(true);
            // Load data from from the cache
            ListEngine * listEngine = m_listEngineFactory->availableListEngine("cache://");
            MediaListProperties cacheListProperties;
            cacheListProperties.lri = QString("cache://dummyarg?%1").arg(m_mediaListProperties.lri);
            m_requestSignature = m_listEngineFactory->generateRequestSignature();
            listEngine->setRequestSignature(m_requestSignature);
            listEngine->setMediaListProperties(cacheListProperties);
            listEngine->start();
            kDebug() << "loading from cache for " << m_mediaListProperties.lri;
        } else {    
            if (m_listEngineFactory->engineExists(m_mediaListProperties.engine())) {
                setLoadingState(true);
                if (m_lrisLoading.indexOf(m_mediaListProperties.lri) == -1) {
                    // Since this lri is not currently being loaded by any list engine
                    // go ahead and start a new load
                    ListEngine * listEngine = m_listEngineFactory->availableListEngine(m_mediaListProperties.engine());
                    m_requestSignature = m_listEngineFactory->generateRequestSignature();
                    listEngine->setRequestSignature(m_requestSignature);
                    listEngine->setMediaListProperties(m_mediaListProperties);
                    m_lriStartTimes.insert(m_mediaListProperties.lri, QTime::currentTime());
                    m_lrisLoading.append(m_mediaListProperties.lri);
                    listEngine->start();
                    kDebug() << "started new load for " << m_mediaListProperties.lri;
                } else {
                    kDebug() << "waiting for " << m_mediaListProperties.lri;
                }
            } else {
                showNoResultsMessage();
            }
            m_forceRefreshFromSource = false;
        }
    }
    m_loadSources = false;
}


Generated by  Doxygen 1.6.0   Back to index