--- a/videocollection/videocollectionwrapper/src/videothumbnaildata_p.cpp Tue Jul 06 14:17:50 2010 +0300
+++ b/videocollection/videocollectionwrapper/src/videothumbnaildata_p.cpp Wed Aug 18 09:50:14 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 24 %
+// Version : %version: 24.1.3 %
// INCLUDE FILES
#include <qapplication.h>
@@ -163,13 +163,6 @@
FUNC_LOG;
if(mSignalsConnected)
{
- VideoSortFilterProxyModel *model =
- VideoCollectionWrapper::instance().getModel(VideoCollectionCommon::EModelTypeAllVideos);
- if(model)
- {
- disconnect(model->sourceModel(), SIGNAL(modelReady()), this, SLOT(modelChangedSlot()));
- disconnect(model->sourceModel(), SIGNAL(modelChanged()), this, SLOT(modelChangedSlot()));
- }
disconnect(mThumbnailFetcher, SIGNAL(thumbnailReady(QPixmap , const TMPXItemId &, int )),
this, SLOT(thumbnailReadySlot(QPixmap , const TMPXItemId &, int )));
disconnect(mThumbnailFetcher, SIGNAL(allThumbnailsFetched()),
@@ -197,8 +190,6 @@
this, SLOT(thumbnailReadySlot( QPixmap , const TMPXItemId &, int))) ||
!connect(mThumbnailFetcher, SIGNAL(allThumbnailsFetched()),
this, SLOT(allThumbnailsFetchedSlot())) ||
- !connect(model->sourceModel(), SIGNAL(modelReady()), this, SLOT(modelChangedSlot())) ||
- !connect(model->sourceModel(), SIGNAL(modelChanged()), this, SLOT(modelChangedSlot())) ||
!connect(mBgFetchTimer, SIGNAL(timeout()), this, SLOT(doBackgroundFetching())) ||
!connect(mTbnReportTimer, SIGNAL(timeout()), this, SLOT(reportThumbnailsReadySlot())))
{
@@ -220,7 +211,7 @@
// VideoThumbnailDataPrivate::getThumbnail()
// -----------------------------------------------------------------------------
//
-const QIcon* VideoThumbnailDataPrivate::getThumbnail(TMPXItemId mediaId)
+const QIcon* VideoThumbnailDataPrivate::getThumbnail( const TMPXItemId &mediaId)
{
const QIcon *thumbnail = mThumbnailData[mediaId];
if(!thumbnail)
@@ -268,7 +259,7 @@
// VideoThumbnailDataPrivate::startFetchingThumbnail()
// -----------------------------------------------------------------------------
//
-int VideoThumbnailDataPrivate::startFetchingThumbnail(TMPXItemId mediaId, int priority)
+int VideoThumbnailDataPrivate::startFetchingThumbnail(const TMPXItemId &mediaId, int priority)
{
if(!mCurrentModel || !mThumbnailFetcher)
{
@@ -299,11 +290,13 @@
void VideoThumbnailDataPrivate::doBackgroundFetching()
{
FUNC_LOG;
+ INFO_1("VideoThumbnailDataPrivate::doBackgroundFetching() bg fetch count: %d", mCurrentBackgroundFetchCount);
+
if(!mCurrentModel || !mThumbnailFetcher)
{
return;
}
-
+
if(mCurrentBackgroundFetchCount >= THUMBNAIL_CACHE_SIZE)
{
return;
@@ -348,9 +341,11 @@
// VideoThumbnailDataPrivate::getModelIndexes()
// -----------------------------------------------------------------------------
//
-void VideoThumbnailDataPrivate::getModelIndexes(QList<QModelIndex> &indexes, int startIndex, int endIndex)
+void VideoThumbnailDataPrivate::getModelIndexes(QList<QModelIndex> &indexes, int &startIndex, int &endIndex)
{
FUNC_LOG;
+ INFO_2("VideoThumbnailDataPrivate::getModelIndexes() from %d to %d", startIndex, endIndex);
+
QModelIndex index;
for(int i = startIndex; i < endIndex; i++)
{
@@ -410,20 +405,10 @@
}
// -----------------------------------------------------------------------------
-// VideoThumbnailDataPrivate::modelChangedSlot()
-// -----------------------------------------------------------------------------
-//
-void VideoThumbnailDataPrivate::modelChangedSlot()
-{
- FUNC_LOG;
- startBackgroundFetching(mCurrentModel, mCurrentFetchIndex);
-}
-
-// -----------------------------------------------------------------------------
// VideoThumbnailDataPrivate::defaultThumbnail()
// -----------------------------------------------------------------------------
//
-const QIcon* VideoThumbnailDataPrivate::defaultThumbnail(TMPXItemId mediaId)
+const QIcon* VideoThumbnailDataPrivate::defaultThumbnail(const TMPXItemId &mediaId)
{
const TMPXItemId defaultIdVideo(KMaxTUint32-1, KVcxMvcMediaTypeVideo);
const TMPXItemId defaultIdAlbum(KMaxTUint32-1, KVcxMvcMediaTypeAlbum);
@@ -538,7 +523,7 @@
// VideoThumbnailDataPrivate::removeThumbnail()
// -----------------------------------------------------------------------------
//
-bool VideoThumbnailDataPrivate::removeThumbnail(TMPXItemId mediaId)
+bool VideoThumbnailDataPrivate::removeThumbnail(const TMPXItemId &mediaId)
{
FUNC_LOG;
return mThumbnailData.remove(mediaId);
@@ -571,6 +556,15 @@
}
// -----------------------------------------------------------------------------
+// VideoThumbnailDataPrivate::backgroundFetchingEnabled()
+// -----------------------------------------------------------------------------
+//
+bool VideoThumbnailDataPrivate::backgroundFetchingEnabled()
+{
+ return mBackgroundFetchingEnabled;
+}
+
+// -----------------------------------------------------------------------------
// VideoThumbnailDataPrivate::freeThumbnailData()
// -----------------------------------------------------------------------------
//
@@ -622,7 +616,12 @@
INFO("VideoThumbnailDataPrivate::startBackgroundFetching() fetching is disabled.");
return;
}
-
+
+ if(mBgFetchTimer)
+ {
+ mBgFetchTimer->stop();
+ }
+
doBackgroundFetching();
}