# HG changeset patch
# User hgs
# Date 1283506663 -10800
# Node ID d2b028fd1f7d04fe251758122a86461949cb48ac
# Parent 4bfa887905cfc6a2be3dc63ab7f507babfcac573
201035
diff -r 4bfa887905cf -r d2b028fd1f7d package_definition.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/package_definition.xml Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,95 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r 4bfa887905cf -r d2b028fd1f7d package_map.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/package_map.xml Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,1 @@
+
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/bwins/videocollectionwrapperu.def
--- a/videocollection/bwins/videocollectionwrapperu.def Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/bwins/videocollectionwrapperu.def Fri Sep 03 12:37:43 2010 +0300
@@ -1,82 +1,82 @@
EXPORTS
?sendAsyncStatus@VideoCollectionWrapper@@QAEXHAAVQVariant@@@Z @ 1 NONAME ; void VideoCollectionWrapper::sendAsyncStatus(int, class QVariant &)
- ??1VideoSortFilterProxyModel@@UAE@XZ @ 2 NONAME ; VideoSortFilterProxyModel::~VideoSortFilterProxyModel(void)
- ?open@VideoSortFilterProxyModel@@QAEHW4TCollectionLevels@VideoCollectionCommon@@@Z @ 3 NONAME ; int VideoSortFilterProxyModel::open(enum VideoCollectionCommon::TCollectionLevels)
- ?deleteItems@VideoSortFilterProxyModel@@QAEHABV?$QList@VQModelIndex@@@@@Z @ 4 NONAME ; int VideoSortFilterProxyModel::deleteItems(class QList const &)
- ?trUtf8@VideoThumbnailData@@SA?AVQString@@PBD0@Z @ 5 NONAME ; class QString VideoThumbnailData::trUtf8(char const *, char const *)
- ?removeItemsFromAlbum@VideoSortFilterProxyModel@@QAEHAAVTMPXItemId@@ABV?$QList@VTMPXItemId@@@@@Z @ 6 NONAME ; int VideoSortFilterProxyModel::removeItemsFromAlbum(class TMPXItemId &, class QList const &)
- ?instance@VideoCollectionWrapper@@SAAAV1@XZ @ 7 NONAME ; class VideoCollectionWrapper & VideoCollectionWrapper::instance(void)
- ?back@VideoSortFilterProxyModel@@QAEHXZ @ 8 NONAME ; int VideoSortFilterProxyModel::back(void)
- ?modelReady@VideoSortFilterProxyModel@@IAEXXZ @ 9 NONAME ; void VideoSortFilterProxyModel::modelReady(void)
- ?albumChangedSlot@VideoSortFilterProxyModel@@AAEXXZ @ 10 NONAME ; void VideoSortFilterProxyModel::albumChangedSlot(void)
- ?qt_metacall@VideoThumbnailData@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 11 NONAME ; int VideoThumbnailData::qt_metacall(enum QMetaObject::Call, int, void * *)
- ?backgroundFetchingEnabled@VideoThumbnailData@@QAE_NXZ @ 12 NONAME ; bool VideoThumbnailData::backgroundFetchingEnabled(void)
- ??1VideoThumbnailData@@EAE@XZ @ 13 NONAME ; VideoThumbnailData::~VideoThumbnailData(void)
- ??_EVideoThumbnailData@@UAE@I@Z @ 14 NONAME ; VideoThumbnailData::~VideoThumbnailData(unsigned int)
- ?qt_metacast@VideoCollectionWrapper@@UAEPAXPBD@Z @ 15 NONAME ; void * VideoCollectionWrapper::qt_metacast(char const *)
- ?addItemsInAlbum@VideoSortFilterProxyModel@@QAEHAAVTMPXItemId@@ABV?$QList@VTMPXItemId@@@@@Z @ 16 NONAME ; int VideoSortFilterProxyModel::addItemsInAlbum(class TMPXItemId &, class QList const &)
- ?tr@VideoSortFilterProxyModel@@SA?AVQString@@PBD0H@Z @ 17 NONAME ; class QString VideoSortFilterProxyModel::tr(char const *, char const *, int)
- ?getMediaIdAtIndex@VideoSortFilterProxyModel@@QBEABVTMPXItemId@@ABVQModelIndex@@@Z @ 18 NONAME ; class TMPXItemId const & VideoSortFilterProxyModel::getMediaIdAtIndex(class QModelIndex const &) const
- ?removeAlbums@VideoSortFilterProxyModel@@QAEHABV?$QList@VQModelIndex@@@@@Z @ 19 NONAME ; int VideoSortFilterProxyModel::removeAlbums(class QList const &)
- ?instance@VideoThumbnailData@@SAAAV1@XZ @ 20 NONAME ; class VideoThumbnailData & VideoThumbnailData::instance(void)
- ?getType@VideoSortFilterProxyModel@@QAE?AW4TModelType@VideoCollectionCommon@@XZ @ 21 NONAME ; enum VideoCollectionCommon::TModelType VideoSortFilterProxyModel::getType(void)
- ?fetchItemDetails@VideoSortFilterProxyModel@@QAEHABVQModelIndex@@@Z @ 22 NONAME ; int VideoSortFilterProxyModel::fetchItemDetails(class QModelIndex const &)
- ??0VideoCollectionWrapper@@AAE@XZ @ 23 NONAME ; VideoCollectionWrapper::VideoCollectionWrapper(void)
- ?metaObject@VideoSortFilterProxyModel@@UBEPBUQMetaObject@@XZ @ 24 NONAME ; struct QMetaObject const * VideoSortFilterProxyModel::metaObject(void) const
- ?metaObject@VideoCollectionWrapper@@UBEPBUQMetaObject@@XZ @ 25 NONAME ; struct QMetaObject const * VideoCollectionWrapper::metaObject(void) const
- ?lessThan@VideoSortFilterProxyModel@@MBE_NABVQModelIndex@@0@Z @ 26 NONAME ; bool VideoSortFilterProxyModel::lessThan(class QModelIndex const &, class QModelIndex const &) const
- ?getStaticMetaObject@VideoCollectionWrapper@@SAABUQMetaObject@@XZ @ 27 NONAME ; struct QMetaObject const & VideoCollectionWrapper::getStaticMetaObject(void)
- ?getStaticMetaObject@VideoSortFilterProxyModel@@SAABUQMetaObject@@XZ @ 28 NONAME ; struct QMetaObject const & VideoSortFilterProxyModel::getStaticMetaObject(void)
- ?trUtf8@VideoSortFilterProxyModel@@SA?AVQString@@PBD0@Z @ 29 NONAME ; class QString VideoSortFilterProxyModel::trUtf8(char const *, char const *)
- ?doSorting@VideoSortFilterProxyModel@@QAEXHW4SortOrder@Qt@@_N@Z @ 30 NONAME ; void VideoSortFilterProxyModel::doSorting(int, enum Qt::SortOrder, bool)
- ?getOpenItem@VideoSortFilterProxyModel@@QBE?AVTMPXItemId@@XZ @ 31 NONAME ; class TMPXItemId VideoSortFilterProxyModel::getOpenItem(void) const
- ?startBackgroundFetching@VideoThumbnailData@@QAEXPAVVideoSortFilterProxyModel@@H@Z @ 32 NONAME ; void VideoThumbnailData::startBackgroundFetching(class VideoSortFilterProxyModel *, int)
- ??_EVideoCollectionWrapper@@UAE@I@Z @ 33 NONAME ; VideoCollectionWrapper::~VideoCollectionWrapper(unsigned int)
- ?resolveAlbumName@VideoSortFilterProxyModel@@QBE?AVQString@@ABV2@@Z @ 34 NONAME ; class QString VideoSortFilterProxyModel::resolveAlbumName(class QString const &) const
- ?getThumbnail@VideoThumbnailData@@QAEPBVQIcon@@ABVTMPXItemId@@@Z @ 35 NONAME ; class QIcon const * VideoThumbnailData::getThumbnail(class TMPXItemId const &)
- ?getStaticMetaObject@VideoThumbnailData@@SAABUQMetaObject@@XZ @ 36 NONAME ; struct QMetaObject const & VideoThumbnailData::getStaticMetaObject(void)
- ?qt_metacall@VideoCollectionWrapper@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 37 NONAME ; int VideoCollectionWrapper::qt_metacall(enum QMetaObject::Call, int, void * *)
- ?trUtf8@VideoThumbnailData@@SA?AVQString@@PBD0H@Z @ 38 NONAME ; class QString VideoThumbnailData::trUtf8(char const *, char const *, int)
- ?enableBackgroundFetching@VideoThumbnailData@@QAEX_N@Z @ 39 NONAME ; void VideoThumbnailData::enableBackgroundFetching(bool)
- ?getMediaFilePathForId@VideoSortFilterProxyModel@@QAE?AVQString@@ABVTMPXItemId@@@Z @ 40 NONAME ; class QString VideoSortFilterProxyModel::getMediaFilePathForId(class TMPXItemId const &)
- ?connectSignals@VideoSortFilterProxyModel@@AAE_NXZ @ 41 NONAME ; bool VideoSortFilterProxyModel::connectSignals(void)
- ?getModel@VideoCollectionWrapper@@QAEPAVVideoSortFilterProxyModel@@W4TModelType@VideoCollectionCommon@@@Z @ 42 NONAME ; class VideoSortFilterProxyModel * VideoCollectionWrapper::getModel(enum VideoCollectionCommon::TModelType)
- ?tr@VideoCollectionWrapper@@SA?AVQString@@PBD0H@Z @ 43 NONAME ; class QString VideoCollectionWrapper::tr(char const *, char const *, int)
- ?staticMetaObject@VideoSortFilterProxyModel@@2UQMetaObject@@B @ 44 NONAME ; struct QMetaObject const VideoSortFilterProxyModel::staticMetaObject
- ?tr@VideoSortFilterProxyModel@@SA?AVQString@@PBD0@Z @ 45 NONAME ; class QString VideoSortFilterProxyModel::tr(char const *, char const *)
- ?asyncStatus@VideoCollectionWrapper@@IAEXHAAVQVariant@@@Z @ 46 NONAME ; void VideoCollectionWrapper::asyncStatus(int, class QVariant &)
- ?initialize@VideoSortFilterProxyModel@@QAEHPAVVideoListDataModel@@@Z @ 47 NONAME ; int VideoSortFilterProxyModel::initialize(class VideoListDataModel *)
- ?modelChanged@VideoSortFilterProxyModel@@IAEXXZ @ 48 NONAME ; void VideoSortFilterProxyModel::modelChanged(void)
- ?removeThumbnail@VideoThumbnailData@@QAE_NABVTMPXItemId@@@Z @ 49 NONAME ; bool VideoThumbnailData::removeThumbnail(class TMPXItemId const &)
- ?indexOfId@VideoSortFilterProxyModel@@QAE?AVQModelIndex@@ABVTMPXItemId@@@Z @ 50 NONAME ; class QModelIndex VideoSortFilterProxyModel::indexOfId(class TMPXItemId const &)
- ?setGenericIdFilter@VideoSortFilterProxyModel@@QAEXABVTMPXItemId@@_N@Z @ 51 NONAME ; void VideoSortFilterProxyModel::setGenericIdFilter(class TMPXItemId const &, bool)
- ?trUtf8@VideoCollectionWrapper@@SA?AVQString@@PBD0@Z @ 52 NONAME ; class QString VideoCollectionWrapper::trUtf8(char const *, char const *)
- ?thumbnailsFetched@VideoThumbnailData@@IAEXAAV?$QList@VTMPXItemId@@@@@Z @ 53 NONAME ; void VideoThumbnailData::thumbnailsFetched(class QList &)
- ?processSorting@VideoSortFilterProxyModel@@AAEXXZ @ 54 NONAME ; void VideoSortFilterProxyModel::processSorting(void)
- ?getSorting@VideoSortFilterProxyModel@@QAEXAAHAAW4SortOrder@Qt@@@Z @ 55 NONAME ; void VideoSortFilterProxyModel::getSorting(int &, enum Qt::SortOrder &)
- ?filterAcceptsRow@VideoSortFilterProxyModel@@MBE_NHABVQModelIndex@@@Z @ 56 NONAME ; bool VideoSortFilterProxyModel::filterAcceptsRow(int, class QModelIndex const &) const
- ?metaObject@VideoThumbnailData@@UBEPBUQMetaObject@@XZ @ 57 NONAME ; struct QMetaObject const * VideoThumbnailData::metaObject(void) const
- ?tr@VideoThumbnailData@@SA?AVQString@@PBD0H@Z @ 58 NONAME ; class QString VideoThumbnailData::tr(char const *, char const *, int)
- ?disconnectSignals@VideoSortFilterProxyModel@@AAEXXZ @ 59 NONAME ; void VideoSortFilterProxyModel::disconnectSignals(void)
- ?trUtf8@VideoSortFilterProxyModel@@SA?AVQString@@PBD0H@Z @ 60 NONAME ; class QString VideoSortFilterProxyModel::trUtf8(char const *, char const *, int)
- ?openItem@VideoSortFilterProxyModel@@QAEHVTMPXItemId@@@Z @ 61 NONAME ; int VideoSortFilterProxyModel::openItem(class TMPXItemId)
+ ?doSorting@VideoProxyModelGeneric@@QAEXHW4SortOrder@Qt@@_N@Z @ 2 NONAME ; void VideoProxyModelGeneric::doSorting(int, enum Qt::SortOrder, bool)
+ ?addItemsInAlbum@VideoProxyModelGeneric@@QAEHAAVTMPXItemId@@ABV?$QList@VTMPXItemId@@@@@Z @ 3 NONAME ; int VideoProxyModelGeneric::addItemsInAlbum(class TMPXItemId &, class QList const &)
+ ?trUtf8@VideoThumbnailData@@SA?AVQString@@PBD0@Z @ 4 NONAME ; class QString VideoThumbnailData::trUtf8(char const *, char const *)
+ ?tr@VideoProxyModelGeneric@@SA?AVQString@@PBD0H@Z @ 5 NONAME ; class QString VideoProxyModelGeneric::tr(char const *, char const *, int)
+ ?instance@VideoCollectionWrapper@@SAAAV1@XZ @ 6 NONAME ; class VideoCollectionWrapper & VideoCollectionWrapper::instance(void)
+ ?qt_metacall@VideoThumbnailData@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 7 NONAME ; int VideoThumbnailData::qt_metacall(enum QMetaObject::Call, int, void * *)
+ ?backgroundFetchingEnabled@VideoThumbnailData@@QAE_NXZ @ 8 NONAME ; bool VideoThumbnailData::backgroundFetchingEnabled(void)
+ ?removeItemsFromAlbum@VideoProxyModelGeneric@@QAEHAAVTMPXItemId@@ABV?$QList@VTMPXItemId@@@@@Z @ 9 NONAME ; int VideoProxyModelGeneric::removeItemsFromAlbum(class TMPXItemId &, class QList const &)
+ ?openItem@VideoProxyModelGeneric@@UAEHVTMPXItemId@@@Z @ 10 NONAME ; int VideoProxyModelGeneric::openItem(class TMPXItemId)
+ ?getMediaIdAtIndex@VideoProxyModelGeneric@@QBEABVTMPXItemId@@ABVQModelIndex@@@Z @ 11 NONAME ; class TMPXItemId const & VideoProxyModelGeneric::getMediaIdAtIndex(class QModelIndex const &) const
+ ??1VideoThumbnailData@@EAE@XZ @ 12 NONAME ; VideoThumbnailData::~VideoThumbnailData(void)
+ ??_EVideoThumbnailData@@UAE@I@Z @ 13 NONAME ; VideoThumbnailData::~VideoThumbnailData(unsigned int)
+ ?shortDetailsReady@VideoProxyModelGeneric@@IAEXVTMPXItemId@@@Z @ 14 NONAME ; void VideoProxyModelGeneric::shortDetailsReady(class TMPXItemId)
+ ?fetchItemDetails@VideoProxyModelGeneric@@QAEHABVQModelIndex@@@Z @ 15 NONAME ; int VideoProxyModelGeneric::fetchItemDetails(class QModelIndex const &)
+ ??1VideoProxyModelGeneric@@UAE@XZ @ 16 NONAME ; VideoProxyModelGeneric::~VideoProxyModelGeneric(void)
+ ?qt_metacast@VideoCollectionWrapper@@UAEPAXPBD@Z @ 17 NONAME ; void * VideoCollectionWrapper::qt_metacast(char const *)
+ ?disconnectSignals@VideoProxyModelGeneric@@MAEXXZ @ 18 NONAME ; void VideoProxyModelGeneric::disconnectSignals(void)
+ ?qt_metacast@VideoProxyModelGeneric@@UAEPAXPBD@Z @ 19 NONAME ; void * VideoProxyModelGeneric::qt_metacast(char const *)
+ ??0VideoProxyModelGeneric@@QAE@PAVQObject@@@Z @ 20 NONAME ; VideoProxyModelGeneric::VideoProxyModelGeneric(class QObject *)
+ ?deleteItems@VideoProxyModelGeneric@@QAEHABV?$QList@VQModelIndex@@@@@Z @ 21 NONAME ; int VideoProxyModelGeneric::deleteItems(class QList const &)
+ ?instance@VideoThumbnailData@@SAAAV1@XZ @ 22 NONAME ; class VideoThumbnailData & VideoThumbnailData::instance(void)
+ ?qt_metacall@VideoProxyModelGeneric@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 23 NONAME ; int VideoProxyModelGeneric::qt_metacall(enum QMetaObject::Call, int, void * *)
+ ??0VideoCollectionWrapper@@AAE@XZ @ 24 NONAME ; VideoCollectionWrapper::VideoCollectionWrapper(void)
+ ?startBackgroundFetching@VideoThumbnailData@@QAEXPAVVideoProxyModelGeneric@@H@Z @ 25 NONAME ; void VideoThumbnailData::startBackgroundFetching(class VideoProxyModelGeneric *, int)
+ ?metaObject@VideoCollectionWrapper@@UBEPBUQMetaObject@@XZ @ 26 NONAME ; struct QMetaObject const * VideoCollectionWrapper::metaObject(void) const
+ ?setAlbumInUse@VideoProxyModelGeneric@@UAEXABVTMPXItemId@@@Z @ 27 NONAME ; void VideoProxyModelGeneric::setAlbumInUse(class TMPXItemId const &)
+ ?staticMetaObject@VideoProxyModelGeneric@@2UQMetaObject@@B @ 28 NONAME ; struct QMetaObject const VideoProxyModelGeneric::staticMetaObject
+ ?getStaticMetaObject@VideoCollectionWrapper@@SAABUQMetaObject@@XZ @ 29 NONAME ; struct QMetaObject const & VideoCollectionWrapper::getStaticMetaObject(void)
+ ?getStaticMetaObject@VideoProxyModelGeneric@@SAABUQMetaObject@@XZ @ 30 NONAME ; struct QMetaObject const & VideoProxyModelGeneric::getStaticMetaObject(void)
+ ?resolveAlbumName@VideoProxyModelGeneric@@QBE?AVQString@@ABV2@@Z @ 31 NONAME ; class QString VideoProxyModelGeneric::resolveAlbumName(class QString const &) const
+ ?lessThan@VideoProxyModelGeneric@@MBE_NABVQModelIndex@@0@Z @ 32 NONAME ; bool VideoProxyModelGeneric::lessThan(class QModelIndex const &, class QModelIndex const &) const
+ ?getCollectionsModel@VideoCollectionWrapper@@QAEPAVVideoProxyModelGeneric@@XZ @ 33 NONAME ; class VideoProxyModelGeneric * VideoCollectionWrapper::getCollectionsModel(void)
+ ?connectSignals@VideoProxyModelGeneric@@MAE_NXZ @ 34 NONAME ; bool VideoProxyModelGeneric::connectSignals(void)
+ ??_EVideoCollectionWrapper@@UAE@I@Z @ 35 NONAME ; VideoCollectionWrapper::~VideoCollectionWrapper(unsigned int)
+ ?getThumbnail@VideoThumbnailData@@QAEPBVQIcon@@ABVTMPXItemId@@@Z @ 36 NONAME ; class QIcon const * VideoThumbnailData::getThumbnail(class TMPXItemId const &)
+ ?back@VideoProxyModelGeneric@@QAEHXZ @ 37 NONAME ; int VideoProxyModelGeneric::back(void)
+ ?getStaticMetaObject@VideoThumbnailData@@SAABUQMetaObject@@XZ @ 38 NONAME ; struct QMetaObject const & VideoThumbnailData::getStaticMetaObject(void)
+ ?qt_metacall@VideoCollectionWrapper@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 39 NONAME ; int VideoCollectionWrapper::qt_metacall(enum QMetaObject::Call, int, void * *)
+ ?trUtf8@VideoThumbnailData@@SA?AVQString@@PBD0H@Z @ 40 NONAME ; class QString VideoThumbnailData::trUtf8(char const *, char const *, int)
+ ?setGenericIdFilter@VideoProxyModelGeneric@@UAEXABVTMPXItemId@@_N@Z @ 41 NONAME ; void VideoProxyModelGeneric::setGenericIdFilter(class TMPXItemId const &, bool)
+ ?enableBackgroundFetching@VideoThumbnailData@@QAEX_N@Z @ 42 NONAME ; void VideoThumbnailData::enableBackgroundFetching(bool)
+ ?trUtf8@VideoProxyModelGeneric@@SA?AVQString@@PBD0H@Z @ 43 NONAME ; class QString VideoProxyModelGeneric::trUtf8(char const *, char const *, int)
+ ?getMediaFilePathForId@VideoProxyModelGeneric@@QAE?AVQString@@ABVTMPXItemId@@@Z @ 44 NONAME ; class QString VideoProxyModelGeneric::getMediaFilePathForId(class TMPXItemId const &)
+ ?getGenericModel@VideoCollectionWrapper@@QAEPAVVideoProxyModelGeneric@@XZ @ 45 NONAME ; class VideoProxyModelGeneric * VideoCollectionWrapper::getGenericModel(void)
+ ?getSorting@VideoProxyModelGeneric@@QAEXAAHAAW4SortOrder@Qt@@@Z @ 46 NONAME ; void VideoProxyModelGeneric::getSorting(int &, enum Qt::SortOrder &)
+ ?tr@VideoCollectionWrapper@@SA?AVQString@@PBD0H@Z @ 47 NONAME ; class QString VideoCollectionWrapper::tr(char const *, char const *, int)
+ ?addNewAlbum@VideoProxyModelGeneric@@QAE?AVTMPXItemId@@ABVQString@@@Z @ 48 NONAME ; class TMPXItemId VideoProxyModelGeneric::addNewAlbum(class QString const &)
+ ?renameItem@VideoProxyModelGeneric@@QAEHABVTMPXItemId@@ABVQString@@@Z @ 49 NONAME ; int VideoProxyModelGeneric::renameItem(class TMPXItemId const &, class QString const &)
+ ?asyncStatus@VideoCollectionWrapper@@IAEXHAAVQVariant@@@Z @ 50 NONAME ; void VideoCollectionWrapper::asyncStatus(int, class QVariant &)
+ ?getOpenItem@VideoProxyModelGeneric@@UBE?AVTMPXItemId@@XZ @ 51 NONAME ; class TMPXItemId VideoProxyModelGeneric::getOpenItem(void) const
+ ?removeThumbnail@VideoThumbnailData@@QAE_NABVTMPXItemId@@@Z @ 52 NONAME ; bool VideoThumbnailData::removeThumbnail(class TMPXItemId const &)
+ ?trUtf8@VideoCollectionWrapper@@SA?AVQString@@PBD0@Z @ 53 NONAME ; class QString VideoCollectionWrapper::trUtf8(char const *, char const *)
+ ?thumbnailsFetched@VideoThumbnailData@@IAEXAAV?$QList@VTMPXItemId@@@@@Z @ 54 NONAME ; void VideoThumbnailData::thumbnailsFetched(class QList &)
+ ?trUtf8@VideoProxyModelGeneric@@SA?AVQString@@PBD0@Z @ 55 NONAME ; class QString VideoProxyModelGeneric::trUtf8(char const *, char const *)
+ ?metaObject@VideoThumbnailData@@UBEPBUQMetaObject@@XZ @ 56 NONAME ; struct QMetaObject const * VideoThumbnailData::metaObject(void) const
+ ?tr@VideoThumbnailData@@SA?AVQString@@PBD0H@Z @ 57 NONAME ; class QString VideoThumbnailData::tr(char const *, char const *, int)
+ ?indexOfId@VideoProxyModelGeneric@@QAE?AVQModelIndex@@ABVTMPXItemId@@@Z @ 58 NONAME ; class QModelIndex VideoProxyModelGeneric::indexOfId(class TMPXItemId const &)
+ ?initialize@VideoProxyModelGeneric@@UAEHPAVVideoListDataModel@@@Z @ 59 NONAME ; int VideoProxyModelGeneric::initialize(class VideoListDataModel *)
+ ?getAllVideosModel@VideoCollectionWrapper@@QAEPAVVideoProxyModelGeneric@@XZ @ 60 NONAME ; class VideoProxyModelGeneric * VideoCollectionWrapper::getAllVideosModel(void)
+ ?processSortingSlot@VideoProxyModelGeneric@@AAEXXZ @ 61 NONAME ; void VideoProxyModelGeneric::processSortingSlot(void)
?qt_metacast@VideoThumbnailData@@UAEPAXPBD@Z @ 62 NONAME ; void * VideoThumbnailData::qt_metacast(char const *)
- ?tr@VideoCollectionWrapper@@SA?AVQString@@PBD0@Z @ 63 NONAME ; class QString VideoCollectionWrapper::tr(char const *, char const *)
- ??_EVideoSortFilterProxyModel@@UAE@I@Z @ 64 NONAME ; VideoSortFilterProxyModel::~VideoSortFilterProxyModel(unsigned int)
- ??0VideoSortFilterProxyModel@@QAE@W4TModelType@VideoCollectionCommon@@PAVQObject@@@Z @ 65 NONAME ; VideoSortFilterProxyModel::VideoSortFilterProxyModel(enum VideoCollectionCommon::TModelType, class QObject *)
- ?addNewAlbum@VideoSortFilterProxyModel@@QAE?AVTMPXItemId@@ABVQString@@@Z @ 66 NONAME ; class TMPXItemId VideoSortFilterProxyModel::addNewAlbum(class QString const &)
- ?renameItem@VideoSortFilterProxyModel@@QAEHABVTMPXItemId@@ABVQString@@@Z @ 67 NONAME ; int VideoSortFilterProxyModel::renameItem(class TMPXItemId const &, class QString const &)
- ?enableThumbnailCreation@VideoThumbnailData@@QAEX_N@Z @ 68 NONAME ; void VideoThumbnailData::enableThumbnailCreation(bool)
- ?qt_metacall@VideoSortFilterProxyModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 69 NONAME ; int VideoSortFilterProxyModel::qt_metacall(enum QMetaObject::Call, int, void * *)
- ?freeThumbnailData@VideoThumbnailData@@QAEXXZ @ 70 NONAME ; void VideoThumbnailData::freeThumbnailData(void)
- ?shortDetailsReady@VideoSortFilterProxyModel@@IAEXVTMPXItemId@@@Z @ 71 NONAME ; void VideoSortFilterProxyModel::shortDetailsReady(class TMPXItemId)
- ?qt_metacast@VideoSortFilterProxyModel@@UAEPAXPBD@Z @ 72 NONAME ; void * VideoSortFilterProxyModel::qt_metacast(char const *)
- ?staticMetaObject@VideoCollectionWrapper@@2UQMetaObject@@B @ 73 NONAME ; struct QMetaObject const VideoCollectionWrapper::staticMetaObject
- ?setAlbumInUse@VideoSortFilterProxyModel@@QAEXABVTMPXItemId@@@Z @ 74 NONAME ; void VideoSortFilterProxyModel::setAlbumInUse(class TMPXItemId const &)
+ ?getCollectionContentModel@VideoCollectionWrapper@@QAEPAVVideoProxyModelGeneric@@XZ @ 63 NONAME ; class VideoProxyModelGeneric * VideoCollectionWrapper::getCollectionContentModel(void)
+ ?tr@VideoCollectionWrapper@@SA?AVQString@@PBD0@Z @ 64 NONAME ; class QString VideoCollectionWrapper::tr(char const *, char const *)
+ ?metaObject@VideoProxyModelGeneric@@UBEPBUQMetaObject@@XZ @ 65 NONAME ; struct QMetaObject const * VideoProxyModelGeneric::metaObject(void) const
+ ?filterAcceptsRow@VideoProxyModelGeneric@@MBE_NHABVQModelIndex@@@Z @ 66 NONAME ; bool VideoProxyModelGeneric::filterAcceptsRow(int, class QModelIndex const &) const
+ ?tr@VideoProxyModelGeneric@@SA?AVQString@@PBD0@Z @ 67 NONAME ; class QString VideoProxyModelGeneric::tr(char const *, char const *)
+ ?modelSorted@VideoProxyModelGeneric@@IAEXXZ @ 68 NONAME ; void VideoProxyModelGeneric::modelSorted(void)
+ ?enableThumbnailCreation@VideoThumbnailData@@QAEX_N@Z @ 69 NONAME ; void VideoThumbnailData::enableThumbnailCreation(bool)
+ ??_EVideoProxyModelGeneric@@UAE@I@Z @ 70 NONAME ; VideoProxyModelGeneric::~VideoProxyModelGeneric(unsigned int)
+ ?freeThumbnailData@VideoThumbnailData@@QAEXXZ @ 71 NONAME ; void VideoThumbnailData::freeThumbnailData(void)
+ ?processSorting@VideoProxyModelGeneric@@MAEXXZ @ 72 NONAME ; void VideoProxyModelGeneric::processSorting(void)
+ ?open@VideoProxyModelGeneric@@QAEHW4TCollectionLevels@VideoCollectionCommon@@@Z @ 73 NONAME ; int VideoProxyModelGeneric::open(enum VideoCollectionCommon::TCollectionLevels)
+ ?staticMetaObject@VideoCollectionWrapper@@2UQMetaObject@@B @ 74 NONAME ; struct QMetaObject const VideoCollectionWrapper::staticMetaObject
?tr@VideoThumbnailData@@SA?AVQString@@PBD0@Z @ 75 NONAME ; class QString VideoThumbnailData::tr(char const *, char const *)
??1VideoCollectionWrapper@@EAE@XZ @ 76 NONAME ; VideoCollectionWrapper::~VideoCollectionWrapper(void)
?trUtf8@VideoCollectionWrapper@@SA?AVQString@@PBD0H@Z @ 77 NONAME ; class QString VideoCollectionWrapper::trUtf8(char const *, char const *, int)
- ??0VideoThumbnailData@@AAE@XZ @ 78 NONAME ; VideoThumbnailData::VideoThumbnailData(void)
- ?staticMetaObject@VideoThumbnailData@@2UQMetaObject@@B @ 79 NONAME ; struct QMetaObject const VideoThumbnailData::staticMetaObject
- ?modelSorted@VideoSortFilterProxyModel@@IAEXXZ @ 80 NONAME ; void VideoSortFilterProxyModel::modelSorted(void)
+ ?staticMetaObject@VideoThumbnailData@@2UQMetaObject@@B @ 78 NONAME ; struct QMetaObject const VideoThumbnailData::staticMetaObject
+ ??0VideoThumbnailData@@AAE@XZ @ 79 NONAME ; VideoThumbnailData::VideoThumbnailData(void)
+ ?removeAlbums@VideoProxyModelGeneric@@QAEHABV?$QList@VQModelIndex@@@@@Z @ 80 NONAME ; int VideoProxyModelGeneric::removeAlbums(class QList const &)
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/eabi/videocollectionwrapperu.def
--- a/videocollection/eabi/videocollectionwrapperu.def Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/eabi/videocollectionwrapperu.def Fri Sep 03 12:37:43 2010 +0300
@@ -8,7 +8,7 @@
_ZN18VideoThumbnailData17thumbnailsFetchedER5QListI10TMPXItemIdE @ 7 NONAME
_ZN18VideoThumbnailData19getStaticMetaObjectEv @ 8 NONAME
_ZN18VideoThumbnailData23enableThumbnailCreationEb @ 9 NONAME
- _ZN18VideoThumbnailData23startBackgroundFetchingEP25VideoSortFilterProxyModeli @ 10 NONAME
+ _ZN18VideoThumbnailData23startBackgroundFetchingEP22VideoProxyModelGenerici @ 10 NONAME
_ZN18VideoThumbnailData24enableBackgroundFetchingEb @ 11 NONAME
_ZN18VideoThumbnailData25backgroundFetchingEnabledEv @ 12 NONAME
_ZN18VideoThumbnailData8instanceEv @ 13 NONAME
@@ -20,63 +20,63 @@
_ZN22VideoCollectionWrapper11asyncStatusEiR8QVariant @ 19 NONAME
_ZN22VideoCollectionWrapper11qt_metacallEN11QMetaObject4CallEiPPv @ 20 NONAME
_ZN22VideoCollectionWrapper11qt_metacastEPKc @ 21 NONAME
- _ZN22VideoCollectionWrapper15sendAsyncStatusEiR8QVariant @ 22 NONAME
- _ZN22VideoCollectionWrapper16staticMetaObjectE @ 23 NONAME DATA 16
- _ZN22VideoCollectionWrapper19getStaticMetaObjectEv @ 24 NONAME
- _ZN22VideoCollectionWrapper8getModelEN21VideoCollectionCommon10TModelTypeE @ 25 NONAME
- _ZN22VideoCollectionWrapper8instanceEv @ 26 NONAME
- _ZN22VideoCollectionWrapperC1Ev @ 27 NONAME
- _ZN22VideoCollectionWrapperC2Ev @ 28 NONAME
- _ZN22VideoCollectionWrapperD0Ev @ 29 NONAME
- _ZN22VideoCollectionWrapperD1Ev @ 30 NONAME
- _ZN22VideoCollectionWrapperD2Ev @ 31 NONAME
- _ZN25VideoSortFilterProxyModel10getSortingERiRN2Qt9SortOrderE @ 32 NONAME
- _ZN25VideoSortFilterProxyModel10initializeEP18VideoListDataModel @ 33 NONAME
- _ZN25VideoSortFilterProxyModel10modelReadyEv @ 34 NONAME
- _ZN25VideoSortFilterProxyModel10renameItemERK10TMPXItemIdRK7QString @ 35 NONAME
- _ZN25VideoSortFilterProxyModel11addNewAlbumERK7QString @ 36 NONAME
- _ZN25VideoSortFilterProxyModel11deleteItemsERK5QListI11QModelIndexE @ 37 NONAME
- _ZN25VideoSortFilterProxyModel11qt_metacallEN11QMetaObject4CallEiPPv @ 38 NONAME
- _ZN25VideoSortFilterProxyModel11qt_metacastEPKc @ 39 NONAME
- _ZN25VideoSortFilterProxyModel12modelChangedEv @ 40 NONAME
- _ZN25VideoSortFilterProxyModel12removeAlbumsERK5QListI11QModelIndexE @ 41 NONAME
- _ZN25VideoSortFilterProxyModel13setAlbumInUseERK10TMPXItemId @ 42 NONAME
- _ZN25VideoSortFilterProxyModel14connectSignalsEv @ 43 NONAME
- _ZN25VideoSortFilterProxyModel14processSortingEv @ 44 NONAME
- _ZN25VideoSortFilterProxyModel15addItemsInAlbumER10TMPXItemIdRK5QListIS0_E @ 45 NONAME
- _ZN25VideoSortFilterProxyModel16albumChangedSlotEv @ 46 NONAME
- _ZN25VideoSortFilterProxyModel16fetchItemDetailsERK11QModelIndex @ 47 NONAME
- _ZN25VideoSortFilterProxyModel16staticMetaObjectE @ 48 NONAME DATA 16
- _ZN25VideoSortFilterProxyModel17disconnectSignalsEv @ 49 NONAME
- _ZN25VideoSortFilterProxyModel17shortDetailsReadyE10TMPXItemId @ 50 NONAME
- _ZN25VideoSortFilterProxyModel18setGenericIdFilterERK10TMPXItemIdb @ 51 NONAME
- _ZN25VideoSortFilterProxyModel19getStaticMetaObjectEv @ 52 NONAME
- _ZN25VideoSortFilterProxyModel20removeItemsFromAlbumER10TMPXItemIdRK5QListIS0_E @ 53 NONAME
- _ZN25VideoSortFilterProxyModel21getMediaFilePathForIdERK10TMPXItemId @ 54 NONAME
- _ZN25VideoSortFilterProxyModel4backEv @ 55 NONAME
- _ZN25VideoSortFilterProxyModel4openEN21VideoCollectionCommon17TCollectionLevelsE @ 56 NONAME
- _ZN25VideoSortFilterProxyModel7getTypeEv @ 57 NONAME
- _ZN25VideoSortFilterProxyModel8openItemE10TMPXItemId @ 58 NONAME
- _ZN25VideoSortFilterProxyModel9doSortingEiN2Qt9SortOrderEb @ 59 NONAME
- _ZN25VideoSortFilterProxyModel9indexOfIdERK10TMPXItemId @ 60 NONAME
- _ZN25VideoSortFilterProxyModelC1EN21VideoCollectionCommon10TModelTypeEP7QObject @ 61 NONAME
- _ZN25VideoSortFilterProxyModelC2EN21VideoCollectionCommon10TModelTypeEP7QObject @ 62 NONAME
- _ZN25VideoSortFilterProxyModelD0Ev @ 63 NONAME
- _ZN25VideoSortFilterProxyModelD1Ev @ 64 NONAME
- _ZN25VideoSortFilterProxyModelD2Ev @ 65 NONAME
- _ZNK18VideoThumbnailData10metaObjectEv @ 66 NONAME
- _ZNK22VideoCollectionWrapper10metaObjectEv @ 67 NONAME
- _ZNK25VideoSortFilterProxyModel10metaObjectEv @ 68 NONAME
- _ZNK25VideoSortFilterProxyModel11getOpenItemEv @ 69 NONAME
- _ZNK25VideoSortFilterProxyModel16filterAcceptsRowEiRK11QModelIndex @ 70 NONAME
- _ZNK25VideoSortFilterProxyModel16resolveAlbumNameERK7QString @ 71 NONAME
- _ZNK25VideoSortFilterProxyModel17getMediaIdAtIndexERK11QModelIndex @ 72 NONAME
- _ZNK25VideoSortFilterProxyModel8lessThanERK11QModelIndexS2_ @ 73 NONAME
- _ZTI18VideoThumbnailData @ 74 NONAME
- _ZTI22VideoCollectionWrapper @ 75 NONAME
- _ZTI25VideoSortFilterProxyModel @ 76 NONAME
- _ZTV18VideoThumbnailData @ 77 NONAME
- _ZTV22VideoCollectionWrapper @ 78 NONAME
- _ZTV25VideoSortFilterProxyModel @ 79 NONAME
- _ZN25VideoSortFilterProxyModel11modelSortedEv @ 80 NONAME
+ _ZN22VideoCollectionWrapper15getGenericModelEv @ 22 NONAME
+ _ZN22VideoCollectionWrapper15sendAsyncStatusEiR8QVariant @ 23 NONAME
+ _ZN22VideoCollectionWrapper16staticMetaObjectE @ 24 NONAME DATA 16
+ _ZN22VideoCollectionWrapper17getAllVideosModelEv @ 25 NONAME
+ _ZN22VideoCollectionWrapper19getCollectionsModelEv @ 26 NONAME
+ _ZN22VideoCollectionWrapper19getStaticMetaObjectEv @ 27 NONAME
+ _ZN22VideoCollectionWrapper25getCollectionContentModelEv @ 28 NONAME
+ _ZN22VideoCollectionWrapper8instanceEv @ 29 NONAME
+ _ZN22VideoCollectionWrapperC1Ev @ 30 NONAME
+ _ZN22VideoCollectionWrapperC2Ev @ 31 NONAME
+ _ZN22VideoCollectionWrapperD0Ev @ 32 NONAME
+ _ZN22VideoCollectionWrapperD1Ev @ 33 NONAME
+ _ZN22VideoCollectionWrapperD2Ev @ 34 NONAME
+ _ZN22VideoProxyModelGeneric10getSortingERiRN2Qt9SortOrderE @ 35 NONAME
+ _ZN22VideoProxyModelGeneric10initializeEP18VideoListDataModel @ 36 NONAME
+ _ZN22VideoProxyModelGeneric10renameItemERK10TMPXItemIdRK7QString @ 37 NONAME
+ _ZN22VideoProxyModelGeneric11addNewAlbumERK7QString @ 38 NONAME
+ _ZN22VideoProxyModelGeneric11deleteItemsERK5QListI11QModelIndexE @ 39 NONAME
+ _ZN22VideoProxyModelGeneric11modelSortedEv @ 40 NONAME
+ _ZN22VideoProxyModelGeneric11qt_metacallEN11QMetaObject4CallEiPPv @ 41 NONAME
+ _ZN22VideoProxyModelGeneric11qt_metacastEPKc @ 42 NONAME
+ _ZN22VideoProxyModelGeneric12removeAlbumsERK5QListI11QModelIndexE @ 43 NONAME
+ _ZN22VideoProxyModelGeneric13setAlbumInUseERK10TMPXItemId @ 44 NONAME
+ _ZN22VideoProxyModelGeneric14connectSignalsEv @ 45 NONAME
+ _ZN22VideoProxyModelGeneric14processSortingEv @ 46 NONAME
+ _ZN22VideoProxyModelGeneric15addItemsInAlbumER10TMPXItemIdRK5QListIS0_E @ 47 NONAME
+ _ZN22VideoProxyModelGeneric16fetchItemDetailsERK11QModelIndex @ 48 NONAME
+ _ZN22VideoProxyModelGeneric16staticMetaObjectE @ 49 NONAME DATA 16
+ _ZN22VideoProxyModelGeneric17disconnectSignalsEv @ 50 NONAME
+ _ZN22VideoProxyModelGeneric17shortDetailsReadyE10TMPXItemId @ 51 NONAME
+ _ZN22VideoProxyModelGeneric18processSortingSlotEv @ 52 NONAME
+ _ZN22VideoProxyModelGeneric18setGenericIdFilterERK10TMPXItemIdb @ 53 NONAME
+ _ZN22VideoProxyModelGeneric19getStaticMetaObjectEv @ 54 NONAME
+ _ZN22VideoProxyModelGeneric20removeItemsFromAlbumER10TMPXItemIdRK5QListIS0_E @ 55 NONAME
+ _ZN22VideoProxyModelGeneric21getMediaFilePathForIdERK10TMPXItemId @ 56 NONAME
+ _ZN22VideoProxyModelGeneric4backEv @ 57 NONAME
+ _ZN22VideoProxyModelGeneric4openEN21VideoCollectionCommon17TCollectionLevelsE @ 58 NONAME
+ _ZN22VideoProxyModelGeneric8openItemE10TMPXItemId @ 59 NONAME
+ _ZN22VideoProxyModelGeneric9doSortingEiN2Qt9SortOrderEb @ 60 NONAME
+ _ZN22VideoProxyModelGeneric9indexOfIdERK10TMPXItemId @ 61 NONAME
+ _ZN22VideoProxyModelGenericC1EP7QObject @ 62 NONAME
+ _ZN22VideoProxyModelGenericC2EP7QObject @ 63 NONAME
+ _ZN22VideoProxyModelGenericD0Ev @ 64 NONAME
+ _ZN22VideoProxyModelGenericD1Ev @ 65 NONAME
+ _ZN22VideoProxyModelGenericD2Ev @ 66 NONAME
+ _ZNK18VideoThumbnailData10metaObjectEv @ 67 NONAME
+ _ZNK22VideoCollectionWrapper10metaObjectEv @ 68 NONAME
+ _ZNK22VideoProxyModelGeneric10metaObjectEv @ 69 NONAME
+ _ZNK22VideoProxyModelGeneric11getOpenItemEv @ 70 NONAME
+ _ZNK22VideoProxyModelGeneric16filterAcceptsRowEiRK11QModelIndex @ 71 NONAME
+ _ZNK22VideoProxyModelGeneric16resolveAlbumNameERK7QString @ 72 NONAME
+ _ZNK22VideoProxyModelGeneric17getMediaIdAtIndexERK11QModelIndex @ 73 NONAME
+ _ZNK22VideoProxyModelGeneric8lessThanERK11QModelIndexS2_ @ 74 NONAME
+ _ZTI18VideoThumbnailData @ 75 NONAME
+ _ZTI22VideoCollectionWrapper @ 76 NONAME
+ _ZTI22VideoProxyModelGeneric @ 77 NONAME
+ _ZTV18VideoThumbnailData @ 78 NONAME
+ _ZTV22VideoCollectionWrapper @ 79 NONAME
+ _ZTV22VideoProxyModelGeneric @ 80 NONAME
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/inc/videocollectioncommon.h
--- a/videocollection/inc/videocollectioncommon.h Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/inc/videocollectioncommon.h Fri Sep 03 12:37:43 2010 +0300
@@ -162,15 +162,6 @@
statusVideosRemovedFromCollection
};
- enum TModelType
- {
- EModelTypeInvalid,
- EModelTypeAllVideos,
- EModelTypeCollections,
- EModelTypeCollectionContent,
- EModelTypeGeneric
- };
-
/**
* Utility macro to trace heap consumption.
*/
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/tsrc/simplevideoplayback/inc/svpbengine.h
--- a/videocollection/tsrc/simplevideoplayback/inc/svpbengine.h Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/tsrc/simplevideoplayback/inc/svpbengine.h Fri Sep 03 12:37:43 2010 +0300
@@ -1,3 +1,20 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Engine class of the SimpleVideoPlayback MPX view plugin.
+*
+*/
+
#ifndef SVPBENGINE_H
#define SVPBENGINE_H
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/tsrc/simplevideoplayback/src/svpbengine.cpp
--- a/videocollection/tsrc/simplevideoplayback/src/svpbengine.cpp Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/tsrc/simplevideoplayback/src/svpbengine.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -1,3 +1,20 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Engine class of the SimpleVideoPlayback MPX view plugin.
+*
+*/
+
#include // MMPXPlaybackUtility
#include
#include
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/tsrc/stubs/inc/hblistview.h
--- a/videocollection/tsrc/stubs/inc/hblistview.h Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/tsrc/stubs/inc/hblistview.h Fri Sep 03 12:37:43 2010 +0300
@@ -23,7 +23,7 @@
#include "hblistviewitem.h"
#include "hbscrollbar.h"
#include "hbabstractitemview.h"
-#include "videosortfilterproxymodel.h"
+#include "videoproxymodelgeneric.h"
#include
#include
@@ -111,7 +111,7 @@
/**
* dummy method
*/
- void setModel(VideoSortFilterProxyModel *model)
+ void setModel(VideoProxyModelGeneric *model)
{
mLatestModel = model;
}
@@ -322,7 +322,7 @@
/**
* provided model
*/
- static VideoSortFilterProxyModel *mLatestModel;
+ static VideoProxyModelGeneric *mLatestModel;
/**
* -1 == initialized
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/tsrc/stubs/inc/hbmainwindow.h
--- a/videocollection/tsrc/stubs/inc/hbmainwindow.h Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/tsrc/stubs/inc/hbmainwindow.h Fri Sep 03 12:37:43 2010 +0300
@@ -76,9 +76,9 @@
return mSoftKeyAction;
}
- HbView *addView(QGraphicsWidget *widget = 0);
+ HbView *addView(HbView *view = 0);
- void removeView(QGraphicsWidget *widget);
+ void removeView(HbView *view);
QList views() const;
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/tsrc/stubs/inc/videocollectionviewutilsdata.h
--- a/videocollection/tsrc/stubs/inc/videocollectionviewutilsdata.h Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/tsrc/stubs/inc/videocollectionviewutilsdata.h Fri Sep 03 12:37:43 2010 +0300
@@ -31,6 +31,7 @@
static void reset()
{
mLastError = 0;
+ mIsServiceValue = false;
mLoadSortingValuesFails = false;
mVideoSortRole = -1;
mCollectionSortRole = -1;
@@ -48,7 +49,8 @@
public: // data
static int mLastError;
- static bool mLoadSortingValuesFails;
+ static bool mIsServiceValue;
+ static bool mLoadSortingValuesFails;
static int mVideoSortRole;
static int mCollectionSortRole;
static Qt::SortOrder mVideoSortOrder;
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/tsrc/stubs/inc/videocollectionwrapperdata.h
--- a/videocollection/tsrc/stubs/inc/videocollectionwrapperdata.h Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/tsrc/stubs/inc/videocollectionwrapperdata.h Fri Sep 03 12:37:43 2010 +0300
@@ -18,39 +18,44 @@
#ifndef VIDEOCOLLECTIONWRAPPERDATA_H
#define VIDEOCOLLECTIONWRAPPERDATA_H
-#include "videosortfilterproxymodel.h"
+#include "videoproxymodelgeneric.h"
+#include "videoproxymodelallvideos.h"
+#include "videoproxymodelcollections.h"
+#include "videoproxymodelcontent.h"
#include "videolistdatamodel.h"
+#include
-class VideoCollectionWrapperData
+class VideoCollectionWrapperData : public QObject
{
+ Q_OBJECT
+
public: // methods
- static void reset()
- {
- mGetModelFails = false;
+ static void reset();
+ /*{
+ mGetGenericModelFails = false;
+ mGetAllVideosModelFails = false;
+ mGetCollectionsModelFails = false;
+ mGetCollectionContentModelFails = false;
delete mAllVideosModel;
- mAllVideosModel = 0;
-
delete mCollectionsModel;
- mCollectionsModel = 0;
-
delete mCollectionContentModel;
- mCollectionContentModel = 0;
-
delete mGenericModel;
- mGenericModel = 0;
-
+
delete mSourceModel;
mSourceModel = 0;
- }
+ }*/
public: // data
- static bool mGetModelFails;
+ static bool mGetGenericModelFails;
+ static bool mGetAllVideosModelFails;
+ static bool mGetCollectionsModelFails;
+ static bool mGetCollectionContentModelFails;
static VideoListDataModel *mSourceModel;
- static VideoSortFilterProxyModel *mAllVideosModel;
- static VideoSortFilterProxyModel *mCollectionsModel;
- static VideoSortFilterProxyModel *mCollectionContentModel;
- static VideoSortFilterProxyModel *mGenericModel;
+ static QPointer mAllVideosModel;
+ static QPointer mCollectionsModel;
+ static QPointer mCollectionContentModel;
+ static QPointer mGenericModel;
};
-#endif /* VIDEOSORTFILTERPROXYMODEL_H */
+#endif /* VIDEOCOLLECTIONWRAPPERDATA_H */
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/tsrc/stubs/inc/videolistwidgetdata.h
--- a/videocollection/tsrc/stubs/inc/videolistwidgetdata.h Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/tsrc/stubs/inc/videolistwidgetdata.h Fri Sep 03 12:37:43 2010 +0300
@@ -18,6 +18,8 @@
#ifndef VIDEOLISTWIDGETDATA_H
#define VIDEOLISTWIDGETDATA_H
+#include
+
class VideoListWidgetData
{
public: // methods
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/tsrc/stubs/inc/videoproxymodeldata.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/videoproxymodeldata.h Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,76 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: stub VideoProxyModelData
+*
+*/
+
+#ifndef VIDEOPROXYMODELDATA_H
+#define VIDEOPROXYMODELDATA_H
+
+#include
+#include
+#include
+#include
+
+class VideoProxyModelData
+{
+public: // methods
+ static void reset()
+ {
+ mOpenFails = false;
+ mSortRole = -1;
+ mSortOrder = Qt::AscendingOrder;
+ mSortAsync = false;
+ mDeleteItemsFails = true;
+ mRemoveAlbumsFails = true;
+ mDoSortingCallCount = 0;
+ mItemIds.clear();
+ mLastIndex = QModelIndex();
+ mLastItemId = TMPXItemId::InvalidId();
+ mOpenedItemId = TMPXItemId::InvalidId();
+ mDetailsReturnValue = 0;
+ mAddItemsInAlbumReturnValue = 0;
+ mRemoveItemsFromAlbumReturnValue = 0;
+ mGenericFilterId = TMPXItemId::InvalidId();
+ mGenericFilterValue = false;
+ mNewAlbumId = TMPXItemId::InvalidId();
+ mLastItemNameInRename = "";
+ mRenameItemReturnValue= 0;
+ mLastAddedAlbumName = "";
+ }
+
+public: // data
+ static bool mOpenFails;
+ static int mSortRole;
+ static Qt::SortOrder mSortOrder;
+ static bool mSortAsync;
+ static bool mDeleteItemsFails;
+ static bool mRemoveAlbumsFails;
+ static int mDoSortingCallCount;
+ static QList mItemIds;
+ static QModelIndex mLastIndex;
+ static TMPXItemId mLastItemId;
+ static TMPXItemId mOpenedItemId;
+ static int mDetailsReturnValue;
+ static int mAddItemsInAlbumReturnValue;
+ static int mRemoveItemsFromAlbumReturnValue;
+ static TMPXItemId mGenericFilterId;
+ static bool mGenericFilterValue;
+ static TMPXItemId mNewAlbumId;
+ static QString mLastItemNameInRename;
+ static int mRenameItemReturnValue;
+ static QString mLastAddedAlbumName;
+};
+
+#endif /* VIDEOPROXYMODELDATA_H */
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/tsrc/stubs/inc/videosortfilterproxymodeldata.h
--- a/videocollection/tsrc/stubs/inc/videosortfilterproxymodeldata.h Mon Aug 23 14:27:29 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: stub videosortfilterproxymodeldata
-*
-*/
-
-#ifndef VIDEOSORTFILTERPROXYMODELDATA_H
-#define VIDEOSORTFILTERPROXYMODELDATA_H
-
-#include
-#include
-
-class VideoSortFilterProxyModelData
-{
-public: // methods
- static void reset()
- {
- mOpenFails = false;
- mSortRole = -1;
- mSortOrder = Qt::AscendingOrder;
- mSortAsync = false;
- mDeleteItemsFails = true;
- mRemoveAlbumsFails = true;
- mDoSortingCallCount = 0;
- mItemIds.clear();
- mLastIndex = QModelIndex();
- mLastItemId = TMPXItemId::InvalidId();
- mOpenedItemId = TMPXItemId::InvalidId();
- mDetailsReturnValue = 0;
- mAddItemsInAlbumReturnValue = 0;
- mRemoveItemsFromAlbumReturnValue = 0;
- mGenericFilterId = TMPXItemId::InvalidId();
- mGenericFilterValue = false;
- mNewAlbumId = TMPXItemId::InvalidId();
- mLastItemNameInRename = "";
- mRenameItemReturnValue= 0;
- mLastAddedAlbumName = "";
- }
-
-public: // data
- static bool mOpenFails;
- static int mSortRole;
- static Qt::SortOrder mSortOrder;
- static bool mSortAsync;
- static bool mDeleteItemsFails;
- static bool mRemoveAlbumsFails;
- static int mDoSortingCallCount;
- static QList mItemIds;
- static QModelIndex mLastIndex;
- static TMPXItemId mLastItemId;
- static TMPXItemId mOpenedItemId;
- static int mDetailsReturnValue;
- static int mAddItemsInAlbumReturnValue;
- static int mRemoveItemsFromAlbumReturnValue;
- static TMPXItemId mGenericFilterId;
- static bool mGenericFilterValue;
- static TMPXItemId mNewAlbumId;
- static QString mLastItemNameInRename;
- static int mRenameItemReturnValue;
- static QString mLastAddedAlbumName;
-};
-
-#endif /* VIDEOSORTFILTERPROXYMODEL_H */
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/tsrc/stubs/src/hblistview.cpp
--- a/videocollection/tsrc/stubs/src/hblistview.cpp Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/tsrc/stubs/src/hblistview.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -15,12 +15,12 @@
*
*/
-#include "videosortfilterproxymodel.h"
+#include "videoproxymodelgeneric.h"
#include "hblistview.h"
QList HbListView::mVisibleItems = QList();
HbAbstractItemView::SelectionMode HbListView::mSelectionMode = HbAbstractItemView::InvalidSelection;
-VideoSortFilterProxyModel* HbListView::mLatestModel = 0;
+VideoProxyModelGeneric* HbListView::mLatestModel = 0;
bool HbListView::mReturnNullPrototype = false;
bool HbListView::mVScrollBarIsNull = false;
bool HbListView::mLatestrecycling = false;
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/tsrc/stubs/src/hbmainwindow.cpp
--- a/videocollection/tsrc/stubs/src/hbmainwindow.cpp Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/tsrc/stubs/src/hbmainwindow.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -23,9 +23,8 @@
// addView
// ---------------------------------------------------------------------------
//
-HbView* HbMainWindow::addView(QGraphicsWidget *widget)
+HbView* HbMainWindow::addView(HbView *view)
{
- HbView* view = qobject_cast(widget);
mViews.append(view);
return view;
}
@@ -34,9 +33,9 @@
// removeView
// ---------------------------------------------------------------------------
//
-void HbMainWindow::removeView(QGraphicsWidget *widget)
+void HbMainWindow::removeView(HbView *view)
{
- mViews.removeAll(qobject_cast(widget));
+ mViews.removeAll(view);
}
// ---------------------------------------------------------------------------
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/tsrc/stubs/src/videocollectionuiloader.cpp
--- a/videocollection/tsrc/stubs/src/videocollectionuiloader.cpp Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/tsrc/stubs/src/videocollectionuiloader.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -136,14 +136,17 @@
name == DOCML_NAME_VC_COLLECTIONWIDGET ||
name == DOCML_NAME_VC_COLLECTIONCONTENTWIDGET)
{
- VideoCollectionCommon::TModelType type = VideoCollectionCommon::EModelTypeAllVideos;
+ VideoProxyModelGeneric *model(0);
+
if(name == DOCML_NAME_VC_COLLECTIONWIDGET) {
- type = VideoCollectionCommon::EModelTypeCollections;
+ model = wrapper.getCollectionsModel();
} else if (name == DOCML_NAME_VC_COLLECTIONCONTENTWIDGET) {
- type = VideoCollectionCommon::EModelTypeCollectionContent;
+ model = wrapper.getCollectionContentModel();
+ } else
+ {
+ model = wrapper.getAllVideosModel();
}
VideoListWidget *videoList = qobject_cast(object);
- VideoSortFilterProxyModel *model = wrapper.getModel(type);
VideoCollectionCommon::TCollectionLevels level = VideoCollectionCommon::ELevelInvalid;
if(name == DOCML_NAME_VC_VIDEOLISTWIDGET )
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/tsrc/stubs/src/videocollectionviewutils.cpp
--- a/videocollection/tsrc/stubs/src/videocollectionviewutils.cpp Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/tsrc/stubs/src/videocollectionviewutils.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -20,6 +20,7 @@
int VideoCollectionViewUtilsData::mLastError = 0;
bool VideoCollectionViewUtilsData::mLoadSortingValuesFails = false;
+bool VideoCollectionViewUtilsData::mIsServiceValue = false;
int VideoCollectionViewUtilsData::mVideoSortRole = -1;
int VideoCollectionViewUtilsData::mCollectionSortRole = -1;
Qt::SortOrder VideoCollectionViewUtilsData::mVideoSortOrder = Qt::AscendingOrder;
@@ -40,6 +41,7 @@
}
VideoCollectionViewUtils::VideoCollectionViewUtils():
+mIsService(false),
mVideosSortRole(-1),
mCollectionsSortRole(-1),
mVideosSortOrder(Qt::AscendingOrder),
@@ -159,7 +161,7 @@
}
-void VideoCollectionViewUtils::sortModel(VideoSortFilterProxyModel *model,
+void VideoCollectionViewUtils::sortModel(VideoProxyModelGeneric *model,
bool async, VideoCollectionCommon::TCollectionLevels target)
{
Q_UNUSED(model);
@@ -173,3 +175,13 @@
VideoCollectionViewUtilsData::mLastStatusAdditional = additional;
VideoCollectionViewUtilsData::mLastError = statusCode;
}
+
+void VideoCollectionViewUtils::setIsService()
+{
+ mIsService = VideoCollectionViewUtilsData::mIsServiceValue;
+}
+
+bool VideoCollectionViewUtils::isService()
+{
+ return mIsService;
+}
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/tsrc/stubs/src/videocollectionwrapper.cpp
--- a/videocollection/tsrc/stubs/src/videocollectionwrapper.cpp Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/tsrc/stubs/src/videocollectionwrapper.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -17,13 +17,16 @@
#include "videocollectionwrapper.h"
#include "videocollectionwrapperdata.h"
-
-bool VideoCollectionWrapperData::mGetModelFails = false;
+/*
+bool VideoCollectionWrapperData::mGetGenericModelFails = false;
+bool VideoCollectionWrapperData::mGetAllVideosModelFails = false;
+bool VideoCollectionWrapperData::mGetCollectionsModelFails = false;
+bool VideoCollectionWrapperData::mGetCollectionContentModelFails = false;
VideoListDataModel *VideoCollectionWrapperData::mSourceModel = 0;
-VideoSortFilterProxyModel *VideoCollectionWrapperData::mAllVideosModel = 0;
-VideoSortFilterProxyModel *VideoCollectionWrapperData::mCollectionsModel = 0;
-VideoSortFilterProxyModel *VideoCollectionWrapperData::mCollectionContentModel = 0;
-VideoSortFilterProxyModel *VideoCollectionWrapperData::mGenericModel = 0;
+QPointer VideoCollectionWrapperData::mAllVideosModel = 0;
+QPointer VideoCollectionWrapperData::mCollectionsModel = 0;
+QPointer VideoCollectionWrapperData::mCollectionContentModel = 0;
+QPointer VideoCollectionWrapperData::mGenericModel = 0;*/
VideoCollectionWrapper &VideoCollectionWrapper::instance()
{
@@ -41,85 +44,100 @@
VideoCollectionWrapperData::reset();
}
-VideoSortFilterProxyModel* VideoCollectionWrapper::getModel(VideoCollectionCommon::TModelType type)
+VideoProxyModelGeneric* VideoCollectionWrapper::getGenericModel()
{
- VideoSortFilterProxyModel *model = 0;
- if (!VideoCollectionWrapperData::mGetModelFails)
+ VideoProxyModelGeneric *model = 0;
+ if (!VideoCollectionWrapperData::mGetGenericModelFails)
+ {
+ VideoListDataModel *sourceModel = VideoCollectionWrapperData::mSourceModel;
+ if (!sourceModel)
+ {
+ sourceModel = new VideoListDataModel;
+ sourceModel->initialize();
+ VideoCollectionWrapperData::mSourceModel = sourceModel;
+ }
+
+ model = VideoCollectionWrapperData::mGenericModel;
+ if(!model && VideoCollectionWrapperData::mSourceModel)
+ {
+ model = new VideoProxyModelGeneric();
+ model->initialize(VideoCollectionWrapperData::mSourceModel);
+ VideoCollectionWrapperData::mGenericModel = model;
+ }
+ }
+
+ return model;
+}
+
+VideoProxyModelGeneric* VideoCollectionWrapper::getAllVideosModel()
+{
+ VideoProxyModelGeneric *model = 0;
+ if (!VideoCollectionWrapperData::mGetAllVideosModelFails)
{
VideoListDataModel *sourceModel = VideoCollectionWrapperData::mSourceModel;
if (!sourceModel)
{
sourceModel = new VideoListDataModel;
- if (sourceModel)
- {
- sourceModel->initialize();
- VideoCollectionWrapperData::mSourceModel = sourceModel;
- }
+ sourceModel->initialize();
+ VideoCollectionWrapperData::mSourceModel = sourceModel;
+ }
+
+ model = VideoCollectionWrapperData::mAllVideosModel;
+ if (!model)
+ {
+ model = new VideoProxyModelAllVideos();
+ model->initialize(VideoCollectionWrapperData::mSourceModel);
+ VideoCollectionWrapperData::mAllVideosModel = model;
}
-
- switch (type)
+ }
+
+ return model;
+}
+
+VideoProxyModelGeneric* VideoCollectionWrapper::getCollectionsModel()
+{
+ VideoProxyModelGeneric *model = 0;
+ if (!VideoCollectionWrapperData::mGetCollectionsModelFails)
+ {
+ VideoListDataModel *sourceModel = VideoCollectionWrapperData::mSourceModel;
+ if (!sourceModel)
{
- case VideoCollectionCommon::EModelTypeAllVideos:
- {
- model = VideoCollectionWrapperData::mAllVideosModel;
- if (!model)
- {
- model = new VideoSortFilterProxyModel(type);
- if (model)
- {
- model->initialize(sourceModel);
- VideoCollectionWrapperData::mAllVideosModel = model;
- }
- }
- break;
- }
- case VideoCollectionCommon::EModelTypeCollections:
- {
- model = VideoCollectionWrapperData::mCollectionsModel;
- if (!model)
- {
- model = new VideoSortFilterProxyModel(type);
- if (model)
- {
- model->initialize(sourceModel);
- VideoCollectionWrapperData::mCollectionsModel = model;
- }
- }
- break;
- }
- case VideoCollectionCommon::EModelTypeCollectionContent:
- {
- model = VideoCollectionWrapperData::mCollectionContentModel;
- if (!model)
- {
- model = new VideoSortFilterProxyModel(type);
- if (model)
- {
- model->initialize(sourceModel);
- VideoCollectionWrapperData::mCollectionContentModel = model;
- }
- }
- break;
- }
- case VideoCollectionCommon::EModelTypeGeneric:
- {
- model = VideoCollectionWrapperData::mGenericModel;
- if (!model)
- {
- model = new VideoSortFilterProxyModel(type);
- if (model)
- {
- model->initialize(sourceModel);
- VideoCollectionWrapperData::mGenericModel = model;
- }
- }
- break;
- }
- default:
- {
- // invalid model type
- break;
- }
+ sourceModel = new VideoListDataModel;
+ sourceModel->initialize();
+ VideoCollectionWrapperData::mSourceModel = sourceModel;
+ }
+
+ model = VideoCollectionWrapperData::mCollectionsModel;
+ if (!model)
+ {
+ model = new VideoProxyModelCollections();
+ model->initialize(VideoCollectionWrapperData::mSourceModel);
+ VideoCollectionWrapperData::mCollectionsModel = model;
+ }
+ }
+
+ return model;
+}
+
+VideoProxyModelGeneric* VideoCollectionWrapper::getCollectionContentModel()
+{
+ VideoProxyModelGeneric *model = 0;
+ if (!VideoCollectionWrapperData::mGetCollectionContentModelFails)
+ {
+ VideoListDataModel *sourceModel = VideoCollectionWrapperData::mSourceModel;
+ if (!sourceModel)
+ {
+ sourceModel = new VideoListDataModel;
+ sourceModel->initialize();
+ VideoCollectionWrapperData::mSourceModel = sourceModel;
+ }
+
+ model = VideoCollectionWrapperData::mCollectionContentModel;
+ if (!model)
+ {
+ model = new VideoProxyModelContent();
+ model->initialize(VideoCollectionWrapperData::mSourceModel);
+ VideoCollectionWrapperData::mCollectionContentModel = model;
}
}
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/tsrc/stubs/src/videocollectionwrapperdata.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/videocollectionwrapperdata.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,45 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: VideoCollectionWrapperData class implementation
+*
+*/
+
+#include "videocollectionwrapperdata.h"
+
+bool VideoCollectionWrapperData::mGetGenericModelFails = false;
+bool VideoCollectionWrapperData::mGetAllVideosModelFails = false;
+bool VideoCollectionWrapperData::mGetCollectionsModelFails = false;
+bool VideoCollectionWrapperData::mGetCollectionContentModelFails = false;
+VideoListDataModel *VideoCollectionWrapperData::mSourceModel = 0;
+QPointer VideoCollectionWrapperData::mAllVideosModel = 0;
+QPointer VideoCollectionWrapperData::mCollectionsModel = 0;
+QPointer VideoCollectionWrapperData::mCollectionContentModel = 0;
+QPointer VideoCollectionWrapperData::mGenericModel = 0;
+
+void VideoCollectionWrapperData::reset()
+{
+ mGetGenericModelFails = false;
+ mGetAllVideosModelFails = false;
+ mGetCollectionsModelFails = false;
+ mGetCollectionContentModelFails = false;
+
+ delete mAllVideosModel;
+ delete mCollectionsModel;
+ delete mCollectionContentModel;
+ delete mGenericModel;
+
+ delete mSourceModel;
+ mSourceModel = 0;
+}
+
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/tsrc/stubs/src/videolistselectiondialog.cpp
--- a/videocollection/tsrc/stubs/src/videolistselectiondialog.cpp Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/tsrc/stubs/src/videolistselectiondialog.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -20,7 +20,7 @@
#include "videolistselectiondialog.h"
#include "videolistselectiondialogdata.h"
#include "videocollectionwrapper.h"
-#include "videosortfilterproxymodel.h"
+#include "videoproxymodelgeneric.h"
bool VideoListSelectionDialogData::mExecReturnPrimary = false;
int VideoListSelectionDialogData::mSelectionCount = 0;
@@ -79,7 +79,7 @@
// fill selection
VideoListSelectionDialogData::mMultiSelectionLaunchCount++;
VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
- VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionCommon::EModelTypeGeneric);
+ VideoProxyModelGeneric *model = wrapper.getGenericModel();
if (model)
{
for (int i = 0; i < VideoListSelectionDialogData::mSelectionCount; i++)
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/tsrc/stubs/src/videolistwidget.cpp
--- a/videocollection/tsrc/stubs/src/videolistwidget.cpp Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/tsrc/stubs/src/videolistwidget.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -47,7 +47,7 @@
VideoListWidgetData::reset();
}
-int VideoListWidget::initialize(VideoSortFilterProxyModel &model,
+int VideoListWidget::initialize(VideoProxyModelGeneric &model,
bool isService, VideoCollectionCommon::TCollectionLevels level)
{
Q_UNUSED(isService);
@@ -109,7 +109,7 @@
return mCurrentLevel;
}
-VideoSortFilterProxyModel* VideoListWidget::getModel()
+VideoProxyModelGeneric* VideoListWidget::getModel()
{
return mModel;
}
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/tsrc/stubs/src/videoproxymodelallvideos.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/videoproxymodelallvideos.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: VideoProxyModelAllVideos implementation
+*
+*/
+
+// Version :
+
+// INCLUDE FILES
+#include
+#include "videoproxymodeldata.h"
+#include "videoproxymodelallvideos.h"
+#include "videolistdatamodel.h"
+#include "videocollectiontrace.h"
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelAllVideos::VideoProxyModelGeneric
+// -----------------------------------------------------------------------------
+//
+VideoProxyModelAllVideos::VideoProxyModelAllVideos(QObject *parent) :
+VideoProxyModelGeneric(parent)
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelAllVideos::~VideoProxyModelAllVideos
+// -----------------------------------------------------------------------------
+//
+VideoProxyModelAllVideos::~VideoProxyModelAllVideos()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelAllVideos::filterAcceptsRow
+// -----------------------------------------------------------------------------
+//
+bool VideoProxyModelAllVideos::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
+{
+ Q_UNUSED(source_row);
+ Q_UNUSED(source_parent);
+ return true;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelAllVideos::getOpenItem()
+// -----------------------------------------------------------------------------
+//
+TMPXItemId VideoProxyModelAllVideos::getOpenItem() const
+{
+ return VideoProxyModelData::mOpenedItemId;
+}
+
+// End of file
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/tsrc/stubs/src/videoproxymodelcollections.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/videoproxymodelcollections.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: VideoProxyModelCollections implementation
+*
+*/
+
+// Version :
+
+// INCLUDE FILES
+#include
+#include "videoproxymodeldata.h"
+#include "videoproxymodelcollections.h"
+#include "videolistdatamodel.h"
+#include "videocollectiontrace.h"
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelCollections::VideoProxyModelCollections
+// -----------------------------------------------------------------------------
+//
+VideoProxyModelCollections::VideoProxyModelCollections(QObject *parent) :
+VideoProxyModelGeneric(parent)
+{
+ mDefaultSortRole = VideoCollectionCommon::KeyTitle;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelCollections::~VideoProxyModelCollections
+// -----------------------------------------------------------------------------
+//
+VideoProxyModelCollections::~VideoProxyModelCollections()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelCollections::lessThan
+// -----------------------------------------------------------------------------
+//
+bool VideoProxyModelCollections::lessThan(const QModelIndex &left,
+ const QModelIndex &right) const
+{
+ Q_UNUSED(left);
+ Q_UNUSED(right);
+ return true;
+}
+// -----------------------------------------------------------------------------
+// VideoProxyModelCollections::filterAcceptsRow
+// -----------------------------------------------------------------------------
+//
+bool VideoProxyModelCollections::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
+{
+ Q_UNUSED(source_parent);
+ Q_UNUSED(source_row);
+ return true;
+}
+
+// End of file
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/tsrc/stubs/src/videoproxymodelcontent.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/videoproxymodelcontent.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: VideoProxyModelContent implementation
+*
+*/
+
+// Version :
+
+// INCLUDE FILES
+#include "videoproxymodeldata.h"
+#include "videoproxymodelcontent.h"
+#include "videolistdatamodel.h"
+#include "videocollectiontrace.h"
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelContent::VideoProxyModelGeneric
+// -----------------------------------------------------------------------------
+//
+VideoProxyModelContent::VideoProxyModelContent(QObject *parent) :
+VideoProxyModelGeneric(parent)
+{
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelContent::~VideoProxyModelContent
+// -----------------------------------------------------------------------------
+//
+VideoProxyModelContent::~VideoProxyModelContent()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelContent::connectSignals
+// -----------------------------------------------------------------------------
+//
+bool VideoProxyModelContent::connectSignals()
+{
+ return true;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelContent::disconnectSignals
+// -----------------------------------------------------------------------------
+//
+void VideoProxyModelContent::disconnectSignals()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelContent::filterAcceptsRow
+// -----------------------------------------------------------------------------
+//
+bool VideoProxyModelContent::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
+{
+ Q_UNUSED(source_row);
+ Q_UNUSED(source_parent);
+ return true;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelContent::getOpenItem()
+// -----------------------------------------------------------------------------
+//
+TMPXItemId VideoProxyModelContent::getOpenItem() const
+{
+ return VideoProxyModelData::mOpenedItemId;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelContent::albumChangedSlot()
+// -----------------------------------------------------------------------------
+//
+void VideoProxyModelContent::albumChangedSlot()
+{
+
+}
+
+// End of file
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/tsrc/stubs/src/videoproxymodelgeneric.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/videoproxymodelgeneric.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,298 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: stub VideoProxyModelGeneric implementation
+*
+*/
+
+#include "videoproxymodelgeneric.h"
+#include "videoproxymodeldata.h"
+#include "videocollectioncommon.h"
+#include "videolistdatamodel.h"
+
+using namespace VideoCollectionCommon;
+
+int VideoProxyModelData::mSortRole = -1;
+Qt::SortOrder VideoProxyModelData::mSortOrder = Qt::AscendingOrder;
+bool VideoProxyModelData::mSortAsync = false;
+bool VideoProxyModelData::mDeleteItemsFails = false;
+bool VideoProxyModelData::mRemoveAlbumsFails = false;
+int VideoProxyModelData::mDoSortingCallCount = 0;
+bool VideoProxyModelData::mOpenFails = false;
+QList VideoProxyModelData::mItemIds = QList();
+QModelIndex VideoProxyModelData::mLastIndex = QModelIndex();
+TMPXItemId VideoProxyModelData::mLastItemId = TMPXItemId::InvalidId();
+TMPXItemId VideoProxyModelData::mOpenedItemId = TMPXItemId::InvalidId();
+int VideoProxyModelData::mDetailsReturnValue = 0;
+int VideoProxyModelData::mAddItemsInAlbumReturnValue = 0;
+int VideoProxyModelData::mRemoveItemsFromAlbumReturnValue = 0;
+TMPXItemId VideoProxyModelData::mGenericFilterId = TMPXItemId::InvalidId();
+bool VideoProxyModelData::mGenericFilterValue = false;
+TMPXItemId VideoProxyModelData::mNewAlbumId = TMPXItemId::InvalidId();
+QString VideoProxyModelData::mLastItemNameInRename = "";
+int VideoProxyModelData::mRenameItemReturnValue = 0;
+QString VideoProxyModelData::mLastAddedAlbumName = "";
+
+const TMPXItemId INVALID_ID = TMPXItemId::InvalidId();
+
+VideoProxyModelGeneric::VideoProxyModelGeneric(QObject *parent):
+ QSortFilterProxyModel(parent),
+ mModel(0),
+ mCollectionClient(0),
+ mLevel(VideoCollectionCommon::ELevelInvalid),
+ mIdleSortTimer(0),
+ mWantedSortRole(VideoCollectionCommon::KeyDateTime),
+ mDefaultSortRole(VideoCollectionCommon::KeyTitle)
+{
+
+}
+
+VideoProxyModelGeneric::~VideoProxyModelGeneric()
+{
+ VideoProxyModelData::reset();
+}
+
+int VideoProxyModelGeneric::initialize(VideoListDataModel *sourceModel)
+{
+ mModel = sourceModel;
+ setSourceModel(mModel);
+ return 0;
+}
+
+bool VideoProxyModelGeneric::connectSignals()
+{
+ // not stubbed
+ return true;
+}
+
+void VideoProxyModelGeneric::disconnectSignals()
+{
+ // not stubbed
+}
+
+int VideoProxyModelGeneric::open(VideoCollectionCommon::TCollectionLevels level)
+{
+ int err = 0;
+
+ mLevel = level;
+ if (VideoProxyModelData::mOpenFails)
+ {
+ err = -1;
+ }
+
+ return err;
+}
+
+void VideoProxyModelGeneric::doSorting(int sortingRole,
+ Qt::SortOrder order,
+ bool async)
+{
+ VideoProxyModelData::mDoSortingCallCount++;
+ VideoProxyModelData::mSortRole = sortingRole;
+ VideoProxyModelData::mSortOrder = order;
+ VideoProxyModelData::mSortAsync = async;
+ setSortRole(sortingRole);
+ sort(0, order);
+}
+
+void VideoProxyModelGeneric::getSorting(int &sortingRole,
+ Qt::SortOrder &order)
+{
+ sortingRole = VideoProxyModelData::mSortRole;
+ order = VideoProxyModelData::mSortOrder;
+}
+
+int VideoProxyModelGeneric::deleteItems(const QModelIndexList &indexList)
+{
+
+ int err = 0;
+ if (VideoProxyModelData::mDeleteItemsFails)
+ {
+ err = -1;
+ }
+ else
+ {
+ if (indexList.count() > 0)
+ {
+ VideoProxyModelData::mLastIndex = indexList.at(0);
+ }
+ }
+
+ return err;
+}
+
+int VideoProxyModelGeneric::openItem(TMPXItemId mediaId)
+{
+ VideoProxyModelData::mLastItemId = mediaId;
+
+ return 0;
+}
+
+int VideoProxyModelGeneric::back()
+{
+ // not stubbed
+ return 0;
+}
+
+int VideoProxyModelGeneric::fetchItemDetails(const QModelIndex &index)
+{
+ VideoProxyModelData::mLastIndex = index;
+
+ return VideoProxyModelData::mDetailsReturnValue;
+}
+
+void VideoProxyModelGeneric::processSorting()
+{
+ // not stubbed
+}
+
+void VideoProxyModelGeneric::processSortingSlot()
+{
+ // not stubbed
+}
+
+bool VideoProxyModelGeneric::lessThan(const QModelIndex &left,
+ const QModelIndex &right) const
+{
+ Q_UNUSED(left);
+ Q_UNUSED(right);
+ // not stubbed
+ return true;
+}
+
+bool VideoProxyModelGeneric::filterAcceptsRow (int source_row,
+ const QModelIndex &source_parent) const
+{
+ Q_UNUSED(source_row);
+ Q_UNUSED(source_parent);
+ // not stubbed
+ return true;
+}
+
+ const TMPXItemId& VideoProxyModelGeneric::getMediaIdAtIndex(
+ const QModelIndex &index) const
+{
+ if (index.row() >= 0 &&
+ index.row() < VideoProxyModelData::mItemIds.count())
+ {
+ return VideoProxyModelData::mItemIds[index.row()];
+ }
+ return INVALID_ID;
+}
+
+QModelIndex VideoProxyModelGeneric::indexOfId(const TMPXItemId &id)
+{
+ //VideoListDataModel *sourceModel = qobject_cast(sourceModel());
+
+ for(int i = 0; i < VideoProxyModelData::mItemIds.count(); i++)
+ {
+ if(VideoProxyModelData::mItemIds.at(i) == id)
+ {
+ //return sourceModel->index(i, 0);
+ return index(i, 0);
+ }
+ }
+ return QModelIndex();
+}
+
+QString VideoProxyModelGeneric::getMediaFilePathForId(const TMPXItemId &mediaId)
+{
+ Q_UNUSED(mediaId);
+ // not stubbed
+ return QString();
+}
+
+TMPXItemId VideoProxyModelGeneric::addNewAlbum(const QString &title)
+{
+ VideoProxyModelData::mLastAddedAlbumName = title;
+ return VideoProxyModelData::mNewAlbumId;
+}
+
+QString VideoProxyModelGeneric::resolveAlbumName(
+ const QString& albumName) const
+{
+ QString name = albumName;
+ return name;
+}
+
+int VideoProxyModelGeneric::addItemsInAlbum(TMPXItemId &albumId, const QList &mediaIds)
+{
+ if(VideoProxyModelData::mAddItemsInAlbumReturnValue >= 0)
+ {
+ VideoProxyModelData::mLastItemId = albumId;
+ VideoProxyModelData::mItemIds.clear();
+ VideoProxyModelData::mItemIds = mediaIds;
+ }
+ // not stubbed
+ return VideoProxyModelData::mAddItemsInAlbumReturnValue;
+}
+
+int VideoProxyModelGeneric::removeAlbums(const QModelIndexList &indexList)
+{
+
+ int err = 0;
+ if (VideoProxyModelData::mRemoveAlbumsFails)
+ {
+ err = -1;
+ }
+ else
+ {
+ if (indexList.count() > 0)
+ {
+ VideoProxyModelData::mLastIndex = indexList.at(0);
+ }
+ }
+
+ return err;
+}
+
+int VideoProxyModelGeneric::removeItemsFromAlbum(class TMPXItemId &album, QList const &mediaIds)
+{
+ if(VideoProxyModelData::mRemoveItemsFromAlbumReturnValue >= 0)
+ {
+ VideoProxyModelData::mLastItemId = album;
+ VideoProxyModelData::mItemIds.clear();
+ VideoProxyModelData::mItemIds = mediaIds;
+ }
+ return VideoProxyModelData::mRemoveItemsFromAlbumReturnValue;
+}
+
+void VideoProxyModelGeneric::setAlbumInUse(const TMPXItemId &albumId)
+{
+ VideoProxyModelData::mLastItemId = albumId;
+}
+
+int VideoProxyModelGeneric::renameItem(const TMPXItemId &itemId, const QString &newTitle)
+{
+ if(VideoProxyModelData::mRemoveItemsFromAlbumReturnValue >= 0)
+ {
+ VideoProxyModelData::mLastItemId = itemId;
+ VideoProxyModelData::mLastItemNameInRename = newTitle;
+
+ }
+ return VideoProxyModelData::mRenameItemReturnValue;
+}
+
+TMPXItemId VideoProxyModelGeneric::getOpenItem() const
+{
+ return VideoProxyModelData::mOpenedItemId;
+}
+
+void VideoProxyModelGeneric::setGenericIdFilter(const TMPXItemId &itemId, bool filterValue)
+{
+ VideoProxyModelData::mGenericFilterId = itemId;
+ VideoProxyModelData::mGenericFilterValue = filterValue;
+ return;
+}
+
+// end of file
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/tsrc/stubs/src/videosortfilterproxymodel.cpp
--- a/videocollection/tsrc/stubs/src/videosortfilterproxymodel.cpp Mon Aug 23 14:27:29 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,303 +0,0 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Videosortfilterproxymodel implementation
-*
-*/
-
-#include "videosortfilterproxymodel.h"
-#include "videosortfilterproxymodeldata.h"
-#include "videocollectioncommon.h"
-#include "videolistdatamodel.h"
-
-using namespace VideoCollectionCommon;
-
-int VideoSortFilterProxyModelData::mSortRole = -1;
-Qt::SortOrder VideoSortFilterProxyModelData::mSortOrder = Qt::AscendingOrder;
-bool VideoSortFilterProxyModelData::mSortAsync = false;
-bool VideoSortFilterProxyModelData::mDeleteItemsFails = false;
-bool VideoSortFilterProxyModelData::mRemoveAlbumsFails = false;
-int VideoSortFilterProxyModelData::mDoSortingCallCount = 0;
-bool VideoSortFilterProxyModelData::mOpenFails = false;
-QList VideoSortFilterProxyModelData::mItemIds = QList();
-QModelIndex VideoSortFilterProxyModelData::mLastIndex = QModelIndex();
-TMPXItemId VideoSortFilterProxyModelData::mLastItemId = TMPXItemId::InvalidId();
-TMPXItemId VideoSortFilterProxyModelData::mOpenedItemId = TMPXItemId::InvalidId();
-int VideoSortFilterProxyModelData::mDetailsReturnValue = 0;
-int VideoSortFilterProxyModelData::mAddItemsInAlbumReturnValue = 0;
-int VideoSortFilterProxyModelData::mRemoveItemsFromAlbumReturnValue = 0;
-TMPXItemId VideoSortFilterProxyModelData::mGenericFilterId = TMPXItemId::InvalidId();
-bool VideoSortFilterProxyModelData::mGenericFilterValue = false;
-TMPXItemId VideoSortFilterProxyModelData::mNewAlbumId = TMPXItemId::InvalidId();
-QString VideoSortFilterProxyModelData::mLastItemNameInRename = "";
-int VideoSortFilterProxyModelData::mRenameItemReturnValue = 0;
-QString VideoSortFilterProxyModelData::mLastAddedAlbumName = "";
-
-const TMPXItemId INVALID_ID = TMPXItemId::InvalidId();
-
-VideoSortFilterProxyModel::VideoSortFilterProxyModel(VideoCollectionCommon::TModelType type, QObject *parent):
- QSortFilterProxyModel(parent),
- mModel(0),
- mCollectionClient(0),
- mType(type),
- mLevel(VideoCollectionCommon::ELevelInvalid),
- mIdleSortTimer(0),
- mWantedSortRole(VideoCollectionCommon::KeyDateTime)
-{
- // NOP
-}
-
-VideoSortFilterProxyModel::~VideoSortFilterProxyModel()
-{
- VideoSortFilterProxyModelData::reset();
-}
-
-int VideoSortFilterProxyModel::initialize(VideoListDataModel *sourceModel)
-{
- setSourceModel(sourceModel);
-
- return 0;
-}
-
-bool VideoSortFilterProxyModel::connectSignals()
-{
- // not stubbed
- return true;
-}
-
-void VideoSortFilterProxyModel::disconnectSignals()
-{
- // not stubbed
-}
-
-int VideoSortFilterProxyModel::open(VideoCollectionCommon::TCollectionLevels level)
-{
- int err = 0;
-
- mLevel = level;
- if (VideoSortFilterProxyModelData::mOpenFails)
- {
- err = -1;
- }
-
- return err;
-}
-
-void VideoSortFilterProxyModel::doSorting(int sortingRole,
- Qt::SortOrder order,
- bool async)
-{
- VideoSortFilterProxyModelData::mDoSortingCallCount++;
- VideoSortFilterProxyModelData::mSortRole = sortingRole;
- VideoSortFilterProxyModelData::mSortOrder = order;
- VideoSortFilterProxyModelData::mSortAsync = async;
- setSortRole(sortingRole);
- sort(0, order);
-}
-
-void VideoSortFilterProxyModel::getSorting(int &sortingRole,
- Qt::SortOrder &order)
-{
- sortingRole = VideoSortFilterProxyModelData::mSortRole;
- order = VideoSortFilterProxyModelData::mSortOrder;
-}
-
-int VideoSortFilterProxyModel::deleteItems(const QModelIndexList &indexList)
-{
-
- int err = 0;
- if (VideoSortFilterProxyModelData::mDeleteItemsFails)
- {
- err = -1;
- }
- else
- {
- if (indexList.count() > 0)
- {
- VideoSortFilterProxyModelData::mLastIndex = indexList.at(0);
- }
- }
-
- return err;
-}
-
-int VideoSortFilterProxyModel::openItem(TMPXItemId mediaId)
-{
- VideoSortFilterProxyModelData::mLastItemId = mediaId;
-
- return 0;
-}
-
-int VideoSortFilterProxyModel::back()
-{
- // not stubbed
- return 0;
-}
-
-int VideoSortFilterProxyModel::fetchItemDetails(const QModelIndex &index)
-{
- VideoSortFilterProxyModelData::mLastIndex = index;
-
- return VideoSortFilterProxyModelData::mDetailsReturnValue;
-}
-
-void VideoSortFilterProxyModel::processSorting()
-{
- // not stubbed
-}
-
-void VideoSortFilterProxyModel::albumChangedSlot()
-{
- // not stubbed
-}
-
-bool VideoSortFilterProxyModel::lessThan(const QModelIndex &left,
- const QModelIndex &right) const
-{
- Q_UNUSED(left);
- Q_UNUSED(right);
- // not stubbed
- return true;
-}
-
-bool VideoSortFilterProxyModel::filterAcceptsRow (int source_row,
- const QModelIndex &source_parent) const
-{
- Q_UNUSED(source_row);
- Q_UNUSED(source_parent);
- // not stubbed
- return true;
-}
-
- const TMPXItemId& VideoSortFilterProxyModel::getMediaIdAtIndex(
- const QModelIndex &index) const
-{
- if (index.row() >= 0 &&
- index.row() < VideoSortFilterProxyModelData::mItemIds.count())
- {
- return VideoSortFilterProxyModelData::mItemIds[index.row()];
- }
- return INVALID_ID;
-}
-
-QModelIndex VideoSortFilterProxyModel::indexOfId(const TMPXItemId &id)
-{
- //VideoListDataModel *sourceModel = qobject_cast(sourceModel());
-
- for(int i = 0; i < VideoSortFilterProxyModelData::mItemIds.count(); i++)
- {
- if(VideoSortFilterProxyModelData::mItemIds.at(i) == id)
- {
- //return sourceModel->index(i, 0);
- return index(i, 0);
- }
- }
- return QModelIndex();
-}
-
-QString VideoSortFilterProxyModel::getMediaFilePathForId(const TMPXItemId &mediaId)
-{
- Q_UNUSED(mediaId);
- // not stubbed
- return QString();
-}
-
-TModelType VideoSortFilterProxyModel::getType()
-{
- return mType;
-}
-
-TMPXItemId VideoSortFilterProxyModel::addNewAlbum(const QString &title)
-{
- VideoSortFilterProxyModelData::mLastAddedAlbumName = title;
- return VideoSortFilterProxyModelData::mNewAlbumId;
-}
-
-QString VideoSortFilterProxyModel::resolveAlbumName(
- const QString& albumName) const
-{
- QString name = albumName;
- return name;
-}
-
-int VideoSortFilterProxyModel::addItemsInAlbum(TMPXItemId &albumId, const QList &mediaIds)
-{
- if(VideoSortFilterProxyModelData::mAddItemsInAlbumReturnValue >= 0)
- {
- VideoSortFilterProxyModelData::mLastItemId = albumId;
- VideoSortFilterProxyModelData::mItemIds.clear();
- VideoSortFilterProxyModelData::mItemIds = mediaIds;
- }
- // not stubbed
- return VideoSortFilterProxyModelData::mAddItemsInAlbumReturnValue;
-}
-
-int VideoSortFilterProxyModel::removeAlbums(const QModelIndexList &indexList)
-{
-
- int err = 0;
- if (VideoSortFilterProxyModelData::mRemoveAlbumsFails)
- {
- err = -1;
- }
- else
- {
- if (indexList.count() > 0)
- {
- VideoSortFilterProxyModelData::mLastIndex = indexList.at(0);
- }
- }
-
- return err;
-}
-
-int VideoSortFilterProxyModel::removeItemsFromAlbum(class TMPXItemId &album, QList const &mediaIds)
-{
- if(VideoSortFilterProxyModelData::mRemoveItemsFromAlbumReturnValue >= 0)
- {
- VideoSortFilterProxyModelData::mLastItemId = album;
- VideoSortFilterProxyModelData::mItemIds.clear();
- VideoSortFilterProxyModelData::mItemIds = mediaIds;
- }
- return VideoSortFilterProxyModelData::mRemoveItemsFromAlbumReturnValue;
-}
-
-void VideoSortFilterProxyModel::setAlbumInUse(const TMPXItemId &albumId)
-{
- VideoSortFilterProxyModelData::mLastItemId = albumId;
-}
-
-int VideoSortFilterProxyModel::renameItem(const TMPXItemId &itemId, const QString &newTitle)
-{
- if(VideoSortFilterProxyModelData::mRemoveItemsFromAlbumReturnValue >= 0)
- {
- VideoSortFilterProxyModelData::mLastItemId = itemId;
- VideoSortFilterProxyModelData::mLastItemNameInRename = newTitle;
-
- }
- return VideoSortFilterProxyModelData::mRenameItemReturnValue;
-}
-
-TMPXItemId VideoSortFilterProxyModel::getOpenItem() const
-{
- return VideoSortFilterProxyModelData::mOpenedItemId;
-}
-
-void VideoSortFilterProxyModel::setGenericIdFilter(const TMPXItemId &itemId, bool filterValue)
-{
- VideoSortFilterProxyModelData::mGenericFilterId = itemId;
- VideoSortFilterProxyModelData::mGenericFilterValue = filterValue;
- return;
-}
-
-// end of file
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/tsrc/stubs/src/videothumbnaildata.cpp
--- a/videocollection/tsrc/stubs/src/videothumbnaildata.cpp Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/tsrc/stubs/src/videothumbnaildata.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -60,7 +60,7 @@
return 0;
}
-void VideoThumbnailData::startBackgroundFetching(VideoSortFilterProxyModel *model, int fetchIndex)
+void VideoThumbnailData::startBackgroundFetching(VideoProxyModelGeneric *model, int fetchIndex)
{
Q_UNUSED(model);
VideoThumbnailTestData::mStartBackgroundFetchingCallCount++;
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/tsrc/stubs/stubs.pro
--- a/videocollection/tsrc/stubs/stubs.pro Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/tsrc/stubs/stubs.pro Fri Sep 03 12:37:43 2010 +0300
@@ -76,7 +76,7 @@
inc/videolistwidgetdata.h \
inc/videolistviewdata.h \
inc/videoplayerappexport.h \
- inc/videosortfilterproxymodeldata.h \
+ inc/videoproxymodeldata.h \
inc/videothumbnailtestdata.h \
inc/videoactivitystate.h \
inc/xqserviceutilxtra.h \
@@ -92,7 +92,10 @@
../../videocollectionview/inc/videolistview.h \
../../videocollectionwrapper/inc/videolistdatamodel.h \
../../videocollectionwrapper/inc/videocollectionwrapper.h \
- ../../videocollectionwrapper/inc/videosortfilterproxymodel.h \
+ ../../videocollectionwrapper/inc/videoproxymodelgeneric.h \
+ ../../videocollectionwrapper/inc/videoproxymodelallvideos.h \
+ ../../videocollectionwrapper/inc/videoproxymodelcollections.h \
+ ../../videocollectionwrapper/inc/videoproxymodelcontent.h \
../../videocollectionwrapper/inc/videothumbnaildata.h \
../../videocollectionview/inc/videooperatorservice.h \
../../videocollectionview/inc/videooperatorservice_p.h
@@ -131,7 +134,10 @@
src/videolistview.cpp \
src/videolistdatamodel.cpp \
src/videocollectionwrapper.cpp \
- src/videosortfilterproxymodel.cpp \
+ src/videoproxymodelgeneric.cpp \
+ src/videoproxymodelallvideos.cpp \
+ src/videoproxymodelcollections.cpp \
+ src/videoproxymodelcontent.cpp \
src/videothumbnaildata.cpp \
src/videoservices.cpp \
src/videoserviceurifetch.cpp \
@@ -139,6 +145,7 @@
src/videoactivitystate.cpp \
src/videooperatorservice.cpp \
src/videooperatorservice_p.cpp \
+ src/videocollectionwrapperdata.cpp \
src/xqsettingsmanagerstub.cpp
HEADERS += $$find(HEADERS_TEMP, ^(?!.*$$TESTEDCLASS).*$)
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/tsrc/videoservicestestapp/sis/videoservicestestapp.sisx
Binary file videocollection/tsrc/videoservicestestapp/sis/videoservicestestapp.sisx has changed
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionview/inc/videocollectionviewplugin.h
--- a/videocollection/videocollectionview/inc/videocollectionviewplugin.h Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionview/inc/videocollectionviewplugin.h Fri Sep 03 12:37:43 2010 +0300
@@ -21,6 +21,7 @@
#include
class VideoCollectionUiLoader;
+class VideoCollectionViewUtils;
class VideoListView;
class VideoServices;
@@ -137,6 +138,11 @@
VideoListView *mView;
/**
+ * Reference to video collection view utils
+ */
+ VideoCollectionViewUtils &mUiUtils;
+
+ /**
* Activated flag. Set as true when view is properly activated.
* If flag is false, no operations can be do to the view.
*/
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionview/inc/videocollectionviewutils.h
--- a/videocollection/videocollectionview/inc/videocollectionviewutils.h Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionview/inc/videocollectionviewutils.h Fri Sep 03 12:37:43 2010 +0300
@@ -23,7 +23,7 @@
#include "videocollectioncommon.h"
class HbListView;
-class VideoSortFilterProxyModel;
+class VideoProxyModelGeneric;
class VideoCollectionViewUtils : public QObject
{
@@ -73,6 +73,16 @@
* @return Application UID if operation succeeded, less than zero in error cases.
*/
int getCenRepIntValue(int key);
+
+ /**
+ * Set video services in use.
+ */
+ void setIsService();
+
+ /**
+ * Get video services in use.
+ */
+ bool isService();
public:
/**
@@ -84,7 +94,7 @@
/**
* Initilizes model sort values.
*/
- static void sortModel(VideoSortFilterProxyModel *model, bool async, VideoCollectionCommon::TCollectionLevels target);
+ static void sortModel(VideoProxyModelGeneric *model, bool async, VideoCollectionCommon::TCollectionLevels target);
/**
* Method saves the latest videolist widget level into local activity manager
@@ -149,6 +159,10 @@
virtual ~VideoCollectionViewUtils();
private:
+
+ /** is service */
+ bool mIsService;
+
/** current sorting role */
int mVideosSortRole;
int mCollectionsSortRole;
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionview/inc/videolistselectiondialog.h
--- a/videocollection/videocollectionview/inc/videolistselectiondialog.h Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionview/inc/videolistselectiondialog.h Fri Sep 03 12:37:43 2010 +0300
@@ -31,7 +31,7 @@
class HbStackedWidget;
class VideoCollectionUiLoader;
class VideoCollectionWrapper;
-class VideoSortFilterProxyModel;
+class VideoProxyModelGeneric;
class VideoListWidget;
class VideoListSelectionDialog: public HbDialog
@@ -265,7 +265,7 @@
/**
* Video list model
*/
- VideoSortFilterProxyModel *mModel;
+ VideoProxyModelGeneric *mModel;
/**
* Boolean to know if the model is ready or not.
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionview/inc/videolistview.h
--- a/videocollection/videocollectionview/inc/videolistview.h Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionview/inc/videolistview.h Fri Sep 03 12:37:43 2010 +0300
@@ -30,7 +30,7 @@
class QActionGroup;
class QVariant;
class VideoCollectionViewUtils;
-class VideoSortFilterProxyModel;
+class VideoProxyModelGeneric;
class VideoCollectionWrapper;
class HbStackedWidget;
class VideoCollectionUiLoader;
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionview/inc/videolistwidget.h
--- a/videocollection/videocollectionview/inc/videolistwidget.h Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionview/inc/videolistwidget.h Fri Sep 03 12:37:43 2010 +0300
@@ -27,7 +27,7 @@
#include "videoservices.h"
#include "videocollectioncommon.h"
-class VideoSortFilterProxyModel;
+class VideoProxyModelGeneric;
class VideoServices;
class VideoCollectionUiLoader;
class HbAction;
@@ -73,7 +73,7 @@
* @param level presetted level for the widget
* @return int 0 initialization ok, < 0 if fails.
*/
- int initialize(VideoSortFilterProxyModel &model,
+ int initialize(VideoProxyModelGeneric &model,
bool isService = false,
VideoCollectionCommon::TCollectionLevels level = VideoCollectionCommon::ELevelInvalid);
@@ -107,9 +107,9 @@
/**
* returns widget's model
*
- * @return VideoSortFilterProxyModel*
+ * @return VideoProxyModelGeneric*
*/
- VideoSortFilterProxyModel* getModel();
+ VideoProxyModelGeneric* getModel();
public:
@@ -377,7 +377,7 @@
* Provided model
* Not own.
*/
- QPointer mModel;
+ QPointer mModel;
/**
* pointer to videoservices instance. If exists,
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionview/src/videocollectionuiloader.cpp
--- a/videocollection/videocollectionview/src/videocollectionuiloader.cpp Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionview/src/videocollectionuiloader.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 24 %
+// Version : %version: 24.1.1 %
// INCLUDE FILES
#include
@@ -32,7 +32,7 @@
#include "videolistwidget.h"
#include "videohintwidget.h"
#include "videocollectionwrapper.h"
-#include "videosortfilterproxymodel.h"
+#include "videoproxymodelgeneric.h"
#include "videocollectionviewutils.h"
#include "videocollectiontrace.h"
@@ -368,8 +368,7 @@
VideoListWidget *videoList = qobject_cast(object);
if (videoList)
{
- VideoSortFilterProxyModel *model =
- wrapper.getModel(VideoCollectionCommon::EModelTypeAllVideos);
+ VideoProxyModelGeneric *model = wrapper.getAllVideosModel();
if(model)
{
VideoCollectionViewUtils::sortModel(model, true, VideoCollectionCommon::ELevelVideos);
@@ -381,8 +380,7 @@
}
else if (name.compare(DOCML_NAME_VC_COLLECTIONWIDGET) == 0)
{
- VideoSortFilterProxyModel *model = wrapper.getModel(
- VideoCollectionCommon::EModelTypeCollections);
+ VideoProxyModelGeneric *model = wrapper.getCollectionsModel();
if (model)
{
VideoCollectionViewUtils::sortModel(model, true, VideoCollectionCommon::ELevelCategory);
@@ -399,8 +397,7 @@
}
else if (name.compare(DOCML_NAME_VC_COLLECTIONCONTENTWIDGET) == 0)
{
- VideoSortFilterProxyModel *model = wrapper.getModel(
- VideoCollectionCommon::EModelTypeCollectionContent);
+ VideoProxyModelGeneric *model = wrapper.getCollectionContentModel();
if (model)
{
// collection content contains always a list of videos so we use
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionview/src/videocollectionviewplugin.cpp
--- a/videocollection/videocollectionview/src/videocollectionviewplugin.cpp Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionview/src/videocollectionviewplugin.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -15,11 +15,10 @@
*
*/
-// Version : %version: 24 %
+// Version : %version: 25 %
// INCLUDE FILES
#include
-#include
#include
#include
#include
@@ -30,6 +29,7 @@
#include "videocollectionviewplugin.h"
#include "videolistview.h"
#include "videocollectionuiloader.h"
+#include "videocollectionviewutils.h"
#include "mpxhbvideocommondefs.h"
#include "videocollectiontrace.h"
@@ -40,6 +40,7 @@
VideoCollectionViewPlugin::VideoCollectionViewPlugin()
: mUiLoader( 0 )
, mView( 0 )
+ , mUiUtils( VideoCollectionViewUtils::instance() )
, mActivated( false )
, mVideoServices( 0 )
{
@@ -73,7 +74,9 @@
mUiLoader->reset();
- mUiLoader->setIsService(XQServiceUtil::isService());
+ mUiUtils.setIsService();
+
+ mUiLoader->setIsService(mUiUtils.isService());
bool ok(false);
@@ -160,7 +163,7 @@
if(wnd)
{
TMPXItemId itemId = TMPXItemId::InvalidId();
- bool isService = XQServiceUtil::isService();
+ bool isService = mUiUtils.isService();
if (isService)
{
if(!mVideoServices)
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionview/src/videocollectionviewutils.cpp
--- a/videocollection/videocollectionview/src/videocollectionviewutils.cpp Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionview/src/videocollectionviewutils.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 47 %
+// Version : %version: 51 %
// INCLUDE FILES
#include
@@ -27,11 +27,12 @@
#include
#include
#include
+#include
#include
#include "videocollectioncommon.h"
#include "videocollectionviewutils.h"
-#include "videosortfilterproxymodel.h"
+#include "videoproxymodelgeneric.h"
#include "videoactivitystate.h"
#include "videocollectioncenrepdefs.h"
#include "videocollectiontrace.h"
@@ -70,11 +71,12 @@
// VideoCollectionViewUtils
// ---------------------------------------------------------------------------
//
-VideoCollectionViewUtils::VideoCollectionViewUtils():
- mVideosSortRole(-1),
- mCollectionsSortRole(-1),
- mVideosSortOrder(Qt::AscendingOrder),
- mCollectionsSortOrder(Qt::AscendingOrder)
+VideoCollectionViewUtils::VideoCollectionViewUtils()
+ : mIsService(false)
+ , mVideosSortRole(-1)
+ , mCollectionsSortRole(-1)
+ , mVideosSortOrder(Qt::AscendingOrder)
+ , mCollectionsSortOrder(Qt::AscendingOrder)
{
FUNC_LOG;
}
@@ -89,6 +91,30 @@
}
// ---------------------------------------------------------------------------
+// setIsService
+// ---------------------------------------------------------------------------
+//
+void VideoCollectionViewUtils::setIsService()
+{
+ FUNC_LOG;
+
+ mIsService = XQServiceUtil::isService();
+
+ INFO_1("VideoCollectionViewUtils::setService() saving: is service: %d", mIsService);
+}
+
+// ---------------------------------------------------------------------------
+// isService
+// ---------------------------------------------------------------------------
+//
+bool VideoCollectionViewUtils::isService()
+{
+ FUNC_LOG;
+
+ return mIsService;
+}
+
+// ---------------------------------------------------------------------------
// saveSortingValues
// ---------------------------------------------------------------------------
//
@@ -256,7 +282,7 @@
// ---------------------------------------------------------------------------
//
void VideoCollectionViewUtils::sortModel(
- VideoSortFilterProxyModel *model,
+ VideoProxyModelGeneric *model,
bool async,
VideoCollectionCommon::TCollectionLevels target)
{
@@ -394,7 +420,7 @@
}
break;
case VideoCollectionCommon::statusMultipleDeleteFail:
- msg = hbTrId("txt_videos_info_unable_to_delete_some_items_which");
+ msg = hbTrId("txt_videos_info_unable_to_delete_some_videos_which");
break;
case VideoCollectionCommon::statusSingleRemoveFail:
format = hbTrId("txt_videos_info_unable_to_remove_collection_1");
@@ -412,9 +438,12 @@
{
int count = additional.toList().at(KAddToCollectionCountIndex).toInt();
QString name = additional.toList().at(KAddToCollectionNameIndex).toString();
- if(count && name.length())
+ if(count > 0 && name.length())
{
- msg = hbTrId("txt_videos_dpopinfo_ln_videos_added_to_1", count).arg(name);
+ const char* locId = count == 1 ? "txt_videos_dpopinfo_video_added_to_1" :
+ "txt_videos_dpopinfo_videos_added_to_1";
+
+ msg = hbTrId(locId).arg(name);
}
}
error = false;
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionview/src/videolistselectiondialog.cpp
--- a/videocollection/videocollectionview/src/videolistselectiondialog.cpp Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionview/src/videolistselectiondialog.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 30.1.3 %
+// Version : %version: 30.1.4 %
// INCLUDE FILES
#include
@@ -30,7 +30,7 @@
#include "videocollectionuiloader.h"
#include "videolistwidget.h"
-#include "videosortfilterproxymodel.h"
+#include "videoproxymodelgeneric.h"
#include "videolistselectiondialog.h"
#include "videocollectionwrapper.h"
#include "videocollectionviewutils.h"
@@ -101,8 +101,7 @@
// create model for list widget
mModel =
- VideoCollectionWrapper::instance().getModel(
- VideoCollectionCommon::EModelTypeGeneric);
+ VideoCollectionWrapper::instance().getGenericModel();
if (mModel)
{
// create list widget
@@ -189,7 +188,7 @@
FUNC_LOG;
if(!mModel)
{
- mModel = VideoCollectionWrapper::instance().getModel(VideoCollectionCommon::EModelTypeGeneric);
+ mModel = VideoCollectionWrapper::instance().getGenericModel();
if (!mModel)
{
return false;
@@ -793,9 +792,8 @@
QString name;
if(mSelectedAlbumId.iId2 > KVcxMvcMediaTypeVideo)
{
- VideoSortFilterProxyModel *model =
- VideoCollectionWrapper::instance().getModel(
- VideoCollectionCommon::EModelTypeCollections);
+ VideoProxyModelGeneric *model =
+ VideoCollectionWrapper::instance().getCollectionsModel();
if(!model)
{
return name;
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionview/src/videolistview.cpp
--- a/videocollection/videocollectionview/src/videolistview.cpp Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionview/src/videolistview.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -15,10 +15,9 @@
*
*/
-// Version : %version: 113.1.5 %
+// Version : %version: 113.1.8 %
// INCLUDE FILES
-#include
#include
#include
#include
@@ -44,7 +43,7 @@
#include "videolistview.h"
#include "videocollectioncommon.h"
#include "videocollectionwrapper.h"
-#include "videosortfilterproxymodel.h"
+#include "videoproxymodelgeneric.h"
#include "videocollectionuiloader.h"
#include "mpxhbvideocommondefs.h"
#include "videooperatorservice.h"
@@ -123,7 +122,7 @@
int collectionListPhase = VideoCollectionUiLoaderParam::LoadPhaseSecondary;
int collectionContentListPhase = VideoCollectionUiLoaderParam::LoadPhaseSecondary;
VideoCollectionCommon::TCollectionLevels level = VideoCollectionCommon::ELevelVideos;
- if (XQServiceUtil::isService())
+ if (mUiUtils.isService())
{
INFO("VideoListView::initializeView() initializing service.");
if (!mVideoServices)
@@ -608,6 +607,13 @@
else if(level == VideoCollectionCommon::ELevelAlbum)
{
bar->addActions(mToolbarCollectionActionGroup->actions());
+ if(!mModelReady)
+ {
+ // if model not ready yet toolbuttons should not be
+ // visible, after model responds visibility will be updated
+ mToolbarActions[ETBActionAddVideos]->setVisible(false);
+ mToolbarActions[ETBActionRemoveVideos]->setVisible(false);
+ }
}
if(mToolbarServiceExtension && (level == VideoCollectionCommon::ELevelCategory
@@ -738,7 +744,7 @@
return;
}
- VideoSortFilterProxyModel *model = mCurrentList->getModel();
+ VideoProxyModelGeneric *model = mCurrentList->getModel();
if(!model || (!mModelReady && model->rowCount() == 0))
{
@@ -774,6 +780,7 @@
if (mToolbarViewsActionGroup && mToolbarCollectionActionGroup && !mVideoServices)
{
+ mToolbarActions[ETBActionAddVideos]->setVisible(true);
if (show)
{
mToolbarActions[ETBActionRemoveVideos]->setVisible(false);
@@ -819,7 +826,7 @@
void VideoListView::updateSubLabel()
{
FUNC_LOG;
- VideoSortFilterProxyModel *model = 0;
+ VideoProxyModelGeneric *model = 0;
if(mCurrentList)
{
model = mCurrentList->getModel();
@@ -1096,7 +1103,7 @@
}
// sort model
Qt::SortOrder order(Qt::AscendingOrder);
- VideoSortFilterProxyModel *model = mCurrentList->getModel();
+ VideoProxyModelGeneric *model = mCurrentList->getModel();
if(model->sortRole() == role && model->sortOrder() == Qt::AscendingOrder)
{
order = Qt::DescendingOrder;
@@ -1319,7 +1326,7 @@
}
// No other actions shown if there's no videos.
- VideoSortFilterProxyModel *model = mCurrentList->getModel();
+ VideoProxyModelGeneric *model = mCurrentList->getModel();
if (!model || !model->rowCount())
{
return;
@@ -1403,7 +1410,7 @@
showAction(false, DOCML_NAME_SORT_BY_SIZE);
showAction(false, DOCML_NAME_SORT_MENU);
- VideoSortFilterProxyModel *model = mCurrentList->getModel();
+ VideoProxyModelGeneric *model = mCurrentList->getModel();
if (!model || !model->rowCount())
{
return;
@@ -1482,7 +1489,7 @@
return;
}
- VideoSortFilterProxyModel *model = collectionContentWidget->getModel();
+ VideoProxyModelGeneric *model = collectionContentWidget->getModel();
if(!model)
{
// no model for content widget, cannot activate
@@ -1512,18 +1519,21 @@
mModelReady = model->rowCount() > 0;
setHintLevel(VideoHintWidget::Collection);
- // update toolbar for albums, default categories don't have one. Neither does services.
- toolBar()->clearActions();
- if(!mVideoServices && level == VideoCollectionCommon::ELevelAlbum &&
- mToolbarCollectionActionGroup && mToolbarActions.contains(ETBActionCollections))
+ if(mToolbarCollectionActionGroup)
{
- mToolbarActions[ETBActionCollections]->setChecked(false);
- toolBar()->addActions(mToolbarCollectionActionGroup->actions());
- setItemVisible(Hb::ToolBarItem, true);
- }
- else
- {
- setItemVisible(Hb::ToolBarItem, false);
+ // update toolbar for albums, default categories don't have one. Neither does services.
+ toolBar()->clearActions();
+ if(!mVideoServices && level == VideoCollectionCommon::ELevelAlbum &&
+ mToolbarActions.contains(ETBActionCollections))
+ {
+ mToolbarActions[ETBActionCollections]->setChecked(false);
+ toolBar()->addActions(mToolbarCollectionActionGroup->actions());
+ setItemVisible(Hb::ToolBarItem, true);
+ }
+ else
+ {
+ setItemVisible(Hb::ToolBarItem, false);
+ }
}
// restore animations for collection content widget
collectionContentWidget->setEnabledAnimations(animationState);
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionview/src/videolistwidget.cpp
--- a/videocollection/videocollectionview/src/videolistwidget.cpp Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionview/src/videolistwidget.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -18,7 +18,6 @@
#include "videocollectiontrace.h"
#include "videolistwidget.h"
-#include
#include
#include
#include
@@ -37,7 +36,7 @@
#include "videocollectionuiloader.h"
#include "videolistselectiondialog.h"
#include "videothumbnaildata.h"
-#include "videosortfilterproxymodel.h"
+#include "videoproxymodelgeneric.h"
#include "videocollectioncommon.h"
#include "mpxhbvideocommondefs.h"
@@ -45,6 +44,7 @@
const char* const LIST_WIDGET_OBJECT_NAME_CONTEXT_MENU = "vc:ListWidgetContextMenu";
const char* const LIST_WIDGET_OBJECT_NAME_DELETE_VIDEO = "vc:ListWidgetMessageBoxDeleteVideo";
const char* const LIST_WIDGET_OBJECT_NAME_RENAME_VIDEO = "vc:ListWidgetInputDialogRenameVideo";
+const char* const LIST_WIDGET_OBJECT_NAME_RENAME_ALBUM = "vc:ListWidgetInputDialogRenameAlbum";
const char* const LIST_WIDGET_OBJECT_NAME_REMOVE_COLLECTION = "vc:ListWidgetMessageBoxRemoveCollection";
const char* const LIST_WIDGET_OBJECT_NAME_NAV_KEY_BACK = "vc:ListWidgetNavKeyBack";
const char* const LIST_WIDGET_OBJECT_NAME_NAV_KEY_QUIT = "vc:ListWidgetNavKeyQuit";
@@ -108,7 +108,7 @@
// initialize
// ---------------------------------------------------------------------------
//
-int VideoListWidget::initialize(VideoSortFilterProxyModel &model,
+int VideoListWidget::initialize(VideoProxyModelGeneric &model,
bool isService,
VideoCollectionCommon::TCollectionLevels level)
{
@@ -191,18 +191,17 @@
ERROR_1(-1, "VideoListWidget::activate() [0x%x]: connecting signals failed.", this);
return -1;
}
-
+
+ // Enable thumbnail background fetching.
+ VideoThumbnailData::instance().enableBackgroundFetching(true);
+ fetchThumbnailsForVisibleItems();
+
// open model to the current level in case not in album or category
if (level != VideoCollectionCommon::ELevelAlbum &&
level != VideoCollectionCommon::ELevelDefaultColl)
{
mModel->open(level);
}
-
- // Enable thumbnail background fetching.
- VideoThumbnailData &thumbnailData = VideoThumbnailData::instance();
- thumbnailData.enableBackgroundFetching(true);
- fetchThumbnailsForVisibleItems();
return 0;
}
@@ -222,10 +221,8 @@
setVisible(false);
disConnectSignals();
- // Free allocated memory for list thumbnails and disable background fetching.
- VideoThumbnailData &thumbnailData = VideoThumbnailData::instance();
- thumbnailData.enableBackgroundFetching(false);
- thumbnailData.freeThumbnailData();
+ // Disable background thumbnail fetching.
+ VideoThumbnailData::instance().enableBackgroundFetching(false);
}
// ---------------------------------------------------------------------------
@@ -603,7 +600,7 @@
// getModel
// ---------------------------------------------------------------------------
//
-VideoSortFilterProxyModel* VideoListWidget::getModel()
+VideoProxyModelGeneric* VideoListWidget::getModel()
{
FUNC_LOG_ADDR(this);
return mModel;
@@ -685,6 +682,10 @@
}
else
{
+ if(mModel->getMediaIdAtIndex(index).iId2 == KVcxMvcMediaTypeVideo)
+ {
+ VideoThumbnailData::instance().freeThumbnailData();
+ }
mModel->openItem(mModel->getMediaIdAtIndex(index));
}
}
@@ -798,18 +799,34 @@
QModelIndex index = currentIndex();
QVariant variant = mModel->data(index, VideoCollectionCommon::KeyTitle);
-
+
if(variant.isValid())
{
- QString label(hbTrId("txt_videos_title_enter_name"));
- QString albumName = variant.toString();
+ QString label;
+ const char* objectName = 0;
+ QString currentName = variant.toString();
- HbInputDialog *dialog = new HbInputDialog();
- dialog->setAttribute(Qt::WA_DeleteOnClose);
- dialog->setObjectName(LIST_WIDGET_OBJECT_NAME_RENAME_VIDEO);
- dialog->setPromptText(label);
- dialog->setValue(albumName);
- dialog->open(this, SLOT(renameDialogFinished(HbAction *)));
+ TMPXItemId mpxId = mModel->getMediaIdAtIndex(index);
+ if(mpxId.iId2 == KVcxMvcMediaTypeAlbum)
+ {
+ label = hbTrId("txt_videos_title_enter_name");
+ objectName = LIST_WIDGET_OBJECT_NAME_RENAME_ALBUM;
+ }
+ else if(mpxId.iId2 == KVcxMvcMediaTypeVideo)
+ {
+ label = hbTrId("txt_videos_dialog_video_name");
+ objectName = LIST_WIDGET_OBJECT_NAME_RENAME_VIDEO;
+ }
+
+ if(!label.isEmpty())
+ {
+ HbInputDialog *dialog = new HbInputDialog();
+ dialog->setAttribute(Qt::WA_DeleteOnClose);
+ dialog->setObjectName(objectName);
+ dialog->setPromptText(label);
+ dialog->setValue(currentName);
+ dialog->open(this, SLOT(renameDialogFinished(HbAction *)));
+ }
}
}
@@ -828,6 +845,7 @@
}
QModelIndex index = currentIndex();
TMPXItemId itemId = mModel->getMediaIdAtIndex(index);
+
QVariant newNameVariant = dialog->value();
QVariant oldNameVariant = mModel->data(index, VideoCollectionCommon::KeyTitle);
if(!newNameVariant.isValid() || !oldNameVariant.isValid())
@@ -835,9 +853,10 @@
// invalid data at index
return;
}
- QString newAlbumName = newNameVariant.toString().trimmed();
- QString oldAlbumName = oldNameVariant.toString();
- if(!newAlbumName.length() || newAlbumName == oldAlbumName)
+
+ QString newName = newNameVariant.toString().trimmed();
+ QString oldName = oldNameVariant.toString();
+ if(!newName.length() || newName == oldName)
{
// no new name provided or name has not changed
return;
@@ -845,9 +864,9 @@
if(itemId.iId2 == KVcxMvcMediaTypeAlbum)
{
// for album, we need to make sure name is unique
- newAlbumName = mModel->resolveAlbumName(newAlbumName);
+ newName = mModel->resolveAlbumName(newName);
}
- mModel->renameItem(itemId, newAlbumName);
+ mModel->renameItem(itemId, newName);
}
// ---------------------------------------------------------------------------
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionview/tsrc/testcollectionview/inc/testcollectionview.h
--- a/videocollection/videocollectionview/tsrc/testcollectionview/inc/testcollectionview.h Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionview/tsrc/testcollectionview/inc/testcollectionview.h Fri Sep 03 12:37:43 2010 +0300
@@ -11,7 +11,7 @@
*
* Contributors:
*
-* Description: tester for methods in VideoSortFilterProxyModel
+* Description: tester for methods in VideoProxyModelGeneric
*
*/
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionview/tsrc/testcollectionview/src/testcollectionview.cpp
--- a/videocollection/videocollectionview/tsrc/testcollectionview/src/testcollectionview.cpp Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionview/tsrc/testcollectionview/src/testcollectionview.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -11,7 +11,7 @@
*
* Contributors:
*
-* Description: tester for methods in VideoSortFilterProxyModel
+* Description: tester for methods in VideoProxyModelGeneric
*
*/
@@ -110,7 +110,8 @@
HbMainWindow *window = hbInstance->allMainWindows().value(0);
if (window)
{
- window->addView(mTestView->getView());
+ HbView *view = qobject_cast(mTestView->getView());
+ window->addView(view);
}
}
@@ -347,7 +348,6 @@
QApplication::sendEvent(mTestView, &timerEvent);
QVERIFY(commandSpy.count() == 1);
QVERIFY(delayedSpy.count() == 1);
-
}
// ---------------------------------------------------------------------------
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionview/tsrc/testhintwidget/inc/testhintwidget.h
--- a/videocollection/videocollectionview/tsrc/testhintwidget/inc/testhintwidget.h Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionview/tsrc/testhintwidget/inc/testhintwidget.h Fri Sep 03 12:37:43 2010 +0300
@@ -11,7 +11,7 @@
*
* Contributors:
*
-* Description: tester for methods in VideoSortFilterProxyModel
+* Description: tester for methods in VideoProxyModelGeneric
*
*/
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionview/tsrc/testlistview/inc/testlistview.h
--- a/videocollection/videocollectionview/tsrc/testlistview/inc/testlistview.h Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionview/tsrc/testlistview/inc/testlistview.h Fri Sep 03 12:37:43 2010 +0300
@@ -26,7 +26,7 @@
#include "hbeffect.h"
class VideoListView;
-class VideoSortFilterProxyModel;
+class VideoProxyModelGeneric;
class VideoCollectionWrapper;
class VideoCollectionUiLoader;
class VideoListWidget;
@@ -48,7 +48,7 @@
/**
* Set row count in model.
*/
- void setRowCount(int count, VideoSortFilterProxyModel *model = 0);
+ void setRowCount(int count, VideoProxyModelGeneric *model = 0);
/**
* Check if action is visible.
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionview/tsrc/testlistview/src/testlistview.cpp
--- a/videocollection/videocollectionview/tsrc/testlistview/src/testlistview.cpp Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionview/tsrc/testlistview/src/testlistview.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -15,11 +15,11 @@
*
*/
-// Version : %version: 54 %
+// Version : %version: 55 %
#define private public
#include "videoservices.h"
-#include "videosortfilterproxymodel.h"
+#include "videoproxymodelgeneric.h"
#include "videolistwidget.h"
#include "videolistview.h"
#undef private
@@ -59,7 +59,7 @@
#include "videocollectionwrapperdata.h"
#include "videocollectionviewutilsdata.h"
#include "videolistselectiondialogdata.h"
-#include "videosortfilterproxymodeldata.h"
+#include "videoproxymodeldata.h"
#include "videocollectionuiloaderdata.h"
#include "videolistdatamodeldata.h"
#include "xqserviceutilxtra.h"
@@ -147,7 +147,7 @@
VideoCollectionWrapperData::reset();
VideoCollectionViewUtilsData::reset();
VideoListSelectionDialogData::reset();
- VideoSortFilterProxyModelData::reset();
+ VideoProxyModelData::reset();
HbDocumentLoader::cleanup();
}
@@ -175,7 +175,7 @@
// setRowCount
// ---------------------------------------------------------------------------
//
-void TestListView::setRowCount(int count, VideoSortFilterProxyModel *model)
+void TestListView::setRowCount(int count, VideoProxyModelGeneric *model)
{
if(!model)
{
@@ -464,7 +464,7 @@
videoListWidget = mUiLoader->findWidget(DOCML_NAME_VC_VIDEOLISTWIDGET);
QVERIFY(videoListWidget);
VideoListWidgetData::mActivateReturnValue = -1;
- QCOMPARE( mTestView->activateView(invalidId), -1 );
+ QCOMPARE( mTestView->activateView(invalidId), -1 );
QVERIFY( VideoListWidgetData::mActive == false );
QCOMPARE( VideoListWidgetData::mActivateCount, 1 );
QCOMPARE( VideoListWidgetData::mDeactivateCount, 1 );
@@ -492,7 +492,7 @@
TMPXItemId itemId = TMPXItemId::InvalidId();
init();
VideoListWidgetData::reset();
- VideoSortFilterProxyModelData::reset();
+ VideoProxyModelData::reset();
itemId.iId1 = KVcxMvcCategoryIdCaptured;
itemId.iId2 = KVcxMvcMediaTypeCategory;
QCOMPARE(mTestView->activateView(itemId), 0);
@@ -500,14 +500,14 @@
QCOMPARE(VideoListWidgetData::mActivateCount, 1);
QCOMPARE(mTestView->mCollectionName, hbTrId("txt_videos_dblist_captured"));
QCOMPARE(mTestView->mCurrentList->getLevel(), VideoCollectionCommon::ELevelDefaultColl);
- QCOMPARE(VideoSortFilterProxyModelData::mLastItemId, itemId);
+ QCOMPARE(VideoProxyModelData::mLastItemId, itemId);
cleanup();
// activate collection content view::
// -downloaded category
init();
VideoListWidgetData::reset();
- VideoSortFilterProxyModelData::reset();
+ VideoProxyModelData::reset();
itemId.iId1 = KVcxMvcCategoryIdDownloads;
itemId.iId2 = KVcxMvcMediaTypeCategory;
QCOMPARE(mTestView->activateView(itemId), 0);
@@ -515,7 +515,7 @@
QCOMPARE(VideoListWidgetData::mActivateCount, 1);
QCOMPARE(mTestView->mCollectionName, hbTrId("txt_videos_dblist_downloaded"));
QCOMPARE(mTestView->mCurrentList->getLevel(), VideoCollectionCommon::ELevelDefaultColl);
- QCOMPARE(VideoSortFilterProxyModelData::mLastItemId, itemId);
+ QCOMPARE(VideoProxyModelData::mLastItemId, itemId);
cleanup();
// activate collection content view:
@@ -523,7 +523,7 @@
init();
videoListWidget = mUiLoader->findWidget(DOCML_NAME_VC_VIDEOLISTWIDGET);
VideoListWidgetData::reset();
- VideoSortFilterProxyModelData::reset();
+ VideoProxyModelData::reset();
itemId.iId1 = KVcxMvcCategoryIdOther;
itemId.iId2 = KVcxMvcMediaTypeCategory;
QCOMPARE(mTestView->activateView(itemId), -1);
@@ -532,14 +532,14 @@
QCOMPARE(mTestView->mCollectionName.length(), 0);
// for not activated widget, defaultlevel is ELevelVideos
QCOMPARE(mTestView->mCurrentList->getLevel(), VideoCollectionCommon::ELevelVideos);
- QCOMPARE(VideoSortFilterProxyModelData::mLastItemId, TMPXItemId::InvalidId());
+ QCOMPARE(VideoProxyModelData::mLastItemId, TMPXItemId::InvalidId());
cleanup();
// activate collection content view:
// -invalid category but item id is ok
init();
VideoListWidgetData::reset();
- VideoSortFilterProxyModelData::reset();
+ VideoProxyModelData::reset();
itemId.iId1 = 0;
itemId.iId2 = KVcxMvcMediaTypeVideo;
QCOMPARE(mTestView->activateView(itemId), -1);
@@ -548,7 +548,7 @@
QCOMPARE(mTestView->mCollectionName.length(), 0);
// for not activated widget, defaultlevel is ELevelVideos
QCOMPARE(mTestView->mCurrentList->getLevel(), VideoCollectionCommon::ELevelVideos);
- QCOMPARE(VideoSortFilterProxyModelData::mLastItemId, TMPXItemId::InvalidId());
+ QCOMPARE(VideoProxyModelData::mLastItemId, TMPXItemId::InvalidId());
cleanup();
// activate view:
@@ -562,7 +562,7 @@
videoServices->mCurrentService = VideoServices::EBrowse;
videoServices->mSortRole = 0;
VideoListWidgetData::reset();
- VideoSortFilterProxyModelData::reset();
+ VideoProxyModelData::reset();
itemId.iId1 = KVcxMvcCategoryIdCaptured;
itemId.iId2 = KVcxMvcMediaTypeCategory;
QCOMPARE(mTestView->initializeView(), 0);
@@ -571,9 +571,9 @@
QCOMPARE(VideoListWidgetData::mActivateCount, 1);
QCOMPARE(mTestView->mCollectionName, hbTrId("txt_videos_dblist_captured"));
QCOMPARE(mTestView->mCurrentList->getLevel(), VideoCollectionCommon::ELevelDefaultColl);
- QCOMPARE(VideoSortFilterProxyModelData::mLastItemId, itemId);
- QCOMPARE(VideoSortFilterProxyModelData::mSortRole, (int)VideoCollectionCommon::KeyDateTime);
- QCOMPARE(VideoSortFilterProxyModelData::mSortOrder, Qt::AscendingOrder);
+ QCOMPARE(VideoProxyModelData::mLastItemId, itemId);
+ QCOMPARE(VideoProxyModelData::mSortRole, (int)VideoCollectionCommon::KeyDateTime);
+ QCOMPARE(VideoProxyModelData::mSortOrder, Qt::AscendingOrder);
serviceUtilXtra->decreaseReferenceCount();
videoServices->decreaseReferenceCount();
cleanup();
@@ -589,7 +589,7 @@
videoServices->mCurrentService = VideoServices::EBrowse;
videoServices->mSortRole = 1;
VideoListWidgetData::reset();
- VideoSortFilterProxyModelData::reset();
+ VideoProxyModelData::reset();
itemId.iId1 = KVcxMvcCategoryIdCaptured;
itemId.iId2 = KVcxMvcMediaTypeCategory;
QCOMPARE(mTestView->initializeView(), 0);
@@ -598,9 +598,9 @@
QCOMPARE(VideoListWidgetData::mActivateCount, 1);
QCOMPARE(mTestView->mCollectionName, hbTrId("txt_videos_dblist_captured"));
QCOMPARE(mTestView->mCurrentList->getLevel(), VideoCollectionCommon::ELevelDefaultColl);
- QCOMPARE(VideoSortFilterProxyModelData::mLastItemId, itemId);
- QCOMPARE(VideoSortFilterProxyModelData::mSortRole, (int)VideoCollectionCommon::KeyDateTime);
- QCOMPARE(VideoSortFilterProxyModelData::mSortOrder, Qt::AscendingOrder);
+ QCOMPARE(VideoProxyModelData::mLastItemId, itemId);
+ QCOMPARE(VideoProxyModelData::mSortRole, (int)VideoCollectionCommon::KeyDateTime);
+ QCOMPARE(VideoProxyModelData::mSortOrder, Qt::AscendingOrder);
cleanup();
serviceUtilXtra->decreaseReferenceCount();
videoServices->decreaseReferenceCount();
@@ -616,7 +616,7 @@
videoServices->mCurrentService = VideoServices::EBrowse;
videoServices->mSortRole = 2;
VideoListWidgetData::reset();
- VideoSortFilterProxyModelData::reset();
+ VideoProxyModelData::reset();
itemId.iId1 = KVcxMvcCategoryIdCaptured;
itemId.iId2 = KVcxMvcMediaTypeCategory;
QCOMPARE(mTestView->initializeView(), 0);
@@ -625,9 +625,9 @@
QCOMPARE(VideoListWidgetData::mActivateCount, 1);
QCOMPARE(mTestView->mCollectionName, hbTrId("txt_videos_dblist_captured"));
QCOMPARE(mTestView->mCurrentList->getLevel(), VideoCollectionCommon::ELevelDefaultColl);
- QCOMPARE(VideoSortFilterProxyModelData::mLastItemId, itemId);
- QCOMPARE(VideoSortFilterProxyModelData::mSortRole, (int)VideoCollectionCommon::KeyTitle);
- QCOMPARE(VideoSortFilterProxyModelData::mSortOrder, Qt::AscendingOrder);
+ QCOMPARE(VideoProxyModelData::mLastItemId, itemId);
+ QCOMPARE(VideoProxyModelData::mSortRole, (int)VideoCollectionCommon::KeyTitle);
+ QCOMPARE(VideoProxyModelData::mSortOrder, Qt::AscendingOrder);
cleanup();
serviceUtilXtra->decreaseReferenceCount();
videoServices->decreaseReferenceCount();
@@ -643,7 +643,7 @@
videoServices->mCurrentService = VideoServices::EBrowse;
videoServices->mSortRole = 3;
VideoListWidgetData::reset();
- VideoSortFilterProxyModelData::reset();
+ VideoProxyModelData::reset();
itemId.iId1 = KVcxMvcCategoryIdCaptured;
itemId.iId2 = KVcxMvcMediaTypeCategory;
QCOMPARE(mTestView->initializeView(), 0);
@@ -652,9 +652,9 @@
QCOMPARE(VideoListWidgetData::mActivateCount, 1);
QCOMPARE(mTestView->mCollectionName, hbTrId("txt_videos_dblist_captured"));
QCOMPARE(mTestView->mCurrentList->getLevel(), VideoCollectionCommon::ELevelDefaultColl);
- QCOMPARE(VideoSortFilterProxyModelData::mLastItemId, itemId);
- QCOMPARE(VideoSortFilterProxyModelData::mSortRole, (int)VideoCollectionCommon::KeySizeValue);
- QCOMPARE(VideoSortFilterProxyModelData::mSortOrder, Qt::AscendingOrder);
+ QCOMPARE(VideoProxyModelData::mLastItemId, itemId);
+ QCOMPARE(VideoProxyModelData::mSortRole, (int)VideoCollectionCommon::KeySizeValue);
+ QCOMPARE(VideoProxyModelData::mSortOrder, Qt::AscendingOrder);
cleanup();
serviceUtilXtra->decreaseReferenceCount();
videoServices->decreaseReferenceCount();
@@ -832,16 +832,16 @@
init(false);
connect(this, SIGNAL(testSignal(int)), mTestView, SLOT(startSorting()));
emit testSignal(0);
- QCOMPARE(VideoSortFilterProxyModelData::mDoSortingCallCount, 0);
- QCOMPARE(VideoSortFilterProxyModelData::mSortRole, -1);
+ QCOMPARE(VideoProxyModelData::mDoSortingCallCount, 0);
+ QCOMPARE(VideoProxyModelData::mSortRole, -1);
cleanup();
// View is not activated.
init();
connect(this, SIGNAL(testSignal(int)), mTestView, SLOT(startSorting()));
emit testSignal(0);
- QCOMPARE(VideoSortFilterProxyModelData::mDoSortingCallCount, 0);
- QCOMPARE(VideoSortFilterProxyModelData::mSortRole, -1);
+ QCOMPARE(VideoProxyModelData::mDoSortingCallCount, 0);
+ QCOMPARE(VideoProxyModelData::mSortRole, -1);
cleanup();
TMPXItemId invalidId = TMPXItemId::InvalidId();
@@ -856,8 +856,8 @@
HbMenuData::mMenuAction = sortMenuAction;
connect(this, SIGNAL(testSignal(int)), mTestView, SLOT(startSorting()));
emit testSignal(0);
- QCOMPARE(VideoSortFilterProxyModelData::mDoSortingCallCount, 0);
- QCOMPARE(VideoSortFilterProxyModelData::mSortRole, -1);
+ QCOMPARE(VideoProxyModelData::mDoSortingCallCount, 0);
+ QCOMPARE(VideoProxyModelData::mSortRole, -1);
cleanup();
// Good cases.
@@ -866,7 +866,7 @@
sortMenu = mUiLoader->findWidget(DOCML_NAME_SORT_MENU);
sortMenuAction->setMenu(sortMenu);
HbMenuData::mMenuAction = sortMenuAction;
- VideoSortFilterProxyModel* model = mTestView->mCurrentList->getModel();
+ VideoProxyModelGeneric* model = mTestView->mCurrentList->getModel();
QVERIFY(action != 0);
mUiLoader->findWidget(DOCML_NAME_OPTIONS_MENU)->setActiveAction(sortMenuAction);
HbAction* sortAction = mUiLoader->findObject(DOCML_NAME_SORT_BY_NAME);
@@ -883,42 +883,42 @@
connect(this, SIGNAL(testSignal(int)), mTestView, SLOT(startSorting()));
emit testSignal(0);
// since current list is videolist, sorting count is 2 because both all videos and collection content are sorted
- QCOMPARE(VideoSortFilterProxyModelData::mDoSortingCallCount, 2);
- QCOMPARE(VideoSortFilterProxyModelData::mSortRole, (int)VideoCollectionCommon::KeyTitle);
- QCOMPARE(VideoSortFilterProxyModelData::mSortOrder, Qt::AscendingOrder);
- QVERIFY(VideoSortFilterProxyModelData::mSortAsync);
+ QCOMPARE(VideoProxyModelData::mDoSortingCallCount, 2);
+ QCOMPARE(VideoProxyModelData::mSortRole, (int)VideoCollectionCommon::KeyTitle);
+ QCOMPARE(VideoProxyModelData::mSortOrder, Qt::AscendingOrder);
+ QVERIFY(VideoProxyModelData::mSortAsync);
- VideoSortFilterProxyModelData::mDoSortingCallCount = 0;
+ VideoProxyModelData::mDoSortingCallCount = 0;
// emit test signal again, with same parameters. Sorting should be switched to
// descending order.
emit testSignal(0);
// since current list is videolist, sorting count is 2 because both all videos and collection content are sorted
- QCOMPARE(VideoSortFilterProxyModelData::mDoSortingCallCount, 2);
- QCOMPARE(VideoSortFilterProxyModelData::mSortRole, (int)VideoCollectionCommon::KeyTitle);
- QCOMPARE(VideoSortFilterProxyModelData::mSortOrder, Qt::DescendingOrder);
- QVERIFY(VideoSortFilterProxyModelData::mSortAsync);
+ QCOMPARE(VideoProxyModelData::mDoSortingCallCount, 2);
+ QCOMPARE(VideoProxyModelData::mSortRole, (int)VideoCollectionCommon::KeyTitle);
+ QCOMPARE(VideoProxyModelData::mSortOrder, Qt::DescendingOrder);
+ QVERIFY(VideoProxyModelData::mSortAsync);
- VideoSortFilterProxyModelData::mDoSortingCallCount = 0;
+ VideoProxyModelData::mDoSortingCallCount = 0;
// on third emit, sorting should be switched back to ascending
emit testSignal(0);
// since current list is videolist, sorting count is 2 because both all videos and collection content are sorted
- QCOMPARE(VideoSortFilterProxyModelData::mDoSortingCallCount, 2);
- QCOMPARE(VideoSortFilterProxyModelData::mSortRole, (int)VideoCollectionCommon::KeyTitle);
- QCOMPARE(VideoSortFilterProxyModelData::mSortOrder, Qt::AscendingOrder);
- QVERIFY(VideoSortFilterProxyModelData::mSortAsync);
+ QCOMPARE(VideoProxyModelData::mDoSortingCallCount, 2);
+ QCOMPARE(VideoProxyModelData::mSortRole, (int)VideoCollectionCommon::KeyTitle);
+ QCOMPARE(VideoProxyModelData::mSortOrder, Qt::AscendingOrder);
+ QVERIFY(VideoProxyModelData::mSortAsync);
// test that after changing the sort role, the order is also switched to ascending.
model->doSorting(model->sortRole(), Qt::DescendingOrder);
sortAction = mUiLoader->findObject(DOCML_NAME_SORT_BY_DATE);
QVERIFY(sortAction != 0);
sortMenu->setActiveAction(sortAction);
- VideoSortFilterProxyModelData::mDoSortingCallCount = 0;
+ VideoProxyModelData::mDoSortingCallCount = 0;
emit testSignal(0);
// since current list is videolist, sorting count is 2 because both all videos and collection content are sorted
- QCOMPARE(VideoSortFilterProxyModelData::mDoSortingCallCount, 2);
- QCOMPARE(VideoSortFilterProxyModelData::mSortRole, (int)VideoCollectionCommon::KeyDateTime);
- QCOMPARE(VideoSortFilterProxyModelData::mSortOrder, Qt::AscendingOrder);
- QVERIFY(VideoSortFilterProxyModelData::mSortAsync);
+ QCOMPARE(VideoProxyModelData::mDoSortingCallCount, 2);
+ QCOMPARE(VideoProxyModelData::mSortRole, (int)VideoCollectionCommon::KeyDateTime);
+ QCOMPARE(VideoProxyModelData::mSortOrder, Qt::AscendingOrder);
+ QVERIFY(VideoProxyModelData::mSortAsync);
cleanup();
// start sorting slot:
@@ -1049,20 +1049,20 @@
// selection dialog exists
////////////
VideoCollectionUiLoaderData::mFailDialogLoad = false;
- VideoSortFilterProxyModelData::mOpenedItemId = TMPXItemId(2, 3);
+ VideoProxyModelData::mOpenedItemId = TMPXItemId(2, 3);
emit testSignal();
QCOMPARE(VideoListSelectionDialogData::mMultiSelectionLaunchCount, 1);
QCOMPARE(VideoListSelectionDialogData::mSelectionType, (int)VideoListSelectionDialog::EDeleteVideos);
- QVERIFY(VideoListSelectionDialogData::mSettedMpxId == VideoSortFilterProxyModelData::mOpenedItemId);
+ QVERIFY(VideoListSelectionDialogData::mSettedMpxId == VideoProxyModelData::mOpenedItemId);
////////////
// test second successful activation.
////////////
- VideoSortFilterProxyModelData::mOpenedItemId = TMPXItemId(3, 2);
+ VideoProxyModelData::mOpenedItemId = TMPXItemId(3, 2);
emit testSignal();
QCOMPARE(VideoListSelectionDialogData::mMultiSelectionLaunchCount, 2);
QCOMPARE(VideoListSelectionDialogData::mSelectionType, (int)VideoListSelectionDialog::EDeleteVideos);
- QVERIFY(VideoListSelectionDialogData::mSettedMpxId == VideoSortFilterProxyModelData::mOpenedItemId);
+ QVERIFY(VideoListSelectionDialogData::mSettedMpxId == VideoProxyModelData::mOpenedItemId);
cleanup();
}
@@ -1315,8 +1315,8 @@
mTestView->mCurrentList = tmpList;
// collection list widget has no model
- VideoSortFilterProxyModel *nullModel = 0;
- VideoSortFilterProxyModel *tempModel = collectionContent->getModel();
+ VideoProxyModelGeneric *nullModel = 0;
+ VideoProxyModelGeneric *tempModel = collectionContent->getModel();
collectionContent->initialize(*nullModel, false, VideoCollectionCommon::ELevelDefaultColl);
listWidget = mTestView->mCurrentList;
listWidgetActivateCount = VideoListWidgetData::mActivateCount;
@@ -1683,7 +1683,7 @@
QVERIFY(connect(this, SIGNAL(testSignal()), mTestView, SLOT(addVideosToCollectionSlot())));
TMPXItemId invalidId = TMPXItemId::InvalidId();
- VideoSortFilterProxyModelData::mOpenedItemId = TMPXItemId(0, 2);
+ VideoProxyModelData::mOpenedItemId = TMPXItemId(0, 2);
// Not initalized, no mCurrentList
emit testSignal();
@@ -1708,7 +1708,7 @@
mTestView->mCurrentList->mCurrentLevel = VideoCollectionCommon::ELevelCategory;
emit testSignal();
QVERIFY(VideoListSelectionDialogData::mSelectionType == VideoListSelectionDialog::EAddToCollection);
- QVERIFY(VideoListSelectionDialogData::mSettedMpxId == VideoSortFilterProxyModelData::mOpenedItemId);
+ QVERIFY(VideoListSelectionDialogData::mSettedMpxId == VideoProxyModelData::mOpenedItemId);
QCOMPARE(VideoCollectionViewUtilsData::mLastError, 0);
// Current level is album, video list widget load fails.
@@ -1719,7 +1719,7 @@
mTestView->mCurrentList->mCurrentLevel = VideoCollectionCommon::ELevelAlbum;
emit testSignal();
QVERIFY(VideoListSelectionDialogData::mSelectionType == VideoListSelectionDialog::EAddToCollection);
- QVERIFY(VideoListSelectionDialogData::mSettedMpxId == VideoSortFilterProxyModelData::mOpenedItemId);
+ QVERIFY(VideoListSelectionDialogData::mSettedMpxId == VideoProxyModelData::mOpenedItemId);
QCOMPARE(VideoCollectionViewUtilsData::mLastError, 0);
// Current level is album, but model is empty.
@@ -1766,7 +1766,7 @@
setRowCount(1);
emit testSignal();
QVERIFY(VideoListSelectionDialogData::mSelectionType == VideoListSelectionDialog::EAddToCollection);
- QVERIFY(VideoListSelectionDialogData::mSettedMpxId == VideoSortFilterProxyModelData::mOpenedItemId);
+ QVERIFY(VideoListSelectionDialogData::mSettedMpxId == VideoProxyModelData::mOpenedItemId);
QCOMPARE(VideoCollectionViewUtilsData::mLastError, 0);
disconnect(this, SIGNAL(testSignal()), mTestView, SLOT(addVideosToCollectionSlot()));
@@ -1812,15 +1812,15 @@
// Open item is invalid
VideoCollectionUiLoaderData::mFindFailure = false;
- VideoSortFilterProxyModelData::mOpenedItemId = TMPXItemId::InvalidId();
+ VideoProxyModelData::mOpenedItemId = TMPXItemId::InvalidId();
emit testSignal();
// Open item is video!
- VideoSortFilterProxyModelData::mOpenedItemId = TMPXItemId(0, KVcxMvcMediaTypeVideo);
+ VideoProxyModelData::mOpenedItemId = TMPXItemId(0, KVcxMvcMediaTypeVideo);
emit testSignal();
// Good case.
- VideoSortFilterProxyModelData::mOpenedItemId = TMPXItemId(0, KVcxMvcMediaTypeAlbum);
+ VideoProxyModelData::mOpenedItemId = TMPXItemId(0, KVcxMvcMediaTypeAlbum);
emit testSignal();
disconnect(this, SIGNAL(testSignal()), mTestView, SLOT(removeVideosFromCollectionSlot()));
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionview/tsrc/testlistwidget/inc/testlistwidget.h
--- a/videocollection/videocollectionview/tsrc/testlistwidget/inc/testlistwidget.h Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionview/tsrc/testlistwidget/inc/testlistwidget.h Fri Sep 03 12:37:43 2010 +0300
@@ -11,11 +11,11 @@
*
* Contributors:
*
-* Description: tester for methods in VideoSortFilterProxyModel
+* Description: tester for methods in VideoProxyModelGeneric
*
*/
-// Version : %version: 27 %
+// Version : %version: 28 %
#ifndef __TESTLISTWIDGET_H__
#define __TESTLISTWIDGET_H__
@@ -28,7 +28,7 @@
class DummyDataModel;
class HbAbstractViewItem;
class HbView;
-class VideoSortFilterProxyModel;
+class VideoProxyModelGeneric;
class VideoCollectionWrapper;
class HbMainWindow;
class ListWidgetTester;
@@ -45,7 +45,7 @@
public:
void setRowCount(int count,
- TModelType type = EModelTypeAllVideos,
+ VideoProxyModelGeneric *proxyModel = 0,
VideoListDataModel *model = 0);
// test functions for the test framework
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionview/tsrc/testlistwidget/src/testlistwidget.cpp
--- a/videocollection/videocollectionview/tsrc/testlistwidget/src/testlistwidget.cpp Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionview/tsrc/testlistwidget/src/testlistwidget.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 60 %
+// Version : %version: 62 %
#include
#include
@@ -24,7 +24,7 @@
#include "hbglobal.h"
#include "hblistview.h"
#include "hbview.h"
-#include "videosortfilterproxymodel.h"
+#include "videoproxymodelgeneric.h"
#include "hbscrollbar.h"
#include "hbmenu.h"
#include "hbmessagebox.h"
@@ -40,7 +40,7 @@
#include "videothumbnailtestdata.h"
#include "videolistdatamodel.h"
#include "videolistdatamodeldata.h"
-#include "videosortfilterproxymodeldata.h"
+#include "videoproxymodeldata.h"
#include "videocollectionuiloader.h"
#include "videocollectionuiloaderdata.h"
#include "videolistselectiondialog.h"
@@ -129,16 +129,15 @@
// ---------------------------------------------------------------------------
//
void TestListWidget::setRowCount(int count,
- VideoCollectionCommon::TModelType type,
+ VideoProxyModelGeneric *proxyModel,
VideoListDataModel *model)
{
if (!model)
{
- VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
- VideoSortFilterProxyModel *model = wrapper.getModel(type);
- QVERIFY(model);
+ proxyModel = VideoCollectionWrapper::instance().getAllVideosModel();
+ QVERIFY(proxyModel);
- VideoListDataModel *sourceModel = qobject_cast(model->sourceModel());
+ VideoListDataModel *sourceModel = qobject_cast(proxyModel->sourceModel());
QVERIFY(sourceModel);
VideoListDataModelData::setRowCount(*sourceModel, count);
@@ -195,7 +194,7 @@
HbMenuData::reset();
VideoThumbnailTestData::reset();
VideoListDataModelData::reset();
- VideoSortFilterProxyModelData::reset();
+ VideoProxyModelData::reset();
HbMessageBoxData::reset();
}
@@ -206,7 +205,7 @@
void TestListWidget::testInitialize()
{
VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
- VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionCommon::EModelTypeAllVideos);
+ VideoProxyModelGeneric *model = wrapper.getAllVideosModel();
// succeed case ( new operator cannot be stubbed)
QVERIFY(mTestWidget->initialize(*model) == 0);
@@ -230,7 +229,7 @@
void TestListWidget::testActivate()
{
VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
- VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionCommon::EModelTypeAllVideos);
+ VideoProxyModelGeneric *model = wrapper.getAllVideosModel();
// no model: fails
QVERIFY(mTestWidget->activate() == -1);
@@ -254,7 +253,7 @@
delete mTestWidget;
mTestWidget = 0;
mTestWidget = new ListWidgetTester(mTestUiLoader, mTempView);
- model = wrapper.getModel(VideoCollectionCommon::EModelTypeAllVideos);
+ model = wrapper.getAllVideosModel();
QVERIFY(mTestWidget->initialize(*model, 0, VideoCollectionCommon::ELevelVideos) == 0);
hbInstance->allMainWindows().value(0)->addView(tmpView);
@@ -274,7 +273,7 @@
delete mTestWidget;
mTestWidget = 0;
mTestWidget = new ListWidgetTester(mTestUiLoader, mTempView);
- model = wrapper.getModel(VideoCollectionCommon::EModelTypeCollectionContent);
+ model = wrapper.getCollectionContentModel();
tmpView->mNavigationAction = 0;
QVERIFY(mTestWidget->initialize(*model) == 0);
QVERIFY(mTestWidget->activate(VideoCollectionCommon::ELevelAlbum) == 0);
@@ -343,7 +342,7 @@
void TestListWidget::testDeactivate()
{
VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
- VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionCommon::EModelTypeAllVideos);
+ VideoProxyModelGeneric *model = wrapper.getAllVideosModel();
HbListView::mLatestVisibility = true;
VideoThumbnailTestData::mBackgroundThumbnailFetchingEnabled = 1;
@@ -392,7 +391,7 @@
void TestListWidget::testGetLevel()
{
VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
- VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionCommon::EModelTypeAllVideos);
+ VideoProxyModelGeneric *model = wrapper.getAllVideosModel();
mTestWidget->initialize(*model);
@@ -407,7 +406,7 @@
void TestListWidget::testGetModel()
{
VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
- VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionCommon::EModelTypeAllVideos);
+ VideoProxyModelGeneric *model = wrapper.getAllVideosModel();
QVERIFY(mTestWidget->getModel() == 0);
@@ -426,7 +425,7 @@
{
VideoServices *videoServices = VideoServices::instance();
VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
- VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionCommon::EModelTypeAllVideos);
+ VideoProxyModelGeneric *model = wrapper.getAllVideosModel();
QSignalSpy spysignal(mTestWidget, SIGNAL(collectionOpened(bool, const QString&, const TMPXItemId&)));
QSignalSpy spysignalFileUri(mTestWidget, SIGNAL(fileUri(const QString&)));
@@ -435,14 +434,14 @@
mTestWidget->initialize(*model);
mTestWidget->activate();
- VideoSortFilterProxyModelData::mLastItemId = TMPXItemId::InvalidId();
+ VideoProxyModelData::mLastItemId = TMPXItemId::InvalidId();
TMPXItemId savedId = TMPXItemId(1,1);
- VideoSortFilterProxyModelData::mItemIds.clear();
- VideoSortFilterProxyModelData::mItemIds.append(savedId);
+ VideoProxyModelData::mItemIds.clear();
+ VideoProxyModelData::mItemIds.append(savedId);
QVariant data = QString("test");
VideoListDataModelData::setData(VideoCollectionCommon::KeyTitle, data);
setRowCount(2);
- VideoSortFilterProxyModelData::mItemIds.append(TMPXItemId(0,0));
+ VideoProxyModelData::mItemIds.append(TMPXItemId(0,0));
QModelIndex fetchIndex = model->index(0, 0, QModelIndex());
@@ -452,7 +451,7 @@
QVERIFY(spysignal.count() == 0);
QVERIFY(spysignalFileUri.count() == 0);
QVERIFY(spysignalActivated.count() == 1);
- QVERIFY(VideoSortFilterProxyModelData::mLastItemId == TMPXItemId::InvalidId());
+ QVERIFY(VideoProxyModelData::mLastItemId == TMPXItemId::InvalidId());
spysignal.clear();
spysignalFileUri.clear();
spysignalActivated.clear();
@@ -464,7 +463,7 @@
QVERIFY(spysignal.count() == 0);
QVERIFY(spysignalFileUri.count() == 0);
QVERIFY(spysignalActivated.count() == 0);
- QVERIFY(VideoSortFilterProxyModelData::mLastItemId == TMPXItemId::InvalidId());
+ QVERIFY(VideoProxyModelData::mLastItemId == TMPXItemId::InvalidId());
// current level is ELevelCategory
mTestWidget->mCurrentLevel = VideoCollectionCommon::ELevelCategory;
@@ -475,7 +474,7 @@
QVERIFY(spysignal.count() == 0);
QVERIFY(spysignalFileUri.count() == 0);
QVERIFY(spysignalActivated.count() == 0);
- QVERIFY(VideoSortFilterProxyModelData::mLastItemId == TMPXItemId::InvalidId());
+ QVERIFY(VideoProxyModelData::mLastItemId == TMPXItemId::InvalidId());
// --> variant is valid, collectionOpened -signal should be emitted
@@ -485,7 +484,7 @@
QVERIFY(spysignal.count() == 1);
QVERIFY(spysignalFileUri.count() == 0);
QVERIFY(spysignalActivated.count() == 0);
- QVERIFY(VideoSortFilterProxyModelData::mLastItemId == TMPXItemId::InvalidId());
+ QVERIFY(VideoProxyModelData::mLastItemId == TMPXItemId::InvalidId());
spysignal.clear();
spysignalFileUri.clear();
@@ -502,7 +501,7 @@
QVERIFY(spysignal.count() == 0);
QVERIFY(spysignalFileUri.count() == 0);
QVERIFY(spysignalActivated.count() == 0);
- QVERIFY(VideoSortFilterProxyModelData::mLastItemId == TMPXItemId::InvalidId());
+ QVERIFY(VideoProxyModelData::mLastItemId == TMPXItemId::InvalidId());
// current level is not ELevelCategory
// mVideoServices, variant gotten is valid
@@ -513,7 +512,7 @@
QVERIFY(spysignal.count() == 0);
QVERIFY(spysignalFileUri.count() == 1);
QVERIFY(spysignalActivated.count() == 0);
- QVERIFY(VideoSortFilterProxyModelData::mLastItemId == TMPXItemId::InvalidId());
+ QVERIFY(VideoProxyModelData::mLastItemId == TMPXItemId::InvalidId());
spysignal.clear();
spysignalFileUri.clear();
@@ -527,7 +526,7 @@
QVERIFY(spysignal.count() == 0);
QVERIFY(spysignalFileUri.count() == 0);
QVERIFY(spysignalActivated.count() == 0);
- QVERIFY(VideoSortFilterProxyModelData::mLastItemId == savedId);
+ QVERIFY(VideoProxyModelData::mLastItemId == savedId);
// context menu is visible
if (!mTestWidget->mContextMenu)
@@ -535,13 +534,13 @@
mTestWidget->mContextMenu = new HbMenu;
}
mTestWidget->mContextMenu->show();
- VideoSortFilterProxyModelData::mLastItemId = TMPXItemId::InvalidId();
+ VideoProxyModelData::mLastItemId = TMPXItemId::InvalidId();
fetchIndex = model->index(0, 0, QModelIndex());
mTestWidget->callEmiteActivated(fetchIndex);
QVERIFY(spysignal.count() == 0);
QVERIFY(spysignalFileUri.count() == 0);
QVERIFY(spysignalActivated.count() == 0);
- QVERIFY(VideoSortFilterProxyModelData::mLastItemId == TMPXItemId::InvalidId());
+ QVERIFY(VideoProxyModelData::mLastItemId == TMPXItemId::InvalidId());
// final cleanup
videoServices->decreaseReferenceCount();
@@ -554,7 +553,7 @@
void TestListWidget::testLongPressedSlot()
{
VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
- VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionCommon::EModelTypeAllVideos);
+ VideoProxyModelGeneric *model = wrapper.getAllVideosModel();
QVariant data = QString("test");
// correct data to index 0
@@ -597,7 +596,7 @@
mTestWidget->mItem->mModelIndex = HbListView::mCurrentIndex ;
// model is null
- VideoSortFilterProxyModel *tmp = mTestWidget->mModel;
+ VideoProxyModelGeneric *tmp = mTestWidget->mModel;
mTestWidget->mModel = 0;
mTestWidget->callLongPressedSlot(item, point);
QVERIFY(HbMenuData::mExecPoint != point);
@@ -606,30 +605,30 @@
VideoServices *videoServices = VideoServices::instance();
// gotten id != KVcxMvcMediaTypeVideo, service exists true and id != KVcxMvcMediaTypeAlbum
- VideoSortFilterProxyModelData::mItemIds.clear();
- VideoSortFilterProxyModelData::mItemIds.append(TMPXItemId(1,1));
+ VideoProxyModelData::mItemIds.clear();
+ VideoProxyModelData::mItemIds.append(TMPXItemId(1,1));
mTestWidget->mVideoServices = videoServices;
mTestWidget->callLongPressedSlot(item, point);
QVERIFY(HbMenuData::mExecPoint == point);
// gotten id != KVcxMvcMediaTypeVideo, service does not exists and id != KVcxMvcMediaTypeAlbum
- VideoSortFilterProxyModelData::mItemIds.clear();
- VideoSortFilterProxyModelData::mItemIds.append(TMPXItemId(1,1));
+ VideoProxyModelData::mItemIds.clear();
+ VideoProxyModelData::mItemIds.append(TMPXItemId(1,1));
mTestWidget->mVideoServices = 0;
mTestWidget->callLongPressedSlot(item, point);
QVERIFY(HbMenuData::mExecPoint == point);
// gotten id != KVcxMvcMediaTypeVideo, service service does not exists and id == KVcxMvcMediaTypeAlbum
- VideoSortFilterProxyModelData::mItemIds.clear();
- VideoSortFilterProxyModelData::mItemIds.append(TMPXItemId(1,2));
+ VideoProxyModelData::mItemIds.clear();
+ VideoProxyModelData::mItemIds.append(TMPXItemId(1,2));
mTestWidget->mVideoServices = 0;
mTestWidget->callLongPressedSlot(item, point);
QVERIFY(HbMenuData::mExecPoint == point);
HbMenuData::mExecPoint = QPointF();
// gotten id == KVcxMvcMediaTypeVideo
- VideoSortFilterProxyModelData::mItemIds.clear();
- VideoSortFilterProxyModelData::mItemIds.append(TMPXItemId(1,02));
+ VideoProxyModelData::mItemIds.clear();
+ VideoProxyModelData::mItemIds.append(TMPXItemId(1,02));
mTestWidget->mVideoServices = 0;
mTestWidget->callLongPressedSlot(item, point);
QVERIFY(HbMenuData::mExecPoint == point);
@@ -734,9 +733,9 @@
void TestListWidget::testSetContextMenu()
{
VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
- VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionCommon::EModelTypeAllVideos);
+ VideoProxyModelGeneric *model = wrapper.getAllVideosModel();
VideoListDataModel *sourceModel = qobject_cast(model->sourceModel());
- VideoSortFilterProxyModelData::mItemIds.clear();
+ VideoProxyModelData::mItemIds.clear();
mTestWidget->initialize(*model);
setRowCount(1);
@@ -746,7 +745,7 @@
TMPXItemId itemId;
QPointF point(1,1);
itemId.iId2 = 0;
- VideoSortFilterProxyModelData::mItemIds.append(itemId);
+ VideoProxyModelData::mItemIds.append(itemId);
HbAbstractViewItem *item = new HbAbstractViewItem();
item->mModelIndex = model->index(0, 0, QModelIndex());
@@ -818,7 +817,7 @@
QVERIFY(visibleCount == 1);
// service does not exists , mpxId.iId2 == KVcxMvcMediaTypeAlbum
- VideoSortFilterProxyModelData::mItemIds.append(TMPXItemId(1,KVcxMvcMediaTypeAlbum));
+ VideoProxyModelData::mItemIds.append(TMPXItemId(1,KVcxMvcMediaTypeAlbum));
HbListView::mCurrentIndex = model->index(1, 0, QModelIndex());
item->mModelIndex = model->index(1, 0, QModelIndex());
mTestWidget->mVideoServices = 0;
@@ -860,7 +859,7 @@
cleanup();
init();
setRowCount(1);
- model = wrapper.getModel(VideoCollectionCommon::EModelTypeAllVideos);
+ model = wrapper.getAllVideosModel();
mTestWidget->mVideoServices = videoServices;
videoServices->mCurrentService = VideoServices::EUriFetcher;
mTestWidget->initialize(*model, videoServices);
@@ -868,7 +867,7 @@
mTestWidget->mItem->mModelIndex = HbListView::mCurrentIndex ;
mTestWidget->mCurrentLevel = VideoCollectionCommon::ELevelAlbum;
- VideoSortFilterProxyModelData::mItemIds.append(itemId);
+ VideoProxyModelData::mItemIds.append(itemId);
mTestWidget->callLongPressedSlot(item, point);
iter = mTestWidget->mContextMenuActions.begin();
@@ -909,7 +908,7 @@
//dodelayed calls create context menu, which is already tested at
// testSetContextMenu -method, these tests are just for coverity's sake
VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
- VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionCommon::EModelTypeAllVideos);
+ VideoProxyModelGeneric *model = wrapper.getAllVideosModel();
mTestWidget->initialize(*model);
delete mTestWidget->mContextMenu;
@@ -937,10 +936,10 @@
void TestListWidget::testDeleteItemSlot()
{
VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
- VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionCommon::EModelTypeAllVideos);
+ VideoProxyModelGeneric *model = wrapper.getAllVideosModel();
HbMessageBoxData::mLatestTxt = "";
- VideoSortFilterProxyModelData::mLastIndex = QModelIndex();
+ VideoProxyModelData::mLastIndex = QModelIndex();
mTestWidget->initialize(*model);
connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(deleteItemSlot()));
@@ -948,12 +947,12 @@
// no model
VideoListDataModelData::mDataAccessCount = 0;
- VideoSortFilterProxyModel *tmp = mTestWidget->mModel;
+ VideoProxyModelGeneric *tmp = mTestWidget->mModel;
mTestWidget->mModel = 0;
emit testSignal();
QVERIFY(VideoListDataModelData::dataAccessCount() == 0);
QVERIFY(HbMessageBoxData::mLatestTxt.isEmpty());
- QVERIFY(!VideoSortFilterProxyModelData::mLastIndex.isValid());
+ QVERIFY(!VideoProxyModelData::mLastIndex.isValid());
setRowCount(1);
mTestWidget->mModel = tmp;
@@ -964,7 +963,7 @@
emit testSignal();
QVERIFY(VideoListDataModelData::dataAccessCount() == 1);
QVERIFY(HbMessageBoxData::mLatestTxt.isEmpty());
- QVERIFY(!VideoSortFilterProxyModelData::mLastIndex.isValid());
+ QVERIFY(!VideoProxyModelData::mLastIndex.isValid());
setRowCount(0);
// data is valid
@@ -980,7 +979,7 @@
box->emitDialogFinished(mTestWidget, SLOT(deleteItemDialogFinished(int)), HbMessageBox::No);
QVERIFY(VideoListDataModelData::dataAccessCount() == 1);
QVERIFY(!HbMessageBoxData::mLatestTxt.isEmpty());
- QVERIFY(!VideoSortFilterProxyModelData::mLastIndex.isValid());
+ QVERIFY(!VideoProxyModelData::mLastIndex.isValid());
HbMessageBoxData::mLatestTxt = "";
setRowCount(1);
data = QString("test");
@@ -988,13 +987,13 @@
// messagebox question returns true
VideoListDataModelData::mDataAccessCount = 0;
- VideoSortFilterProxyModelData::mDeleteItemsFails = false;
+ VideoProxyModelData::mDeleteItemsFails = false;
HbMessageBoxData::mQuestionReturnValue = true;
emit testSignal();
box->emitDialogFinished(mTestWidget, SLOT(deleteItemDialogFinished(int)), HbMessageBox::Yes);
QVERIFY(VideoListDataModelData::dataAccessCount() == 1);
QVERIFY(!HbMessageBoxData::mLatestTxt.isEmpty());
- QVERIFY(VideoSortFilterProxyModelData::mLastIndex.row() == 0);
+ QVERIFY(VideoProxyModelData::mLastIndex.row() == 0);
disconnect(this, SIGNAL(testSignal()), mTestWidget, SLOT(deleteItemSlot()));
}
@@ -1006,23 +1005,23 @@
void TestListWidget::testRenameSlot()
{
VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
- VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionCommon::EModelTypeAllVideos);
+ VideoProxyModelGeneric *model = wrapper.getAllVideosModel();
HbInputDialog *dialog = new HbInputDialog();
connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(renameSlot()));
- VideoSortFilterProxyModelData::reset();
- VideoSortFilterProxyModelData::mLastIndex = QModelIndex();
+ VideoProxyModelData::reset();
+ VideoProxyModelData::mLastIndex = QModelIndex();
mTestWidget->initialize(*model);
// Good case
- VideoSortFilterProxyModelData::mLastItemNameInRename = "";
+ VideoProxyModelData::mLastItemNameInRename = "";
HbInputDialog::mValueReturnValue = "renamedVideo";
HbInputDialog::mValueCallCount = 0;
HbInputDialog::mOpenCallCount = 0;
setRowCount(1);
- VideoSortFilterProxyModelData::mItemIds.append(TMPXItemId(0, KVcxMvcMediaTypeAlbum));
+ VideoProxyModelData::mItemIds.append(TMPXItemId(0, KVcxMvcMediaTypeAlbum));
QVariant data = QString("albumName");
VideoListDataModelData::setData(VideoCollectionCommon::KeyTitle, data);
mTestWidget->mCurrentIndex = model->index(0, 0, QModelIndex());
@@ -1036,13 +1035,13 @@
HbInputDialog::mValueReturnValue = "albumName";
HbInputDialog::mValueCallCount = 0;
HbInputDialog::mOpenCallCount = 0;
- VideoSortFilterProxyModelData::mLastItemNameInRename = "";
+ VideoProxyModelData::mLastItemNameInRename = "";
data = QString("albumName");
VideoListDataModelData::setData(VideoCollectionCommon::KeyTitle, data);
mTestWidget->mCurrentIndex = model->index(0, 0, QModelIndex());
emit testSignal();
dialog->emitDialogFinished(mTestWidget, SLOT(renameDialogFinished(HbAction *)), 0);
- QVERIFY(VideoSortFilterProxyModelData::mLastItemNameInRename == "");
+ QVERIFY(VideoProxyModelData::mLastItemNameInRename == "");
QCOMPARE(HbInputDialog::mOpenCallCount, 1);
QVERIFY(HbInputDialog::mValueCallCount == 1);
@@ -1050,18 +1049,18 @@
HbInputDialog::mValueReturnValue = "";
HbInputDialog::mValueCallCount = 0;
HbInputDialog::mOpenCallCount = 0;
- VideoSortFilterProxyModelData::mLastItemNameInRename = "";
+ VideoProxyModelData::mLastItemNameInRename = "";
data = QString("albumName");
VideoListDataModelData::setData(VideoCollectionCommon::KeyTitle, data);
mTestWidget->mCurrentIndex = model->index(0, 0, QModelIndex());
emit testSignal();
dialog->emitDialogFinished(mTestWidget, SLOT(renameDialogFinished(HbAction *)), 1);
- QVERIFY(VideoSortFilterProxyModelData::mLastItemNameInRename == "");
+ QVERIFY(VideoProxyModelData::mLastItemNameInRename == "");
QCOMPARE(HbInputDialog::mOpenCallCount, 1);
QVERIFY(HbInputDialog::mValueCallCount == 0);
// New name is empty.
- VideoSortFilterProxyModelData::mLastItemNameInRename = "";
+ VideoProxyModelData::mLastItemNameInRename = "";
HbInputDialog::mValueReturnValue = "";
HbInputDialog::mValueCallCount = 0;
HbInputDialog::mOpenCallCount = 0;
@@ -1070,14 +1069,14 @@
mTestWidget->mCurrentIndex = model->index(0, 0, QModelIndex());
emit testSignal();
dialog->emitDialogFinished(mTestWidget, SLOT(renameDialogFinished(HbAction *)), 0);
- QVERIFY(VideoSortFilterProxyModelData::mLastItemNameInRename == "");
+ QVERIFY(VideoProxyModelData::mLastItemNameInRename == "");
QCOMPARE(HbInputDialog::mOpenCallCount, 1);
QVERIFY(HbInputDialog::mValueCallCount == 1);
// Item is video
- VideoSortFilterProxyModelData::mItemIds.clear();
- VideoSortFilterProxyModelData::mItemIds.append(TMPXItemId(0, KVcxMvcMediaTypeVideo));
- VideoSortFilterProxyModelData::mLastItemNameInRename = "";
+ VideoProxyModelData::mItemIds.clear();
+ VideoProxyModelData::mItemIds.append(TMPXItemId(0, KVcxMvcMediaTypeVideo));
+ VideoProxyModelData::mLastItemNameInRename = "";
HbInputDialog::mValueReturnValue = "renamedVideo";
HbInputDialog::mValueCallCount = 0;
HbInputDialog::mOpenCallCount = 0;
@@ -1088,37 +1087,67 @@
dialog->emitDialogFinished(mTestWidget, SLOT(renameDialogFinished(HbAction *)), 0);
QCOMPARE(HbInputDialog::mOpenCallCount, 1);
QVERIFY(HbInputDialog::mValueCallCount == 1);
- QVERIFY(VideoSortFilterProxyModelData::mLastItemNameInRename == "renamedVideo");
+ QVERIFY(VideoProxyModelData::mLastItemNameInRename == "renamedVideo");
+ // Item is album
+ VideoProxyModelData::mItemIds.clear();
+ VideoProxyModelData::mItemIds.append(TMPXItemId(0, KVcxMvcMediaTypeAlbum));
+ VideoProxyModelData::mLastItemNameInRename = "";
+ HbInputDialog::mValueReturnValue = "renamedAlbum";
+ HbInputDialog::mValueCallCount = 0;
+ HbInputDialog::mOpenCallCount = 0;
+ data = QString("oldAlbumName");
+ VideoListDataModelData::setData(VideoCollectionCommon::KeyTitle, data);
+ mTestWidget->mCurrentIndex = model->index(0, 0, QModelIndex());
+ emit testSignal();
+ dialog->emitDialogFinished(mTestWidget, SLOT(renameDialogFinished(HbAction *)), 0);
+ QCOMPARE(HbInputDialog::mOpenCallCount, 1);
+ QVERIFY(HbInputDialog::mValueCallCount == 1);
+ QVERIFY(VideoProxyModelData::mLastItemNameInRename == "renamedAlbum");
+
+ // Item is category
+ VideoProxyModelData::mItemIds.clear();
+ VideoProxyModelData::mItemIds.append(TMPXItemId(0, KVcxMvcMediaTypeCategory));
+ VideoProxyModelData::mLastItemNameInRename = "";
+ HbInputDialog::mValueReturnValue = "notallowed";
+ HbInputDialog::mValueCallCount = 0;
+ HbInputDialog::mOpenCallCount = 0;
+ data = QString("oldCategoryName");
+ VideoListDataModelData::setData(VideoCollectionCommon::KeyTitle, data);
+ mTestWidget->mCurrentIndex = model->index(0, 0, QModelIndex());
+ emit testSignal();
+ QCOMPARE(HbInputDialog::mOpenCallCount, 0);
+ QVERIFY(VideoProxyModelData::mLastItemNameInRename == "");
+
// No model
- VideoSortFilterProxyModelData::mLastItemNameInRename = "";
+ VideoProxyModelData::mLastItemNameInRename = "";
HbInputDialog::mValueReturnValue = "";
HbInputDialog::mValueCallCount = 0;
HbInputDialog::mOpenCallCount = 0;
- VideoSortFilterProxyModelData::mItemIds.clear();
- VideoSortFilterProxyModelData::mItemIds.append(TMPXItemId(0, KVcxMvcMediaTypeAlbum));
+ VideoProxyModelData::mItemIds.clear();
+ VideoProxyModelData::mItemIds.append(TMPXItemId(0, KVcxMvcMediaTypeAlbum));
data = QString("albumName");
VideoListDataModelData::setData(VideoCollectionCommon::KeyTitle, data);
mTestWidget->mCurrentIndex = model->index(0, 0, QModelIndex());
- VideoSortFilterProxyModel *tmp = mTestWidget->mModel;
+ VideoProxyModelGeneric *tmp = mTestWidget->mModel;
mTestWidget->mModel = 0;
emit testSignal();
mTestWidget->mModel = tmp;
- QVERIFY(VideoSortFilterProxyModelData::mLastItemNameInRename == "");
+ QVERIFY(VideoProxyModelData::mLastItemNameInRename == "");
QCOMPARE(HbInputDialog::mOpenCallCount, 0);
// Variant data is invalid
- VideoSortFilterProxyModelData::mLastItemNameInRename = "";
+ VideoProxyModelData::mLastItemNameInRename = "";
HbInputDialog::mValueReturnValue = "renamedVideo";
HbInputDialog::mValueCallCount = 0;
HbInputDialog::mOpenCallCount = 0;
- VideoSortFilterProxyModelData::mItemIds.clear();
- VideoSortFilterProxyModelData::mItemIds.append(TMPXItemId(0, KVcxMvcMediaTypeAlbum));
+ VideoProxyModelData::mItemIds.clear();
+ VideoProxyModelData::mItemIds.append(TMPXItemId(0, KVcxMvcMediaTypeAlbum));
data = QVariant();
VideoListDataModelData::setData(VideoCollectionCommon::KeyTitle, data);
mTestWidget->mCurrentIndex = model->index(0, 0, QModelIndex());
emit testSignal();
- QVERIFY(VideoSortFilterProxyModelData::mLastItemNameInRename == "");
+ QVERIFY(VideoProxyModelData::mLastItemNameInRename == "");
QCOMPARE(HbInputDialog::mOpenCallCount, 0);
disconnect(this, SIGNAL(testSignal()), mTestWidget, SLOT(renameSlot()));
@@ -1134,13 +1163,13 @@
// Just verify here, that the openItemSlot calls doEmitActivated.
VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
- VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionCommon::EModelTypeAllVideos);
+ VideoProxyModelGeneric *model = wrapper.getAllVideosModel();
mTestWidget->initialize(*model);
connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(openItemSlot()));
setRowCount(1);
TMPXItemId savedId = TMPXItemId(1,1);
- VideoSortFilterProxyModelData::mItemIds.clear();
- VideoSortFilterProxyModelData::mItemIds.append(savedId);
+ VideoProxyModelData::mItemIds.clear();
+ VideoProxyModelData::mItemIds.append(savedId);
HbListView::mCurrentIndex = model->index(0, 0, QModelIndex());
// Making the context menu visible ensures that the doEmitActivated is called
@@ -1154,7 +1183,7 @@
emit testSignal();
- QVERIFY(VideoSortFilterProxyModelData::mLastItemId == savedId);
+ QVERIFY(VideoProxyModelData::mLastItemId == savedId);
disconnect(this, SIGNAL(testSignal()), mTestWidget, SLOT(openItemSlot()));
}
@@ -1166,18 +1195,18 @@
void TestListWidget::testPlayItemSlot()
{
VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
- VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionCommon::EModelTypeAllVideos);
+ VideoProxyModelGeneric *model = wrapper.getAllVideosModel();
mTestWidget->initialize(*model);
connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(playItemSlot()));
setRowCount(1);
TMPXItemId savedId = TMPXItemId(1,1);
- VideoSortFilterProxyModelData::mItemIds.clear();
- VideoSortFilterProxyModelData::mItemIds.append(savedId);
+ VideoProxyModelData::mItemIds.clear();
+ VideoProxyModelData::mItemIds.append(savedId);
HbListView::mCurrentIndex = model->index(0, 0, QModelIndex());
emit testSignal();
- QVERIFY(VideoSortFilterProxyModelData::mLastItemId == savedId);
+ QVERIFY(VideoProxyModelData::mLastItemId == savedId);
disconnect(this, SIGNAL(testSignal()), mTestWidget, SLOT(playItemSlot()));
}
@@ -1189,7 +1218,7 @@
void TestListWidget::testAddToCollectionSlot()
{
VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
- VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionCommon::EModelTypeAllVideos);
+ VideoProxyModelGeneric *model = wrapper.getAllVideosModel();
VideoListSelectionDialogData::mSelectionType = -1;
VideoListSelectionDialogData::mSettedMpxId = TMPXItemId::InvalidId();
@@ -1197,8 +1226,8 @@
connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(addToCollectionSlot()));
setRowCount(1);
TMPXItemId savedId = TMPXItemId(1,1);
- VideoSortFilterProxyModelData::mItemIds.clear();
- VideoSortFilterProxyModelData::mItemIds.append(savedId);
+ VideoProxyModelData::mItemIds.clear();
+ VideoProxyModelData::mItemIds.append(savedId);
HbListView::mCurrentIndex = model->index(0, 0, QModelIndex());
// no model
@@ -1215,15 +1244,15 @@
VideoCollectionUiLoaderData::mFindFailureNameList.clear();
// invalid id at current index
- VideoSortFilterProxyModelData::mItemIds.clear();
- VideoSortFilterProxyModelData::mItemIds.append(TMPXItemId::InvalidId());
+ VideoProxyModelData::mItemIds.clear();
+ VideoProxyModelData::mItemIds.append(TMPXItemId::InvalidId());
emit testSignal();
QVERIFY(VideoListSelectionDialogData::mSelectionType == -1 );
QVERIFY(VideoListSelectionDialogData::mSettedMpxId == TMPXItemId::InvalidId());
// valid id at current index
- VideoSortFilterProxyModelData::mItemIds.clear();
- VideoSortFilterProxyModelData::mItemIds.append(savedId);
+ VideoProxyModelData::mItemIds.clear();
+ VideoProxyModelData::mItemIds.append(savedId);
emit testSignal();
QVERIFY(VideoListSelectionDialogData::mSelectionType == VideoListSelectionDialog::ESelectCollection );
QVERIFY(VideoListSelectionDialogData::mSettedMpxId == savedId);
@@ -1239,45 +1268,45 @@
void TestListWidget::testRemoveFromCollectionSlot()
{
VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
- VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionCommon::EModelTypeAllVideos);
+ VideoProxyModelGeneric *model = wrapper.getAllVideosModel();
- VideoSortFilterProxyModelData::mRemoveItemsFromAlbumReturnValue = 0;
- VideoSortFilterProxyModelData::mLastItemId = TMPXItemId::InvalidId();
- VideoSortFilterProxyModelData::mItemIds.clear();
+ VideoProxyModelData::mRemoveItemsFromAlbumReturnValue = 0;
+ VideoProxyModelData::mLastItemId = TMPXItemId::InvalidId();
+ VideoProxyModelData::mItemIds.clear();
connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(removeFromCollectionSlot()));
setRowCount(2);
TMPXItemId savedId = TMPXItemId(1,1);
- VideoSortFilterProxyModelData::mItemIds.clear();
+ VideoProxyModelData::mItemIds.clear();
// invalid id at index 0
- VideoSortFilterProxyModelData::mItemIds.append(TMPXItemId::InvalidId());
- VideoSortFilterProxyModelData::mItemIds.append(savedId);
+ VideoProxyModelData::mItemIds.append(TMPXItemId::InvalidId());
+ VideoProxyModelData::mItemIds.append(savedId);
HbListView::mCurrentIndex = model->index(1, 0, QModelIndex());
// no model
emit testSignal();
- QVERIFY(VideoSortFilterProxyModelData::mLastItemId == TMPXItemId::InvalidId());
+ QVERIFY(VideoProxyModelData::mLastItemId == TMPXItemId::InvalidId());
mTestWidget->initialize(*model);
- VideoSortFilterProxyModelData::mOpenedItemId = TMPXItemId::InvalidId();
+ VideoProxyModelData::mOpenedItemId = TMPXItemId::InvalidId();
// collection id is invalid
emit testSignal();
- QVERIFY(VideoSortFilterProxyModelData::mLastItemId == TMPXItemId::InvalidId());
- VideoSortFilterProxyModelData::mOpenedItemId = TMPXItemId(1,2);
+ QVERIFY(VideoProxyModelData::mLastItemId == TMPXItemId::InvalidId());
+ VideoProxyModelData::mOpenedItemId = TMPXItemId(1,2);
// media at current index is invalid
HbListView::mCurrentIndex = model->index(0, 0, QModelIndex());
emit testSignal();
- QVERIFY(VideoSortFilterProxyModelData::mLastItemId == TMPXItemId::InvalidId());
+ QVERIFY(VideoProxyModelData::mLastItemId == TMPXItemId::InvalidId());
// all is ok
HbListView::mCurrentIndex = model->index(1, 0, QModelIndex());
emit testSignal();
- QVERIFY(VideoSortFilterProxyModelData::mLastItemId == TMPXItemId(1,2));
- // ids are to be saved at VideoSortFilterProxyModelData::mItemIds
- QVERIFY(VideoSortFilterProxyModelData::mItemIds.at(0) == savedId);
+ QVERIFY(VideoProxyModelData::mLastItemId == TMPXItemId(1,2));
+ // ids are to be saved at VideoProxyModelData::mItemIds
+ QVERIFY(VideoProxyModelData::mItemIds.at(0) == savedId);
disconnect(this, SIGNAL(testSignal()), mTestWidget, SLOT(removeFromCollectionSlot()));
}
@@ -1288,13 +1317,13 @@
//
void TestListWidget::testRemoveCollectionSlot()
{
- VideoSortFilterProxyModelData::mRemoveAlbumsFails = false;
+ VideoProxyModelData::mRemoveAlbumsFails = false;
VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
- VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionCommon::EModelTypeAllVideos);
+ VideoProxyModelGeneric *model = wrapper.getAllVideosModel();
HbMessageBoxData::mQuestionReturnValue = true;
HbMessageBoxData::mLatestTxt = "";
- VideoSortFilterProxyModelData::mLastIndex = QModelIndex();
+ VideoProxyModelData::mLastIndex = QModelIndex();
setRowCount(1);
HbListView::mCurrentIndex = model->index(0, 0, QModelIndex());
@@ -1304,15 +1333,15 @@
setRowCount(2);
TMPXItemId savedId = TMPXItemId(1,1);
- VideoSortFilterProxyModelData::mItemIds.clear();
+ VideoProxyModelData::mItemIds.clear();
// invalid id at index 0
- VideoSortFilterProxyModelData::mItemIds.append(TMPXItemId::InvalidId());
- VideoSortFilterProxyModelData::mItemIds.append(savedId);
+ VideoProxyModelData::mItemIds.append(TMPXItemId::InvalidId());
+ VideoProxyModelData::mItemIds.append(savedId);
HbListView::mCurrentIndex = model->index(1, 0, QModelIndex());
// no model
emit testSignal();
- QVERIFY(!VideoSortFilterProxyModelData::mLastIndex.isValid());
+ QVERIFY(!VideoProxyModelData::mLastIndex.isValid());
QVERIFY(HbMessageBoxData::mLatestTxt.isEmpty());
mTestWidget->initialize(*model);
@@ -1320,24 +1349,24 @@
// invalid data
VideoListDataModelData::setData(VideoCollectionCommon::KeyTitle, QVariant());
emit testSignal();
- QVERIFY(!VideoSortFilterProxyModelData::mLastIndex.isValid());
+ QVERIFY(!VideoProxyModelData::mLastIndex.isValid());
QVERIFY(HbMessageBoxData::mLatestTxt.isEmpty());
// valid data
VideoListDataModelData::setData(VideoCollectionCommon::KeyTitle, "test");
emit testSignal();
box->emitDialogFinished(mTestWidget, SLOT(removeCollectionDialogFinished(int)), HbMessageBox::Yes);
- QVERIFY(VideoSortFilterProxyModelData::mLastIndex.isValid());
- QVERIFY(VideoSortFilterProxyModelData::mLastIndex.row() == 1);
+ QVERIFY(VideoProxyModelData::mLastIndex.isValid());
+ QVERIFY(VideoProxyModelData::mLastIndex.row() == 1);
QVERIFY(!HbMessageBoxData::mLatestTxt.isEmpty());
// msg box return false (for coverity)
- VideoSortFilterProxyModelData::mLastIndex = QModelIndex();
+ VideoProxyModelData::mLastIndex = QModelIndex();
HbMessageBoxData::mLatestTxt = "";
HbMessageBoxData::mQuestionReturnValue = false;
emit testSignal();
box->emitDialogFinished(mTestWidget, SLOT(removeCollectionDialogFinished(int)), HbMessageBox::No);
- QVERIFY(!VideoSortFilterProxyModelData::mLastIndex.isValid());
+ QVERIFY(!VideoProxyModelData::mLastIndex.isValid());
QVERIFY(!HbMessageBoxData::mLatestTxt.isEmpty());
disconnect(this, SIGNAL(testSignal()), mTestWidget, SLOT(removeCollectionSlot()));
@@ -1350,21 +1379,21 @@
void TestListWidget::testOpenDetailsSlot()
{
VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
- VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionCommon::EModelTypeAllVideos);
+ VideoProxyModelGeneric *model = wrapper.getAllVideosModel();
QSignalSpy spysignal(mTestWidget, SIGNAL(command(int)));
HbMessageBoxData::mLatestTxt = "";
- VideoSortFilterProxyModelData::mLastIndex = QModelIndex();
+ VideoProxyModelData::mLastIndex = QModelIndex();
setRowCount(0);
mTestWidget->initialize(*model);
connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(openDetailsSlot()));
// no model
- VideoSortFilterProxyModel *tmp = mTestWidget->mModel;
+ VideoProxyModelGeneric *tmp = mTestWidget->mModel;
mTestWidget->mModel = 0;
emit testSignal();
QVERIFY(spysignal.count() == 0);
- QVERIFY(!VideoSortFilterProxyModelData::mLastIndex.isValid());
+ QVERIFY(!VideoProxyModelData::mLastIndex.isValid());
mTestWidget->mModel = tmp;
// detail fetch fails
@@ -1372,24 +1401,24 @@
QVariant data = QString("test");
VideoListDataModelData::setData(Qt::DisplayRole, data);
mTestWidget->mCurrentIndex = model->index(0, 0, QModelIndex());
- VideoSortFilterProxyModelData::mDetailsReturnValue = -1;
+ VideoProxyModelData::mDetailsReturnValue = -1;
emit testSignal();
QVERIFY(spysignal.count() == 0);
- QVERIFY(VideoSortFilterProxyModelData::mLastIndex.row() == 0);
+ QVERIFY(VideoProxyModelData::mLastIndex.row() == 0);
// detail fetch succeeds
- VideoSortFilterProxyModelData::mDetailsReturnValue = 0;
- VideoSortFilterProxyModelData::mLastIndex = QModelIndex();
+ VideoProxyModelData::mDetailsReturnValue = 0;
+ VideoProxyModelData::mLastIndex = QModelIndex();
emit testSignal();
QVERIFY(spysignal.count() == 1);
QVERIFY(spysignal.at(0).at(0).isValid());
QVERIFY(spysignal.at(0).at(0).toInt() == MpxHbVideoCommon::ActivateVideoDetailsView);
- QVERIFY(VideoSortFilterProxyModelData::mLastIndex.row() == 0);
+ QVERIFY(VideoProxyModelData::mLastIndex.row() == 0);
disconnect(this, SIGNAL(testSignal()), mTestWidget, SLOT(openDetailsSlot()));
}
-
+
// ---------------------------------------------------------------------------
// testBack
// ---------------------------------------------------------------------------
@@ -1397,7 +1426,7 @@
void TestListWidget::testBack()
{
VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
- VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionCommon::EModelTypeAllVideos);
+ VideoProxyModelGeneric *model = wrapper.getAllVideosModel();
QSignalSpy spysignal(mTestWidget, SIGNAL(collectionOpened(bool, const QString&, const TMPXItemId&)));
connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(back()));
@@ -1438,7 +1467,7 @@
{
VideoThumbnailTestData::mBackgroundThumbnailFetchingEnabled = true;
VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
- VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionCommon::EModelTypeAllVideos);
+ VideoProxyModelGeneric *model = wrapper.getAllVideosModel();
mTestWidget->initialize(*model);
connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(scrollingEndedSlot()));
@@ -1485,7 +1514,7 @@
void TestListWidget::testScrollPositionChangedSlot()
{
VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
- VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionCommon::EModelTypeAllVideos);
+ VideoProxyModelGeneric *model = wrapper.getAllVideosModel();
mTestWidget->initialize(*model);
const QPointF point;
@@ -1529,7 +1558,7 @@
void TestListWidget::testRowsInsertedSlot()
{
VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
- VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionCommon::EModelTypeAllVideos);
+ VideoProxyModelGeneric *model = wrapper.getAllVideosModel();
mTestWidget->initialize(*model);
@@ -1555,7 +1584,7 @@
void TestListWidget::testRowsRemovedSlot()
{
VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
- VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionCommon::EModelTypeAllVideos);
+ VideoProxyModelGeneric *model = wrapper.getAllVideosModel();
mTestWidget->initialize(*model);
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionview/tsrc/testvideocollectionuiloader/src/testvideocollectionuiloader.cpp
--- a/videocollection/videocollectionview/tsrc/testvideocollectionuiloader/src/testvideocollectionuiloader.cpp Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionview/tsrc/testvideocollectionuiloader/src/testvideocollectionuiloader.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -27,6 +27,7 @@
#include
#include
+#include "videolistwidgetdata.h"
#include "testvideocollectionuiloader.h"
#include "videohintwidget.h"
#include "videocollectionwrapperdata.h"
@@ -741,6 +742,7 @@
QVERIFY(found);
i++;
}
+ QCOMPARE(VideoListWidgetData::mInitializeCount, 3);
// Getting proxymodel fails.
cleanup();
@@ -748,7 +750,9 @@
mTestObject->addData(params,
this,
SLOT(handleObjectReady(QObject*, const QString&)));
- VideoCollectionWrapperData::mGetModelFails = true;
+ VideoCollectionWrapperData::mGetAllVideosModelFails = true;
+ VideoCollectionWrapperData::mGetCollectionsModelFails = true;
+ VideoCollectionWrapperData::mGetCollectionContentModelFails = true;
mTestObject->loadPhase(VideoCollectionUiLoaderParam::LoadPhasePrimary);
mTestObject->loadPhase(VideoCollectionUiLoaderParam::LoadPhaseSecondary);
QTest::qWait(5000); // 5 seconds
@@ -769,6 +773,7 @@
i++;
}
params.clear();
+ QCOMPARE(VideoListWidgetData::mInitializeCount, 0);
}
// ---------------------------------------------------------------------------
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionview/tsrc/testvideocollectionviewutils/src/testvideocollectionviewutils.cpp
--- a/videocollection/videocollectionview/tsrc/testvideocollectionviewutils/src/testvideocollectionviewutils.cpp Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionview/tsrc/testvideocollectionviewutils/src/testvideocollectionviewutils.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -24,7 +24,7 @@
#include "hblabel.h"
#include "hbaction.h"
#include "videocollectionwrapper.h"
-#include "videosortfilterproxymodeldata.h"
+#include "videoproxymodeldata.h"
#include "videoactivitystate.h"
#include "videocollectioncommon.h"
#include "centralrepository.h"
@@ -623,58 +623,57 @@
// null model
VideoCollectionViewUtils::sortModel(0, false, target);
- VideoSortFilterProxyModel *model =
- VideoCollectionWrapper::instance().getModel(VideoCollectionCommon::EModelTypeGeneric);
+ VideoProxyModelGeneric *model =
+ VideoCollectionWrapper::instance().getGenericModel();
// target == invalid -> default values used as sort -call
VideoCollectionViewUtils::sortModel(model, false, target);
- QVERIFY(VideoSortFilterProxyModelData::mDoSortingCallCount == 1);
- QVERIFY(VideoSortFilterProxyModelData::mSortRole == VideoCollectionCommon::KeyDateTime);
- QVERIFY(VideoSortFilterProxyModelData::mSortOrder == Qt::AscendingOrder);
- QVERIFY(VideoSortFilterProxyModelData::mSortAsync == false);
+ QVERIFY(VideoProxyModelData::mDoSortingCallCount == 1);
+ QVERIFY(VideoProxyModelData::mSortRole == VideoCollectionCommon::KeyDateTime);
+ QVERIFY(VideoProxyModelData::mSortOrder == Qt::AscendingOrder);
+ QVERIFY(VideoProxyModelData::mSortAsync == false);
QVERIFY(testObject.mVideosSortRole == -1);
QVERIFY(testObject.mVideosSortOrder == Qt::AscendingOrder);
QVERIFY(testObject.mCollectionsSortRole == -1);
QVERIFY(testObject.mCollectionsSortOrder == Qt::AscendingOrder);
- VideoSortFilterProxyModelData::mDoSortingCallCount = 0;
- VideoSortFilterProxyModelData::mSortRole = -1;
- VideoSortFilterProxyModelData::mSortOrder = Qt::AscendingOrder;
- VideoSortFilterProxyModelData::mSortAsync = true;
+ VideoProxyModelData::mDoSortingCallCount = 0;
+ VideoProxyModelData::mSortRole = -1;
+ VideoProxyModelData::mSortOrder = Qt::AscendingOrder;
+ VideoProxyModelData::mSortAsync = true;
// target == VideoCollectionCommon::ELevelVideos
target = VideoCollectionCommon::ELevelVideos;
VideoCollectionViewUtils::sortModel(model, false, target);
- QVERIFY(VideoSortFilterProxyModelData::mDoSortingCallCount == 1);
- QVERIFY(VideoSortFilterProxyModelData::mSortRole == VideoCollectionCommon::KeyDateTime);
- QVERIFY(VideoSortFilterProxyModelData::mSortOrder == Qt::DescendingOrder);
- QVERIFY(VideoSortFilterProxyModelData::mSortAsync == false);
+ QVERIFY(VideoProxyModelData::mDoSortingCallCount == 1);
+ QVERIFY(VideoProxyModelData::mSortRole == VideoCollectionCommon::KeyDateTime);
+ QVERIFY(VideoProxyModelData::mSortOrder == Qt::DescendingOrder);
+ QVERIFY(VideoProxyModelData::mSortAsync == false);
QVERIFY(testObject.mVideosSortRole == VideoCollectionCommon::KeyDateTime);
QVERIFY(testObject.mVideosSortOrder == Qt::DescendingOrder);
QVERIFY(testObject.mCollectionsSortRole == -1);
QVERIFY(testObject.mCollectionsSortOrder == Qt::AscendingOrder);
- VideoSortFilterProxyModelData::mDoSortingCallCount = 0;
- VideoSortFilterProxyModelData::mSortRole = -1;
- VideoSortFilterProxyModelData::mSortOrder = Qt::AscendingOrder;
- VideoSortFilterProxyModelData::mSortAsync = true;
+ VideoProxyModelData::mDoSortingCallCount = 0;
+ VideoProxyModelData::mSortRole = -1;
+ VideoProxyModelData::mSortOrder = Qt::AscendingOrder;
+ VideoProxyModelData::mSortAsync = true;
// target == VideoCollectionCommon::ELevelCategory
target = VideoCollectionCommon::ELevelCategory;
VideoCollectionViewUtils::sortModel(model, false, target);
- QVERIFY(VideoSortFilterProxyModelData::mDoSortingCallCount == 1);
- QVERIFY(VideoSortFilterProxyModelData::mSortRole == VideoCollectionCommon::KeyTitle);
- QVERIFY(VideoSortFilterProxyModelData::mSortOrder == Qt::DescendingOrder);
- QVERIFY(VideoSortFilterProxyModelData::mSortAsync == false);
+ QVERIFY(VideoProxyModelData::mDoSortingCallCount == 1);
+ QVERIFY(VideoProxyModelData::mSortRole == VideoCollectionCommon::KeyTitle);
+ QVERIFY(VideoProxyModelData::mSortOrder == Qt::DescendingOrder);
+ QVERIFY(VideoProxyModelData::mSortAsync == false);
QVERIFY(testObject.mVideosSortRole == VideoCollectionCommon::KeyDateTime);
QVERIFY(testObject.mVideosSortOrder == Qt::DescendingOrder);
QVERIFY(testObject.mCollectionsSortRole == VideoCollectionCommon::KeyTitle);
QVERIFY(testObject.mCollectionsSortOrder == Qt::DescendingOrder);
-
}
// -----------------------------------------------------------------------------
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionview/tsrc/testvideolistselectiondialog/inc/testvideolistselectiondialog.h
--- a/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/inc/testvideolistselectiondialog.h Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/inc/testvideolistselectiondialog.h Fri Sep 03 12:37:43 2010 +0300
@@ -26,7 +26,7 @@
class VideoListSelectionDialog;
class VideoCollectionUiLoader;
class VideoListDataModel;
-class VideoSortFilterProxyModel;
+class VideoProxyModelGeneric;
class VideoListWidget;
class VideoListSelectionDialogTesterHelper;
@@ -36,7 +36,7 @@
private:
- void setRowCount(int count, VideoCollectionCommon::TModelType type = VideoCollectionCommon::EModelTypeAllVideos, VideoListDataModel *model = 0);
+ void setRowCount(int count, VideoProxyModelGeneric *proxyModel = 0, VideoListDataModel *model = 0);
// test functions for the test framework
@@ -150,7 +150,7 @@
/**
* dummy model
*/
- VideoSortFilterProxyModel *mModel;
+ VideoProxyModelGeneric *mModel;
/**
* dummy widget
@@ -161,6 +161,7 @@
* flag indicating if last call to init succeeded.
*/
bool mInitOk;
+
};
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionview/tsrc/testvideolistselectiondialog/inc/videolistselectiondialogtester.h
--- a/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/inc/videolistselectiondialogtester.h Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/inc/videolistselectiondialogtester.h Fri Sep 03 12:37:43 2010 +0300
@@ -43,18 +43,18 @@
public:
VideoListSelectionDialogTesterHelper(VideoListSelectionDialog *testable = 0)
- : mTestable(testable) {};
+ : mTestable(testable), mSignalsConnected(false) {};
~VideoListSelectionDialogTesterHelper() {};
bool connectSignals()
{
- if(!mTestable)
+ if(!mTestable || mSignalsConnected)
{
return false;
}
- // disconnect first to make sure there signals are not connected twice
- disconnectSignals();
+ mSignalsConnected = true;
+
if(!connect(this, SIGNAL(markAllSignal(int)), mTestable, SLOT(markAllStateChangedSlot(int))))
{
return false;
@@ -91,8 +91,9 @@
void disconnectSignals()
{
- if(mTestable)
+ if(mTestable && mSignalsConnected)
{
+ mSignalsConnected = false;
disconnect(this, SIGNAL(markAllSignal(int)), mTestable, SLOT(markAllStateChangedSlot(int)));
disconnect(this, SIGNAL(selectionChangedSignal(const QItemSelection&, const QItemSelection&)),
mTestable, SLOT(selectionChangedSlot(const QItemSelection&, const QItemSelection&)));
@@ -142,6 +143,11 @@
}
VideoListSelectionDialog *mTestable;
+
+ /**
+ * flag indicating if signals are connected.
+ */
+ bool mSignalsConnected;
};
#endif
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionview/tsrc/testvideolistselectiondialog/src/testvideolistselectiondialog.cpp
--- a/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/src/testvideolistselectiondialog.cpp Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/src/testvideolistselectiondialog.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -32,7 +32,7 @@
#include "videocollectionuiloader.h"
#include "videolistdatamodel.h"
-#include "videosortfilterproxymodel.h"
+#include "videoproxymodelgeneric.h"
#include "videolistwidget.h"
#include "videocollectionwrapper.h"
#include "videocollectioncommon.h"
@@ -42,7 +42,7 @@
#include "videocollectionwrapperdata.h"
#include "videocollectionuiloaderdata.h"
#include "videolistwidgetdata.h"
-#include "videosortfilterproxymodeldata.h"
+#include "videoproxymodeldata.h"
#include "videocollectionviewutilsdata.h"
#define private public
@@ -90,15 +90,17 @@
// setRowCount
// ---------------------------------------------------------------------------
//
-void TestVideoListSelectionDialog::setRowCount(int count, VideoCollectionCommon::TModelType type, VideoListDataModel *model)
+void TestVideoListSelectionDialog::setRowCount(int count, VideoProxyModelGeneric *proxyModel, VideoListDataModel *model)
{
if (!model)
{
- VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
- VideoSortFilterProxyModel *model = wrapper.getModel(type);
- QVERIFY(model);
+ if(!proxyModel)
+ {
+ proxyModel = VideoCollectionWrapper::instance().getAllVideosModel();
+ QVERIFY(proxyModel);
+ }
- VideoListDataModel *sourceModel = qobject_cast(model->sourceModel());
+ VideoListDataModel *sourceModel = qobject_cast(proxyModel->sourceModel());
QVERIFY(sourceModel);
VideoListDataModelData::setRowCount(*sourceModel, count);
@@ -142,7 +144,7 @@
mTestUiLoader = new VideoCollectionUiLoader();
mTestObject = new VideoListSelectionDialog(mTestUiLoader);
- mModel = VideoCollectionWrapper::instance().getModel(VideoCollectionCommon::EModelTypeGeneric);
+ mModel = VideoCollectionWrapper::instance().getGenericModel();
mTestHelper->mTestable = mTestObject;
QVERIFY(mTestHelper->connectSignals());
@@ -189,7 +191,7 @@
mTestObject = 0;
// Getting model fails
- VideoCollectionWrapperData::mGetModelFails = true;
+ VideoCollectionWrapperData::mGetGenericModelFails = true;
mTestObject = new VideoListSelectionDialog(mTestUiLoader);
QVERIFY(mTestObject->mModel == 0);
QVERIFY(mTestObject->mListWidget == 0);
@@ -198,7 +200,7 @@
mTestObject = 0;
// List widget initialize fails
- VideoCollectionWrapperData::mGetModelFails = false;
+ VideoCollectionWrapperData::mGetGenericModelFails = false;
VideoListWidgetData::mInitializeReturnValue = -1;
mTestObject = new VideoListSelectionDialog(mTestUiLoader);
QVERIFY(mTestObject->mModel != 0);
@@ -248,12 +250,12 @@
QVERIFY(mTestObject->mCheckBox != 0);
QVERIFY(mTestObject->mPrimaryAction != 0);
QVERIFY(mTestObject->mSecondaryAction != 0);
- QVERIFY(VideoSortFilterProxyModelData::mGenericFilterId == mpxId);
- QVERIFY(VideoSortFilterProxyModelData::mGenericFilterValue);
+ QVERIFY(VideoProxyModelData::mGenericFilterId == mpxId);
+ QVERIFY(VideoProxyModelData::mGenericFilterValue);
QVERIFY(mTestObject->mModelReady == false);
QVERIFY(mTestObject->mAlbumListReady == false);
- VideoSortFilterProxyModelData::reset();
+ VideoProxyModelData::reset();
// second setup (for coverity)
mTestObject->setupContent(VideoListSelectionDialog::EDeleteVideos, mpxId);
@@ -273,14 +275,14 @@
QVERIFY(mTestObject->mCheckBox != 0);
QVERIFY(mTestObject->mPrimaryAction != 0);
QVERIFY(mTestObject->mSecondaryAction != 0);
- QVERIFY(VideoSortFilterProxyModelData::mGenericFilterId == mpxId);
- QVERIFY(VideoSortFilterProxyModelData::mGenericFilterValue);
+ QVERIFY(VideoProxyModelData::mGenericFilterId == mpxId);
+ QVERIFY(VideoProxyModelData::mGenericFilterValue);
QVERIFY(mTestObject->mModelReady == false);
QVERIFY(mTestObject->mAlbumListReady == false);
delete mTestObject;
mTestObject = new VideoListSelectionDialog(mTestUiLoader);
- VideoSortFilterProxyModelData::reset();
+ VideoProxyModelData::reset();
// No data. type ESelectCollection. Default mpx item
setRowCount(0);
@@ -302,14 +304,14 @@
QVERIFY(mTestObject->mCheckBox != 0);
QVERIFY(mTestObject->mPrimaryAction != 0);
QVERIFY(mTestObject->mSecondaryAction != 0);
- QVERIFY(VideoSortFilterProxyModelData::mGenericFilterId == mpxId);
- QVERIFY(!VideoSortFilterProxyModelData::mGenericFilterValue);
+ QVERIFY(VideoProxyModelData::mGenericFilterId == mpxId);
+ QVERIFY(!VideoProxyModelData::mGenericFilterValue);
QVERIFY(mTestObject->mModelReady == false);
QVERIFY(mTestObject->mAlbumListReady == false);
delete mTestObject;
mTestObject = new VideoListSelectionDialog(mTestUiLoader);
- VideoSortFilterProxyModelData::reset();
+ VideoProxyModelData::reset();
// No data. type EAddToCollection:. Default mpx item
setRowCount(0);
@@ -331,8 +333,8 @@
QVERIFY(mTestObject->mCheckBox != 0);
QVERIFY(mTestObject->mPrimaryAction != 0);
QVERIFY(mTestObject->mSecondaryAction != 0);
- QVERIFY(VideoSortFilterProxyModelData::mGenericFilterId == mpxId);
- QVERIFY(!VideoSortFilterProxyModelData::mGenericFilterValue);
+ QVERIFY(VideoProxyModelData::mGenericFilterId == mpxId);
+ QVERIFY(!VideoProxyModelData::mGenericFilterValue);
QVERIFY(mTestObject->mModelReady == false);
QVERIFY(mTestObject->mAlbumListReady == false);
@@ -356,14 +358,14 @@
QVERIFY(mTestObject->mCheckBox != 0);
QVERIFY(mTestObject->mPrimaryAction != 0);
QVERIFY(mTestObject->mSecondaryAction != 0);
- QVERIFY(VideoSortFilterProxyModelData::mGenericFilterId == mpxId);
- QVERIFY(!VideoSortFilterProxyModelData::mGenericFilterValue);
+ QVERIFY(VideoProxyModelData::mGenericFilterId == mpxId);
+ QVERIFY(!VideoProxyModelData::mGenericFilterValue);
QVERIFY(mTestObject->mModelReady == false);
QVERIFY(mTestObject->mAlbumListReady == false);
delete mTestObject;
mTestObject = new VideoListSelectionDialog(mTestUiLoader);
- VideoSortFilterProxyModelData::reset();
+ VideoProxyModelData::reset();
// No data. type ERemoveFromCollection:. Default mpx item
setRowCount(0);
@@ -385,14 +387,14 @@
QVERIFY(mTestObject->mCheckBox != 0);
QVERIFY(mTestObject->mPrimaryAction != 0);
QVERIFY(mTestObject->mSecondaryAction != 0);
- QVERIFY(VideoSortFilterProxyModelData::mGenericFilterId == mpxId);
- QVERIFY(VideoSortFilterProxyModelData::mGenericFilterValue);
+ QVERIFY(VideoProxyModelData::mGenericFilterId == mpxId);
+ QVERIFY(VideoProxyModelData::mGenericFilterValue);
QVERIFY(mTestObject->mModelReady == false);
QVERIFY(mTestObject->mAlbumListReady == false);
delete mTestObject;
mTestObject = new VideoListSelectionDialog(mTestUiLoader);
- VideoSortFilterProxyModelData::reset();
+ VideoProxyModelData::reset();
// Some data, mpx item type is album
setRowCount(10);
@@ -414,14 +416,14 @@
QVERIFY(mTestObject->mCheckBox != 0);
QVERIFY(mTestObject->mPrimaryAction != 0);
QVERIFY(mTestObject->mSecondaryAction != 0);
- QVERIFY(VideoSortFilterProxyModelData::mGenericFilterId == mpxId);
- QVERIFY(VideoSortFilterProxyModelData::mGenericFilterValue);
+ QVERIFY(VideoProxyModelData::mGenericFilterId == mpxId);
+ QVERIFY(VideoProxyModelData::mGenericFilterValue);
QVERIFY(mTestObject->mModelReady == false);
QVERIFY(mTestObject->mAlbumListReady == false);
delete mTestObject;
mTestObject = new VideoListSelectionDialog(mTestUiLoader);
- VideoSortFilterProxyModelData::reset();
+ VideoProxyModelData::reset();
// Some data, mpx item type is invalid: category
mpxId = TMPXItemId(0, KVcxMvcMediaTypeCategory);
@@ -442,14 +444,14 @@
QVERIFY(mTestObject->mCheckBox != 0);
QVERIFY(mTestObject->mPrimaryAction != 0);
QVERIFY(mTestObject->mSecondaryAction != 0);
- QVERIFY(VideoSortFilterProxyModelData::mGenericFilterId == mpxId);
- QVERIFY(VideoSortFilterProxyModelData::mGenericFilterValue);
+ QVERIFY(VideoProxyModelData::mGenericFilterId == mpxId);
+ QVERIFY(VideoProxyModelData::mGenericFilterValue);
QVERIFY(mTestObject->mModelReady == false);
QVERIFY(mTestObject->mAlbumListReady == false);
delete mTestObject;
mTestObject = new VideoListSelectionDialog(mTestUiLoader);
- VideoSortFilterProxyModelData::reset();
+ VideoProxyModelData::reset();
// Some data, mpx item type is invalid id
mpxId = TMPXItemId::InvalidId();
@@ -470,12 +472,12 @@
QVERIFY(mTestObject->mCheckBox != 0);
QVERIFY(mTestObject->mPrimaryAction != 0);
QVERIFY(mTestObject->mSecondaryAction != 0);
- QVERIFY(VideoSortFilterProxyModelData::mGenericFilterId == mpxId);
- QVERIFY(VideoSortFilterProxyModelData::mGenericFilterValue);
+ QVERIFY(VideoProxyModelData::mGenericFilterId == mpxId);
+ QVERIFY(VideoProxyModelData::mGenericFilterValue);
QVERIFY(mTestObject->mModelReady == false);
QVERIFY(mTestObject->mAlbumListReady == false);
- VideoSortFilterProxyModelData::reset();
+ VideoProxyModelData::reset();
// some data, second initialization without widget and model, for coverity
delete mTestObject->mListWidget;
mTestObject->mListWidget = 0;
@@ -498,8 +500,8 @@
QVERIFY(mTestObject->mCheckBox != 0);
QVERIFY(mTestObject->mPrimaryAction != 0);
QVERIFY(mTestObject->mSecondaryAction != 0);
- QVERIFY(VideoSortFilterProxyModelData::mGenericFilterId == mpxId);
- QVERIFY(VideoSortFilterProxyModelData::mGenericFilterValue);
+ QVERIFY(VideoProxyModelData::mGenericFilterId == mpxId);
+ QVERIFY(VideoProxyModelData::mGenericFilterValue);
QVERIFY(mTestObject->mModelReady == false);
QVERIFY(mTestObject->mAlbumListReady == false);
}
@@ -514,14 +516,14 @@
// initDialog fails because model get fails.
QVERIFY(mTestObject->mModel != 0);
- VideoSortFilterProxyModel *backup = mTestObject->mModel;
+ VideoProxyModelGeneric *backup = mTestObject->mModel;
VideoListWidget *backupWidget = mTestObject->mListWidget;
mTestObject->mModel = 0;
mTestObject->mListWidget = 0;
- VideoCollectionWrapperData::mGetModelFails = true;
+ VideoCollectionWrapperData::mGetGenericModelFails = true;
mpxId = TMPXItemId(0, KVcxMvcMediaTypeVideo);
mTestObject->setupContent(VideoListSelectionDialog::EDeleteVideos, mpxId);
- VideoCollectionWrapperData::mGetModelFails = false;
+ VideoCollectionWrapperData::mGetGenericModelFails = false;
QVERIFY(mTestObject->mModel == 0);
QVERIFY(mTestObject->mListWidget == 0);
QVERIFY(mTestObject->mListContainer == 0);
@@ -671,11 +673,11 @@
// finished with secondary action
VideoCollectionViewUtilsData::mLastError = -1;
HbDialog::execReturnPrimary = false;
- VideoSortFilterProxyModelData::reset();
+ VideoProxyModelData::reset();
mTestObject->exec();
QVERIFY(VideoCollectionViewUtilsData::mLastError == -1);
- QVERIFY(VideoSortFilterProxyModelData::mLastItemId == TMPXItemId::InvalidId());
- QVERIFY(!VideoSortFilterProxyModelData::mItemIds.count());
+ QVERIFY(VideoProxyModelData::mLastItemId == TMPXItemId::InvalidId());
+ QVERIFY(!VideoProxyModelData::mItemIds.count());
HbDialog::execReturnPrimary = true;
@@ -686,17 +688,17 @@
mTestObject->setupContent(VideoListSelectionDialog::ESelectCollection, mpxId);
mTestObject->mSelectedVideos.insert(TMPXItemId(1,0));
mTestObject->mSelectedVideos.insert(TMPXItemId(2,0));
- VideoSortFilterProxyModelData::reset();
- VideoSortFilterProxyModelData::mAddItemsInAlbumReturnValue = 0;
+ VideoProxyModelData::reset();
+ VideoProxyModelData::mAddItemsInAlbumReturnValue = 0;
mTestObject->exec();
// type of selection has changed
QVERIFY(mTestObject->mTypeOfSelection == VideoListSelectionDialog::EAddToCollection);
// videos added into collection
QVERIFY(VideoCollectionViewUtilsData::mLastError == VideoCollectionCommon::statusVideosAddedToCollection);
- QVERIFY(VideoSortFilterProxyModelData::mLastItemId == mpxId);
- QVERIFY(VideoSortFilterProxyModelData::mItemIds.count() == 2);
- QVERIFY(VideoSortFilterProxyModelData::mItemIds.at(0) == TMPXItemId(1,0));
- QVERIFY(VideoSortFilterProxyModelData::mItemIds.at(1) == TMPXItemId(2,0));
+ QVERIFY(VideoProxyModelData::mLastItemId == mpxId);
+ QVERIFY(VideoProxyModelData::mItemIds.count() == 2);
+ QVERIFY(VideoProxyModelData::mItemIds.at(0) == TMPXItemId(1,0));
+ QVERIFY(VideoProxyModelData::mItemIds.at(1) == TMPXItemId(2,0));
HbInputDialog *dialog = new HbInputDialog();
@@ -707,23 +709,23 @@
mTestObject->setupContent(VideoListSelectionDialog::ESelectCollection, mpxId);
mTestObject->mSelectedVideos.insert(TMPXItemId(1,0));
mTestObject->mSelectedVideos.insert(TMPXItemId(2,0));
- VideoSortFilterProxyModelData::reset();
- VideoSortFilterProxyModelData::mNewAlbumId = TMPXItemId::InvalidId();
+ VideoProxyModelData::reset();
+ VideoProxyModelData::mNewAlbumId = TMPXItemId::InvalidId();
mTestObject->exec();
dialog->emitDialogFinished(mTestObject, SLOT(newAlbumNameDialogFinished(HbAction *)), 1); // No selected.
// type of selection does not change
QVERIFY(mTestObject->mTypeOfSelection == VideoListSelectionDialog::EAddToCollection);
// since there's no selected videos, status code does not change
QVERIFY(VideoCollectionViewUtilsData::mLastError == -1);
- QVERIFY(VideoSortFilterProxyModelData::mLastItemId == TMPXItemId::InvalidId());
- QVERIFY(!VideoSortFilterProxyModelData::mItemIds.count());
+ QVERIFY(VideoProxyModelData::mLastItemId == TMPXItemId::InvalidId());
+ QVERIFY(!VideoProxyModelData::mItemIds.count());
// query for new album name sets selected
mTestObject->setupContent(VideoListSelectionDialog::ESelectCollection, mpxId);
mTestObject->mSelectedVideos.insert(TMPXItemId(1,0));
mTestObject->mSelectedVideos.insert(TMPXItemId(2,0));
- VideoSortFilterProxyModelData::reset();
- VideoSortFilterProxyModelData::mNewAlbumId = TMPXItemId(1,2);
+ VideoProxyModelData::reset();
+ VideoProxyModelData::mNewAlbumId = TMPXItemId(1,2);
HbInputDialog::mValueReturnValue = QVariant(QString("testname"));
mTestObject->exec();
dialog->emitDialogFinished(mTestObject, SLOT(newAlbumNameDialogFinished(HbAction *)), 0); // Yes selected.
@@ -731,10 +733,10 @@
QVERIFY(mTestObject->mTypeOfSelection == VideoListSelectionDialog::EAddToCollection);
// videos added into collection
QVERIFY(VideoCollectionViewUtilsData::mLastError == VideoCollectionCommon::statusVideosAddedToCollection);
- QVERIFY(VideoSortFilterProxyModelData::mLastItemId == VideoSortFilterProxyModelData::mNewAlbumId);
- QVERIFY(VideoSortFilterProxyModelData::mItemIds.count() == 2);
- QVERIFY(VideoSortFilterProxyModelData::mItemIds.at(0) == TMPXItemId(1,0));
- QVERIFY(VideoSortFilterProxyModelData::mItemIds.at(1) == TMPXItemId(2,0));
+ QVERIFY(VideoProxyModelData::mLastItemId == VideoProxyModelData::mNewAlbumId);
+ QVERIFY(VideoProxyModelData::mItemIds.count() == 2);
+ QVERIFY(VideoProxyModelData::mItemIds.at(0) == TMPXItemId(1,0));
+ QVERIFY(VideoProxyModelData::mItemIds.at(1) == TMPXItemId(2,0));
////////////
// mTypeOfSelection == EAddToCollection
@@ -743,48 +745,48 @@
mTestObject->setupContent(VideoListSelectionDialog::EAddToCollection, TMPXItemId::InvalidId());
mTestObject->mSelectedVideos.insert(TMPXItemId(1,0));
mTestObject->mSelectedVideos.insert(TMPXItemId(2,0));
- VideoSortFilterProxyModelData::reset();
+ VideoProxyModelData::reset();
mTestObject->exec();
QVERIFY(mTestObject->mTypeOfSelection == VideoListSelectionDialog::EAddToCollection);
QVERIFY(VideoCollectionViewUtilsData::mLastError == -1);
- QVERIFY(VideoSortFilterProxyModelData::mLastItemId == TMPXItemId::InvalidId());
- QVERIFY(!VideoSortFilterProxyModelData::mItemIds.count());
+ QVERIFY(VideoProxyModelData::mLastItemId == TMPXItemId::InvalidId());
+ QVERIFY(!VideoProxyModelData::mItemIds.count());
// no selected videos
mpxId = TMPXItemId(1, KVcxMvcMediaTypeAlbum);
mTestObject->setupContent(VideoListSelectionDialog::EAddToCollection, mpxId);
- VideoSortFilterProxyModelData::reset();
+ VideoProxyModelData::reset();
mTestObject->exec();
QVERIFY(mTestObject->mTypeOfSelection == VideoListSelectionDialog::EAddToCollection);
QVERIFY(VideoCollectionViewUtilsData::mLastError == -1);
- QVERIFY(VideoSortFilterProxyModelData::mLastItemId == TMPXItemId::InvalidId());
- QVERIFY(!VideoSortFilterProxyModelData::mItemIds.count());
+ QVERIFY(VideoProxyModelData::mLastItemId == TMPXItemId::InvalidId());
+ QVERIFY(!VideoProxyModelData::mItemIds.count());
// selected album exist, selected videos exists, add items fails
mTestObject->setupContent(VideoListSelectionDialog::EAddToCollection, mpxId);
mTestObject->mSelectedVideos.insert(TMPXItemId(1,0));
mTestObject->mSelectedVideos.insert(TMPXItemId(2,0));
- VideoSortFilterProxyModelData::reset();
- VideoSortFilterProxyModelData::mAddItemsInAlbumReturnValue = -1;
+ VideoProxyModelData::reset();
+ VideoProxyModelData::mAddItemsInAlbumReturnValue = -1;
mTestObject->exec();
QVERIFY(mTestObject->mTypeOfSelection == VideoListSelectionDialog::EAddToCollection);
QVERIFY(VideoCollectionViewUtilsData::mLastError == -1);
- QVERIFY(VideoSortFilterProxyModelData::mLastItemId == TMPXItemId::InvalidId());
- QVERIFY(!VideoSortFilterProxyModelData::mItemIds.count());
+ QVERIFY(VideoProxyModelData::mLastItemId == TMPXItemId::InvalidId());
+ QVERIFY(!VideoProxyModelData::mItemIds.count());
// selected album exist, selected videos exists, add items succeeds
mTestObject->setupContent(VideoListSelectionDialog::EAddToCollection, mpxId);
mTestObject->mSelectedVideos.insert(TMPXItemId(1,0));
mTestObject->mSelectedVideos.insert(TMPXItemId(2,0));
- VideoSortFilterProxyModelData::reset();
- VideoSortFilterProxyModelData::mAddItemsInAlbumReturnValue = 0;
+ VideoProxyModelData::reset();
+ VideoProxyModelData::mAddItemsInAlbumReturnValue = 0;
mTestObject->exec();
QVERIFY(mTestObject->mTypeOfSelection == VideoListSelectionDialog::EAddToCollection);
QVERIFY(VideoCollectionViewUtilsData::mLastError == VideoCollectionCommon::statusVideosAddedToCollection);
- QVERIFY(VideoSortFilterProxyModelData::mLastItemId == mpxId);
- QVERIFY(VideoSortFilterProxyModelData::mItemIds.count() == 2);
- QVERIFY(VideoSortFilterProxyModelData::mItemIds.at(0) == TMPXItemId(1,0));
- QVERIFY(VideoSortFilterProxyModelData::mItemIds.at(1) == TMPXItemId(2,0));
+ QVERIFY(VideoProxyModelData::mLastItemId == mpxId);
+ QVERIFY(VideoProxyModelData::mItemIds.count() == 2);
+ QVERIFY(VideoProxyModelData::mItemIds.at(0) == TMPXItemId(1,0));
+ QVERIFY(VideoProxyModelData::mItemIds.at(1) == TMPXItemId(2,0));
VideoCollectionViewUtilsData::mLastError = -1;
// selected album exist, selected videos exists, name for selected album exist
@@ -792,8 +794,8 @@
mTestObject->setupContent(VideoListSelectionDialog::ESelectCollection, mpxId);
mTestObject->mSelectedVideos.insert(TMPXItemId(1,0));
mTestObject->mSelectedVideos.insert(TMPXItemId(2,0));
- VideoSortFilterProxyModelData::reset();
- VideoSortFilterProxyModelData::mNewAlbumId = TMPXItemId(1,2);
+ VideoProxyModelData::reset();
+ VideoProxyModelData::mNewAlbumId = TMPXItemId(1,2);
mTestObject->exec();
dialog->emitDialogFinished(mTestObject, SLOT(newAlbumNameDialogFinished(HbAction *)), 0); // Yes selected.
// type of selection has changed
@@ -801,10 +803,10 @@
// videos added into collection
QVERIFY(VideoCollectionViewUtilsData::mLastError == VideoCollectionCommon::statusVideosAddedToCollection);
- QVERIFY(VideoSortFilterProxyModelData::mLastItemId == mpxId);
- QVERIFY(VideoSortFilterProxyModelData::mItemIds.count() == 2);
- QVERIFY(VideoSortFilterProxyModelData::mItemIds.at(0) == TMPXItemId(1,0));
- QVERIFY(VideoSortFilterProxyModelData::mItemIds.at(1) == TMPXItemId(2,0));
+ QVERIFY(VideoProxyModelData::mLastItemId == mpxId);
+ QVERIFY(VideoProxyModelData::mItemIds.count() == 2);
+ QVERIFY(VideoProxyModelData::mItemIds.at(0) == TMPXItemId(1,0));
+ QVERIFY(VideoProxyModelData::mItemIds.at(1) == TMPXItemId(2,0));
/////
// mTypeOfSelection == ERemoveFromCollection
@@ -813,47 +815,47 @@
mTestObject->setupContent(VideoListSelectionDialog::ERemoveFromCollection, TMPXItemId::InvalidId());
mTestObject->mSelectedVideos.insert(TMPXItemId(1,0));
mTestObject->mSelectedVideos.insert(TMPXItemId(2,0));
- VideoSortFilterProxyModelData::reset();
+ VideoProxyModelData::reset();
mTestObject->exec();
QVERIFY(mTestObject->mTypeOfSelection == VideoListSelectionDialog::ERemoveFromCollection);
QVERIFY(VideoCollectionViewUtilsData::mLastError == -1);
- QVERIFY(VideoSortFilterProxyModelData::mLastItemId == TMPXItemId::InvalidId());
- QVERIFY(!VideoSortFilterProxyModelData::mItemIds.count());
+ QVERIFY(VideoProxyModelData::mLastItemId == TMPXItemId::InvalidId());
+ QVERIFY(!VideoProxyModelData::mItemIds.count());
// no selected videos
mpxId = TMPXItemId(1, KVcxMvcMediaTypeAlbum);
mTestObject->setupContent(VideoListSelectionDialog::ERemoveFromCollection, mpxId);
- VideoSortFilterProxyModelData::reset();
+ VideoProxyModelData::reset();
mTestObject->exec();
QVERIFY(mTestObject->mTypeOfSelection == VideoListSelectionDialog::ERemoveFromCollection);
QVERIFY(VideoCollectionViewUtilsData::mLastError == -1);
- QVERIFY(VideoSortFilterProxyModelData::mLastItemId == TMPXItemId::InvalidId());
- QVERIFY(!VideoSortFilterProxyModelData::mItemIds.count());
+ QVERIFY(VideoProxyModelData::mLastItemId == TMPXItemId::InvalidId());
+ QVERIFY(!VideoProxyModelData::mItemIds.count());
// selected videos exists, removeitemsFromAlbum fails
mTestObject->setupContent(VideoListSelectionDialog::ERemoveFromCollection, mpxId);
mTestObject->mSelectedVideos.insert(TMPXItemId(1,0));
mTestObject->mSelectedVideos.insert(TMPXItemId(2,0));
- VideoSortFilterProxyModelData::reset();
- VideoSortFilterProxyModelData::mRemoveItemsFromAlbumReturnValue = -1;
+ VideoProxyModelData::reset();
+ VideoProxyModelData::mRemoveItemsFromAlbumReturnValue = -1;
mTestObject->exec();
QVERIFY(mTestObject->mTypeOfSelection == VideoListSelectionDialog::ERemoveFromCollection);
QVERIFY(VideoCollectionViewUtilsData::mLastError == -1);
- QVERIFY(VideoSortFilterProxyModelData::mLastItemId == TMPXItemId::InvalidId());
- QVERIFY(!VideoSortFilterProxyModelData::mItemIds.count());
+ QVERIFY(VideoProxyModelData::mLastItemId == TMPXItemId::InvalidId());
+ QVERIFY(!VideoProxyModelData::mItemIds.count());
mTestObject->setupContent(VideoListSelectionDialog::ERemoveFromCollection, mpxId);
mTestObject->mSelectedVideos.insert(TMPXItemId(1,0));
mTestObject->mSelectedVideos.insert(TMPXItemId(2,0));
- VideoSortFilterProxyModelData::reset();
- VideoSortFilterProxyModelData::mRemoveItemsFromAlbumReturnValue = 0;
+ VideoProxyModelData::reset();
+ VideoProxyModelData::mRemoveItemsFromAlbumReturnValue = 0;
mTestObject->exec();
QVERIFY(mTestObject->mTypeOfSelection == VideoListSelectionDialog::ERemoveFromCollection);
QVERIFY(VideoCollectionViewUtilsData::mLastError == VideoCollectionCommon::statusVideosRemovedFromCollection);
- QVERIFY(VideoSortFilterProxyModelData::mLastItemId == mpxId);
- QVERIFY(VideoSortFilterProxyModelData::mItemIds.count() == 2);
- QVERIFY(VideoSortFilterProxyModelData::mItemIds.at(0) == TMPXItemId(1,0));
- QVERIFY(VideoSortFilterProxyModelData::mItemIds.at(1) == TMPXItemId(2,0));
+ QVERIFY(VideoProxyModelData::mLastItemId == mpxId);
+ QVERIFY(VideoProxyModelData::mItemIds.count() == 2);
+ QVERIFY(VideoProxyModelData::mItemIds.at(0) == TMPXItemId(1,0));
+ QVERIFY(VideoProxyModelData::mItemIds.at(1) == TMPXItemId(2,0));
/////
// mTypeOfSelection == EDeleteVideos
@@ -861,7 +863,7 @@
mTestObject->setupContent(VideoListSelectionDialog::EDeleteVideos, mpxId);
mTestObject->mSelectedVideos.insert(TMPXItemId(1,0));
mTestObject->mSelectedVideos.insert(TMPXItemId(2,0));
- VideoSortFilterProxyModelData::reset();
+ VideoProxyModelData::reset();
mTestObject->exec();
QVERIFY(mTestObject->mTypeOfSelection == VideoListSelectionDialog::EDeleteVideos);
QVERIFY(VideoCollectionViewUtilsData::mLastError == VideoCollectionCommon::statusDeleteInProgress);
@@ -871,11 +873,11 @@
VideoCollectionViewUtilsData::mLastError = -1;
mTestObject->mSelectedVideos.insert(TMPXItemId(1,0));
mTestObject->mSelectedVideos.insert(TMPXItemId(2,0));
- VideoSortFilterProxyModelData::reset();
+ VideoProxyModelData::reset();
mTestObject->exec();
QVERIFY(mTestObject->mTypeOfSelection == 500);
QVERIFY(VideoCollectionViewUtilsData::mLastError == -1);
- QVERIFY(!VideoSortFilterProxyModelData::mItemIds.count());
+ QVERIFY(!VideoProxyModelData::mItemIds.count());
}
@@ -883,7 +885,7 @@
{
VideoCollectionWrapperData::reset();
VideoListWidgetData::reset();
- VideoSortFilterProxyModelData::reset();
+ VideoProxyModelData::reset();
mTestHelper->mTestable = mTestObject;
mTestHelper->connectSignals();
@@ -1168,8 +1170,8 @@
QCOMPARE(mTestObject->mSelectedVideos.count(), 0);
setRowCount(10);
- VideoSortFilterProxyModelData::mItemIds.append(TMPXItemId(0,0));
- VideoSortFilterProxyModelData::mItemIds.append(TMPXItemId(1,2));
+ VideoProxyModelData::mItemIds.append(TMPXItemId(0,0));
+ VideoProxyModelData::mItemIds.append(TMPXItemId(1,2));
// videos selected, other one's type is not video
QItemSelection selected;
@@ -1206,11 +1208,11 @@
mTestObject->mSelectedAlbumId = TMPXItemId(1,2);
// fetching collections model unsucceeds
- VideoCollectionWrapperData::mGetModelFails = true;
+ VideoCollectionWrapperData::mGetCollectionsModelFails = true;
mTestHelper->emitFinishedSlot(mTestObject->mPrimaryAction);
QVERIFY(VideoCollectionViewUtilsData::mLastStatusAdditional.isValid());
QVERIFY(!VideoCollectionViewUtilsData::mLastStatusAdditional.toString().length());
- VideoCollectionWrapperData::mGetModelFails = false;
+ VideoCollectionWrapperData::mGetCollectionsModelFails = false;
// invalid index for selected album
mTestHelper->emitFinishedSlot(mTestObject->mPrimaryAction);
@@ -1219,7 +1221,7 @@
// succeed case:
// need to add album ib into selected list, because stub proxy overwrites
- // VideoSortFilterProxyModelData::mItemIds at removeitems removeItemsFromAlbum -method
+ // VideoProxyModelData::mItemIds at removeitems removeItemsFromAlbum -method
// and we need valid index for id
QString testname("testname");
VideoListDataModelData::mData[VideoCollectionCommon::KeyTitle] = testname;
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/inc/videocollectionwrapper.h
--- a/videocollection/videocollectionwrapper/inc/videocollectionwrapper.h Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionwrapper/inc/videocollectionwrapper.h Fri Sep 03 12:37:43 2010 +0300
@@ -27,7 +27,7 @@
// FORWARD DECLARATIONS
class VideoCollectionWrapperPrivate;
-class VideoSortFilterProxyModel;
+class VideoProxyModelGeneric;
/**
@@ -39,7 +39,7 @@
* @code
* #include "videocollectioncommon.h"
* #include "videocollectionwrapper.h"
- * #include "videosortfilterproxymodel.h"
+ * #include "videoproxymodelgeneric.h"
*
* ...
* ////
@@ -47,7 +47,7 @@
* ////
* VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
* // getting all videos model
- * VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionCommon::EModelTypeAllVideos);
+ * VideoProxyModelGeneric *model = wrapper.getAllVideosModel();
* ...
* ////
* // Opening collection and start fetching video item data
@@ -80,16 +80,38 @@
static VideoCollectionWrapper &instance();
/**
- * Returns pointer to model. Null if creation fails or if
+ * Returns pointer to generic video model. Null if creation fails or if
* application is closing.
*
- * @param type of the model
+ * @return address to model or NULL if fails or if application is closing.
+ */
+ VideoProxyModelGeneric* getGenericModel();
+
+ /**
+ * Returns pointer to all videos model. Null if creation fails or if
+ * application is closing.
*
* @return address to model or NULL if fails or if application is closing.
*/
- VideoSortFilterProxyModel* getModel(VideoCollectionCommon::TModelType type);
+ VideoProxyModelGeneric* getAllVideosModel();
/**
+ * Returns pointer to collections model. Null if creation fails or if
+ * application is closing.
+ *
+ * @return address to model or NULL if fails or if application is closing.
+ */
+ VideoProxyModelGeneric* getCollectionsModel();
+
+ /**
+ * Returns pointer to collection content model. Null if creation fails or if
+ * application is closing.
+ *
+ * @return address to model or NULL if fails or if application is closing.
+ */
+ VideoProxyModelGeneric* getCollectionContentModel();
+
+ /**
* Method can be used by client to emit status signal
* containing status code from particular async status.
*
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/inc/videocollectionwrapper_p.h
--- a/videocollection/videocollectionwrapper/inc/videocollectionwrapper_p.h Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionwrapper/inc/videocollectionwrapper_p.h Fri Sep 03 12:37:43 2010 +0300
@@ -11,7 +11,7 @@
*
* Contributors:
*
-* Description: VideoCollectionWrapperPrivate class definition
+* Description: VideoCollectionWrapperPrivate class definition
*
*/
@@ -29,7 +29,10 @@
class CMPXMediaArray;
class CMPXMedia;
class VideoListDataModel;
-class VideoSortFilterProxyModel;
+class VideoProxyModelGeneric;
+class VideoProxyModelAllVideos;
+class VideoProxyModelCollections;
+class VideoProxyModelContent;
class VideoCollectionWrapperPrivate : public QObject
{
@@ -51,55 +54,138 @@
* Destructor
*/
~VideoCollectionWrapperPrivate();
+
+ /**
+ * Returns the pointer into generic video model. Creates the model if it doesn't
+ * exist yet.
+ *
+ * Noter that if application has signaled aboutToQuit -signal indicating closing, all
+ * previously created models have been removed and new ones will not be created
+ * anymore
+ *
+ * @return address of model, NULL if creation did not succeed or if application is closing.
+ */
+ VideoProxyModelGeneric* getGenericModel();
/**
- * Returns the pointer into model. Creates the model if it doesn't exists yet.
+ * Returns the pointer into all videos model. Creates the model if it doesn't exist yet.
*
* Noter that if application has signaled aboutToQuit -signal indicating closing, all
* previously created models have been removed and new ones will not be created
* anymore
- *
- * @param type type of model
+ *
+ * @return address of model, NULL if creation did not succeed or if application is closing.
+ */
+
+ VideoProxyModelGeneric* getAllVideosModel();
+
+ /**
+ * Returns the pointer into collections model. Creates the model if it doesn't exist yet.
+ *
+ * Noter that if application has signaled aboutToQuit -signal indicating closing, all
+ * previously created models have been removed and new ones will not be created
+ * anymore
+ *
* @return address of model, NULL if creation did not succeed or if application is closing.
*/
- VideoSortFilterProxyModel* getModel(VideoCollectionCommon::TModelType &type);
+
+ VideoProxyModelGeneric* getCollectionsModel();
+
+ /**
+ * Returns the pointer into collection content model. Creates the model if it doesn't
+ * exist yet.
+ *
+ * Noter that if application has signaled aboutToQuit -signal indicating closing, all
+ * previously created models have been removed and new ones will not be created
+ * anymore
+ *
+ * @return address of model, NULL if creation did not succeed or if application is closing.
+ */
+ VideoProxyModelGeneric* getCollectionContentModel();
private slots:
-
-
+
/**
* Signaled when UI environment is about to be destroyed.
* All models needs to be cleaned up before of that.
*
*/
void aboutToQuitSlot();
-
+
private:
+ /**
+ * Creates proxy model and returns the pointer.
+ *
+ * Noter that if application has signaled aboutToQuit -signal indicating closing, all
+ * previously created models have been removed and new ones will not be created
+ * anymore.
+ *
+ * @return address of model, NULL if creation did not succeed or if application is closing.
+ */
+ template
+ T *initProxyModelModel()
+ {
+ if(mAboutToClose)
+ {
+ return 0;
+ }
+
+ if(!initSourceModel())
+ {
+ return 0;
+ }
+
+ T *model = 0;
+
+ model = new T();
+
+ if(model->initialize(mSourceModel) ||
+ !connect(model, SIGNAL(shortDetailsReady(TMPXItemId)),
+ mSourceModel, SIGNAL(shortDetailsReady(TMPXItemId))))
+ {
+ delete model;
+ model = 0;
+ }
+
+ return model;
+ }
+
+private:
+
+ /**
+ * Initializes source model.
+ *
+ * @return true if initialization succeeds, otherwise false.
+ */
+ bool initSourceModel();
+
+private:
+
+ /**
+ * data model for collection content
+ */
+ QPointer mGenericModel;
+
/**
* data model for all videos
*/
- QPointer mAllVideosModel;
+ QPointer mAllVideosModel;
/**
* data model for collections
*/
- QPointer mCollectionsModel;
+ QPointer mCollectionsModel;
/**
* data model for collection content
*/
- QPointer mCollectionContentModel;
-
- /**
- * data model for collection content
- */
- QPointer mGenericModel;
+ QPointer mCollectionContentModel;
/**
* source model
*/
- QPointer mSourceModel;
+ QPointer mSourceModel;
/**
* flag to indicate, that object is to be deallocated, so no
@@ -111,6 +197,3 @@
#endif // __VIDEOCOLLECTIONWRAPPERPRIVATE_H__
// End of file
-
-
-
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/inc/videodatacontainer.h
--- a/videocollection/videocollectionwrapper/inc/videodatacontainer.h Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionwrapper/inc/videodatacontainer.h Fri Sep 03 12:37:43 2010 +0300
@@ -173,8 +173,3 @@
};
#endif // __VIDEODATACONTAINER_H__
-
-
-
-
-
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/inc/videoproxymodelallvideos.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/inc/videoproxymodelallvideos.h Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: VideoProxyModelAllVideos class definition
+*
+*/
+
+#ifndef VIDEOPROXYMODELALLVIDEOS_H
+#define VIDEOPROXYMODELALLVIDEOS_H
+
+// INCLUDES
+#include
+#include
+#include "videocollectioncommon.h"
+#include "videoproxymodelgeneric.h"
+
+// CLASS DECLARATION
+class VideoProxyModelAllVideos : public VideoProxyModelGeneric
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * Contructor.
+ *
+ * @param QObject parent object.
+ */
+ VideoProxyModelAllVideos(QObject *parent = 0);
+
+ /**
+ * Destructor.
+ *
+ */
+ virtual ~VideoProxyModelAllVideos();
+
+public:
+
+ /**
+ * Gets the currently opened item.
+ *
+ * @param None.
+ * @return TMPXItemId.
+ */
+ TMPXItemId getOpenItem() const;
+
+protected: // from QSortFilterProxyModel
+
+ /**
+ * Filtering functionality. Called by the fw.
+ *
+ * @param source_row row to check
+ * @param source_parent row's parent
+ *
+ * @return bool row accepted(true) or not accepted(false)
+ */
+ bool filterAcceptsRow(int source_row, const QModelIndex & source_parent) const;
+
+};
+
+#endif // VIDEOPROXYMODELALLVIDEOS_H
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/inc/videoproxymodelcollections.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/inc/videoproxymodelcollections.h Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: VideoProxyModelCollections class definition
+*
+*/
+
+#ifndef VIDEOPROXYMODELCOLLETIONS_H
+#define VIDEOPROXYMODELCOLLETIONS_H
+
+// INCLUDES
+#include
+#include
+#include "videocollectioncommon.h"
+#include "videoproxymodelgeneric.h"
+
+// CLASS DECLARATION
+class VideoProxyModelCollections : public VideoProxyModelGeneric
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * Contructor.
+ *
+ * @param QObject parent object.
+ */
+ VideoProxyModelCollections(QObject *parent = 0);
+
+ /**
+ * Destructor.
+ *
+ */
+ virtual ~VideoProxyModelCollections();
+
+protected: // from QSortFilterProxyModel
+
+ /**
+ * Compares items based in the role setted before sorting.
+ *
+ */
+ bool lessThan(const QModelIndex & left, const QModelIndex & right) const;
+
+ /**
+ * Filtering functionality. Called by the fw.
+ *
+ * @param source_row row to check
+ * @param source_parent row's parent
+ *
+ * @return bool row accepted(true) or not accepted(false)
+ */
+ bool filterAcceptsRow(int source_row, const QModelIndex & source_parent) const;
+
+};
+
+#endif // VIDEOPROXYMODELCOLLETIONS_H
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/inc/videoproxymodelcontent.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/inc/videoproxymodelcontent.h Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: VideoProxyModelContent class definition
+*
+*/
+
+#ifndef VIDEOPROXYMODELCONTENT_H
+#define VIDEOPROXYMODELCONTENT_H
+
+// INCLUDES
+#include
+#include
+#include "videocollectioncommon.h"
+#include "videoproxymodelgeneric.h"
+
+// CLASS DECLARATION
+class VideoProxyModelContent : public VideoProxyModelGeneric
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * Contructor.
+ *
+ * @param QObject parent object.
+ */
+ VideoProxyModelContent(QObject *parent = 0);
+
+ /**
+ * Destructor.
+ *
+ */
+ virtual ~VideoProxyModelContent();
+
+public:
+
+ /**
+ * Gets the currently opened item.
+ *
+ * @param None.
+ * @return TMPXItemId.
+ */
+ TMPXItemId getOpenItem() const;
+
+protected:
+
+ /**
+ * Connects all signals emitted from or throught this object.
+ *
+ * @return bool
+ */
+ bool connectSignals();
+
+ /**
+ * Disconnects all signals.
+ */
+ void disconnectSignals();
+
+protected: // from QSortFilterProxyModel
+
+ /**
+ * Filtering functionality. Called by the FW.
+ *
+ * @param source_row row to check
+ * @param source_parent row's parent
+ *
+ * @return bool row accepted(true) or not accepted(false)
+ */
+ bool filterAcceptsRow(int source_row, const QModelIndex & source_parent) const;
+
+private slots:
+
+ /**
+ * Signaled when particular album content has changed and
+ * refiltering is required.
+ */
+ void albumChangedSlot();
+
+};
+
+#endif // VIDEOPROXYMODELCONTENT_H
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/inc/videoproxymodelgeneric.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/inc/videoproxymodelgeneric.h Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,345 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: VideoProxyModelGeneric class definition
+*
+*/
+
+#ifndef VIDEOPROXYMODELGENERIC_H
+#define VIDEOPROXYMODELGENERIC_H
+
+// INCLUDES
+#include
+#include
+#include
+#include "videocollectionexport.h"
+#include "videocollectioncommon.h"
+
+// FORWARD DECLARATIONS
+class QTimer;
+class VideoListDataModel;
+class VideoCollectionClient;
+
+// CLASS DECLARATION
+class VIDEOCOLLECTION_DLL_EXPORT VideoProxyModelGeneric : public QSortFilterProxyModel
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * Contructor.
+ *
+ * @param QObject parent object.
+ */
+ VideoProxyModelGeneric(QObject *parent = 0);
+
+ /**
+ * Destructor.
+ *
+ */
+ virtual ~VideoProxyModelGeneric();
+
+ /**
+ * Initializes model. Sets the given sourceModel as source model
+ * for this proxy model.
+ *
+ * @param sourceModel the source model
+ *
+ * @return int 0 if initialization was ok.
+ */
+ virtual int initialize(VideoListDataModel *sourceModel);
+
+public:
+
+ /**
+ * First call opens the collection at the defined level. Subsequent calls only change the level.
+ * This starts populating the model data from the MyVideos collection plugin.
+ *
+ * @param level The level where the collection is opened.
+ * @return 0 if opening was successful, negative if not.
+ */
+ int open(VideoCollectionCommon::TCollectionLevels level);
+
+ /**
+ * Starts sorting. If async parameter is defined as true uses idle timer:
+ * starts timer with zero interval. When system has time to run timer sort()
+ * -method is called. If async is false, then the sort() -method is called
+ * immediatelly.
+ *
+ * @param sortingRole The role that sorting is done by.
+ * @param sortingOrder The sorting order, e.g. ascending or descending.
+ * @param async Defines if the sorting is done asyncronously or not. Default
+ * is true.
+ */
+ void doSorting(int sortingRole, Qt::SortOrder order, bool async = true);
+
+ /**
+ * To get current actice sorting parameters of the model
+ *
+ * @param sortingRole The role that sorting is done by.
+ * @param sortingOrder The sorting order, e.g. ascending or descending.
+ */
+ void getSorting(int &sortingRole, Qt::SortOrder &order);
+
+ /**
+ * Method to delete items at provided indeces
+ *
+ * @param indexList list of indeces.
+ * @return int 0 succeeds, -1 does not succeed.
+ */
+ int deleteItems(const QModelIndexList &indexList);
+
+ /**
+ * Opens the defined item. This is quite abstract as depending
+ * on the type of the item, the behaviour or result could be
+ * quite different.
+ *
+ * @param item id id of the item to be opened
+ * @return int 0 succeeds, <0 if opening does not succeed.
+ */
+ virtual int openItem(TMPXItemId mediaId);
+
+ /**
+ * Return to collection level
+ *
+ */
+ int back();
+
+ /**
+ * Starts fetching full details for the defined item.
+ *
+ * @param index index of the item from where to get details from
+ * @return int 0 succeeds, < 0 if detail fetching startup does not succeed.
+ */
+ int fetchItemDetails(const QModelIndex &index);
+
+ /**
+ * Method checks that model exists and asks for mpx id from
+ * given object.
+ *
+ * @param index index of the item in UI.
+ * @return TMPXItemId mpx id if succeeds TMPXItemId::InvalidId() in case of error
+ *
+ */
+ const TMPXItemId& getMediaIdAtIndex(const QModelIndex &index) const;
+
+ /**
+ * returns qmodelindex of item id provided.
+ *
+ * @param item id
+ * @return QModelIndex;
+ */
+ QModelIndex indexOfId(const TMPXItemId &id);
+
+ /**
+ * Method checks that model exists and asks for file path from
+ * given object.
+ *
+ * @param mediaId id of the item.
+ * @return QString file path if succeeds, empty string in case of error.
+ *
+ */
+ QString getMediaFilePathForId(const TMPXItemId &mediaId);
+
+ /**
+ * Add a new album.
+ *
+ * @param title, Album title.
+ * @param mediaIds, Media items to add in the album.
+ * @return TMPXItemId id of created album TMPXItemId:::InvalidId() in case of failure
+ */
+ TMPXItemId addNewAlbum(const QString &title);
+
+ /**
+ * Remove an album.
+ *
+ * @param indexList, list of album indexes to be removed.
+ * @return 0 if no errors.
+ */
+ int removeAlbums(const QModelIndexList &indexList);
+
+ /**
+ * Add items in an existing album.
+ *
+ * @param albumId, Album where to add items.
+ * @param mediaIds, list of item ids
+ * @return 0 if no errors.
+ */
+ int addItemsInAlbum(TMPXItemId &albumId, const QList &mediaIds);
+
+ /**
+ * Removes items from existing album.
+ *
+ * @param albumId, Album where to add items.
+ * @param mediaIds, list of item ids
+ * @return 0 if no errors.
+ */
+ int removeItemsFromAlbum(TMPXItemId &albumId, const QList &mediaIds);
+
+ /**
+ * Renames a video or user defined colletion.
+ *
+ * @param itemId, id of item to be renamed.
+ * @param newTitle, New title for the item.
+ * @return 0 if no errors.
+ */
+ int renameItem(const TMPXItemId &itemId, const QString &newTitle);
+
+ /**
+ * Resolves duplicate album names and returns the resolved name.
+ * 'New collection' -> 'New collection (1)' -> 'New collection (2)', etc.
+ *
+ * @param albumName, Name specified by the user.
+ * @return Resolved name given to the album.
+ */
+ QString resolveAlbumName(const QString& albumName) const;
+
+ /**
+ * sets item id filter used in generic proxy model
+ * while filtering rows.
+ *
+ * If provided filterValue -flag is true, we filter off items that
+ * do not exist in container indicated as itemId.
+ * If false, filtering works other way around.
+ *
+ *
+ * @param filterValue item id used as filter
+ * @param filterValue
+ */
+ virtual void setGenericIdFilter(const TMPXItemId &itemId, bool filterValue);
+
+ /**
+ * Set album in use and invalidates filtering.
+ *
+ * @param albumId album id
+ */
+ virtual void setAlbumInUse(const TMPXItemId &albumId);
+
+ /**
+ * Gets the currently opened item.
+ *
+ * @param None.
+ * @return TMPXItemId.
+ */
+ virtual TMPXItemId getOpenItem() const;
+
+signals:
+
+ /**
+ * Signal to be emitted if detail fetching started ok
+ *
+ * @param index, index of the item
+ */
+ void shortDetailsReady(TMPXItemId itemId);
+
+ /**
+ * Notifies that model has been sorted.
+ */
+ void modelSorted();
+
+protected:
+
+ /**
+ * Compares items based in the role setted before sorting. From QSortFilterProxyModel.
+ *
+ */
+ virtual bool lessThan(const QModelIndex & left, const QModelIndex & right) const;
+
+ /**
+ * Filtering functionality. Called by the FW. From QSortFilterProxyModel.
+ *
+ * @param source_row row to check
+ * @param source_parent row's parent
+ *
+ * @return bool row accepted(true) or not accepted(false)
+ */
+ virtual bool filterAcceptsRow(int source_row, const QModelIndex & source_parent) const;
+
+ /**
+ * Connects all signals emitted from or throught this object.
+ *
+ * @return bool
+ */
+ virtual bool connectSignals();
+
+ /**
+ * Disconnects all signals.
+ */
+ virtual void disconnectSignals();
+
+ /**
+ * Does actual sorting and emits sortingReady.
+ *
+ */
+ virtual void processSorting();
+
+private slots:
+
+ /**
+ * Timeout slot for zero timer. Stops timer and calls processSorting.
+ *
+ */
+ void processSortingSlot();
+
+protected:
+
+ /**
+ * Pointer to the actual model.
+ * Not owned.
+ */
+ VideoListDataModel *mModel;
+
+ /**
+ * Collection client.
+ * Not owned.
+ */
+ VideoCollectionClient *mCollectionClient;
+
+ /**
+ * Currently open level.
+ */
+ VideoCollectionCommon::TCollectionLevels mLevel;
+
+ /**
+ * Item id used as filter if model type is generic model.
+ */
+ TMPXItemId mGenericFilterId;
+
+ /**
+ * Flag used.
+ */
+ bool mGenericFilterValue;
+
+ /**
+ * Timer object. Owned.
+ */
+ QTimer *mIdleSortTimer;
+
+ /**
+ * Sort role to be setted after idle timer time outs for sorting to be able to be executed.
+ */
+ int mWantedSortRole;
+
+ /**
+ * Sort order (ascending or descending).
+ */
+ Qt::SortOrder mWantedSortOrder;
+
+ /*
+ * Default sort role for the model.
+ */
+ int mDefaultSortRole;
+};
+
+#endif // VIDEOPROXYMODELGENERIC_H
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/inc/videosortfilterproxymodel.h
--- a/videocollection/videocollectionwrapper/inc/videosortfilterproxymodel.h Mon Aug 23 14:27:29 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,375 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Videolist sort filter proxy implementation
-*
-*/
-
-#ifndef VIDEOSORTFILTERPROXYMODEL_H
-#define VIDEOSORTFILTERPROXYMODEL_H
-
-#include
-#include
-#include
-#include "videocollectionexport.h"
-#include "videocollectioncommon.h"
-
-class QTimer;
-class VideoListDataModel;
-class VideoCollectionClient;
-
-class VIDEOCOLLECTION_DLL_EXPORT VideoSortFilterProxyModel : public QSortFilterProxyModel
-{
- Q_OBJECT
-
-public:
-
- /**
- * Contructor.
- *
- * @param parent parent of this widget
- * @param client Collection client pointer to use.
- */
- VideoSortFilterProxyModel(VideoCollectionCommon::TModelType type, QObject *parent=0);
-
- /**
- * Destructor.
- *
- */
- virtual ~VideoSortFilterProxyModel();
-
- /**
- * Initializes model, calls initialize to source model, and sets
- * the given sourceModel as source model for this proxy model.
- *
- * @param collection mpx video collectionobject
- * @param sourceModel the source model
- *
- * @return int: 0 if everything ok
- */
- int initialize(VideoListDataModel *sourceModel);
-
-public:
-
- /**
- * First call opens the collection at the defined level. Subsequent calls only change the level.
- * This starts populating the model data from the MyVideos collection plugin.
- *
- * @param level The level where the collection is opened.
- * @return 0 if opening was successful, negative if not.
- */
- int open(VideoCollectionCommon::TCollectionLevels level);
-
- /**
- * Starts sorting. If async parameter is defined as true uses idle timer:
- * starts timer with zero interval. When system has time to run timer sort()
- * -method is called. If async is false, then the sort() -method is called
- * immediatelly.
- *
- * @param sortingRole The role that sorting is done by.
- * @param sortingOrder The sorting order, e.g. ascending or descending.
- * @param async Defines if the sorting is done asyncronously or not. Default
- * is true.
- */
- void doSorting(int sortingRole, Qt::SortOrder order, bool async = true);
-
- /**
- * To get current actice sorting parameters of the model
- *
- * @param sortingRole The role that sorting is done by.
- * @param sortingOrder The sorting order, e.g. ascending or descending.
- */
- void getSorting(int &sortingRole, Qt::SortOrder &order);
-
-
- /**
- * Method to delete items at provided indeces
- *
- * @param indexList list of indeces.
- * @return int 0 succeeds, -1 does not succeed.
- */
- int deleteItems(const QModelIndexList &indexList);
-
- /**
- * Opens the defined item. This is quite abstract as depending
- * on the type of the item, the behaviour or result could be
- * quite different.
- *
- * @param item id id of the item to be opened
- * @return int 0 succeeds, <0 if opening does not succeed.
- */
- int openItem(TMPXItemId mediaId);
-
- /**
- * Return to collection level
- *
- */
- int back();
-
- /**
- * Starts fetching full details for the defined item.
- *
- * @param index index of the item from where to get details from
- * @return int 0 succeeds, < 0 if detail fetching startup does not succeed.
- */
- int fetchItemDetails(const QModelIndex &index);
-
- /**
- * Method checks that model exists and asks for mpx id from
- * given object.
- *
- * @param index index of the item in UI.
- * @return TMPXItemId mpx id if succeeds TMPXItemId::InvalidId() in case of error
- *
- */
- const TMPXItemId& getMediaIdAtIndex(const QModelIndex &index) const;
-
- /**
- * returns qmodelindex of item id provided.
- *
- * @param item id
- * @return QModelIndex;
- */
- QModelIndex indexOfId(const TMPXItemId &id);
-
- /**
- * Method checks that model exists and asks for file path from
- * given object.
- *
- * @param mediaId id of the item.
- * @return QString file path if succeeds, empty string in case of error.
- *
- */
- QString getMediaFilePathForId(const TMPXItemId &mediaId);
-
- /**
- * Add a new album.
- *
- * @param title, Album title.
- * @param mediaIds, Media items to add in the album.
- * @return TMPXItemId id of created album TMPXItemId:::InvalidId() in case of failure
- */
- TMPXItemId addNewAlbum(const QString &title);
-
- /**
- * Remove an album.
- *
- * @param indexList, list of album indexes to be removed.
- * @return 0 if no errors.
- */
- int removeAlbums(const QModelIndexList &indexList);
-
- /**
- * Add items in an existing album.
- *
- * @param albumId, Album where to add items.
- * @param mediaIds, list of item ids
- * @return 0 if no errors.
- */
- int addItemsInAlbum(TMPXItemId &albumId, const QList &mediaIds);
-
- /**
- * Removes items from existing album.
- *
- * @param albumId, Album where to add items.
- * @param mediaIds, list of item ids
- * @return 0 if no errors.
- */
- int removeItemsFromAlbum(TMPXItemId &albumId, const QList &mediaIds);
-
- /**
- * Renames a video or user defined colletion.
- *
- * @param itemId, id of item to be renamed.
- * @param newTitle, New title for the item.
- * @return 0 if no errors.
- */
- int renameItem(const TMPXItemId &itemId, const QString &newTitle);
-
- /**
- * Resolves duplicate album names and returns the resolved name.
- * 'New collection' -> 'New collection (1)' -> 'New collection (2)', etc.
- *
- * @param albumName, Name specified by the user.
- * @return Resolved name given to the album.
- */
- QString resolveAlbumName(const QString& albumName) const;
-
- /**
- * sets item id filter used in generic proxy model
- * while filtering rows.
- *
- * If provided filterValue -flag is true, we filter off items that
- * do not exist in container indicated as itemId.
- * If false, filtering works other way around.
- *
- *
- * @param filterValue item id used as filter
- * @param filterValue
- */
- void setGenericIdFilter(const TMPXItemId &itemId, bool filterValue);
-
- /**
- * Set album in use and invalidates filtering.
- *
- * @param albumId album id
- */
- void setAlbumInUse(const TMPXItemId &albumId);
-
- /**
- * Gets the currently opened item.
- *
- * @param None.
- * @return TMPXItemId.
- */
- TMPXItemId getOpenItem() const;
-
- /**
- * Gets the type of model.
- *
- * @param None.
- * @return TModelType.
- */
- VideoCollectionCommon::TModelType getType();
-
-signals:
-
- /**
- * Signal to be emitted if detail fetching started ok
- *
- * @param index, index of the item
- */
- void shortDetailsReady(TMPXItemId itemId);
-
- /**
- * Signals that the model is ready, ie. that all data has been
- * loaded from myvideoscollection.
- */
- void modelReady();
-
- /**
- * Notifies that model's physical data structure has changed:
- * - item inserted
- * - item removed
- */
- void modelChanged();
-
- /**
- * Notifies that model has been sorted.
- */
- void modelSorted();
-
-protected: // from QSortFilterProxyModel
-
- /**
- * Compares items based in the role setted before sorting.
- *
- */
- bool lessThan ( const QModelIndex & left, const QModelIndex & right ) const;
-
- /**
- * Filtering functionality. Called by the fw.
- *
- * @param source_row row to chexk
- * @param source_parent row's parent
- *
- * @return bool row accepted(true) or not accepted(false)
- */
- bool filterAcceptsRow ( int source_row, const QModelIndex & source_parent ) const;
-
-private slots:
-
- /**
- * Timeout slot for zero timer. Stops timer and calls sort().
- * After call is finished, emits sortingReady.
- *
- */
- void processSorting();
-
- /**
- * signaled when particular album content has changed and
- * refiltering is required
- */
- void albumChangedSlot();
-
-private:
-
- /**
- * disabled contructor
- */
- VideoSortFilterProxyModel(QObject *parent=0);
-
- /**
- * connects all signals emitted from or throught this object
- *
- * @return bool
- */
- bool connectSignals();
-
- /**
- * disconnects all signals
- */
- void disconnectSignals();
-
-private:
-
- /**
- * Pointer to the actual model.
- * Not owned.
- */
- VideoListDataModel *mModel;
-
- /**
- * Collection client.
- * Not owned.
- */
- VideoCollectionClient *mCollectionClient;
-
- /**
- * type of data excepted
- */
- VideoCollectionCommon::TModelType mType;
-
- /**
- * Currently open level.
- */
- VideoCollectionCommon::TCollectionLevels mLevel;
-
- /**
- * item id used as filter if model type is generic model
- */
- TMPXItemId mGenericFilterId;
-
- /**
- * flag used
- */
- bool mGenericFilterValue;
-
- /**
- * Timer object. Owned.
- */
- QTimer *mIdleSortTimer;
-
- /**
- * sort role to be setted after idle timer time outs for sorting to be able to be executed
- */
- int mWantedSortRole;
-
- /**
- * sort order (ascending or descending).
- */
- Qt::SortOrder mWantedSortOrder;
-
-};
-
-#endif //VIDEOSORTFILTERPROXYMODEL_H
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/inc/videothumbnaildata.h
--- a/videocollection/videocollectionwrapper/inc/videothumbnaildata.h Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionwrapper/inc/videothumbnaildata.h Fri Sep 03 12:37:43 2010 +0300
@@ -27,7 +27,7 @@
// FORWARD DECLARATIONS
class VideoThumbnailDataPrivate;
-class VideoSortFilterProxyModel;
+class VideoProxyModelGeneric;
// CLASS DECLARATIONS
@@ -95,7 +95,7 @@
* @param fetchIndex index where to start the background thumbnail fetching.
*
*/
- void startBackgroundFetching(VideoSortFilterProxyModel *model, int fetchIndex);
+ void startBackgroundFetching(VideoProxyModelGeneric *model, int fetchIndex);
/**
* Enables or disables thumbnail background fetching. Default is enabled.
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/inc/videothumbnaildata_p.h
--- a/videocollection/videocollectionwrapper/inc/videothumbnaildata_p.h Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionwrapper/inc/videothumbnaildata_p.h Fri Sep 03 12:37:43 2010 +0300
@@ -31,7 +31,7 @@
// FORWARD DECLARATIONS
class VideoCollectionWrapper;
-class VideoSortFilterProxyModel;
+class VideoProxyModelGeneric;
class QModelIndex;
class QTimer;
class VideoThumbnailFetcher;
@@ -86,7 +86,7 @@
* @param model model of the items for the fetching.
* @param fetchIndex index where to start the background thumbnail fetching.
*/
- void startBackgroundFetching(VideoSortFilterProxyModel *model, int fetchIndex);
+ void startBackgroundFetching(VideoProxyModelGeneric *model, int fetchIndex);
/**
* Enables or disables thumbnail background fetching.
@@ -193,10 +193,10 @@
*
* @param iconName name of the file or resource.
*
- * @return HbIcon the icon load from resource or file.
+ * @return QIcon the icon load from resource or file.
*
*/
- HbIcon loadIcon(QString iconName);
+ QIcon *loadIcon(QString iconName);
/**
* Starts timer that continues the background thumbnail fetching at timeout.
@@ -254,7 +254,7 @@
private: // Data
- VideoThumbnailFetcher *mThumbnailFetcher;
+ VideoThumbnailFetcher *mThumbnailFetcher;
/**
* Local cache for thumbnail data:
@@ -262,19 +262,19 @@
* - data is the actual thumbnail data.
* If thumbnail data is not yet fetched, QIcon is default thumbnail.
*/
- QCache mThumbnailData;
+ QCache mThumbnailData;
/**
* Local hash for default thumbnails.
* - key is mpx item id defining default tn type
- * - data is the actual thumbnail data.
+ * - data is the actual thumbnail data.
*/
- QHash mDefaultThumbnails;
+ QHash mDefaultThumbnails;
/**
* Current model, set at call to startBackgroundFetching.
*/
- QPointer mCurrentModel;
+ QPointer mCurrentModel;
/**
* Current index for background thumbnail fetching.
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/src/videocollectionwrapper.cpp
--- a/videocollection/videocollectionwrapper/src/videocollectionwrapper.cpp Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionwrapper/src/videocollectionwrapper.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -15,14 +15,14 @@
*
*/
-// Version : %version: 31 %
+// Version : %version: 32 %
// INCLUDE FILES
#include
#include "videocollectionwrapper.h"
#include "videocollectionwrapper_p.h"
-#include "videosortfilterproxymodel.h"
+#include "videoproxymodelgeneric.h"
#include "videocollectiontrace.h"
// -----------------------------------------------------------------------------
@@ -59,15 +59,57 @@
}
// -----------------------------------------------------------------------------
-// CVideoCollectionWrapper::getModel()
+// CVideoCollectionWrapper::getGenericModel()
// -----------------------------------------------------------------------------
//
-VideoSortFilterProxyModel* VideoCollectionWrapper::getModel(VideoCollectionCommon::TModelType type)
+VideoProxyModelGeneric* VideoCollectionWrapper::getGenericModel()
+{
+ FUNC_LOG;
+ if(d)
+ {
+ return d->getGenericModel();
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// CVideoCollectionWrapper::getAllVideosModel()
+// -----------------------------------------------------------------------------
+//
+VideoProxyModelGeneric* VideoCollectionWrapper::getAllVideosModel()
{
FUNC_LOG;
if(d)
{
- return d->getModel(type);
+ return d->getAllVideosModel();
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// CVideoCollectionWrapper::getCollectionsModel()
+// -----------------------------------------------------------------------------
+//
+VideoProxyModelGeneric* VideoCollectionWrapper::getCollectionsModel()
+{
+ FUNC_LOG;
+ if(d)
+ {
+ return d->getCollectionsModel();
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// CVideoCollectionWrapper::getCollectionContentModel()
+// -----------------------------------------------------------------------------
+//
+VideoProxyModelGeneric* VideoCollectionWrapper::getCollectionContentModel()
+{
+ FUNC_LOG;
+ if(d)
+ {
+ return d->getCollectionContentModel();
}
return 0;
}
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/src/videocollectionwrapper_p.cpp
--- a/videocollection/videocollectionwrapper/src/videocollectionwrapper_p.cpp Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionwrapper/src/videocollectionwrapper_p.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 27 %
+// Version : %version: 30 %
// INCLUDE FILES
#include
@@ -25,7 +25,10 @@
#include "videocollectionwrapper.h"
#include "videocollectionwrapper_p.h"
#include "videolistdatamodel.h"
-#include "videosortfilterproxymodel.h"
+#include "videoproxymodelgeneric.h"
+#include "videoproxymodelallvideos.h"
+#include "videoproxymodelcollections.h"
+#include "videoproxymodelcontent.h"
#include "videocollectionclient.h"
#include "videocollectioncommon.h"
#include "videocollectiontrace.h"
@@ -37,13 +40,13 @@
// VideoCollectionWrapperPrivate::VideoCollectionWrapperPrivate()
// -----------------------------------------------------------------------------
//
-VideoCollectionWrapperPrivate::VideoCollectionWrapperPrivate()
- : mAllVideosModel( 0 )
- , mCollectionsModel( 0 )
- , mCollectionContentModel( 0 )
- , mGenericModel( 0 )
- , mSourceModel( 0 )
- , mAboutToClose( false )
+VideoCollectionWrapperPrivate::VideoCollectionWrapperPrivate() :
+ mGenericModel( 0 ),
+ mAllVideosModel( 0 ),
+ mCollectionsModel( 0 ),
+ mCollectionContentModel( 0 ),
+ mSourceModel( 0 ),
+ mAboutToClose( false )
{
FUNC_LOG;
// NOP
@@ -58,85 +61,83 @@
FUNC_LOG;
}
+// -----------------------------------------------------------------------------
+// VideoCollectionWrapperPrivate::getGenericModel()
+// -----------------------------------------------------------------------------
+//
+VideoProxyModelGeneric* VideoCollectionWrapperPrivate::getGenericModel()
+{
+ FUNC_LOG;
+ if(!mGenericModel)
+ {
+ mGenericModel = initProxyModelModel();
+ }
+ return mGenericModel;
+}
// -----------------------------------------------------------------------------
-// VideoCollectionWrapperPrivate::getModel()
+// VideoCollectionWrapperPrivate::getAllVideosModel()
+// -----------------------------------------------------------------------------
+//
+VideoProxyModelGeneric* VideoCollectionWrapperPrivate::getAllVideosModel()
+{
+ FUNC_LOG;
+ if(!mAllVideosModel)
+ {
+ mAllVideosModel = initProxyModelModel();
+ }
+ return mAllVideosModel;
+}
+
+// -----------------------------------------------------------------------------
+// VideoCollectionWrapperPrivate::getCollectionsModel()
// -----------------------------------------------------------------------------
//
-VideoSortFilterProxyModel* VideoCollectionWrapperPrivate::getModel(VideoCollectionCommon::TModelType &type)
+VideoProxyModelGeneric* VideoCollectionWrapperPrivate::getCollectionsModel()
+{
+ FUNC_LOG;
+ if(!mCollectionsModel)
+ {
+ mCollectionsModel = initProxyModelModel();
+ }
+ return mCollectionsModel;
+}
+
+// -----------------------------------------------------------------------------
+// VideoCollectionWrapperPrivate::getCollectionContentModel()
+// -----------------------------------------------------------------------------
+//
+VideoProxyModelGeneric* VideoCollectionWrapperPrivate::getCollectionContentModel()
{
- FUNC_LOG;
- INFO_1("VideoCollectionWrapperPrivate::getModel() type: %d", type);
-
- if(mAboutToClose)
+ FUNC_LOG;
+ if(!mCollectionContentModel)
{
- return 0;
+ mCollectionContentModel = initProxyModelModel();
}
+ return mCollectionContentModel;
+}
+
+// -----------------------------------------------------------------------------
+// VideoCollectionWrapperPrivate::initSourceModel()
+// -----------------------------------------------------------------------------
+//
+bool VideoCollectionWrapperPrivate::initSourceModel()
+{
+ FUNC_LOG;
- VideoSortFilterProxyModel *model = 0;
if(!mSourceModel)
{
mSourceModel = new VideoListDataModel();
- if(!mSourceModel || mSourceModel->initialize() < 0 ||
+ if(mSourceModel->initialize() < 0 ||
!connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(aboutToQuitSlot())) )
{
- ERROR(-1, "VideoCollectionWrapperPrivate::getModel() sourceModel setup failed.");
- return 0;
+ delete mSourceModel;
+ mSourceModel = 0;
+ ERROR(-1, "VideoCollectionWrapperPrivate::initSourceModel() sourceModel setup failed.");
+ return false;
}
}
- bool needsInitialization = false;
- if(type == VideoCollectionCommon::EModelTypeAllVideos)
- {
- if(!mAllVideosModel)
- {
- mAllVideosModel = new VideoSortFilterProxyModel(type);
- needsInitialization = true;
- }
- model = mAllVideosModel;
- }
- else if(type == VideoCollectionCommon::EModelTypeCollections)
- {
- if(!mCollectionsModel)
- {
- mCollectionsModel = new VideoSortFilterProxyModel(type);
- needsInitialization = true;
- }
- model = mCollectionsModel;
- }
- else if(type == VideoCollectionCommon::EModelTypeCollectionContent)
- {
- if(!mCollectionContentModel)
- {
- mCollectionContentModel = new VideoSortFilterProxyModel(type);
- needsInitialization = true;
- }
- model = mCollectionContentModel;
- }
- else if(type == VideoCollectionCommon::EModelTypeGeneric)
- {
- if(!mGenericModel)
- {
- mGenericModel = new VideoSortFilterProxyModel(type);
- needsInitialization = true;
- }
- model = mGenericModel;
- }
-
- if(needsInitialization)
- {
- if(model && model->initialize(mSourceModel) < 0)
- {
- ERROR(-1, "VideoCollectionWrapperPrivate::getModel() no model or init failed.");
- delete model;
- return 0;
- }
- if(!connect(model, SIGNAL(shortDetailsReady(TMPXItemId)), mSourceModel, SIGNAL(shortDetailsReady(TMPXItemId))))
- {
- delete model;
- return 0;
- }
- }
- return model;
+ return true;
}
// -----------------------------------------------------------------------------
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/src/videolistdatamodel_p.cpp
--- a/videocollection/videocollectionwrapper/src/videolistdatamodel_p.cpp Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionwrapper/src/videolistdatamodel_p.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 38.1.6 %
+// Version : %version: 38.1.7 %
// INCLUDE FILES
#include
@@ -126,10 +126,30 @@
//
const QString VideoListDataModelPrivate::getVideoNameFromIndex(const int &index ) const
{
- QString txt;
CMPXMedia* media = mMediaData.fromIndex(index);
- VideoCollectionUtils::instance().mediaValue(media, KMPXMediaGeneralTitle, txt );
- return txt;
+ QString text;
+
+ TMPXItemId mpxId( 0, 0 );
+ VideoCollectionUtils::instance().mediaValue(media, KMPXMediaGeneralId, mpxId );
+
+ //Localize default categories
+ if(mpxId.iId2 == KVcxMvcMediaTypeCategory)
+ {
+ switch(mpxId.iId1)
+ {
+ case KVcxMvcCategoryIdDownloads:
+ text = hbTrId("txt_videos_dblist_downloaded");
+ break;
+ case KVcxMvcCategoryIdCaptured:
+ text = hbTrId("txt_videos_dblist_captured");
+ break;
+ }
+ }
+ else
+ {
+ VideoCollectionUtils::instance().mediaValue(media, KMPXMediaGeneralTitle, text );
+ }
+ return text;
}
// -----------------------------------------------------------------------------
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/src/videoproxymodelallvideos.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/src/videoproxymodelallvideos.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: VideoProxyModelAllVideos implementation
+*
+*/
+
+// Version :
+
+// INCLUDE FILES
+#include
+#include "videoproxymodelgeneric.h"
+#include "videoproxymodelallvideos.h"
+#include "videolistdatamodel.h"
+#include "videocollectiontrace.h"
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelAllVideos::VideoProxyModelGeneric
+// -----------------------------------------------------------------------------
+//
+VideoProxyModelAllVideos::VideoProxyModelAllVideos(QObject *parent) :
+VideoProxyModelGeneric(parent)
+{
+ FUNC_LOG_ADDR(this);
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelAllVideos::~VideoProxyModelAllVideos
+// -----------------------------------------------------------------------------
+//
+VideoProxyModelAllVideos::~VideoProxyModelAllVideos()
+{
+ FUNC_LOG_ADDR(this);
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelAllVideos::filterAcceptsRow
+// -----------------------------------------------------------------------------
+//
+bool VideoProxyModelAllVideos::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
+{
+ Q_UNUSED(source_parent);
+
+ if(!sourceModel())
+ {
+ return false;
+ }
+
+ if(source_row < 0 || source_row >= sourceModel()->rowCount())
+ {
+ return false;
+ }
+
+ TMPXItemId id = mModel->mediaIdAtIndex(source_row);
+
+ if(id.iId2 == KVcxMvcMediaTypeVideo)
+ {
+ return true;
+ }
+
+ return false;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelAllVideos::getOpenItem()
+// -----------------------------------------------------------------------------
+//
+TMPXItemId VideoProxyModelAllVideos::getOpenItem() const
+{
+ FUNC_LOG_ADDR(this);
+ TMPXItemId itemId = TMPXItemId::InvalidId();
+
+ if(mModel && mCollectionClient)
+ {
+ INFO_1("VideoProxyModelAllVideos::getOpenItem() [0x%x] all videos is open.", this);
+ itemId.iId1 = KVcxMvcCategoryIdAll;
+ itemId.iId2 = KVcxMvcMediaTypeCategory;
+ }
+
+ return itemId;
+}
+
+// End of file
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/src/videoproxymodelcollections.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/src/videoproxymodelcollections.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,133 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: VideoProxyModelCollections implementation
+*
+*/
+
+// Version :
+
+// INCLUDE FILES
+#include
+#include "videoproxymodelgeneric.h"
+#include "videoproxymodelcollections.h"
+#include "videolistdatamodel.h"
+#include "videocollectiontrace.h"
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelCollections::VideoProxyModelCollections
+// -----------------------------------------------------------------------------
+//
+VideoProxyModelCollections::VideoProxyModelCollections(QObject *parent) :
+VideoProxyModelGeneric(parent)
+{
+ FUNC_LOG_ADDR(this);
+ mDefaultSortRole = VideoCollectionCommon::KeyTitle;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelCollections::~VideoProxyModelCollections
+// -----------------------------------------------------------------------------
+//
+VideoProxyModelCollections::~VideoProxyModelCollections()
+{
+ FUNC_LOG_ADDR(this);
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelCollections::lessThan
+// -----------------------------------------------------------------------------
+//
+bool VideoProxyModelCollections::lessThan(const QModelIndex &left,
+ const QModelIndex &right) const
+{
+ if (!mModel)
+ {
+ return false;
+ }
+ int index = left.row();
+ TMPXItemId leftId = mModel->mediaIdAtIndex(index);
+ index = right.row();
+ TMPXItemId rightId = mModel->mediaIdAtIndex(index);
+
+ // Default categories are always first in the following order:
+ // Recently played (missing currently)
+ // Captured
+ // Downloaded
+ // Podcasts (missing currently)
+ bool lessThan(false);
+ bool proceedDataSorting(false);
+ if(leftId.iId2 == KVcxMvcMediaTypeCategory &&
+ rightId.iId2 == KVcxMvcMediaTypeCategory)
+ {
+ if(leftId.iId1 == KVcxMvcCategoryIdCaptured)
+ {
+ lessThan = true;
+ }
+ else if(leftId.iId1 == KVcxMvcCategoryIdDownloads)
+ {
+ if(rightId.iId1 != KVcxMvcCategoryIdCaptured)
+ {
+ lessThan = true;
+ }
+ }
+ }
+ else if(leftId.iId2 == KVcxMvcMediaTypeCategory ||
+ rightId.iId2 == KVcxMvcMediaTypeCategory)
+ {
+ lessThan = (leftId.iId2 == KVcxMvcMediaTypeCategory);
+ }
+ else
+ {
+ proceedDataSorting = true;
+ }
+
+ if(!proceedDataSorting)
+ {
+ return mWantedSortOrder == Qt::AscendingOrder ? lessThan : !lessThan;
+ }
+
+ // It wasn't collection or they were in correct order, continue sorting with generic rules.
+ lessThan = VideoProxyModelGeneric::lessThan(left, right);
+
+ return lessThan;
+}
+// -----------------------------------------------------------------------------
+// VideoProxyModelCollections::filterAcceptsRow
+// -----------------------------------------------------------------------------
+//
+bool VideoProxyModelCollections::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
+{
+ Q_UNUSED(source_parent);
+
+ if(!sourceModel())
+ {
+ return false;
+ }
+
+ if(source_row < 0 || source_row >= sourceModel()->rowCount())
+ {
+ return false;
+ }
+
+ TMPXItemId id = mModel->mediaIdAtIndex(source_row);
+
+ if(mLevel == VideoCollectionCommon::ELevelCategory && id.iId2 != KVcxMvcMediaTypeVideo)
+ {
+ return true;
+ }
+
+ return false;
+}
+
+// End of file
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/src/videoproxymodelcontent.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/src/videoproxymodelcontent.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,141 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: VideoProxyModelContent implementation
+*
+*/
+
+// Version :
+
+// INCLUDE FILES
+#include "videoproxymodelgeneric.h"
+#include "videoproxymodelcontent.h"
+#include "videolistdatamodel.h"
+#include "videocollectiontrace.h"
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelContent::VideoProxyModelGeneric
+// -----------------------------------------------------------------------------
+//
+VideoProxyModelContent::VideoProxyModelContent(QObject *parent) :
+VideoProxyModelGeneric(parent)
+{
+ FUNC_LOG_ADDR(this);
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelContent::~VideoProxyModelContent
+// -----------------------------------------------------------------------------
+//
+VideoProxyModelContent::~VideoProxyModelContent()
+{
+ FUNC_LOG_ADDR(this);
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelContent::connectSignals
+// -----------------------------------------------------------------------------
+//
+bool VideoProxyModelContent::connectSignals()
+{
+ FUNC_LOG_ADDR(this);
+
+ if(!VideoProxyModelGeneric::connectSignals())
+ {
+ return false;
+ }
+
+ if(!connect(mModel, SIGNAL(albumChanged()),
+ this, SLOT(albumChangedSlot())))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelContent::disconnectSignals
+// -----------------------------------------------------------------------------
+//
+void VideoProxyModelContent::disconnectSignals()
+{
+ FUNC_LOG_ADDR(this);
+
+ VideoProxyModelGeneric::disconnectSignals();
+
+ disconnect(mModel, SIGNAL(albumChanged()),
+ this, SLOT(albumChangedSlot()));
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelContent::filterAcceptsRow
+// -----------------------------------------------------------------------------
+//
+bool VideoProxyModelContent::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
+{
+ Q_UNUSED(source_parent);
+
+ if(!sourceModel())
+ {
+ return false;
+ }
+
+ if(source_row < 0 || source_row >= sourceModel()->rowCount())
+ {
+ return false;
+ }
+
+ TMPXItemId id = mModel->mediaIdAtIndex(source_row);
+
+ // Accept item if it belongs to the open album.
+ if(mModel->belongsToAlbum(id))
+ {
+ return true;
+ }
+
+ return false;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelContent::getOpenItem()
+// -----------------------------------------------------------------------------
+//
+TMPXItemId VideoProxyModelContent::getOpenItem() const
+{
+ FUNC_LOG_ADDR(this);
+ TMPXItemId itemId = TMPXItemId::InvalidId();
+
+ if(mModel && mCollectionClient)
+ {
+ INFO_1("VideoProxyModelContent::getOpenItem() [0x%x] category or album is open.", this);
+ itemId = mModel->albumInUse();
+ }
+
+ return itemId;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelContent::albumChangedSlot()
+// -----------------------------------------------------------------------------
+//
+void VideoProxyModelContent::albumChangedSlot()
+{
+ FUNC_LOG_ADDR(this);
+ // Sort and invalidate filtering, otherwise newly created album content won't sort.
+ invalidateFilter();
+ setSortRole(mWantedSortRole);
+ sort(0, mWantedSortOrder);
+}
+
+// End of file
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/src/videoproxymodelgeneric.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/src/videoproxymodelgeneric.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,699 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: VideoProxyModelGeneric implementation
+*
+*/
+
+// Version :
+
+// INCLUDE FILES
+#include
+#include
+#include
+#include
+#include
+
+#include "videothumbnaildata.h"
+#include "videocollectioncommon.h"
+#include "videoproxymodelgeneric.h"
+#include "videolistdatamodel.h"
+#include "videocollectionclient.h"
+#include "videocollectionwrapper.h"
+#include "videocollectiontrace.h"
+
+const TMPXItemId INVALID_ID = TMPXItemId::InvalidId();
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::VideoProxyModelGeneric
+// -----------------------------------------------------------------------------
+//
+VideoProxyModelGeneric::VideoProxyModelGeneric(QObject *parent) :
+QSortFilterProxyModel(parent),
+mModel(0),
+mCollectionClient(0),
+mLevel(VideoCollectionCommon::ELevelInvalid),
+mGenericFilterId(TMPXItemId::InvalidId()),
+mGenericFilterValue(false),
+mIdleSortTimer(0),
+mWantedSortRole(VideoCollectionCommon::KeyDateTime),
+mWantedSortOrder(Qt::AscendingOrder),
+mDefaultSortRole(VideoCollectionCommon::KeyTitle)
+{
+ FUNC_LOG_ADDR(this);
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::~VideoProxyModelGeneric
+// -----------------------------------------------------------------------------
+//
+VideoProxyModelGeneric::~VideoProxyModelGeneric()
+{
+ FUNC_LOG_ADDR(this);
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::initialize
+// -----------------------------------------------------------------------------
+//
+int VideoProxyModelGeneric::initialize(VideoListDataModel *sourceModel)
+{
+ FUNC_LOG_ADDR(this);
+ if(!sourceModel)
+ {
+ return -1;
+ }
+ mModel = sourceModel;
+ if(!connectSignals())
+ {
+ ERROR_1(-1, "VideoProxyModelGeneric::initialize() [0x%x] failed to connect signals.", this);
+ disconnectSignals();
+ mModel = 0;
+ return -1;
+ }
+ mCollectionClient = sourceModel->getCollectionClient();
+ if(!mCollectionClient)
+ {
+ mModel = 0;
+ return -1;
+ }
+ setSourceModel(sourceModel);
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::connectSignals
+// -----------------------------------------------------------------------------
+//
+bool VideoProxyModelGeneric::connectSignals()
+{
+ FUNC_LOG_ADDR(this);
+
+ if(!connect(mModel, SIGNAL(modelChanged()),
+ this, SLOT(invalidate())))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::disconnectSignals
+// -----------------------------------------------------------------------------
+//
+void VideoProxyModelGeneric::disconnectSignals()
+{
+ FUNC_LOG_ADDR(this);
+
+ disconnect(mModel, SIGNAL(modelChanged()), this, SLOT(invalidate()));
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::open
+// -----------------------------------------------------------------------------
+//
+int VideoProxyModelGeneric::open(VideoCollectionCommon::TCollectionLevels level)
+{
+ FUNC_LOG_ADDR(this);
+ INFO_2("VideoProxyModelGeneric::open() [0x%x] level: %d", this, level);
+
+ if(!mCollectionClient)
+ {
+ return -1;
+ }
+
+ if(mLevel != level)
+ {
+ INFO_1("VideoProxyModelGeneric::open() [0x%x] opening different level, invalidating.", this);
+ mLevel = level;
+ invalidateFilter();
+ // sorting call required here to setup correct sort order in cases where source model allready
+ // contains items but proxy is not yet updated. (invalidate -call does not work since it updates proxy and
+ // calls sort in different order for us to use)
+ sort(0, mWantedSortOrder);
+ }
+ // need to call open every time to make sure all items are
+ // inserted to UI ( recent open might have been cancelled)
+ return mCollectionClient->startOpenCollection(level);
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::doSorting
+// -----------------------------------------------------------------------------
+//
+void VideoProxyModelGeneric::doSorting(int sortingRole, Qt::SortOrder order,
+ bool async)
+{
+ FUNC_LOG_ADDR(this);
+ INFO_3("VideoProxyModelGeneric::doSorting() [0x%x] sortingRole: %d, order: %d", this, sortingRole, order);
+
+ if(sortingRole != VideoCollectionCommon::KeyTitle &&
+ sortingRole != VideoCollectionCommon::KeySizeValue &&
+ sortingRole != VideoCollectionCommon::KeyDateTime &&
+ sortingRole != VideoCollectionCommon::KeyNumberOfItems)
+ {
+ mWantedSortRole = mDefaultSortRole;
+ }
+ else
+ {
+ mWantedSortRole = sortingRole;
+ }
+
+ mWantedSortOrder = order;
+
+ if(async)
+ {
+ if(mIdleSortTimer)
+ {
+ if(mIdleSortTimer->isActive())
+ {
+ mIdleSortTimer->stop();
+ }
+ }
+ else
+ {
+ mIdleSortTimer = new QTimer(this);
+ connect(mIdleSortTimer, SIGNAL(timeout()),
+ this, SLOT(processSortingSlot()));
+ }
+ mIdleSortTimer->start(0);
+ }
+ else
+ {
+ processSorting();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::getSorting
+// -----------------------------------------------------------------------------
+//
+void VideoProxyModelGeneric::getSorting(int &sortingRole, Qt::SortOrder &order)
+{
+ FUNC_LOG_ADDR(this);
+ sortingRole = mWantedSortRole;
+ order = mWantedSortOrder;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::deleteItems
+// -----------------------------------------------------------------------------
+//
+int VideoProxyModelGeneric::deleteItems(const QModelIndexList &indexList)
+{
+ FUNC_LOG_ADDR(this);
+
+ // Disable thumbnail fetching while items are removed from the model.
+ VideoThumbnailData::instance().enableBackgroundFetching(false);
+
+ if(mModel)
+ {
+ QModelIndexList mappedList;
+ for(int i = 0; i < indexList.count(); ++i)
+ {
+ mappedList.append(mapToSource(indexList.at(i)));
+ }
+
+ if(mModel->removeRows(mappedList))
+ {
+ // Start fetching thumbnails at start of the model.
+ VideoThumbnailData::instance().enableBackgroundFetching(true);
+ VideoThumbnailData::instance().startBackgroundFetching(0, 0);
+ return 0;
+ }
+ }
+
+ VideoThumbnailData::instance().enableBackgroundFetching(true);
+ return -1;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::openItem
+// -----------------------------------------------------------------------------
+//
+int VideoProxyModelGeneric::openItem(TMPXItemId mediaId)
+{
+ FUNC_LOG_ADDR(this);
+ if(mediaId != TMPXItemId::InvalidId() && mCollectionClient)
+ {
+ if(mCollectionClient->openItem(mediaId) == 0)
+ {
+ if(mediaId.iId2 != KVcxMvcMediaTypeVideo)
+ {
+ mLevel = VideoCollectionCommon::ELevelAlbum;
+ mModel->setAlbumInUse(mediaId);
+ INFO_1("VideoProxyModelGeneric::open() [0x%x] opening album or category, invalidating.", this);
+ invalidateFilter();
+ // sorting call required here to setup correct sort order in cases where source model allready
+ // contains items but proxy is not yet updated. (invalidate -call does not work since it updates proxy and
+ // calls sort in different order for us to use)
+ sort(0, mWantedSortOrder);
+ }
+ return 0;
+ }
+ }
+ return -1;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::back
+// -----------------------------------------------------------------------------
+//
+int VideoProxyModelGeneric::back()
+{
+ FUNC_LOG_ADDR(this);
+ if(mCollectionClient && mCollectionClient->back() == 0)
+ {
+ if(mLevel == VideoCollectionCommon::ELevelAlbum)
+ {
+ mLevel = VideoCollectionCommon::ELevelCategory;
+ }
+ else
+ {
+ mLevel = VideoCollectionCommon::ELevelVideos;
+ }
+ return 0;
+ }
+ return -1;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::fetchItemDetails
+// -----------------------------------------------------------------------------
+//
+int VideoProxyModelGeneric::fetchItemDetails(const QModelIndex &index)
+{
+ FUNC_LOG_ADDR(this);
+ // no need to map index beforehand, because
+ // getMediaIdAtIndex maps it
+ TMPXItemId mpxId1 = getMediaIdAtIndex(index);
+ if(mpxId1 != TMPXItemId::InvalidId() && mCollectionClient)
+ {
+ if(mCollectionClient->getVideoDetails(mpxId1) == 0)
+ {
+ emit shortDetailsReady(mpxId1);
+ return 0;
+ }
+ }
+ return -1;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::lessThan
+// -----------------------------------------------------------------------------
+//
+bool VideoProxyModelGeneric::lessThan(const QModelIndex &left,
+ const QModelIndex &right) const
+{
+ if (!mModel)
+ {
+ return false;
+ }
+
+ // Do comparisation based on the role:
+ // VideoCollectionCommon::KeyTitle,
+ // VideoCollectionCommon::KeySizeValue,
+ // VideoCollectionCommon::KeyNumberOfItems,
+ // VideoCollectionCommon::KeyDateValue
+ //
+ // If role does not match, do not sort
+ int sRole = sortRole();
+ QVariant leftData = sourceModel()->data(left, sRole);
+ QVariant rightData = sourceModel()->data(right, sRole);
+
+ if(!leftData.isValid() || !rightData.isValid())
+ {
+ return false;
+ }
+ if(sRole == VideoCollectionCommon::KeyTitle)
+ {
+ QString leftString = leftData.toString().toUpper();
+ QString rightString = rightData.toString().toUpper();
+ return QString::localeAwareCompare(leftString, rightString) < 0;
+ }
+ else if(sRole == VideoCollectionCommon::KeySizeValue ||
+ sRole == VideoCollectionCommon::KeyNumberOfItems)
+ {
+ quint32 leftSize = leftData.toUInt();
+ quint32 rightSize = rightData.toUInt();
+ return leftSize < rightSize;
+ }
+ else if(sRole == VideoCollectionCommon::KeyDateTime)
+ {
+ QDateTime leftDateTime = leftData.toDateTime();
+ QDateTime rightDateTime = rightData.toDateTime();
+ // datetime sorting role has inverted sorting order compared to other roles
+ return rightDateTime < leftDateTime;
+ }
+ return false;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::filterAcceptsRow
+// -----------------------------------------------------------------------------
+//
+bool VideoProxyModelGeneric::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
+{
+ Q_UNUSED(source_parent);
+
+ if(!sourceModel())
+ {
+ return false;
+ }
+
+ if(source_row < 0 || source_row >= sourceModel()->rowCount())
+ {
+ return false;
+ }
+ TMPXItemId id = mModel->mediaIdAtIndex(source_row);
+ if(id == TMPXItemId::InvalidId())
+ {
+ return false;
+ }
+
+ if(mLevel == VideoCollectionCommon::ELevelVideos && id.iId2 == KVcxMvcMediaTypeVideo)
+ {
+ // filter items that belong to that album setted as filter id
+ // if there's no filter or setted filter is "all videos", we accept everything
+ if(mGenericFilterId == TMPXItemId::InvalidId() ||
+ (mGenericFilterId.iId1 == KVcxMvcCategoryIdAll &&
+ mGenericFilterId.iId2 == KVcxMvcMediaTypeCategory) ||
+ mGenericFilterValue == mModel->belongsToAlbum(id, mGenericFilterId))
+ {
+ return true;
+ }
+ }
+ else if(mLevel == VideoCollectionCommon::ELevelCategory && id.iId2 == KVcxMvcMediaTypeAlbum)
+ {
+ // we do not filter albums yet
+ return true;
+ }
+
+ return false;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::getMediaIdAtIndex()
+// -----------------------------------------------------------------------------
+//
+const TMPXItemId& VideoProxyModelGeneric::getMediaIdAtIndex(const QModelIndex &index) const
+{
+ if(index.isValid())
+ {
+ int rowIndex = mapToSource(index).row();
+ if(mModel)
+ {
+ return mModel->mediaIdAtIndex(rowIndex);
+ }
+ }
+ return INVALID_ID;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::indexOfId()
+// -----------------------------------------------------------------------------
+//
+QModelIndex VideoProxyModelGeneric::indexOfId(const TMPXItemId &id)
+{
+ QModelIndex sourceIndex;
+ if(!mModel || id == TMPXItemId::InvalidId())
+ {
+ return sourceIndex;
+ }
+ sourceIndex = mModel->indexOfId(id);
+ return mapFromSource(sourceIndex);
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::getMediaFilePathForId()
+// -----------------------------------------------------------------------------
+//
+QString VideoProxyModelGeneric::getMediaFilePathForId(const TMPXItemId &mediaId)
+{
+ QString filePath;
+ if(mModel)
+ {
+ filePath = mModel->mediaFilePathForId(mediaId);
+ }
+ return filePath;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::addNewAlbum()
+// -----------------------------------------------------------------------------
+//
+TMPXItemId VideoProxyModelGeneric::addNewAlbum(const QString &title)
+{
+ FUNC_LOG_ADDR(this);
+ TMPXItemId id = TMPXItemId::InvalidId();
+
+ if (mCollectionClient)
+ {
+ id = mCollectionClient->addNewAlbum(title);
+ }
+
+ return id;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::removeAlbums()
+// -----------------------------------------------------------------------------
+//
+int VideoProxyModelGeneric::removeAlbums(const QModelIndexList &indexList)
+{
+ FUNC_LOG_ADDR(this);
+ int err(-1);
+
+ if (mCollectionClient)
+ {
+ TMPXItemId mpxId;
+ QList ids;
+
+ for(int i = 0; i < indexList.count(); ++i)
+ {
+ mpxId = getMediaIdAtIndex(indexList.at(i));
+ if(mpxId != TMPXItemId::InvalidId() &&
+ mpxId.iId2 == KVcxMvcMediaTypeAlbum)
+ {
+ ids.append(getMediaIdAtIndex(indexList.at(i)));
+ }
+ }
+
+ if (ids.count())
+ {
+ err = mCollectionClient->removeAlbums(ids);
+ }
+ }
+
+ return err;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::resolveAlbumName()
+// -----------------------------------------------------------------------------
+//
+QString VideoProxyModelGeneric::resolveAlbumName(
+ const QString& albumName) const
+{
+ FUNC_LOG_ADDR(this);
+ QString resolvedName = albumName.trimmed();
+
+ // for checking names, we need to use collection list proxy model
+ // to get all existing album names including default ones
+ VideoProxyModelGeneric *collectionModel =
+ VideoCollectionWrapper::instance().getCollectionsModel();
+ if(!collectionModel || !mModel)
+ {
+ return resolvedName;
+ }
+
+ int i(0);
+ QModelIndex proxyIndex = collectionModel->index(i, 0);
+ QSet names;
+ QVariant data;
+ // create set of existing names
+ while (proxyIndex.isValid())
+ {
+ data = mModel->data(collectionModel->mapToSource(proxyIndex),
+ VideoCollectionCommon::KeyTitle);
+ if (data.isValid())
+ {
+ names.insert(data.toString());
+ }
+ proxyIndex = collectionModel->index(++i, 0, QModelIndex());
+ }
+ i = 0;
+ QString firstMatch("");
+ // find a name that does not yet exists
+ while(names.contains(resolvedName))
+ {
+ if (!firstMatch.length())
+ {
+ firstMatch = resolvedName;
+ }
+ ++i;
+ resolvedName = tr("%1 (%2)").arg(firstMatch).arg(i);
+ }
+ return resolvedName;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::addItemsInAlbum()
+// -----------------------------------------------------------------------------
+//
+int VideoProxyModelGeneric::addItemsInAlbum(TMPXItemId &albumId,
+ const QList &mediaIds)
+{
+ FUNC_LOG_ADDR(this);
+ int err(-1);
+
+ if (mCollectionClient)
+ {
+ // add items in album
+ err = mCollectionClient->addItemsInAlbum(albumId, mediaIds);
+ }
+
+ return err;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::removeItemsFromAlbum()
+// -----------------------------------------------------------------------------
+//
+int VideoProxyModelGeneric::removeItemsFromAlbum(TMPXItemId &albumId,
+ const QList &mediaIds)
+{
+ FUNC_LOG_ADDR(this);
+ int err(-1);
+
+ // Disable thumbnail fetching while items are removed from the model.
+ VideoThumbnailData::instance().enableBackgroundFetching(false);
+
+ if (mModel)
+ {
+ // remove items in album
+ err = mModel->removeItemsFromAlbum(albumId, mediaIds);
+ if(err > 0)
+ {
+ // if there really were items to be removed, invalid filter
+ INFO_1("VideoProxyModelGeneric::removeItemsFromAlbum() [0x%x] items removed, invaliding.", this);
+ invalidateFilter();
+ err = 0;
+ }
+ }
+
+ VideoThumbnailData::instance().enableBackgroundFetching(true);
+ return err;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::renameItem()
+// -----------------------------------------------------------------------------
+//
+int VideoProxyModelGeneric::renameItem(const TMPXItemId &itemId, const QString &newTitle)
+{
+ FUNC_LOG_ADDR(this);
+ int err(-1);
+
+ if(mCollectionClient)
+ {
+ return mCollectionClient->renameItem(itemId, newTitle);
+ }
+ return err;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::getOpenItem()
+// -----------------------------------------------------------------------------
+//
+TMPXItemId VideoProxyModelGeneric::getOpenItem() const
+{
+ FUNC_LOG_ADDR(this);
+ TMPXItemId itemId = TMPXItemId::InvalidId();
+ return itemId;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::setGenericIdFilter()
+// -----------------------------------------------------------------------------
+//
+void VideoProxyModelGeneric::setGenericIdFilter(const TMPXItemId &itemId, bool filterValue)
+{
+ FUNC_LOG_ADDR(this);
+ INFO_3("VideoProxyModelGeneric::setGenericIdFilter() [0x%x] itemId.iId2: %d, filterValue: %d", this, itemId.iId2, filterValue);
+ mGenericFilterId = itemId;
+ mGenericFilterValue = filterValue;
+ INFO_1("VideoProxyModelGeneric::setGenericIdFilter() [0x%x] invalidating.", this);
+ invalidateFilter();
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::setAlbumInUse()
+// -----------------------------------------------------------------------------
+//
+void VideoProxyModelGeneric::setAlbumInUse(const TMPXItemId &albumId)
+{
+ FUNC_LOG_ADDR(this);
+ if(mModel)
+ {
+ INFO_1("VideoProxyModelGeneric::setAlbumInUse() [0x%x] invalidating.", this);
+ mModel->setAlbumInUse(albumId);
+ invalidateFilter();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::processSortingSlot
+// -----------------------------------------------------------------------------
+//
+void VideoProxyModelGeneric::processSortingSlot()
+{
+ FUNC_LOG_ADDR(this);
+ if(mIdleSortTimer)
+ {
+ mIdleSortTimer->stop();
+ }
+ processSorting();
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::processSorting
+// -----------------------------------------------------------------------------
+//
+void VideoProxyModelGeneric::processSorting()
+{
+ FUNC_LOG_ADDR(this);
+
+ if(sortRole() != mWantedSortRole)
+ {
+ setSortRole(mWantedSortRole);
+ }
+
+ if(sortColumn() == -1 || sortOrder() != mWantedSortOrder)
+ {
+ // if sorting column is not yet setted, it indicates
+ // that we've setted the sorting order for the first time
+ // and sorting has not yet been done. After we have called sort once,
+ // the sort columnt gets updated and following sorts gets executed
+ // by setSortRole -call as long as role changes.
+
+ // Another case is when we need to change the sort order, as there is
+ // no other way of setting the sort order than calling sort().
+ sort(0, mWantedSortOrder);
+ }
+
+ emit modelSorted();
+}
+
+// End of file
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/src/videosortfilterproxymodel.cpp
--- a/videocollection/videocollectionwrapper/src/videosortfilterproxymodel.cpp Mon Aug 23 14:27:29 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,824 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: Videosortfilterproxymodel implementation
-*
-*/
-
-// Version : %version: 66.1.9 %
-
-// INCLUDE FILES
-#include
-#include
-#include
-#include
-#include
-
-#include "videothumbnaildata.h"
-#include "videocollectioncommon.h"
-#include "videosortfilterproxymodel.h"
-#include "videolistdatamodel.h"
-#include "videocollectionclient.h"
-#include "videocollectionwrapper.h"
-#include "videocollectiontrace.h"
-
-const TMPXItemId INVALID_ID = TMPXItemId::InvalidId();
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::VideoSortFilterProxyModel
-// -----------------------------------------------------------------------------
-//
-VideoSortFilterProxyModel::VideoSortFilterProxyModel(VideoCollectionCommon::TModelType type, QObject *parent) :
-QSortFilterProxyModel(parent),
-mModel(0),
-mCollectionClient(0),
-mType(type),
-mLevel(VideoCollectionCommon::ELevelInvalid),
-mGenericFilterId(TMPXItemId::InvalidId()),
-mGenericFilterValue(false),
-mIdleSortTimer(0),
-mWantedSortRole(VideoCollectionCommon::KeyDateTime),
-mWantedSortOrder(Qt::AscendingOrder)
-{
- FUNC_LOG_ADDR(this);
- INFO_2("VideoSortFilterProxyModel::VideoSortFilterProxyModel() [0x%x]: type: %d", this, type);
-}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::~VideoSortFilterProxyModel
-// -----------------------------------------------------------------------------
-//
-VideoSortFilterProxyModel::~VideoSortFilterProxyModel()
-{
- FUNC_LOG_ADDR(this);
-}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::initialize
-// -----------------------------------------------------------------------------
-//
-int VideoSortFilterProxyModel::initialize(VideoListDataModel *sourceModel)
-{
- FUNC_LOG_ADDR(this);
- if(!sourceModel)
- {
- return -1;
- }
-
- if(!mModel)
- {
- mModel = sourceModel;
- if(!connectSignals())
- {
- ERROR_1(-1, "VideoSortFilterProxyModel::initialize() [0x%x] failed to connect signals.", this);
- disconnectSignals();
- mModel = 0;
- return -1;
- }
- mCollectionClient = mModel->getCollectionClient();
- setSourceModel(sourceModel);
- }
- return 0;
-}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::connectSignals
-// -----------------------------------------------------------------------------
-//
-bool VideoSortFilterProxyModel::connectSignals()
-{
- FUNC_LOG_ADDR(this);
-
- if(!connect(mModel, SIGNAL(modelChanged()),
- this, SLOT(invalidate())))
- {
- return false;
- }
- if(mType == VideoCollectionCommon::EModelTypeCollectionContent)
- {
- if(!connect(mModel, SIGNAL(albumChanged()),
- this, SLOT(albumChangedSlot())))
- {
- return false;
- }
- }
-
- return true;
-}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::disconnectSignals
-// -----------------------------------------------------------------------------
-//
-void VideoSortFilterProxyModel::disconnectSignals()
-{
- FUNC_LOG_ADDR(this);
- disconnect(mModel, SIGNAL(modelChanged()), this, SLOT(invalidate()));
- if(mType == VideoCollectionCommon::EModelTypeCollectionContent)
- {
- disconnect(mModel, SIGNAL(albumChanged()), this, SLOT(albumChangedSlot()));
- }
- if(mType == VideoCollectionCommon::EModelTypeCollections)
- {
- disconnect(mModel, SIGNAL(itemModified(const TMPXItemId &)),
- this, SLOT(itemModifiedSlot(const TMPXItemId &)));
- }
-}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::open
-// -----------------------------------------------------------------------------
-//
-int VideoSortFilterProxyModel::open(VideoCollectionCommon::TCollectionLevels level)
-{
- FUNC_LOG_ADDR(this);
- INFO_2("VideoSortFilterProxyModel::open() [0x%x] level: %d", this, level);
-
- if(!mCollectionClient)
- {
- return -1;
- }
-
- if(mLevel != level)
- {
- INFO_1("VideoSortFilterProxyModel::open() [0x%x] opening different level, invalidating.", this);
- mLevel = level;
- invalidateFilter();
- // sorting call required here to setup correct sort order in cases where source model allready
- // contains items but proxy is not yet updated. (invalidate -call does not work since it updates proxy and
- // calls sort in different order for us to use)
- sort(0, mWantedSortOrder);
- }
- // need to call open every time to make sure all items are
- // inserted to UI ( recent open might have been cancelled)
- return mCollectionClient->startOpenCollection(level);
-}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::doSorting
-// -----------------------------------------------------------------------------
-//
-void VideoSortFilterProxyModel::doSorting(int sortingRole, Qt::SortOrder order,
- bool async)
-{
- FUNC_LOG_ADDR(this);
- INFO_3("VideoSortFilterProxyModel::doSorting() [0x%x] sortingRole: %d, order: %d", this, sortingRole, order);
-
- if(sortingRole != VideoCollectionCommon::KeyTitle &&
- sortingRole != VideoCollectionCommon::KeySizeValue &&
- sortingRole != VideoCollectionCommon::KeyDateTime &&
- sortingRole != VideoCollectionCommon::KeyNumberOfItems)
- {
- // default sorting order is by date for other models but collections.
- if(mType != VideoCollectionCommon::EModelTypeCollections)
- {
- mWantedSortRole = VideoCollectionCommon::KeyDateTime;
- }
- else
- {
- mWantedSortRole = VideoCollectionCommon::KeyTitle;
- }
- }
- else
- {
- mWantedSortRole = sortingRole;
- }
-
- mWantedSortOrder = order;
-
- if(async)
- {
- if(mIdleSortTimer)
- {
- if(mIdleSortTimer->isActive())
- {
- mIdleSortTimer->stop();
- }
- }
- else
- {
- mIdleSortTimer = new QTimer(this);
- connect(mIdleSortTimer, SIGNAL(timeout()), this, SLOT(processSorting()));
- }
- mIdleSortTimer->start(0);
- }
- else
- {
- processSorting();
- }
-}
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::getSorting
-// -----------------------------------------------------------------------------
-//
-void VideoSortFilterProxyModel::getSorting(int &sortingRole, Qt::SortOrder &order)
-{
- FUNC_LOG_ADDR(this);
- sortingRole = mWantedSortRole;
- order = mWantedSortOrder;
-}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::deleteItems
-// -----------------------------------------------------------------------------
-//
-int VideoSortFilterProxyModel::deleteItems(const QModelIndexList &indexList)
-{
- FUNC_LOG_ADDR(this);
-
- // Disable thumbnail fetching while items are removed from the model.
- VideoThumbnailData::instance().enableBackgroundFetching(false);
-
- if(mModel)
- {
- QModelIndexList mappedList;
- for(int i = 0; i < indexList.count(); ++i)
- {
- mappedList.append(mapToSource(indexList.at(i)));
- }
-
- if(mModel->removeRows(mappedList))
- {
- // Start fetching thumbnails at start of the model.
- VideoThumbnailData::instance().enableBackgroundFetching(true);
- VideoThumbnailData::instance().startBackgroundFetching(0, 0);
- return 0;
- }
- }
-
- VideoThumbnailData::instance().enableBackgroundFetching(true);
- return -1;
-}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::openItem
-// -----------------------------------------------------------------------------
-//
-int VideoSortFilterProxyModel::openItem(TMPXItemId mediaId)
-{
- FUNC_LOG_ADDR(this);
- if(mediaId != TMPXItemId::InvalidId() && mCollectionClient)
- {
- if(mCollectionClient->openItem(mediaId) == 0)
- {
- if(mediaId.iId2 != KVcxMvcMediaTypeVideo)
- {
- mLevel = VideoCollectionCommon::ELevelAlbum;
- mModel->setAlbumInUse(mediaId);
- INFO_1("VideoSortFilterProxyModel::open() [0x%x] opening album or category, invalidating.", this);
- invalidateFilter();
- // sorting call required here to setup correct sort order in cases where source model allready
- // contains items but proxy is not yet updated. (invalidate -call does not work since it updates proxy and
- // calls sort in different order for us to use)
- sort(0, mWantedSortOrder);
- }
- return 0;
- }
- }
- return -1;
-}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::back
-// -----------------------------------------------------------------------------
-//
-int VideoSortFilterProxyModel::back()
-{
- FUNC_LOG_ADDR(this);
- if(mCollectionClient && mCollectionClient->back() == 0)
- {
- if(mLevel == VideoCollectionCommon::ELevelAlbum)
- {
- mLevel = VideoCollectionCommon::ELevelCategory;
- }
- else
- {
- mLevel = VideoCollectionCommon::ELevelVideos;
- }
- return 0;
- }
- return -1;
-}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::fetchItemDetails
-// -----------------------------------------------------------------------------
-//
-int VideoSortFilterProxyModel::fetchItemDetails(const QModelIndex &index)
-{
- FUNC_LOG_ADDR(this);
- // no need to map index beforehand, because
- // getMediaIdAtIndex maps it
- TMPXItemId mpxId1 = getMediaIdAtIndex(index);
- if(mpxId1 != TMPXItemId::InvalidId() && mCollectionClient)
- {
- if(mCollectionClient->getVideoDetails(mpxId1) == 0)
- {
- emit shortDetailsReady(mpxId1);
- return 0;
- }
- }
- return -1;
-}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::processSorting
-// -----------------------------------------------------------------------------
-//
-void VideoSortFilterProxyModel::processSorting()
-{
- FUNC_LOG_ADDR(this);
- if(mIdleSortTimer)
- {
- mIdleSortTimer->stop();
- }
-
- if(sortRole() != mWantedSortRole)
- {
- setSortRole(mWantedSortRole);
- }
-
- if(sortColumn() == -1 || sortOrder() != mWantedSortOrder)
- {
- // if sorting column is not yet setted, it indicates
- // that we've setted the sorting order for the first time
- // and sorting has not yet been done. After we have called sort once,
- // the sort columnt gets updated and following sorts gets executed
- // by setSortRole -call as long as role changes.
-
- // Another case is when we need to change the sort order, as there is
- // no other way of setting the sort order than calling sort().
- sort(0, mWantedSortOrder);
- }
-
- emit modelSorted();
-}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::lessThan
-// -----------------------------------------------------------------------------
-//
-bool VideoSortFilterProxyModel::lessThan(const QModelIndex &left,
- const QModelIndex &right) const
-{
- if (!mModel)
- {
- return false;
- }
- int index = left.row();
- TMPXItemId leftId = mModel->mediaIdAtIndex(index);
- index = right.row();
- TMPXItemId rightId = mModel->mediaIdAtIndex(index);
-
- // Default categories are always first in the following order:
- // Recently played (missing currently)
- // Captured
- // Downloaded
- // Podcasts (missing currently)
- bool lessThan(false);
- bool proceedDataSorting(false);
- if(leftId.iId2 == KVcxMvcMediaTypeCategory &&
- rightId.iId2 == KVcxMvcMediaTypeCategory)
- {
- if(leftId.iId1 == KVcxMvcCategoryIdCaptured)
- {
- lessThan = true;
- }
-
- else if(leftId.iId1 == KVcxMvcCategoryIdDownloads)
- {
- if(rightId.iId1 != KVcxMvcCategoryIdCaptured)
- {
- lessThan = true;
- }
- }
- }
- else if(leftId.iId2 == KVcxMvcMediaTypeCategory ||
- rightId.iId2 == KVcxMvcMediaTypeCategory)
- {
- lessThan = (leftId.iId2 == KVcxMvcMediaTypeCategory);
- }
- else
- {
- proceedDataSorting = true;
- }
-
- if(!proceedDataSorting)
- {
- return mWantedSortOrder == Qt::AscendingOrder ? lessThan : !lessThan;
- }
-
- // Do comparisation based on the role:
- // VideoCollectionCommon::KeyTitle,
- // VideoCollectionCommon::KeySizeValue,
- // VideoCollectionCommon::KeyNumberOfItems,
- // VideoCollectionCommon::KeyDateValue
- //
- // If role does not match, do not sort
- int sRole = sortRole();
- QVariant leftData = sourceModel()->data(left, sRole);
- QVariant rightData = sourceModel()->data(right, sRole);
-
- if(!leftData.isValid() || !rightData.isValid())
- {
- return false;
- }
- if(sRole == VideoCollectionCommon::KeyTitle)
- {
- QString leftString = leftData.toString().toUpper();
- QString rightString = rightData.toString().toUpper();
- return QString::localeAwareCompare(leftString, rightString) < 0;
- }
- else if(sRole == VideoCollectionCommon::KeySizeValue ||
- sRole == VideoCollectionCommon::KeyNumberOfItems)
- {
- quint32 leftSize = leftData.toUInt();
- quint32 rightSize = rightData.toUInt();
- return leftSize < rightSize;
- }
- else if(sRole == VideoCollectionCommon::KeyDateTime)
- {
- QDateTime leftDateTime = leftData.toDateTime();
- QDateTime rightDateTime = rightData.toDateTime();
- // datetime sorting role has inverted sorting order compared to other roles
- return rightDateTime < leftDateTime;
- }
- return false;
-}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::filterAcceptsRow
-// -----------------------------------------------------------------------------
-//
-bool VideoSortFilterProxyModel::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
-{
- Q_UNUSED(source_parent);
-
- if(!sourceModel())
- {
- return false;
- }
-
- if(source_row < 0 || source_row >= sourceModel()->rowCount())
- {
- return false;
- }
- TMPXItemId id = mModel->mediaIdAtIndex(source_row);
- if(id == TMPXItemId::InvalidId())
- {
- return false;
- }
-
- if (mType == VideoCollectionCommon::EModelTypeAllVideos)
- {
- if(id.iId2 == KVcxMvcMediaTypeVideo)
- {
- return true;
- }
- }
- else if(mType == VideoCollectionCommon::EModelTypeCollections)
- {
- if(mLevel == VideoCollectionCommon::ELevelCategory && id.iId2 != KVcxMvcMediaTypeVideo)
- {
- return true;
- }
- }
- else if (mType == VideoCollectionCommon::EModelTypeCollectionContent)
- {
- // if item belongs to the open album, accept it
- if (mModel->belongsToAlbum(id))
- {
- return true;
- }
- }
- else if(mType == VideoCollectionCommon::EModelTypeGeneric)
- {
- if(mLevel == VideoCollectionCommon::ELevelVideos && id.iId2 == KVcxMvcMediaTypeVideo)
- {
- // filter items that belong to that album setted as filter id
- // if there's no filter or setted filter is "all videos", we accept everything
- if(mGenericFilterId == TMPXItemId::InvalidId() ||
- (mGenericFilterId.iId1 == KVcxMvcCategoryIdAll &&
- mGenericFilterId.iId2 == KVcxMvcMediaTypeCategory) ||
- mGenericFilterValue == mModel->belongsToAlbum(id, mGenericFilterId))
- {
- return true;
- }
- }
- else if(mLevel == VideoCollectionCommon::ELevelCategory && id.iId2 == KVcxMvcMediaTypeAlbum)
- {
- // we do not filter albums yet
- return true;
- }
- }
-
- return false;
-}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::getMediaIdAtIndex()
-// -----------------------------------------------------------------------------
-//
-const TMPXItemId& VideoSortFilterProxyModel::getMediaIdAtIndex(const QModelIndex &index) const
-{
- if(index.isValid())
- {
- int rowIndex = mapToSource(index).row();
- if(mModel)
- {
- return mModel->mediaIdAtIndex(rowIndex);
- }
- }
- return INVALID_ID;
-}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::indexOfId()
-// -----------------------------------------------------------------------------
-//
-QModelIndex VideoSortFilterProxyModel::indexOfId(const TMPXItemId &id)
-{
- QModelIndex sourceIndex;
- if(!mModel || id == TMPXItemId::InvalidId())
- {
- return sourceIndex;
- }
- sourceIndex = mModel->indexOfId(id);
- return mapFromSource(sourceIndex);
-}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::getMediaFilePathForId()
-// -----------------------------------------------------------------------------
-//
-QString VideoSortFilterProxyModel::getMediaFilePathForId(const TMPXItemId &mediaId)
-{
- QString filePath;
- if(mModel)
- {
- filePath = mModel->mediaFilePathForId(mediaId);
- }
- return filePath;
-}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::addNewAlbum()
-// -----------------------------------------------------------------------------
-//
-TMPXItemId VideoSortFilterProxyModel::addNewAlbum(const QString &title)
-{
- FUNC_LOG_ADDR(this);
- TMPXItemId id = TMPXItemId::InvalidId();
-
- if (mCollectionClient)
- {
- id = mCollectionClient->addNewAlbum(title);
- }
-
- return id;
-}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::removeAlbums()
-// -----------------------------------------------------------------------------
-//
-int VideoSortFilterProxyModel::removeAlbums(const QModelIndexList &indexList)
-{
- FUNC_LOG_ADDR(this);
- int err(-1);
-
- if (mCollectionClient)
- {
- TMPXItemId mpxId;
- QList ids;
-
- for(int i = 0; i < indexList.count(); ++i)
- {
- mpxId = getMediaIdAtIndex(indexList.at(i));
- if((mpxId != TMPXItemId::InvalidId()) && (mpxId.iId2 == KVcxMvcMediaTypeAlbum))
- {
- ids.append(getMediaIdAtIndex(indexList.at(i)));
- }
- }
-
- if (ids.count())
- {
- err = mCollectionClient->removeAlbums(ids);
- }
- }
-
- return err;
-}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::resolveAlbumName()
-// -----------------------------------------------------------------------------
-//
-QString VideoSortFilterProxyModel::resolveAlbumName(
- const QString& albumName) const
-{
- FUNC_LOG_ADDR(this);
- QString resolvedName = albumName.trimmed();
-
- // for checking names, we need to use collection list proxy model
- // to get all existing album names including default ones
- VideoSortFilterProxyModel *collectionModel =
- VideoCollectionWrapper::instance().getModel(
- VideoCollectionCommon::EModelTypeCollections);
- if(!collectionModel || !mModel)
- {
- return resolvedName;
- }
-
- int i(0);
- QModelIndex proxyIndex = collectionModel->index(i, 0);
- QSet names;
- QVariant data;
- // create set of existing names
- while (proxyIndex.isValid())
- {
- data = mModel->data(collectionModel->mapToSource(proxyIndex), VideoCollectionCommon::KeyTitle);
- if (data.isValid())
- {
- names.insert(data.toString());
- }
- proxyIndex = collectionModel->index(++i, 0, QModelIndex());
- }
- i = 0;
- QString firstMatch("");
- // find a name that does not yet exists
- while(names.contains(resolvedName))
- {
- if (!firstMatch.length())
- {
- firstMatch = resolvedName;
- }
- ++i;
- resolvedName = tr("%1 (%2)").arg(firstMatch).arg(i);
- }
- return resolvedName;
-}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::addItemsInAlbum()
-// -----------------------------------------------------------------------------
-//
-int VideoSortFilterProxyModel::addItemsInAlbum(TMPXItemId &albumId,
- const QList &mediaIds)
-{
- FUNC_LOG_ADDR(this);
- int err(-1);
-
- if (mCollectionClient)
- {
- // add items in album
- err = mCollectionClient->addItemsInAlbum(albumId, mediaIds);
- }
-
- return err;
-}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::removeItemsFromAlbum()
-// -----------------------------------------------------------------------------
-//
-int VideoSortFilterProxyModel::removeItemsFromAlbum(TMPXItemId &albumId,
- const QList &mediaIds)
-{
- FUNC_LOG_ADDR(this);
- int err(-1);
-
- // Disable thumbnail fetching while items are removed from the model.
- VideoThumbnailData::instance().enableBackgroundFetching(false);
-
- if (mModel)
- {
- // remove items in album
- err = mModel->removeItemsFromAlbum(albumId, mediaIds);
- if(err > 0)
- {
- // if there really were items to be removed, invalid filter
- INFO_1("VideoSortFilterProxyModel::removeItemsFromAlbum() [0x%x] items removed, invaliding.", this);
- invalidateFilter();
- err = 0;
- }
- }
-
- VideoThumbnailData::instance().enableBackgroundFetching(true);
- return err;
-}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::renameItem()
-// -----------------------------------------------------------------------------
-//
-int VideoSortFilterProxyModel::renameItem(const TMPXItemId &itemId, const QString &newTitle)
-{
- FUNC_LOG_ADDR(this);
- int err(-1);
-
- if(mCollectionClient)
- {
- return mCollectionClient->renameItem(itemId, newTitle);
- }
- return err;
-}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::getOpenItem()
-// -----------------------------------------------------------------------------
-//
-TMPXItemId VideoSortFilterProxyModel::getOpenItem() const
-{
- FUNC_LOG_ADDR(this);
- TMPXItemId itemId = TMPXItemId::InvalidId();
-
- if(mModel && mCollectionClient)
- {
- if(mType == VideoCollectionCommon::EModelTypeAllVideos)
- {
- INFO_1("VideoSortFilterProxyModel::getOpenItem() [0x%x] all videos is open.", this);
- itemId.iId1 = KVcxMvcCategoryIdAll;
- itemId.iId2 = KVcxMvcMediaTypeCategory;
- }
- else if(mType == VideoCollectionCommon::EModelTypeCollectionContent)
- {
- INFO_1("VideoSortFilterProxyModel::getOpenItem() [0x%x] category or album is open.", this);
- itemId = mModel->albumInUse();
- }
- }
-
- return itemId;
-}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::setGenericIdFilter()
-// -----------------------------------------------------------------------------
-//
-void VideoSortFilterProxyModel::setGenericIdFilter(const TMPXItemId &itemId, bool filterValue)
-{
- FUNC_LOG_ADDR(this);
- if(mType == VideoCollectionCommon::EModelTypeGeneric)
- {
- INFO_3("VideoSortFilterProxyModel::setGenericIdFilter() [0x%x] itemId.iId2: %d, filterValue: %d", this, itemId.iId2, filterValue);
- mGenericFilterId = itemId;
- mGenericFilterValue = filterValue;
- INFO_1("VideoSortFilterProxyModel::setGenericIdFilter() [0x%x] invalidating.", this);
- invalidateFilter();
- }
-}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::setAlbumInUse()
-// -----------------------------------------------------------------------------
-//
-void VideoSortFilterProxyModel::setAlbumInUse(const TMPXItemId &albumId)
-{
- FUNC_LOG_ADDR(this);
- if(mModel)
- {
- INFO_1("VideoSortFilterProxyModel::setAlbumInUse() [0x%x] invalidating.", this);
- mModel->setAlbumInUse(albumId);
- invalidateFilter();
- }
-}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::albumChangedSlot()
-// -----------------------------------------------------------------------------
-//
-void VideoSortFilterProxyModel::albumChangedSlot()
-{
- FUNC_LOG_ADDR(this);
- // ignore if not collection content model
- if (mType == VideoCollectionCommon::EModelTypeCollectionContent)
- {
- INFO_1("VideoSortFilterProxyModel::albumChangedSlot() [0x%x] invalidating.", this);
- // sort and invalidate filtering, otherwise newly created album content won't sort
- invalidateFilter();
- setSortRole(mWantedSortRole);
- sort(0, mWantedSortOrder);
- }
-}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::getType()
-// -----------------------------------------------------------------------------
-//
-VideoCollectionCommon::TModelType VideoSortFilterProxyModel::getType()
-{
- FUNC_LOG_ADDR(this);
- return mType;
-}
-
-// End of file
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/src/videothumbnaildata.cpp
--- a/videocollection/videocollectionwrapper/src/videothumbnaildata.cpp Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionwrapper/src/videothumbnaildata.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 26.1.2 %
+// Version : %version: 26.1.3 %
// INCLUDE FILES
#include "videocollectiontrace.h"
@@ -84,7 +84,7 @@
// VideoThumbnailData::startBackgroundFetching()
// -----------------------------------------------------------------------------
//
-void VideoThumbnailData::startBackgroundFetching(VideoSortFilterProxyModel *model, int fetchIndex)
+void VideoThumbnailData::startBackgroundFetching(VideoProxyModelGeneric *model, int fetchIndex)
{
INFO_2("VideoThumbnailData::startBackgroundFetching() model: 0x%x, fetchIndex: %d", model, fetchIndex);
d_ptr->startBackgroundFetching(model, fetchIndex);
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/src/videothumbnaildata_p.cpp
--- a/videocollection/videocollectionwrapper/src/videothumbnaildata_p.cpp Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionwrapper/src/videothumbnaildata_p.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 24.1.3 %
+// Version : %version: 24.1.5 %
// INCLUDE FILES
#include
@@ -30,7 +30,7 @@
#include "videothumbnaildata_p.h"
#include "videocollectionwrapper.h"
-#include "videosortfilterproxymodel.h"
+#include "videoproxymodelgeneric.h"
#include "videothumbnailfetcher.h"
#include "videocollectiontrace.h"
@@ -182,10 +182,6 @@
FUNC_LOG;
if(!mSignalsConnected)
{
- VideoSortFilterProxyModel *model =
- VideoCollectionWrapper::instance().getModel(VideoCollectionCommon::EModelTypeAllVideos);
- if(!model)
- return -1;
if(!connect(mThumbnailFetcher, SIGNAL(thumbnailReady( QPixmap , const TMPXItemId &, int )),
this, SLOT(thumbnailReadySlot( QPixmap , const TMPXItemId &, int))) ||
!connect(mThumbnailFetcher, SIGNAL(allThumbnailsFetched()),
@@ -228,6 +224,7 @@
int VideoThumbnailDataPrivate::startFetchingThumbnails(const QList &indexes, int priority)
{
FUNC_LOG;
+
if(!mCurrentModel || !mThumbnailFetcher)
{
return -1;
@@ -410,19 +407,26 @@
//
const QIcon* VideoThumbnailDataPrivate::defaultThumbnail(const TMPXItemId &mediaId)
{
+ FUNC_LOG;
+
+ if(!mBackgroundFetchingEnabled)
+ {
+ return 0;
+ }
+
const TMPXItemId defaultIdVideo(KMaxTUint32-1, KVcxMvcMediaTypeVideo);
const TMPXItemId defaultIdAlbum(KMaxTUint32-1, KVcxMvcMediaTypeAlbum);
const TMPXItemId defaultIdDownloads(KVcxMvcCategoryIdDownloads, KVcxMvcMediaTypeCategory);
const TMPXItemId defaultIdCaptured(KVcxMvcCategoryIdCaptured, KVcxMvcMediaTypeCategory);
// Default thumbnail for video
- if(mediaId.iId2 == KVcxMvcMediaTypeVideo)
+ if(mediaId.iId2 == KVcxMvcMediaTypeVideo)
{
if(!mDefaultThumbnails.contains(defaultIdVideo))
{
mDefaultThumbnails[defaultIdVideo] = loadIcon("qtg_large_video");
}
- return &mDefaultThumbnails[defaultIdVideo].qicon();
+ return mDefaultThumbnails[defaultIdVideo];
}
else
{
@@ -433,7 +437,7 @@
{
mDefaultThumbnails[defaultIdAlbum] = loadIcon("qtg_large_video_collection");
}
- return &mDefaultThumbnails[defaultIdAlbum].qicon();
+ return mDefaultThumbnails[defaultIdAlbum];
}
// Thumbnails for default collections.
@@ -445,7 +449,7 @@
{
mDefaultThumbnails[defaultIdDownloads] = loadIcon("qtg_large_video_download");
}
- return &mDefaultThumbnails[defaultIdDownloads].qicon();
+ return mDefaultThumbnails[defaultIdDownloads];
}
case KVcxMvcCategoryIdCaptured:
@@ -454,16 +458,12 @@
{
mDefaultThumbnails[defaultIdCaptured] = loadIcon("qtg_large_video_capture");
}
- return &mDefaultThumbnails[defaultIdCaptured].qicon();
+ return mDefaultThumbnails[defaultIdCaptured];
}
default:
{
- if(!mDefaultThumbnails.contains(defaultIdAlbum))
- {
- mDefaultThumbnails[defaultIdAlbum] = loadIcon("qtg_large_video_collection");
- }
- return &mDefaultThumbnails[defaultIdAlbum].qicon();
+ return 0;
}
}
}
@@ -473,50 +473,30 @@
// VideoThumbnailDataPrivate::loadIcon()
// -----------------------------------------------------------------------------
//
-HbIcon VideoThumbnailDataPrivate::loadIcon(QString iconName)
-{
- HbIcon icon(iconName);
+QIcon *VideoThumbnailDataPrivate::loadIcon(QString iconName)
+{
+ FUNC_LOG;
- if(!icon.isNull())
+ HbIcon resource(iconName);
+ QIcon *icon = 0;
+
+ if(!resource.isNull())
{
+ // Set matching height, width is adjusted automaticly.
+ resource.setHeight(DEFAULT_THUMBNAIL_HEIGHT);
+
QPixmap dest = QPixmap(DEFAULT_THUMBNAIL_WIDTH, DEFAULT_THUMBNAIL_HEIGHT);
-
- // Scale the icon into the thumbnail area.
- QPixmap source = icon.pixmap();
- // Smooth scaling is very expensive (size^2). Therefore we reduce the size
- // to 2x of the destination size and using fast transformation before doing final smooth scaling.
- if(source.size().width() > (6*dest.width()) || source.size().height() > (6*dest.height()))
- {
- QSize intermediate_size = QSize( dest.width() * 2, dest.height() * 2 );
- source = source.scaled(intermediate_size, Qt::KeepAspectRatio, Qt::FastTransformation );
- }
- QPixmap scaled = source.scaled(dest.size(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
-
- // Center the icon.
- int xDiff = 0;
- int yDiff = 0;
- if(dest.width() > scaled.width())
- {
- xDiff = (dest.width() - scaled.width()) / 2;
- }
- if(dest.height() > scaled.height())
- {
- yDiff = (dest.height() - scaled.height()) / 2;
- }
- // Paint it.
QPainter painter(&dest);
painter.setCompositionMode(QPainter::CompositionMode_Source);
- painter.fillRect(dest.rect(), Qt::transparent);
- painter.drawPixmap(xDiff, yDiff, scaled.width(), scaled.height(), scaled);
+ painter.fillRect(dest.rect(), Qt::transparent);
+ resource.paint(&painter, dest.rect());
painter.end();
- return HbIcon(dest);
+ icon = new QIcon(dest);
}
- else
- {
- return HbIcon();
- }
+
+ return icon;
}
// -----------------------------------------------------------------------------
@@ -590,6 +570,13 @@
// Clear data.
mReadyThumbnailMediaIds.clear();
mThumbnailData.clear();
+
+ QHash::const_iterator iter = mDefaultThumbnails.constBegin();
+ while(iter != mDefaultThumbnails.constEnd())
+ {
+ delete *iter;
+ iter++;
+ }
mDefaultThumbnails.clear();
}
@@ -597,7 +584,7 @@
// VideoThumbnailDataPrivate::startBackgroundFetching()
// -----------------------------------------------------------------------------
//
-void VideoThumbnailDataPrivate::startBackgroundFetching(VideoSortFilterProxyModel *model, int fetchIndex)
+void VideoThumbnailDataPrivate::startBackgroundFetching(VideoProxyModelGeneric *model, int fetchIndex)
{
FUNC_LOG;
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/src/videothumbnailfetcher.cpp
--- a/videocollection/videocollectionwrapper/src/videothumbnailfetcher.cpp Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionwrapper/src/videothumbnailfetcher.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 6 %
+// Version : %version: 6.1.1 %
// INCLUDE FILES
#include
@@ -47,7 +47,7 @@
{
FUNC_LOG;
mThumbnailManager = new ThumbnailManager();
- mThumbnailManager->setThumbnailSize(ThumbnailManager::ThumbnailMedium);
+ mThumbnailManager->setThumbnailSize(ThumbnailManager::ThumbnailSmall);
mThumbnailManager->setQualityPreference(ThumbnailManager::OptimizeForPerformance);
mThumbnailManager->setMode(ThumbnailManager::CropToAspectRatio);
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/src/testvideocollectionwrapper_p.cpp
--- a/videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/src/testvideocollectionwrapper_p.cpp Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/src/testvideocollectionwrapper_p.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -18,13 +18,14 @@
// INCLUDES
+#include
#include
#include
#include "testvideocollectionwrapper_p.h"
#include "videocollectionwrapper.h"
#include "videocollectioncommon.h"
#include "videolistdatamodel.h"
-#include "videosortfilterproxymodel.h"
+#include "videoproxymodelgeneric.h"
#include "videocollectionclient.h"
#include "vcxmyvideosdefs.h"
@@ -86,37 +87,23 @@
{
QVERIFY(mTestObject);
- VideoSortFilterProxyModel *proxyGotten = 0;
-
- // source model init fails
+ VideoProxyModelGeneric *proxyGotten = 0;
+
VideoListDataModel::mInitFails = true;
- VideoCollectionCommon::TModelType type = VideoCollectionCommon::EModelTypeAllVideos;
- proxyGotten = mTestObject->getModel(type);
- QVERIFY(!proxyGotten);
+ // Test source model init fails
- VideoListDataModel::mInitFails = false;
- VideoSortFilterProxyModel::setInitFailure(true);
-
- // VideoCollectionWrapper::EAllvideos -> init fails
- type = VideoCollectionCommon::EModelTypeAllVideos;
- proxyGotten = mTestObject->getModel(type);
+ proxyGotten = mTestObject->getGenericModel();
QVERIFY(!proxyGotten);
- // VideoCollectionWrapper::ECollections -> init fails
- type = VideoCollectionCommon::EModelTypeAllVideos;
- proxyGotten = mTestObject->getModel(type);
+ proxyGotten = mTestObject->getAllVideosModel();
QVERIFY(!proxyGotten);
- // VideoCollectionWrapper::EGeneric -> init fails
- type = VideoCollectionCommon::EModelTypeGeneric;
- proxyGotten = mTestObject->getModel(type);
+ proxyGotten = mTestObject->getCollectionsModel();
QVERIFY(!proxyGotten);
- type = VideoCollectionCommon::EModelTypeCollectionContent;
- proxyGotten = mTestObject->getModel(type);
+ proxyGotten = mTestObject->getCollectionContentModel();
QVERIFY(!proxyGotten);
}
-
// -----------------------------------------------------------------------------
// testGetModelSucceed
@@ -125,52 +112,54 @@
void TestVideCollectionWrapper_p::testGetModelSucceed()
{
QVERIFY(mTestObject);
-
- VideoSortFilterProxyModel *proxyGotten = 0;
- VideoSortFilterProxyModel::setInitFailure(false);
- VideoCollectionCommon::TModelType type = VideoCollectionCommon::EModelTypeAllVideos;
+
+ VideoListDataModel::mInitFails = false;
+
+ VideoProxyModelGeneric *proxyGotten = 0;
+ VideoProxyModelGeneric *proxyGotten2 = 0;
- // VideoCollectionWrapper::EAllvideos
- type = VideoCollectionCommon::EModelTypeAllVideos;
- proxyGotten = mTestObject->getModel(type);
+ proxyGotten = mTestObject->getAllVideosModel();
QVERIFY(proxyGotten);
- QVERIFY(proxyGotten->mType == type);
- proxyGotten = mTestObject->getModel(type);
- QVERIFY(proxyGotten);
- QVERIFY(proxyGotten->mType == type);
+
+ QString name = proxyGotten->metaObject()->className();
+ QString expectedName = QString("VideoProxyModelAllVideos");
+ QVERIFY(name == expectedName);
+ // again
+ proxyGotten2 = mTestObject->getAllVideosModel();
+ QCOMPARE(proxyGotten, proxyGotten2);
delete proxyGotten;
proxyGotten = 0;
-
- // VideoCollectionWrapper::ECollections
- type = VideoCollectionCommon::EModelTypeCollections;
- proxyGotten = mTestObject->getModel(type);
- QVERIFY(proxyGotten);
- QVERIFY(proxyGotten->mType == type);
- proxyGotten = mTestObject->getModel(type);
+
+ proxyGotten = mTestObject->getCollectionsModel();
QVERIFY(proxyGotten);
- QVERIFY(proxyGotten->mType == type);
- delete proxyGotten;
- proxyGotten = 0;
-
- // VideoCollectionWrapper::EGeneric
- type = VideoCollectionCommon::EModelTypeGeneric;
- proxyGotten = mTestObject->getModel(type);
- QVERIFY(proxyGotten);
- QVERIFY(proxyGotten->mType == type);
- proxyGotten = mTestObject->getModel(type);
- QVERIFY(proxyGotten);
- QVERIFY(proxyGotten->mType == type);
+ name = proxyGotten->metaObject()->className();
+ expectedName = QString("VideoProxyModelCollections");
+ QVERIFY(name == expectedName);
+ // again
+ proxyGotten2 = mTestObject->getCollectionsModel();
+ QCOMPARE(proxyGotten, proxyGotten2);
delete proxyGotten;
proxyGotten = 0;
- // VideoCollectionWrapper::ECollectionContent
- type = VideoCollectionCommon::EModelTypeCollectionContent;
- proxyGotten = mTestObject->getModel(type);
+ proxyGotten = mTestObject->getCollectionContentModel();
QVERIFY(proxyGotten);
- QVERIFY(proxyGotten->mType == type);
- proxyGotten = mTestObject->getModel(type);
+ name = proxyGotten->metaObject()->className();
+ expectedName = QString("VideoProxyModelContent");
+ QVERIFY(name == expectedName);
+ // again
+ proxyGotten2 = mTestObject->getCollectionContentModel();
+ QCOMPARE(proxyGotten, proxyGotten2);
+ delete proxyGotten;
+ proxyGotten = 0;
+
+ proxyGotten = mTestObject->getGenericModel();
QVERIFY(proxyGotten);
- QVERIFY(proxyGotten->mType == type);
+ name = proxyGotten->metaObject()->className();
+ expectedName = QString("VideoProxyModelGeneric");
+ QVERIFY(name == expectedName);
+ // again
+ proxyGotten2 = mTestObject->getGenericModel();
+ QCOMPARE(proxyGotten, proxyGotten2);
delete proxyGotten;
proxyGotten = 0;
}
@@ -184,22 +173,24 @@
QVERIFY(mTestObject);
connect(this, SIGNAL(testSignal()), mTestObject, SLOT(aboutToQuitSlot()));
- VideoSortFilterProxyModel *proxyGotten = 0;
- VideoSortFilterProxyModel::setInitFailure(false);
- VideoCollectionCommon::TModelType type = VideoCollectionCommon::EModelTypeAllVideos;
- proxyGotten = mTestObject->getModel(type);
+ VideoProxyModelGeneric *proxyGotten = 0;
+ proxyGotten = mTestObject->getAllVideosModel();
QVERIFY(proxyGotten);
QVERIFY(!mTestObject->mSourceModel.isNull());
- emit testSignal();
- QVERIFY(mTestObject->mSourceModel.isNull());
emit testSignal();
QVERIFY(mTestObject->mSourceModel.isNull());
+ proxyGotten = mTestObject->getAllVideosModel();
+ QVERIFY(!proxyGotten);
+ emit testSignal();
+ QVERIFY(mTestObject->mSourceModel.isNull());
+ proxyGotten = mTestObject->getAllVideosModel();
+ QVERIFY(!proxyGotten);
+
disconnect(this, SIGNAL(testSignal()), mTestObject, SLOT(aboutToQuitSlot()));
}
-
// End of file
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/stub/inc/videocollectionwrapper.h
--- a/videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/stub/inc/videocollectionwrapper.h Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/stub/inc/videocollectionwrapper.h Fri Sep 03 12:37:43 2010 +0300
@@ -24,12 +24,5 @@
public: // Constructor
- enum TModelType
- {
- EAllVideos,
- ECollections,
- EGeneric,
- ECollectionContent
- };
};
#endif // __VIDEOCOLLECTIONWRAPPER_H__
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/stub/inc/videoproxymodelallvideos.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/stub/inc/videoproxymodelallvideos.h Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: stub VideoProxyModelAllVideos for VideoCollectionWrapperPrivate unit tests
+*
+*/
+
+#ifndef VIDEOPROXYMODELALLVIDEOS_H
+#define VIDEOPROXYMODELALLVIDEOS_H
+
+#include
+
+class VideoProxyModelAllVideos : public VideoProxyModelGeneric
+{
+ Q_OBJECT
+
+signals:
+
+ void shortDetailsReady(TMPXItemId);
+
+public:
+
+ /**
+ * Contructor.
+ *
+ * @param parent parent of this widget
+ */
+ VideoProxyModelAllVideos(QObject *parent=0);
+
+ /**
+ * Destructor.
+ *
+ */
+ virtual ~VideoProxyModelAllVideos();
+
+public:
+
+ static int mAllVideosModelConstructCallCount;
+};
+
+#endif // VIDEOPROXYMODELALLVIDEOS_H
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/stub/inc/videoproxymodelcollections.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/stub/inc/videoproxymodelcollections.h Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: stub VideoProxyModelCollections for VideoCollectionWrapperPrivate unit tests
+*
+*/
+
+#ifndef VIDEOPROXYMODELCOLLETIONS_H
+#define VIDEOPROXYMODELCOLLETIONS_H
+
+#include
+
+class VideoProxyModelCollections : public VideoProxyModelGeneric
+{
+ Q_OBJECT
+
+signals:
+
+ void shortDetailsReady(TMPXItemId);
+
+public:
+
+ /**
+ * Contructor.
+ *
+ * @param parent parent of this widget
+ */
+ VideoProxyModelCollections(QObject *parent=0);
+
+ /**
+ * Destructor.
+ *
+ */
+ virtual ~VideoProxyModelCollections();
+
+public:
+
+ static int mCollectionsModelConstructCallCount;
+};
+
+#endif // VIDEOPROXYMODELCOLLETIONS_H
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/stub/inc/videoproxymodelcontent.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/stub/inc/videoproxymodelcontent.h Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: stub VideoProxyModelContent for VideoCollectionWrapperPrivate unit tests
+*
+*/
+
+#ifndef VIDEOPROXYMODELCONTENT_H
+#define VIDEOPROXYMODELCONTENT_H
+
+#include
+
+class VideoProxyModelContent : public VideoProxyModelGeneric
+{
+ Q_OBJECT
+
+signals:
+
+ void shortDetailsReady(TMPXItemId);
+
+public:
+
+ /**
+ * Contructor.
+ *
+ * @param parent parent of this widget
+ * @param client Collection client pointer to use.
+ */
+ VideoProxyModelContent(QObject *parent=0);
+
+ /**
+ * Destructor.
+ *
+ */
+ virtual ~VideoProxyModelContent();
+
+public:
+
+ static int mContentModelConstructCallCount;
+};
+
+#endif // VIDEOPROXYMODELCONTENT_H
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/stub/inc/videoproxymodelgeneric.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/stub/inc/videoproxymodelgeneric.h Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,67 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: stub VideoProxyModelGeneric for VideoCollectionWrapperPrivate unit tests
+*
+*/
+
+#ifndef VIDEOPROXYMODELGENERIC_H
+#define VIDEOPROXYMODELGENERIC_H
+
+#include
+#include
+
+class QTimer;
+class VideoListDataModel;
+class VideoCollectionClient;
+
+class VideoProxyModelGeneric : public QObject
+{
+ Q_OBJECT
+
+signals:
+
+ void shortDetailsReady(TMPXItemId);
+
+public:
+
+ /**
+ * Contructor.
+ *
+ * @param parent parent of this widget
+ */
+ VideoProxyModelGeneric(QObject *parent=0);
+
+ /**
+ * Destructor.
+ *
+ */
+ virtual ~VideoProxyModelGeneric();
+
+ /**
+ * Initialize.
+ */
+ int initialize(VideoListDataModel *sourceModel);
+
+public:
+
+ /**
+ * Pointer to the actual model.
+ * Not owned.
+ */
+ VideoListDataModel *mModel;
+
+ static int mGenericModelConstructCallCount;
+};
+
+#endif // VIDEOPROXYMODELGENERIC_H
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/stub/inc/videosortfilterproxymodel.h
--- a/videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/stub/inc/videosortfilterproxymodel.h Mon Aug 23 14:27:29 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: stub Videosortfilterproxymodel for VideoCollectionWrapperPrivate unit tests
-*
-*/
-
-#ifndef VIDEOSORTFILTERPROXYMODEL_H
-#define VIDEOSORTFILTERPROXYMODEL_H
-
-#include
-#include
-
-class QTimer;
-class VideoListDataModel;
-class VideoCollectionClient;
-
-class VideoSortFilterProxyModel : public QObject
-{
- Q_OBJECT
-
-signals:
-
- void shortDetailsReady(TMPXItemId);
-
-public:
-
- /**
- * Contructor.
- *
- * @param parent parent of this widget
- * @param client Collection client pointer to use.
- */
- VideoSortFilterProxyModel( int type, QObject *parent=0);
-
- /**
- * Destructor.
- *
- */
- virtual ~VideoSortFilterProxyModel();
-
- /**
- * Initializes model, calls initialize to source model, and sets
- * the given sourceModel as source model for this proxy model.
- *
- * @param collection mpx video collectionobject
- * @param sourceModel the source model
- *
- * @return int: 0 if everything ok
- */
- int initialize(VideoListDataModel *sourceModel);
-
-public:
-
-
- /**
- * sets gInitFails
- *
- * @param bool
- */
- static void setInitFailure(bool fails);
-
-
- /**
- * Pointer to the actual model.
- * Not owned.
- */
- VideoListDataModel *mModel;
-
- /**
- * type
- */
- int mType;
-
-};
-
-
-
-#endif //VIDEOSORTFILTERPROXYMODEL_H
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/stub/src/videoproxymodelallvideos.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/stub/src/videoproxymodelallvideos.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: stub VideoProxyModelGeneric for VideoCollectionWrapperPrivate unit tests
+*
+*/
+
+#include
+#include
+#include
+
+#include "videocollectioncommon.h"
+#include "videoproxymodelallvideos.h"
+#include "videolistdatamodel.h"
+#include "videocollectionclient.h"
+
+int VideoProxyModelAllVideos::mAllVideosModelConstructCallCount = 0;
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelAllVideos::VideoProxyModelAllVideos
+// -----------------------------------------------------------------------------
+//
+VideoProxyModelAllVideos::VideoProxyModelAllVideos(QObject *parent) :
+VideoProxyModelGeneric(parent)
+{
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelAllVideos::~VideoProxyModelAllVideos
+// -----------------------------------------------------------------------------
+//
+VideoProxyModelAllVideos::~VideoProxyModelAllVideos()
+{
+}
+
+// end of file
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/stub/src/videoproxymodelcollections.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/stub/src/videoproxymodelcollections.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: stub VideoProxyModelGeneric for VideoCollectionWrapperPrivate unit tests
+*
+*/
+
+#include
+#include
+#include
+
+#include "videocollectioncommon.h"
+#include "videoproxymodelcollections.h"
+#include "videolistdatamodel.h"
+#include "videocollectionclient.h"
+
+int VideoProxyModelCollections::mCollectionsModelConstructCallCount = 0;
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelCollections::VideoProxyModelCollections
+// -----------------------------------------------------------------------------
+//
+VideoProxyModelCollections::VideoProxyModelCollections(QObject *parent) :
+VideoProxyModelGeneric(parent)
+{
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelCollections::~VideoProxyModelCollections
+// -----------------------------------------------------------------------------
+//
+VideoProxyModelCollections::~VideoProxyModelCollections()
+{
+}
+
+// end of file
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/stub/src/videoproxymodelcontent.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/stub/src/videoproxymodelcontent.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: stub VideoProxyModelGeneric for VideoCollectionWrapperPrivate unit tests
+*
+*/
+
+#include
+#include
+#include
+
+#include "videocollectioncommon.h"
+#include "videoproxymodelcontent.h"
+#include "videolistdatamodel.h"
+#include "videocollectionclient.h"
+
+int VideoProxyModelContent::mContentModelConstructCallCount = 0;
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelContent::VideoProxyModelContent
+// -----------------------------------------------------------------------------
+//
+VideoProxyModelContent::VideoProxyModelContent(QObject *parent) :
+VideoProxyModelGeneric(parent)
+{
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelContent::~VideoProxyModelContent
+// -----------------------------------------------------------------------------
+//
+VideoProxyModelContent::~VideoProxyModelContent()
+{
+}
+
+// end of file
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/stub/src/videoproxymodelgeneric.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/stub/src/videoproxymodelgeneric.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: stub VideoProxyModelGeneric for VideoCollectionWrapperPrivate unit tests
+*
+*/
+
+#include
+#include
+#include
+
+#include "videocollectioncommon.h"
+#include "videoproxymodelgeneric.h"
+#include "videolistdatamodel.h"
+#include "videocollectionclient.h"
+
+int VideoProxyModelGeneric::mGenericModelConstructCallCount = 0;
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::VideoProxyModelGeneric
+// -----------------------------------------------------------------------------
+//
+VideoProxyModelGeneric::VideoProxyModelGeneric(QObject *parent) :
+QObject(parent),
+mModel(0)
+{
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::~VideoProxyModelGeneric
+// -----------------------------------------------------------------------------
+//
+VideoProxyModelGeneric::~VideoProxyModelGeneric()
+{
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::initialize
+// -----------------------------------------------------------------------------
+//
+int VideoProxyModelGeneric::initialize(VideoListDataModel *sourceModel)
+{
+ mModel = sourceModel;
+ return 0;
+}
+
+// end of file
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/stub/src/videosortfilterproxymodel.cpp
--- a/videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/stub/src/videosortfilterproxymodel.cpp Mon Aug 23 14:27:29 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: stub Videosortfilterproxymodel for VideoCollectionWrapperPrivate unit tests
-*
-*/
-
-#include
-#include
-#include
-
-#include "videocollectioncommon.h"
-#include "videosortfilterproxymodel.h"
-#include "videolistdatamodel.h"
-#include "videocollectionclient.h"
-
-bool gInitFails = false;
-
-bool gFetchMediaIDFails = false;
-
-bool gFailDeleteFile = false;
-
-// -----------------------------------------------------------------------------
-// setInitFailure
-// -----------------------------------------------------------------------------
-//
-void VideoSortFilterProxyModel::setInitFailure(bool fails)
-{
- gInitFails = fails;
-}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::VideoSortFilterProxyModel
-// -----------------------------------------------------------------------------
-//
-VideoSortFilterProxyModel::VideoSortFilterProxyModel(int type, QObject *parent) :
- QObject(parent),
- mModel(0),
- mType(type)
-{
-}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::~VideoSortFilterProxyModel
-// -----------------------------------------------------------------------------
-//
-VideoSortFilterProxyModel::~VideoSortFilterProxyModel()
-{
-}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::initialize
-// -----------------------------------------------------------------------------
-//
-int VideoSortFilterProxyModel::initialize(VideoListDataModel *sourceModel)
-{
- mModel = sourceModel;
- return gInitFails ? -1 : 0;
-}
-// end of file
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/testvideocollectionwrapper_p.pro
--- a/videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/testvideocollectionwrapper_p.pro Mon Aug 23 14:27:29 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/testvideocollectionwrapper_p.pro Fri Sep 03 12:37:43 2010 +0300
@@ -25,12 +25,18 @@
# Input
HEADERS += inc/testvideocollectionwrapper_p.h \
- stub/inc/videosortfilterproxymodel.h \
+ stub/inc/videoproxymodelgeneric.h \
+ stub/inc/videoproxymodelallvideos.h \
+ stub/inc/videoproxymodelcollections.h \
+ stub/inc/videoproxymodelcontent.h \
stub/inc/videolistdatamodel.h \
stub/inc/videocollectionwrapper.h \
../../inc/videocollectionwrapper_p.h
SOURCES += src/testvideocollectionwrapper_p.cpp \
- stub/src/videosortfilterproxymodel.cpp \
+ stub/src/videoproxymodelgeneric.cpp \
+ stub/src/videoproxymodelallvideos.cpp \
+ stub/src/videoproxymodelcollections.cpp \
+ stub/src/videoproxymodelcontent.cpp \
stub/src/videolistdatamodel.cpp \
../../src/videocollectionwrapper_p.cpp
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideoproxymodelallvideos/inc/testvideoproxymodelallvideos.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelallvideos/inc/testvideoproxymodelallvideos.h Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,75 @@
+/**
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: tester for methods in VideoProxyModelAllVideos
+*
+*/
+
+#ifndef __TESTVIDEOPROXYMODELALLVIDEOS_H__
+#define __TESTVIDEOPROXYMODELALLVIDEOS_H__
+
+
+// INCLUDES
+#include
+#include
+
+class FilterProxyTester;
+
+class TestVideoProxyModelAllVideos : public QObject
+{
+ Q_OBJECT
+
+ // test functions for the test framework
+
+signals:
+
+private slots:
+
+ /**
+ * will be called before each testfunction is executed.
+ *
+ */
+ void init();
+
+ /**
+ * will be called after every testfunction.
+ *
+ */
+ void cleanup();
+
+ /**
+ * Tests filterAcceptsRow.
+ */
+ void testFilterAcceptsRow();
+
+ /**
+ * Tests getOpenItem.
+ */
+ void testGetOpenItem();
+
+private:
+
+ /**
+ * tester object inherited from the actual test object
+ * implemented to be able to call protected objects
+ */
+ FilterProxyTester *mTestObject;
+
+};
+
+#endif // __TESTVIDEOPROXYMODELALLVIDEOS_H__
+
+// End of file
+
+
+
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideoproxymodelallvideos/src/testvideoproxymodelallvideos.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelallvideos/src/testvideoproxymodelallvideos.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,156 @@
+/**
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: tester for methods in VideoProxyModelAllVideos
+*
+*/
+
+#include
+#include
+#include
+
+#include
+#include "videoproxymodelgeneric.h"
+
+#define private public
+#include "videoproxymodelallvideos.h"
+#undef private
+
+#include "videolistdatamodel.h"
+#include "filterproxytester.h"
+#include "videocollectioncommon.h"
+#include "testvideoproxymodelallvideos.h"
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ HbApplication app(argc, argv);
+
+ TestVideoProxyModelAllVideos tv;
+
+ int res;
+ if(argc > 1)
+ {
+ res = QTest::qExec(&tv, argc, argv);
+ }
+ else
+ {
+ char *pass[3];
+ pass[0] = argv[0];
+ pass[1] = "-o";
+ pass[2] = "c:\\data\\testVideoProxyModelAllVideos.txt";
+ res = QTest::qExec(&tv, 3, pass);
+ }
+
+ return res;
+}
+
+// ---------------------------------------------------------------------------
+// init
+// ---------------------------------------------------------------------------
+//
+void TestVideoProxyModelAllVideos::init()
+{
+ qRegisterMetaType("TMPXItemId");
+
+ mTestObject = new FilterProxyTester();
+}
+
+// ---------------------------------------------------------------------------
+// cleanup
+// ---------------------------------------------------------------------------
+//
+void TestVideoProxyModelAllVideos::cleanup()
+{
+ delete mTestObject;
+ mTestObject = 0;
+}
+
+// ---------------------------------------------------------------------------
+// testFilterAcceptsRow
+// ---------------------------------------------------------------------------
+//
+void TestVideoProxyModelAllVideos::testFilterAcceptsRow()
+{
+ // No source model
+ VideoListDataModel *model = 0;
+ mTestObject->mModel = model;
+ VideoListDataModel::mMediaIdAtIndexReturnValue = TMPXItemId::InvalidId();
+ VideoListDataModel::mMediaIdAtIndexCallCount = 0;
+ VideoListDataModel::mRowCountReturnValue = 0;
+ QVERIFY(mTestObject->callFilterAcceptsRow(0, QModelIndex()) == false);
+ QCOMPARE(VideoListDataModel::mMediaIdAtIndexCallCount, 0);
+
+ // Source row < 0
+ model = new VideoListDataModel();
+ mTestObject->mModel = model;
+ VideoListDataModel::mMediaIdAtIndexReturnValue = TMPXItemId::InvalidId();
+ VideoListDataModel::mMediaIdAtIndexCallCount = 0;
+ VideoListDataModel::mRowCountReturnValue = 0;
+ QVERIFY(mTestObject->callFilterAcceptsRow(-1, QModelIndex()) == false);
+ QCOMPARE(VideoListDataModel::mMediaIdAtIndexCallCount, 0);
+
+ // Source row > model row count
+ VideoListDataModel::mMediaIdAtIndexReturnValue = TMPXItemId::InvalidId();
+ VideoListDataModel::mMediaIdAtIndexCallCount = 0;
+ VideoListDataModel::mRowCountReturnValue = 0;
+ QVERIFY(mTestObject->callFilterAcceptsRow(10, QModelIndex()) == false);
+ QCOMPARE(VideoListDataModel::mMediaIdAtIndexCallCount, 0);
+
+ // Item id is not video
+ VideoListDataModel::mMediaIdAtIndexReturnValue = TMPXItemId(0, KVcxMvcMediaTypeAlbum);
+ VideoListDataModel::mMediaIdAtIndexCallCount = 0;
+ VideoListDataModel::mRowCountReturnValue = 1;
+ QVERIFY(mTestObject->callFilterAcceptsRow(0, QModelIndex()) == false);
+ QCOMPARE(VideoListDataModel::mMediaIdAtIndexCallCount, 1);
+
+ // Good case
+ VideoListDataModel::mMediaIdAtIndexReturnValue = TMPXItemId(0, KVcxMvcMediaTypeVideo);
+ VideoListDataModel::mMediaIdAtIndexCallCount = 0;
+ VideoListDataModel::mRowCountReturnValue = 1;
+ QVERIFY(mTestObject->callFilterAcceptsRow(0, QModelIndex()) == true);
+ QCOMPARE(VideoListDataModel::mMediaIdAtIndexCallCount, 1);
+}
+
+// ---------------------------------------------------------------------------
+// testGetOpenItem
+// ---------------------------------------------------------------------------
+//
+void TestVideoProxyModelAllVideos::testGetOpenItem()
+{
+ TMPXItemId returned = TMPXItemId(1, 1);
+
+ // No model
+ VideoListDataModel *model = 0;
+ mTestObject->mModel = model;
+ returned = mTestObject->getOpenItem();
+ QVERIFY(returned == TMPXItemId::InvalidId());
+
+ // No collection client
+ model = new VideoListDataModel();
+ mTestObject->mModel = model;
+ mTestObject->mCollectionClient = 0;
+ returned = mTestObject->getOpenItem();
+ QVERIFY(returned == TMPXItemId::InvalidId());
+
+ // Good case.
+ mTestObject->mModel = model;
+ mTestObject->mCollectionClient = 1;
+ returned = mTestObject->getOpenItem();
+ QVERIFY(returned == TMPXItemId(KVcxMvcCategoryIdAll, KVcxMvcMediaTypeCategory));
+}
+
+// End of file
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideoproxymodelallvideos/stub/inc/filterproxytester.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelallvideos/stub/inc/filterproxytester.h Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,67 @@
+
+/**
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Helper class to test protected members from the proxy model
+*
+*/
+
+#ifndef __FILTERLISTPROXY_TESTER_H
+#define __FILTERLISTPROXY_TESTER_H
+
+#include
+#include
+
+#include "videocollectioncommon.h"
+
+#include "videoproxymodelgeneric.h"
+
+#define private public
+#include "videoproxymodelallvideos.h"
+#undef private
+
+class FilterProxyTester : public VideoProxyModelAllVideos
+{
+
+ Q_OBJECT
+
+public: // Constructors and destructor
+
+ /**
+ * Constructor
+ *
+ */
+ FilterProxyTester(QObject *parent = 0);
+
+ /**
+ * destructor
+ *
+ */
+ virtual ~FilterProxyTester();
+
+public: // helper methods for test
+
+ /**
+ * Helper methor to call protected lessThan.
+ *
+ */
+ bool callLessThan( const QModelIndex & left, const QModelIndex & right ) const;
+
+ /**
+ * Helper methor to call protected filterAcceptsRow.
+ *
+ */
+ bool callFilterAcceptsRow( int source_row, const QModelIndex & source_parent ) const;
+};
+
+#endif // __FILTERLISTPROXY_TESTER_H
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideoproxymodelallvideos/stub/inc/videolistdatamodel.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelallvideos/stub/inc/videolistdatamodel.h Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,66 @@
+
+/**
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Stub collection client to be used when unit testing the proxy model.
+*
+*/
+
+#ifndef __STUB_VIDEOLISTDATAMODELFORPROXY_H
+#define __STUB_VIDEOLISTDATAMODELFORPROXY_H
+
+#include
+#include
+#include
+#include
+#include "videocollectioncommon.h"
+
+class VideoListDataModel : public QObject
+{
+ Q_OBJECT
+
+public: // Constructors and destructor
+
+ /**
+ * Constructor
+ *
+ */
+ VideoListDataModel(QObject *parent = NULL);
+
+ /**
+ * destructor
+ *
+ */
+ virtual ~VideoListDataModel();
+
+ /**
+ * Stub method.
+ */
+ TMPXItemId mediaIdAtIndex(int index);
+
+ /**
+ * Stub method.
+ */
+ const int rowCount() const;
+
+public:
+
+ static TMPXItemId mMediaIdAtIndexReturnValue;
+ static int mMediaIdAtIndexCallCount;
+ static int mRowCountReturnValue;
+
+};
+
+#endif // __STUB_VIDEOLISTDATAMODELFORPROXY_H
+
+
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideoproxymodelallvideos/stub/inc/videoproxymodelgeneric.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelallvideos/stub/inc/videoproxymodelgeneric.h Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,129 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: stub VideoProxyModelGeneric class definition
+*
+*/
+
+#ifndef VIDEOPROXYMODELGENERIC_H
+#define VIDEOPROXYMODELGENERIC_H
+
+// INCLUDES
+#include
+#include
+#include
+
+class VideoListDataModel;
+
+// CLASS DECLARATION
+class VideoProxyModelGeneric : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * Contructor.
+ *
+ * @param QObject parent object.
+ */
+ VideoProxyModelGeneric(QObject *parent = 0);
+
+ /**
+ * Destructor.
+ *
+ */
+ virtual ~VideoProxyModelGeneric();
+
+public:
+
+ /**
+ * Opens the defined item. This is quite abstract as depending
+ * on the type of the item, the behaviour or result could be
+ * quite different.
+ *
+ * @param item id id of the item to be opened
+ * @return int 0 succeeds, <0 if opening does not succeed.
+ */
+ virtual int openItem(TMPXItemId mediaId);
+
+ /**
+ * Gets the currently opened item.
+ *
+ * @param None.
+ * @return TMPXItemId.
+ */
+ virtual TMPXItemId getOpenItem() const;
+
+ /**
+ * Compares items based in the role setted before sorting. From QSortFilterProxyModel.
+ *
+ */
+ virtual bool lessThan(const QModelIndex & left, const QModelIndex & right) const;
+
+ /**
+ * Filtering functionality. Called by the FW. From QSortFilterProxyModel.
+ *
+ * @param source_row row to check
+ * @param source_parent row's parent
+ *
+ * @return bool row accepted(true) or not accepted(false)
+ */
+ virtual bool filterAcceptsRow(int source_row, const QModelIndex & source_parent) const;
+
+ /**
+ * Connects all signals emitted from or throught this object.
+ *
+ * @return bool
+ */
+ virtual bool connectSignals();
+
+ /**
+ * Disconnects all signals.
+ */
+ void disconnectSignals();
+
+ /**
+ * Does actual sorting and emits sortingReady.
+ *
+ */
+ virtual void processSorting();
+
+ /**
+ * Returns sourceModel;
+ */
+ virtual const VideoListDataModel *sourceModel() const;
+
+public:
+ static int mOpenItemCallCount;
+ static int mGetOpenItemCallCount;
+ static int mLessThanCallCount;
+ static int mFilterAcceptsRowCallCount;
+ static int mConnectSignalsCallCount;
+ static int mDisconnectSignalsCallCount;
+ static int mProcessSortingCallCount;
+
+public:
+
+ /**
+ * Pointer to the actual model.
+ */
+ VideoListDataModel *mModel;
+
+ /**
+ * Collection client.
+ */
+ int mCollectionClient;
+};
+
+#endif // VIDEOPROXYMODELGENERIC_H
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideoproxymodelallvideos/stub/src/filterproxytester.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelallvideos/stub/src/filterproxytester.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,62 @@
+
+/**
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Helper class to test protected members from the proxy model
+*
+*/
+
+// INCLUDES
+
+#include "filterproxytester.h"
+
+// ---------------------------------------------------------------------------
+// FilterProxyTester
+// ---------------------------------------------------------------------------
+//
+FilterProxyTester::FilterProxyTester(QObject *parent) :
+VideoProxyModelAllVideos(parent)
+{
+ // NOP
+}
+
+// ---------------------------------------------------------------------------
+// ~FilterProxyTester
+// ---------------------------------------------------------------------------
+//
+FilterProxyTester::~FilterProxyTester()
+{
+
+}
+
+// ---------------------------------------------------------------------------
+// callLessThan
+// ---------------------------------------------------------------------------
+//
+bool FilterProxyTester::callLessThan( const QModelIndex & left, const QModelIndex & right ) const
+{
+ return VideoProxyModelAllVideos::lessThan(left, right);
+}
+
+
+// ---------------------------------------------------------------------------
+// callLessThan
+// ---------------------------------------------------------------------------
+//
+bool FilterProxyTester::callFilterAcceptsRow( int source_row, const QModelIndex & source_parent ) const
+{
+ return VideoProxyModelAllVideos::filterAcceptsRow(source_row, source_parent);
+}
+
+
+// End of file
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideoproxymodelallvideos/stub/src/videolistdatamodel.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelallvideos/stub/src/videolistdatamodel.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,68 @@
+/**
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Stub model to be used when unit testing the proxy model.
+*
+*/
+
+
+// INCLUDES
+#include "videolistdatamodel.h"
+
+TMPXItemId VideoListDataModel::mMediaIdAtIndexReturnValue;
+int VideoListDataModel::mMediaIdAtIndexCallCount = 0;
+int VideoListDataModel::mRowCountReturnValue = 0;
+
+// ---------------------------------------------------------------------------
+// VideoListDataModel
+// ---------------------------------------------------------------------------
+//
+VideoListDataModel::VideoListDataModel(QObject *parent)
+{
+ Q_UNUSED(parent);
+}
+
+// ---------------------------------------------------------------------------
+// ~VideoListDataModel
+// ---------------------------------------------------------------------------
+//
+VideoListDataModel::~VideoListDataModel()
+{
+
+}
+
+// ---------------------------------------------------------------------------
+// mediaIdAtIndex
+// ---------------------------------------------------------------------------
+//
+TMPXItemId VideoListDataModel::mediaIdAtIndex(int index)
+{
+ Q_UNUSED(index);
+ mMediaIdAtIndexCallCount++;
+ return mMediaIdAtIndexReturnValue;
+}
+
+// ---------------------------------------------------------------------------
+// rowCount
+// ---------------------------------------------------------------------------
+//
+const int VideoListDataModel::rowCount() const
+{
+ return mRowCountReturnValue;
+}
+
+
+// End of file
+
+
+
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideoproxymodelallvideos/stub/src/videoproxymodelgeneric.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelallvideos/stub/src/videoproxymodelgeneric.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,142 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: VideoProxyModelGeneric implementation
+*
+*/
+
+// Version :
+
+// INCLUDE FILES
+#include
+#include
+#include
+#include
+#include
+
+#include "videolistdatamodel.h"
+#include "videocollectioncommon.h"
+#include "videoproxymodelgeneric.h"
+
+const TMPXItemId INVALID_ID = TMPXItemId::InvalidId();
+
+int VideoProxyModelGeneric::mOpenItemCallCount = 0;
+int VideoProxyModelGeneric::mGetOpenItemCallCount = 0;
+int VideoProxyModelGeneric::mLessThanCallCount = 0;
+int VideoProxyModelGeneric::mFilterAcceptsRowCallCount = 0;
+int VideoProxyModelGeneric::mConnectSignalsCallCount = 0;
+int VideoProxyModelGeneric::mDisconnectSignalsCallCount = 0;
+int VideoProxyModelGeneric::mProcessSortingCallCount = 0;
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::VideoProxyModelGeneric
+// -----------------------------------------------------------------------------
+//
+VideoProxyModelGeneric::VideoProxyModelGeneric(QObject *parent) :
+ mModel(0),
+ mCollectionClient(0)
+{
+ Q_UNUSED(parent);
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::~VideoProxyModelGeneric
+// -----------------------------------------------------------------------------
+//
+VideoProxyModelGeneric::~VideoProxyModelGeneric()
+{
+ delete mModel;
+ mModel = 0;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::openItem
+// -----------------------------------------------------------------------------
+//
+int VideoProxyModelGeneric::openItem(TMPXItemId mediaId)
+{
+ Q_UNUSED(mediaId);
+ mOpenItemCallCount++;
+ return -1;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::getOpenItem()
+// -----------------------------------------------------------------------------
+//
+TMPXItemId VideoProxyModelGeneric::getOpenItem() const
+{
+ mGetOpenItemCallCount++;
+ TMPXItemId itemId = TMPXItemId::InvalidId();
+ return itemId;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::lessThan
+// -----------------------------------------------------------------------------
+//
+bool VideoProxyModelGeneric::lessThan(const QModelIndex &left,
+ const QModelIndex &right) const
+{
+ Q_UNUSED(left);
+ Q_UNUSED(right);
+ mLessThanCallCount++;
+ return false;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::filterAcceptsRow
+// -----------------------------------------------------------------------------
+//
+bool VideoProxyModelGeneric::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
+{
+ Q_UNUSED(source_row);
+ Q_UNUSED(source_parent);
+ mFilterAcceptsRowCallCount++;
+ return false;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::connectSignals
+// -----------------------------------------------------------------------------
+//
+bool VideoProxyModelGeneric::connectSignals()
+{
+ mConnectSignalsCallCount++;
+ return true;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::disconnectSignals
+// -----------------------------------------------------------------------------
+//
+void VideoProxyModelGeneric::disconnectSignals()
+{
+ mDisconnectSignalsCallCount++;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::processSorting
+// -----------------------------------------------------------------------------
+//
+void VideoProxyModelGeneric::processSorting()
+{
+ mProcessSortingCallCount++;
+}
+
+const VideoListDataModel *VideoProxyModelGeneric::sourceModel() const
+{
+ return mModel;
+}
+
+// End of file
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideoproxymodelallvideos/testvideoproxymodelallvideos.pro
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelallvideos/testvideoproxymodelallvideos.pro Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,41 @@
+TEMPLATE = app
+TARGET =
+DEFINES += BUILD_VIDEOCOLLECTION_DLL
+
+DEPENDPATH += . \
+ inc \
+ src \
+ stub/inc \
+ stub/src
+
+INCLUDEPATH += . \
+ stub/inc \
+ /epoc32/include/domain \
+ /epoc32/include/domain/middleware \
+ /epoc32/include/domain/applications \
+ /epoc32/include/osextensions \
+ /epoc32/include/middleware \
+ /epoc32/include/osextensions/stdapis/stlport \
+ ../../../inc
+
+CONFIG += qtestlib \
+ Hb \
+ symbian_test
+
+LIBS += -lestor.dll \
+ -lfbscli.dll \
+ -lbitgdi.dll \
+ -lgdi.dll
+
+# Input
+HEADERS += inc/testvideoproxymodelallvideos.h \
+ stub/inc/filterproxytester.h \
+ stub/inc/videoproxymodelgeneric.h \
+ stub/inc/videolistdatamodel.h \
+ ../../inc/videoproxymodelallvideos.h
+
+SOURCES += src/testvideoproxymodelallvideos.cpp \
+ stub/src/filterproxytester.cpp \
+ stub/src/videoproxymodelgeneric.cpp \
+ stub/src/videolistdatamodel.cpp \
+ ../../src/videoproxymodelallvideos.cpp
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcollections/inc/testvideoproxymodelcollections.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcollections/inc/testvideoproxymodelcollections.h Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,72 @@
+/**
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: tester for methods in VideoProxyModelCollections
+*
+*/
+
+#ifndef __TESTVIDEOPROXYMODELCOLLETIONS_H__
+#define __TESTVIDEOPROXYMODELCOLLETIONS_H__
+
+
+// INCLUDES
+#include
+#include
+
+class FilterProxyTester;
+
+class TestVideoProxyModelCollections : public QObject
+{
+ Q_OBJECT
+
+ // test functions for the test framework
+
+signals:
+
+private slots:
+
+ /**
+ * will be called before each testfunction is executed.
+ *
+ */
+ void init();
+
+ /**
+ * will be called after every testfunction.
+ *
+ */
+ void cleanup();
+
+ /**
+ * Tests lessThan.
+ */
+ void testLessThan();
+
+ /**
+ * Tests filterAcceptsRow.
+ */
+ void testFilterAcceptsRow();
+
+private:
+
+ /**
+ * tester object inherited from the actual test object
+ * implemented to be able to call protected objects
+ */
+ FilterProxyTester *mTestObject;
+
+};
+
+#endif // __TESTVIDEOPROXYMODELCOLLETIONS_H__
+
+// End of file
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcollections/src/testvideoproxymodelcollections.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcollections/src/testvideoproxymodelcollections.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,248 @@
+/**
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: tester for methods in VideoProxyModelCollections
+*
+*/
+
+#include
+#include
+#include
+
+#include
+#include "videoproxymodelgeneric.h"
+#include "videolistdatamodel.h"
+
+#define private public
+#include "videoproxymodelcollections.h"
+#undef private
+
+#include "filterproxytester.h"
+#include "videocollectioncommon.h"
+#include "testvideoproxymodelcollections.h"
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ HbApplication app(argc, argv);
+
+ TestVideoProxyModelCollections tv;
+
+ int res;
+ if(argc > 1)
+ {
+ res = QTest::qExec(&tv, argc, argv);
+ }
+ else
+ {
+ char *pass[3];
+ pass[0] = argv[0];
+ pass[1] = "-o";
+ pass[2] = "c:\\data\\testVideoProxyModelCollections.txt";
+ res = QTest::qExec(&tv, 3, pass);
+ }
+
+ return res;
+}
+
+// ---------------------------------------------------------------------------
+// init
+// ---------------------------------------------------------------------------
+//
+void TestVideoProxyModelCollections::init()
+{
+ qRegisterMetaType("TMPXItemId");
+
+ mTestObject = new FilterProxyTester();
+}
+
+// ---------------------------------------------------------------------------
+// cleanup
+// ---------------------------------------------------------------------------
+//
+void TestVideoProxyModelCollections::cleanup()
+{
+ delete mTestObject;
+ mTestObject = 0;
+}
+
+// ---------------------------------------------------------------------------
+// testLessThan
+// ---------------------------------------------------------------------------
+//
+void TestVideoProxyModelCollections::testLessThan()
+{
+ QModelIndex left;
+ QModelIndex right;
+
+ // No model.
+ QVERIFY(mTestObject->callLessThan(left, right) == false);
+ QCOMPARE(VideoListDataModel::mMediaIdAtIndexCallCount, 0);
+
+ // Set model.
+ VideoListDataModel *model = 0;
+ model = new VideoListDataModel();
+ mTestObject->mModel = model;
+
+ // Default categories are always first in the following order:
+ // Recently played (missing currently)
+ // Captured
+ // Downloaded
+ // Podcasts (missing currently)
+
+ // Items are not categories.
+ VideoProxyModelGeneric::mLessThanCallCount = 0;
+ VideoListDataModel::mMediaIdAtIndexCallCount = 0;
+ VideoListDataModel::mMediaIdAtIndexReturnValues.append(TMPXItemId(0, KVcxMvcMediaTypeVideo));
+ VideoListDataModel::mMediaIdAtIndexReturnValues.append(TMPXItemId(1, KVcxMvcMediaTypeAlbum));
+ QVERIFY(mTestObject->callLessThan(left, right) == true);
+ QCOMPARE(VideoListDataModel::mMediaIdAtIndexCallCount, 2);
+ QCOMPARE(VideoProxyModelGeneric::mLessThanCallCount, 1);
+
+ // Both are categories, left is captured
+ VideoProxyModelGeneric::mLessThanCallCount = 0;
+ VideoListDataModel::mMediaIdAtIndexCallCount = 0;
+ VideoListDataModel::mMediaIdAtIndexReturnValues.append(
+ TMPXItemId(KVcxMvcCategoryIdCaptured, KVcxMvcMediaTypeCategory));
+ VideoListDataModel::mMediaIdAtIndexReturnValues.append(
+ TMPXItemId(KVcxMvcCategoryIdDownloads, KVcxMvcMediaTypeCategory));
+ QVERIFY(mTestObject->callLessThan(left, right) == true);
+ QCOMPARE(VideoListDataModel::mMediaIdAtIndexCallCount, 2);
+ QCOMPARE(VideoProxyModelGeneric::mLessThanCallCount, 0);
+
+ // Both are categories, left is downloads, right some other
+ VideoProxyModelGeneric::mLessThanCallCount = 0;
+ VideoListDataModel::mMediaIdAtIndexCallCount = 0;
+ VideoListDataModel::mMediaIdAtIndexReturnValues.append(
+ TMPXItemId(KVcxMvcCategoryIdDownloads, KVcxMvcMediaTypeCategory));
+ VideoListDataModel::mMediaIdAtIndexReturnValues.append(
+ TMPXItemId(KVcxMvcCategoryIdOther, KVcxMvcMediaTypeCategory));
+ QVERIFY(mTestObject->callLessThan(left, right) == true);
+ QCOMPARE(VideoListDataModel::mMediaIdAtIndexCallCount, 2);
+ QCOMPARE(VideoProxyModelGeneric::mLessThanCallCount, 0);
+
+ // Both are categories, left is downloads, right captured
+ VideoProxyModelGeneric::mLessThanCallCount = 0;
+ VideoListDataModel::mMediaIdAtIndexCallCount = 0;
+ VideoListDataModel::mMediaIdAtIndexReturnValues.append(
+ TMPXItemId(KVcxMvcCategoryIdDownloads, KVcxMvcMediaTypeCategory));
+ VideoListDataModel::mMediaIdAtIndexReturnValues.append(
+ TMPXItemId(KVcxMvcCategoryIdCaptured, KVcxMvcMediaTypeCategory));
+ QVERIFY(mTestObject->callLessThan(left, right) == false);
+ QCOMPARE(VideoListDataModel::mMediaIdAtIndexCallCount, 2);
+ QCOMPARE(VideoProxyModelGeneric::mLessThanCallCount, 0);
+
+ // Only left is category
+ VideoProxyModelGeneric::mLessThanCallCount = 0;
+ VideoListDataModel::mMediaIdAtIndexCallCount = 0;
+ VideoListDataModel::mMediaIdAtIndexReturnValues.append(
+ TMPXItemId(KVcxMvcCategoryIdDownloads, KVcxMvcMediaTypeCategory));
+ VideoListDataModel::mMediaIdAtIndexReturnValues.append(
+ TMPXItemId(1, KVcxMvcMediaTypeVideo));
+ QVERIFY(mTestObject->callLessThan(left, right) == true);
+ QCOMPARE(VideoListDataModel::mMediaIdAtIndexCallCount, 2);
+ QCOMPARE(VideoProxyModelGeneric::mLessThanCallCount, 0);
+
+ // Only right is category
+ VideoProxyModelGeneric::mLessThanCallCount = 0;
+ VideoListDataModel::mMediaIdAtIndexCallCount = 0;
+ VideoListDataModel::mMediaIdAtIndexReturnValues.append(
+ TMPXItemId(1, KVcxMvcMediaTypeVideo));
+ VideoListDataModel::mMediaIdAtIndexReturnValues.append(
+ TMPXItemId(KVcxMvcCategoryIdDownloads, KVcxMvcMediaTypeCategory));
+ QVERIFY(mTestObject->callLessThan(left, right) == false);
+ QCOMPARE(VideoListDataModel::mMediaIdAtIndexCallCount, 2);
+ QCOMPARE(VideoProxyModelGeneric::mLessThanCallCount, 0);
+
+ // Sort order is descending. Both are categories, left is captured.
+ mTestObject->mWantedSortOrder = Qt::DescendingOrder;
+ VideoProxyModelGeneric::mLessThanCallCount = 0;
+ VideoListDataModel::mMediaIdAtIndexCallCount = 0;
+ VideoListDataModel::mMediaIdAtIndexReturnValues.append(
+ TMPXItemId(KVcxMvcCategoryIdCaptured, KVcxMvcMediaTypeCategory));
+ VideoListDataModel::mMediaIdAtIndexReturnValues.append(
+ TMPXItemId(KVcxMvcCategoryIdDownloads, KVcxMvcMediaTypeCategory));
+ QVERIFY(mTestObject->callLessThan(left, right) == false);
+ QCOMPARE(VideoListDataModel::mMediaIdAtIndexCallCount, 2);
+ QCOMPARE(VideoProxyModelGeneric::mLessThanCallCount, 0);
+}
+
+// ---------------------------------------------------------------------------
+// testFilterAcceptsRow
+// ---------------------------------------------------------------------------
+//
+void TestVideoProxyModelCollections::testFilterAcceptsRow()
+{
+ // No source model
+ VideoListDataModel *model = 0;
+ mTestObject->mModel = model;
+ VideoListDataModel::mMediaIdAtIndexCallCount = 0;
+ VideoListDataModel::mRowCountReturnValue = 0;
+ QVERIFY(mTestObject->callFilterAcceptsRow(0, QModelIndex()) == false);
+ QCOMPARE(VideoListDataModel::mMediaIdAtIndexCallCount, 0);
+
+ // Source row < 0
+ model = new VideoListDataModel();
+ mTestObject->mModel = model;
+ VideoListDataModel::mMediaIdAtIndexCallCount = 0;
+ VideoListDataModel::mRowCountReturnValue = 0;
+ QVERIFY(mTestObject->callFilterAcceptsRow(-1, QModelIndex()) == false);
+ QCOMPARE(VideoListDataModel::mMediaIdAtIndexCallCount, 0);
+
+ // Source row > model row count
+ VideoListDataModel::mMediaIdAtIndexCallCount = 0;
+ VideoListDataModel::mRowCountReturnValue = 0;
+ QVERIFY(mTestObject->callFilterAcceptsRow(10, QModelIndex()) == false);
+ QCOMPARE(VideoListDataModel::mMediaIdAtIndexCallCount, 0);
+
+ // Current level is not category
+ mTestObject->mLevel = VideoCollectionCommon::ELevelVideos;
+ VideoListDataModel::mMediaIdAtIndexReturnValues.clear();
+ VideoListDataModel::mMediaIdAtIndexReturnValues.append(TMPXItemId(0, KVcxMvcMediaTypeAlbum));
+ VideoListDataModel::mMediaIdAtIndexCallCount = 0;
+ VideoListDataModel::mRowCountReturnValue = 1;
+ QVERIFY(mTestObject->callFilterAcceptsRow(0, QModelIndex()) == false);
+ QCOMPARE(VideoListDataModel::mMediaIdAtIndexCallCount, 1);
+
+ // Item id is not an album
+ mTestObject->mLevel = VideoCollectionCommon::ELevelCategory;
+ VideoListDataModel::mMediaIdAtIndexReturnValues.clear();
+ VideoListDataModel::mMediaIdAtIndexReturnValues.append(TMPXItemId(0, KVcxMvcMediaTypeVideo));
+ VideoListDataModel::mMediaIdAtIndexCallCount = 0;
+ VideoListDataModel::mRowCountReturnValue = 1;
+ QVERIFY(mTestObject->callFilterAcceptsRow(0, QModelIndex()) == false);
+ QCOMPARE(VideoListDataModel::mMediaIdAtIndexCallCount, 1);
+
+ // Item is album
+ mTestObject->mLevel = VideoCollectionCommon::ELevelCategory;
+ VideoListDataModel::mMediaIdAtIndexReturnValues.clear();
+ VideoListDataModel::mMediaIdAtIndexReturnValues.append(TMPXItemId(0, KVcxMvcMediaTypeAlbum));
+ VideoListDataModel::mMediaIdAtIndexCallCount = 0;
+ VideoListDataModel::mRowCountReturnValue = 1;
+ QVERIFY(mTestObject->callFilterAcceptsRow(0, QModelIndex()) == true);
+ QCOMPARE(VideoListDataModel::mMediaIdAtIndexCallCount, 1);
+
+ // Item is category
+ mTestObject->mLevel = VideoCollectionCommon::ELevelCategory;
+ VideoListDataModel::mMediaIdAtIndexReturnValues.clear();
+ VideoListDataModel::mMediaIdAtIndexReturnValues.append(TMPXItemId(0, KVcxMvcMediaTypeCategory));
+ VideoListDataModel::mMediaIdAtIndexCallCount = 0;
+ VideoListDataModel::mRowCountReturnValue = 1;
+ QVERIFY(mTestObject->callFilterAcceptsRow(0, QModelIndex()) == true);
+ QCOMPARE(VideoListDataModel::mMediaIdAtIndexCallCount, 1);
+}
+
+// End of file
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcollections/stub/inc/filterproxytester.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcollections/stub/inc/filterproxytester.h Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,67 @@
+
+/**
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Helper class to test protected members from the proxy model
+*
+*/
+
+#ifndef __FILTERLISTPROXY_TESTER_H
+#define __FILTERLISTPROXY_TESTER_H
+
+#include
+#include
+
+#include "videocollectioncommon.h"
+
+#include "videoproxymodelgeneric.h"
+
+#define private public
+#include "videoproxymodelcollections.h"
+#undef private
+
+class FilterProxyTester : public VideoProxyModelCollections
+{
+
+ Q_OBJECT
+
+public: // Constructors and destructor
+
+ /**
+ * Constructor
+ *
+ */
+ FilterProxyTester(QObject *parent = 0);
+
+ /**
+ * destructor
+ *
+ */
+ virtual ~FilterProxyTester();
+
+public: // helper methods for test
+
+ /**
+ * Helper methor to call protected lessThan.
+ *
+ */
+ bool callLessThan( const QModelIndex & left, const QModelIndex & right ) const;
+
+ /**
+ * Helper methor to call protected filterAcceptsRow.
+ *
+ */
+ bool callFilterAcceptsRow( int source_row, const QModelIndex & source_parent ) const;
+};
+
+#endif // __FILTERLISTPROXY_TESTER_H
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcollections/stub/inc/videolistdatamodel.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcollections/stub/inc/videolistdatamodel.h Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,65 @@
+
+/**
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Stub collection client to be used when unit testing the proxy model.
+*
+*/
+
+#ifndef __STUB_VIDEOLISTDATAMODELFORPROXY_H
+#define __STUB_VIDEOLISTDATAMODELFORPROXY_H
+
+#include
+#include
+#include
+#include
+#include "videocollectioncommon.h"
+
+class VideoListDataModel : public QObject
+{
+ Q_OBJECT
+
+public: // Constructors and destructor
+
+ /**
+ * Constructor
+ *
+ */
+ VideoListDataModel(QObject *parent = NULL);
+
+ /**
+ * destructor
+ *
+ */
+ virtual ~VideoListDataModel();
+
+ /**
+ * Stub method.
+ */
+ TMPXItemId mediaIdAtIndex(int index);
+
+ /**
+ * Stub method.
+ */
+ const int rowCount() const;
+
+public:
+ static QList mMediaIdAtIndexReturnValues;
+ static int mMediaIdAtIndexCallCount;
+ static int mRowCountReturnValue;
+
+};
+
+#endif // __STUB_VIDEOLISTDATAMODELFORPROXY_H
+
+
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcollections/stub/inc/videoproxymodelgeneric.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcollections/stub/inc/videoproxymodelgeneric.h Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,146 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: stub VideoProxyModelGeneric class definition
+*
+*/
+
+#ifndef VIDEOPROXYMODELGENERIC_H
+#define VIDEOPROXYMODELGENERIC_H
+
+// INCLUDES
+#include
+#include
+#include
+
+#include "videocollectioncommon.h"
+
+class VideoListDataModel;
+
+// CLASS DECLARATION
+class VideoProxyModelGeneric : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * Contructor.
+ *
+ * @param QObject parent object.
+ */
+ VideoProxyModelGeneric(QObject *parent = 0);
+
+ /**
+ * Destructor.
+ *
+ */
+ virtual ~VideoProxyModelGeneric();
+
+public:
+
+ /**
+ * Opens the defined item. This is quite abstract as depending
+ * on the type of the item, the behaviour or result could be
+ * quite different.
+ *
+ * @param item id id of the item to be opened
+ * @return int 0 succeeds, <0 if opening does not succeed.
+ */
+ virtual int openItem(TMPXItemId mediaId);
+
+ /**
+ * Gets the currently opened item.
+ *
+ * @param None.
+ * @return TMPXItemId.
+ */
+ virtual TMPXItemId getOpenItem() const;
+
+ /**
+ * Compares items based in the role setted before sorting. From QSortFilterProxyModel.
+ *
+ */
+ virtual bool lessThan(const QModelIndex & left, const QModelIndex & right) const;
+
+ /**
+ * Filtering functionality. Called by the FW. From QSortFilterProxyModel.
+ *
+ * @param source_row row to check
+ * @param source_parent row's parent
+ *
+ * @return bool row accepted(true) or not accepted(false)
+ */
+ virtual bool filterAcceptsRow(int source_row, const QModelIndex & source_parent) const;
+
+ /**
+ * Connects all signals emitted from or throught this object.
+ *
+ * @return bool
+ */
+ virtual bool connectSignals();
+
+ /**
+ * Disconnects all signals.
+ */
+ void disconnectSignals();
+
+ /**
+ * Does actual sorting and emits sortingReady.
+ *
+ */
+ virtual void processSorting();
+
+ /**
+ * Returns sourceModel;
+ */
+ virtual const VideoListDataModel *sourceModel() const;
+
+public:
+ static int mOpenItemCallCount;
+ static int mGetOpenItemCallCount;
+ static int mLessThanCallCount;
+ static int mFilterAcceptsRowCallCount;
+ static int mConnectSignalsCallCount;
+ static int mDisconnectSignalsCallCount;
+ static int mProcessSortingCallCount;
+
+public:
+
+ /**
+ * Pointer to the actual model.
+ */
+ VideoListDataModel *mModel;
+
+ /**
+ * Collection client.
+ */
+ int mCollectionClient;
+
+ /**
+ * Currently open level.
+ */
+ VideoCollectionCommon::TCollectionLevels mLevel;
+
+ /**
+ * Sort order (ascending or descending).
+ */
+ Qt::SortOrder mWantedSortOrder;
+
+ /*
+ * Default sort role for the model.
+ */
+ int mDefaultSortRole;
+};
+
+#endif // VIDEOPROXYMODELGENERIC_H
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcollections/stub/src/filterproxytester.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcollections/stub/src/filterproxytester.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,61 @@
+
+/**
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Helper class to test protected members from the proxy model
+*
+*/
+
+// INCLUDES
+
+#include "filterproxytester.h"
+
+// ---------------------------------------------------------------------------
+// FilterProxyTester
+// ---------------------------------------------------------------------------
+//
+FilterProxyTester::FilterProxyTester(QObject *parent) :
+VideoProxyModelCollections(parent)
+{
+ // NOP
+}
+
+// ---------------------------------------------------------------------------
+// ~FilterProxyTester
+// ---------------------------------------------------------------------------
+//
+FilterProxyTester::~FilterProxyTester()
+{
+
+}
+
+// ---------------------------------------------------------------------------
+// callLessThan
+// ---------------------------------------------------------------------------
+//
+bool FilterProxyTester::callLessThan( const QModelIndex & left, const QModelIndex & right ) const
+{
+ return VideoProxyModelCollections::lessThan(left, right);
+}
+
+
+// ---------------------------------------------------------------------------
+// callLessThan
+// ---------------------------------------------------------------------------
+//
+bool FilterProxyTester::callFilterAcceptsRow( int source_row, const QModelIndex & source_parent ) const
+{
+ return VideoProxyModelCollections::filterAcceptsRow(source_row, source_parent);
+}
+
+// End of file
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcollections/stub/src/videolistdatamodel.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcollections/stub/src/videolistdatamodel.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,72 @@
+/**
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Stub model to be used when unit testing the proxy model.
+*
+*/
+
+
+// INCLUDES
+#include "videolistdatamodel.h"
+
+QList VideoListDataModel::mMediaIdAtIndexReturnValues;
+int VideoListDataModel::mMediaIdAtIndexCallCount = 0;
+int VideoListDataModel::mRowCountReturnValue = 0;
+
+// ---------------------------------------------------------------------------
+// VideoListDataModel
+// ---------------------------------------------------------------------------
+//
+VideoListDataModel::VideoListDataModel(QObject *parent)
+{
+ Q_UNUSED(parent);
+}
+
+// ---------------------------------------------------------------------------
+// ~VideoListDataModel
+// ---------------------------------------------------------------------------
+//
+VideoListDataModel::~VideoListDataModel()
+{
+
+}
+
+// ---------------------------------------------------------------------------
+// mediaIdAtIndex
+// ---------------------------------------------------------------------------
+//
+TMPXItemId VideoListDataModel::mediaIdAtIndex(int index)
+{
+ Q_UNUSED(index);
+ mMediaIdAtIndexCallCount++;
+ if(!mMediaIdAtIndexReturnValues.isEmpty())
+ {
+ return mMediaIdAtIndexReturnValues.takeFirst();
+ }
+ TMPXItemId::InvalidId();
+}
+
+// ---------------------------------------------------------------------------
+// rowCount
+// ---------------------------------------------------------------------------
+//
+const int VideoListDataModel::rowCount() const
+{
+ return mRowCountReturnValue;
+}
+
+
+// End of file
+
+
+
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcollections/stub/src/videoproxymodelgeneric.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcollections/stub/src/videoproxymodelgeneric.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,145 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: VideoProxyModelGeneric implementation
+*
+*/
+
+// Version :
+
+// INCLUDE FILES
+#include
+#include
+#include
+#include
+#include
+
+#include "videolistdatamodel.h"
+#include "videocollectioncommon.h"
+#include "videoproxymodelgeneric.h"
+
+const TMPXItemId INVALID_ID = TMPXItemId::InvalidId();
+
+int VideoProxyModelGeneric::mOpenItemCallCount = 0;
+int VideoProxyModelGeneric::mGetOpenItemCallCount = 0;
+int VideoProxyModelGeneric::mLessThanCallCount = 0;
+int VideoProxyModelGeneric::mFilterAcceptsRowCallCount = 0;
+int VideoProxyModelGeneric::mConnectSignalsCallCount = 0;
+int VideoProxyModelGeneric::mDisconnectSignalsCallCount = 0;
+int VideoProxyModelGeneric::mProcessSortingCallCount = 0;
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::VideoProxyModelGeneric
+// -----------------------------------------------------------------------------
+//
+VideoProxyModelGeneric::VideoProxyModelGeneric(QObject *parent) :
+ mModel(0),
+ mCollectionClient(0),
+ mLevel(VideoCollectionCommon::ELevelInvalid),
+ mWantedSortOrder(Qt::AscendingOrder),
+ mDefaultSortRole(0)
+{
+ Q_UNUSED(parent);
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::~VideoProxyModelGeneric
+// -----------------------------------------------------------------------------
+//
+VideoProxyModelGeneric::~VideoProxyModelGeneric()
+{
+ delete mModel;
+ mModel = 0;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::openItem
+// -----------------------------------------------------------------------------
+//
+int VideoProxyModelGeneric::openItem(TMPXItemId mediaId)
+{
+ Q_UNUSED(mediaId);
+ mOpenItemCallCount++;
+ return -1;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::getOpenItem()
+// -----------------------------------------------------------------------------
+//
+TMPXItemId VideoProxyModelGeneric::getOpenItem() const
+{
+ mGetOpenItemCallCount++;
+ TMPXItemId itemId = TMPXItemId::InvalidId();
+ return itemId;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::lessThan
+// -----------------------------------------------------------------------------
+//
+bool VideoProxyModelGeneric::lessThan(const QModelIndex &left,
+ const QModelIndex &right) const
+{
+ Q_UNUSED(left);
+ Q_UNUSED(right);
+ mLessThanCallCount++;
+ return true;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::filterAcceptsRow
+// -----------------------------------------------------------------------------
+//
+bool VideoProxyModelGeneric::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
+{
+ Q_UNUSED(source_row);
+ Q_UNUSED(source_parent);
+ mFilterAcceptsRowCallCount++;
+ return false;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::connectSignals
+// -----------------------------------------------------------------------------
+//
+bool VideoProxyModelGeneric::connectSignals()
+{
+ mConnectSignalsCallCount++;
+ return true;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::disconnectSignals
+// -----------------------------------------------------------------------------
+//
+void VideoProxyModelGeneric::disconnectSignals()
+{
+ mDisconnectSignalsCallCount++;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::processSorting
+// -----------------------------------------------------------------------------
+//
+void VideoProxyModelGeneric::processSorting()
+{
+ mProcessSortingCallCount++;
+}
+
+const VideoListDataModel *VideoProxyModelGeneric::sourceModel() const
+{
+ return mModel;
+}
+
+// End of file
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcollections/testvideoproxymodelcollections.pro
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcollections/testvideoproxymodelcollections.pro Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,41 @@
+TEMPLATE = app
+TARGET =
+DEFINES += BUILD_VIDEOCOLLECTION_DLL
+
+DEPENDPATH += . \
+ inc \
+ src \
+ stub/inc \
+ stub/src
+
+INCLUDEPATH += . \
+ stub/inc \
+ /epoc32/include/domain \
+ /epoc32/include/domain/middleware \
+ /epoc32/include/domain/applications \
+ /epoc32/include/osextensions \
+ /epoc32/include/middleware \
+ /epoc32/include/osextensions/stdapis/stlport \
+ ../../../inc
+
+CONFIG += qtestlib \
+ Hb \
+ symbian_test
+
+LIBS += -lestor.dll \
+ -lfbscli.dll \
+ -lbitgdi.dll \
+ -lgdi.dll
+
+# Input
+HEADERS += inc/testvideoproxymodelcollections.h \
+ stub/inc/filterproxytester.h \
+ stub/inc/videoproxymodelgeneric.h \
+ stub/inc/videolistdatamodel.h \
+ ../../inc/videoproxymodelcollections.h
+
+SOURCES += src/testvideoproxymodelcollections.cpp \
+ stub/src/filterproxytester.cpp \
+ stub/src/videoproxymodelgeneric.cpp \
+ stub/src/videolistdatamodel.cpp \
+ ../../src/videoproxymodelcollections.cpp
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcontent/inc/testvideoproxymodelcontent.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcontent/inc/testvideoproxymodelcontent.h Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,87 @@
+/**
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: tester for methods in VideoProxyModelContent
+*
+*/
+
+#ifndef __TESTVIDEOPROXYMODELCONTENT_H__
+#define __TESTVIDEOPROXYMODELCONTENT_H__
+
+
+// INCLUDES
+#include
+#include
+
+class FilterProxyTester;
+
+class TestVideoProxyModelContent : public QObject
+{
+ Q_OBJECT
+
+ // test functions for the test framework
+
+signals:
+
+private slots:
+
+ /**
+ * will be called before each testfunction is executed.
+ *
+ */
+ void init();
+
+ /**
+ * will be called after every testfunction.
+ *
+ */
+ void cleanup();
+
+ /**
+ * Tests connectSignals
+ */
+ void testConnectSignals();
+
+ /**
+ * Tests disconnectSignals
+ */
+ void testDisconnectSignals();
+
+ /**
+ * Tests filterAcceptsRow
+ */
+ void testFilterAcceptsRow();
+
+ /**
+ * Tests getOpenItem
+ */
+ void testGetOpenItem();
+
+ /**
+ * Tests albumChangedSlot
+ */
+ void testAlbumChangedSlot();
+
+private:
+
+ /**
+ * tester object inherited from the actual test object
+ * implemented to be able to call protected objects
+ */
+ FilterProxyTester *mTestObject;
+
+};
+
+#endif // __TESTVIDEOPROXYMODELCONTENT_H__
+
+// End of file
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcontent/src/testvideoproxymodelcontent.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcontent/src/testvideoproxymodelcontent.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,227 @@
+/**
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: tester for methods in VideoProxyModelContent
+*
+*/
+
+#include
+#include
+#include
+
+#include "videoproxymodelgeneric.h"
+
+#define private public
+#include "videoproxymodelcontent.h"
+#undef private
+
+#include "videolistdatamodel.h"
+#include "filterproxytester.h"
+#include "videocollectioncommon.h"
+#include "testvideoproxymodelcontent.h"
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ HbApplication app(argc, argv);
+
+ TestVideoProxyModelContent tv;
+
+ int res;
+ if(argc > 1)
+ {
+ res = QTest::qExec(&tv, argc, argv);
+ }
+ else
+ {
+ char *pass[3];
+ pass[0] = argv[0];
+ pass[1] = "-o";
+ pass[2] = "c:\\data\\testVideoProxyModelContent.txt";
+ res = QTest::qExec(&tv, 3, pass);
+ }
+
+ return res;
+}
+
+// ---------------------------------------------------------------------------
+// init
+// ---------------------------------------------------------------------------
+//
+void TestVideoProxyModelContent::init()
+{
+ qRegisterMetaType("TMPXItemId");
+
+ mTestObject = new FilterProxyTester();
+}
+
+// ---------------------------------------------------------------------------
+// cleanup
+// ---------------------------------------------------------------------------
+//
+void TestVideoProxyModelContent::cleanup()
+{
+ delete mTestObject;
+ mTestObject = 0;
+}
+
+// ---------------------------------------------------------------------------
+// testConnectSignals
+// ---------------------------------------------------------------------------
+//
+void TestVideoProxyModelContent::testConnectSignals()
+{
+ // Base class connect returns false.
+ VideoProxyModelGeneric::mConnectSignalsCallCount = 0;
+ VideoProxyModelGeneric::mConnectSignalsReturnValue = false;
+ QVERIFY(mTestObject->callConnectSignals() == false);
+ QCOMPARE(VideoProxyModelGeneric::mConnectSignalsCallCount, 1);
+
+ // No model.
+ VideoProxyModelGeneric::mConnectSignalsCallCount = 0;
+ VideoProxyModelGeneric::mConnectSignalsReturnValue = true;
+ QVERIFY(mTestObject->callConnectSignals() == false);
+ QCOMPARE(VideoProxyModelGeneric::mConnectSignalsCallCount, 1);
+
+ // Model exists.
+ VideoProxyModelGeneric::mConnectSignalsCallCount = 0;
+ VideoProxyModelGeneric::mConnectSignalsReturnValue = true;
+ VideoListDataModel *model = new VideoListDataModel();
+ mTestObject->mModel = model;
+ QVERIFY(mTestObject->callConnectSignals() == true);
+ QCOMPARE(VideoProxyModelGeneric::mConnectSignalsCallCount, 1);
+}
+
+// ---------------------------------------------------------------------------
+// testDisconnectSignals
+// ---------------------------------------------------------------------------
+//
+void TestVideoProxyModelContent::testDisconnectSignals()
+{
+ // No model
+ VideoProxyModelGeneric::mDisconnectSignalsCallCount = 0;
+ mTestObject->callDisconnectSignals();
+ QCOMPARE(VideoProxyModelGeneric::mDisconnectSignalsCallCount, 1);
+
+ // Model exists.
+ VideoProxyModelGeneric::mDisconnectSignalsCallCount = 0;
+ VideoListDataModel *model = new VideoListDataModel();
+ mTestObject->mModel = model;
+ mTestObject->callDisconnectSignals();
+ QCOMPARE(VideoProxyModelGeneric::mDisconnectSignalsCallCount, 1);
+}
+
+// ---------------------------------------------------------------------------
+// testFilterAcceptsRow
+// ---------------------------------------------------------------------------
+//
+void TestVideoProxyModelContent::testFilterAcceptsRow()
+{
+ // No source model
+ VideoListDataModel *model = 0;
+ mTestObject->mModel = model;
+ VideoListDataModel::mMediaIdAtIndexReturnValue = TMPXItemId::InvalidId();
+ VideoListDataModel::mMediaIdAtIndexCallCount = 0;
+ VideoListDataModel::mRowCountReturnValue = 0;
+ QVERIFY(mTestObject->callFilterAcceptsRow(0, QModelIndex()) == false);
+ QCOMPARE(VideoListDataModel::mMediaIdAtIndexCallCount, 0);
+
+ // Source row < 0
+ model = new VideoListDataModel();
+ mTestObject->mModel = model;
+ VideoListDataModel::mMediaIdAtIndexReturnValue = TMPXItemId::InvalidId();
+ VideoListDataModel::mMediaIdAtIndexCallCount = 0;
+ VideoListDataModel::mRowCountReturnValue = 0;
+ QVERIFY(mTestObject->callFilterAcceptsRow(-1, QModelIndex()) == false);
+ QCOMPARE(VideoListDataModel::mMediaIdAtIndexCallCount, 0);
+
+ // Source row > model row count
+ VideoListDataModel::mMediaIdAtIndexReturnValue = TMPXItemId::InvalidId();
+ VideoListDataModel::mMediaIdAtIndexCallCount = 0;
+ VideoListDataModel::mRowCountReturnValue = 0;
+ QVERIFY(mTestObject->callFilterAcceptsRow(10, QModelIndex()) == false);
+ QCOMPARE(VideoListDataModel::mMediaIdAtIndexCallCount, 0);
+
+ // Doesn't belong to album
+ VideoListDataModel::mBelongsToAlbumReturnValue = false;
+ VideoListDataModel::mMediaIdAtIndexCallCount = 0;
+ VideoListDataModel::mRowCountReturnValue = 1;
+ QVERIFY(mTestObject->callFilterAcceptsRow(0, QModelIndex()) == false);
+ QCOMPARE(VideoListDataModel::mMediaIdAtIndexCallCount, 1);
+
+ // Good case
+ VideoListDataModel::mBelongsToAlbumReturnValue = true;
+ VideoListDataModel::mMediaIdAtIndexCallCount = 0;
+ VideoListDataModel::mRowCountReturnValue = 1;
+ QVERIFY(mTestObject->callFilterAcceptsRow(0, QModelIndex()) == true);
+ QCOMPARE(VideoListDataModel::mMediaIdAtIndexCallCount, 1);
+}
+
+// ---------------------------------------------------------------------------
+// testGetOpenItem
+// ---------------------------------------------------------------------------
+//
+void TestVideoProxyModelContent::testGetOpenItem()
+{
+ TMPXItemId returned = TMPXItemId(1, 1);
+
+ // No model
+ VideoListDataModel::mAlbumInUseReturnValue = TMPXItemId(2, 2);
+ VideoListDataModel *model = 0;
+ mTestObject->mModel = model;
+ returned = mTestObject->getOpenItem();
+ QVERIFY(returned == TMPXItemId::InvalidId());
+
+ // No collection client
+ returned = TMPXItemId(1, 1);
+ VideoListDataModel::mAlbumInUseReturnValue = TMPXItemId(2, 2);
+ model = new VideoListDataModel();
+ mTestObject->mModel = model;
+ mTestObject->mCollectionClient = 0;
+ returned = mTestObject->getOpenItem();
+ QVERIFY(returned == TMPXItemId::InvalidId());
+
+ // Good case.
+ returned = TMPXItemId(1, 1);
+ VideoListDataModel::mAlbumInUseReturnValue = TMPXItemId(2, 2);
+ mTestObject->mModel = model;
+ mTestObject->mCollectionClient = 1;
+ returned = mTestObject->getOpenItem();
+ QVERIFY(returned == TMPXItemId(2, 2));
+}
+
+// ---------------------------------------------------------------------------
+// testAlbumChangedSlot
+// ---------------------------------------------------------------------------
+//
+void TestVideoProxyModelContent::testAlbumChangedSlot()
+{
+ VideoProxyModelGeneric::mLastSortRole = -1;
+ mTestObject->mWantedSortRole = 5;
+ mTestObject->mWantedSortOrder = Qt::DescendingOrder;
+ VideoProxyModelGeneric::mLastSortedOrder = Qt::AscendingOrder;
+
+ VideoListDataModel *model = new VideoListDataModel();
+ mTestObject->mModel = model;
+ mTestObject->callConnectSignals();
+ emit model->emitAlbumChanged();
+ mTestObject->callDisconnectSignals();
+ QCOMPARE(VideoProxyModelGeneric::mInvalidateFilterCallCount, 1);
+ QVERIFY(VideoProxyModelGeneric::mLastSortedOrder == Qt::DescendingOrder);
+ QCOMPARE(VideoProxyModelGeneric::mLastSortRole, 5);
+}
+
+// End of file
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcontent/stub/inc/filterproxytester.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcontent/stub/inc/filterproxytester.h Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,81 @@
+
+/**
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Helper class to test protected members from the proxy model
+*
+*/
+
+#ifndef __FILTERLISTPROXY_TESTER_H
+#define __FILTERLISTPROXY_TESTER_H
+
+#include
+#include
+
+#include "videocollectioncommon.h"
+
+#include "videoproxymodelgeneric.h"
+
+#define private public
+#include "videoproxymodelcontent.h"
+#undef private
+
+class FilterProxyTester : public VideoProxyModelContent
+{
+
+ Q_OBJECT
+
+public: // Constructors and destructor
+
+ /**
+ * Constructor
+ *
+ */
+ FilterProxyTester(QObject *parent = 0);
+
+ /**
+ * destructor
+ *
+ */
+ virtual ~FilterProxyTester();
+
+public: // helper methods for test
+
+ /**
+ * Helper methor to call protected lessThan.
+ *
+ */
+ bool callLessThan( const QModelIndex & left, const QModelIndex & right ) const;
+
+ /**
+ * Helper methor to call protected filterAcceptsRow.
+ *
+ */
+ bool callFilterAcceptsRow( int source_row, const QModelIndex & source_parent ) const;
+
+ /**
+ * Helper methor to call protected connectSignals.
+ *
+ */
+ bool callConnectSignals();
+
+ /**
+ * Helper methor to call protected disconnectSignals.
+ *
+ */
+ void callDisconnectSignals();
+
+
+};
+
+#endif // __FILTERLISTPROXY_TESTER_H
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcontent/stub/inc/videolistdatamodel.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcontent/stub/inc/videolistdatamodel.h Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,87 @@
+
+/**
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Stub collection client to be used when unit testing the proxy model.
+*
+*/
+
+#ifndef __STUB_VIDEOLISTDATAMODELFORPROXY_H
+#define __STUB_VIDEOLISTDATAMODELFORPROXY_H
+
+#include
+#include
+#include
+#include
+#include "videocollectioncommon.h"
+
+class VideoListDataModel : public QObject
+{
+ Q_OBJECT
+
+public: // Constructors and destructor
+
+ /**
+ * Constructor
+ *
+ */
+ VideoListDataModel(QObject *parent = NULL);
+
+ /**
+ * destructor
+ *
+ */
+ virtual ~VideoListDataModel();
+
+ /**
+ * Stub method.
+ */
+ TMPXItemId mediaIdAtIndex(int index);
+
+ /**
+ * Stub method.
+ */
+ const int rowCount() const;
+
+ /**
+ * Stub method.
+ */
+ bool belongsToAlbum(TMPXItemId &id);
+
+ /**
+ * Stub method.
+ */
+ TMPXItemId albumInUse();
+
+ /**
+ * Helper methor to emit albumChanged signal.
+ *
+ */
+ void emitAlbumChanged();
+
+signals:
+ void albumChanged();
+
+public:
+
+ static TMPXItemId mMediaIdAtIndexReturnValue;
+ static int mMediaIdAtIndexCallCount;
+ static int mRowCountReturnValue;
+ static bool mBelongsToAlbumReturnValue;
+ static TMPXItemId mAlbumInUseReturnValue;
+
+};
+
+#endif // __STUB_VIDEOLISTDATAMODELFORPROXY_H
+
+
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcontent/stub/inc/videoproxymodelgeneric.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcontent/stub/inc/videoproxymodelgeneric.h Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,163 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: stub VideoProxyModelGeneric class definition
+*
+*/
+
+#ifndef VIDEOPROXYMODELGENERIC_H
+#define VIDEOPROXYMODELGENERIC_H
+
+// INCLUDES
+#include
+#include
+#include
+
+class VideoListDataModel;
+
+// CLASS DECLARATION
+class VideoProxyModelGeneric : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * Contructor.
+ *
+ * @param QObject parent object.
+ */
+ VideoProxyModelGeneric(QObject *parent = 0);
+
+ /**
+ * Destructor.
+ *
+ */
+ virtual ~VideoProxyModelGeneric();
+
+public:
+
+ /**
+ * Opens the defined item. This is quite abstract as depending
+ * on the type of the item, the behaviour or result could be
+ * quite different.
+ *
+ * @param item id id of the item to be opened
+ * @return int 0 succeeds, <0 if opening does not succeed.
+ */
+ virtual int openItem(TMPXItemId mediaId);
+
+ /**
+ * Gets the currently opened item.
+ *
+ * @param None.
+ * @return TMPXItemId.
+ */
+ virtual TMPXItemId getOpenItem() const;
+
+ /**
+ * Compares items based in the role setted before sorting. From QSortFilterProxyModel.
+ *
+ */
+ virtual bool lessThan(const QModelIndex & left, const QModelIndex & right) const;
+
+ /**
+ * Filtering functionality. Called by the FW. From QSortFilterProxyModel.
+ *
+ * @param source_row row to check
+ * @param source_parent row's parent
+ *
+ * @return bool row accepted(true) or not accepted(false)
+ */
+ virtual bool filterAcceptsRow(int source_row, const QModelIndex & source_parent) const;
+
+ /**
+ * Connects all signals emitted from or throught this object.
+ *
+ * @return bool
+ */
+ virtual bool connectSignals();
+
+ /**
+ * Disconnects all signals.
+ */
+ void disconnectSignals();
+
+ /**
+ * Does actual sorting and emits sortingReady.
+ *
+ */
+ virtual void processSorting();
+
+ /**
+ * Returns sourceModel;
+ */
+ virtual const VideoListDataModel *sourceModel() const;
+
+ /**
+ * Stub method.
+ */
+ void invalidateFilter();
+
+ /**
+ * Stub method.
+ */
+ void sort(int column, Qt::SortOrder order);
+
+ /**
+ * Stub method.
+ */
+ void setSortRole(int sortRole);
+
+public:
+ static int mOpenItemCallCount;
+ static int mGetOpenItemCallCount;
+ static int mLessThanCallCount;
+ static int mFilterAcceptsRowCallCount;
+ static int mConnectSignalsCallCount;
+ static bool mConnectSignalsReturnValue;
+ static int mDisconnectSignalsCallCount;
+ static int mProcessSortingCallCount;
+ static int mInvalidateFilterCallCount;
+ static Qt::SortOrder mLastSortedOrder;
+ static int mLastSortRole;
+
+public:
+
+ /**
+ * Pointer to the actual model.
+ */
+ VideoListDataModel *mModel;
+
+ /**
+ * Collection client.
+ */
+ int mCollectionClient;
+
+ /**
+ * Sort order (ascending or descending).
+ */
+ Qt::SortOrder mWantedSortOrder;
+
+ /*
+ * Sort role.
+ */
+ int mWantedSortRole;
+
+ /*
+ * Default sort role for the model.
+ */
+ int mDefaultSortRole;
+};
+
+#endif // VIDEOPROXYMODELGENERIC_H
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcontent/stub/src/filterproxytester.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcontent/stub/src/filterproxytester.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,79 @@
+
+/**
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Helper class to test protected members from the proxy model
+*
+*/
+
+// INCLUDES
+
+#include "filterproxytester.h"
+
+// ---------------------------------------------------------------------------
+// FilterProxyTester
+// ---------------------------------------------------------------------------
+//
+FilterProxyTester::FilterProxyTester(QObject *parent) :
+VideoProxyModelContent(parent)
+{
+ // NOP
+}
+
+// ---------------------------------------------------------------------------
+// ~FilterProxyTester
+// ---------------------------------------------------------------------------
+//
+FilterProxyTester::~FilterProxyTester()
+{
+
+}
+
+// ---------------------------------------------------------------------------
+// callLessThan
+// ---------------------------------------------------------------------------
+//
+bool FilterProxyTester::callLessThan( const QModelIndex & left, const QModelIndex & right ) const
+{
+ return VideoProxyModelContent::lessThan(left, right);
+}
+
+
+// ---------------------------------------------------------------------------
+// callLessThan
+// ---------------------------------------------------------------------------
+//
+bool FilterProxyTester::callFilterAcceptsRow( int source_row, const QModelIndex & source_parent ) const
+{
+ return VideoProxyModelContent::filterAcceptsRow(source_row, source_parent);
+}
+
+// ---------------------------------------------------------------------------
+// callConnectSignals
+// ---------------------------------------------------------------------------
+//
+bool FilterProxyTester::callConnectSignals()
+{
+ return connectSignals();
+}
+
+// ---------------------------------------------------------------------------
+// callDisconnectSignals
+// ---------------------------------------------------------------------------
+//
+void FilterProxyTester::callDisconnectSignals()
+{
+ disconnectSignals();
+}
+
+// End of file
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcontent/stub/src/videolistdatamodel.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcontent/stub/src/videolistdatamodel.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,94 @@
+/**
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Stub model to be used when unit testing the proxy model.
+*
+*/
+
+
+// INCLUDES
+#include "videolistdatamodel.h"
+
+TMPXItemId VideoListDataModel::mMediaIdAtIndexReturnValue;
+int VideoListDataModel::mMediaIdAtIndexCallCount = 0;
+int VideoListDataModel::mRowCountReturnValue = 0;
+bool VideoListDataModel::mBelongsToAlbumReturnValue = true;
+TMPXItemId VideoListDataModel::mAlbumInUseReturnValue = TMPXItemId::InvalidId();
+
+// ---------------------------------------------------------------------------
+// VideoListDataModel
+// ---------------------------------------------------------------------------
+//
+VideoListDataModel::VideoListDataModel(QObject *parent)
+{
+ Q_UNUSED(parent);
+}
+
+// ---------------------------------------------------------------------------
+// ~VideoListDataModel
+// ---------------------------------------------------------------------------
+//
+VideoListDataModel::~VideoListDataModel()
+{
+
+}
+
+// ---------------------------------------------------------------------------
+// mediaIdAtIndex
+// ---------------------------------------------------------------------------
+//
+TMPXItemId VideoListDataModel::mediaIdAtIndex(int index)
+{
+ Q_UNUSED(index);
+ mMediaIdAtIndexCallCount++;
+ return mMediaIdAtIndexReturnValue;
+}
+
+// ---------------------------------------------------------------------------
+// rowCount
+// ---------------------------------------------------------------------------
+//
+const int VideoListDataModel::rowCount() const
+{
+ return mRowCountReturnValue;
+}
+
+// ---------------------------------------------------------------------------
+// mediaIdAtIndex
+// ---------------------------------------------------------------------------
+//
+bool VideoListDataModel::belongsToAlbum(TMPXItemId &id)
+{
+ return mBelongsToAlbumReturnValue;
+}
+
+// ---------------------------------------------------------------------------
+// albumInUse
+// ---------------------------------------------------------------------------
+//
+TMPXItemId VideoListDataModel::albumInUse()
+{
+ return mAlbumInUseReturnValue;
+}
+
+
+// ---------------------------------------------------------------------------
+// emitAlbumChanged
+// ---------------------------------------------------------------------------
+//
+void VideoListDataModel::emitAlbumChanged()
+{
+ emit albumChanged();
+}
+// End of file
+
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcontent/stub/src/videoproxymodelgeneric.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcontent/stub/src/videoproxymodelgeneric.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,181 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: VideoProxyModelGeneric implementation
+*
+*/
+
+// Version :
+
+// INCLUDE FILES
+#include
+#include
+#include
+#include
+#include
+
+#include "videolistdatamodel.h"
+#include "videocollectioncommon.h"
+#include "videoproxymodelgeneric.h"
+
+const TMPXItemId INVALID_ID = TMPXItemId::InvalidId();
+
+int VideoProxyModelGeneric::mOpenItemCallCount = 0;
+int VideoProxyModelGeneric::mGetOpenItemCallCount = 0;
+int VideoProxyModelGeneric::mLessThanCallCount = 0;
+int VideoProxyModelGeneric::mFilterAcceptsRowCallCount = 0;
+int VideoProxyModelGeneric::mConnectSignalsCallCount = 0;
+int VideoProxyModelGeneric::mDisconnectSignalsCallCount = 0;
+int VideoProxyModelGeneric::mProcessSortingCallCount = 0;
+int VideoProxyModelGeneric::mInvalidateFilterCallCount = 0;
+Qt::SortOrder VideoProxyModelGeneric::mLastSortedOrder = Qt::AscendingOrder;
+int VideoProxyModelGeneric::mLastSortRole = 0;
+bool VideoProxyModelGeneric::mConnectSignalsReturnValue = true;
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::VideoProxyModelGeneric
+// -----------------------------------------------------------------------------
+//
+VideoProxyModelGeneric::VideoProxyModelGeneric(QObject *parent) :
+ mModel(0),
+ mCollectionClient(0),
+ mWantedSortOrder(Qt::AscendingOrder),
+ mWantedSortRole(0),
+ mDefaultSortRole(0)
+{
+ Q_UNUSED(parent);
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::~VideoProxyModelGeneric
+// -----------------------------------------------------------------------------
+//
+VideoProxyModelGeneric::~VideoProxyModelGeneric()
+{
+ delete mModel;
+ mModel = 0;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::openItem
+// -----------------------------------------------------------------------------
+//
+int VideoProxyModelGeneric::openItem(TMPXItemId mediaId)
+{
+ Q_UNUSED(mediaId);
+ mOpenItemCallCount++;
+ return -1;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::getOpenItem()
+// -----------------------------------------------------------------------------
+//
+TMPXItemId VideoProxyModelGeneric::getOpenItem() const
+{
+ mGetOpenItemCallCount++;
+ TMPXItemId itemId = TMPXItemId::InvalidId();
+ return itemId;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::lessThan
+// -----------------------------------------------------------------------------
+//
+bool VideoProxyModelGeneric::lessThan(const QModelIndex &left,
+ const QModelIndex &right) const
+{
+ Q_UNUSED(left);
+ Q_UNUSED(right);
+ mLessThanCallCount++;
+ return false;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::filterAcceptsRow
+// -----------------------------------------------------------------------------
+//
+bool VideoProxyModelGeneric::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
+{
+ Q_UNUSED(source_row);
+ Q_UNUSED(source_parent);
+ mFilterAcceptsRowCallCount++;
+ return false;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::connectSignals
+// -----------------------------------------------------------------------------
+//
+bool VideoProxyModelGeneric::connectSignals()
+{
+ mConnectSignalsCallCount++;
+ return mConnectSignalsReturnValue;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::disconnectSignals
+// -----------------------------------------------------------------------------
+//
+void VideoProxyModelGeneric::disconnectSignals()
+{
+ mDisconnectSignalsCallCount++;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::processSorting
+// -----------------------------------------------------------------------------
+//
+void VideoProxyModelGeneric::processSorting()
+{
+ mProcessSortingCallCount++;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::processSorting
+// -----------------------------------------------------------------------------
+//
+const VideoListDataModel *VideoProxyModelGeneric::sourceModel() const
+{
+ return mModel;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::processSorting
+// -----------------------------------------------------------------------------
+//
+void VideoProxyModelGeneric::invalidateFilter()
+{
+ mInvalidateFilterCallCount++;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::processSorting
+// -----------------------------------------------------------------------------
+//
+void VideoProxyModelGeneric::sort(int column, Qt::SortOrder order)
+{
+ Q_UNUSED(column);
+ mLastSortedOrder = order;
+}
+
+// -----------------------------------------------------------------------------
+// VideoProxyModelGeneric::processSorting
+// -----------------------------------------------------------------------------
+//
+void VideoProxyModelGeneric::setSortRole(int sortRole)
+{
+ mLastSortRole = sortRole;
+}
+
+// End of file
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcontent/testvideoproxymodelcontent.pro
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelcontent/testvideoproxymodelcontent.pro Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,41 @@
+TEMPLATE = app
+TARGET =
+DEFINES += BUILD_VIDEOCOLLECTION_DLL
+
+DEPENDPATH += . \
+ inc \
+ src \
+ stub/inc \
+ stub/src
+
+INCLUDEPATH += . \
+ stub/inc \
+ /epoc32/include/domain \
+ /epoc32/include/domain/middleware \
+ /epoc32/include/domain/applications \
+ /epoc32/include/osextensions \
+ /epoc32/include/middleware \
+ /epoc32/include/osextensions/stdapis/stlport \
+ ../../../inc
+
+CONFIG += qtestlib \
+ Hb \
+ symbian_test
+
+LIBS += -lestor.dll \
+ -lfbscli.dll \
+ -lbitgdi.dll \
+ -lgdi.dll
+
+# Input
+HEADERS += inc/testvideoproxymodelcontent.h \
+ stub/inc/filterproxytester.h \
+ stub/inc/videoproxymodelgeneric.h \
+ stub/inc/videolistdatamodel.h \
+ ../../inc/videoproxymodelcontent.h
+
+SOURCES += src/testvideoproxymodelcontent.cpp \
+ stub/src/filterproxytester.cpp \
+ stub/src/videoproxymodelgeneric.cpp \
+ stub/src/videolistdatamodel.cpp \
+ ../../src/videoproxymodelcontent.cpp
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideoproxymodelgeneric/inc/testvideoproxymodelgeneric.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelgeneric/inc/testvideoproxymodelgeneric.h Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,284 @@
+/**
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: tester for methods in VideoProxyModelGeneric
+*
+*/
+
+#ifndef __TESTVIDEOPROXYMODELGENERIC_H__
+#define __TESTVIDEOPROXYMODELGENERIC_H__
+
+
+// INCLUDES
+#include
+#include
+
+class VideoListDataModel;
+class FilterProxyTester;
+class VideoCollectionClient;
+class VideoProxyModelGeneric;
+
+class TestVideoProxyModelGeneric : public QObject
+{
+ Q_OBJECT
+
+ // test functions for the test framework
+
+signals:
+
+ /**
+ * test signal
+ */
+ void testSignal();
+
+ /**
+ * test signal
+ */
+ void testSignalMpxId(const TMPXItemId &id);
+
+private slots:
+
+ /**
+ * will be called before each testfunction is executed.
+ *
+ */
+ void init();
+
+ /**
+ * will be called after every testfunction.
+ *
+ */
+ void cleanup();
+
+ /**
+ * Tests initialize.
+ */
+ void testInitialize();
+
+ /**
+ * Test open.
+ */
+ void testOpen();
+
+ /**
+ * Test deleteItems with valid data.
+ */
+ void testDeleteItems();
+
+ /**
+ * Test deleteItems with NULL model.
+ */
+ void testDeleteItemsModelNull();
+
+ /**
+ * Test deleteItems when removeRows fails.
+ */
+ void testDeleteItemsRemoveRowsFail();
+
+ /**
+ * Test openItem when getMediaId fails.
+ */
+ void testOpenItemInvalidId();
+
+ /**
+ * Test openItem when collection is NULL.
+ */
+ void testOpenItemCollectionNull();
+
+ /**
+ * Test openItem when openVideo fails.
+ */
+ void testOpenItemOpenVideoFails();
+
+ /**
+ * Test openItem with valid data.
+ */
+ void testOpenItem();
+
+ /**
+ * Test back with valid data.
+ */
+ void testBack();
+
+ /**
+ * Test fetchItemDetails with valid data.
+ */
+ void testFetchItemDetails();
+
+ /**
+ * Test fetchItemDetails when getMediaId fails.
+ */
+ void testFetchItemDetailsGetMediaIdFail();
+
+ /**
+ * Test fetchItemDetails when getVideoDetails fails.
+ */
+ void testFetchItemDetailsGetVideoDetailsFails();
+
+ /**
+ * Test lessThan when there's no mModel.
+ */
+ void testLessThanNoModel();
+
+ /**
+ * Calls sure lessThan with Qt::DisplayRole setted on
+ * tests that return values are correct for presetted items
+ */
+ void testLessThanName();
+
+ /**
+ * Calls sure lessThan with VideoCollectionCommon::KeySizeValue setted on
+ * tests that return values are correct for presetted items
+ */
+ void testLessThanSize();
+
+ /**
+ * Calls sure lessThan with VideoCollectionCommon::KeyDate setted on
+ * tests that return values are correct for presetted items
+ */
+ void testLessThanDateTime();
+
+ /**
+ * Calls less than with media objects of combined default / user created
+ * collections
+ */
+ void testLessThanDefaults();
+
+ /**
+ * Calls sure lessThan with invalid role,
+ * same indexes and for invalid data
+ * tests that return values are correct for presetted items
+ */
+ void testLessThanInvalid();
+
+ /**
+ * Calls doSorting.
+ * tests that sorting is done only once
+ */
+ void testDoSorting();
+
+ /**
+ * Calls filterAcceptsRow. using type EAllVideos for model
+ * Tests that return values are correct with items with varying statuses.
+ *
+ */
+ void testFilterAcceptsRowVideos();
+
+ /**
+ * Calls filterAcceptsRow. using type differ than EAllVideos for model
+ * Tests that return values are correct with items with varying statuses.
+ *
+ */
+ void testFilterAcceptsNoVideoTypes();
+
+ /**
+ * Test getMediaFilePathForId.
+ */
+ void testGetMediaFilePathForId();
+
+ /**
+ * Tests calling addNewCollection when initialize has not been called.
+ */
+ void testAddNewCollectionNoCollectionClient();
+
+ /**
+ * Tests calling addNewCollection where collection client returns 0.
+ */
+ void testAddNewCollectionSucceed();
+
+ /**
+ * tests resolveAlbumName
+ */
+ void testResolveAlbumName();
+
+ /**
+ * tests addItemsInAlbum
+ */
+ void testAddItemsInAlbum();
+
+ /**
+ * tests removeItemsFromAlbum
+ */
+ void testRemoveItemsFromAlbum();
+
+ /**
+ * tests getOpenItem
+ */
+ void testGetOpenItem();
+
+ /**
+ * tests removeAlbums
+ */
+ void testRemoveAlbums();
+
+ /**
+ * tests albumChangedSlot
+ */
+ //void testAlbumChangedSlot();
+
+ /**
+ * tests indexOfId
+ */
+ void testIndexOfId();
+
+ /**
+ * tests setGenericIdFilter
+ */
+ void testSetGenericIdFilter();
+
+ /**
+ * tests setAlbumInUse
+ */
+ void testSetAlbumInUse();
+
+ /**
+ * tests renameItem
+ */
+ void testRenameItem();
+
+ /**
+ * tests disconnectSignals
+ */
+ void testDisconnectSignals();
+
+private:
+
+ /**
+ * stub videolist model
+ */
+ VideoListDataModel *mStubModel;
+
+ /**
+ * stub CVideoCollectionClient.
+ */
+ VideoCollectionClient *mCollectionClient;
+
+ /**
+ * tester object inherited from the actual test object
+ * implemented to be able to call protected objects
+ */
+ FilterProxyTester *mTestObject;
+
+ /**
+ * dummy collections content proxy
+ */
+ VideoProxyModelGeneric *mCollectionModel;
+};
+
+
+#endif // __TESTVIDEOPROXYMODELGENERIC_H__
+
+// End of file
+
+
+
diff -r 4bfa887905cf -r d2b028fd1f7d videocollection/videocollectionwrapper/tsrc/testvideoproxymodelgeneric/src/testvideoproxymodelgeneric.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideoproxymodelgeneric/src/testvideoproxymodelgeneric.cpp Fri Sep 03 12:37:43 2010 +0300
@@ -0,0 +1,1534 @@
+/**
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: tester for methods in VideoProxyModelGeneric
+*
+*/
+
+#include