--- a/inc/mpxvideoplayercustomviewmsgconsts.h Thu Apr 01 23:13:36 2010 +0300
+++ b/inc/mpxvideoplayercustomviewmsgconsts.h Thu Apr 01 23:22:15 2010 +0300
@@ -15,7 +15,7 @@
*/
-// Version : %version: 2 %
+// Version : %version: da1mmcf#3 %
#ifndef __MPXVIDEOPLAYERCUSTOMVIEWMSGCONSTS_H__
#define __MPXVIDEOPLAYERCUSTOMVIEWMSGCONSTS_H__
@@ -29,4 +29,7 @@
const TInt KVcxCustomViewMessagePtr = 0x200211F9;
+const TInt KMpxVideoPlaybackPdlReloading = 0x20024339;
+
+
#endif // __MPXVIDEOPLAYERCUSTOMVIEWMSGCONSTS_H__
--- a/layers.sysdef.xml Thu Apr 01 23:13:36 2010 +0300
+++ b/layers.sysdef.xml Thu Apr 01 23:22:15 2010 +0300
@@ -14,8 +14,23 @@
</layer>
<layer name="qt_unit_test_layer">
- <module name="vado.videocollectionwrapper.tsrc">
+ <module name="vado.videocollection.tsrc">
+ <unit unitID="vado.testcollectionview" mrp="" bldFile="&layer_real_source_path;/videocollection/videocollectionview/tsrc/testcollectionview" proFile="testcollectionview.pro" name="unittest.testcollectionview"/>
+ <unit unitID="vado.testhintwidget" mrp="" bldFile="&layer_real_source_path;/videocollection/videocollectionview/tsrc/testhintwidget" proFile="testhintwidget.pro" name="unittest.testhintwidget"/>
+ <unit unitID="vado.testlistview" mrp="" bldFile="&layer_real_source_path;/videocollection/videocollectionview/tsrc/testlistview" proFile="testlistview.pro" name="unittest.testlistview"/>
+ <unit unitID="vado.testlistwidget" mrp="" bldFile="&layer_real_source_path;/videocollection/videocollectionview/tsrc/testlistwidget" proFile="testlistwidget.pro" name="unittest.testlistwidget"/>
+ <unit unitID="vado.testvideocollectionviewutils" mrp="" bldFile="&layer_real_source_path;/videocollection/videocollectionview/tsrc/testvideocollectionviewutils" proFile="testvideocollectionviewutils.pro" name="unittest.testvideocollectionviewutils"/>
+ <unit unitID="vado.testvideolistselectiondialog" mrp="" bldFile="&layer_real_source_path;/videocollection/videocollectionview/tsrc/testvideolistselectiondialog" proFile="testvideolistselectiondialog.pro" name="unittest.testvideolistselectiondialog"/>
+ <unit unitID="vado.testvideocollectionclient" mrp="" bldFile="&layer_real_source_path;/videocollection/videocollectionwrapper/tsrc/testvideocollectionclient" proFile="testvideocollectionclient.pro" name="unittest.testvideocollectionclient"/>
<unit unitID="vado.testvideocollectionlistener" mrp="" bldFile="&layer_real_source_path;/videocollection/videocollectionwrapper/tsrc/testvideocollectionlistener" proFile="testvideocollectionlistener.pro" name="unittest.testvideocollectionlistener"/>
+ <unit unitID="vado.testvideocollectionwrapper_p" mrp="" bldFile="&layer_real_source_path;/videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p" proFile="testvideocollectionwrapper_p.pro" name="unittest.testvideocollectionwrapper_p"/>
+ <unit unitID="vado.testvideodatacontainer" mrp="" bldFile="&layer_real_source_path;/videocollection/videocollectionwrapper/tsrc/testvideodatacontainer" proFile="testvideodatacontainer.pro" name="unittest.testvideodatacontainer"/>
+ <unit unitID="vado.testvideodeleteworker" mrp="" bldFile="&layer_real_source_path;/videocollection/videocollectionwrapper/tsrc/testvideodeleteworker" proFile="testvideodeleteworker.pro" name="unittest.testvideodeleteworker"/>
+ <unit unitID="vado.testvideomodel" mrp="" bldFile="&layer_real_source_path;/videocollection/videocollectionwrapper/tsrc/testvideomodel" proFile="testvideomodel.pro" name="unittest.testvideomodel"/>
+ <unit unitID="vado.testvideomodel_p" mrp="" bldFile="&layer_real_source_path;/videocollection/videocollectionwrapper/tsrc/testvideomodel_p" proFile="testvideomodel_p.pro" name="unittest.testvideomodel_p"/>
+ <unit unitID="vado.testvideosortfilterproxymodel" mrp="" bldFile="&layer_real_source_path;/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel" proFile="testvideosortfilterproxymodel.pro" name="unittest.testvideosortfilterproxymodel"/>
+ <unit unitID="vado.testvideothumbnaildata" mrp="" bldFile="&layer_real_source_path;/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata" proFile="testvideothumbnaildata.pro" name="unittest.testvideothumbnaildata"/>
+ <unit unitID="vado.testvideothumbnaildata_p" mrp="" bldFile="&layer_real_source_path;/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p" proFile="testvideothumbnaildata_p.pro" name="unittest.testvideothumbnaildata_p"/>
</module>
</layer>
@@ -26,4 +41,4 @@
</layer>
</systemModel>
-</SystemDefinition>
\ No newline at end of file
+</SystemDefinition>
--- a/mediasettings/group/bld.inf Thu Apr 01 23:13:36 2010 +0300
+++ b/mediasettings/group/bld.inf Thu Apr 01 23:22:15 2010 +0300
@@ -15,17 +15,11 @@
*/
-// Version : %version: 9 %
+// Version : %version: 11 %
#include <platform_paths.hrh>
-#include "../videoplayersettingsengine/group/bld.inf"
#include "../mediasettingsengine/group/bld.inf"
-#include "../feedsettingsplugin/group/bld.inf"
-#include "../feedsettingsviews/group/bld.inf"
-#include "../mpsettbase/group/bld.inf"
-#include "../mediasettingsapp/group/bld.inf"
-#include "../gsvideoplugin/group/bld.inf"
PRJ_PLATFORMS
DEFAULT
--- a/mediasettings/mediasettingsengine/src/MPSettingsModelForROP.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/mediasettings/mediasettingsengine/src/MPSettingsModelForROP.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -15,7 +15,7 @@
*/
-// Version : %version: 9 %
+// Version : %version: 10 %
@@ -1157,6 +1157,11 @@
{
MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::WapIdFromIapIdL(%d)"),aIapId);
+ TUint32 wap = 0;
+#ifdef __WINSCW__
+ wap = aIapId;
+#else
+
CMDBSession* db = CMDBSession::NewL( CMDBSession::LatestVersion() );
CleanupStack::PushL( db );
@@ -1169,16 +1174,17 @@
wapBearerRecord->iWAPIAP = aIapId;
TBool found = wapBearerRecord->FindL( *db );
-
if ( !found )
{
User::Leave(KErrNotFound);
}
- TUint32 wap = static_cast<TUint32>( wapBearerRecord->iWAPAccessPointId );
+ wap = static_cast<TUint32>( wapBearerRecord->iWAPAccessPointId );
CleanupStack::PopAndDestroy( wapBearerRecord );
CleanupStack::PopAndDestroy( db );
+
+#endif
MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::IapIdFromWapIdL() - return wap id: %d "), wap);
return wap;
@@ -1192,6 +1198,10 @@
{
MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::IapIdFromWapIdL(%d)"),aWapId);
+ TUint32 iap = 0;
+#ifdef __WINSCW__
+ iap = aWapId;
+#else
CMDBSession* db = CMDBSession::NewL( CMDBSession::LatestVersion() );
CleanupStack::PushL( db );
@@ -1210,10 +1220,12 @@
User::Leave(KErrNotFound);
}
- TUint32 iap = static_cast<TUint32>( wapBearerRecord->iWAPIAP );
+ iap = static_cast<TUint32>( wapBearerRecord->iWAPIAP );
CleanupStack::PopAndDestroy( wapBearerRecord );
CleanupStack::PopAndDestroy( db );
+
+#endif
MPX_DEBUG2(_L("#MS# CMPSettingsModelForROP::IapIdFromWapIdL() - return iap id: %d "), iap);
return iap;
--- a/videocollection/bwins/videocollectionwrapperu.def Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/bwins/videocollectionwrapperu.def Thu Apr 01 23:22:15 2010 +0300
@@ -2,67 +2,76 @@
?getThumbnail@VideoThumbnailData@@QAEPBVQIcon@@VTMPXItemId@@@Z @ 1 NONAME ; class QIcon const * VideoThumbnailData::getThumbnail(class TMPXItemId)
?sendAsyncStatus@VideoCollectionWrapper@@QAEXHAAVQVariant@@@Z @ 2 NONAME ; void VideoCollectionWrapper::sendAsyncStatus(int, class QVariant &)
??1VideoSortFilterProxyModel@@UAE@XZ @ 3 NONAME ; VideoSortFilterProxyModel::~VideoSortFilterProxyModel(void)
- ?startFetchingThumbnail@VideoThumbnailData@@QAEHHH@Z @ 4 NONAME ; int VideoThumbnailData::startFetchingThumbnail(int, int)
- ?removeThumbnail@VideoThumbnailData@@QAE_NVTMPXItemId@@@Z @ 5 NONAME ; bool VideoThumbnailData::removeThumbnail(class TMPXItemId)
- ?deleteItems@VideoSortFilterProxyModel@@QAEHABV?$QList@VQModelIndex@@@@@Z @ 6 NONAME ; int VideoSortFilterProxyModel::deleteItems(class QList<class QModelIndex> const &)
- ?trUtf8@VideoThumbnailData@@SA?AVQString@@PBD0@Z @ 7 NONAME ; class QString VideoThumbnailData::trUtf8(char const *, char const *)
+ ?removeThumbnail@VideoThumbnailData@@QAE_NVTMPXItemId@@@Z @ 4 NONAME ; bool VideoThumbnailData::removeThumbnail(class TMPXItemId)
+ ?deleteItems@VideoSortFilterProxyModel@@QAEHABV?$QList@VQModelIndex@@@@@Z @ 5 NONAME ; int VideoSortFilterProxyModel::deleteItems(class QList<class QModelIndex> const &)
+ ?trUtf8@VideoThumbnailData@@SA?AVQString@@PBD0@Z @ 6 NONAME ; class QString VideoThumbnailData::trUtf8(char const *, char 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)
- ?qt_metacall@VideoThumbnailData@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 10 NONAME ; int VideoThumbnailData::qt_metacall(enum QMetaObject::Call, int, void * *)
- ?fullDetailsReady@VideoSortFilterProxyModel@@IAEXH@Z @ 11 NONAME ; void VideoSortFilterProxyModel::fullDetailsReady(int)
- ??1VideoThumbnailData@@EAE@XZ @ 12 NONAME ; VideoThumbnailData::~VideoThumbnailData(void)
- ??_EVideoThumbnailData@@UAE@I@Z @ 13 NONAME ; VideoThumbnailData::~VideoThumbnailData(unsigned int)
- ?getMediaFilePathForId@VideoSortFilterProxyModel@@QAE?AVQString@@VTMPXItemId@@@Z @ 14 NONAME ; class QString VideoSortFilterProxyModel::getMediaFilePathForId(class TMPXItemId)
- ?qt_metacast@VideoCollectionWrapper@@UAEPAXPBD@Z @ 15 NONAME ; void * VideoCollectionWrapper::qt_metacast(char const *)
- ??0VideoSortFilterProxyModel@@QAE@PAVQObject@@@Z @ 16 NONAME ; VideoSortFilterProxyModel::VideoSortFilterProxyModel(class QObject *)
- ?startBackgroundFetching@VideoThumbnailData@@QAEXH@Z @ 17 NONAME ; void VideoThumbnailData::startBackgroundFetching(int)
+ ?albumChangedSlot@VideoSortFilterProxyModel@@AAEXXZ @ 10 NONAME ; void VideoSortFilterProxyModel::albumChangedSlot(void)
+ ?addItemsInAlbum@VideoSortFilterProxyModel@@QAEHVTMPXItemId@@ABV?$QList@VTMPXItemId@@@@@Z @ 11 NONAME ; int VideoSortFilterProxyModel::addItemsInAlbum(class TMPXItemId, class QList<class TMPXItemId> const &)
+ ?qt_metacall@VideoThumbnailData@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 12 NONAME ; int VideoThumbnailData::qt_metacall(enum QMetaObject::Call, int, void * *)
+ ??1VideoThumbnailData@@EAE@XZ @ 13 NONAME ; VideoThumbnailData::~VideoThumbnailData(void)
+ ??_EVideoThumbnailData@@UAE@I@Z @ 14 NONAME ; VideoThumbnailData::~VideoThumbnailData(unsigned int)
+ ?getMediaFilePathForId@VideoSortFilterProxyModel@@QAE?AVQString@@VTMPXItemId@@@Z @ 15 NONAME ; class QString VideoSortFilterProxyModel::getMediaFilePathForId(class TMPXItemId)
+ ?qt_metacast@VideoCollectionWrapper@@UAEPAXPBD@Z @ 16 NONAME ; void * VideoCollectionWrapper::qt_metacast(char const *)
+ ?fullDetailsReady@VideoSortFilterProxyModel@@IAEXVTMPXItemId@@@Z @ 17 NONAME ; void VideoSortFilterProxyModel::fullDetailsReady(class TMPXItemId)
?tr@VideoSortFilterProxyModel@@SA?AVQString@@PBD0H@Z @ 18 NONAME ; class QString VideoSortFilterProxyModel::tr(char const *, char const *, int)
- ?instance@VideoThumbnailData@@SAAAV1@XZ @ 19 NONAME ; class VideoThumbnailData & VideoThumbnailData::instance(void)
- ?fetchItemDetails@VideoSortFilterProxyModel@@QAEHABVQModelIndex@@@Z @ 20 NONAME ; int VideoSortFilterProxyModel::fetchItemDetails(class QModelIndex const &)
- ??0VideoCollectionWrapper@@AAE@XZ @ 21 NONAME ; VideoCollectionWrapper::VideoCollectionWrapper(void)
- ?metaObject@VideoSortFilterProxyModel@@UBEPBUQMetaObject@@XZ @ 22 NONAME ; struct QMetaObject const * VideoSortFilterProxyModel::metaObject(void) const
- ?metaObject@VideoCollectionWrapper@@UBEPBUQMetaObject@@XZ @ 23 NONAME ; struct QMetaObject const * VideoCollectionWrapper::metaObject(void) const
- ?open@VideoSortFilterProxyModel@@QAEHH@Z @ 24 NONAME ; int VideoSortFilterProxyModel::open(int)
- ?lessThan@VideoSortFilterProxyModel@@MBE_NABVQModelIndex@@0@Z @ 25 NONAME ; bool VideoSortFilterProxyModel::lessThan(class QModelIndex const &, class QModelIndex const &) const
- ?getStaticMetaObject@VideoCollectionWrapper@@SAABUQMetaObject@@XZ @ 26 NONAME ; struct QMetaObject const & VideoCollectionWrapper::getStaticMetaObject(void)
- ?getStaticMetaObject@VideoSortFilterProxyModel@@SAABUQMetaObject@@XZ @ 27 NONAME ; struct QMetaObject const & VideoSortFilterProxyModel::getStaticMetaObject(void)
- ?trUtf8@VideoSortFilterProxyModel@@SA?AVQString@@PBD0@Z @ 28 NONAME ; class QString VideoSortFilterProxyModel::trUtf8(char const *, char const *)
- ?doSorting@VideoSortFilterProxyModel@@QAEXHW4SortOrder@Qt@@_N@Z @ 29 NONAME ; void VideoSortFilterProxyModel::doSorting(int, enum Qt::SortOrder, bool)
- ??_EVideoCollectionWrapper@@UAE@I@Z @ 30 NONAME ; VideoCollectionWrapper::~VideoCollectionWrapper(unsigned int)
- ?getStaticMetaObject@VideoThumbnailData@@SAABUQMetaObject@@XZ @ 31 NONAME ; struct QMetaObject const & VideoThumbnailData::getStaticMetaObject(void)
- ?getMediaIdAtIndex@VideoSortFilterProxyModel@@QAE?AVTMPXItemId@@ABVQModelIndex@@@Z @ 32 NONAME ; class TMPXItemId VideoSortFilterProxyModel::getMediaIdAtIndex(class QModelIndex const &)
- ?qt_metacall@VideoCollectionWrapper@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 33 NONAME ; int VideoCollectionWrapper::qt_metacall(enum QMetaObject::Call, int, void * *)
- ?trUtf8@VideoThumbnailData@@SA?AVQString@@PBD0H@Z @ 34 NONAME ; class QString VideoThumbnailData::trUtf8(char const *, char const *, int)
- ?enableBackgroundFetching@VideoThumbnailData@@QAEX_N@Z @ 35 NONAME ; void VideoThumbnailData::enableBackgroundFetching(bool)
- ?openItem@VideoSortFilterProxyModel@@QAEHABVQModelIndex@@@Z @ 36 NONAME ; int VideoSortFilterProxyModel::openItem(class QModelIndex const &)
- ?tr@VideoCollectionWrapper@@SA?AVQString@@PBD0H@Z @ 37 NONAME ; class QString VideoCollectionWrapper::tr(char const *, char const *, int)
- ?staticMetaObject@VideoSortFilterProxyModel@@2UQMetaObject@@B @ 38 NONAME ; struct QMetaObject const VideoSortFilterProxyModel::staticMetaObject
- ?tr@VideoSortFilterProxyModel@@SA?AVQString@@PBD0@Z @ 39 NONAME ; class QString VideoSortFilterProxyModel::tr(char const *, char const *)
- ?asyncStatus@VideoCollectionWrapper@@IAEXHAAVQVariant@@@Z @ 40 NONAME ; void VideoCollectionWrapper::asyncStatus(int, class QVariant &)
- ?initialize@VideoSortFilterProxyModel@@QAEHPAVVideoListDataModel@@@Z @ 41 NONAME ; int VideoSortFilterProxyModel::initialize(class VideoListDataModel *)
- ?shortDetailsReady@VideoSortFilterProxyModel@@IAEXH@Z @ 42 NONAME ; void VideoSortFilterProxyModel::shortDetailsReady(int)
- ?instance@VideoCollectionWrapper@@SAPAV1@XZ @ 43 NONAME ; class VideoCollectionWrapper * VideoCollectionWrapper::instance(void)
- ?thumbnailsFetched@VideoThumbnailData@@IAEXV?$QList@VTMPXItemId@@@@@Z @ 44 NONAME ; void VideoThumbnailData::thumbnailsFetched(class QList<class TMPXItemId>)
- ?trUtf8@VideoCollectionWrapper@@SA?AVQString@@PBD0@Z @ 45 NONAME ; class QString VideoCollectionWrapper::trUtf8(char const *, char const *)
- ?processSorting@VideoSortFilterProxyModel@@AAEXXZ @ 46 NONAME ; void VideoSortFilterProxyModel::processSorting(void)
- ?filterAcceptsRow@VideoSortFilterProxyModel@@MBE_NHABVQModelIndex@@@Z @ 47 NONAME ; bool VideoSortFilterProxyModel::filterAcceptsRow(int, class QModelIndex const &) const
- ?metaObject@VideoThumbnailData@@UBEPBUQMetaObject@@XZ @ 48 NONAME ; struct QMetaObject const * VideoThumbnailData::metaObject(void) const
- ?tr@VideoThumbnailData@@SA?AVQString@@PBD0H@Z @ 49 NONAME ; class QString VideoThumbnailData::tr(char const *, char const *, int)
- ?addNewCollection@VideoSortFilterProxyModel@@QAEHVQString@@0V?$QList@VTMPXItemId@@@@@Z @ 50 NONAME ; int VideoSortFilterProxyModel::addNewCollection(class QString, class QString, class QList<class TMPXItemId>)
- ?qt_metacast@VideoThumbnailData@@UAEPAXPBD@Z @ 51 NONAME ; void * VideoThumbnailData::qt_metacast(char const *)
- ?trUtf8@VideoSortFilterProxyModel@@SA?AVQString@@PBD0H@Z @ 52 NONAME ; class QString VideoSortFilterProxyModel::trUtf8(char const *, char const *, int)
- ?tr@VideoCollectionWrapper@@SA?AVQString@@PBD0@Z @ 53 NONAME ; class QString VideoCollectionWrapper::tr(char const *, char const *)
- ?decreaseReferenceCount@VideoCollectionWrapper@@QAEXXZ @ 54 NONAME ; void VideoCollectionWrapper::decreaseReferenceCount(void)
- ??_EVideoSortFilterProxyModel@@UAE@I@Z @ 55 NONAME ; VideoSortFilterProxyModel::~VideoSortFilterProxyModel(unsigned int)
- ?mInstance@VideoCollectionWrapper@@0PAV1@A @ 56 NONAME ; class VideoCollectionWrapper * VideoCollectionWrapper::mInstance
- ?getModel@VideoCollectionWrapper@@QAEPAVVideoSortFilterProxyModel@@XZ @ 57 NONAME ; class VideoSortFilterProxyModel * VideoCollectionWrapper::getModel(void)
- ?qt_metacall@VideoSortFilterProxyModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 58 NONAME ; int VideoSortFilterProxyModel::qt_metacall(enum QMetaObject::Call, int, void * *)
- ?freeThumbnailData@VideoThumbnailData@@QAEXXZ @ 59 NONAME ; void VideoThumbnailData::freeThumbnailData(void)
- ?qt_metacast@VideoSortFilterProxyModel@@UAEPAXPBD@Z @ 60 NONAME ; void * VideoSortFilterProxyModel::qt_metacast(char const *)
- ?staticMetaObject@VideoCollectionWrapper@@2UQMetaObject@@B @ 61 NONAME ; struct QMetaObject const VideoCollectionWrapper::staticMetaObject
- ?tr@VideoThumbnailData@@SA?AVQString@@PBD0@Z @ 62 NONAME ; class QString VideoThumbnailData::tr(char const *, char const *)
- ??1VideoCollectionWrapper@@EAE@XZ @ 63 NONAME ; VideoCollectionWrapper::~VideoCollectionWrapper(void)
- ?trUtf8@VideoCollectionWrapper@@SA?AVQString@@PBD0H@Z @ 64 NONAME ; class QString VideoCollectionWrapper::trUtf8(char const *, char const *, int)
- ??0VideoThumbnailData@@AAE@XZ @ 65 NONAME ; VideoThumbnailData::VideoThumbnailData(void)
- ?staticMetaObject@VideoThumbnailData@@2UQMetaObject@@B @ 66 NONAME ; struct QMetaObject const VideoThumbnailData::staticMetaObject
+ ?removeAlbums@VideoSortFilterProxyModel@@QAEHABV?$QList@VQModelIndex@@@@@Z @ 19 NONAME ; int VideoSortFilterProxyModel::removeAlbums(class QList<class QModelIndex> const &)
+ ?instance@VideoThumbnailData@@SAAAV1@XZ @ 20 NONAME ; class VideoThumbnailData & VideoThumbnailData::instance(void)
+ ?fetchItemDetails@VideoSortFilterProxyModel@@QAEHABVQModelIndex@@@Z @ 21 NONAME ; int VideoSortFilterProxyModel::fetchItemDetails(class QModelIndex const &)
+ ??0VideoCollectionWrapper@@AAE@XZ @ 22 NONAME ; VideoCollectionWrapper::VideoCollectionWrapper(void)
+ ?metaObject@VideoSortFilterProxyModel@@UBEPBUQMetaObject@@XZ @ 23 NONAME ; struct QMetaObject const * VideoSortFilterProxyModel::metaObject(void) const
+ ?metaObject@VideoCollectionWrapper@@UBEPBUQMetaObject@@XZ @ 24 NONAME ; struct QMetaObject const * VideoCollectionWrapper::metaObject(void) const
+ ?open@VideoSortFilterProxyModel@@QAEHH@Z @ 25 NONAME ; int VideoSortFilterProxyModel::open(int)
+ ?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)
+ ?indexOfId@VideoSortFilterProxyModel@@QAE?AVQModelIndex@@VTMPXItemId@@@Z @ 28 NONAME ; class QModelIndex VideoSortFilterProxyModel::indexOfId(class TMPXItemId)
+ ??0VideoSortFilterProxyModel@@QAE@HPAVQObject@@@Z @ 29 NONAME ; VideoSortFilterProxyModel::VideoSortFilterProxyModel(int, class QObject *)
+ ?getStaticMetaObject@VideoSortFilterProxyModel@@SAABUQMetaObject@@XZ @ 30 NONAME ; struct QMetaObject const & VideoSortFilterProxyModel::getStaticMetaObject(void)
+ ?trUtf8@VideoSortFilterProxyModel@@SA?AVQString@@PBD0@Z @ 31 NONAME ; class QString VideoSortFilterProxyModel::trUtf8(char const *, char const *)
+ ?doSorting@VideoSortFilterProxyModel@@QAEXHW4SortOrder@Qt@@_N@Z @ 32 NONAME ; void VideoSortFilterProxyModel::doSorting(int, enum Qt::SortOrder, bool)
+ ?getOpenItem@VideoSortFilterProxyModel@@QBE?AVTMPXItemId@@XZ @ 33 NONAME ; class TMPXItemId VideoSortFilterProxyModel::getOpenItem(void) const
+ ?startBackgroundFetching@VideoThumbnailData@@QAEXPAVVideoSortFilterProxyModel@@H@Z @ 34 NONAME ; void VideoThumbnailData::startBackgroundFetching(class VideoSortFilterProxyModel *, int)
+ ??_EVideoCollectionWrapper@@UAE@I@Z @ 35 NONAME ; VideoCollectionWrapper::~VideoCollectionWrapper(unsigned int)
+ ?resolveAlbumName@VideoSortFilterProxyModel@@QBE?AVQString@@ABV2@@Z @ 36 NONAME ; class QString VideoSortFilterProxyModel::resolveAlbumName(class QString const &) const
+ ?setGenericIdFilter@VideoSortFilterProxyModel@@QAEXVTMPXItemId@@_N@Z @ 37 NONAME ; void VideoSortFilterProxyModel::setGenericIdFilter(class TMPXItemId, bool)
+ ?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)
+ ?enableBackgroundFetching@VideoThumbnailData@@QAEX_N@Z @ 41 NONAME ; void VideoThumbnailData::enableBackgroundFetching(bool)
+ ?getMediaIdAtIndex@VideoSortFilterProxyModel@@QBE?AVTMPXItemId@@ABVQModelIndex@@@Z @ 42 NONAME ; class TMPXItemId VideoSortFilterProxyModel::getMediaIdAtIndex(class QModelIndex const &) const
+ ?connectSignals@VideoSortFilterProxyModel@@AAE_NXZ @ 43 NONAME ; bool VideoSortFilterProxyModel::connectSignals(void)
+ ?tr@VideoCollectionWrapper@@SA?AVQString@@PBD0H@Z @ 44 NONAME ; class QString VideoCollectionWrapper::tr(char const *, char const *, int)
+ ?staticMetaObject@VideoSortFilterProxyModel@@2UQMetaObject@@B @ 45 NONAME ; struct QMetaObject const VideoSortFilterProxyModel::staticMetaObject
+ ?tr@VideoSortFilterProxyModel@@SA?AVQString@@PBD0@Z @ 46 NONAME ; class QString VideoSortFilterProxyModel::tr(char const *, char const *)
+ ?asyncStatus@VideoCollectionWrapper@@IAEXHAAVQVariant@@@Z @ 47 NONAME ; void VideoCollectionWrapper::asyncStatus(int, class QVariant &)
+ ?initialize@VideoSortFilterProxyModel@@QAEHPAVVideoListDataModel@@@Z @ 48 NONAME ; int VideoSortFilterProxyModel::initialize(class VideoListDataModel *)
+ ?modelChanged@VideoSortFilterProxyModel@@IAEXXZ @ 49 NONAME ; void VideoSortFilterProxyModel::modelChanged(void)
+ ?thumbnailsFetched@VideoThumbnailData@@IAEXV?$QList@VTMPXItemId@@@@@Z @ 50 NONAME ; void VideoThumbnailData::thumbnailsFetched(class QList<class TMPXItemId>)
+ ?trUtf8@VideoCollectionWrapper@@SA?AVQString@@PBD0@Z @ 51 NONAME ; class QString VideoCollectionWrapper::trUtf8(char const *, char const *)
+ ?processSorting@VideoSortFilterProxyModel@@AAEXXZ @ 52 NONAME ; void VideoSortFilterProxyModel::processSorting(void)
+ ?getSorting@VideoSortFilterProxyModel@@QAEXAAHAAW4SortOrder@Qt@@@Z @ 53 NONAME ; void VideoSortFilterProxyModel::getSorting(int &, enum Qt::SortOrder &)
+ ?filterAcceptsRow@VideoSortFilterProxyModel@@MBE_NHABVQModelIndex@@@Z @ 54 NONAME ; bool VideoSortFilterProxyModel::filterAcceptsRow(int, class QModelIndex const &) const
+ ?metaObject@VideoThumbnailData@@UBEPBUQMetaObject@@XZ @ 55 NONAME ; struct QMetaObject const * VideoThumbnailData::metaObject(void) const
+ ?tr@VideoThumbnailData@@SA?AVQString@@PBD0H@Z @ 56 NONAME ; class QString VideoThumbnailData::tr(char const *, char const *, int)
+ ?disconnectSignals@VideoSortFilterProxyModel@@AAEXXZ @ 57 NONAME ; void VideoSortFilterProxyModel::disconnectSignals(void)
+ ?getModel@VideoCollectionWrapper@@QAEPAVVideoSortFilterProxyModel@@H@Z @ 58 NONAME ; class VideoSortFilterProxyModel * VideoCollectionWrapper::getModel(int)
+ ?trUtf8@VideoSortFilterProxyModel@@SA?AVQString@@PBD0H@Z @ 59 NONAME ; class QString VideoSortFilterProxyModel::trUtf8(char const *, char const *, int)
+ ?openItem@VideoSortFilterProxyModel@@QAEHVTMPXItemId@@@Z @ 60 NONAME ; int VideoSortFilterProxyModel::openItem(class TMPXItemId)
+ ?qt_metacast@VideoThumbnailData@@UAEPAXPBD@Z @ 61 NONAME ; void * VideoThumbnailData::qt_metacast(char const *)
+ ?tr@VideoCollectionWrapper@@SA?AVQString@@PBD0@Z @ 62 NONAME ; class QString VideoCollectionWrapper::tr(char const *, char const *)
+ ??_EVideoSortFilterProxyModel@@UAE@I@Z @ 63 NONAME ; VideoSortFilterProxyModel::~VideoSortFilterProxyModel(unsigned int)
+ ?addNewAlbum@VideoSortFilterProxyModel@@QAE?AVTMPXItemId@@ABVQString@@@Z @ 64 NONAME ; class TMPXItemId VideoSortFilterProxyModel::addNewAlbum(class QString const &)
+ ?enableThumbnailCreation@VideoThumbnailData@@QAEX_N@Z @ 65 NONAME ; void VideoThumbnailData::enableThumbnailCreation(bool)
+ ?qt_metacall@VideoSortFilterProxyModel@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 66 NONAME ; int VideoSortFilterProxyModel::qt_metacall(enum QMetaObject::Call, int, void * *)
+ ?freeThumbnailData@VideoThumbnailData@@QAEXXZ @ 67 NONAME ; void VideoThumbnailData::freeThumbnailData(void)
+ ?shortDetailsReady@VideoSortFilterProxyModel@@IAEXVTMPXItemId@@@Z @ 68 NONAME ; void VideoSortFilterProxyModel::shortDetailsReady(class TMPXItemId)
+ ?qt_metacast@VideoSortFilterProxyModel@@UAEPAXPBD@Z @ 69 NONAME ; void * VideoSortFilterProxyModel::qt_metacast(char const *)
+ ?staticMetaObject@VideoCollectionWrapper@@2UQMetaObject@@B @ 70 NONAME ; struct QMetaObject const VideoCollectionWrapper::staticMetaObject
+ ?tr@VideoThumbnailData@@SA?AVQString@@PBD0@Z @ 71 NONAME ; class QString VideoThumbnailData::tr(char const *, char const *)
+ ??1VideoCollectionWrapper@@EAE@XZ @ 72 NONAME ; VideoCollectionWrapper::~VideoCollectionWrapper(void)
+ ?trUtf8@VideoCollectionWrapper@@SA?AVQString@@PBD0H@Z @ 73 NONAME ; class QString VideoCollectionWrapper::trUtf8(char const *, char const *, int)
+ ??0VideoThumbnailData@@AAE@XZ @ 74 NONAME ; VideoThumbnailData::VideoThumbnailData(void)
+ ?staticMetaObject@VideoThumbnailData@@2UQMetaObject@@B @ 75 NONAME ; struct QMetaObject const VideoThumbnailData::staticMetaObject
--- a/videocollection/eabi/videocollectionwrapperu.def Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/eabi/videocollectionwrapperu.def Thu Apr 01 23:22:15 2010 +0300
@@ -7,8 +7,8 @@
_ZN18VideoThumbnailData17freeThumbnailDataEv @ 6 NONAME
_ZN18VideoThumbnailData17thumbnailsFetchedE5QListI10TMPXItemIdE @ 7 NONAME
_ZN18VideoThumbnailData19getStaticMetaObjectEv @ 8 NONAME
- _ZN18VideoThumbnailData22startFetchingThumbnailEii @ 9 NONAME
- _ZN18VideoThumbnailData23startBackgroundFetchingEi @ 10 NONAME
+ _ZN18VideoThumbnailData23enableThumbnailCreationEb @ 9 NONAME
+ _ZN18VideoThumbnailData23startBackgroundFetchingEP25VideoSortFilterProxyModeli @ 10 NONAME
_ZN18VideoThumbnailData24enableBackgroundFetchingEb @ 11 NONAME
_ZN18VideoThumbnailData8instanceEv @ 12 NONAME
_ZN18VideoThumbnailDataC1Ev @ 13 NONAME
@@ -22,47 +22,56 @@
_ZN22VideoCollectionWrapper15sendAsyncStatusEiR8QVariant @ 21 NONAME
_ZN22VideoCollectionWrapper16staticMetaObjectE @ 22 NONAME DATA 16
_ZN22VideoCollectionWrapper19getStaticMetaObjectEv @ 23 NONAME
- _ZN22VideoCollectionWrapper22decreaseReferenceCountEv @ 24 NONAME
- _ZN22VideoCollectionWrapper8getModelEv @ 25 NONAME
- _ZN22VideoCollectionWrapper8instanceEv @ 26 NONAME
- _ZN22VideoCollectionWrapper9mInstanceE @ 27 NONAME DATA 4
- _ZN22VideoCollectionWrapperC1Ev @ 28 NONAME
- _ZN22VideoCollectionWrapperC2Ev @ 29 NONAME
- _ZN22VideoCollectionWrapperD0Ev @ 30 NONAME
- _ZN22VideoCollectionWrapperD1Ev @ 31 NONAME
- _ZN22VideoCollectionWrapperD2Ev @ 32 NONAME
- _ZN25VideoSortFilterProxyModel10initializeEP18VideoListDataModel @ 33 NONAME
- _ZN25VideoSortFilterProxyModel10modelReadyEv @ 34 NONAME
+ _ZN22VideoCollectionWrapper8getModelEi @ 24 NONAME
+ _ZN22VideoCollectionWrapper8instanceEv @ 25 NONAME
+ _ZN22VideoCollectionWrapperC1Ev @ 26 NONAME
+ _ZN22VideoCollectionWrapperC2Ev @ 27 NONAME
+ _ZN22VideoCollectionWrapperD0Ev @ 28 NONAME
+ _ZN22VideoCollectionWrapperD1Ev @ 29 NONAME
+ _ZN22VideoCollectionWrapperD2Ev @ 30 NONAME
+ _ZN25VideoSortFilterProxyModel10getSortingERiRN2Qt9SortOrderE @ 31 NONAME
+ _ZN25VideoSortFilterProxyModel10initializeEP18VideoListDataModel @ 32 NONAME
+ _ZN25VideoSortFilterProxyModel10modelReadyEv @ 33 NONAME
+ _ZN25VideoSortFilterProxyModel11addNewAlbumERK7QString @ 34 NONAME
_ZN25VideoSortFilterProxyModel11deleteItemsERK5QListI11QModelIndexE @ 35 NONAME
_ZN25VideoSortFilterProxyModel11qt_metacallEN11QMetaObject4CallEiPPv @ 36 NONAME
_ZN25VideoSortFilterProxyModel11qt_metacastEPKc @ 37 NONAME
- _ZN25VideoSortFilterProxyModel14processSortingEv @ 38 NONAME
- _ZN25VideoSortFilterProxyModel16addNewCollectionE7QStringS0_5QListI10TMPXItemIdE @ 39 NONAME
- _ZN25VideoSortFilterProxyModel16fetchItemDetailsERK11QModelIndex @ 40 NONAME
- _ZN25VideoSortFilterProxyModel16fullDetailsReadyEi @ 41 NONAME
- _ZN25VideoSortFilterProxyModel16staticMetaObjectE @ 42 NONAME DATA 16
- _ZN25VideoSortFilterProxyModel17getMediaIdAtIndexERK11QModelIndex @ 43 NONAME
- _ZN25VideoSortFilterProxyModel17shortDetailsReadyEi @ 44 NONAME
- _ZN25VideoSortFilterProxyModel19getStaticMetaObjectEv @ 45 NONAME
- _ZN25VideoSortFilterProxyModel21getMediaFilePathForIdE10TMPXItemId @ 46 NONAME
- _ZN25VideoSortFilterProxyModel4backEv @ 47 NONAME
- _ZN25VideoSortFilterProxyModel4openEi @ 48 NONAME
- _ZN25VideoSortFilterProxyModel8openItemERK11QModelIndex @ 49 NONAME
- _ZN25VideoSortFilterProxyModel9doSortingEiN2Qt9SortOrderEb @ 50 NONAME
- _ZN25VideoSortFilterProxyModelC1EP7QObject @ 51 NONAME
- _ZN25VideoSortFilterProxyModelC2EP7QObject @ 52 NONAME
- _ZN25VideoSortFilterProxyModelD0Ev @ 53 NONAME
- _ZN25VideoSortFilterProxyModelD1Ev @ 54 NONAME
- _ZN25VideoSortFilterProxyModelD2Ev @ 55 NONAME
- _ZNK18VideoThumbnailData10metaObjectEv @ 56 NONAME
- _ZNK22VideoCollectionWrapper10metaObjectEv @ 57 NONAME
- _ZNK25VideoSortFilterProxyModel10metaObjectEv @ 58 NONAME
- _ZNK25VideoSortFilterProxyModel16filterAcceptsRowEiRK11QModelIndex @ 59 NONAME
- _ZNK25VideoSortFilterProxyModel8lessThanERK11QModelIndexS2_ @ 60 NONAME
- _ZTI18VideoThumbnailData @ 61 NONAME
- _ZTI22VideoCollectionWrapper @ 62 NONAME
- _ZTI25VideoSortFilterProxyModel @ 63 NONAME
- _ZTV18VideoThumbnailData @ 64 NONAME
- _ZTV22VideoCollectionWrapper @ 65 NONAME
- _ZTV25VideoSortFilterProxyModel @ 66 NONAME
+ _ZN25VideoSortFilterProxyModel12modelChangedEv @ 38 NONAME
+ _ZN25VideoSortFilterProxyModel12removeAlbumsERK5QListI11QModelIndexE @ 39 NONAME
+ _ZN25VideoSortFilterProxyModel14connectSignalsEv @ 40 NONAME
+ _ZN25VideoSortFilterProxyModel14processSortingEv @ 41 NONAME
+ _ZN25VideoSortFilterProxyModel15addItemsInAlbumE10TMPXItemIdRK5QListIS0_E @ 42 NONAME
+ _ZN25VideoSortFilterProxyModel16albumChangedSlotEv @ 43 NONAME
+ _ZN25VideoSortFilterProxyModel16fetchItemDetailsERK11QModelIndex @ 44 NONAME
+ _ZN25VideoSortFilterProxyModel16fullDetailsReadyE10TMPXItemId @ 45 NONAME
+ _ZN25VideoSortFilterProxyModel16staticMetaObjectE @ 46 NONAME DATA 16
+ _ZN25VideoSortFilterProxyModel17disconnectSignalsEv @ 47 NONAME
+ _ZN25VideoSortFilterProxyModel17shortDetailsReadyE10TMPXItemId @ 48 NONAME
+ _ZN25VideoSortFilterProxyModel18setGenericIdFilterE10TMPXItemIdb @ 49 NONAME
+ _ZN25VideoSortFilterProxyModel19getStaticMetaObjectEv @ 50 NONAME
+ _ZN25VideoSortFilterProxyModel21getMediaFilePathForIdE10TMPXItemId @ 51 NONAME
+ _ZN25VideoSortFilterProxyModel4backEv @ 52 NONAME
+ _ZN25VideoSortFilterProxyModel4openEi @ 53 NONAME
+ _ZN25VideoSortFilterProxyModel8openItemE10TMPXItemId @ 54 NONAME
+ _ZN25VideoSortFilterProxyModel9doSortingEiN2Qt9SortOrderEb @ 55 NONAME
+ _ZN25VideoSortFilterProxyModel9indexOfIdE10TMPXItemId @ 56 NONAME
+ _ZN25VideoSortFilterProxyModelC1EiP7QObject @ 57 NONAME
+ _ZN25VideoSortFilterProxyModelC2EiP7QObject @ 58 NONAME
+ _ZN25VideoSortFilterProxyModelD0Ev @ 59 NONAME
+ _ZN25VideoSortFilterProxyModelD1Ev @ 60 NONAME
+ _ZN25VideoSortFilterProxyModelD2Ev @ 61 NONAME
+ _ZNK18VideoThumbnailData10metaObjectEv @ 62 NONAME
+ _ZNK22VideoCollectionWrapper10metaObjectEv @ 63 NONAME
+ _ZNK25VideoSortFilterProxyModel10metaObjectEv @ 64 NONAME
+ _ZNK25VideoSortFilterProxyModel11getOpenItemEv @ 65 NONAME
+ _ZNK25VideoSortFilterProxyModel16filterAcceptsRowEiRK11QModelIndex @ 66 NONAME
+ _ZNK25VideoSortFilterProxyModel16resolveAlbumNameERK7QString @ 67 NONAME
+ _ZNK25VideoSortFilterProxyModel17getMediaIdAtIndexERK11QModelIndex @ 68 NONAME
+ _ZNK25VideoSortFilterProxyModel8lessThanERK11QModelIndexS2_ @ 69 NONAME
+ _ZTI18VideoThumbnailData @ 70 NONAME
+ _ZTI22VideoCollectionWrapper @ 71 NONAME
+ _ZTI25VideoSortFilterProxyModel @ 72 NONAME
+ _ZTV18VideoThumbnailData @ 73 NONAME
+ _ZTV22VideoCollectionWrapper @ 74 NONAME
+ _ZTV25VideoSortFilterProxyModel @ 75 NONAME
--- a/videocollection/inc/videocollectioncommon.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/inc/videocollectioncommon.h Thu Apr 01 23:22:15 2010 +0300
@@ -19,7 +19,9 @@
#define __VIDEOCOLLECTIONCOMMON_H__
-#include <QObject>
+#include <qobject.h>
+#include <qhash.h>
+#include <mpxitemid.h>
namespace VideoCollectionCommon
{
@@ -71,23 +73,23 @@
* order than the VideoDetailLabelKeys.
*/
const char * const VideoDetailLabels[] = {
- QT_TR_NOOP("DRM: %1"),
- QT_TR_NOOP("Service: %1"),
- QT_TR_NOOP("Description: %1"),
- QT_TR_NOOP("Length: %1"),
- QT_TR_NOOP("Date: %1"),
- QT_TR_NOOP("Modified: %1"),
- QT_TR_NOOP("Location: %1"),
- QT_TR_NOOP("Author: %1"),
- QT_TR_NOOP("Copyright: %1"),
- QT_TR_NOOP("Audio Type: %1"),
- QT_TR_NOOP("Language: %1"),
- QT_TR_NOOP("Keywords: %1"),
- QT_TR_NOOP("Size: %1"),
- QT_TR_NOOP("Resolution: %1"),
- QT_TR_NOOP("Format: %1"),
- QT_TR_NOOP("Bitrate: %1")
- };
+ QT_TR_NOOP("txt_videos_list_drm"),
+ QT_TR_NOOP("Service:"), //TODO: localisation
+ QT_TR_NOOP("txt_videos_list_description"),
+ QT_TR_NOOP("txt_videos_list_duration"),
+ QT_TR_NOOP("txt_videos_list_date"),
+ QT_TR_NOOP("txt_videos_list_modified"),
+ QT_TR_NOOP("txt_videos_list_location"),
+ QT_TR_NOOP("txt_videos_list_author"),
+ QT_TR_NOOP("txt_videos_list_copyright"),
+ QT_TR_NOOP("Audio Type:"), //TODO: localisation
+ QT_TR_NOOP("txt_videos_list_language"),
+ QT_TR_NOOP("txt_videos_list_keywords"),
+ QT_TR_NOOP("txt_videos_list_file_size"),
+ QT_TR_NOOP("txt_videos_list_resolution"),
+ QT_TR_NOOP("txt_videos_list_format"),
+ QT_TR_NOOP("txt_videos_list_bitrate")
+};
/**
* Order of keys in the labels const array.
@@ -111,6 +113,26 @@
MetaKeyBitRate
};
+ /**
+ * Collection level app browsed to
+ */
+ enum TCollectionLevels
+ {
+ ELevelInvalid = -1,
+ ELevelCategory = 2,
+ ELevelVideos = 3,
+ ELevelDefaultColl = 4,
+ ELevelAlbum = 5
+ };
+
+ /**
+ * Container path levels.
+ */
+ enum ContainerPathLevels
+ {
+ PathLevelCategories = 1,
+ PathLevelVideos = 2
+ };
/**
* Collection related asyncronous
@@ -120,9 +142,29 @@
{
statusSingleDeleteFail = 1,
statusMultipleDeleteFail,
- statusMultipleDeleteSucceed
+ statusDeleteInProgress,
+ statusDeleteSucceed,
+ statusSingleRemoveFail,
+ statusMultiRemoveFail,
+ statusRemoveSucceed,
+ statusVideosAddedToCollection,
+ statusAllVideosAlreadyInCollection
};
-
+ /**
+ * Utility macro to trace heap consumption.
+ */
+#ifdef _DEBUG
+ #define TRACE_HEAP(prefix)\
+ {\
+ int totalAllocSpace = 0;\
+ User::AllocSize( totalAllocSpace );\
+ qDebug("[VIDEOCOLLECTION][HEAP]: %s, Total allocated space : %d",\
+ prefix,\
+ totalAllocSpace);\
+ }
+#else
+ #define TRACE_HEAP(prefix)
+#endif
}
#endif // __VIDEOCOLLECTIONCOMMON_H__
--- a/videocollection/mpxmyvideoscollection/group/vcxmyvideoscollectionplugin.mmp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/group/vcxmyvideoscollectionplugin.mmp Thu Apr 01 23:22:15 2010 +0300
@@ -16,7 +16,6 @@
-
#include <bldvariant.hrh>
#include <data_caging_paths.hrh>
#include <platform_paths.hrh>
@@ -38,18 +37,15 @@
SOURCE vcxmyvideoscategories.cpp
SOURCE vcxmyvideosmessagelist.cpp
SOURCE vcxmyvideosasyncfileoperations.cpp
-SOURCE vcxmyvideosdownloadcache.cpp
SOURCE vcxmyvideosdrivemonitor.cpp
SOURCE vcxmyvideosdriveinfo.cpp
SOURCE vcxmyvideosdrivemonitorevent.cpp
SOURCE vcxmyvideosactivetask.cpp
SOURCE vcxmyvideosopenhandler.cpp
-
-SOURCEPATH ../download/src
-SOURCE vcxmyvideosdownloadutil.cpp
-
-SOURCEPATH ../src
-SOURCE vcxmyvideostimer.cpp
+SOURCE vcxmyvideosmdsalbums.cpp
+SOURCE vcxmyvideosmdscmdqueue.cpp
+SOURCE vcxmyvideosalbums.cpp
+SOURCE vcxmyvideosalbum.cpp
SOURCEPATH ../data
@@ -58,7 +54,6 @@
END
USERINCLUDE ../inc
-USERINCLUDE ../download/inc
USERINCLUDE ../../inc
APP_LAYER_SYSTEMINCLUDE
@@ -72,10 +67,6 @@
LIBRARY flogger.lib
LIBRARY mdeclient.lib
LIBRARY efsrv.lib
-LIBRARY downloadmgr.lib
LIBRARY charconv.lib
-LIBRARY vcxconnectionutility.lib
-LIBRARY mediatorclient.lib
LIBRARY centralrepository.lib
-LIBRARY drmutility.lib
-LIBRARY platformenv.lib
\ No newline at end of file
+LIBRARY PlatformEnv.lib
--- a/videocollection/mpxmyvideoscollection/inc/vcxmyvideosactivetask.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/inc/vcxmyvideosactivetask.h Thu Apr 01 23:22:15 2010 +0300
@@ -28,11 +28,22 @@
NONSHARABLE_CLASS( MVcxMyVideosActiveTaskObserver )
{
public:
+
+ enum TStepResult
+ {
+ EMoreToCome,
+ EDone,
+ /**
+ * Observer is responsible for calling Done or ContinueStepping if returning this.
+ */
+ EStopStepping
+ };
+
/**
* Handle the execution of a step
- * @return ETrue if complete, EFalse if more to do
+ * @return TStepResult
*/
- virtual TBool HandleStepL() = 0;
+ virtual TStepResult HandleStepL() = 0;
/**
* Handle the completion of the operation
*/
@@ -84,7 +95,26 @@
*/
CMPXCommand& GetCommand();
+ /**
+ * Get the command for the current task.
+ * @return the current command, ownership does not move.
+ */
+ CMPXMedia* Command();
+
+ /**
+ * If observer returns EStopStepping from HandleStepL, then observer must call
+ * this or ContinueStepping when sub operation is finished.
+ * Can be used to run async operations.
+ */
+ void Done();
+ /**
+ * If observer returns EStopStepping from HandleStepL, then observer must call
+ * this or Done when sub operation is finished.
+ * Can be used to run async operations.
+ */
+ void ContinueStepping();
+
protected: // From base class
/**
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/mpxmyvideoscollection/inc/vcxmyvideosalbum.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,216 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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: Class representing album in My Videos collection.
+*/
+
+
+#ifndef CVCXMYVIDEOSALBUM_H
+#define CVCXMYVIDEOSALBUM_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+
+class CMPXMedia;
+class CVcxMyVideosCollectionPlugin;
+
+// CLASS DECLARATION
+
+/**
+ * Contains information about video which belongs to some album.
+ * These are stored to CVcxMyVideosAlbum::iVideoList.
+ */
+NONSHARABLE_CLASS(TVcxMyVideosAlbumVideo)
+ {
+ public:
+
+ /**
+ * Constructor.
+ */
+ TVcxMyVideosAlbumVideo::TVcxMyVideosAlbumVideo();
+
+ /**
+ * = operator.
+ */
+ TVcxMyVideosAlbumVideo& operator=( const TVcxMyVideosAlbumVideo& aVideo );
+ private:
+
+ /**
+ * Set values.
+ */
+ void Set( TUint32 aMdsId, TUint32 aRelationMdsId, CMPXMedia* aVideo );
+
+ public:
+ TUint32 iMdsId; //Video object ID in MDS.
+ TUint32 iRelationMdsId; //Relation ID in MDS, this is used when removing items from album.
+ CMPXMedia* iMedia;
+ };
+
+/**
+ * Contains list of videos belonging to an album. Videos can be searched, added and
+ * removed. Videos are kept in sorting order by MDS ID to speed up access. Pointers
+ * to media objects in collection cache are also stored to speed up access.
+ * Contains also logic for keeping album media attributes up to date.
+ */
+NONSHARABLE_CLASS(CVcxMyVideosAlbum) : public CBase
+ {
+public:
+ // Constructors and destructor
+
+ /**
+ * Destructor.
+ */
+ ~CVcxMyVideosAlbum();
+
+ /**
+ * Two-phased constructor.
+ */
+ static CVcxMyVideosAlbum* NewL( CVcxMyVideosCollectionPlugin& aCollectionPlugin );
+
+ /**
+ * Two-phased constructor.
+ */
+ static CVcxMyVideosAlbum* NewLC( CVcxMyVideosCollectionPlugin& aCollectionPlugin );
+
+ // new methods
+
+ /**
+ * Sets up this album.
+ *
+ * @param aAlbum Media class to set from.
+ */
+ void SetL( /*CMPXMedia& aAlbum*/ );
+
+ /**
+ * Sorts iVideoList by MDS ID.
+ */
+ void Sort();
+
+ /**
+ * Checks if aMdsId belongs to this album. Checking is
+ * done using bisection method.
+ *
+ * @param aMdsId Id to check.
+ */
+ TBool BelongsToAlbum( TUint32 aMdsId );
+
+ /**
+ * Finds video from iVideoList. Uses bisection method, ie
+ * is fast.
+ *
+ * @param aMdsId Video to find.
+ * @param aVideo If found, this is filled with data.
+ * @param aIndex Position in iVideoList where from the video
+ * was found.
+ * @return System-wide error code. If != KErrNone, then
+ * aVideo and aIndex won't contain valid data.
+ */
+ TInt Video( TUint32 aMdsId, TVcxMyVideosAlbumVideo& aVideo, TInt& aIndex );
+
+ /**
+ * Adds aVideo to this album. The id array is kept in ascending order.
+ *
+ * @param aVideo Video to add.
+ */
+ void AddL( TVcxMyVideosAlbumVideo aVideo );
+
+ /**
+ * Removes videos from this album.
+ *
+ * @param aMdsIds Array containing IDs of the videos to remove.
+ */
+ void Remove( RArray<TUint32>& aMdsIds );
+
+ /**
+ * Removes aMdsId from this album.
+ *
+ * @param aMdsId ID to remove.
+ * @param aCompress If ETrue, then Compress is called to iVideoList.
+ * ETrue as default.
+ */
+ void Remove( TUint32 aMdsId, TBool aCompress = ETrue );
+
+ /**
+ * Updates album attributes from scratch.
+ */
+ void UpdateAttributesL();
+
+ /**
+ * Used for keeping RArray<TVcxMyVideosAlbumVideo> in integer order by
+ * TVcxMyVideosAlbumVideo::iMdsId.
+ *
+ * @param aVideo1 Video to compare
+ * @param aVideo2 Video to compare
+ * @return -1 if aVideo1 is smaller than aVideo2, 1 if aVideo1 is larger than
+ * aVideo2.
+ */
+ static TInt CompareVideosByMdsId( const TVcxMyVideosAlbumVideo& aVideo1,
+ const TVcxMyVideosAlbumVideo& aVideo2 );
+
+ /**
+ * Creates video list belonging to this album. Ownership goes to caller.
+ *
+ * @return Media containing media array. Array items are videos.
+ */
+ CMPXMedia* CreateVideoListL();
+
+ /**
+ * Appends items from aFromVideoList to aToVideoList if they belong to
+ * this album.
+ *
+ * @param aFromVideoList From list.
+ * @param aToVideoList To List.
+ * @param aNewItemStartIndex Start index of the copy. Items in aFromVideoList before this
+ * value are ignored.
+ */
+ void AppendToVideoListL( CMPXMedia& aFromVideoList,
+ CMPXMedia& aToVideoList, TInt aNewItemStartIndex );
+
+private:
+
+ /**
+ * Constructor for performing 1st stage construction
+ */
+ CVcxMyVideosAlbum( CVcxMyVideosCollectionPlugin& aCollectionPlugin );
+
+ /**
+ * EPOC default constructor for performing 2nd stage construction
+ */
+ void ConstructL();
+
+private: //data
+ CVcxMyVideosCollectionPlugin& iCollection;
+
+public: //data
+
+ /**
+ * MDS ID of this album.
+ */
+ TUint32 iMdsId;
+
+ /**
+ * MPX media object representing this album in collection, not own.
+ * The item is owned by CVcxMyVideosAlbums::iAlbumList
+ */
+ CMPXMedia* iMedia;
+
+ /**
+ * Array containing info about videos belonging to this album.
+ */
+ RArray<TVcxMyVideosAlbumVideo> iVideoList;
+
+ };
+
+#endif // CVCXMYVIDEOSALBUM_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/mpxmyvideoscollection/inc/vcxmyvideosalbums.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,305 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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: Albums related collection functionality.
+*/
+
+
+
+#ifndef VCXMYVIDEOSALBUMS_H
+#define VCXMYVIDEOSALBUMS_H
+
+// INCLUDES
+#include <mdequery.h>
+#include "vcxmyvideosmdsdb.h"
+#include "vcxmyvideosalbum.h"
+
+// FORWARD DECLARATIONS
+class CVcxMyVideosMdsDb;
+class CMPXMedia;
+class CVcxMyVideosCollectionPlugin;
+class CVcxMyVideosAlbum;
+
+// CONSTANTS
+
+// CLASS DECLARATION
+
+/**
+* Albums related collection functionality.
+*
+* @lib mpxmyvideoscollectionplugin.lib
+*/
+NONSHARABLE_CLASS(CVcxMyVideosAlbums) : public CBase, public MVcxMyVideosMdsAlbumsObserver
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor
+ * @return object constructed
+ */
+ static CVcxMyVideosAlbums* NewL( CVcxMyVideosCollectionPlugin& aCollectionPlugin );
+
+ /**
+ * Destructor
+ */
+ virtual ~CVcxMyVideosAlbums();
+
+ public: // new methods
+
+ /**
+ * Returns album from iAlbums array by MDS ID. Ownership does not move.
+ *
+ * @param aMdsId MDS ID of the album to get.
+ * @param aPos If given, then the position index in iAlbums is written here.
+ * Ownership does not move.
+ * @return Pointer to album or NULL if not found.
+ */
+ CVcxMyVideosAlbum* Album( TUint32 aMdsId, TInt* aPos = NULL );
+
+ /**
+ * Creates iAlbumList if it doesn't exist yet. The list is populated
+ * from async callback, HandleGetAlbumsResp().
+ */
+ void CreateAlbumListL();
+
+ /**
+ * Fetches MDS IDs from MDS for all videos belonging to albums.
+ * Ie fills iAlbums[*]->iVideoList[*].iMdsId (and iAlbums[*]->iVideoList[*].iRelationMdsId) fields.
+ * Causes several async calls to MDS.
+ */
+ void GetAlbumContentIdsL();
+
+ /**
+ * Adds videos to album.
+ *
+ * @param aCmd See attribute usage from vcxmyvideosdefs.h.
+ */
+ void AddVideosToAlbumL( CMPXMedia* aCmd );
+
+ /**
+ * Removes videos from album.
+ *
+ * @param aCmd See attribute usage from vcxmyvideosdefs.h.
+ */
+ void RemoveVideosFromAlbumL( CMPXMedia* aCmd );
+
+ /**
+ * Adds album to MDS and to this class. KMPXMediaGeneralTitle
+ * should be set in aCmd. Upon completion, the KMPXMediaGeneralId
+ * attribute contains the new MPX item ID. Leaves if could
+ * not add to MDS.
+ *
+ * @param aCmd Command object received from collection client.
+ */
+ void AddAlbumL( CMPXMedia& aCmd );
+
+ /**
+ * Removes albums from MDS. MDS delete events will clean up albums
+ * from this class.
+ *
+ * @param aCmd MPX command received from the client. Contains media array,
+ * which contains medias with album IDs set to KMPXMediaGeneralId.
+ * Ownership does not move.
+ */
+ void RemoveAlbumsFromMdsOnlyL( CMPXMedia* aCmd );
+
+ /**
+ * Removes albums from this object (iAlbumList and iAlbums).
+ * Called from MDS delete event. Album IDs which were removed are
+ * also removed from aAlbumIds array. After the call aAlbumIds
+ * will contain items which were not found and not deleted.
+ * Sends appropriate events to collection client.
+ *
+ * @param aAlbumIds Album IDs to be removed.
+ */
+ void RemoveAlbumsL( RArray<TUint32>& aAlbumIds );
+
+ /**
+ * Removes album from this class (iAlbumList and iAlbums).
+ * Adds event to message list but does not send it.
+ *
+ * @param aMdsIds Album MDS ID to be removed.
+ * @param aCompress If ETrue, then iAlbums is compressed,
+ * otherwise not.
+ * @return ETrue if album was found and removed.
+ */
+ TBool RemoveAlbum( TUint32 aMdsId, TBool aCompress );
+
+ /**
+ * Fetches albums from MDS. This is called from MDS insert event.
+ *
+ * @param aAlbumIds Album IDs to fetch.
+ */
+ void AddAlbumsFromMdsL( RArray<TUint32>& aAlbumIds );
+
+ /**
+ * From MVcxMyVideosMdsAlbumsObserver.
+ * Process albums arriving from MDS. Response to VcxMyVideosMdsAlbums::GetAlbumsL.
+ */
+ void HandleGetAlbumsRespL( CMPXMedia* aAlbumList );
+
+ /**
+ * From MVcxMyVideosMdsAlbumsObserver.
+ * Process content ids arriving from MDS. Response to VcxMyVideosMdsAlbums::GetAlbumContentIdsL.
+ *
+ * @param aAlbumId ID of the album.
+ * @param aAlbumContent Array containing MDS object IDs. This array is the same which
+ * was given in GetAlbumContentIdsL call.
+ */
+ void HandleGetAlbumContentIdsRespL( TUint32 aAlbumId,
+ RArray<TVcxMyVideosAlbumVideo>& aAlbumContentIds );
+
+ /**
+ * From MVcxMyVideosMdsAlbumsObserver.
+ * Response to VcxMyVideosMdsAlbums::GetAlbumsL.
+ * Sends insert events to collection clients.
+ *
+ * @param aAlbumList Pointer to same array which was given in GetAlbums call.
+ */
+ void HandleGetAlbumsResp( CMPXMedia* aAlbumList );
+
+ /**
+ * From MVcxMyVideosMdsAlbumsObserver.
+ * Process content ids arriving from MDS. Response to CVcxMyVideosMdsAlbums::GetAlbumContentIdsL.
+ *
+ * @param aAlbumId ID of the album.
+ * @param aAlbumContent Array containing MDS object IDs. This array is the same which
+ * was given in GetAlbumContentL call.
+ */
+ void HandleGetAlbumContentIdsResp( TUint32 aAlbumId,
+ RArray<TVcxMyVideosAlbumVideo>& aAlbumContentIds );
+
+ /**
+ * From MVcxMyVideosMdsAlbumsObserver.
+ * Process content videos arriving from MDS. Response to CVcxMyVideosMdsAlbums::GetAlbumContentVideosL.
+ *
+ * @param aAlbumId Album ID.
+ * @param aVideoList Media containing media array, array items are videos.
+ * @param aError Error code in case of failure.
+ * @param aFirstNewItemIndex The index of the first new item.
+ * @param aNewItemCount How many new items since the last results.
+ * @param aComplete ETrue is query is complete, EFalse if there is new to come.
+ */
+ void HandleGetAlbumContentVideosResp( TUint32 /*aAlbumId*/, CMPXMedia& /*aVideoList*/,
+ TInt /*aError*/, TInt /*aFirstNewItemIndex*/, TInt /*aNewItemCount*/, TBool /*aComplete*/ ) {}
+
+ /**
+ * From MVcxMyVideosMdsAlbumsObserver.
+ * Response to CVcxMyVideosMdsAlbums::AddVideosToAlbumL.
+ *
+ * @param aCmd Pointer to object which was given in AddVideosToAlbumL
+ * function call. Ownership does not move.
+ * @param aItemArray Item array which was tried to add to MDS.
+ */
+ void HandleAddVideosToAlbumResp( CMPXMedia* aCmd,
+ RPointerArray<CMdEInstanceItem>& aItemArray );
+
+ /**
+ * From MVcxMyVideosMdsAlbumsObserver.
+ * Response to CVcxMyVideosMdsAlbums::RemoveRelationsL.
+ */
+ void HandleRemoveRelationsResp( RArray<TUint32>& aRelationIds,
+ RArray<TUint32>& aResults );
+
+ /**
+ * From MVcxMyVideosMdsAlbumsObserver.
+ * Response to CVcxMyVideosMdsAlbums::RemoveAlbumsL.
+ */
+ void HandleRemoveAlbumsResp( CMPXMedia* aCmd,
+ RArray<TUint32>& aResultIds );
+
+ /**
+ * From MVcxMyVideosMdsAlbumsObserver.
+ * Relation events from MDS. This object is set as an observer at
+ * iCollection.ConstructL, CVcxMyVideosMdsDb::NewL(..,aAlbumsObserver,..).
+ */
+ void HandleRelationEvent( TObserverNotificationType aType,
+ const RArray<TMdERelation>& aRelationArray );
+ private:
+
+ /**
+ * Fills in iAlbums array. This is called when iAlbumList is ready.
+ * Pointers to CVcxMyVideosVideoCache::iVideoList are not filled
+ * in yet.
+ */
+ void CreateAlbumsL();
+
+ /**
+ * Constructor
+ */
+ CVcxMyVideosAlbums( CVcxMyVideosCollectionPlugin& aCollectionPlugin );
+
+ /**
+ * Symbian 2nd phase constructor.
+ */
+ void ConstructL();
+
+ /**
+ * Leaving version of HandleAddVideosToAlbumResp.
+ */
+ void DoHandleAddVideosToAlbumRespL( CMPXMedia* aCmd,
+ RPointerArray<CMdEInstanceItem>& aItemArray );
+
+ public:
+
+ /**
+ * Album list. This is given to client when categorylevel items are requested. Own.
+ * If this is destroyed/edited, then pointers have to be updated in iAlbums.
+ */
+ CMPXMedia* iAlbumList;
+
+ /**
+ * Array containing MDS IDs and pointers to album and video media items.
+ * Album media items are in iAlbumList and video media items are in
+ * CVcxMyVideosVideoCache::iVideoList.
+ */
+ RArray<CVcxMyVideosAlbum*> iAlbums;
+
+ /**
+ * ETrue when iAlbumList is ready and iAlbums contains video IDs.
+ */
+ TBool iAlbumListIsComplete;
+
+ private:
+
+ /**
+ * Owner of this object.
+ */
+ CVcxMyVideosCollectionPlugin& iCollection;
+
+ /**
+ * Used in MDS operations to store MDS video (or relation) IDs.
+ */
+ RArray<TUint32> iMdsOpTargetIds;
+
+ /**
+ * Store album video data during relation deletion. This is to
+ * avoid second search when resp arrives.
+ */
+ RArray<TVcxMyVideosAlbumVideo> iRemoveFromAlbumVideos;
+
+ /**
+ * Used in MDS operations to store operation results. Is in sync with iMdsOpTargetIds.
+ */
+ RArray<TInt> iMdsOpResults;
+
+ /**
+ * Used in MDS operations to store operation results. Is in sync with iMdsOpTargetIds.
+ */
+ RArray<TUint32> iMdsOpResultsUint32;
+
+ };
+
+#endif // VCXMYVIDEOSALBUMS_H
+
+
--- a/videocollection/mpxmyvideoscollection/inc/vcxmyvideosasyncfileoperations.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/inc/vcxmyvideosasyncfileoperations.h Thu Apr 01 23:22:15 2010 +0300
@@ -27,10 +27,6 @@
#include <mpxcollectionmessagedefs.h>
#include <vcxmyvideosdefs.h>
-//#include "mpxdbactivetask.h" // change to <> when moved to s60 dir and remove temp .h-file
-
-#include "vcxmyvideosdownloadutil.h"
-
// FORWARD DECLARATIONS
class CVcxMyVideosCollectionPlugin;
@@ -83,9 +79,10 @@
/**
* Performs one Move or Copy operation. Called by HandleStep.
*
- * @return ETrue if operation was the last one, EFalse othewise.
+ * @return MVcxMyVideosActiveTaskObserver::EDone if was last operation,
+ * MVcxMyVideosActiveTaskObserver::EMoreToCome otherwise.
*/
- TBool HandleMoveOrCopyStepL();
+ MVcxMyVideosActiveTaskObserver::TStepResult HandleMoveOrCopyStepL();
/**
* Moves or copies video to another drive.
@@ -110,9 +107,10 @@
/**
* Performs one Delete operation. Called by HandleStep.
*
- * @return ETrue if operation was the last one, EFalse otherwise.
+ * @return MVcxMyVideosActiveTaskObserver::EDone if was last operation,
+ * MVcxMyVideosActiveTaskObserver::EMoreToCome otherwise.
*/
- TBool HandleDeleteStepL();
+ MVcxMyVideosActiveTaskObserver::TStepResult HandleDeleteStepL();
private:
--- a/videocollection/mpxmyvideoscollection/inc/vcxmyvideoscollectionplugin.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/inc/vcxmyvideoscollectionplugin.h Thu Apr 01 23:22:15 2010 +0300
@@ -11,12 +11,11 @@
*
* Contributors:
*
-* Description: Implementation of My Videos MPX Collection Plugin interface*
+* Description: Implementation of My Videos MPX Collection Plugin interface*
*/
-
#ifndef VCXMYVIDEOSCOLLECTIONPLUGIN_H
#define VCXMYVIDEOSCOLLECTIONPLUGIN_H
@@ -30,18 +29,17 @@
#include "vcxmyvideosactivetask.h"
#include "vcxmyvideosmdsdb.h"
-#include "vcxmyvideosdownloadutil.h"
// FORWARD DECLARATIONS
class CVcxMyVideosMdsDb;
class CMPXResource;
class CMPXMediaArray;
-class CVcxMyVideosDownloadUtil;
class CVcxMyVideosVideoCache;
class CVcxMyVideosCategories;
class CVcxMyVideosMessageList;
class CVcxMyVideosAsyncFileOperations;
class CVcxMyVideosOpenHandler;
+class CVcxMyVideosAlbums;
// CONSTANTS
@@ -55,13 +53,13 @@
NONSHARABLE_CLASS(CVcxMyVideosCollectionPlugin) :
public CMPXCollectionPlugin,
public MVcxMyVideosMdsDbObserver,
- public MVcxMyVideosActiveTaskObserver,
- public MVcxMyVideosDownloadUtilObserver
+ public MVcxMyVideosActiveTaskObserver
{
public: // Constructors and destructor
friend class CVcxMyVideosOpenHandler;
friend class CVcxMyVideosVideoCache;
+ friend class CVcxMyVideosAlbums;
/**
* Two-phased constructor
@@ -190,7 +188,7 @@
/**
* From MMPXDbActiveTaskObserver
*/
- TBool HandleStepL();
+ MVcxMyVideosActiveTaskObserver::TStepResult HandleStepL();
/**
* From MMPXDbActiveTaskObserver
@@ -226,26 +224,12 @@
* From MVcxMyVideosMdsDbObserver. Called when media is removed or inserted.
*/
void HandleObjectPresentNotification();
-
+
/**
* Leaving version of HandleObjectPresentNotification.
*/
void DoHandleObjectPresentNotificationL();
-
- /**
- * From CVcxMyVideosDownloadUtilObserver.
- */
- void HandleDlEvent( TVcxMyVideosDownloadState aState,
- TUint32 aDownloadId, TInt aProgress, TInt64 aDownloaded,
- TInt32 aError, TInt32 aGlobalError );
-
- /**
- * Leaving version of HandleDlEvent.
- */
- void DoHandleDlEventL( TVcxMyVideosDownloadState aState,
- TUint32 aDownloadId, TInt aProgress, TInt64 aDownloaded,
- TInt32 aError, TInt32 aGlobalError );
-
+
private:
/**
* Constructor
@@ -256,38 +240,6 @@
* Symbian 2nd phase constructor.
*/
void ConstructL ();
-
- /**
- * Synchronizes set of videos in cache with Download Manager.
- * Download related attributes are set in cache if corresponding
- * download is found.
- *
- * @param aItemsInCache Array of MDS IDs.
- */
- void SyncWithDownloadsL( RArray<TUint32>& aItemsInCache );
-
- /**
- * Synchronizes video with Download Manager.
- *
- * @aVideo Video to synchronize.
- * @aEventAdded Set to ETrue if event was added to iMessageList, does not change the
- * value otherwise.
- */
- void SyncVideoWithDownloadsL( CMPXMedia& aVideo, TBool& aEventAdded,
- TBool aAddEvent = ETrue );
-
- /**
- * Copies download attributes from aDownload to aVideo.
- *
- * @param aVideo Video in cache.
- * @param aDownload Corresponding download in Download Manager.
- * @param aSendMpxEvent ETrue if MPX item has been modified and caller should
- * send the modification event.
- */
- void SyncVideoAndDownloadL(
- CMPXMedia& aVideo,
- RHttpDownload& aDownload,
- TBool& aSendMpxEvent );
/**
* Copies KVcxMediaMyVideosTransactionId field from aRequest to aResp.
@@ -318,24 +270,7 @@
* fetching ongoing.
*/
void RestartVideoListFetchingL();
-
-
- /**
- * Sets download ID to 0 and download state to none. Updates MDS and sends
- * modified event.
- *
- * @param aDownloadId Download ID of the MPX item.
- */
- void SetDownloadIdToZeroL( TUint aDownloadId );
-
-
-#ifdef _DEBUG
- /**
- * Returns download state as a descriptor.
- */
- const TDesC& DownloadState( TUint8 aDlState );
-#endif
-
+
public:
/**
@@ -363,23 +298,6 @@
void SendMyVideosMessageL( TUint32 aMessageId, CMPXCommand* aCommand = NULL );
/**
- * Synchronizes video list with Download Manager.
- *
- * @param aVideoList Video list to synchronize.
- * @param aStartPos Items before aStartPos index are left out from synchronizing.
- * @param aSendEvents If ETrue and modifications are done to the list, then
- * MPX events are sent.
- */
- void SyncVideoListWithDownloadsL( CMPXMedia& aVideoList,
- TBool aSendEvents, TInt aStartPos = 0 );
-
- /**
- * Returns reference to iDownloadUtil. If iDownloadUtil is NULL then
- * it is created.
- */
- CVcxMyVideosDownloadUtil& DownloadUtilL();
-
- /**
* Sends messages to clients. If udeb version, adds messageid
* parameter to the message for debugging purposes. May or may not
* contain media list as parameter.
@@ -394,13 +312,13 @@
* @return Reference to iCategories member.
*/
CVcxMyVideosCategories& CategoriesL();
-
+
/**
- * Notifies to mediator listeners that a download has completed.
+ * Creates iAlbums if its not created yet and returns reference to it.
*
- * @param aVideo Downloaded video.
+ * @return Reference to iAlbums member.
*/
- void NotifyDownloadCompletedL( CMPXMedia& aVideo );
+ CVcxMyVideosAlbums& AlbumsL();
/**
* Notifies to mediator listeners that count of new videos has decreased.
@@ -435,7 +353,7 @@
* Executes command in several small steps.
*/
CVcxMyVideosActiveTask* iActiveTask;
-
+
private:
/**
@@ -443,12 +361,12 @@
* Own.
*/
CVcxMyVideosCategories* iCategories;
-
+
/**
- * Download util, own.
+ * Albums related functionality (except mds db operations). Own.
*/
- CVcxMyVideosDownloadUtil* iDownloadUtil;
-
+ CVcxMyVideosAlbums* iAlbums;
+
/**
* Target drive for Move operation.
*/
--- a/videocollection/mpxmyvideoscollection/inc/vcxmyvideoscollectionutil.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/inc/vcxmyvideoscollectionutil.h Thu Apr 01 23:22:15 2010 +0300
@@ -11,17 +11,17 @@
*
* Contributors:
*
-* Description:
+* Description:
*
*/
-
#ifndef VCXMYVIDEOSCOLLECTIONUTIL_H
#define VCXMYVIDEOSCOLLECTIONUTIL_H
// INCLUDES
+#include <vcxmyvideosdefs.h>
// FORWARD DECLARATIONS
class CMPXMedia;
@@ -83,6 +83,15 @@
RArray<TUint32>& aMdsIds );
/**
+ * Appends all items from aFromList to aToList. New items will point to
+ * same shared memory.
+ *
+ * @param aToList List in which items are appended to.
+ * @param aFromList List in which items are copied from.
+ */
+ static void AppendToListL( CMPXMedia& aToList, CMPXMedia& aFromList );
+
+ /**
* Converts drive letter to drive number.
*
* @param aDrive drive letter
@@ -207,6 +216,44 @@
*/
static TInt Origin( TInt aCategoryId );
+ /**
+ * Gets KMPXMediaArrayContents attribute from aMedia. Leaves
+ * with KErrArgument is attribute is not supported.
+ *
+ * @param aMedia Media where from the attribute is fetched.
+ * @return Pointer to media array.
+ */
+ static CMPXMediaArray* MediaArrayL( CMPXMedia& aMedia );
+
+ /**
+ * Gets KVcxMediaMyVideosInt32Value attribute from aMedia. Leaves
+ * with KErrArgument if attribute is not supported.
+ *
+ * @param aMedia Media where from the attribute is fetched.
+ * @return Value of KVcxMediaMyVideosInt32Value attribute.
+ */
+ static TInt32 Int32ValueL( CMPXMedia& aMedia );
+
+ /**
+ * Gets KVcxMediaMyVideosUint32Value attribute from aMedia. Leaves
+ * with KErrArgument if attribute is not supported.
+ *
+ * @param aMedia Media where from the attribute is fetched.
+ * @return Value of KVcxMediaMyVideosUint32Value attribute.
+ */
+ static TUint32 Uint32ValueL( CMPXMedia& aMedia );
+
+ /**
+ * Gets KMPXMediaGeneralId attributes from aMediaArray and
+ * puts them to aIdArray. aIdArray is reset before adding.
+ *
+ * @param aMediaArray Media array containing media items which
+ * have KMPXMediaGeneralId attribute set.
+ * @param aIdArray Array where to the IDs are written to.
+ */
+ static void GetIdsFromMediaArrayL( CMPXMediaArray& aMediaArray,
+ RArray<TUint32>& aIdArray );
+
#ifdef _DEBUG
/**
* Prints process names which have file handle open to aFileName
--- a/videocollection/mpxmyvideoscollection/inc/vcxmyvideosdownloadcache.h Thu Apr 01 23:13:36 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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: Contains cached MDS media items which are being downloaded.*
-*/
-
-
-
-
-#ifndef VCXMYVIDEOSDOWNLOADCACHE_H
-#define VCXMYVIDEOSDOWNLOADCACHE_H
-
-// INCLUDES
-
-// FORWARD DECLARATIONS
-class CMPXMedia;
-
-// CONSTANTS
-
-// CLASS DECLARATION
-
-/**
-* Used for storing download ids and media object pointers to circular buffers for fast access.
-*
-* @lib mpxmyvideoscollectionplugin.lib
-*/
-NONSHARABLE_CLASS(CVcxMyVideosDownloadCache) : public CBase
- {
- public: // Constructors and destructor
-
- /**
- * Two-phased constructor
- * @return Object constructed
- */
- static CVcxMyVideosDownloadCache* NewL();
-
- /**
- * Destructor
- */
- virtual ~CVcxMyVideosDownloadCache();
-
- private:
- /**
- * Constructor
- */
- CVcxMyVideosDownloadCache();
-
- /**
- * Symbian 2nd phase constructor.
- */
- void ConstructL ();
-
- public:
- /**
- * Tries to find item with aDownloadId from Download Cache.
- *
- * @param aDownloadId Download ID in Download Manager.
- * @return Returns pointer to media object, NULL if not found.
- * Ownership does not move.
- */
- CMPXMedia* Get( TUint32 aDownloadId );
-
- /**
- * Adds download ID and index pair to Download Cache.
- *
- * @param aDownloadId Download ID in Download Manager
- * @param aVideo Pointer to video, ownership does not move.
- */
- void Add( TUint32 aDownloadId, CMPXMedia* aVideo );
-
- /**
- * Deletes item from Download Cache
- *
- * @param aVideo Video to remove.
- */
- void Delete( CMPXMedia* aVideo );
-
- private:
-
- /**
- * Array used as circular buffer, contains download ids.
- */
- RArray<TUint32> iDownloadId;
-
- /**
- * Array used as circular buffer, contains pointers to medias.
- */
- RPointerArray<CMPXMedia> iMedia;
-
- /**
- * Current position of the circular buffers (iDownloadId and iMedia).
- * Next item added is written to this position.
- */
- TInt iPos;
-
- };
-
-#endif // VCXMYVIDEOSVIDEOCACHE_H
-
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/mpxmyvideoscollection/inc/vcxmyvideosmdsalbums.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,500 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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: Provides albums support from MDS*
+*/
+
+
+
+#ifndef VCXMYVIDEOSMDSALBUMS_H
+#define VCXMYVIDEOSMDSALBUMS_H
+
+// INCLUDES
+#include <mdequery.h>
+#include <mpxmedia.h>
+#include "vcxmyvideosalbum.h"
+#include "vcxmyvideosmdsdb.h"
+
+// FORWARD DECLARATIONS
+class CMPXMedia;
+
+// CONSTANTS
+
+// CLASS DECLARATION
+
+/**
+* Provides albums support, uses MDS.
+*
+* @lib mpxmyvideoscollectionplugin.lib
+*/
+NONSHARABLE_CLASS(CVcxMyVideosMdsAlbums) :
+ public CActive,
+ public MMdEQueryObserver,
+ public MMdERelationItemObserver
+#if 0 // not used
+ ,
+ public MMdERelationObserver
+#endif
+ {
+ public: // Constructors and destructor
+
+ friend class CVcxMyVideosMdsCmdQueue;
+
+ enum TVcxAsyncOperation
+ {
+ EVcxNone,
+ EVcxAddVideosToAlbum,
+ EVcxRemoveRelations,
+ EVcxRemoveAlbums
+ };
+
+ /**
+ * Constructor.
+ *
+ * @param aMdsDb Owner of this object.
+ * @param aObserver Object which is listening album related events. If NULL, then
+ * no observer is set.
+ */
+ static CVcxMyVideosMdsAlbums* NewL( CVcxMyVideosMdsDb& aMdsDb,
+ MVcxMyVideosMdsAlbumsObserver* aObserver );
+
+ /**
+ * Destructor
+ */
+ virtual ~CVcxMyVideosMdsAlbums();
+
+ public: // new methods
+
+ /**
+ * Cancels possible ongoing asynchronous request.
+ *
+ * @param aType Defines what kind of request is cancelled.
+ */
+ void Cancel( CVcxMyVideosMdsDb::TRequestType aType = CVcxMyVideosMdsDb::EAll );
+
+ /**
+ * Gets My Videos albums from MDS asynchronously.
+ * HandleGetAlbumsResp() callback function is called when ready.
+ * Utilizes CVcxMyVideosMdsCmdQueue.
+ *
+ * @param aAlbumList Album list is written here. Caller owns this, ownership
+ * does not move.
+ * @param aClient Response call is done to this object.
+ */
+ void GetAlbumsL( CMPXMedia* aAlbumList, MVcxMyVideosMdsAlbumsObserver& aClient );
+
+ /**
+ * Gets album content IDs asynchronously.
+ * HandleGetAlbumContentIdsResp() callback function is called when ready.
+ * Utilizes CVcxMyVideosMdsCmdQueue.
+ *
+ * @param aAlbumId Album ID.
+ * @param aContentArray Item IDs which belog to aAlbum are written here. Caller must
+ * keep aContentArray available until HandleGetAlbumContentIdsResp
+ * has been called.
+ * @param aClient Response call is done to this object.
+ */
+ void GetAlbumContentIdsL( TUint32 aAlbumId, RArray<TVcxMyVideosAlbumVideo>& aContentArray,
+ MVcxMyVideosMdsAlbumsObserver& aClient );
+
+ /**
+ * Gets album content videos asynchronously.
+ * HandleGetAlbumContentVideosResp() callback function is called when ready.
+ * Utilizes CVcxMyVideosMdsCmdQueue.
+ *
+ * @param aAlbumId Album ID.
+ * @param aVideoList Media containing media array. Video media objects are added to media array.
+ * Caller must keep aVideoList available until callback has been called.
+ * @param aClient Response call is done to this object.
+ */
+ void GetAlbumContentVideosL( TUint32 aAlbumId, CMPXMedia& aVideoList,
+ MVcxMyVideosMdsAlbumsObserver& aClient );
+
+ /**
+ * Adds videos to album asynchronously. HandleAddVideosToAlbumResp() callback function
+ * is called when operation finishes.
+ * Utilizes CVcxMyVideosMdsCmdQueue.
+ *
+ * @param aMpxCmd Media containing command parameters: album ID and video ID list.
+ * Results are also written to this object. See media structure and
+ * used attributes from vcxmyvideosdef.c file,
+ * KVcxCommandMyVideosAddToAlbum command. Ownership does not move.
+ *
+ * @param aClient Response call is done to this object.
+ */
+ void AddVideosToAlbumL( CMPXMedia* aMpxCmd, MVcxMyVideosMdsAlbumsObserver& aClient );
+
+ /**
+ * Removes relations asynchronously.
+ * Utilizes CVcxMyVideosMdsCmdQueue.
+ *
+ * @param aRelationIds Relations which are removed.
+ * @param aResults In sync with aRelationIds. Result codes, KErrNone if successful,
+ * KErrGeneral if failed.
+ * @param aClient Response call is done to this object.
+ */
+ void RemoveRelationsL( RArray<TUint32>& aRelationIds,
+ RArray<TUint32>& aResults, MVcxMyVideosMdsAlbumsObserver& aClient );
+
+ /**
+ * Adds album to MDS. aAlbum should have KMPXMediaGeneralTitle attribute
+ * set. The MDS item ID of the created album is written to KMPXMediaGeneralId
+ * attribute.
+ *
+ * @param aAlbum Album which is added to database.
+ */
+ void AddAlbumL( CMPXMedia& aAlbum );
+
+ /**
+ * Removes albums asynchronously. HandleRemoveAlbumsResp() callback function
+ * is called when operation finishes.
+ * Utilizes CVcxMyVideosMdsCmdQueue.
+ *
+ * @param aMpxCmd Media containing command parameters: media array containing album IDs.
+ * Results are also written to this object. See media structure and
+ * used attributes from vcxmyvideosdef.c file,
+ * KVcxCommandMyVideosRemoveAlbums command. Ownership does not move.
+ *
+ * @param aClient Response call is done to this object.
+ */
+ void RemoveAlbumsL( CMPXMedia* aMpxCmd, MVcxMyVideosMdsAlbumsObserver& aClient );
+
+ protected:
+
+ /**
+ * From CActive.
+ * Called when operation completes.
+ */
+ void RunL();
+
+ /**
+ * From CActive.
+ * Actual implementation for cancelling.
+ */
+ void DoCancel();
+
+ private:
+
+ /**
+ * Constructor
+ */
+ CVcxMyVideosMdsAlbums( CVcxMyVideosMdsDb& aMdsDb,
+ MVcxMyVideosMdsAlbumsObserver* aObserver );
+
+ /**
+ * Symbian 2nd phase constructor.
+ */
+ void ConstructL();
+
+ /**
+ * Copies album data from aObject to aAlbum.
+ *
+ * @param aObject MDS object to copy data from.
+ * @param aAlbum MPX media to copy data to.
+ */
+ void Object2MediaL( CMdEObject& aObject, CMPXMedia& aAlbum );
+
+ /**
+ * Copies album data from aAlbum to aObject.
+ *
+ * @param aAlbum MPX media to copy data from.
+ * @param aObject MDS object to copy data to.
+ */
+ void Media2ObjectL( CMPXMedia& aAlbum, CMdEObject& aObject);
+
+ /**
+ * Gets various defintions from MDS and stores them to member variables.
+ */
+ void GetSchemaDefinitionsL();
+
+ /**
+ * Gets My Videos albums from MDS asynchronously.
+ * HandleGetAlbumsResp() callback function is called when ready.
+ *
+ * @param aAlbumList Album list is written here. Caller owns this, ownership
+ * does not move.
+ * @param aClient Callback is done to this object.
+ */
+ void DoGetAlbumsL( CMPXMedia* aAlbumList, MVcxMyVideosMdsAlbumsObserver& aClient );
+
+ /**
+ * Gets album content IDs from MDS asynchronously.
+ * HandleGetAlbumContentIdsResp() callback function is called when ready.
+ *
+ * @param aAlbumId Album ID.
+ * @param aContentArray Array containing MDS IDs which belong to aAlbum.
+ * Caller is responsible to keep array available
+ * until HandleGetAlbumContentResp has been called.
+ * @param aClient Callback is done to this object.
+ */
+ void DoGetAlbumContentIdsL( TUint32 aAlbumId,
+ RArray<TVcxMyVideosAlbumVideo>& aContentArray,
+ MVcxMyVideosMdsAlbumsObserver& aClient );
+
+ /**
+ * Gets album content videos from MDS asynchronously.
+ * HandleGetAlbumContentVideosResp() callback function is called when ready.
+ *
+ * @param aAlbumId Album ID.
+ * @param aVideoList Media containing empty media array. Videos are added to array. Caller
+ * must keep aVideoList available until HandleGetAlbumContentVideosResp
+ * is called.
+ * @param aClient Callback is done to this object.
+ */
+ void DoGetAlbumContentVideosL( TUint32 aAlbumId, CMPXMedia& aVideoList,
+ MVcxMyVideosMdsAlbumsObserver& aClient );
+
+ /**
+ * Adds videos to album asynchronously. HandleAddVideosToAlbumResp() callback function
+ * is called when operation finishes.
+ *
+ * @param aMpxCmd Media containing command parameters: album ID and video ID list.
+ * Results are also written to this object. See media structure and
+ * used attributes from vcxmyvideosdef.c file,
+ * KVcxCommandMyVideosAddToAlbum command. Ownership does not move.
+ * @param aClient Response call is done to this object.
+ */
+ void DoAddVideosToAlbumL( CMPXMedia* aMpxCmd, MVcxMyVideosMdsAlbumsObserver& aClient );
+
+ /**
+ * Removes relations asynchronously.
+ *
+ * @param aRelationIds Relations which are removed.
+ * @param aResults In sync with aRelationIds. Result codes, KErrNone if successful,
+ * KErrGeneral if failed.
+ * @param aClient Response call is done to this object.
+ */
+ void DoRemoveRelationsL( RArray<TUint32>& aRelationIds,
+ RArray<TUint32>& aResults, MVcxMyVideosMdsAlbumsObserver& aClient );
+
+ /**
+ * Removes albums asynchronously.
+ *
+ * @param aMpxCmd Media containing command parameters: array with albums IDs.
+ * @param aClient Response call is done to this object.
+ */
+ void CVcxMyVideosMdsAlbums::DoRemoveAlbumsL( CMPXMedia* aMpxCmd,
+ MVcxMyVideosMdsAlbumsObserver& aClient );
+
+ /**
+ * Handles album query responses.
+ *
+ * @param aQuery Query instance.
+ * @param aError <code>KErrNone</code>, if the query was completed
+ * successfully. Otherwise one of the system-wide error
+ * codes.
+ */
+ void HandleAlbumQueryCompletedL(CMdEQuery& aQuery, TInt aError);
+
+ /**
+ * Handles video query responses.
+ *
+ * @param aQuery Query instance.
+ * @param aError <code>KErrNone</code>, if the query was completed
+ * successfully. Otherwise one of the system-wide error
+ * codes.
+ * @param aFirstNewItemIndex Index of the first new item in the query.
+ * @param aNewItemCount How many new items were added.
+ * @param aComplete ETrue if query is complete, EFalse if new to come.
+ */
+ void HandleVideoQueryResultsL( CMdEQuery& aQuery, TInt aError,
+ TInt aFirstNewItemIndex, TInt aNewItemCount, TBool aComplete );
+
+ /**
+ * Handles relation query responses.
+ *
+ * @param aQuery Query instance.
+ * @param aError <code>KErrNone</code>, if the query was completed
+ * successfully. Otherwise one of the system-wide error
+ * codes.
+ */
+ void HandleRelationQueryCompletedL( CMdEQuery& aQuery, TInt aError );
+
+ /**
+ * Called from RunL when video adding to album completes.
+ */
+ void HandleAddVideosToAlbumCompletedL();
+
+ /**
+ * Called from RunL when relations remove completes.
+ */
+ void HandleRemoveRelationsCompletedL();
+
+ /**
+ * Called from RunL when albums remove completes.
+ */
+ void HandleRemoveAlbumsCompletedL();
+
+ public:
+
+ /**
+ * From MMdEQueryObserver.
+ * Called to notify the observer that new results have been received
+ * in the query.
+ *
+ * @param aQuery Query instance that received new results.
+ * @param aFirstNewItemIndex Index of the first new item that was added
+ * to the result item array.
+ * @param aNewItemCount Number of items added to the result item
+ * array.
+ */
+ void HandleQueryNewResults(CMdEQuery& aQuery,
+ TInt aFirstNewItemIndex,
+ TInt aNewItemCount);
+
+ /**
+ * From MMdEQueryObserver.
+ * Called to notify the observer that the query has been completed,
+ * or that an error has occured.
+ *
+ * @param aQuery Query instance.
+ * @param aError <code>KErrNone</code>, if the query was completed
+ * successfully. Otherwise one of the system-wide error
+ * codes.
+ */
+ void HandleQueryCompleted(CMdEQuery& aQuery, TInt aError);
+
+ /**
+ * From MMdERelationItemObserver
+ */
+ void HandleRelationItemNotification(CMdESession& aSession,
+ TObserverNotificationType aType,
+ const RArray<TMdERelation>& aRelationArray);
+
+#if 0 //not used
+ /**
+ * From MMdERelationObserver
+ */
+ void HandleRelationNotification(CMdESession& aSession,
+ TObserverNotificationType aType,
+ const RArray<TItemId>& aRelationIdArray);
+#endif
+
+ private:
+
+ /**
+ * Main class for Mds operations. Owns session to MDS.
+ */
+ CVcxMyVideosMdsDb& iMdsDb;
+
+ /**
+ * Observer of albums related events. May be NULL.
+ * not own.
+ */
+ MVcxMyVideosMdsAlbumsObserver* iObserver;
+
+ /**
+ * Asynchronous album object fetching query is stored here. Own.
+ */
+ CMdEObjectQuery* iAlbumQuery;
+
+ /**
+ * Asynchronous video object fetching query is stored here. Own.
+ */
+ CMdEObjectQuery* iVideoQuery;
+
+ /**
+ * Asynchronous relation fetching query is stored here. Own.
+ */
+ CMdERelationQuery* iRelationQuery;
+
+ /**
+ * The default namespace definition, not own.
+ */
+ CMdENamespaceDef* iNamespaceDef;
+
+ /**
+ * Album object definition, not own.
+ */
+ CMdEObjectDef* iAlbumObjectDef;
+
+ /**
+ * Album type property definition, not own.
+ */
+ CMdEPropertyDef* iTypePropertyDef;
+
+ /**
+ * "Contains" relation definition, not own.
+ */
+ CMdERelationDef* iContainsRelationDef;
+
+ /**
+ * Pointer to album list which is being fetched from MDS. Not own.
+ */
+ CMPXMedia* iAlbumList;
+
+ /**
+ * Pointer to video list which is being fetched from MDS. Not own.
+ */
+ CMPXMedia* iVideoList;
+
+ /**
+ * When doing some async operation to MDS, the album ID is stored here.
+ */
+ TUint32 iAlbumId;
+
+ /**
+ * When fetching album content from MDS, the pointer to content array is stored here.
+ * Only MDS ID is filled to TVideo.
+ * Not own.
+ */
+ RArray<TVcxMyVideosAlbumVideo>* iAlbumContent;
+
+ /**
+ * The pending async operation ID is stored here.
+ */
+ TVcxAsyncOperation iAsyncOperation;
+
+ /**
+ * Used for storing items during async mds operations.
+ */
+ RPointerArray<CMdEInstanceItem> iItemArray;
+
+ /**
+ * Used for storing result buffer during async mds operations.
+ */
+ RMdEDataBuffer iResultBuffer;
+
+ /**
+ * Used in async operations to store
+ * pointer to result array (which is owned by the user).
+ */
+ RArray<TInt>* iResultArray;
+
+ /**
+ * Used in async operations to store
+ * pointer to result array (which is owned by the user).
+ */
+ RArray<TUint32>* iResultArrayUint32;
+
+ /**
+ * Used in async oprations (EVcxAddVideosToAlbum and EVcxRemoveVideosFromAlbum) to store
+ * pointer to item ID array (which is owned by the user).
+ */
+ RArray<TUint32>* iIdArray;
+
+ /**
+ * Used to store command parameters during async MDS operations. Not owned.
+ */
+ CMPXMedia* iMpxCmd;
+
+ /**
+ * Used to store pointer to client who initiated the async operation.
+ */
+ MVcxMyVideosMdsAlbumsObserver* iClient;
+
+ };
+
+#endif // VCXMYVIDEOSMDSALBUMS_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/mpxmyvideoscollection/inc/vcxmyvideosmdscmdqueue.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,330 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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: Queues commands to MDS.
+*/
+
+
+
+#ifndef VCXMYVIDEOSMDSCMDQUEUE_H
+#define VCXMYVIDEOSMDSCMDQUEUE_H
+
+// INCLUDES
+#include <vcxmyvideosdefs.h>
+#include "vcxmyvideosalbum.h"
+#include "vcxmyvideosmdsdb.h"
+
+// FORWARD DECLARATIONS
+class CMPXMedia;
+
+// CONSTANTS
+
+// CLASS DECLARATION
+
+/**
+* All MDS commands inherit this.
+*
+* @lib mpxmyvideoscollectionplugin.lib
+*/
+NONSHARABLE_CLASS(CVcxMyVideosMdsCmd) : public CBase
+ {
+ public:
+
+ /**
+ * Destructor
+ */
+ virtual ~CVcxMyVideosMdsCmd() {}
+
+ /**
+ * Command type. Used for casting the pointer to correct type.
+ */
+ CVcxMyVideosMdsDb::TRequestType iCmdType;
+
+ /**
+ * Pointer to client is stored here, used for performing response call.
+ */
+ MVcxMyVideosMdsAlbumsObserver* iClient;
+ };
+
+/**
+* Class which encapsulates GetVideoListL function parameters.
+*
+* @lib mpxmyvideoscollectionplugin.lib
+*/
+NONSHARABLE_CLASS(CVcxMyVideosMdsCmdGetVideoList) : public CVcxMyVideosMdsCmd
+ {
+ public:
+
+ /**
+ * Constructor
+ */
+ CVcxMyVideosMdsCmdGetVideoList() {}
+
+ /**
+ * Destructor
+ */
+ virtual ~CVcxMyVideosMdsCmdGetVideoList() {}
+
+ public:
+ /**
+ * Stored CreateVideoListL function parameters, see meanings from vcxmyvideosmdsdb.h file.
+ */
+ TVcxMyVideosSortingOrder iSortingOrder;
+ TBool iAscending;
+ TBool iFullDetails;
+ CMPXMedia** iVideoList;
+ };
+
+/**
+* Class which stores GetAlbumsL function arguments.
+*
+* @lib mpxmyvideoscollectionplugin.lib
+*/
+NONSHARABLE_CLASS(CVcxMyVideosMdsCmdGetAlbums) : public CVcxMyVideosMdsCmd
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Constructor
+ */
+ CVcxMyVideosMdsCmdGetAlbums() {}
+
+ /**
+ * Destructor
+ */
+ virtual ~CVcxMyVideosMdsCmdGetAlbums() {}
+
+ public:
+ /**
+ * Stored GetAlbumsL function parameters, see meanings from vcxmyvideosmdsalbums.h file.
+ */
+ CMPXMedia* iAlbumList;
+ };
+
+/**
+* Class which stores GetAlbumContentIdsL function arguments.
+*
+* @lib mpxmyvideoscollectionplugin.lib
+*/
+NONSHARABLE_CLASS(CVcxMyVideosMdsCmdGetAlbumContentIds) : public CVcxMyVideosMdsCmd
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Constructor
+ */
+ CVcxMyVideosMdsCmdGetAlbumContentIds() {}
+
+ /**
+ * Destructor
+ */
+ virtual ~CVcxMyVideosMdsCmdGetAlbumContentIds() {}
+
+ public:
+ /**
+ * Stored GetAlbumContentL function parameters, see meanings from vcxmyvideosmdsalbums.h file.
+ */
+ TUint32 iAlbumId;
+ RArray<TVcxMyVideosAlbumVideo>* iAlbumContent; //not own
+ };
+
+/**
+* Class which stores GetAlbumContentVideosL function arguments.
+*
+* @lib mpxmyvideoscollectionplugin.lib
+*/
+NONSHARABLE_CLASS(CVcxMyVideosMdsCmdGetAlbumContentVideos) : public CVcxMyVideosMdsCmd
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Constructor
+ */
+ CVcxMyVideosMdsCmdGetAlbumContentVideos() {}
+
+ /**
+ * Destructor
+ */
+ virtual ~CVcxMyVideosMdsCmdGetAlbumContentVideos() {}
+
+ public:
+ /**
+ * Stored GetAlbumContentL function parameters, see meanings from vcxmyvideosmdsalbums.h file.
+ */
+ TUint32 iAlbumId;
+ CMPXMedia* iAlbumContentVideos; //not own
+ };
+
+/**
+* Class which stores AddVideosToAlbumL function arguments.
+*
+* @lib mpxmyvideoscollectionplugin.lib
+*/
+NONSHARABLE_CLASS(CVcxMyVideosMdsCmdAddVideosToAlbum) : public CVcxMyVideosMdsCmd
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Constructor
+ */
+ CVcxMyVideosMdsCmdAddVideosToAlbum() {}
+
+ /**
+ * Destructor
+ */
+ virtual ~CVcxMyVideosMdsCmdAddVideosToAlbum() {}
+
+ public:
+ /**
+ * Stored AddVideosToAlbumL function parameters, see meanings from vcxmyvideosdefs.h
+ * KVcxCommandMyVideosAddToAlbum command descriptions.
+ */
+ CMPXMedia* iMpxCmd;
+ };
+
+/**
+* Class which stores RemoveRelationsL function arguments.
+*
+* @lib mpxmyvideoscollectionplugin.lib
+*/
+NONSHARABLE_CLASS(CVcxMyVideosMdsCmdRemoveRelations) : public CVcxMyVideosMdsCmd
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Constructor
+ */
+ CVcxMyVideosMdsCmdRemoveRelations() {}
+
+ /**
+ * Destructor
+ */
+ virtual ~CVcxMyVideosMdsCmdRemoveRelations() {}
+
+ public:
+ /**
+ * Stored RemoveRelationsL function parameters, see meanings from vcxmyvideosmdsalbums.h file.
+ */
+ RArray<TUint32>* iRelationIds; //not own
+ RArray<TUint32>* iResults; //not own
+ };
+
+/**
+* Class which stores RemoveAlbumsL function arguments.
+*
+* @lib mpxmyvideoscollectionplugin.lib
+*/
+NONSHARABLE_CLASS(CVcxMyVideosMdsCmdRemoveAlbums) : public CVcxMyVideosMdsCmd
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Constructor
+ */
+ CVcxMyVideosMdsCmdRemoveAlbums() {}
+
+ /**
+ * Destructor
+ */
+ virtual ~CVcxMyVideosMdsCmdRemoveAlbums() {}
+
+ public:
+ /**
+ * Stored RemoveAlbumsL function parameters, see meanings from vcxmyvideosmdsalbums.h file.
+ */
+ CMPXMedia* iMpxCmd; //not own
+ };
+
+/**
+* Queues MDS commands.
+*
+* @lib mpxmyvideoscollectionplugin.lib
+*/
+NONSHARABLE_CLASS(CVcxMyVideosMdsCmdQueue) : public CBase
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor
+ * @return object constructed
+ */
+ static CVcxMyVideosMdsCmdQueue* NewL( CVcxMyVideosMdsDb& aMdsDb );
+
+ /**
+ * Destructor
+ */
+ virtual ~CVcxMyVideosMdsCmdQueue();
+
+ public: // new methods
+
+ /**
+ * Executes command if queue is empty, otherwise adds it to queue.
+ * Ownership of aCmd moves to this object.
+ *
+ * @param aCmd Command to execute.
+ */
+ void ExecuteCmdL( CVcxMyVideosMdsCmd* aCmd );
+
+ /**
+ * Called when command finishes. Executes next command from the queue.
+ */
+ void CmdFinished();
+
+ /**
+ * Removes commands from command queue.
+ *
+ * @param aType Defines what kind of commands are removed from the command queue.
+ */
+ void Cancel( CVcxMyVideosMdsDb::TRequestType aType = CVcxMyVideosMdsDb::EAll );
+
+ private:
+
+ /**
+ * Constructor
+ */
+ CVcxMyVideosMdsCmdQueue( CVcxMyVideosMdsDb& aMdsDb );
+
+ /**
+ * Symbian 2nd phase constructor.
+ */
+ void ConstructL();
+
+ /**
+ * Executes the command.
+ *
+ * @param aCmd Command to execute, ownership does not move.
+ */
+ void DoExecuteCmdL( CVcxMyVideosMdsCmd* aCmd );
+
+ private:
+
+ /**
+ * Owner of this object.
+ */
+ CVcxMyVideosMdsDb& iMdsDb;
+
+ /**
+ * Command queue. Own.
+ */
+ RArray<CVcxMyVideosMdsCmd*> iQueue;
+
+ /**
+ * Set to ETrue when command is started and to EFalse
+ * when command finishes.
+ */
+ TBool iCmdInProgress;
+ };
+
+#endif // VCXMYVIDEOSMDSCMDQUEUE_H
+
+
--- a/videocollection/mpxmyvideoscollection/inc/vcxmyvideosmdsdb.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/inc/vcxmyvideosmdsdb.h Thu Apr 01 23:22:15 2010 +0300
@@ -11,12 +11,11 @@
*
* Contributors:
*
-* Description: MPX My Videos collection plugins' MDS database class*
+* Description: MPX My Videos collection plugins' MDS database class*
*/
-
#ifndef VCXMYVIDEOSMDSDB_H
#define VCXMYVIDEOSMDSDB_H
@@ -25,14 +24,19 @@
#include <mdequery.h>
#include <harvesterclient.h>
#include <mpxcollectionmessagedefs.h>
+#include <vcxmyvideosdefs.h>
+#include "vcxmyvideosalbum.h"
+
+class CVcxMyVideosMdsAlbums;
+class CMPXMedia;
+class CVcxMyVideosMdsCmdQueue;
/**
* MPX My Videos collection MDS database observer class.
* Part of ECOM Plugin.
*/
NONSHARABLE_CLASS(MVcxMyVideosMdsDbObserver)
- {
-
+ {
public:
/*
@@ -56,7 +60,7 @@
virtual void HandleMyVideosDbEvent( TMPXChangeEventType aEvent, RArray<TUint32>& aId ) = 0;
/**
- * Handler function for list fetching events. This callback is called as a response
+ * Handler function for video list fetching events. This callback is called as a response
* to CreateVideoList( aSync = EFalse ).
*
* @param aVideoList List of videos fetched from MDS.
@@ -77,7 +81,86 @@
/**
- * MPX My Videos collection ECOM plugins' MDS database class.
+ * MPX My Videos collection MDS albums related functionality observer class.
+ * Part of ECOM Plugin.
+ */
+NONSHARABLE_CLASS(MVcxMyVideosMdsAlbumsObserver)
+ {
+ public:
+
+ /**
+ * This callback is called as a response to GetAlbumsL.
+ *
+ * @param aAlbumList List of albums fetched from MDS.
+ */
+ virtual void HandleGetAlbumsResp( CMPXMedia* aAlbumList ) = 0;
+
+ /**
+ * This callback is called as a response to GetAlbumContentIdsL.
+ *
+ * @param aAlbumId Album ID which was fetched.
+ * @param aContentArray Array containing MDS object IDs. This array is the same which
+ * was given in GetAlbumContentIdsL call.
+ */
+ virtual void HandleGetAlbumContentIdsResp( TUint32 aAlbumId,
+ RArray<TVcxMyVideosAlbumVideo>& aContentArray ) = 0;
+
+ /**
+ * Called as a response to GetAlbumContentVideosL.
+ *
+ * @param aAlbumId ID of the album containing the result videos.
+ * @param aVideoList Media containing array of videos.
+ * @param aError Error code in case of failure.
+ * @param aFirstNewItemIndex Index of the first new item.
+ * @param aNewItemCount How many new items in the query since the last results.
+ * @param aComplete ETrue if query is complete, EFalse if there is more to come.
+ */
+ virtual void HandleGetAlbumContentVideosResp( TUint32 aAlbumId, CMPXMedia& aVideoList,
+ TInt aError, TInt aFirstNewItemIndex, TInt aNewItemCount, TBool aComplete ) = 0;
+
+ /**
+ * Called as a response to AddVideosToAlbumL. Results are written from aItemArray
+ * to aCmd (KVcxMediaMyVideosInt32Value attribute). KErrNone if operation was successful,
+ * KErrGeneral otherwise.
+ *
+ * @param aCmd Pointer to same object which was given in AddVideosToAlbumL function call.
+ * @param aItemArray Array of relation items that were added to MDS.
+ */
+ virtual void HandleAddVideosToAlbumResp( CMPXMedia* aCmd,
+ RPointerArray<CMdEInstanceItem>& aItemArray ) = 0;
+
+ /**
+ * Called as a response to RemoveRelationsL.
+ *
+ * @param aRelationIds Relations which were tried to be removed.
+ * @param aResults Result codes, in sync with aRelationIds. KErrNone if successful,
+ * KErrGeneral if failed.
+ */
+ virtual void HandleRemoveRelationsResp( RArray<TUint32>& aRelationIds,
+ RArray<TUint32>& aResults ) = 0;
+
+ /**
+ * Called as a response to RemoveAlbumsL.
+ *
+ * @param aCmd Cmd which was given in RemoveAlbumsL call.
+ * @param aResults Result IDs.
+ */
+ virtual void HandleRemoveAlbumsResp( CMPXMedia* aCmd,
+ RArray<TUint32>& aResultIds ) = 0;
+
+ /**
+ * Event handler function for relation delete events.
+ *
+ * @param aType Event type
+ * @param aRelationArray Array containing relations.
+ */
+ virtual void HandleRelationEvent( TObserverNotificationType aType,
+ const RArray<TMdERelation>& aRelationArray ) = 0;
+
+ };
+
+/**
+ * MPX My Videos collection ECOM plugin's MDS database class.
*/
NONSHARABLE_CLASS(CVcxMyVideosMdsDb) :
public CBase,
@@ -89,17 +172,34 @@
public:
+ friend class CVcxMyVideosMdsAlbums;
+ friend class CVcxMyVideosMdsCmdQueue;
+
+ enum TRequestType
+ {
+ EAll,
+ EGetVideoList,
+ EGetAlbums,
+ EGetAlbumContentIds,
+ EGetAlbumContentVideos,
+ EAddVideosToAlbum,
+ ERemoveRelations,
+ ERemoveAlbums
+ };
+
/**
* Two-phased constructor.
* @param aObserver The db change observer.
*/
- static CVcxMyVideosMdsDb* NewL( MVcxMyVideosMdsDbObserver* aObserver, RFs& aFs );
+ static CVcxMyVideosMdsDb* NewL( MVcxMyVideosMdsDbObserver* aObserver,
+ MVcxMyVideosMdsAlbumsObserver* aAlbumsObserver, RFs& aFs );
/**
* Two-phased constructor.
* @param aObserver The db change observer.
*/
- static CVcxMyVideosMdsDb* NewLC( MVcxMyVideosMdsDbObserver* aObserver, RFs& aFs );
+ static CVcxMyVideosMdsDb* NewLC( MVcxMyVideosMdsDbObserver* aObserver,
+ MVcxMyVideosMdsAlbumsObserver* aAlbumsObserver, RFs& aFs );
/**
@@ -108,9 +208,30 @@
virtual ~CVcxMyVideosMdsDb();
/**
- * Cancels possible ongoing asynchronous operation.
+ * Cancels possible ongoing asynchronous operations.
+ *
+ * @param aType What kind of requests are cancelled.
*/
- void Cancel();
+ void Cancel( TRequestType aType = EAll );
+
+ /**
+ * Creates list of videos from MDS. This function utilizes CVcxMyVideosMdsQueue, ie
+ * commands are put in queue if there are other commands pending.
+ *
+ * @param aSortingOrder Sorting order, see values from TSortingOrder.
+ * @param aAscending Sort direction, if ETrue then ascending, else descending.
+ * @param aFullDetails If ETrue, then all details will be filled to media objects,
+ * if EFalse, then only subset.
+ * @param aVideoList Reference to pointer variable. Container type CMPXMedia class, contains
+ * CMPXMediaArray filled with CMPXMedia objects. If aVideoList
+ * pointer variable is NULL, then new medialist is created.
+ * If pointer variable already contains value, then the given medialist
+ * should have empty media array. New items are appended to it.
+ * Caller naturally owns the data.
+ *
+ */
+ void CreateVideoListL( TVcxMyVideosSortingOrder aSortingOrder,
+ TBool aAscending, TBool aFullDetails, CMPXMedia*& aVideoList );
/**
* Add new video.
@@ -137,24 +258,6 @@
void UpdateVideoL( CMPXMedia& aVideo );
/**
- * Create list of videos from MDS.
- *
- * @param aSortingOrder Sorting order, see values from TSortingOrder.
- * @param aAscending Sort direction, if ETrue then ascending, else descending.
- * @param aFullDetails If ETrue, then all details will be filled to media objects,
- * if EFalse, then only subset.
- * @param aVideoList Reference to pointer variable. Container type CMPXMedia class, contains
- * CMPXMediaArray filled with CMPXMedia objects. If aVideoList
- * pointer variable is NULL, then new medialist is created.
- * If pointer variable already contains value, then the given medialist
- * should have empty media array. New items are appended to it.
- * Caller naturally owns the data.
- *
- */
- void CreateVideoListL( TVcxMyVideosSortingOrder aSortingOrder,
- TBool aAscending, TBool aFullDetails, CMPXMedia*& aVideoList );
-
- /**
* Get one video item from MDS and create a new media
* object from it.
*
@@ -235,7 +338,8 @@
* @param aObserver The db change observer.
* @param aFs Session to file server.
*/
- CVcxMyVideosMdsDb( MVcxMyVideosMdsDbObserver* aObserver, RFs& aFs );
+ CVcxMyVideosMdsDb( MVcxMyVideosMdsDbObserver* aObserver,
+ MVcxMyVideosMdsAlbumsObserver* aAlbumsObserver, RFs& aFs );
void ConstructL();
@@ -298,6 +402,37 @@
void DoHandleQueryNewResultsL(CMdEQuery& aQuery,
TInt aFirstNewItemIndex, TInt aNewItemCount);
+ /**
+ * Creates list of videos from MDS.
+ *
+ * @param aSortingOrder Sorting order, see values from TSortingOrder.
+ * @param aAscending Sort direction, if ETrue then ascending, else descending.
+ * @param aFullDetails If ETrue, then all details will be filled to media objects,
+ * if EFalse, then only subset.
+ * @param aVideoList Reference to pointer variable. Container type CMPXMedia class, contains
+ * CMPXMediaArray filled with CMPXMedia objects. If aVideoList
+ * pointer variable is NULL, then new medialist is created.
+ * If pointer variable already contains value, then the given medialist
+ * should have empty media array. New items are appended to it.
+ * Caller naturally owns the data.
+ *
+ */
+ void DoCreateVideoListL( TVcxMyVideosSortingOrder aSortingOrder,
+ TBool aAscending, TBool aFullDetails, CMPXMedia*& aVideoList );
+
+ /**
+ * Handles query complete events asynchronously.
+ */
+ static TInt AsyncHandleQueryCompleted( TAny* aPtr );
+
+ /**
+ * Sets Creation Date and Modified properties to object. Uses current date
+ * value.
+ *
+ * @param aObject Object to modify.
+ */
+ void SetCreationAndModifiedDatesL( CMdEObject& aObject );
+
public:
/**
@@ -306,17 +441,27 @@
*/
TBool iVideoListFetchingIsOngoing;
+ /**
+ * Album related functionality.
+ */
+ CVcxMyVideosMdsAlbums* iAlbums;
+
private: // data
/**
+ * Command queue. Own.
+ */
+ CVcxMyVideosMdsCmdQueue* iCmdQueue;
+
+ /**
* The MDS session object. Own.
*/
- CMdESession* iMDSSession;
+ CMdESession* iMdsSession;
/**
* The error code saved from the callbacks.
*/
- TInt iMDSError;
+ TInt iMdsError;
/**
* Asynchronous video list fetching query is stored here.
@@ -335,8 +480,8 @@
TBool iFullDetails;
/**
- * The default namespace definition. Not own.
- */
+ * The default namespace definition. Not own.
+ */
CMdENamespaceDef* iNamespaceDef;
/**
@@ -435,12 +580,14 @@
*/
CMdEPropertyDef* iLastPlayPositionPropertyDef;
+#if 0
/**
* 17.
* The Download ID property definition. Not own.
*/
CMdEPropertyDef* iDownloadIdPropertyDef;
-
+#endif
+
/**
* 18.
* Rating property definition, not own.
@@ -495,6 +642,18 @@
* The observer for db changes. Not own.
*/
MVcxMyVideosMdsDbObserver* iMdsDbObserver;
+
+ /**
+ * The observer for albums related database events. Not own.
+ */
+ MVcxMyVideosMdsAlbumsObserver* iAlbumsObserver;
+
+ /**
+ * Used to handle complete events asynchronously.
+ * This avoids problems like deleting query objects in the
+ * handler or starting new query from the handler.
+ */
+ CAsyncCallBack* iAsyncHandleQueryCompleteCaller;
};
#endif // VCXMYVIDEOSMDSDB_H
--- a/videocollection/mpxmyvideoscollection/inc/vcxmyvideosopenhandler.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/inc/vcxmyvideosopenhandler.h Thu Apr 01 23:22:15 2010 +0300
@@ -11,11 +11,11 @@
*
* Contributors:
*
-* Description: Handles collection Open operation related functionality*
+* Description: Handles collection Open operation related functionality
+*
*/
-
#ifndef VCXMYVIDEOSOPENHANDLER_H
#define VCXMYVIDEOSOPENHANDLER_H
@@ -23,13 +23,24 @@
class MMPXCollectionPluginObserver;
class CVcxMyVideosMdsDb;
+#include "vcxmyvideosmdsdb.h"
+
+enum TVcxItemType
+ {
+ EVcxItemTypeNone,
+ EVcxItemTypeVideo,
+ EVcxItemTypeCategory,
+ EVcxItemTypeAlbum
+ };
+
/**
*/
-NONSHARABLE_CLASS( CVcxMyVideosOpenHandler ) : public CBase
+NONSHARABLE_CLASS( CVcxMyVideosOpenHandler ) : public CBase, public MVcxMyVideosMdsAlbumsObserver
{
friend class CVcxMyVideosVideoCache;
public:
+
/**
* Two-phased constructor
*/
@@ -52,18 +63,62 @@
void OpenL( const CMPXCollectionPath& aPath );
/**
- * Leaving version of HandleCreateVideoListResp.
- * Handler function for list fetching events. This callback is called as a response
- * to iCache.CreateVideoListL().
- *
- * @param aVideoList List of videos fetched from MDS.
- * @param aNewItemsStartIndex Start position for the new items added.
- * @param aComplete ETrue if list is complete and no more items are expected,
- * EFalse if there are more to come.
- */
+ * From MVcxMyVideosMdsAlbumsObserver.
+ */
+ void HandleAlbumOpenL();
+
+ /**
+ * From MVcxMyVideosMdsAlbumsObserver, no implementation.
+ */
+ void HandleGetAlbumsResp( CMPXMedia* /*aAlbumList*/ ) {}
+
+ /**
+ * From MVcxMyVideosMdsAlbumsObserver, no implementation.
+ */
+ void HandleGetAlbumContentIdsResp( TUint32 /*aAlbumId*/,
+ RArray<TVcxMyVideosAlbumVideo>& /*aContentArray*/ ) {}
+
+ /**
+ * From MVcxMyVideosMdsAlbumsObserver, no implementation.
+ */
+ void HandleAddVideosToAlbumResp( CMPXMedia* /*aCmd*/,
+ RPointerArray<CMdEInstanceItem>& /*aItemArray*/ ) {}
+
+ /**
+ * From MVcxMyVideosMdsAlbumsObserver, no implementation.
+ */
+ void HandleRemoveRelationsResp( RArray<TUint32>& /*aRelationIds*/,
+ RArray<TUint32>& /*aResults*/ ) {}
+
+ /**
+ * From MVcxMyVideosMdsAlbumsObserver, no implementation.
+ */
+ void HandleRemoveAlbumsResp( CMPXMedia* /*aCmd*/,
+ RArray<TUint32>& /*aResultIds*/ ) {}
+
+ /**
+ * From MVcxMyVideosMdsAlbumsObserver, no implementation.
+ */
+ void HandleRelationEvent( TObserverNotificationType /*aType*/,
+ const RArray<TMdERelation>& /*aRelationArray*/ ) {}
+
+ /**
+ * Called as a response to GetAlbumContentVideosL.
+ *
+ * @param aAlbumId ID of the album containing the result videos.
+ * @param aVideoList Media containing array of videos.
+ * @param aError Error code in case of failure.
+ * @param aFirstNewItemIndex Index of the first new item.
+ * @param aNewItemCount How many new items in the query since the last results.
+ * @param aComplete ETrue if query is complete, EFalse if there is more to come.
+ */
+ void HandleGetAlbumContentVideosResp( TUint32 aAlbumId, CMPXMedia& aVideoList,
+ TInt aError, TInt aFirstNewItemIndex, TInt aNewItemCount, TBool aComplete );
+
+
void DoHandleCreateVideoListRespL(
CMPXMedia* aVideoList, TInt aNewItemsStartIndex, TBool aComplete );
-
+
private:
/**
* 2nd-phase Constructor
@@ -77,6 +132,35 @@
CVcxMyVideosVideoCache& aCache,
CVcxMyVideosMdsDb& aMds );
+ /**
+ * Opens category.
+ *
+ * @param aCategoryId Category to open.
+ */
+ void OpenCategoryL( TUint32 aCategoryId );
+
+ /**
+ * Leaving version of HandleGetAlbumContentVideosResp.
+ */
+ void HandleGetAlbumContentVideosRespL(
+ TUint32 aAlbumId, CMPXMedia& /*aVideoList*/, TInt aError,
+ TInt /*aFirstNewItemIndex*/, TInt /*aNewItemCount*/, TBool aComplete );
+public:
+
+ /**
+ * If album is opened when the album list is not yet complete,
+ * then the album ID which is tried to open is stored here.
+ * The open processing is continued when album list is received
+ * from MDS. There can't be several album opens pending since
+ * we do not call HandleOpen before we get the album list.
+ */
+ TUint32 iPendingAlbumOpenId;
+
+ /**
+ * for testing, temp
+ */
+ CMPXMedia* iAlbumVideoList;
+
private: // data
/**
@@ -108,6 +192,26 @@
* This is in sync with iCategoryIdsBeingOpened.
*/
RArray<CMPXMedia*> iVideoListsBeingOpened;
+
+ /**
+ * The album IDs being opened are stored here. These values are used
+ * to filter list when items arrive from MDS.
+ * This is in sync with iAlbumVideoListsBeingOpened.
+ */
+ RArray<TInt> iAlbumIdsBeingOpened;
+
+ /**
+ * Video lists for albums being opened are stored here.
+ * This is in sync with iAlbumIdsBeingOpened.
+ */
+ RArray<CMPXMedia*> iAlbumVideoListsBeingOpened;
+
+ /**
+ * Path being opened is stored here for the HandleOpenL call.
+ * Not Own.
+ */
+ const CMPXCollectionPath* iPath;
+
};
#endif // VCXMYVIDEOSACTIVETASK_H
--- a/videocollection/mpxmyvideoscollection/inc/vcxmyvideostimer.h Thu Apr 01 23:13:36 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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: Timer*
-*/
-
-
-
-
-#ifndef __CVCXMYVIDEOSTIMER_H__
-#define __CVCXMYVIDEOSTIMER_H__
-
-// INCLUDES
-#include <e32base.h>
-
-// FORWARD DECLARATIONS
-class CVcxMyVideosTimer;
-
-// CLASS DECLARATION
-/**
-* This class specifies the function to be called when a timeout occurs.
-* Used in conjunction with CVcxTimer class.
-*/
-class MVcxMyVideosTimerObserver
- {
- public: // New functions
-
- /**
- * The function to be called when a timeout occurs.
- *
- * @param aTimer Pointer to timer which expired.
- */
- virtual void TimerExpired(CVcxMyVideosTimer* aTimer) = 0;
- };
-
-// CLASS DECLARATION
-/**
-* This class will notify an object after a specified timeout.
-*/
-NONSHARABLE_CLASS(CVcxMyVideosTimer) : public CTimer
- {
- public: // Constructors and destructors
-
- /**
- * Two-phased constructor.
- * Creates a CVcxMyVideosTimer object using two phase construction,
- * and returns a pointer to the created object.
- *
- * @param aPriority Priority to use for this timer.
- * @param aTimerObserver Object to notify of timeout event.
- * @return A pointer to the created instance of CVcxMyVideosTimer.
- */
- static CVcxMyVideosTimer* NewL( const TInt aPriority,
- MVcxMyVideosTimerObserver& aTimerObserver );
-
- /**
- * Two-phased constructor.
- * Creates a CVcxMyVideosTimer object using two phase construction,
- * and returns a pointer to the created object.
- *
- * @param aPriority Priority to use for this timer.
- * @param aTimerObserver Object to notify of timeout event.
- * @return A pointer to the created instance of CVcxMyVideosTimer.
- */
- static CVcxMyVideosTimer* NewLC( const TInt aPriority,
- MVcxMyVideosTimerObserver& aTimerObserver );
-
- /**
- * Destructor.
- * Destroys the object and releases all memory objects.
- */
- virtual ~CVcxMyVideosTimer();
-
- protected: // Functions from base classes
-
- /**
- * From CActive, RunL.
- * Called when operation completes.
- */
- void RunL();
-
- private: // Constructors and destructors
-
- /**
- * C++ default constructor.
- * Performs the first phase of two phase construction.
- *
- * @param aPriority Priority to use for this timer.
- * @param aTimeOutNotify An observer to notify.
- */
- CVcxMyVideosTimer( const TInt aPriority,
- MVcxMyVideosTimerObserver& aTimerObserver );
-
- /**
- * ConstructL.
- * 2nd phase constructor.
- */
- void ConstructL();
-
- private: // Data
-
- /**
- * The observer for this objects events.
- */
- MVcxMyVideosTimerObserver& iObserver;
- };
-
-#endif // __CVCXMYVIDEOSTIMER_H__
-
-// End of File
\ No newline at end of file
--- a/videocollection/mpxmyvideoscollection/inc/vcxmyvideosvideocache.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/inc/vcxmyvideosvideocache.h Thu Apr 01 23:22:15 2010 +0300
@@ -25,8 +25,6 @@
// FORWARD DECLARATIONS
class CVcxMyVideosCollectionPlugin;
class CMPXMedia;
-class CVcxMyVideosDownloadCache;
-class CRepository;
// CONSTANTS
@@ -224,16 +222,6 @@
CMPXMedia* FindVideoByMdsIdL( TUint32 aMdsId, TInt& aPos );
/**
- * Tries to find media with matching download ID from iVideoList and iPartialVideoList.
- * If aDownloadId is 0, then NULL is returned.
- *
- * @param aDownloadId ID to compare
- * @return Contains pointer to media if match found, NULL otherwise.
- * Pointer ownership is not moved to the caller.
- */
- CMPXMedia* FindVideoByDownloadIdL( TUint aDownloadId );
-
- /**
* Gets medias from iVideoList and iPartialVideoList.
*
* @param aMdsIds IDs of the items to fetch.
@@ -267,16 +255,19 @@
* @param aMdsIds Array containing MDS IDs of the videos to be added.
* @param aListFetchingWasCanceled This is set to EFalse if video list fetching from mds
* had to be cancelled. EFalse otherwise.
+ * @param aNonVideoIds If argument given then Ids which were detected to not be
+ * videos are written here. Caller owns the array, ownership
+ * does not move.
*/
- void AddVideosFromMdsL( RArray<TUint32>& aMdsIds, TBool& aListFetchingWasCanceled );
+ void AddVideosFromMdsL( RArray<TUint32>& aMdsIds, TBool& aListFetchingWasCanceled,
+ RArray<TUint32>* aNonVideoIds = NULL );
/**
* Deletes old and creates new iVideoList. After the function call iVideoList exists,
* but it might not contain any media items yet, only empty array.
* Media items are added to the list asynchronoysly in
* VcxMyVideosColletionPlugin::HandleCreateVideoListResp(), called by
- * VcxMyVideosMdsDb. When new items are added, they are synchronized with
- * Download Manager. Once iVideoList is complete, iVideoListIsPartial
+ * VcxMyVideosMdsDb. Once iVideoList is complete, iVideoListIsPartial
* is set to EFalse. During the video list fetching
* VcxMyVideosMdsDb::iVideoListFetchingIsOngoing is ETrue.
* If there is video list creation already ongoing
@@ -354,23 +345,9 @@
private:
/**
- * Circular buffer containing download id and media object pointer pairs.
- * Media object pointers are owned by iVideoList.
- * Used to speed up access to media objects which are used regularly during the
- * download.
- */
- CVcxMyVideosDownloadCache* iDownloadCache;
-
- /**
* My Videos collection plugin, owner of this object.
*/
CVcxMyVideosCollectionPlugin& iCollection;
-
- /**
- * Provides access to the sorting order key in cenrep. Own.
- */
- CRepository* iCenRep;
-
};
#endif // VCXMYVIDEOSVIDEOCACHE_H
--- a/videocollection/mpxmyvideoscollection/src/vcxmyvideosactivetask.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideosactivetask.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -112,27 +112,62 @@
}
// ---------------------------------------------------------------------------
+// Get the current media
+// ---------------------------------------------------------------------------
+//
+CMPXMedia* CVcxMyVideosActiveTask::Command()
+ {
+ return iCurCommand;
+ }
+
+// ---------------------------------------------------------------------------
// From CActive
// ---------------------------------------------------------------------------
//
void CVcxMyVideosActiveTask::RunL()
{
- // ETrue is done, EFalse is more to do
- //
- if( iObserver.HandleStepL() )
+ switch ( iObserver.HandleStepL() )
{
- iObserver.HandleOperationCompleted( KErrNone );
- delete iCurCommand;
- iCurCommand = NULL;
+ case MVcxMyVideosActiveTaskObserver::EDone:
+ Done();
+ break;
+
+ case MVcxMyVideosActiveTaskObserver::EMoreToCome:
+ ContinueStepping();
+ break;
+
+ //observer is responsible for calling Done or ContinueStepping
+ case MVcxMyVideosActiveTaskObserver::EStopStepping:
+ break;
}
- else
- {
- ++iCurStep;
- iStatus = KRequestPending;
- SetActive();
- TRequestStatus* status = &iStatus;
- User::RequestComplete( status, KErrNone );
- }
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosActiveTask::Done
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosActiveTask::Done()
+ {
+ MPX_DEBUG1("CVcxMyVideosActiveTask::Done() start");
+
+ iObserver.HandleOperationCompleted( KErrNone );
+ delete iCurCommand;
+ iCurCommand = NULL;
+
+ MPX_DEBUG1("CVcxMyVideosActiveTask::Done() exit");
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosActiveTask::ContinueStepping
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosActiveTask::ContinueStepping()
+ {
+ ++iCurStep;
+ iStatus = KRequestPending;
+ SetActive();
+ TRequestStatus* status = &iStatus;
+ User::RequestComplete( status, KErrNone );
}
// ---------------------------------------------------------------------------
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideosalbum.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,298 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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: Class representing album in My Videos collection.
+*/
+
+#include <mpxlog.h>
+#include <mpxmedia.h>
+#include <mpxmediaarray.h>
+#include <mpxmediacontainerdefs.h>
+#include "vcxmyvideosalbum.h"
+#include "vcxmyvideoscollectionplugin.h"
+#include "vcxmyvideosvideocache.h"
+#include "vcxmyvideoscollectionutil.h"
+
+
+// ---------------------------------------------------------------------------
+// TVcxMyVideosAlbumVideo::TVcxMyVideosAlbumVideo
+// ---------------------------------------------------------------------------
+//
+TVcxMyVideosAlbumVideo::TVcxMyVideosAlbumVideo()
+ {
+ Set( 0, 0, 0 );
+ }
+
+// ---------------------------------------------------------------------------
+// TVcxMyVideosAlbumVideo::operator=
+// ---------------------------------------------------------------------------
+//
+TVcxMyVideosAlbumVideo& TVcxMyVideosAlbumVideo::operator=( const TVcxMyVideosAlbumVideo& aVideo )
+ {
+ Set( aVideo.iMdsId, aVideo.iRelationMdsId, aVideo.iMedia );
+ return *this;
+ }
+
+// ---------------------------------------------------------------------------
+// TVcxMyVideosAlbumVideo::Set
+// ---------------------------------------------------------------------------
+//
+void TVcxMyVideosAlbumVideo::Set( TUint32 aMdsId, TUint32 aRelationMdsId, CMPXMedia* aVideo )
+ {
+ iMdsId = aMdsId;
+ iRelationMdsId = aRelationMdsId;
+ iMedia = aVideo;
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosAlbum::CVcxMyVideosAlbum
+// ---------------------------------------------------------------------------
+//
+CVcxMyVideosAlbum::CVcxMyVideosAlbum( CVcxMyVideosCollectionPlugin& aCollectionPlugin )
+: iCollection( aCollectionPlugin )
+ {
+ // No implementation required
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosAlbum::~CVcxMyVideosAlbum
+// ---------------------------------------------------------------------------
+//
+CVcxMyVideosAlbum::~CVcxMyVideosAlbum()
+ {
+ iVideoList.Close();
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosAlbum::NewLC
+// ---------------------------------------------------------------------------
+//
+CVcxMyVideosAlbum* CVcxMyVideosAlbum::NewLC( CVcxMyVideosCollectionPlugin& aCollectionPlugin )
+ {
+ CVcxMyVideosAlbum* self = new (ELeave) CVcxMyVideosAlbum( aCollectionPlugin );
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosAlbum::NewL
+// ---------------------------------------------------------------------------
+//
+CVcxMyVideosAlbum* CVcxMyVideosAlbum::NewL( CVcxMyVideosCollectionPlugin& aCollectionPlugin )
+ {
+ CVcxMyVideosAlbum* self = CVcxMyVideosAlbum::NewLC( aCollectionPlugin );
+ CleanupStack::Pop(); // self;
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosAlbum::ConstructL
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosAlbum::ConstructL()
+ {
+ iVideoList.Reset();
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosAlbum::Sort
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosAlbum::Sort()
+ {
+ const TLinearOrder<TVcxMyVideosAlbumVideo> KOrderByMdsId(
+ CVcxMyVideosAlbum::CompareVideosByMdsId );
+
+ iVideoList.Sort( KOrderByMdsId );
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosAlbum::SetL
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosAlbum::SetL( /*CMPXMedia& aAlbum*/ )
+ {
+ //TODO:
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosAlbum::BelongsToAlbum
+// ---------------------------------------------------------------------------
+//
+TBool CVcxMyVideosAlbum::BelongsToAlbum( TUint32 aMdsId )
+ {
+ const TLinearOrder<TVcxMyVideosAlbumVideo> KOrderByMdsId(
+ CVcxMyVideosAlbum::CompareVideosByMdsId );
+
+ TInt index;
+ TVcxMyVideosAlbumVideo video;
+ video.iMdsId = aMdsId;
+ TInt err = iVideoList.FindInOrder( video, index, KOrderByMdsId );
+
+ if ( err != KErrNone )
+ {
+ return EFalse;
+ }
+
+ return ETrue;
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosAlbum::Video
+// ---------------------------------------------------------------------------
+//
+TInt CVcxMyVideosAlbum::Video( TUint32 aMdsId, TVcxMyVideosAlbumVideo& aVideo, TInt& aIndex )
+ {
+ const TLinearOrder<TVcxMyVideosAlbumVideo> KOrderByMdsId(
+ CVcxMyVideosAlbum::CompareVideosByMdsId );
+
+ TVcxMyVideosAlbumVideo videoToFind;
+ videoToFind.iMdsId = aMdsId;
+ TInt err = iVideoList.FindInOrder( videoToFind, aIndex, KOrderByMdsId );
+
+ if ( err == KErrNone )
+ {
+ aVideo = iVideoList[aIndex];
+ }
+
+ return err;
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosAlbum::AddL
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosAlbum::AddL( TVcxMyVideosAlbumVideo aVideo )
+ {
+ const TLinearOrder<TVcxMyVideosAlbumVideo> KOrderByMdsId(
+ CVcxMyVideosAlbum::CompareVideosByMdsId );
+
+ iVideoList.InsertInOrderAllowRepeatsL( aVideo, KOrderByMdsId );
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosAlbum::Remove
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosAlbum::Remove( RArray<TUint32>& aMdsIds )
+ {
+ TInt count = aMdsIds.Count();
+ for ( TInt i = 0; i < count; i++ )
+ {
+ Remove( aMdsIds[i], EFalse /* don't compress */ );
+ }
+ iVideoList.Compress();
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosAlbum::Remove
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosAlbum::Remove( TUint32 aMdsId, TBool aCompress )
+ {
+ const TLinearOrder<TVcxMyVideosAlbumVideo> KOrderByMdsId(
+ CVcxMyVideosAlbum::CompareVideosByMdsId );
+
+ TVcxMyVideosAlbumVideo video;
+ video.iMdsId = aMdsId;
+ TInt pos;
+ TInt err = iVideoList.FindInOrder( video, pos, KOrderByMdsId );
+ if ( err == KErrNone )
+ {
+ iVideoList.Remove( pos );
+ }
+ if ( aCompress )
+ {
+ iVideoList.Compress();
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosAlbum::UpdateAttributesL
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosAlbum::UpdateAttributesL()
+ {
+ //CalcNewVideoCountAndLatestNonWatchedL();
+ //CalcPlaytimeL();
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosAlbum::CompareVideosByMdsId
+// ---------------------------------------------------------------------------
+//
+TInt CVcxMyVideosAlbum::CompareVideosByMdsId( const TVcxMyVideosAlbumVideo& aVideo1,
+ const TVcxMyVideosAlbumVideo& aVideo2 )
+ {
+ if ( aVideo1.iMdsId == aVideo2.iMdsId )
+ {
+ return 0;
+ }
+
+ if ( aVideo1.iMdsId < aVideo2.iMdsId )
+ {
+ return -1;
+ }
+ return 1;
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosAlbum::CreateVideoListL
+// Creates album video list from iCollection.iCache->iVideoList.
+// ---------------------------------------------------------------------------
+//
+CMPXMedia* CVcxMyVideosAlbum::CreateVideoListL()
+ {
+ CMPXMedia* toVideoList = TVcxMyVideosCollectionUtil::CreateEmptyMediaListL();
+ CleanupStack::PushL( toVideoList );
+
+ AppendToVideoListL( *iCollection.iCache->iVideoList, *toVideoList, 0 );
+
+ CleanupStack::Pop( toVideoList );
+
+ return toVideoList;
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosAlbum::CreateVideoListL
+// Appends to video list items which belong to this album.
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosAlbum::AppendToVideoListL( CMPXMedia& aFromVideoList,
+ CMPXMedia& aToVideoList, TInt aNewItemStartIndex )
+ {
+ if ( aNewItemStartIndex < 0 )
+ {
+ return;
+ }
+
+ CMPXMediaArray* fromArray = aFromVideoList.Value<CMPXMediaArray>( KMPXMediaArrayContents );
+ CMPXMediaArray* toArray = aToVideoList.Value<CMPXMediaArray>( KMPXMediaArrayContents );
+ TUint32 mdsId;
+ CMPXMedia* fromVideo;
+ TInt count = fromArray->Count();
+ for ( TInt i = aNewItemStartIndex; i < count; i++ )
+ {
+ fromVideo = fromArray->AtL( i );
+ mdsId = TVcxMyVideosCollectionUtil::IdL( *fromVideo ).iId1;
+ if ( BelongsToAlbum( mdsId ) )
+ {
+ CMPXMedia* toVideo = CMPXMedia::NewL( *fromVideo ); //share underlying memory
+ CleanupStack::PushL( toVideo );
+ toArray->AppendL( toVideo );
+ CleanupStack::Pop( toVideo );
+ }
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideosalbums.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,566 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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: Albums related collection functionality (except db operations).
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <mpxlog.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxcollectionpluginobserver.h>
+#include "vcxmyvideosalbums.h"
+#include "vcxmyvideoscollectionutil.h"
+#include "vcxmyvideoscollectionplugin.h"
+#include "vcxmyvideosmdsdb.h"
+#include "vcxmyvideosmdsalbums.h"
+#include "vcxmyvideoscollectionutil.h"
+#include "vcxmyvideosmessagelist.h"
+#include "vcxmyvideosopenhandler.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CVcxMyVideosAlbums::CVcxMyVideosAlbums( CVcxMyVideosCollectionPlugin& aCollection )
+: iCollection( aCollection )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// 2nd-phase constructor
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosAlbums::ConstructL()
+ {
+ iAlbums.Reset();
+ }
+
+// ---------------------------------------------------------------------------
+// Two-Phase Constructor
+// ---------------------------------------------------------------------------
+//
+CVcxMyVideosAlbums* CVcxMyVideosAlbums::NewL( CVcxMyVideosCollectionPlugin& aCollection )
+ {
+ CVcxMyVideosAlbums* self = new(ELeave) CVcxMyVideosAlbums( aCollection );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CVcxMyVideosAlbums::~CVcxMyVideosAlbums()
+ {
+ delete iAlbumList;
+ TInt count = iAlbums.Count();
+ for ( TInt i = 0; i < count; i++ )
+ {
+ delete iAlbums[i];
+ }
+ iAlbums.Close();
+ iMdsOpTargetIds.Close();
+ iMdsOpResults.Close();
+ iMdsOpResultsUint32.Close();
+ iRemoveFromAlbumVideos.Close();
+ }
+
+// ----------------------------------------------------------------------------
+// CVcxMyVideosAlbums::CreateAlbumListL
+// ----------------------------------------------------------------------------
+//
+void CVcxMyVideosAlbums::CreateAlbumListL()
+ {
+ if ( iAlbumList )
+ {
+ return;
+ }
+ iAlbumList = TVcxMyVideosCollectionUtil::CreateEmptyMediaListL();
+ iCollection.iMyVideosMdsDb->iAlbums->GetAlbumsL( iAlbumList, *this );
+ }
+
+// ----------------------------------------------------------------------------
+// CVcxMyVideosAlbums::CreateAlbumsL
+// Called when iAlbumList is ready, fills iAlbums.
+// Pointers to CVcxMyVideosVideoCache::iVideoList are not filled in yet.
+// ----------------------------------------------------------------------------
+//
+void CVcxMyVideosAlbums::CreateAlbumsL()
+ {
+ CMPXMediaArray* albumArray = iAlbumList->Value<CMPXMediaArray>( KMPXMediaArrayContents );
+
+ TInt count = albumArray->Count();
+ CVcxMyVideosAlbum* album;
+ CMPXMedia* media;
+ for ( TInt i = 0; i < count; i++ )
+ {
+ media = albumArray->AtL( i );
+ album = CVcxMyVideosAlbum::NewLC( iCollection );
+ album->iMdsId = TVcxMyVideosCollectionUtil::IdL( *media ).iId1;
+ album->iMedia = media;
+ iAlbums.AppendL( album );
+ CleanupStack::Pop( album );
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CVcxMyVideosAlbums::GetAlbumContentIdsL
+// Fetches MDS IDs for all albums.
+// ----------------------------------------------------------------------------
+//
+void CVcxMyVideosAlbums::GetAlbumContentIdsL()
+ {
+ TInt count = iAlbums.Count();
+ for ( TInt i = 0; i < count; i++ )
+ {
+ // These calls go to queue and responses arrive asynchronously
+ // to HandleGetAlbumContentIdsRespL.
+ iCollection.iMyVideosMdsDb->iAlbums->GetAlbumContentIdsL( iAlbums[i]->iMdsId,
+ iAlbums[i]->iVideoList, *this );
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CVcxMyVideosAlbums::Album
+// ----------------------------------------------------------------------------
+//
+CVcxMyVideosAlbum* CVcxMyVideosAlbums::Album( TUint32 aMdsId, TInt* aPos )
+ {
+ TInt count = iAlbums.Count();
+ for ( TInt i = 0; i < count; i++ )
+ {
+ if ( iAlbums[i]->iMdsId == aMdsId )
+ {
+ if ( aPos )
+ {
+ *aPos = i;
+ }
+ return iAlbums[i];
+ }
+ }
+ return NULL;
+ }
+
+// ----------------------------------------------------------------------------
+// CVcxMyVideosAlbums::AddVideosToAlbumL
+// Command from MPX client.
+// ----------------------------------------------------------------------------
+//
+void CVcxMyVideosAlbums::AddVideosToAlbumL( CMPXMedia* aCmd )
+ {
+ iCollection.iMyVideosMdsDb->iAlbums->AddVideosToAlbumL( aCmd, *this );
+ }
+
+// ----------------------------------------------------------------------------
+// CVcxMyVideosAlbums::RemoveVideosFromAlbumL
+// Converts video mpx ids to relation ids and calls RemoveRelationsL.
+// ----------------------------------------------------------------------------
+//
+void CVcxMyVideosAlbums::RemoveVideosFromAlbumL( CMPXMedia* aCmd )
+ {
+ TInt albumId = TVcxMyVideosCollectionUtil::Uint32ValueL( *aCmd );
+ CMPXMediaArray* array = TVcxMyVideosCollectionUtil::MediaArrayL( *aCmd );
+ TVcxMyVideosAlbumVideo video;
+ TInt index;
+ TInt error;
+ CMPXMedia* media;
+ TInt count = array->Count();
+ iMdsOpTargetIds.Reset();
+ iMdsOpTargetIds.Reserve( count );
+ iRemoveFromAlbumVideos.Reset();
+ iRemoveFromAlbumVideos.Reserve( count );
+ TVcxMyVideosAlbumVideo paddingVideo;
+ paddingVideo.iMdsId = 0;
+ paddingVideo.iRelationMdsId = 0;
+
+ for ( TInt i = 0; i < count; i++ )
+ {
+ media = array->AtL( i );
+ error = Album( albumId )->Video(
+ TVcxMyVideosCollectionUtil::IdL( *media ).iId1, video, index );
+ if ( error == KErrNone )
+ {
+ iRemoveFromAlbumVideos.AppendL( video ); //store album video data now to avoid second search when response arrives
+ iMdsOpTargetIds.AppendL( video.iRelationMdsId );
+ }
+ else
+ {
+ iRemoveFromAlbumVideos.AppendL( paddingVideo ); //add dummy video to keep media array and iRemoveFromAlbumVideos in sync
+ }
+ }
+ iMdsOpResultsUint32.Reset();
+ iCollection.iMyVideosMdsDb->iAlbums->RemoveRelationsL(
+ iMdsOpTargetIds, iMdsOpResultsUint32, *this );
+ }
+
+// ----------------------------------------------------------------------------
+// CVcxMyVideosAlbums::AddAlbumL
+// ----------------------------------------------------------------------------
+//
+void CVcxMyVideosAlbums::AddAlbumL( CMPXMedia& aCmd )
+ {
+ iCollection.iMyVideosMdsDb->iAlbums->AddAlbumL( aCmd );
+
+ TUint32 mdsId = TVcxMyVideosCollectionUtil::IdL( aCmd ).iId1;
+ if ( !Album( mdsId ) )
+ {
+ CMPXMediaArray* albumArray = iAlbumList->Value<CMPXMediaArray>( KMPXMediaArrayContents );
+ albumArray->AppendL( aCmd );
+
+ CVcxMyVideosAlbum* album = CVcxMyVideosAlbum::NewLC( iCollection );
+ album->iMdsId = mdsId;
+ album->iMedia = albumArray->AtL( albumArray->Count() - 1 );
+ iAlbums.AppendL( album );
+ CleanupStack::Pop( album );
+
+ iCollection.iMessageList->AddEventL( TMPXItemId( mdsId, KVcxMvcMediaTypeAlbum ),
+ EMPXItemInserted, EVcxMyVideosListNoInfo, album->iMedia );
+ iCollection.iMessageList->SendL();
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CVcxMyVideosAlbums::RemoveAlbumsFromMdsOnlyL
+// ----------------------------------------------------------------------------
+//
+void CVcxMyVideosAlbums::RemoveAlbumsFromMdsOnlyL( CMPXMedia* aCmd )
+ {
+ //TODO: find out what happens to relations, do we have to clean them out
+ iCollection.iMyVideosMdsDb->iAlbums->RemoveAlbumsL( aCmd, *this );
+ }
+
+// ----------------------------------------------------------------------------
+// CVcxMyVideosAlbums::RemoveAlbumsL
+// From MDS delete event.
+// ----------------------------------------------------------------------------
+//
+void CVcxMyVideosAlbums::RemoveAlbumsL( RArray<TUint32>& aAlbumIds )
+ {
+ TInt count = aAlbumIds.Count();
+ for ( TInt i = count -1; i >= 0; i-- )
+ {
+ TBool removed = RemoveAlbum( aAlbumIds[i], EFalse /* dont compress */);
+ if ( removed )
+ {
+ aAlbumIds.Remove( i );
+ }
+ }
+ iAlbums.Compress();
+
+ iCollection.iMessageList->SendL();
+ }
+
+// ----------------------------------------------------------------------------
+// CVcxMyVideosAlbums::RemoveAlbum
+// ----------------------------------------------------------------------------
+//
+TBool CVcxMyVideosAlbums::RemoveAlbum( TUint32 aMdsId, TBool aCompress )
+ {
+ TInt pos;
+ CVcxMyVideosAlbum* album = Album( aMdsId, &pos );
+ if ( album )
+ {
+ CMPXMediaArray* albumArray = TVcxMyVideosCollectionUtil::MediaArrayL( *iAlbumList );
+
+ iAlbums.Remove( pos );
+ albumArray->Remove( pos );
+
+ if ( aCompress )
+ {
+ iAlbums.Compress();
+ }
+ iCollection.iMessageList->AddEventL( TMPXItemId( aMdsId, KVcxMvcMediaTypeAlbum ),
+ EMPXItemDeleted, EVcxMyVideosListNoInfo );
+ return ETrue;
+ }
+ return EFalse;
+ }
+
+// ----------------------------------------------------------------------------
+// CVcxMyVideosAlbums::AddAlbumsFromMdsL
+// From MDS insert event, no need to fetch content since the album was just
+// created.
+// ----------------------------------------------------------------------------
+//
+void CVcxMyVideosAlbums::AddAlbumsFromMdsL( RArray<TUint32>& /*aAlbumIds*/ )
+ {
+ //TODO: implement if we want to support albums which are added by someone else
+ // than My Videos Collection.
+ }
+
+// ----------------------------------------------------------------------------
+// CVcxMyVideosAlbums::HandleGetAlbumsRespL
+// ----------------------------------------------------------------------------
+//
+void CVcxMyVideosAlbums::HandleGetAlbumsRespL( CMPXMedia* aAlbumList )
+ {
+ // aAlbumList = iAlbums->iAlbumList
+ CMPXMediaArray* array = aAlbumList->Value<CMPXMediaArray>( KMPXMediaArrayContents );
+ TInt count = array->Count();
+ TMPXItemId mpxId;
+ CMPXMedia* album;
+ for ( TInt i = 0; i < count; i++ )
+ {
+ album = array->AtL( i );
+ mpxId = TVcxMyVideosCollectionUtil::IdL( *album );
+ iCollection.iMessageList->AddEventL( mpxId, EMPXItemInserted, 0, album );
+ }
+ CreateAlbumsL(); //fills in iAlbums from iAlbumList
+ GetAlbumContentIdsL(); //fills iAlbums with MDS IDs of the videos asynchronously
+ iCollection.iMessageList->SendL();
+ }
+
+// ----------------------------------------------------------------------------
+// CVcxMyVideosAlbums::HandleGetAlbumContentIdsRespL
+// ----------------------------------------------------------------------------
+//
+void CVcxMyVideosAlbums::HandleGetAlbumContentIdsRespL( TUint32 aAlbumId,
+ RArray<TVcxMyVideosAlbumVideo>& /*aAlbumContentIds*/ )
+ {
+ //&aAlbumContent = iAlbums[x]->iVideoList
+
+ CVcxMyVideosAlbum* album( Album( aAlbumId ) );
+ if ( album )
+ {
+ album->Sort(); //sorts iAlbum[x]->iVideoList by MDS ID.
+ }
+
+ //if last album -> album list is complete
+ if ( iAlbums[iAlbums.Count() -1]->iMdsId == aAlbumId )
+ {
+ MPX_DEBUG1("CVcxMyVideosAlbums:: content ids for last album arrived -> album list is complete" );
+ iAlbumListIsComplete = ETrue;
+
+ if ( iCollection.iOpenHandler->iPendingAlbumOpenId )
+ {
+ MPX_DEBUG1("CVcxMyVideosAlbums:: there was album open pending, calling HandleAlbumOpenL()" );
+
+ TRAPD( err, iCollection.iOpenHandler->HandleAlbumOpenL() );
+ if ( err != KErrNone )
+ {
+ MPX_DEBUG3("CVcxMyVideosAlbums:: HandleAlbumOpenL() left: %d, calling HandleOpen(NULL,%d)",
+ err, err);
+ iCollection.iObs->HandleOpen( static_cast<CMPXMedia*>(NULL), err );
+ }
+ }
+ }
+
+
+#ifdef _DEBUG
+ TInt count = album->iVideoList.Count();
+
+ MPX_DEBUG2("CVcxMyVideosCollectionPlugin:: content ids for album %d arrived", aAlbumId);
+
+ for ( TInt i = 0; i < album->iVideoList.Count(); i++ )
+ {
+ MPX_DEBUG2("CVcxMyVideosCollectionPlugin:: mds id = %d", album->iVideoList[i].iMdsId );
+ }
+#endif
+ }
+
+// ----------------------------------------------------------------------------
+// CVcxMyVideosAlbums::HandleGetAlbumsResp
+// ----------------------------------------------------------------------------
+//
+void CVcxMyVideosAlbums::HandleGetAlbumsResp( CMPXMedia* aAlbumList )
+ {
+ TRAP_IGNORE( HandleGetAlbumsRespL( aAlbumList ) );
+ }
+
+// ----------------------------------------------------------------------------
+// CVcxMyVideosAlbums::HandleGetAlbumContentIdsResp
+// ----------------------------------------------------------------------------
+//
+void CVcxMyVideosAlbums::HandleGetAlbumContentIdsResp( TUint32 aAlbumId,
+ RArray<TVcxMyVideosAlbumVideo>& aAlbumContent )
+ {
+ TRAP_IGNORE( HandleGetAlbumContentIdsRespL( aAlbumId, aAlbumContent ) );
+ }
+
+// ----------------------------------------------------------------------------
+// CVcxMyVideosAlbums::HandleAddVideosToAlbumResp
+// ----------------------------------------------------------------------------
+//
+void CVcxMyVideosAlbums::HandleAddVideosToAlbumResp( CMPXMedia* aCmd,
+ RPointerArray<CMdEInstanceItem>& aItemArray )
+ {
+ TRAPD( err, DoHandleAddVideosToAlbumRespL( aCmd, aItemArray ) );
+
+ if ( err != KErrNone )
+ {
+ CMPXMedia* cmd = iCollection.iActiveTask->Command();
+ if ( cmd )
+ {
+ cmd->SetTObjectValueL<TInt>( KVcxMediaMyVideosInt32Value, err );
+ iCollection.iActiveTask->Done();
+ }
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CVcxMyVideosAlbums::DoHandleAddVideosToAlbumResp
+// ----------------------------------------------------------------------------
+//
+void CVcxMyVideosAlbums::DoHandleAddVideosToAlbumRespL( CMPXMedia* aCmd,
+ RPointerArray<CMdEInstanceItem>& aItemArray )
+ {
+ MPX_DEBUG1("CVcxMyVideosAlbums::DoHandleAddVideosToAlbumResp() start");
+
+ CMPXMediaArray* mediaArray = TVcxMyVideosCollectionUtil::MediaArrayL( *aCmd );
+
+ TVcxMyVideosAlbumVideo video;
+ TUint albumId;
+ CVcxMyVideosAlbum* album;
+
+ TInt count = aItemArray.Count();
+ for ( TInt i = 0; i < count; i++ )
+ {
+ video.iRelationMdsId = aItemArray[i]->Id();
+ MPX_DEBUG3( "CVcxMyVideosAlbums:: item result[%d] = %d (id)", i, video.iRelationMdsId );
+ if ( video.iRelationMdsId == KNoId )
+ {
+ mediaArray->AtL( i )->SetTObjectValueL<TInt>( KVcxMediaMyVideosInt32Value, KErrGeneral );
+ }
+ else
+ {
+ mediaArray->AtL( i )->SetTObjectValueL<TInt>( KVcxMediaMyVideosInt32Value, KErrNone );
+ video.iMdsId = TVcxMyVideosCollectionUtil::IdL( *mediaArray->AtL( i ) ).iId1;
+ albumId = TVcxMyVideosCollectionUtil::Uint32ValueL( *aCmd );
+ album = Album( albumId );
+ if ( album )
+ {
+ album->AddL( video );
+ iCollection.iMessageList->AddEventL( TMPXItemId( albumId, KVcxMvcMediaTypeAlbum ),
+ EMPXItemModified, EVcxMyVideosVideoListOrderChanged );
+ }
+ }
+ }
+
+ iCollection.iActiveTask->Done();
+ iCollection.iMessageList->SendL();
+
+ MPX_DEBUG1("CVcxMyVideosAlbums::DoHandleAddVideosToAlbumResp() exit");
+ }
+
+// ----------------------------------------------------------------------------
+// CVcxMyVideosAlbums::HandleRemoveRelationsResp
+// ----------------------------------------------------------------------------
+//
+void CVcxMyVideosAlbums::HandleRemoveRelationsResp( RArray<TUint32>& /*aRelationIds*/,
+ RArray<TUint32>& aResults )
+ {
+ MPX_DEBUG1("CVcxMyVideosAlbums::HandleRemoveRelationsResp() start");
+
+ // iRemoveFromAlbumVideos and mediaArray are in sync
+
+ CMPXMedia* cmd = iCollection.iActiveTask->Command();
+ CMPXMediaArray* mediaArray = TVcxMyVideosCollectionUtil::MediaArrayL( *cmd );
+ TInt count = iRemoveFromAlbumVideos.Count();
+ CMPXMedia* video;
+ TInt relationId;
+ for ( TInt i = 0; i < count; i++ )
+ {
+ video = mediaArray->AtL( i );
+ relationId = iRemoveFromAlbumVideos[i].iRelationMdsId;
+ if ( relationId != 0 &&
+ aResults.Find( relationId ) != KErrNotFound )
+ {
+ video->SetTObjectValueL( KVcxMediaMyVideosInt32Value, KErrNone );
+ }
+ else
+ {
+ video->SetTObjectValueL( KVcxMediaMyVideosInt32Value, KErrGeneral );
+ }
+ }
+ iRemoveFromAlbumVideos.Reset();
+
+ iCollection.iActiveTask->Done();
+
+ MPX_DEBUG1("CVcxMyVideosAlbums::HandleRemoveRelationsResp() exit");
+ }
+
+// ----------------------------------------------------------------------------
+// CVcxMyVideosAlbums::HandleRemoveAlbumsResp
+// ----------------------------------------------------------------------------
+//
+void CVcxMyVideosAlbums::HandleRemoveAlbumsResp( CMPXMedia* aCmd,
+ RArray<TUint32>& aResultIds )
+ {
+ CMPXMediaArray* mediaArray = TVcxMyVideosCollectionUtil::MediaArrayL( *aCmd );
+ TInt count = mediaArray->Count();
+ TUint32 mdsId;
+ CMPXMedia* album;
+ for ( TInt i = 0; i < count; i++ )
+ {
+ album = mediaArray->AtL( i );
+ mdsId = TVcxMyVideosCollectionUtil::IdL( *album ).iId1;
+ if ( aResultIds.Find( mdsId ) != KErrNotFound )
+ {
+ album->SetTObjectValueL( KVcxMediaMyVideosInt32Value, KErrNone );
+ }
+ else
+ {
+ album->SetTObjectValueL( KVcxMediaMyVideosInt32Value, KErrGeneral );
+ }
+ }
+
+ iCollection.iActiveTask->Done();
+ }
+
+// ----------------------------------------------------------------------------
+// CVcxMyVideosAlbums::HandleRelationEvent
+// Only relation removed events are received here.
+// ----------------------------------------------------------------------------
+//
+void CVcxMyVideosAlbums::HandleRelationEvent( TObserverNotificationType /*aType*/,
+ const RArray<TMdERelation>& aRelationArray )
+ {
+ TRAP_IGNORE(
+
+ TUint albumId;
+ CVcxMyVideosAlbum* album;
+ TInt count = aRelationArray.Count();
+ for ( TInt i = 0; i < count; i++ )
+ {
+ albumId = aRelationArray[i].LeftObjectId();
+
+ if ( iAlbumListIsComplete )
+ {
+ album = Album( albumId );
+ if ( album )
+ {
+ album->Remove( aRelationArray[i].RightObjectId(), ETrue /* compress */ );
+ }
+ iCollection.iMessageList->AddEventL( TMPXItemId( albumId, KVcxMvcMediaTypeAlbum ),
+ EMPXItemModified, EVcxMyVideosVideoListOrderChanged );
+ }
+ else
+ {
+ //We are fetching albums already, we assume that it will be up to date.
+ //If that is not the case, then we should set some flag here and restart
+ //album fetching from scratch.
+ }
+ }
+ iCollection.iMessageList->SendL();
+
+ );
+ }
+
+// END OF FILE
--- a/videocollection/mpxmyvideoscollection/src/vcxmyvideosasyncfileoperations.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideosasyncfileoperations.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -34,7 +34,6 @@
#include "vcxmyvideoscollectionplugin.h"
#include "vcxmyvideoscollection.hrh"
#include "vcxmyvideoscollectionutil.h"
-#include "vcxmyvideosdownloadutil.h"
#include "vcxmyvideosvideocache.h"
#include "vcxmyvideoscategories.h"
#include "vcxmyvideosmessagelist.h"
@@ -221,13 +220,13 @@
// CVcxMyVideosAsyncFileOperations::HandleMoveOrCopyStepL
// ----------------------------------------------------------------------------
//
-TBool CVcxMyVideosAsyncFileOperations::HandleMoveOrCopyStepL()
+MVcxMyVideosActiveTaskObserver::TStepResult CVcxMyVideosAsyncFileOperations::HandleMoveOrCopyStepL()
{
CMPXMedia& cmd = iCollection.iActiveTask->GetCommand();
- TBool done;
+ MVcxMyVideosActiveTaskObserver::TStepResult stepResult;
- TBool isMoveOperation = EFalse;
+ TBool isMoveOperation = EFalse;
TUint32 cmdId = cmd.ValueTObjectL<TUint32>( KVcxMediaMyVideosCommandId );
if ( cmdId == KVcxCommandMyVideosMove )
{
@@ -285,7 +284,7 @@
if ( iCurrentOperationIndex > (iOperationIdArray.Count() - 1) )
{
iCurrentOperationIndex = 0;
- done = ETrue;
+ stepResult = MVcxMyVideosActiveTaskObserver::EDone;
if ( isMoveOperation )
{
SendOperationRespL( KVcxMessageMyVideosMoveResp );
@@ -297,10 +296,10 @@
}
else
{
- done = EFalse;
+ stepResult = MVcxMyVideosActiveTaskObserver::EMoreToCome;
}
- return done;
+ return stepResult;
}
// ----------------------------------------------------------------------------
@@ -431,12 +430,6 @@
video = iCollection.iMyVideosMdsDb->CreateVideoL( aMdsId, EFalse /* brief details */ );
}
- if ( !video )
- {
- MPX_DEBUG2("CVcxMyVideosAsyncFileOperations:: mds id %d not found from mds or cache", aMdsId);
- User::Leave( KErrNotFound );
- }
-
CleanupStack::PushL( video ); // 1->
// sanity checks
@@ -665,13 +658,13 @@
// CVcxMyVideosAsyncFileOperations::HandleDeleteStepL
// ----------------------------------------------------------------------------
//
-TBool CVcxMyVideosAsyncFileOperations::HandleDeleteStepL()
+MVcxMyVideosActiveTaskObserver::TStepResult CVcxMyVideosAsyncFileOperations::HandleDeleteStepL()
{
CMPXMedia& cmd = iCollection.iActiveTask->GetCommand();
//no sanity checks for array items, since we want to generate all events, even if there is nothing to delete
- TBool done;
+ MVcxMyVideosActiveTaskObserver::TStepResult stepResult;
TUint32 cmdId = cmd.ValueTObjectL<TUint32>( KVcxMediaMyVideosCommandId );
@@ -717,16 +710,15 @@
if ( iCurrentOperationIndex > (iOperationIdArray.Count() - 1) )
{
iCurrentOperationIndex = 0;
- done = ETrue;
-
+ stepResult = MVcxMyVideosActiveTaskObserver::EDone;
SendOperationRespL( KVcxMessageMyVideosDeleteResp );
}
else
{
- done = EFalse;
+ stepResult = MVcxMyVideosActiveTaskObserver::EMoreToCome;
}
- return done;
+ return stepResult;
}
--- a/videocollection/mpxmyvideoscollection/src/vcxmyvideoscategories.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideoscategories.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -182,6 +182,8 @@
CleanupClosePushL( newVideosIncrements ); // 2->
TInt i;
+ videosIncrements.ReserveL( categoryCount );
+ newVideosIncrements.ReserveL( categoryCount );
for ( i = 0; i < categoryCount; i++ )
{
videosIncrements.AppendL( 0 );
@@ -280,12 +282,14 @@
{
category = aCategoryArray.AtL( i );
+ //codescanner warning: aVideosIncrements count is same as aCategoryArray count, so the range is checked
UpdateVideosCountL( *category, aVideosIncrements[i], KVcxMediaMyVideosCategoryItemCount,
EVcxMyVideosListNoInfo );
modified = ETrue;
}
+ //codescanner warning: aNewVideosIncrements count is same as aCategoryArray count, so the range is checked
if ( aNewVideosIncrements[i] != 0 )
{
category = aCategoryArray.AtL( i );
--- a/videocollection/mpxmyvideoscollection/src/vcxmyvideoscollectionplugin.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideoscollectionplugin.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -11,12 +11,11 @@
*
* Contributors:
*
-* Description: Implementation of My Videos collection Plugin interface*
+* Description: Implementation of My Videos collection Plugin interface*
*/
-
// INCLUDE FILES
#include <e32cmn.h>
#include <s32mem.h>
@@ -35,19 +34,13 @@
#include "vcxmyvideoscollectionplugin.h"
#include "vcxmyvideoscollection.hrh"
#include "vcxmyvideoscollectionutil.h"
-#include "vcxmyvideosdownloadutil.h"
#include "vcxmyvideosvideocache.h"
#include "vcxmyvideoscategories.h"
#include "vcxmyvideosmessagelist.h"
#include "vcxmyvideosasyncfileoperations.h"
#include "vcxmyvideosopenhandler.h"
-
-const TInt KMaxFileDeleteAttempts = 4;
-const TInt KFileDeleteLoopDelay = 100000;
-
-// Add 2000 new videos to memory card. Reboot phone, mds starts harvesting,
-// open my videos -> mds server crashes and lots of events is sent to client.
-// If one waits until all are harvested before opening my videos, it works.
+#include "vcxmyvideosmdsalbums.h"
+#include "vcxmyvideosalbums.h"
// ============================ MEMBER FUNCTIONS ==============================
@@ -78,13 +71,13 @@
MPX_DEBUG2("CVcxMyVideosCollectionPlugin:: this = %x", this);
delete iMyVideosMdsDb;
- delete iDownloadUtil;
delete iCache;
delete iMessageList;
delete iCategories;
delete iAsyncFileOperations;
delete iActiveTask;
delete iOpenHandler;
+ delete iAlbums;
iFs.Close();
}
@@ -108,7 +101,7 @@
User::LeaveIfError( iFs.Connect() );
- iMyVideosMdsDb = CVcxMyVideosMdsDb::NewL( this, iFs );
+ iMyVideosMdsDb = CVcxMyVideosMdsDb::NewL( this, &AlbumsL(), iFs );
iActiveTask = CVcxMyVideosActiveTask::NewL( *this );
iCache = CVcxMyVideosVideoCache::NewL( *this );
iMessageList = CVcxMyVideosMessageList::NewL( *this );
@@ -137,7 +130,7 @@
const TArray<TCapability>& /*aCaps*/,
CMPXAttributeSpecs* /*aSpecs*/)
{
- MPX_FUNC("CMPXMyVideosDbPlugin::MediaL");
+ MPX_FUNC("CVcxMyVideosCollectionPlugin::MediaL");
MPX_DEBUG_PATH(aPath);
RArray<TInt> supportedIds;
@@ -170,7 +163,7 @@
if ( ids.Count() == 0 )
{
- MPX_DEBUG1("CMPXMyVideosDbPlugin:: request didn't contain any items ids, aborting");
+ MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: request didn't contain any items ids, aborting");
iObs->HandleMedia( NULL, KErrArgument );
CleanupStack::PopAndDestroy( &ids ); // <-2
@@ -186,27 +179,27 @@
if ( videoInCache )
{
// 0 attributes means "get all" -> can't use cache
- MPX_DEBUG2("CMPXMyVideosDbPlugin:: client is requesting %d attributes", aAttrs.Count());
+ MPX_DEBUG2("CVcxMyVideosCollectionPlugin:: client is requesting %d attributes", aAttrs.Count());
if ( aAttrs.Count() > 0 )
{
TBool nonSupportedAttrCanBeFoundFromMds;
if ( TVcxMyVideosCollectionUtil::AreSupported( *videoInCache, aAttrs,
nonSupportedAttrCanBeFoundFromMds ) )
{
- MPX_DEBUG1("CMPXMyVideosDbPlugin:: all attributes found from cache");
+ MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: all attributes found from cache");
useCachedVideo = ETrue;
}
else
{
- MPX_DEBUG1("CMPXMyVideosDbPlugin:: all attributes NOT found from cache");
+ MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: all attributes NOT found from cache");
if ( !nonSupportedAttrCanBeFoundFromMds )
{
- MPX_DEBUG1("CMPXMyVideosDbPlugin:: none of the non cached attrs can be found from MDS -> use cached version");
+ MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: none of the non cached attrs can be found from MDS -> use cached version");
useCachedVideo = ETrue;
}
else
{
- MPX_DEBUG1("CMPXMyVideosDbPlugin:: at least one of the non cached attributes can be found from MDS");
+ MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: at least one of the non cached attributes can be found from MDS");
}
}
}
@@ -216,12 +209,12 @@
if ( useCachedVideo )
{
- MPX_DEBUG1("CMPXMyVideosDbPlugin:: using cached video");
+ MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: using cached video");
video = CMPXMedia::CopyL( *videoInCache );
}
else
{
- MPX_DEBUG1("CMPXMyVideosDbPlugin:: fetching from MDS");
+ MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: fetching from MDS");
video = iMyVideosMdsDb->CreateVideoL( ids[0].iId1, ETrue /* full details */ );
}
@@ -318,6 +311,13 @@
iActiveTask->Cancel();
}
break;
+
+ case KVcxCommandMyVideosAddAlbum:
+ {
+ MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: sync KVcxCommandMyVideosAddAlbum arrived");
+ AlbumsL().AddAlbumL( aCmd );
+ }
+ break;
}
}
break;
@@ -427,6 +427,10 @@
{
MPX_FUNC("CVcxMyVideosCollectionPlugin::DoHandleMyVideosDbEventL");
+ RArray<TUint32> nonVideoIds;
+ nonVideoIds.Reset();
+ CleanupClosePushL( nonVideoIds );
+
switch ( aEvent )
{
case EMPXItemDeleted:
@@ -435,7 +439,8 @@
MPX_DEBUG1("CVcxMyVideosCollectionPlugin::DoHandleMyVideosDbEventL() Items from MDS deleted, deleting from cache |" );
MPX_DEBUG1("CVcxMyVideosCollectionPlugin::DoHandleMyVideosDbEventL() --------------------------------------------'");
- iCache->RemoveL( aId );
+ iCache->RemoveL( aId );
+ AlbumsL().RemoveAlbumsL( aId );
}
break;
@@ -448,22 +453,31 @@
if ( iMyVideosMdsDb->iVideoListFetchingIsOngoing )
{
MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: video list fetching is ongoing, ignoring add event");
+ CleanupStack::PopAndDestroy( &nonVideoIds );
return;
}
TBool videoListFetchingWasCancelled = EFalse;
-
+
// After the call, aId will contain only items which were actually inserted to cache.
// We receive add events for all object types. When fetching the item from MDS we use
- // video condition and only video objects are added to cache.
- iCache->AddVideosFromMdsL( aId, videoListFetchingWasCancelled );
+ // video condition and only video objects are added to cache. Items which were detected
+ // to not be videos are added to nonVideoIds.
+ iCache->AddVideosFromMdsL( aId, videoListFetchingWasCancelled, &nonVideoIds );
+
+#if 0 //TODO: do this if we want to support albums which are being added by someone else than My Videos Collection
+
+ //After the call nonVideoIds will contain only items which were actually added
+ //to albums.
+ AlbumsL().AddAlbumsFromMdsL( nonVideoIds );
+#endif
+
if ( videoListFetchingWasCancelled )
{
RestartVideoListFetchingL();
}
-
- SyncWithDownloadsL( aId );
}
+
break;
case EMPXItemModified:
@@ -488,24 +502,41 @@
}
}
}
- SyncWithDownloadsL( aId );
+
+ //TODO: handle album modify events
break;
}
-
- TInt pos;
- for ( TInt i = 0; i < aId.Count(); i++ )
- {
+
+ TInt pos;
+ TInt count = aId.Count();
+ for ( TInt i = 0; i < count; i++ )
+ {
+ if ( aEvent == EMPXItemInserted )
+ {
+ // add item from cache to the message if we have it.
+ CMPXMedia* video = iCache->FindVideoByMdsIdL( aId[i], pos );
+ TRAP_IGNORE( iMessageList->AddEventL( TMPXItemId( aId[i], KVcxMvcMediaTypeVideo),
+ aEvent, 0, video ) );
+ }
+ else
+ {
+ TRAP_IGNORE( iMessageList->AddEventL( TMPXItemId( aId[i], KVcxMvcMediaTypeVideo),
+ aEvent ) );
+ }
+ }
+
if ( aEvent == EMPXItemInserted )
{
- // add item from cache to the message if we have it.
- CMPXMedia* video = iCache->FindVideoByMdsIdL( aId[i], pos );
- TRAP_IGNORE( iMessageList->AddEventL( TMPXItemId( aId[i], 0), aEvent, 0, video ) );
+ //nonVideoIds are albums
+ TInt count = nonVideoIds.Count();
+ for ( TInt i = 0; i < count; i++ )
+ {
+ TRAP_IGNORE( iMessageList->AddEventL(
+ TMPXItemId( nonVideoIds[i], KVcxMvcMediaTypeAlbum ), aEvent ) );
+ }
}
- else
- {
- TRAP_IGNORE( iMessageList->AddEventL( TMPXItemId( aId[i], 0), aEvent ) );
- }
- }
+
+ CleanupStack::PopAndDestroy( &nonVideoIds );
iMessageList->SendL();
}
@@ -514,11 +545,11 @@
// CVcxMyVideosCollectionPlugin::HandleStepL
// ----------------------------------------------------------------------------
//
-TBool CVcxMyVideosCollectionPlugin::HandleStepL()
+MVcxMyVideosActiveTaskObserver::TStepResult CVcxMyVideosCollectionPlugin::HandleStepL()
{
MPX_FUNC("CVcxMyVideosCollectionPlugin::HandleStepL");
- TBool done(ETrue);
+ MVcxMyVideosActiveTaskObserver::TStepResult stepResult(MVcxMyVideosActiveTaskObserver::EDone);
switch ( iActiveTask->GetTask() )
{
@@ -537,8 +568,7 @@
MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: async KMPXCommandIdCollectionSet out");
- done = ETrue;
-
+ stepResult = MVcxMyVideosActiveTaskObserver::EDone;
break;
}
case KVcxCommandIdMyVideos:
@@ -553,183 +583,7 @@
TInt myVideosCmd( cmd.ValueTObjectL<TUint>( KVcxMediaMyVideosCommandId ) );
switch ( myVideosCmd )
- {
- case KVcxCommandMyVideosStartDownload:
- {
- MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: Handling KVcxCommandMyVideosStartDownload command.");
-
- CMPXMedia* video = CMPXMedia::NewL( *(iActiveTask->GetCommand().Value<CMPXMedia>(
- KMPXCommandColAddMedia)) );
- CleanupStack::PushL( video ); // 1->
-
- if ( !iCache->iVideoList )
- {
- MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: iVideoListCache = NULL -> creating new empty iVideoListCache");
- iCache->iVideoListIsPartial = ETrue;
- iCache->iVideoList = TVcxMyVideosCollectionUtil::CreateEmptyMediaListL();
- }
-
- TBool resume = EFalse;
-
- if ( video->IsSupported( KVcxMediaMyVideosDownloadId ) )
- {
- TUint32 downloadId = video->ValueTObjectL<TUint32>( KVcxMediaMyVideosDownloadId );
- if ( downloadId != 0 )
- {
- MPX_DEBUG2("CVcxMyVideosCollectionPlugin:: download id %d given by the client -> this is download resume",
- downloadId);
- resume = ETrue;
-
- // load the existing item to cache if its not there already
- }
- }
-
- if ( !resume )
- {
- if ( !video->IsSupported( KVcxMediaMyVideosRemoteUrl ) )
- {
- MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: KVcxMediaMyVideosRemoteUrl not supported -> leaving with KErrArgument");
- User::Leave( KErrArgument );
- }
-
- if ( video->ValueText( KVcxMediaMyVideosRemoteUrl ).Length() >
- KVcxMvcMaxUrlLength )
- {
- MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: url longer than 1024 -> leaving with KErrArgument");
- User::Leave( KErrArgument );
- }
-
- MPX_DEBUG2("CVcxMyVideosCollectionPlugin:: starting download for url: %S",
- &video->ValueText( KVcxMediaMyVideosRemoteUrl ) );
-
- video->SetTObjectValueL<TUint8>( KVcxMediaMyVideosOrigin, EVcxMyVideosOriginDownloaded );
- video->SetTObjectValueL<TUint8>( KVcxMediaMyVideosDownloadState,
- static_cast<TUint8>(EVcxMyVideosDlStateDownloading) );
- video->SetTObjectValueL<TUint32>( KMPXMediaGeneralFlags, EVcxMyVideosVideoNew );
-
- HBufC* fileName = DownloadUtilL().CreateFilePathL( *video );
- CleanupStack::PushL( fileName ); // 2->
- video->SetTextValueL( KMPXMediaGeneralUri, *fileName );
- CleanupStack::PopAndDestroy( fileName ); // <-2
- }
-
- TRAPD( err, DownloadUtilL().StartDownloadL( *video ) ); //download id is written to video object
-
- if ( err != KErrNone )
- {
- MPX_DEBUG2("CVcxMyVideosCollectionPlugin:: StartDownloadL left: %d", err);
- User::Leave( err );
- }
-
- if ( !resume )
- {
- TUint32 newDownloadId = video->ValueTObjectL<TUint32>( KVcxMediaMyVideosDownloadId );
- MPX_DEBUG2("CVcxMyVideosCollectionPlugin:: new download ID: %d",
- newDownloadId);
-
- AddVideoToMdsAndCacheL( *video );
- }
- else
- {
- // clear old error codes from the dl item
- TInt pos;
-
- CMPXMedia* videoInCache = iCache->FindVideoByMdsIdL(
- TVcxMyVideosCollectionUtil::IdL( *video ), pos );
- if ( videoInCache )
- {
- videoInCache->SetTObjectValueL<TInt>( KVcxMediaMyVideosDownloadError, 0 );
- videoInCache->SetTObjectValueL<TInt>( KVcxMediaMyVideosDownloadGlobalError, 0 );
- }
- }
-
- CleanupStack::PopAndDestroy( video ); // <-1
- done = ETrue;
- }
- break;
-
- case KVcxCommandMyVideosCancelDownload:
- {
- // Error code is returned to client if dl item was left to system.
- // If file delete fails, then mds item is also left to system.
-
- MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: Handling KVcxCommandMyVideosCancelDownload command.");
-
- CMPXMedia* video = CMPXMedia::NewL( *(iActiveTask->GetCommand().Value<CMPXMedia>(
- KMPXCommandColAddMedia)) );
- CleanupStack::PushL( video ); // 1->
-
- if ( !video->IsSupported( KVcxMediaMyVideosDownloadId ) ||
- !video->IsSupported( KMPXMediaGeneralId ) ||
- !video->IsSupported( KMPXMediaGeneralUri ) )
- {
- MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: parameter missing, can't cancel dl, leaving with KErrArgument");
- User::Leave( KErrArgument );
- }
-
- TUint32 downloadId = video->ValueTObjectL<TUint32>(
- KVcxMediaMyVideosDownloadId );
- DownloadUtilL().CancelDownload( downloadId, ETrue /* remove file */ );
-
- if ( BaflUtils::FileExists( iFs, video->ValueText( KMPXMediaGeneralUri ) ) )
- {
- TMPXItemId mpxItemId = video->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId );
- TInt err( KErrNone );
-
- for ( TInt i = 0; i < KMaxFileDeleteAttempts; i++ )
- {
- TRAP( err, AsyncFileOperationsL().DeleteVideoL( mpxItemId.iId1, ETrue ) );
-
- if ( err == KErrInUse )
- {
- MPX_DEBUG1( "CVcxMyVideosCollectionPlugin:: file is already in use, waiting a moment and try again");
- User::After( KFileDeleteLoopDelay );
- }
- else
- {
- break;
- }
- }
-
- if ( err != KErrNone && err != KErrNotFound )
- {
-#ifdef _DEBUG
- if ( err == KErrInUse )
- {
- TVcxMyVideosCollectionUtil::PrintOpenFileHandlesL(
- video->ValueText( KMPXMediaGeneralUri ), iFs );
- }
-#endif
-
- // Some error occured when cancelling download operation, dl item is however gone and file is left
- // -> change dl id to 0 and leave mpx collection item there. Report operation to client as a success.
- MPX_DEBUG1( "CVcxMyVideosCollectionPlugin:: dl item is gone from dl manager, file and mpx item are left, setting dl id to 0");
- TRAP_IGNORE( SetDownloadIdToZeroL( downloadId ) );
- }
- }
-
- CleanupStack::PopAndDestroy( video ); // <-1
- done = ETrue;
- }
- break;
-
- case KVcxCommandMyVideosPauseDownload:
- {
- CMPXMedia& cmd = iActiveTask->GetCommand();
- if ( !cmd.IsSupported( KVcxMediaMyVideosDownloadId ) )
- {
- User::Leave( KErrArgument );
- }
- else
- {
- TInt err = DownloadUtilL().PauseDownload(
- cmd.ValueTObjectL<TUint32>( KVcxMediaMyVideosDownloadId ) );
- User::LeaveIfError( err );
- }
- done = ETrue;
- }
- break;
-
+ {
case KVcxCommandMyVideosGetMediaFullDetailsByMpxId:
{
MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: KVcxCommandMyVideosGetMediaFullDetailsByMpxId received");
@@ -743,25 +597,16 @@
CMPXMedia* video = iMyVideosMdsDb->CreateVideoL(
mpxId.iId1, ETrue /* full details */ );
-
- if ( !video )
- {
- User::Leave( KErrGeneral );
- }
CleanupStack::PushL( video ); // 1->
-
- TBool eventsAdded;
- SyncVideoWithDownloadsL( *video, eventsAdded,
- EFalse /* dont add event to iMessageList */ );
-
+
cmd.SetCObjectValueL<CMPXMedia>( KMPXCommandColAddMedia, video );
CleanupStack::PopAndDestroy( video ); // <-1
cmd.SetTObjectValueL<TUid>(KMPXMessageCollectionId, TUid::Uid(
KVcxUidMyVideosMpxCollection));
- done = ETrue;
+ stepResult = MVcxMyVideosActiveTaskObserver::EDone;
}
break;
@@ -817,12 +662,8 @@
{
// Load items to cache
MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: loading requested items to iCache->iVideoList");
-
+
iCache->AddVideosFromMdsL( mdsIds, videoListFetchingWasCancelled );
- if ( mdsIds.Count() > 0 )
- {
- SyncWithDownloadsL( mdsIds );
- }
}
else
{
@@ -855,7 +696,7 @@
CleanupStack::PopAndDestroy( &mdsIds2 ); // <-2
CleanupStack::PopAndDestroy( &mdsIds ); // <-1
- done = ETrue;
+ stepResult = MVcxMyVideosActiveTaskObserver::EDone;
}
break;
@@ -863,16 +704,44 @@
case KVcxCommandMyVideosMove:
{
MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: KVcxCommandMyVideosMove or Copy step");
- done = AsyncFileOperationsL().HandleMoveOrCopyStepL();
+ stepResult = AsyncFileOperationsL().HandleMoveOrCopyStepL();
}
break;
case KVcxCommandMyVideosDelete:
{
MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: KVcxCommandMyVideosDelete step");
- done = AsyncFileOperationsL().HandleDeleteStepL();
+ stepResult = AsyncFileOperationsL().HandleDeleteStepL();
}
break;
+
+ case KVcxCommandMyVideosAddToAlbum:
+ iAlbums->AddVideosToAlbumL( &iActiveTask->GetCommand() );
+ stepResult = MVcxMyVideosActiveTaskObserver::EStopStepping;
+ break;
+
+ case KVcxCommandMyVideosRemoveFromAlbum:
+ iAlbums->RemoveVideosFromAlbumL( &iActiveTask->GetCommand() );
+ stepResult = MVcxMyVideosActiveTaskObserver::EStopStepping;
+ break;
+
+ case KVcxCommandMyVideosAddAlbum:
+ {
+ MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: async KVcxCommandMyVideosAddAlbum arrived");
+ AlbumsL().AddAlbumL( iActiveTask->GetCommand() );
+ stepResult = MVcxMyVideosActiveTaskObserver::EDone;
+ break;
+ }
+
+ case KVcxCommandMyVideosRemoveAlbums:
+ {
+ MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: async KVcxCommandMyVideosRemoveAlbums arrived");
+ AlbumsL().RemoveAlbumsFromMdsOnlyL( iActiveTask->Command() );
+ stepResult = MVcxMyVideosActiveTaskObserver::EStopStepping;
+ break;
+ }
+
+
}
}
break;
@@ -883,7 +752,7 @@
TMPXItemId mpxId = iActiveTask->GetCommand().ValueTObjectL<TMPXItemId>(
KMPXMediaGeneralId );
AsyncFileOperationsL().DeleteVideoL( mpxId.iId1 );
- done = ETrue;
+ stepResult = MVcxMyVideosActiveTaskObserver::EDone;
break;
}
@@ -894,7 +763,7 @@
break;
}
}
- return done;
+ return stepResult;
}
@@ -910,10 +779,14 @@
if ( aErr != KErrNone )
{
MPX_DEBUG2("CVcxMyVideosCollectionPlugin:: Leave or cancel happened during the operation: %d", aErr);
- TRAPD( err, AsyncFileOperationsL().CancelOperationL( aErr ) ); // generates resp message for move,copy or delete operations
- if ( err != KErrNone )
+
+ if ( iAsyncFileOperations )
{
- MPX_DEBUG2("CVcxMyVideosCollectionPlugin:: failed to generate resp msg: %d", err);
+ TRAPD( err, AsyncFileOperationsL().CancelOperationL( aErr ) ); // generates resp message for move,copy or delete operations
+ if ( err != KErrNone )
+ {
+ MPX_DEBUG2("CVcxMyVideosCollectionPlugin:: failed to generate resp msg: %d", err);
+ }
}
}
@@ -926,435 +799,6 @@
}
// ----------------------------------------------------------------------------
-// CVcxMyVideosCollectionPlugin::HandleDlEvent
-// From CVcxMyVideosDownloadUtilObserver
-// ----------------------------------------------------------------------------
-//
-void CVcxMyVideosCollectionPlugin::HandleDlEvent( TVcxMyVideosDownloadState aState,
- TUint32 aDownloadId,
- TInt aProgress,
- TInt64 aDownloaded,
- TInt32 aError,
- TInt32 aGlobalError )
- {
- TRAPD( err, DoHandleDlEventL( aState, aDownloadId, aProgress,
- aDownloaded, aError, aGlobalError ) );
- if ( err != KErrNone )
- {
- MPX_DEBUG2("CVcxMyVideosCollectionPlugin:: DoHandleDlEventL left with error code: %d", err);
- }
- }
-
-// ----------------------------------------------------------------------------
-// CVcxMyVideosCollectionPlugin::DoHandleDlEventL
-// ----------------------------------------------------------------------------
-//
-void CVcxMyVideosCollectionPlugin::DoHandleDlEventL( TVcxMyVideosDownloadState aState,
- TUint32 aDownloadId,
- TInt aProgress,
- TInt64 aDownloaded,
- TInt32 aError,
- TInt32 aGlobalError )
- {
- MPX_FUNC("CVcxMyVideosCollectionPlugin::DoHandleDlEventL");
-
- CMPXMedia* video = iCache->FindVideoByDownloadIdL( aDownloadId );
-
- MPX_DEBUG3("CVcxMyVideosCollectionPlugin:: dl event for download ID %d, pointer = %x) arrived.", aDownloadId, video);
-
- TBool sendEvent = EFalse;
- if ( video )
- {
- TMPXItemId mpxId( TVcxMyVideosCollectionUtil::IdL( *video ) );
- MPX_DEBUG4("CVcxMyVideosCollectionPlugin:: MPX item (MDS ID %d) (DL ID %d) %S",
- mpxId.iId1, aDownloadId, &TVcxMyVideosCollectionUtil::Title( *video ) );
-
- TUint8 currentState = TVcxMyVideosCollectionUtil::DownloadStateL( *video );
-
- if ( currentState == EVcxMyVideosDlStateDownloaded )
- {
- MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: already in Downloaded state, discarding event");
- return;
- }
-
- if ( currentState != aState )
- {
- MPX_DEBUG5("CVcxMyVideosCollectionPlugin:: updating (mds id: %d) (dl id: %d) state: %S -> %S",
- mpxId.iId1, aDownloadId, &DownloadState( currentState ), &DownloadState( aState ) );
- video->SetTObjectValueL<TUint8>( KVcxMediaMyVideosDownloadState, static_cast<TUint8>(aState) );
- sendEvent = ETrue;
-
- if ( aState == EVcxMyVideosDlStateDownloaded )
- {
- MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: downloaded state received -> setting download id to 0");
-
- //1. set download id to 0
- video->SetTObjectValueL<TUint32>( KVcxMediaMyVideosDownloadId, 0 );
-
- //2. update drm flag
-#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
- RFile64 dlFile;
-#else
- RFile dlFile;
-#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
- TInt err = dlFile.Open( iFs, video->ValueText( KMPXMediaGeneralUri ), EFileRead );
- if ( err == KErrNone )
- {
- MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: file opened ok for drm reading");
- CleanupClosePushL( dlFile ); // 1->
- DRM::CDrmUtility* drmUtil = DRM::CDrmUtility::NewLC(); // 2->
- if ( drmUtil->IsProtectedL( dlFile ) )
- {
- MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: file is DRM protected, setting the property flag");
- TUint32 flags = video->ValueTObjectL<TUint32>( KMPXMediaGeneralFlags );
- flags |= EVcxMyVideosVideoDrmProtected;
- video->SetTObjectValueL<TUint32>( KMPXMediaGeneralFlags, flags );
- }
- else
- {
- MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: file is not DRM protected");
- }
- CleanupStack::PopAndDestroy( drmUtil ); // <-2
- CleanupStack::PopAndDestroy( &dlFile ); // <-1
- }
- else
- {
- MPX_DEBUG2("CVcxMyVideosCollectionPlugin:: file didnt open for drm reading, %d", err);
- }
- NotifyDownloadCompletedL( *video );
-
- //3. Update file size using iCache->UpdateVideoL function since it changes item position and
- // sends category modified events if necessarry.
- CMPXMedia* updateObject = CMPXMedia::NewL();
- CleanupStack::PushL( updateObject ); // 1->
- updateObject->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, mpxId );
-#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
- updateObject->SetTObjectValueL<TInt64>( KMPXMediaGeneralExtSizeInt64,
- static_cast<TInt64>( aDownloaded ) );
- // set current value to 0 to force event sending and video list position updating
- video->SetTObjectValueL<TInt64>( KMPXMediaGeneralExtSizeInt64, 0 );
-#else
- updateObject->SetTObjectValueL<TInt>( KMPXMediaGeneralSize,
- static_cast<TInt>( aDownloaded ) );
- // set current value to 0 to force event sending and video list position updating
- video->SetTObjectValueL<TInt>( KMPXMediaGeneralSize, 0 );
-#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
- iCache->UpdateVideoL( *updateObject );
- CleanupStack::PopAndDestroy( updateObject ); // <-1
- // find video again since it might have been deleted in iCache->UpdateVideoL
- TInt pos;
- video = iCache->FindVideoByMdsIdL( mpxId.iId1, pos );
-
- //file size and download id are saved to database
- iMyVideosMdsDb->UpdateVideoL( *video );
- sendEvent = EFalse; // MDS will send the event, this avoids duplicate
- }
-
- if ( aState == EVcxMyVideosDlStateFailed )
- {
- video->SetTObjectValueL<TInt32>( KVcxMediaMyVideosDownloadError, aError );
- video->SetTObjectValueL<TInt32>( KVcxMediaMyVideosDownloadGlobalError,
- aGlobalError );
- }
- }
- else
- {
- MPX_DEBUG2("CVcxMyVideosCollectionPlugin:: state was already same(%S), skipping state update.", &DownloadState( currentState ));
- }
-
- TInt8 currentProgress = video->ValueTObjectL<TInt8>( KVcxMediaMyVideosDownloadProgress );
- if ( currentProgress != aProgress )
- {
- MPX_DEBUG4("CVcxMyVideosCollectionPlugin:: (dl id: %d) progress: %d -> %d",
- aDownloadId, currentProgress, aProgress );
-
- video->SetTObjectValueL<TInt8>( KVcxMediaMyVideosDownloadProgress,
- static_cast<TInt8>( aProgress ) );
- // Don't send the update event for progress.
- //sendEvent = ETrue;
- }
- else
- {
- MPX_DEBUG2("CVcxMyVideosCollectionPlugin:: progress was already same(%d), skipping progress update.", currentProgress);
- }
-
- TInt64 currentFileSize = 0;
-#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
- if ( video->IsSupported( KMPXMediaGeneralExtSizeInt64 ) )
- {
- currentFileSize = video->ValueTObjectL<TInt64>( KMPXMediaGeneralExtSizeInt64 );
- }
-#else
- if ( video->IsSupported( KMPXMediaGeneralSize ) )
- {
- currentFileSize = video->ValueTObjectL<TInt>( KMPXMediaGeneralSize );
- }
-#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
- if ( currentFileSize != aDownloaded )
- {
- MPX_DEBUG4("CVcxMyVideosCollectionPlugin:: updating (dl id: %d) size: %ld -> %ld",
- aDownloadId, currentFileSize, aDownloaded );
-
-#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
- video->SetTObjectValueL<TInt64>( KMPXMediaGeneralExtSizeInt64, aDownloaded );
-#else
- TInt newFileSize( aDownloaded );
- video->SetTObjectValueL<TInt>( KMPXMediaGeneralSize, newFileSize );
-#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
- //sendEvent = ETrue;
- }
-
- if ( sendEvent )
- {
- iMessageList->AddEventL( mpxId, EMPXItemModified );
- iMessageList->SendL();
- }
- }
- else
- {
- if ( (aState != EVcxMyVideosDlStateDownloaded) && (aProgress < 100) &&
- !iCache->iVideoListIsPartial )
- {
- MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: -----------------------------------------------------------------------.");
- MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: Event for progressing download arrived, but the MPX/MDS item not found!|");
- MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: -> deleting download. |");
- MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: -----------------------------------------------------------------------'");
-
- RHttpDownload* download = DownloadUtilL().Download( aDownloadId );
- if ( download )
- {
- MPX_DEBUG2("CVcxMyVideosCollectionPlugin:: Download ID (%d) not found from MPX/MDS, deleting download!",
- aDownloadId );
- DownloadUtilL().DeleteDownloadAsync( aDownloadId, ETrue );
- }
- }
- }
- }
-
-// ----------------------------------------------------------------------------
-// CVcxMyVideosCollectionPlugin::SyncWithDownloadsL
-// ----------------------------------------------------------------------------
-//
-void CVcxMyVideosCollectionPlugin::SyncWithDownloadsL(
- RArray<TUint32>& aItemsInCache )
- {
- MPX_FUNC("CVcxMyVideosCollectionPlugin::SyncWithDownloadsL()");
-
- TBool eventsAdded = EFalse;
- for ( TInt i = 0; i < aItemsInCache.Count(); i++ )
- {
- TInt pos;
- CMPXMedia* video = iCache->FindVideoByMdsIdL( aItemsInCache[i], pos );
- if ( video )
- {
- SyncVideoWithDownloadsL( *video, eventsAdded );
- }
- }
- if ( eventsAdded )
- {
- iMessageList->SendL();
- }
- }
-
-// ----------------------------------------------------------------------------
-// CVcxMyVideosCollectionPlugin::SyncVideoWithDownloadsL
-// ----------------------------------------------------------------------------
-//
-void CVcxMyVideosCollectionPlugin::SyncVideoWithDownloadsL( CMPXMedia& aVideo,
- TBool& aEventAdded, TBool aAddEvent )
- {
- TInt downloadId( TVcxMyVideosCollectionUtil::DownloadIdL( aVideo ) );
-
- if ( downloadId )
- {
- RHttpDownload* download( DownloadUtilL().Download( downloadId ) );
-
- if ( download )
- {
- MPX_DEBUG2("CVcxMyVideosCollectionPlugin::SyncVideoWithDownloadsL() item (DL ID: %d) found from dl manager", downloadId);
-
- TBool modified = EFalse;
- SyncVideoAndDownloadL( aVideo, *download, modified );
- if ( modified && aAddEvent )
- {
- iMessageList->AddEventL( TVcxMyVideosCollectionUtil::IdL( aVideo ),
- EMPXItemModified );
- aEventAdded = ETrue;
- }
- }
- else
- {
- //download id != 0 and it is not found from download manager -> we set download id to 0
- MPX_DEBUG2("CVcxMyVideosCollectionPlugin:: download id %d != 0 and no corresponding download found from Download Manager",
- downloadId);
- MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: -> setting download id to 0");
- aVideo.SetTObjectValueL<TUint32>( KVcxMediaMyVideosDownloadId, 0 );
- iMyVideosMdsDb->UpdateVideoL( aVideo ); // if video list fetching is ongoing, this will leave with KErrNotReady
- }
- }
- }
-
-// ----------------------------------------------------------------------------
-// CVcxMyVideosCollectionPlugin::SyncVideoAndDownloadL
-// ----------------------------------------------------------------------------
-//
-void CVcxMyVideosCollectionPlugin::SyncVideoAndDownloadL(
- CMPXMedia& aVideo,
- RHttpDownload& aDownload,
- TBool& aModified )
- {
- MPX_FUNC("CVcxMyVideosCollectionPlugin::SyncVideoAndDownloadL()");
-
- aModified = EFalse;
-
- TBuf<KMaxUrlLength> downloadUrl;
- aDownload.GetStringAttribute( EDlAttrReqUrl, downloadUrl );
- if ( aVideo.ValueText( KVcxMediaMyVideosRemoteUrl )
- != downloadUrl )
- {
- MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: urls in MPX and DL Manager differ!");
- MPX_DEBUG2("CVcxMyVideosCollectionPlugin:: remote url in MPX: %S",
- &(aVideo.ValueText( KVcxMediaMyVideosRemoteUrl )));
- MPX_DEBUG2("CVcxMyVideosCollectionPlugin:: remote url in DL Manager: %S",
- &downloadUrl);
- MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: -> updating MPX cache");
-
- aVideo.SetTextValueL( KVcxMediaMyVideosRemoteUrl, downloadUrl );
- aModified = ETrue;
- }
- else
- {
- MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: remote urls already same in dl manager and mpx");
- }
-
- // KVcxMediaMyVideosDownloadState
- TVcxMyVideosDownloadState dlStateInDlManager;
- DownloadUtilL().GetDownloadState( aDownload, dlStateInDlManager );
-
- TUint8 dlStateInMpxCache;
- if ( aVideo.IsSupported( KVcxMediaMyVideosDownloadState ))
- {
- dlStateInMpxCache = aVideo.ValueTObjectL<TUint8>( KVcxMediaMyVideosDownloadState );
- }
- else
- {
- dlStateInMpxCache = static_cast<TUint8>( EVcxMyVideosDlStateNone );
- }
-
- MPX_DEBUG2("CVcxMyVideosCollectionPlugin:: dl state in dl manager: %S", &DownloadState( dlStateInDlManager ));
- MPX_DEBUG2("CVcxMyVideosCollectionPlugin:: dl state in mpx cache: %S", &DownloadState( dlStateInMpxCache ));
-
- if ( static_cast<TUint8>( dlStateInDlManager ) != dlStateInMpxCache )
- {
- if ( dlStateInDlManager == EVcxMyVideosDlStateDownloaded )
- {
- // Download finished event has arrived when we weren't around, call event handler to get things right.
- // Collection is updated and download is deleted from Download Manager.
- MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: Download is in Finished state and collection has download id != 0");
- MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: -> we have missed download finished event, lets generate it by ourselves.");
-
- TUint64 downloaded( 0 );
- TUint8 progress( DownloadUtilL().DownloadProgress( aDownload, downloaded, EFalse ) );
- TUint32 downloadId( aVideo.ValueTObjectL<TUint32>( KVcxMediaMyVideosDownloadId ) );
- HandleDlEvent( dlStateInDlManager, downloadId,
- progress, downloaded, KErrNone, KErrNone );
- DownloadUtilL().DeleteDownloadAsync( downloadId, EFalse /* don't delete content */ );
- }
- else
- {
- MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: dl state in dl manager differs of mpx cache-> updating mpx cache");
- aVideo.SetTObjectValueL<TUint8>( KVcxMediaMyVideosDownloadState,
- static_cast<TUint8>( dlStateInDlManager ) );
- aModified = ETrue;
- }
- }
- else
- {
- MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: download state already same in dl manager and mds");
- }
-
- // KVcxMediaMyVideosDownloadProgress
- TUint64 downloaded = 0;
- TInt8 dlProgressInDlManager = DownloadUtilL().DownloadProgress(
- aDownload, downloaded, EFalse );
-
- TInt8 dlProgressInMpxCache;
- if ( aVideo.IsSupported( KVcxMediaMyVideosDownloadProgress ) )
- {
- dlProgressInMpxCache = aVideo.ValueTObjectL<TInt8>( KVcxMediaMyVideosDownloadProgress );
- }
- else
- {
- aVideo.SetTObjectValueL<TInt8>( KVcxMediaMyVideosDownloadProgress, 0 );
- dlProgressInMpxCache = 0;
- }
-
- MPX_DEBUG2("CVcxMyVideosCollectionPlugin:: dl progress in dl manager: %d", dlProgressInDlManager);
- MPX_DEBUG2("CVcxMyVideosCollectionPlugin:: dl progress in mpx cache: %d", dlProgressInMpxCache);
-
- if ( dlProgressInDlManager != dlProgressInMpxCache )
- {
- MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: dl progress in dl manager differs of mpx cache-> updating mpx cache");
- aVideo.SetTObjectValueL<TInt8>( KVcxMediaMyVideosDownloadProgress,
- static_cast<TInt8>( dlProgressInDlManager ) );
- aModified = ETrue;
- }
- else
- {
- MPX_DEBUG1("CVcxMyVideosCollectionPlugin:: download progress already same in dl manager and mds");
- }
- }
-
-// ----------------------------------------------------------------------------
-// CVcxMyVideosCollectionPlugin::SyncVideoListWithDownloadsL
-// ----------------------------------------------------------------------------
-//
-void CVcxMyVideosCollectionPlugin::SyncVideoListWithDownloadsL( CMPXMedia& aVideoList,
- TBool aSendEvents, TInt aStartPos )
- {
- MPX_FUNC("CVcxMyVideosCollectionPlugin::SyncVideoListWithDownloadsL");
-
- CMPXMediaArray* videoArray = aVideoList.Value<CMPXMediaArray>(
- KMPXMediaArrayContents);
-
- CMPXMedia* video;
-
- TBool eventsAdded = EFalse;
- for ( TInt i = aStartPos; i < videoArray->Count(); i++ )
- {
- video = (*videoArray)[i];
- SyncVideoWithDownloadsL( *video, eventsAdded, aSendEvents );
- }
- if ( eventsAdded )
- {
- iMessageList->SendL();
- }
- }
-
-// ----------------------------------------------------------------------------
-// CVcxMyVideosCollectionPlugin::DownloadUtil
-// ----------------------------------------------------------------------------
-//
-CVcxMyVideosDownloadUtil& CVcxMyVideosCollectionPlugin::DownloadUtilL()
- {
- if ( !iDownloadUtil )
- {
- iDownloadUtil = CVcxMyVideosDownloadUtil::NewL( *this, iFs );
- }
-
- if ( !iOrphanDownloadsCleared )
- {
- if ( !iCache->iVideoListIsPartial )
- {
- iOrphanDownloadsCleared = ETrue;
- iDownloadUtil->ClearOrphanDownloadsL( *iCache->iVideoList );
- }
- }
-
- return *iDownloadUtil;
- }
-
-// ----------------------------------------------------------------------------
// CVcxMyVideosCollectionPlugin::CategoriesL
// ----------------------------------------------------------------------------
//
@@ -1368,6 +812,20 @@
}
// ----------------------------------------------------------------------------
+// CVcxMyVideosCollectionPlugin::AlbumsL
+// TODO: Unecessarry func since we always load this
+// ----------------------------------------------------------------------------
+//
+CVcxMyVideosAlbums& CVcxMyVideosCollectionPlugin::AlbumsL()
+ {
+ if ( !iAlbums )
+ {
+ iAlbums = CVcxMyVideosAlbums::NewL( *this );
+ }
+ return *iAlbums;
+ }
+
+// ----------------------------------------------------------------------------
// CVcxMyVideosCollectionPlugin::HandleCreateVideoListResp
// ----------------------------------------------------------------------------
//
@@ -1438,6 +896,7 @@
}
}
+#if 0
// ----------------------------------------------------------------------------
// CVcxMyVideosCollectionPlugin::NotifyDownloadCompletedL
// ----------------------------------------------------------------------------
@@ -1464,6 +923,7 @@
CleanupStack::PopAndDestroy( buffer );
}
+#endif
// ----------------------------------------------------------------------------
// CVcxMyVideosCollectionPlugin::NotifyNewVideosCountDecreasedL
@@ -1486,9 +946,7 @@
stream.CommitL();
CleanupStack::PopAndDestroy( &stream );
-
- DownloadUtilL().NotifyNewVideosCountDecreased( *buffer );
-
+
CleanupStack::PopAndDestroy( buffer );
}
@@ -1626,6 +1084,7 @@
iMessageList->SendL();
}
+#if 0
// ----------------------------------------------------------------------------
// CVcxMyVideosCollectionPlugin::SetDownloadIdToZeroL
// ----------------------------------------------------------------------------
@@ -1676,3 +1135,4 @@
}
#endif
+#endif
--- a/videocollection/mpxmyvideoscollection/src/vcxmyvideoscollectionutil.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideoscollectionutil.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -11,13 +11,12 @@
*
* Contributors:
*
-* Description:
+* Description:
*
*/
-
// INCLUDE FILES
#include <mpxmedia.h>
#include <mpxmediaarray.h>
@@ -166,7 +165,25 @@
}
}
}
-
+
+// ---------------------------------------------------------------------------
+// TVcxMyVideosCollectionUtil::AppendToListL
+// New items in aToList will point to same shared memory as items in aFromList.
+// ---------------------------------------------------------------------------
+//
+void TVcxMyVideosCollectionUtil::AppendToListL( CMPXMedia& aToList, CMPXMedia& aFromList )
+ {
+ CMPXMedia* media;
+ CMPXMediaArray* toArray = aToList.Value<CMPXMediaArray>( KMPXMediaArrayContents );
+ CMPXMediaArray* fromArray = aFromList.Value<CMPXMediaArray>( KMPXMediaArrayContents );
+ TInt count = fromArray->Count();
+ for ( TInt i = 0; i < count; i++ )
+ {
+ media = CMPXMedia::NewL( *(fromArray->AtL( i )) ); // points to same shared memory
+ toArray->AppendL( media ); //ownership moves
+ }
+ }
+
// ---------------------------------------------------------------------------
// This helper function converts drive letter to drive number
// ---------------------------------------------------------------------------
@@ -213,7 +230,8 @@
{
aUniquePath = aPath.Mid( 0, pos );
}
- counterDigits.Format(_L("%d"), counter++);
+ _LIT(KPercentD, "%d");
+ counterDigits.Format( KPercentD, counter++ );
aUniquePath.Append( '_' );
aUniquePath.Append( '(' );
aUniquePath.AppendJustify( counterDigits, KMaxDigits, TAlign( ERight ), '0' );
@@ -458,7 +476,63 @@
}
return KErrNotFound;
}
-
+
+// ----------------------------------------------------------------------------
+// TVcxMyVideosCollectionUtil::MediaArrayL
+// ----------------------------------------------------------------------------
+//
+CMPXMediaArray* TVcxMyVideosCollectionUtil::MediaArrayL( CMPXMedia& aMedia )
+ {
+ if ( !aMedia.IsSupported( KMPXMediaArrayContents ) )
+ {
+ User::Leave( KErrArgument );
+ }
+
+ return aMedia.Value<CMPXMediaArray>( KMPXMediaArrayContents );
+ }
+
+// ----------------------------------------------------------------------------
+// TVcxMyVideosCollectionUtil::Int32ValueL
+// ----------------------------------------------------------------------------
+//
+TInt32 TVcxMyVideosCollectionUtil::Int32ValueL( CMPXMedia& aMedia )
+ {
+ if ( !aMedia.IsSupported( KVcxMediaMyVideosInt32Value ) )
+ {
+ User::Leave( KErrArgument );
+ }
+ return aMedia.ValueTObjectL<TInt32>( KVcxMediaMyVideosInt32Value );
+ }
+
+// ----------------------------------------------------------------------------
+// TVcxMyVideosCollectionUtil::Uint32ValueL
+// ----------------------------------------------------------------------------
+//
+TUint32 TVcxMyVideosCollectionUtil::Uint32ValueL( CMPXMedia& aMedia )
+ {
+ if ( !aMedia.IsSupported( KVcxMediaMyVideosUint32Value ) )
+ {
+ User::Leave( KErrArgument );
+ }
+ return aMedia.ValueTObjectL<TUint32>( KVcxMediaMyVideosUint32Value );
+ }
+
+// ----------------------------------------------------------------------------
+// TVcxMyVideosCollectionUtil::GetIdsFromMediaArrayL
+// ----------------------------------------------------------------------------
+//
+void TVcxMyVideosCollectionUtil::GetIdsFromMediaArrayL( CMPXMediaArray& aMediaArray,
+ RArray<TUint32>& aIdArray )
+ {
+ TInt count = aMediaArray.Count();
+ aIdArray.Reset();
+ aIdArray.ReserveL( count );
+ for ( TInt i = 0; i < count; i++ )
+ {
+ aIdArray.AppendL( IdL( *aMediaArray.AtL( i ) ).iId1 );
+ }
+ }
+
#ifdef _DEBUG
// ----------------------------------------------------------------------------
// TVcxMyVideosCollectionUtil::PrintOpenFileHandlesL
@@ -500,7 +574,8 @@
//
void TVcxMyVideosCollectionUtil::GetProcessName( TInt aThreadId, TFullName& aProcessName )
{
- TFindThread find(_L("*"));
+ _LIT(KAsterixDes, "*");
+ TFindThread find( KAsterixDes );
while( find.Next( aProcessName ) == KErrNone )
{
RThread thread;
--- a/videocollection/mpxmyvideoscollection/src/vcxmyvideosdownloadcache.cpp Thu Apr 01 23:13:36 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,133 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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: Download list cache. Circular buffer made for speeding up*
-*/
-
-
-
-
-// INCLUDE FILES
-#include <mpxlog.h>
-#include <mpxmedia.h>
-#include <mpxmediaarray.h>
-#include <mpxmediageneraldefs.h>
-#include <mpxmediacontainerdefs.h>
-#include <vcxmyvideosdefs.h>
-#include <centralrepository.h>
-#include <collate.h>
-#include "vcxmyvideosdownloadcache.h"
-#include "vcxmyvideoscollectionplugin.h"
-#include "vcxmyvideosdownloadutil.h"
-#include "vcxmyvideoscollectionutil.h"
-#include "vcxmyvideoscategories.h"
-
-const TInt KVcxMvDownloadFindCacheSize = 20;
-
-// ============================ MEMBER FUNCTIONS ==============================
-
-// ----------------------------------------------------------------------------
-// Two-phased constructor.
-// ----------------------------------------------------------------------------
-//
-CVcxMyVideosDownloadCache* CVcxMyVideosDownloadCache::NewL()
- {
- CVcxMyVideosDownloadCache* self = new (ELeave) CVcxMyVideosDownloadCache();
- CleanupStack::PushL(self);
- self->ConstructL();
- CleanupStack::Pop(self);
- return self;
- }
-
-// ----------------------------------------------------------------------------
-// Destructor.
-// ----------------------------------------------------------------------------
-//
-CVcxMyVideosDownloadCache::~CVcxMyVideosDownloadCache()
- {
- MPX_FUNC("CVcxMyVideosDownloadCache::~CVcxMyVideosDownloadCache");
-
- iDownloadId.Close();
- iMedia.Close(); // pointers are not own
- }
-
-// ----------------------------------------------------------------------------
-// Constructor.
-// ----------------------------------------------------------------------------
-//
-CVcxMyVideosDownloadCache::CVcxMyVideosDownloadCache()
- {
- MPX_FUNC("CVcxMyVideosDownloadCache::CVcxMyVideosDownloadCache");
- }
-
-// ----------------------------------------------------------------------------
-// Symbian 2nd phase constructor can leave.
-// ----------------------------------------------------------------------------
-//
-void CVcxMyVideosDownloadCache::ConstructL ()
- {
- iDownloadId.Reset();
- iMedia.Reset();
- for ( TInt i = 0; i < KVcxMvDownloadFindCacheSize; i++ )
- {
- iDownloadId.Append( 0 );
- iMedia.Append( NULL );
- }
- }
-
-// ----------------------------------------------------------------------------
-// CVcxMyVideosDownloadCache::Get
-// ----------------------------------------------------------------------------
-//
-CMPXMedia* CVcxMyVideosDownloadCache::Get( TUint32 aDownloadId )
- {
- for ( TInt i = 0; i < KVcxMvDownloadFindCacheSize; i++ )
- {
- if ( iDownloadId[i] == aDownloadId )
- {
- return iMedia[i];
- }
- }
- return NULL;
- }
-
-// ----------------------------------------------------------------------------
-// CVcxMyVideosDownloadCache::Add
-// ----------------------------------------------------------------------------
-//
-void CVcxMyVideosDownloadCache::Add( TUint32 aDownloadId, CMPXMedia* aVideo )
- {
- iPos++;
- iPos %= KVcxMvDownloadFindCacheSize;
- iDownloadId[iPos] = aDownloadId;
- iMedia[iPos] = aVideo;
- }
-
-// ----------------------------------------------------------------------------
-// CVcxMyVideosDownloadCache::Delete
-// ----------------------------------------------------------------------------
-//
-void CVcxMyVideosDownloadCache::Delete( CMPXMedia* aVideo )
- {
- for ( TInt i = 0; i < KVcxMvDownloadFindCacheSize; i++ )
- {
- if ( iMedia[i] == aVideo )
- {
- iDownloadId[i] = 0;
- iMedia[i] = NULL;
- }
- }
- }
-
-// End of file
-
--- a/videocollection/mpxmyvideoscollection/src/vcxmyvideosdrivemonitor.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideosdrivemonitor.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -155,46 +155,6 @@
}
}
-#if 0 // not used in mpx my videos collection
-// -----------------------------------------------------------------------------
-// CVcxMyVideosDriveMonitor::RegisterObserverL
-// -----------------------------------------------------------------------------
-//
-void CVcxMyVideosDriveMonitor::RegisterObserverL( MVcxMyVideosDriveMonitorObserver* aObserver )
- {
- iObservers.AppendL( aObserver );
-
- if ( !IsActive() )
- {
- iFs.NotifyChange( ENotifyDisk, iStatus );
- SetActive();
- }
- }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosDriveMonitor::RemoveObserverL
-// -----------------------------------------------------------------------------
-//
-void CVcxMyVideosDriveMonitor::RemoveObserverL( MVcxMyVideosDriveMonitorObserver* aObserver )
- {
- TInt i;
- for ( i = 0; i < iObservers.Count(); i++ )
- {
- if ( aObserver == iObservers[i] )
- {
- iObservers.Remove( i );
- iObservers.Compress();
- break;
- }
- }
-
- if ( iObservers.Count() == 0 )
- {
- iFs.NotifyChangeCancel();
- }
- }
-#endif
-
/*
N96 without memory card:
26/09/2007 11:37:22 CIptvDriveMonitor:: drive[2]: type = EMediaNANDFlash
@@ -471,111 +431,6 @@
}
return KErrNotFound;
}
-
-#if 0 // not used by mpx my videos collection
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosDriveMonitor::PhoneMemoryDriveL
-// -----------------------------------------------------------------------------
-//
-TInt CVcxMyVideosDriveMonitor::PhoneMemoryDriveL()
- {
- TInt drive;
- User::LeaveIfError( drive = PhoneMemoryDrive() );
- return drive;
- }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosDriveMonitor::PhoneMemoryDrive
-// -----------------------------------------------------------------------------
-//
-TInt CVcxMyVideosDriveMonitor::PhoneMemoryDrive()
- {
- TInt i;
- for ( i = 0; i < iAvailableDrives.Count(); i++ )
- {
- if ( iAvailableDrives[i].iDrive == EDriveC )
- {
- return iAvailableDrives[i].iDrive;
- }
- }
- return KErrNotFound;
- }
-
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosDriveMonitor::FixedDriveL
-// -----------------------------------------------------------------------------
-//
-TInt CVcxMyVideosDriveMonitor::FixedDriveL( TBool aExcludeCDrive )
- {
- TInt drive;
- User::LeaveIfError( drive = FixedDrive( aExcludeCDrive ) );
- return drive;
- }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosDriveMonitor::FixedDrive
-// -----------------------------------------------------------------------------
-//
-TInt CVcxMyVideosDriveMonitor::FixedDrive( TBool aExcludeCDrive )
- {
- TInt i;
- for ( i = 0; i < iAvailableDrives.Count(); i++ )
- {
- MPX_DEBUG2("CVcxMyVideosDriveMonitor:: iAvailableDrives[%d]", i);
-
- if ( !(iAvailableDrives[i].iFlags & TVcxMyVideosDriveInfo::ERemovable) )
- {
- if ( iAvailableDrives[i].iDrive != EDriveC )
- {
- MPX_DEBUG2("CVcxMyVideosDriveMonitor:: FixedDrive() returning drive %d", iAvailableDrives[i].iDrive);
- return iAvailableDrives[i].iDrive;
- }
- else
- {
- if ( !aExcludeCDrive )
- {
- MPX_DEBUG2("CVcxMyVideosDriveMonitor:: FixedDrive() returning drive %d", iAvailableDrives[i].iDrive);
- return iAvailableDrives[i].iDrive;
- }
- }
- }
- }
- MPX_DEBUG1("CVcxMyVideosDriveMonitor:: FixedDrive() fixed drive not found");
- return KErrNotFound;
- }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosDriveMonitor::IsMmcInserted()
-// -----------------------------------------------------------------------------
-//
-TBool CVcxMyVideosDriveMonitor::IsMmcInserted()
- {
- TInt drive = MemoryCardDrive();
-
- if ( drive == KErrNotFound )
- {
- return EFalse;
- }
-
- TInt arrayPos = ArrayPos( drive );
-
- if ( arrayPos == KErrNotFound )
- {
- return EFalse;
- }
-
- TUint32 flags = iAvailableDrives[arrayPos].iFlags;
-
- if ( (flags & TVcxMyVideosDriveInfo::ELocked) || (flags & TVcxMyVideosDriveInfo::EMediaNotPresent) )
- {
- return EFalse;
- }
-
- return ETrue;
- }
-#endif
// -----------------------------------------------------------------------------
// CVcxMyVideosDriveMonitor::RunL()
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideosmdsalbums.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,990 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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: Provides albums support utilizing MDS.
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <mpxlog.h>
+#include <mdesession.h>
+#include <mdeconstants.h>
+#include <mdequery.h>
+#include <mpxmedia.h>
+#include <mpxmediaarray.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxmediageneraldefs.h>
+#include "vcxmyvideosmdsalbums.h"
+#include "vcxmyvideosmdsdb.h"
+#include "vcxmyvideoscollectionutil.h"
+#include "vcxmyvideosmdscmdqueue.h"
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CVcxMyVideosMdsAlbums::CVcxMyVideosMdsAlbums( CVcxMyVideosMdsDb& aMdsDb,
+ MVcxMyVideosMdsAlbumsObserver* aObserver )
+: CActive( EPriorityStandard ), iMdsDb( aMdsDb ), iObserver(aObserver)
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// 2nd-phase constructor
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsAlbums::ConstructL()
+ {
+ GetSchemaDefinitionsL();
+ CActiveScheduler::Add( this );
+
+ if ( iObserver )
+ {
+ //ENotifyAdd and ENotifyModify are not supported
+ iMdsDb.iMdsSession->AddRelationItemObserverL( *this, NULL,
+ ENotifyRemove, iMdsDb.iNamespaceDef );
+
+#if 0
+ // We receive only IDs from here. We need to make query to get
+ // relation objects-> slow to use. We use the response from
+ // the add operation instead. This way we don't receive
+ // add events if someone else adds videos to our albums
+ // but the performance is the best possible.
+ iMdsDb.iMdsSession->AddRelationObserverL( *this, NULL,
+ ENotifyAdd | ENotifyModify | ENotifyRemove );
+#endif
+ }
+
+ //TODO: do we need this?
+ //iMdsDb.iMdsSession->AddRelationPresentObserverL();
+ }
+
+// ---------------------------------------------------------------------------
+// Two-Phase Constructor
+// ---------------------------------------------------------------------------
+//
+CVcxMyVideosMdsAlbums* CVcxMyVideosMdsAlbums::NewL( CVcxMyVideosMdsDb& aMdsDb,
+ MVcxMyVideosMdsAlbumsObserver* aObserver )
+ {
+ CVcxMyVideosMdsAlbums* self = new(ELeave) CVcxMyVideosMdsAlbums( aMdsDb, aObserver );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CVcxMyVideosMdsAlbums::~CVcxMyVideosMdsAlbums()
+ {
+ delete iAlbumQuery;
+ delete iVideoQuery;
+ delete iRelationQuery;
+ delete iAlbumList;
+ iItemArray.Close();
+ iResultBuffer.Close();
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsAlbums::Cancel
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsAlbums::Cancel( CVcxMyVideosMdsDb::TRequestType aType )
+ {
+ if ( aType == CVcxMyVideosMdsDb::EAll || aType == CVcxMyVideosMdsDb::EGetAlbums )
+ {
+ if ( iAlbumQuery )
+ {
+ iAlbumQuery->Cancel();
+ }
+ }
+
+ if ( aType == CVcxMyVideosMdsDb::EAll || aType == CVcxMyVideosMdsDb::EGetAlbumContentIds )
+ {
+ if ( iRelationQuery )
+ {
+ iRelationQuery->Cancel();
+ }
+ }
+
+ if ( aType == CVcxMyVideosMdsDb::EAll || aType == CVcxMyVideosMdsDb::EGetAlbumContentVideos )
+ {
+ if ( iVideoQuery )
+ {
+ iVideoQuery->Cancel();
+ }
+ }
+
+
+ //TODO: cancel for "add to album"
+
+ //TODO: cancel for "remove from album"
+
+ //TODO: cancel for "remove albums"
+
+ // Seems like the only way to cancel these is to close session to MDS and reopen it...
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsAlbums::GetAlbumsL
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsAlbums::GetAlbumsL( CMPXMedia* aAlbumList,
+ MVcxMyVideosMdsAlbumsObserver& aClient )
+ {
+ CVcxMyVideosMdsCmdGetAlbums* cmd = new (ELeave) CVcxMyVideosMdsCmdGetAlbums;
+ CleanupStack::PushL( cmd );
+ cmd->iCmdType = CVcxMyVideosMdsDb::EGetAlbums;
+ cmd->iClient = &aClient;
+ cmd->iAlbumList = aAlbumList;
+ iMdsDb.iCmdQueue->ExecuteCmdL( cmd ); //owneship moves
+ CleanupStack::Pop( cmd );
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsAlbums::DoGetAlbumsL
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsAlbums::DoGetAlbumsL( CMPXMedia* aAlbumList,
+ MVcxMyVideosMdsAlbumsObserver& aClient )
+ {
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums::DoGetAlbumsL() start");
+
+ iAlbumList = aAlbumList; //store pointer to album list, we do not own this
+ iClient = &aClient;
+
+ delete iAlbumQuery;
+ iAlbumQuery = NULL;
+
+ iAlbumQuery = iMdsDb.iMdsSession->NewObjectQueryL( *iNamespaceDef, *iAlbumObjectDef, this );
+
+ CMdELogicCondition& rootCondition = iAlbumQuery->Conditions();
+ rootCondition.SetOperator( ELogicConditionOperatorOr );
+ rootCondition.AddObjectConditionL( *iAlbumObjectDef );
+ rootCondition.AddPropertyConditionL( *iTypePropertyDef,
+ TMdEIntRange( MdeConstants::Album::EAlbumUser, MdeConstants::Album::EAlbumUser,
+ EMdERangeTypeEqual ) );
+
+ iAlbumQuery->FindL();
+
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums::DoGetAlbumsL() exit");
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsAlbums::GetAlbumContentIdsL
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsAlbums::GetAlbumContentIdsL( TUint32 aAlbumId,
+ RArray<TVcxMyVideosAlbumVideo>& aContentArray,
+ MVcxMyVideosMdsAlbumsObserver& aClient )
+ {
+ CVcxMyVideosMdsCmdGetAlbumContentIds* cmd = new (ELeave) CVcxMyVideosMdsCmdGetAlbumContentIds;
+ CleanupStack::PushL( cmd ); // 1->
+ cmd->iCmdType = CVcxMyVideosMdsDb::EGetAlbumContentIds;
+ cmd->iClient = &aClient;
+ cmd->iAlbumId = aAlbumId;
+ cmd->iAlbumContent = &aContentArray;
+ iMdsDb.iCmdQueue->ExecuteCmdL( cmd ); //owneship moves
+ CleanupStack::Pop( cmd ); // <-1
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsAlbums::DoGetAlbumContentIdsL
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsAlbums::DoGetAlbumContentIdsL( TUint32 aAlbumId,
+ RArray<TVcxMyVideosAlbumVideo>& aContentArray,
+ MVcxMyVideosMdsAlbumsObserver& aClient )
+ {
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums::DoGetAlbumContentIdsL() start");
+
+ delete iRelationQuery;
+ iRelationQuery = NULL;
+
+ iClient = &aClient;
+ iAlbumId = aAlbumId;
+ iAlbumContent = &aContentArray;
+
+ iRelationQuery = iMdsDb.iMdsSession->NewRelationQueryL( *iNamespaceDef, this );
+
+ CMdELogicCondition& rootCondition = iRelationQuery->Conditions();
+
+ //relation left side contains and...
+ CMdERelationCondition& relationCondition =
+ rootCondition.AddRelationConditionL( *iContainsRelationDef, ERelationConditionSideLeft); // "AND"
+
+ CMdELogicCondition& leftCondition = relationCondition.LeftL();
+ CMdELogicCondition& rightCondition = relationCondition.RightL();
+
+ //...left side is album...
+ leftCondition.AddObjectConditionL( *iAlbumObjectDef );
+ //...and left id is aAlbumId..
+ leftCondition.AddObjectConditionL( aAlbumId );
+
+ //Right side is video
+ rightCondition.AddObjectConditionL( *iMdsDb.iVideoObjectDef );
+
+ iRelationQuery->FindL();
+
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums::DoGetAlbumContentIdsL() exit");
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsAlbums::GetAlbumContentVideosL
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsAlbums::GetAlbumContentVideosL( TUint32 aAlbumId, CMPXMedia& aVideoList,
+ MVcxMyVideosMdsAlbumsObserver& aClient )
+ {
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums::GetAlbumContentVideosL() start");
+
+ CVcxMyVideosMdsCmdGetAlbumContentVideos* cmd = new (ELeave) CVcxMyVideosMdsCmdGetAlbumContentVideos;
+ CleanupStack::PushL( cmd ); // 1->
+ cmd->iCmdType = CVcxMyVideosMdsDb::EGetAlbumContentVideos;
+ cmd->iClient = &aClient;
+ cmd->iAlbumId = aAlbumId;
+ cmd->iAlbumContentVideos = &aVideoList;
+ iMdsDb.iCmdQueue->ExecuteCmdL( cmd ); //owneship moves
+ CleanupStack::Pop( cmd ); // <-1
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums::GetAlbumContentVideosL() exit");
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsAlbums::DoGetAlbumContentVideosL
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsAlbums::DoGetAlbumContentVideosL( TUint32 aAlbumId, CMPXMedia& aVideoList,
+ MVcxMyVideosMdsAlbumsObserver& aClient )
+ {
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums::DoGetAlbumContentVideosL() start");
+
+ delete iVideoQuery;
+ iVideoQuery = NULL;
+
+ iClient = &aClient;
+ iVideoList = &aVideoList;
+ iAlbumId = aAlbumId;
+
+ iVideoQuery = iMdsDb.iMdsSession->NewObjectQueryL( *iNamespaceDef, *iMdsDb.iVideoObjectDef, this );
+ CMdELogicCondition& rootCondition = iVideoQuery->Conditions();
+ CMdERelationCondition& relationCondition =
+ rootCondition.AddRelationConditionL( *iContainsRelationDef );
+
+ CMdELogicCondition& leftCondition = relationCondition.LeftL();
+ CMdELogicCondition& rightCondition = relationCondition.RightL();
+
+ //...left side is an album...
+ leftCondition.AddObjectConditionL( *iAlbumObjectDef );
+ //...and left id is aAlbumId..
+ leftCondition.AddObjectConditionL( aAlbumId );
+
+ //and queried object is on the right side of the relation
+ relationCondition.SetSide( ERelationConditionSideRight );
+
+ const TInt maxItemsInQueryResult = 500;
+ iVideoQuery->FindL( KMdEQueryDefaultMaxCount, maxItemsInQueryResult );
+
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums::DoGetAlbumContentVideosL() exit");
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsAlbums::GetSchemaDefinitionsL
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsAlbums::GetSchemaDefinitionsL()
+ {
+ iNamespaceDef = &(iMdsDb.iMdsSession->GetDefaultNamespaceDefL());
+
+ _LIT( KVcxAlbumObjectName, "Album" );
+ iAlbumObjectDef = &(iNamespaceDef->GetObjectDefL( KVcxAlbumObjectName ));
+
+ _LIT( KVcxTypePropertyName, "Type" );
+ iTypePropertyDef = &(iAlbumObjectDef->GetPropertyDefL( KVcxTypePropertyName ));
+
+ _LIT( KVcxContainsRelationName, "Contains" );
+ iContainsRelationDef =
+ &(iNamespaceDef->GetRelationDefL( KVcxContainsRelationName ));
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsAlbums::Object2MediaL
+// For album objects only.
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsAlbums::Object2MediaL(
+ CMdEObject& aObject,
+ CMPXMedia& aAlbum )
+ {
+ aAlbum.SetTObjectValueL<TMPXGeneralType>(KMPXMediaGeneralType, EMPXGroup );
+
+ CMdEProperty* property = NULL;
+
+ // ID
+ TMPXItemId mpxId;
+ mpxId.iId1 = aObject.Id();
+ mpxId.iId2 = 2;
+ aAlbum.SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, mpxId );
+
+ // TITLE
+ if ( aObject.Property( *iMdsDb.iTitlePropertyDef, property, 0 ) != KErrNotFound )
+ {
+ aAlbum.SetTextValueL( KMPXMediaGeneralTitle,
+ static_cast<CMdETextProperty*>(property)->Value());
+ }
+
+ // CREATION DATE
+ if ( aObject.Property( *iMdsDb.iCreationDatePropertyDef, property, 0 ) != KErrNotFound )
+ {
+ aAlbum.SetTObjectValueL<TInt64>( KMPXMediaGeneralDate,
+ static_cast<CMdETimeProperty*>(property)->Value().Int64() );
+ }
+
+ // MODIFIED DATE
+ if ( aObject.Property( *iMdsDb.iLastModifiedDatePropertyDef, property, 0 ) != KErrNotFound )
+ {
+ aAlbum.SetTObjectValueL<TInt64>( KVcxMediaMyVideosModifiedDate,
+ static_cast<CMdETimeProperty*>(property)->Value().Int64() );
+ }
+
+#if 0 //TODO
+ // ALBUM TYPE
+ if ( aObject.Property( *iTypePropertyDef, property, 0 ) != KErrNotFound )
+ {
+ aAlbum.SetTObjectValueL<TUint16>( KVcxMediaMyVideosAlbumType,
+ static_cast<CMdETUint16Property*>(property)->Value() );
+ }
+#endif
+
+ //TODO: usage count
+
+ aAlbum.SetTObjectValueL( KMPXMediaGeneralType, EMPXGroup );
+ aAlbum.SetTObjectValueL( KMPXMediaGeneralCategory, EMPXNoCategory );
+ aAlbum.SetTObjectValueL( KVcxMediaMyVideosCategoryItemCount, 0 );
+ aAlbum.SetTObjectValueL( KVcxMediaMyVideosCategoryNewItemCount, 0 );
+
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsAlbums::Media2ObjectL
+// Called by AddAlbumL()
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsAlbums::Media2ObjectL(
+ CMPXMedia& aAlbum,
+ CMdEObject& aObject)
+ {
+ CMdEProperty* property;
+
+ // MDS ID
+
+ // TITLE (NAME)
+ if ( aAlbum.IsSupported( KMPXMediaGeneralTitle ) )
+ {
+ if ( aObject.Property( *iMdsDb.iTitlePropertyDef, property, 0 ) != KErrNotFound )
+ {
+ static_cast<CMdETextProperty*>(property)->SetValueL(
+ aAlbum.ValueText( KMPXMediaGeneralTitle ) );
+ }
+ else
+ {
+ aObject.AddTextPropertyL(
+ *iMdsDb.iTitlePropertyDef, aAlbum.ValueText( KMPXMediaGeneralTitle ) );
+ }
+ }
+
+ // KMPXMediaGeneralDate ( creation date )
+ if ( aAlbum.IsSupported( KMPXMediaGeneralDate ) )
+ {
+ TInt64 creationDateInt64 = 0;
+ creationDateInt64 = aAlbum.ValueTObjectL<TInt64>( KMPXMediaGeneralDate );
+ TTime creationDate( creationDateInt64 );
+ if ( aObject.Property( *iMdsDb.iCreationDatePropertyDef, property, 0 ) != KErrNotFound )
+ {
+ static_cast<CMdETimeProperty*>(property)->SetValueL( creationDate );
+ }
+ else
+ {
+ aObject.AddTimePropertyL( *iMdsDb.iCreationDatePropertyDef, creationDate );
+ }
+ }
+
+ // KVcxMediaMyVideosModifiedDate
+ if ( aAlbum.IsSupported( KVcxMediaMyVideosModifiedDate ) )
+ {
+ TInt64 modifiedDateInt64 = aAlbum.ValueTObjectL<TInt64>( KVcxMediaMyVideosModifiedDate );
+ TTime modifiedDate( modifiedDateInt64 );
+ if ( aObject.Property( *iMdsDb.iLastModifiedDatePropertyDef, property, 0 ) != KErrNotFound )
+ {
+ static_cast<CMdETimeProperty*>(property)->SetValueL( modifiedDate );
+ }
+ else
+ {
+ aObject.AddTimePropertyL( *iMdsDb.iLastModifiedDatePropertyDef, modifiedDate );
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsAlbums::GetSchemaDefinitionsL
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsAlbums::HandleQueryNewResults(CMdEQuery& aQuery,
+ TInt aFirstNewItemIndex,
+ TInt aNewItemCount )
+ {
+ if ( &aQuery == iVideoQuery )
+ {
+ TRAPD( err, HandleVideoQueryResultsL( aQuery, KErrNone,
+ aFirstNewItemIndex, aNewItemCount, EFalse /* completed */ ) );
+ if ( err != KErrNone )
+ {
+ MPX_DEBUG2("CVcxMyVideosMdsAlbums:: HandleVideoQueryResultsL() left: %d", err);
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsAlbums::HandleQueryCompleted
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsAlbums::HandleQueryCompleted( CMdEQuery& aQuery, TInt aError )
+ {
+ if ( &aQuery == iAlbumQuery )
+ {
+ TRAPD( err, HandleAlbumQueryCompletedL( aQuery, aError ) );
+ if ( err != KErrNone )
+ {
+ MPX_DEBUG2("CVcxMyVideosMdsAlbums:: HandleAlbumQueryCompletedL() left: %d", err);
+ }
+ }
+ else if ( &aQuery == iVideoQuery )
+ {
+ TRAPD( err, HandleVideoQueryResultsL( aQuery, aError, 0, 0, ETrue /* completed */ ) );
+ if ( err != KErrNone )
+ {
+ MPX_DEBUG2("CVcxMyVideosMdsAlbums:: HandleVideoQueryResultsL() left: %d", err);
+ }
+ }
+ else if ( &aQuery == iRelationQuery )
+ {
+ TRAPD( err, HandleRelationQueryCompletedL( aQuery, aError ) );
+ if ( err != KErrNone )
+ {
+ MPX_DEBUG2("CVcxMyVideosMdsAlbums:: HandleRelationQueryCompletedL() left: %d", err);
+ }
+ }
+
+ iMdsDb.iCmdQueue->CmdFinished();
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsAlbums::HandleAlbumQueryCompletedL
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsAlbums::HandleAlbumQueryCompletedL( CMdEQuery& /*aQuery*/, TInt aError )
+ {
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums::HandleAlbumQueryCompletedL() start");
+
+ if ( aError != KErrNone )
+ {
+ MPX_DEBUG2("CVcxMyVideosMdsAlbums:: object query failed with error: %d", aError);
+ return;
+ }
+
+ CMPXMediaArray* array = iAlbumList->Value<CMPXMediaArray>( KMPXMediaArrayContents );
+
+ CMPXMedia* media;
+ TInt count = iAlbumQuery->Count();
+
+ iAlbumList->SetTObjectValueL<TInt>( KMPXMediaArrayCount, count );
+
+ for ( TInt i = 0; i < count; i++ )
+ {
+ CMdEObject& object = iAlbumQuery->Result( i );
+
+ media = CMPXMedia::NewL();
+ CleanupStack::PushL( media ); // 1->
+
+ Object2MediaL( object, *media );
+
+#ifdef _DEBUG
+ TBuf<200> title;
+ title = TVcxMyVideosCollectionUtil::Title( *media );
+ MPX_DEBUG2("CVcxMyVideosMdsAlbums:: object title: %S", &title);
+#endif
+
+ array->AppendL( media );
+
+ CleanupStack::Pop( media ); // <-1
+ }
+
+ iClient->HandleGetAlbumsResp( iAlbumList );
+ iAlbumList = NULL;
+
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums::HandleAlbumQueryCompletedL() exit");
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsAlbums::HandleVideoQueryCompletedL
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsAlbums::HandleVideoQueryResultsL( CMdEQuery& /*aQuery*/, TInt aError,
+ TInt aFirstNewItemIndex, TInt aNewItemCount, TBool aComplete )
+ {
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums::HandleVideoQueryResultsL() start");
+
+ if ( aComplete )
+ {
+ // error code given only if completed
+ if ( aError != KErrNone )
+ {
+ MPX_DEBUG2("CVcxMyVideosMdsAlbums:: object query failed with error: %d", aError);
+ }
+
+ iClient->HandleGetAlbumContentVideosResp( iAlbumId, *iVideoList,
+ aError, aFirstNewItemIndex, aNewItemCount, aComplete );
+ return;
+ }
+
+ CMPXMediaArray* array = iVideoList->Value<CMPXMediaArray>( KMPXMediaArrayContents );
+
+ CMPXMedia* media;
+ TInt count = iVideoQuery->Count();
+
+ iVideoList->SetTObjectValueL<TInt>( KMPXMediaArrayCount, count );
+
+ for ( TInt i = aFirstNewItemIndex; i < count; i++ )
+ {
+ CMdEObject& object = iVideoQuery->Result( i );
+
+ media = CMPXMedia::NewL();
+ CleanupStack::PushL( media ); // 1->
+
+ iMdsDb.Object2MediaL( object, *media );
+
+#ifdef _DEBUG
+ TBuf<200> title;
+ title = TVcxMyVideosCollectionUtil::Title( *media );
+ MPX_DEBUG2("CVcxMyVideosMdsAlbums:: object title: %S", &title);
+#endif
+
+ array->AppendL( media );
+
+ CleanupStack::Pop( media ); // <-1
+ }
+
+ iClient->HandleGetAlbumContentVideosResp( iAlbumId, *iVideoList,
+ aError, aFirstNewItemIndex, aNewItemCount, aComplete );
+ iVideoList = NULL;
+
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums::HandleVideoQueryResultsL() exit");
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsAlbums::HandleRelationQueryCompletedL
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsAlbums::HandleRelationQueryCompletedL( CMdEQuery& /*aQuery*/, TInt aError )
+ {
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums::HandleRelationQueryCompletedL() start");
+
+ if ( aError != KErrNone )
+ {
+ MPX_DEBUG2("CVcxMyVideosMdsAlbums:: relation query failed with error: %d", aError);
+ return;
+ }
+
+ TInt count = iRelationQuery->Count();
+ TVcxMyVideosAlbumVideo video;
+ for ( TInt i = 0; i < count; i++ )
+ {
+ MPX_DEBUG4("Relation (id = %d): %d contains %d", iRelationQuery->Result( i ).Id(),
+ iRelationQuery->Result( i ).LeftObjectId(),
+ iRelationQuery->Result( i ).RightObjectId());
+ video.iMdsId = iRelationQuery->Result( i ).RightObjectId();
+ video.iRelationMdsId = iRelationQuery->Result( i ).Id();
+ iAlbumContent->AppendL( video );
+ }
+
+ iClient->HandleGetAlbumContentIdsResp( iAlbumId, *iAlbumContent );
+
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums::HandleRelationQueryCompletedL() exit");
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsAlbums::AddVideosToAlbumL
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsAlbums::AddVideosToAlbumL( CMPXMedia* aCmd,
+ MVcxMyVideosMdsAlbumsObserver& aClient )
+ {
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums::AddVideosToAlbumL() start");
+
+ CVcxMyVideosMdsCmdAddVideosToAlbum* cmd = new (ELeave) CVcxMyVideosMdsCmdAddVideosToAlbum;
+ CleanupStack::PushL( cmd ); // 1->
+ cmd->iCmdType = CVcxMyVideosMdsDb::EAddVideosToAlbum;
+ cmd->iClient = &aClient;
+ cmd->iMpxCmd = aCmd;
+ iMdsDb.iCmdQueue->ExecuteCmdL( cmd ); //owneship moves
+ CleanupStack::Pop( cmd ); // <-1
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums::AddVideosToAlbumL() exit");
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsAlbums::DoAddVideosToAlbumL
+// Called by iMdsDb.iCmdQueue
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsAlbums::DoAddVideosToAlbumL( CMPXMedia* aCmd,
+ MVcxMyVideosMdsAlbumsObserver& aClient )
+ {
+ iItemArray.Reset();
+ iResultBuffer.Close();
+ CMdERelation* relation;
+ CMPXMediaArray* videoArray = TVcxMyVideosCollectionUtil::MediaArrayL( *aCmd );
+
+ TInt albumId = TVcxMyVideosCollectionUtil::Uint32ValueL( *aCmd );
+
+ TInt count = videoArray->Count();
+ iItemArray.Reserve( count );
+ for ( TInt i = 0; i < count; i++ )
+ {
+ relation = iMdsDb.iMdsSession->NewRelationL(
+ *iContainsRelationDef, albumId,
+ TVcxMyVideosCollectionUtil::IdL( *videoArray->AtL( i ) ) );
+ CleanupStack::PushL( relation );
+ iItemArray.AppendL( relation );
+ CleanupStack::Pop( relation );
+ }
+
+ iClient = &aClient;
+ iMpxCmd = aCmd;
+
+ iAsyncOperation = EVcxAddVideosToAlbum;
+
+ iMdsDb.iMdsSession->AddItemsAsyncL( iItemArray, iStatus, iResultBuffer );
+ SetActive();
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsAlbums::RemoveRelationsL
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsAlbums::RemoveRelationsL( RArray<TUint32>& aRelationIds,
+ RArray<TUint32>& aResults, MVcxMyVideosMdsAlbumsObserver& aClient )
+ {
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums::RemoveRelationsL() start");
+
+ CVcxMyVideosMdsCmdRemoveRelations* cmd = new (ELeave) CVcxMyVideosMdsCmdRemoveRelations;
+ CleanupStack::PushL( cmd ); // 1->
+ cmd->iCmdType = CVcxMyVideosMdsDb::ERemoveRelations;
+ cmd->iClient = &aClient;
+ cmd->iRelationIds = &aRelationIds;
+ cmd->iResults = &aResults;
+ iMdsDb.iCmdQueue->ExecuteCmdL( cmd ); //owneship moves
+ CleanupStack::Pop( cmd ); // <-1
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums::RemoveRelationsL() exit");
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsAlbums::DoRemoveRelationsL
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsAlbums::DoRemoveRelationsL( RArray<TUint32>& aRelationIds,
+ RArray<TUint32>& aResults, MVcxMyVideosMdsAlbumsObserver& aClient )
+ {
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums::DoRemoveRelationsL() start");
+
+ iResultBuffer.Close();
+
+ iClient = &aClient;
+ iResultArrayUint32 = &aResults;
+ iIdArray = &aRelationIds;
+
+ iAsyncOperation = EVcxRemoveRelations;
+
+ iMdsDb.iMdsSession->RemoveRelationsAsyncL( *iIdArray, iStatus, iResultBuffer, iNamespaceDef );
+ SetActive();
+
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums::DoRemoveRelationsL() exit");
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsAlbums::AddAlbumL
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsAlbums::AddAlbumL( CMPXMedia& aAlbum )
+ {
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums::AddAlbumL() start");
+
+ if ( !iMdsDb.iMdsSession )
+ {
+ MPX_DEBUG2("CVcxMyVideosMdsAlbums:: no mds session(%d), leaving", iMdsDb.iMdsError);
+ User::Leave( iMdsDb.iMdsError );
+ }
+
+ CMdEObject* object = iMdsDb.iMdsSession->NewObjectLC(
+ *iAlbumObjectDef, KNullDesC ); // 1->
+
+ Media2ObjectL( aAlbum, *object );
+ iMdsDb.SetCreationAndModifiedDatesL( *object );
+
+ TUint32 mdsId;
+
+#ifdef _DEBUG
+ TRAPD( err, mdsId = iMdsDb.iMdsSession->AddObjectL( *object ) );
+
+ if ( err != KErrNone )
+ {
+ MPX_DEBUG2( "CVcxMyVideosMdsAlbums:: iMdsDb.iMdsSession->AddObjectL leaved with error: %d", err );
+ User::Leave( err );
+ }
+#else
+
+ mdsId = iMdsDb.iMdsSession->AddObjectL( *object );
+
+#endif
+
+ if ( mdsId == KNoId )
+ {
+ MPX_DEBUG1( "CVcxMyVideosMdsAlbums::AddAlbumL could not add new album" );
+ User::Leave( KErrGeneral );
+ }
+
+ MPX_DEBUG2( "CVcxMyVideosMdsAlbums::AddAlbumL album created, mds id: %d", mdsId );
+
+ aAlbum.SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, TMPXItemId( mdsId, KVcxMvcMediaTypeAlbum ) );
+
+ CleanupStack::PopAndDestroy( object ); // <-1
+
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums::AddAlbumL() exit");
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsAlbums::RemoveAlbumsL
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsAlbums::RemoveAlbumsL( CMPXMedia* aMpxCmd, MVcxMyVideosMdsAlbumsObserver& aClient )
+ {
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums::RemoveAlbumsL() start");
+
+ CVcxMyVideosMdsCmdRemoveAlbums* cmd = new (ELeave) CVcxMyVideosMdsCmdRemoveAlbums;
+ CleanupStack::PushL( cmd ); // 1->
+ cmd->iCmdType = CVcxMyVideosMdsDb::ERemoveAlbums;
+ cmd->iClient = &aClient;
+ cmd->iMpxCmd = aMpxCmd;
+ iMdsDb.iCmdQueue->ExecuteCmdL( cmd ); //owneship moves
+ CleanupStack::Pop( cmd ); // <-1
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums::RemoveAlbumsL() exit");
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsAlbums::DoRemoveAlbumsL
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsAlbums::DoRemoveAlbumsL( CMPXMedia* aMpxCmd,
+ MVcxMyVideosMdsAlbumsObserver& aClient )
+ {
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums::DoRemoveAlbumsL() start");
+
+ iResultBuffer.Close();
+
+ iClient = &aClient;
+ iMpxCmd = aMpxCmd;
+
+ RArray<TUint32> idArray;
+ CleanupClosePushL( idArray );
+
+ CMPXMediaArray* mediaArray = TVcxMyVideosCollectionUtil::MediaArrayL( *aMpxCmd );
+
+ TVcxMyVideosCollectionUtil::GetIdsFromMediaArrayL( *mediaArray, idArray );
+
+ iAsyncOperation = EVcxRemoveAlbums;
+
+ iMdsDb.iMdsSession->RemoveObjectsAsyncL( idArray, iStatus, iResultBuffer, iNamespaceDef );
+
+ CleanupStack::PopAndDestroy( &idArray );
+ SetActive();
+
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums::DoRemoveAlbumsL() exit");
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsAlbums::RunL
+// From CActive.
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsAlbums::RunL()
+ {
+#ifdef _DEBUG
+ TInt status = iStatus.Int();
+ if ( status != KErrNone )
+ {
+ MPX_DEBUG2("CVcxMyVideosMdsAlbums::RunL() iStatus = %d", status);
+ }
+#endif
+
+ switch ( iAsyncOperation )
+ {
+ case EVcxAddVideosToAlbum:
+ {
+ HandleAddVideosToAlbumCompletedL();
+ }
+ break;
+
+ case EVcxRemoveRelations:
+ HandleRemoveRelationsCompletedL();
+ break;
+
+ case EVcxRemoveAlbums:
+ HandleRemoveAlbumsCompletedL();
+ break;
+ }
+
+ iMdsDb.iCmdQueue->CmdFinished();
+ }
+
+//TODO: implement RunError
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsAlbums::RunL
+// From CActive.
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsAlbums::DoCancel()
+ {
+ //TODO:
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsAlbums::HandleAddVideosToAlbumCompletedL
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsAlbums::HandleAddVideosToAlbumCompletedL()
+ {
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums::HandleAddVideosToAlbumCompletedL() start");
+
+ iMdsDb.iMdsSession->DeserializeItemsL( iResultBuffer, iItemArray );
+
+ iClient->HandleAddVideosToAlbumResp( iMpxCmd, iItemArray );
+ iResultBuffer.Close();
+ iItemArray.Close();
+
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums::HandleAddVideosToAlbumCompletedL() exit");
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsAlbums::HandleRemoveRelationsCompletedL
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsAlbums::HandleRemoveRelationsCompletedL()
+ {
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums::HandleRemoveRelationsCompletedL() start");
+
+ iMdsDb.iMdsSession->DeserializeIdsL( iResultBuffer, NULL, NULL, iResultArrayUint32 );
+
+#ifdef _DEBUG
+ TItemId result;
+ TInt count = iResultArrayUint32->Count();
+ for ( TInt i = 0; i < count; i++ )
+ {
+ result = (*iResultArrayUint32)[i];
+ MPX_DEBUG3("relation remove result[%d] = %d", i, result);
+ }
+#endif
+
+ iClient->HandleRemoveRelationsResp( *iIdArray, *iResultArrayUint32 );
+
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums::HandleRemoveRelationsCompletedL() exit");
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsAlbums::HandleRemoveAlbumsCompletedL
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsAlbums::HandleRemoveAlbumsCompletedL()
+ {
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums::HandleRemoveAlbumsCompletedL() start");
+
+ RArray<TUint32> resultArray;
+ resultArray.Reset();
+ CleanupClosePushL( resultArray );
+
+ iMdsDb.iMdsSession->DeserializeIdsL( iResultBuffer, &resultArray, NULL, NULL );
+
+#ifdef _DEBUG
+ TItemId result;
+ TInt count = resultArray.Count();
+
+ MPX_DEBUG2("CVcxMyVideosMdsAlbums:: remove albums result count = %d", count);
+
+ for ( TInt i = 0; i < count; i++ )
+ {
+ result = resultArray[i];
+ MPX_DEBUG3("CVcxMyVideosMdsAlbums:: remove albums result[%d] = %d", i, result);
+ }
+#endif
+
+ iClient->HandleRemoveAlbumsResp( iMpxCmd, resultArray );
+
+ CleanupStack::PopAndDestroy( &resultArray );
+
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums::HandleRemoveRelationsCompletedL() exit");
+ }
+
+// ----------------------------------------------------------------------------
+// CVcxMyVideosMdsAlbums::HandleRelationItemNotification
+// From MMdERelationItemObserver
+// ----------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsAlbums::HandleRelationItemNotification(CMdESession& /*aSession*/,
+ TObserverNotificationType aType,
+ const RArray<TMdERelation>& aRelationArray)
+ {
+ iObserver->HandleRelationEvent( aType, aRelationArray );
+ }
+
+#if 0 //not used
+// ----------------------------------------------------------------------------
+// CVcxMyVideosMdsAlbums::HandleRelationNotification
+// From MMdERelationObserver
+// ----------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsAlbums::HandleRelationNotification(CMdESession& /*aSession*/,
+ TObserverNotificationType aType,
+ const RArray<TItemId>& aRelationIdArray)
+ {
+ iObserver->HandleRelationIdEvent( aType, aRelationIdArray );
+
+ switch ( aType )
+ {
+ case ENotifyAdd:
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums:: ENotifyAdd");
+ break;
+ case ENotifyModify:
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums:: ENotifyModify");
+ break;
+ case ENotifyRemove:
+ MPX_DEBUG1("CVcxMyVideosMdsAlbums:: ENotifyRemove");
+ break;
+ }
+ }
+#endif
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideosmdscmdqueue.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,231 @@
+/*
+* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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: Queues commands to MDS.
+*
+*/
+
+
+// INCLUDE FILES
+#include <e32base.h>
+#include <mpxlog.h>
+#include "vcxmyvideosmdscmdqueue.h"
+#include "vcxmyvideosmdsdb.h"
+#include "vcxmyvideosmdsalbums.h"
+
+
+// ============================ MEMBER FUNCTIONS =============================
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+CVcxMyVideosMdsCmdQueue::CVcxMyVideosMdsCmdQueue( CVcxMyVideosMdsDb& aMdsDb )
+: iMdsDb( aMdsDb )
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// 2nd-phase constructor
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsCmdQueue::ConstructL()
+ {
+ iQueue.Reset();
+ }
+
+// ---------------------------------------------------------------------------
+// Two-Phase Constructor
+// ---------------------------------------------------------------------------
+//
+CVcxMyVideosMdsCmdQueue* CVcxMyVideosMdsCmdQueue::NewL( CVcxMyVideosMdsDb& aMdsDb )
+ {
+ CVcxMyVideosMdsCmdQueue* self = new(ELeave) CVcxMyVideosMdsCmdQueue( aMdsDb );
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+CVcxMyVideosMdsCmdQueue::~CVcxMyVideosMdsCmdQueue()
+ {
+ for ( TInt i = 0; i < iQueue.Count(); i++ )
+ {
+ delete iQueue[i];
+ }
+ iQueue.Close();
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsCmdQueue::Cancel
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsCmdQueue::Cancel( CVcxMyVideosMdsDb::TRequestType aType )
+ {
+ TInt count = iQueue.Count()-1;
+ for ( TInt i = count; i >= 0; i-- )
+ {
+ if ( iQueue[i]->iCmdType == aType || aType == CVcxMyVideosMdsDb::EAll )
+ {
+ delete iQueue[i];
+ iQueue[i] = NULL;
+ iQueue.Remove( i );
+ }
+ }
+ iQueue.Compress();
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsCmdQueue::ExecuteCmdL
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsCmdQueue::ExecuteCmdL( CVcxMyVideosMdsCmd* aCmd )
+ {
+ if ( iQueue.Count() == 0 && !iCmdInProgress )
+ {
+ DoExecuteCmdL( aCmd ); //ownership does not move
+ delete aCmd;
+ }
+ else
+ {
+ iQueue.AppendL( aCmd );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsCmdQueue::CmdFinished
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsCmdQueue::CmdFinished()
+ {
+ iCmdInProgress = EFalse;
+
+ TInt err( KErrGeneral );
+ while ( err != KErrNone )
+ {
+ if ( iQueue.Count() == 0 )
+ {
+ break;
+ }
+
+ TInt cmdIndexToExecute;
+ // Let other commads bypass EGetVideoList
+ if ( iQueue.Count() > 1 && iQueue[0]->iCmdType == CVcxMyVideosMdsDb::EGetVideoList )
+ {
+ cmdIndexToExecute = 1;
+ }
+ else
+ {
+ cmdIndexToExecute = 0;
+ }
+ TRAP( err, DoExecuteCmdL( iQueue[cmdIndexToExecute] ) ); //ownership does not move
+ delete iQueue[cmdIndexToExecute];
+ iQueue[cmdIndexToExecute] = NULL;
+ iQueue.Remove( cmdIndexToExecute );
+ iQueue.Compress();
+
+#ifdef _DEBUG
+ if ( err != KErrNone )
+ {
+ MPX_DEBUG2("CVcxMyVideosMdsCmdQueue:: MDS cmd failed: %d", err);
+ }
+#endif
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsCmdQueue::DoExecuteCmdL
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsCmdQueue::DoExecuteCmdL( CVcxMyVideosMdsCmd* aCmd )
+ {
+ switch ( aCmd->iCmdType )
+ {
+ case CVcxMyVideosMdsDb::EGetVideoList:
+ {
+ CVcxMyVideosMdsCmdGetVideoList* cmd =
+ static_cast<CVcxMyVideosMdsCmdGetVideoList*>( aCmd );
+ iMdsDb.DoCreateVideoListL( cmd->iSortingOrder,
+ cmd->iAscending,
+ cmd->iFullDetails,
+ *cmd->iVideoList );
+ iCmdInProgress = ETrue;
+ }
+ break;
+
+ case CVcxMyVideosMdsDb::EGetAlbums:
+ {
+ CVcxMyVideosMdsCmdGetAlbums* cmd = static_cast<CVcxMyVideosMdsCmdGetAlbums*>( aCmd );
+ iMdsDb.iAlbums->DoGetAlbumsL( cmd->iAlbumList, *cmd->iClient );
+ iCmdInProgress = ETrue;
+ }
+ break;
+
+ case CVcxMyVideosMdsDb::EGetAlbumContentIds:
+ {
+ CVcxMyVideosMdsCmdGetAlbumContentIds* cmd =
+ static_cast<CVcxMyVideosMdsCmdGetAlbumContentIds*>( aCmd );
+ iMdsDb.iAlbums->DoGetAlbumContentIdsL( cmd->iAlbumId, *cmd->iAlbumContent,
+ *cmd->iClient );
+ iCmdInProgress = ETrue;
+ }
+ break;
+
+ case CVcxMyVideosMdsDb::EGetAlbumContentVideos:
+ {
+ CVcxMyVideosMdsCmdGetAlbumContentVideos* cmd =
+ static_cast<CVcxMyVideosMdsCmdGetAlbumContentVideos*>( aCmd );
+ iMdsDb.iAlbums->DoGetAlbumContentVideosL( cmd->iAlbumId, *cmd->iAlbumContentVideos,
+ *cmd->iClient );
+ iCmdInProgress = ETrue;
+ }
+ break;
+
+ case CVcxMyVideosMdsDb::EAddVideosToAlbum:
+ {
+ CVcxMyVideosMdsCmdAddVideosToAlbum* cmd =
+ static_cast<CVcxMyVideosMdsCmdAddVideosToAlbum*>( aCmd );
+ iMdsDb.iAlbums->DoAddVideosToAlbumL( cmd->iMpxCmd,
+ *cmd->iClient );
+ iCmdInProgress = ETrue;
+ }
+ break;
+
+ case CVcxMyVideosMdsDb::ERemoveRelations:
+ {
+ CVcxMyVideosMdsCmdRemoveRelations* cmd =
+ static_cast<CVcxMyVideosMdsCmdRemoveRelations*>( aCmd );
+ iMdsDb.iAlbums->DoRemoveRelationsL( *cmd->iRelationIds, *cmd->iResults,
+ *cmd->iClient );
+ iCmdInProgress = ETrue;
+ }
+ break;
+
+ case CVcxMyVideosMdsDb::ERemoveAlbums:
+ {
+ CVcxMyVideosMdsCmdRemoveAlbums* cmd =
+ static_cast<CVcxMyVideosMdsCmdRemoveAlbums*>( aCmd );
+ iMdsDb.iAlbums->DoRemoveAlbumsL( cmd->iMpxCmd, *cmd->iClient );
+ iCmdInProgress = ETrue;
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+// END OF FILE
--- a/videocollection/mpxmyvideoscollection/src/vcxmyvideosmdsdb.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideosmdsdb.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -56,7 +56,6 @@
_LIT( KVcxOriginPropertyName, "Origin" ); //16
_LIT( KVcxDurationPropertyName, "Duration" ); //17
_LIT( KVcxLastPlayPositionPropertyName, "LastPlayPosition" ); //10
-_LIT( KVcxDownloadIdPropertyName, "DownloadID" ); //18
_LIT( KVcxRatingPropertyName, "Rating" ); //19
_LIT( KVcxBitratePropertyName, "Bitrate" ); //20
_LIT( KVcxAudioFourCcPropertyName, "AudioFourCC" ); //21
@@ -68,8 +67,9 @@
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
//
-CVcxMyVideosMdsDb::CVcxMyVideosMdsDb( MVcxMyVideosMdsDbObserver* aObserver, RFs& aFs )
-: iFs( aFs ), iMdsDbObserver(aObserver)
+CVcxMyVideosMdsDb::CVcxMyVideosMdsDb( MVcxMyVideosMdsDbObserver* aObserver,
+ MVcxMyVideosMdsAlbumsObserver* aAlbumsObserver, RFs& aFs )
+: iFs( aFs ), iMdsDbObserver(aObserver), iAlbumsObserver(aAlbumsObserver)
{
}
@@ -129,7 +129,7 @@
iMdsSession->AddObjectPresentObserverL( *this );
- iAlbums = CVcxMyVideosMdsAlbums::NewL( *this );
+ iAlbums = CVcxMyVideosMdsAlbums::NewL( *this, iAlbumsObserver );
TCallBack callBack( AsyncHandleQueryCompleted, this );
iAsyncHandleQueryCompleteCaller = new (ELeave) CAsyncCallBack( callBack,
@@ -145,7 +145,6 @@
MPX_DEBUG1( "CVcxMyVideosMdsDb::--------------------------------------------------------------." );
MPX_DEBUG3( "CVcxMyVideosMdsDb::HandleObjectPresentNotification( aPresent = %1d, count = %3d) |", aPresent, aObjectIdArray.Count() );
MPX_DEBUG1( "CVcxMyVideosMdsDb::--------------------------------------------------------------'" );
- //iMdsDbObserver->HandleObjectPresentNotification();
TObserverNotificationType type;
if ( aPresent )
@@ -163,10 +162,11 @@
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
//
-CVcxMyVideosMdsDb* CVcxMyVideosMdsDb::NewL( MVcxMyVideosMdsDbObserver* aObserver, RFs& aFs )
+CVcxMyVideosMdsDb* CVcxMyVideosMdsDb::NewL( MVcxMyVideosMdsDbObserver* aObserver,
+ MVcxMyVideosMdsAlbumsObserver* aAlbumsObserver, RFs& aFs )
{
CVcxMyVideosMdsDb* self =
- CVcxMyVideosMdsDb::NewLC( aObserver, aFs );
+ CVcxMyVideosMdsDb::NewLC( aObserver, aAlbumsObserver, aFs );
CleanupStack::Pop( self );
return self;
}
@@ -175,10 +175,10 @@
// ---------------------------------------------------------------------------
// ---------------------------------------------------------------------------
//
-CVcxMyVideosMdsDb* CVcxMyVideosMdsDb::NewLC(
- MVcxMyVideosMdsDbObserver* aObserver, RFs& aFs )
+CVcxMyVideosMdsDb* CVcxMyVideosMdsDb::NewLC( MVcxMyVideosMdsDbObserver* aObserver,
+ MVcxMyVideosMdsAlbumsObserver* aAlbumsObserver, RFs& aFs )
{
- CVcxMyVideosMdsDb* self = new( ELeave ) CVcxMyVideosMdsDb( aObserver, aFs );
+ CVcxMyVideosMdsDb* self = new( ELeave ) CVcxMyVideosMdsDb( aObserver, aAlbumsObserver, aFs );
CleanupStack::PushL( self );
self->ConstructL();
return self;
@@ -250,18 +250,23 @@
*iVideoObjectDef, aVideo.ValueText( KMPXMediaGeneralUri ) ); // 1->
// check if the file exists and use the creation time from the file
-
+
+ SetCreationAndModifiedDatesL( *object );
+
+#if 0
TTime time;
time.UniversalTime();
TTimeIntervalSeconds timeOffset = User::UTCOffset();
TTime localTime = time + timeOffset;
-
+
+ const TInt secondsInMinute( 60 );
object->AddTimePropertyL( *iCreationDatePropertyDef, localTime );
- object->AddInt16PropertyL( *iTimeOffsetPropertyDef, timeOffset.Int() / 60 );
+ object->AddInt16PropertyL( *iTimeOffsetPropertyDef, timeOffset.Int() / secondsInMinute );
object->AddTimePropertyL( *iLastModifiedDatePropertyDef, localTime );
+#endif
object->AddUint8PropertyL( *iOriginPropertyDef,
aVideo.ValueTObjectL<TUint8>( KVcxMediaMyVideosOrigin ) );
-
+
CMdEProperty* property;
// Type can not be modified normally, so set it here
@@ -365,7 +370,7 @@
CMdEObject* object =
iMdsSession->OpenObjectL( mpxId.iId1, *iVideoObjectDef );
- if ( object == NULL )
+ if ( !object )
{
// No object with this ID was found!
MPX_DEBUG1("CVcxMyVideosMdsDb::UpdateVideoL no object found");
@@ -404,7 +409,8 @@
{
MPX_FUNC( "CVcxMyVideosMdsDb::CreateVideoListL" );
- CVcxMyVideosMdsCmdGetVideoList* cmd = CVcxMyVideosMdsCmdGetVideoList::NewL();
+ CVcxMyVideosMdsCmdGetVideoList* cmd = new (ELeave) CVcxMyVideosMdsCmdGetVideoList;
+ CleanupStack::PushL( cmd ); // 1->
cmd->iCmdType = CVcxMyVideosMdsDb::EGetVideoList;
cmd->iSortingOrder = aSortingOrder;
cmd->iAscending = aAscending;
@@ -412,6 +418,7 @@
cmd->iVideoList = &aVideoList;
iCmdQueue->ExecuteCmdL( cmd ); //ownership moves
+ CleanupStack::Pop( cmd ); // <-1
}
// ---------------------------------------------------------------------------
@@ -512,7 +519,8 @@
iFullDetails = aFullDetails;
- iVideoQuery->FindL(KMdEQueryDefaultMaxCount, 500);
+ const TInt maxItemsInQueryResult = 500;
+ iVideoQuery->FindL( KMdEQueryDefaultMaxCount, maxItemsInQueryResult );
aVideoList->SetTObjectValueL<TMPXGeneralType>( KMPXMediaGeneralType, EMPXGroup );
aVideoList->SetTObjectValueL( KMPXMediaArrayCount, mediaArray->Count() );
@@ -644,20 +652,21 @@
CMdEObject* object = ObjectL( aId );
- CMPXMedia* video = NULL;
-
- if ( object )
+ if ( !object )
{
- CleanupStack::PushL( object ); // 1->
+ MPX_DEBUG2("CVcxMyVideosMdsDb:: mds id %d not found from mds", aId);
+ User::Leave( KErrNotFound );
+ }
+
+ CleanupStack::PushL( object ); // 1->
- video = CMPXMedia::NewL( );
- CleanupStack::PushL( video ); // 2->
+ CMPXMedia* video = CMPXMedia::NewL( );
+ CleanupStack::PushL( video ); // 2->
- Object2MediaL( *object, *video, aFullDetails );
+ Object2MediaL( *object, *video, aFullDetails );
- CleanupStack::Pop( video ); // <-2
- CleanupStack::PopAndDestroy( object ); // <-1
- }
+ CleanupStack::Pop( video ); // <-2
+ CleanupStack::PopAndDestroy( object ); // <-1
return video;
}
@@ -704,8 +713,6 @@
{
MPX_DEBUG1( "CVcxMyVideosMdsDb:: Videolist fetching was going on");
iVideoListFetchingIsOngoing = EFalse;
-// delete iVideoQuery;
-// iVideoQuery = NULL;
iMdsDbObserver->HandleCreateVideoListResp( iVideoList, -1 /* -1 = no new items */,
ETrue /* complete */);
}
@@ -954,6 +961,7 @@
aVideo.SetTObjectValueL<TInt>( KMPXMediaGeneralLastPlaybackPosition, pos );
}
+#if 0
//18. DOWNLOAD ID (BRIEF)
if ( aObject.Property( *iDownloadIdPropertyDef, property, 0 ) != KErrNotFound )
{
@@ -964,7 +972,8 @@
{
aVideo.SetTObjectValueL<TUint32>( KVcxMediaMyVideosDownloadId, 0 );
}
-
+#endif
+
//19. RATING (FULL)
if ( aObject.Property( *iRatingPropertyDef, property, 0 ) != KErrNotFound
&& aFullDetails )
@@ -1320,7 +1329,8 @@
aObject.AddReal32PropertyL( *iLastPlayPositionPropertyDef, lastPlaybackPos );
}
}
-
+
+#if 0
// 18. DOWNLOAD ID
if ( aVideo.IsSupported( KVcxMediaMyVideosDownloadId ) )
{
@@ -1335,7 +1345,8 @@
aObject.AddUint32PropertyL( *iDownloadIdPropertyDef, dlId );
}
}
-
+#endif
+
// 19. RATING
if ( aVideo.IsSupported( KVcxMediaMyVideosRating ) )
{
@@ -1493,9 +1504,11 @@
iAudioLanguagePropertyDef = &(iVideoObjectDef->GetPropertyDefL(
KVcxAudioLanguagePropertyName )); //14
+#if 0
iDownloadIdPropertyDef = &(iVideoObjectDef->GetPropertyDefL(
KVcxDownloadIdPropertyName )); //18
-
+#endif
+
}
// ---------------------------------------------------------------------------
@@ -1536,3 +1549,19 @@
}
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsDb::SetCreationAndModifiedDatesL
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsDb::SetCreationAndModifiedDatesL( CMdEObject& aObject )
+ {
+ TTime time;
+ time.UniversalTime();
+ TTimeIntervalSeconds timeOffset = User::UTCOffset();
+ TTime localTime = time + timeOffset;
+
+ const TInt secondsInMinute( 60 );
+ aObject.AddTimePropertyL( *iCreationDatePropertyDef, localTime );
+ aObject.AddInt16PropertyL( *iTimeOffsetPropertyDef, timeOffset.Int() / secondsInMinute );
+ aObject.AddTimePropertyL( *iLastModifiedDatePropertyDef, localTime );
+ }
--- a/videocollection/mpxmyvideoscollection/src/vcxmyvideosmessagelist.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideosmessagelist.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -130,7 +130,7 @@
{
message->SetTObjectValueL<TInt32>( KVcxMediaMyVideosInt32Value, aExtraInfo );
}
-
+
MPX_DEBUG1("CVcxMyVideosMessageList:: appending to message array");
iMessageArray->AppendL( message ); // ownership moves
@@ -299,9 +299,7 @@
iMessageList->SetTObjectValueL<TMPXMessageId>(KMPXMessageGeneralId, KVcxCommandIdMyVideos);
iMessageList->SetTObjectValueL<TInt>(KVcxMediaMyVideosCommandId, KVcxMessageMyVideosMessageArray );
- iMessageList->SetTObjectValueL<TUid>(KMPXMessageCollectionId, TUid::Uid(KVcxUidMyVideosMpxCollection));
- //iMessageList->SetTObjectValueL<TMPXChangeEventType>(KMPXMessageChangeEventType, aChange);
- //iMessageList->SetTObjectValueL<TMPXItemId>(KMPXMessageMediaGeneralId, TMPXItemId(0, 0) );
+ iMessageList->SetTObjectValueL<TUid>(KMPXMessageCollectionId, TUid::Uid(KVcxUidMyVideosMpxCollection));
iMessageCount = 0;
}
}
--- a/videocollection/mpxmyvideoscollection/src/vcxmyvideosopenhandler.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideosopenhandler.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -11,11 +11,11 @@
*
* Contributors:
*
-* Description: Handles collection Open operation related functionality.*
+* Description: Handles collection Open operation related functionality.
+*
*/
-
// INCLUDE FILES
#include <e32base.h>
#include <mpxlog.h>
@@ -31,6 +31,8 @@
#include "vcxmyvideoscategories.h"
#include "vcxmyvideosmessagelist.h"
#include "vcxmyvideoscollectionutil.h"
+#include "vcxmyvideosalbums.h"
+#include "vcxmyvideosmdsalbums.h"
// ============================ MEMBER FUNCTIONS =============================
@@ -52,6 +54,9 @@
void CVcxMyVideosOpenHandler::ConstructL()
{
iCategoryIdsBeingOpened.Reset();
+ iVideoListsBeingOpened.Reset();
+ iAlbumIdsBeingOpened.Reset();
+ iAlbumVideoListsBeingOpened.Reset();
}
// ---------------------------------------------------------------------------
@@ -85,6 +90,16 @@
iVideoListsBeingOpened[i] = NULL;
}
iVideoListsBeingOpened.Close();
+
+ iAlbumIdsBeingOpened.Close();
+
+ count = iAlbumVideoListsBeingOpened.Count();
+ for ( TInt i = 0; i < count; i++ )
+ {
+ delete iAlbumVideoListsBeingOpened[i];
+ iAlbumVideoListsBeingOpened[i] = NULL;
+ }
+ iAlbumVideoListsBeingOpened.Close();
}
// ---------------------------------------------------------------------------
@@ -99,109 +114,78 @@
MPX_DEBUG1("CVcxMyVideosOpenHandler:: path before open:");
MPX_DEBUG_PATH( aPath );
+ iPath = &aPath;
+
+ const TInt categoryLevel = 1;
+ const TInt videosLevel = 2;
+ const TInt playlistLevel = 3;
+
switch ( aPath.Levels() )
{
- case 1:
+ case categoryLevel:
{
- //we are at root level, return main level items (categories)
+ //we are at root level, return main level items (categories + albums)
- // this is needed to update category counters
+ iCollection.AlbumsL().CreateAlbumListL(); //async
+
+ // This is needed to update category counters.
+ // Goes to queue if CreateAlbumListL command goes to execution
TRAPD( err, iCache.CreateVideoListL() );
if ( err != KErrNone )
{
- MPX_DEBUG2("iCache->CreateVideoListL() left: %d. Returning categories anyway.", err);
+ MPX_DEBUG2("iCache->CreateVideoListL() left: %d. Returning categories and albums anyway.", err);
}
- iCollection.iObs->HandleOpen( iCollection.CategoriesL().iList, KErrNone );
+
+ CMPXMedia* itemList = TVcxMyVideosCollectionUtil::CreateEmptyMediaListL();
+ CleanupStack::PushL( itemList );
+ TVcxMyVideosCollectionUtil::AppendToListL( *itemList, *iCollection.CategoriesL().iList );
+ TVcxMyVideosCollectionUtil::AppendToListL( *itemList, *iCollection.AlbumsL().iAlbumList );
+ itemList->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath );
+ iCollection.iObs->HandleOpen( itemList, KErrNone );
+ CleanupStack::PopAndDestroy( itemList );
+ MPX_DEBUG1("CVcxMyVideosOpenHandler:: called HandleOpen for categories + albums");
}
break;
- case 2:
+ case videosLevel:
{
- //we are at second level, return video list from some category
+ //we are at second level, return video list from some category or album
- TInt categoryId = aPath.Id();
-
- MPX_DEBUG2("CVcxMyVideosOpenHandler:: opening category %d", categoryId);
+ TMPXItemId categoryId( aPath.Id() );
- if ( categoryId != KVcxMvcCategoryIdAll &&
- categoryId != KVcxMvcCategoryIdDownloads &&
- categoryId != KVcxMvcCategoryIdTvRecordings &&
- categoryId != KVcxMvcCategoryIdCaptured &&
- categoryId != KVcxMvcCategoryIdOther )
+ if ( ( categoryId.iId2 == KVcxMvcMediaTypeCategory ) ||
+ ( categoryId.iId2 == KVcxMvcMediaTypeVideo ) &&
+ (categoryId.iId1 == KVcxMvcCategoryIdAll ||
+ categoryId.iId1 == KVcxMvcCategoryIdDownloads ||
+ categoryId.iId1 == KVcxMvcCategoryIdTvRecordings ||
+ categoryId.iId1 == KVcxMvcCategoryIdCaptured ||
+ categoryId.iId1 == KVcxMvcCategoryIdOther) )
{
- MPX_DEBUG2("CVcxMyVideosOpenHandler:: category ID not valid (%d) -> calling HandleOpen with KErrNotFound", categoryId);
- iCollection.iObs->HandleOpen( static_cast<CMPXMedia*>(NULL), KErrNotFound );
+ MPX_DEBUG2("CVcxMyVideosOpenHandler:: opening category %d", categoryId.iId1 );
+ OpenCategoryL( categoryId.iId1 );
return;
}
-
- TUint8 origin = static_cast<TUint8>( TVcxMyVideosCollectionUtil::Origin( categoryId ) );
-
- iCache.CreateVideoListL(); // Causes async call to MDS, callbacks to DoHandleCreateVideoListRespL will happen.
- // If iCache.iVideoList is complete and can be used (correct sorting order),
- // then nothing is done.
-
- if ( !iCache.iVideoListIsPartial )
+ else
{
- MPX_DEBUG1("CVcxMyVideosOpenHandler:: videolist complete");
-
- // iCache.iVideoList is complete
- if ( categoryId == KVcxMvcCategoryIdAll )
+ MPX_DEBUG2("CVcxMyVideosOpenHandler:: opening album %d", categoryId.iId1 );
+
+ iCollection.AlbumsL().CreateAlbumListL(); //async
+ iPendingAlbumOpenId = categoryId.iId1;
+ if ( iCollection.AlbumsL().iAlbumListIsComplete )
{
- MPX_DEBUG1("CVcxMyVideosOpenHandler:: KVcxMvcCategoryIdAll: calling HandleOpen(iCache.iVideoList)");
- iCollection.iObs->HandleOpen( iCache.iVideoList, KErrNone );
+ HandleAlbumOpenL(); // iPendingAlbumOpenId goes to 0
+ return;
}
else
{
- MPX_DEBUG1("CVcxMyVideosOpenHandler:: other than KVcxMvcCategoryIdAll: creating new category video list");
- CMPXMedia* videoList = iCache.CreateVideoListByOriginL( origin );
- MPX_DEBUG1("CVcxMyVideosOpenHandler:: calling HandleOpen(new list)");
- iCollection.iObs->HandleOpen( videoList, KErrNone );
- delete videoList;
- }
- iCollection.iMessageList->AddEventL( KVcxMessageMyVideosListComplete );
- iCollection.iMessageList->SendL();
-
- // No append events will arrive anymore -> we create our own version of the
- // video list.
- iCache.ReCreateVideoListL();
- }
- else
- {
- MPX_DEBUG1("CVcxMyVideosOpenHandler:: video list incomplete");
- // iCache.iVideoList is incomplete
-
- if ( categoryId == KVcxMvcCategoryIdAll )
- {
- MPX_DEBUG1("CVcxMyVideosOpenHandler:: KVcxMvcCategoryIdAll, calling HandleOpen");
- iCollection.iObs->HandleOpen( iCache.iVideoList, KErrNone );
+ // We will continue at HandleAlbumOpenL when album list arrives, iPendingAlbumOpenId is left != 0
+ return;
}
- else
- {
- MPX_DEBUG1("CVcxMyVideosOpenHandler:: other than KVcxMvcCategoryIdAll");
+ }
+ }
- TInt pos = iCategoryIdsBeingOpened.Find( categoryId );
- if ( pos == KErrNotFound )
- {
- MPX_DEBUG1("CVcxMyVideosOpenHandler:: category was not opened yet, creating list for it");
- iCategoryIdsBeingOpened.AppendL( categoryId );
- CMPXMedia* videoList = iCache.CreateVideoListByOriginL( origin );
- iVideoListsBeingOpened.AppendL( videoList );
- MPX_DEBUG1("CVcxMyVideosOpenHandler:: calling HandleOpen");
- iCollection.iObs->HandleOpen( iCache.iVideoList, KErrNone );
- }
- else
- {
- MPX_DEBUG1("CVcxMyVideosOpenHandler:: category was already being opened, calling HandleOpen with that");
- iCollection.iObs->HandleOpen( iVideoListsBeingOpened[pos], KErrNone );
- }
- }
- }
-
- }
- break;
-
- case 3:
+ case playlistLevel:
{
iCollection.iObs->HandleOpen(const_cast<CMPXCollectionPath*> (&aPath), KErrNone);
}
@@ -213,14 +197,91 @@
} //switch
}
+// ---------------------------------------------------------------------------
+// CVcxMyVideosOpenHandler::OpenCategoryL
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosOpenHandler::OpenCategoryL( TUint32 aCategoryId )
+ {
+ TUint8 origin = static_cast<TUint8>( TVcxMyVideosCollectionUtil::Origin( aCategoryId ) );
+
+ iCache.CreateVideoListL(); // Causes async call to MDS, callbacks to DoHandleCreateVideoListRespL will follow.
+ // If iCache.iVideoList is complete and can be used (correct sorting order),
+ // then nothing is done.
+
+ if ( !iCache.iVideoListIsPartial )
+ {
+ MPX_DEBUG1("CVcxMyVideosOpenHandler:: videolist complete");
+
+ // iCache.iVideoList is complete
+ if ( aCategoryId == KVcxMvcCategoryIdAll )
+ {
+ MPX_DEBUG1("CVcxMyVideosOpenHandler:: KVcxMvcCategoryIdAll: calling HandleOpen(iCache.iVideoList)");
+ iCache.iVideoList->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath );
+ iCollection.iObs->HandleOpen( iCache.iVideoList, KErrNone );
+ }
+ else
+ {
+ MPX_DEBUG1("CVcxMyVideosOpenHandler:: other than KVcxMvcCategoryIdAll: creating new category video list");
+ CMPXMedia* videoList = iCache.CreateVideoListByOriginL( origin );
+ MPX_DEBUG1("CVcxMyVideosOpenHandler:: calling HandleOpen(new list)");
+ videoList->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath );
+ iCollection.iObs->HandleOpen( videoList, KErrNone );
+ delete videoList;
+ }
+ iCollection.iMessageList->AddEventL( KVcxMessageMyVideosListComplete );
+ iCollection.iMessageList->SendL();
+
+ // No append events will arrive anymore -> we create our own version of the
+ // video list.
+ iCache.ReCreateVideoListL();
+ }
+ else
+ {
+ MPX_DEBUG1("CVcxMyVideosOpenHandler:: video list incomplete");
+ // iCache.iVideoList is incomplete
+
+ if ( aCategoryId == KVcxMvcCategoryIdAll )
+ {
+ MPX_DEBUG1("CVcxMyVideosOpenHandler:: KVcxMvcCategoryIdAll, calling HandleOpen");
+ iCache.iVideoList->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath );
+ iCollection.iObs->HandleOpen( iCache.iVideoList, KErrNone );
+ }
+ else
+ {
+ MPX_DEBUG1("CVcxMyVideosOpenHandler:: other than KVcxMvcCategoryIdAll");
+
+ TInt pos = iCategoryIdsBeingOpened.Find( aCategoryId );
+ if ( pos == KErrNotFound )
+ {
+ MPX_DEBUG1("CVcxMyVideosOpenHandler:: category was not opened yet, creating list for it");
+ iCategoryIdsBeingOpened.AppendL( aCategoryId );
+ CMPXMedia* videoList = iCache.CreateVideoListByOriginL( origin );
+ CleanupStack::PushL( videoList );
+ iVideoListsBeingOpened.AppendL( videoList );
+ CleanupStack::Pop( videoList );
+ MPX_DEBUG1("CVcxMyVideosOpenHandler:: calling HandleOpen");
+ iCache.iVideoList->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath );
+ iCollection.iObs->HandleOpen( iCache.iVideoList, KErrNone );
+ }
+ else
+ {
+ MPX_DEBUG1("CVcxMyVideosOpenHandler:: category was already being opened, calling HandleOpen with that");
+ iVideoListsBeingOpened[pos]->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath );
+ iCollection.iObs->HandleOpen( iVideoListsBeingOpened[pos], KErrNone );
+ }
+ }
+ }
+ }
+
// ----------------------------------------------------------------------------
// CVcxMyVideosOpenHandler::DoHandleCreateVideoListRespL
-// New items fetched from MDS. iCache.iVideoList = aVideoList.
+// New items fetched from MDS. iCollection.iCache->iVideoList = &aVideoList.
// ----------------------------------------------------------------------------
//
void CVcxMyVideosOpenHandler::DoHandleCreateVideoListRespL(
CMPXMedia* aVideoList, TInt aNewItemsStartIndex, TBool aComplete )
- {
+ {
MPX_FUNC("CVcxMyVideosOpenHandler::DoHandleCreateVideoListRespL()");
MPX_DEBUG2("CVcxMyVideosOpenHandler:: aComplete = %d", aComplete);
@@ -232,22 +293,27 @@
}
// Append new items to category video lists. All category is using iCache.iVideoList, thus no need to append to it.
- TInt count = iCategoryIdsBeingOpened.Count();
- for ( TInt i = 0; i < count; i++ )
+ TInt categoryCount = iCategoryIdsBeingOpened.Count();
+ for ( TInt i = 0; i < categoryCount; i++ )
{
iCache.AppendToListL( *iVideoListsBeingOpened[i], *aVideoList,
TVcxMyVideosCollectionUtil::Origin( iCategoryIdsBeingOpened[i] ),
aNewItemsStartIndex );
}
-
+
+ // Append new items to album video lists.
+ TInt albumCount = iAlbumVideoListsBeingOpened.Count();
+ for ( TInt i = 0; i < albumCount; i++ )
+ {
+ iCollection.iAlbums->Album( iAlbumIdsBeingOpened[i] )->AppendToVideoListL(
+ *aVideoList, *(iAlbumVideoListsBeingOpened[i]), aNewItemsStartIndex );
+ }
+
if ( aComplete == 0 )
{
iCollection.iMessageList->AddEventL( KVcxMessageMyVideosItemsAppended );
// Still fetching items
- // Missing download fields filled from download manager
- TRAP_IGNORE( iCollection.SyncVideoListWithDownloadsL( *(iCache.iVideoList),
- EFalse /* dont send events */, aNewItemsStartIndex ); );
iCollection.CategoriesL().UpdateCategoriesL( *aVideoList, aNewItemsStartIndex );
}
else
@@ -255,6 +321,8 @@
// End event arrived
iCache.iVideoListIsPartial = EFalse;
+ iCache.IsFetchingVideoList = EFalse;
+
// Create modify event for All category.
// This will cause client to make a new OpenL() call.
@@ -266,7 +334,7 @@
EVcxMyVideosVideoListOrderChanged );
// We dont send here, the send is at the end of this function.
- for ( TInt i = 0; i < count; i++ )
+ for ( TInt i = 0; i < categoryCount; i++ )
{
// Create modify event for other than All categories.
// This will cause client to make a new OpenL() call.
@@ -283,7 +351,25 @@
iVideoListsBeingOpened.Reset();
iCategoryIdsBeingOpened.Reset();
- // all category, lets delete our copy and start using new one, this gives the full ownership to client
+ for ( TInt i = 0; i < albumCount; i++ )
+ {
+ // Create modify event for albums.
+ // This will cause client to make a new OpenL() call.
+ // Also this causes collection framework to purge its possibly outdated
+ // (KVcxMessageMyVideosItemsAppended events don't update collection frameworks cache) cache.
+ MPX_DEBUG3("CVcxMyVideosOpenHandler:: adding modify event for album %d, extra info = %d",
+ iAlbumIdsBeingOpened[i], EVcxMyVideosVideoListOrderChanged );
+ iCollection.iMessageList->AddEventL( TMPXItemId( iAlbumIdsBeingOpened[i], 2 ), EMPXItemModified,
+ EVcxMyVideosVideoListOrderChanged );
+ // We dont send here, the send is at the end of this function.
+ delete iAlbumVideoListsBeingOpened[i]; // we can delete our copy, client has its own copy
+ iAlbumVideoListsBeingOpened[i] = NULL;
+ }
+ iAlbumVideoListsBeingOpened.Reset();
+ iAlbumIdsBeingOpened.Reset();
+
+ // All category, lets delete our copy and start using new one, this gives the full
+ // ownership of the list to client. Video objects will continue to point to the same shared data.
iCache.ReCreateVideoListL();
iCollection.CategoriesL().UpdateCategoriesNewVideoNamesL();
@@ -293,4 +379,148 @@
iCollection.iMessageList->SendL();
}
+// ----------------------------------------------------------------------------
+// CVcxMyVideosOpenHandler::HandleAlbumOpenL
+// Album list has been fetched already.
+// ----------------------------------------------------------------------------
+//
+void CVcxMyVideosOpenHandler::HandleAlbumOpenL()
+ {
+ //TODO: If iVideoList is partial and fetching is already going on -> use the implementation below.
+ // If iVideoList is partial but fetching is not going on -> fetch only album items to iCache.
+
+ MPX_DEBUG1("CVcxMyVideosOpenHandler::HandleAlbumOpenL() start");
+
+ CVcxMyVideosAlbum* album = iCollection.AlbumsL().Album( iPendingAlbumOpenId );
+ if ( album )
+ {
+ if ( !iCollection.iCache->iVideoListIsPartial )
+ {
+ //videolist complete
+ CMPXMedia* videoList = album->CreateVideoListL();
+ videoList->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath );
+ iCollection.iObs->HandleOpen( videoList, KErrNone );
+ delete videoList;
+ iCollection.iMessageList->AddEventL( KVcxMessageMyVideosListComplete );
+ iCollection.iMessageList->SendL();
+ }
+ else
+ {
+ if ( iCollection.iCache->IsFetchingVideoList )
+ {
+ MPX_DEBUG1("CVcxMyVideosOpenHandler:: videolist fetching already in progress -> use that to populate album");
+
+ // videolist incomplete and fetching already going on
+ TInt pos = iAlbumIdsBeingOpened.Find( iPendingAlbumOpenId );
+ if ( pos == KErrNotFound )
+ {
+ //store video list for append events
+ CMPXMedia* videoList = album->CreateVideoListL();
+ CleanupStack::PushL( videoList );
+ iAlbumVideoListsBeingOpened.AppendL( videoList );
+ CleanupStack::Pop( videoList );
+ iAlbumIdsBeingOpened.AppendL( iPendingAlbumOpenId );
+ videoList->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath );
+ iCollection.iObs->HandleOpen( videoList, KErrNone );
+ }
+ else
+ {
+ //video list already stored
+ iAlbumVideoListsBeingOpened[pos]->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath );
+ iCollection.iObs->HandleOpen( iAlbumVideoListsBeingOpened[pos],
+ KErrNone );
+ }
+ }
+ else
+ {
+ // videolist incomplete and fetching hasn't been started
+ // TODO: Test how fast this is. If slow, then ditch the separate album fetching.
+
+ MPX_DEBUG1("CVcxMyVideosOpenHandler:: videolist partial and no fetching going on -> fetch the album videos separately");
+
+ delete iAlbumVideoList;
+ iAlbumVideoList = NULL;
+ iAlbumVideoList = TVcxMyVideosCollectionUtil::CreateEmptyMediaListL();
+ iCollection.iMyVideosMdsDb->iAlbums->GetAlbumContentVideosL( iPendingAlbumOpenId,
+ *iAlbumVideoList, *this );
+ return;
+ }
+ }
+ }
+ else
+ {
+ MPX_DEBUG2("CVcxMyVideosOpenHandler:: album ID not valid (%d) -> calling HandleOpen with KErrNotFound",
+ iPendingAlbumOpenId);
+ iCollection.iObs->HandleOpen( static_cast<CMPXMedia*>(NULL), KErrNotFound );
+ }
+ iPendingAlbumOpenId = 0;
+
+ MPX_DEBUG1("CVcxMyVideosOpenHandler::HandleAlbumOpenL() exit");
+ }
+
+// ----------------------------------------------------------------------------
+// CVcxMyVideosOpenHandler::HandleGetAlbumContentVideosResp
+// ----------------------------------------------------------------------------
+//
+void CVcxMyVideosOpenHandler::HandleGetAlbumContentVideosResp(
+ TUint32 aAlbumId, CMPXMedia& aVideoList, TInt aError,
+ TInt aFirstNewItemIndex, TInt aNewItemCount, TBool aComplete )
+ {
+ TRAPD( err, HandleGetAlbumContentVideosRespL( aAlbumId, aVideoList, aError,
+ aFirstNewItemIndex, aNewItemCount, aComplete ));
+ if ( err != KErrNone )
+ {
+ MPX_DEBUG2("CVcxMyVideosOpenHandler:: HandleGetAlbumContentVideosRespL leaved: %d", err);
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CVcxMyVideosOpenHandler::HandleGetAlbumContentVideosRespL
+// ----------------------------------------------------------------------------
+//
+void CVcxMyVideosOpenHandler::HandleGetAlbumContentVideosRespL(
+ TUint32 aAlbumId, CMPXMedia& /*aVideoList*/, TInt aError,
+ TInt /*aFirstNewItemIndex*/, TInt /*aNewItemCount*/, TBool aComplete )
+ {
+ MPX_DEBUG1("CVcxMyVideosOpenHandler::HandleGetAlbumContentVideosRespL() start");
+
+ if ( aError != KErrNone )
+ {
+ MPX_DEBUG2("CVcxMyVideosOpenHandler:: error %d occured when fetching album videos", aError );
+ }
+
+ MPX_DEBUG3("CVcxMyVideosOpenHandler:: iPendingAlbumOpenId = %d, aAlbumId = %d", iPendingAlbumOpenId, aAlbumId );
+
+ if ( iPendingAlbumOpenId == aAlbumId )
+ {
+ MPX_DEBUG2("CVcxMyVideosOpenHandler:: First videos for album %d arrived, calling HandleOpen()", aAlbumId);
+
+ iAlbumVideoList->SetCObjectValueL( KMPXMediaGeneralContainerPath, iPath );
+ iCollection.iObs->HandleOpen( iAlbumVideoList, aError );
+ iPendingAlbumOpenId = 0;
+ }
+
+ if ( !aComplete )
+ {
+ iCollection.iMessageList->AddEventL( KVcxMessageMyVideosItemsAppended );
+
+ MPX_DEBUG3("CVcxMyVideosOpenHandler:: adding modify event for album %d, extra info = %d",
+ aAlbumId, EVcxMyVideosVideoListOrderChanged );
+ iCollection.iMessageList->AddEventL( TMPXItemId( aAlbumId, 2 ), EMPXItemModified,
+ EVcxMyVideosVideoListOrderChanged );
+ }
+ else
+ {
+ //TODO: should add album id
+ iCollection.iMessageList->AddEventL( KVcxMessageMyVideosListComplete );
+
+ delete iAlbumVideoList;
+ iAlbumVideoList = NULL;
+ }
+
+ iCollection.iMessageList->SendL();
+
+ MPX_DEBUG1("CVcxMyVideosOpenHandler::HandleGetAlbumContentVideosRespL() exit");
+ }
+
// END OF FILE
--- a/videocollection/mpxmyvideoscollection/src/vcxmyvideostimer.cpp Thu Apr 01 23:13:36 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-/*
-* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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: General purpose timer*
-*/
-
-
-
-
-
-// INCLUDE FILES
-#include "vcxmyvideostimer.h"
-
-// ========================= MEMBER FUNCTIONS ==================================
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosTimer::NewL()
-// Two-phased constructor.
-// -----------------------------------------------------------------------------
-//
-CVcxMyVideosTimer* CVcxMyVideosTimer::NewL(const TInt aPriority,
- MVcxMyVideosTimerObserver& aTimerObserver)
- {
- CVcxMyVideosTimer* self = CVcxMyVideosTimer::NewLC(aPriority, aTimerObserver );
- CleanupStack::Pop( self );
- return self;
- }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosTimer::NewLC()
-// Two-phased constructor.
-// -----------------------------------------------------------------------------
-//
-CVcxMyVideosTimer* CVcxMyVideosTimer::NewLC(const TInt aPriority,
- MVcxMyVideosTimerObserver& aTimerObserver)
- {
- CVcxMyVideosTimer* self = new ( ELeave ) CVcxMyVideosTimer(aPriority, aTimerObserver);
- CleanupStack::PushL( self );
- self->ConstructL();
- return self;
- }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosTimer::CVcxMyVideosTimer()
-// C++ default constructor can NOT contain any code, that might leave.
-// -----------------------------------------------------------------------------
-//
-CVcxMyVideosTimer::CVcxMyVideosTimer(const TInt aPriority,
- MVcxMyVideosTimerObserver& aTimerObserver)
-: CTimer( aPriority ), iObserver( aTimerObserver )
- {
- // No implementation required
- }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosTimer::ConstructL()
-// Symbian 2nd phase constructor can leave.
-// -----------------------------------------------------------------------------
-//
-void CVcxMyVideosTimer::ConstructL()
- {
- CTimer::ConstructL();
- CActiveScheduler::Add( this );
- }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosTimer::~CVcxMyVideosTimer()
-// Destructor.
-// -----------------------------------------------------------------------------
-//
-CVcxMyVideosTimer::~CVcxMyVideosTimer()
- {
- // No implementation required
- }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosTimer::RunL()
-// Called when operation completes.
-// -----------------------------------------------------------------------------
-//
-void CVcxMyVideosTimer::RunL()
- {
- // Timer request has completed, so notify the timer's owner
- if ( iStatus == KErrNone )
- {
- iObserver.TimerExpired( this );
- }
- }
-
-// End of File
--- a/videocollection/mpxmyvideoscollection/src/vcxmyvideosvideocache.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideosvideocache.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -29,10 +29,8 @@
#include <mpxmediavideodefs.h>
#include "vcxmyvideosvideocache.h"
#include "vcxmyvideoscollectionplugin.h"
-#include "vcxmyvideosdownloadutil.h"
#include "vcxmyvideoscollectionutil.h"
#include "vcxmyvideoscategories.h"
-#include "vcxmyvideosdownloadcache.h"
#include "vcxmyvideosmessagelist.h"
#include "vcxmyvideosopenhandler.h"
@@ -66,9 +64,6 @@
MPX_FUNC("CVcxMyVideosVideoCache::~CVcxMyVideosVideoCache");
delete iVideoList;
- delete iDownloadCache;
- delete iCenRep;
-
DeletePartialList();
}
@@ -94,7 +89,6 @@
iVideoList = TVcxMyVideosCollectionUtil::CreateEmptyMediaListL();
iVideoListIsPartial = ETrue;
- iDownloadCache = CVcxMyVideosDownloadCache::NewL();
iPartialVideoList.Reset();
}
@@ -269,72 +263,6 @@
}
// ----------------------------------------------------------------------------
-// CVcxMyVideosVideoCache::FindVideoByDownloadIdL
-// ----------------------------------------------------------------------------
-//
-CMPXMedia* CVcxMyVideosVideoCache::FindVideoByDownloadIdL( TUint aDownloadId )
- {
- MPX_FUNC("CVcxMyVideosVideoCache::FindVideoByDownloadIdL()");
-
- MPX_DEBUG2("CVcxMyVideosVideoCache:: looking for MPX item with download ID %d from cache", aDownloadId);
-
- if ( aDownloadId == 0 )
- {
- MPX_DEBUG1("CVcxMyVideosVideoCache:: dl id == 0 -> NOT FOUND");
- return NULL;
- }
-
- if ( !iVideoList )
- {
- MPX_DEBUG1("CVcxMyVideosVideoCache:: iVideoList is NULL -> NOT FOUND");
- return NULL;
- }
-
- CMPXMedia* video = iDownloadCache->Get( aDownloadId );
- if ( video )
- {
- MPX_DEBUG1("CVcxMyVideosVideoCache:: found from Download Cache");
- return video;
- }
-
- MPX_DEBUG1("CVcxMyVideosVideoCache:: not found from Download Cache");
-
- CMPXMediaArray* cachedVideoArray = iVideoList->Value<CMPXMediaArray>(
- KMPXMediaArrayContents);
-
- TUint32 downloadId;
- TInt count = cachedVideoArray->Count();
- for ( TInt i = 0; i < count; i++ )
- {
- downloadId = TVcxMyVideosCollectionUtil::DownloadIdL( *cachedVideoArray->AtL( i ) );
- if ( downloadId == aDownloadId )
- {
- MPX_DEBUG1("CVcxMyVideosVideoCache:: found from iVideoList");
- MPX_DEBUG1("CVcxMyVideosVideoCache:: adding to iDownloadCache");
- iDownloadCache->Add( downloadId, (*cachedVideoArray)[i] );
- return (*cachedVideoArray)[i];
- }
- }
-
- count = iPartialVideoList.Count();
- for ( TInt i = 0; i < count; i++ )
- {
- downloadId = TVcxMyVideosCollectionUtil::DownloadIdL( *(iPartialVideoList[i]) );
- if ( downloadId == aDownloadId )
- {
- MPX_DEBUG1("CVcxMyVideosVideoCache:: found from iPartialVideoList");
- MPX_DEBUG1("CVcxMyVideosVideoCache:: adding to iDownloadCache");
- iDownloadCache->Add( downloadId, iPartialVideoList[i] );
- return iPartialVideoList[i];
- }
- }
-
- MPX_DEBUG1("CVcxMyVideosVideoCache:: NOT FOUND");
- return NULL;
- }
-
-
-// ----------------------------------------------------------------------------
// CVcxMyVideosVideoCache::GetVideosL
// ----------------------------------------------------------------------------
//
@@ -359,14 +287,14 @@
// CVcxMyVideosVideoCache::AddVideosFromMdsL
// Called when item inserted events arrive from mds or from
// KVcxCommandMyVideosGetMediasByMpxId cmd handler.
-// Synchronizing with downloads is not done here, caller must take care of it.
// If mpx item is already in cache, or MDS does not contain the item (or was not video item),
// then it is removed from aMdsIds. Ie after this function call aMdsIds contains
-// only IDs which are actually added to cache.
+// only IDs which are actually added to cache. aNonVideoIds will contain IDs
+// which were not video objects.
// ----------------------------------------------------------------------------
//
void CVcxMyVideosVideoCache::AddVideosFromMdsL( RArray<TUint32>& aMdsIds,
- TBool& aListFetchingWasCanceled )
+ TBool& aListFetchingWasCanceled, RArray<TUint32>* aNonVideoIds )
{
MPX_FUNC("CVcxMyVideosVideoCache::AddVideosFromMdsL");
@@ -416,13 +344,17 @@
}
else
{
- MPX_DEBUG2("CVcxMyVideosVideoCache:: video with %d ID not found from MDS -> skipping add to cache and deleting from id array", aMdsIds[j] );
+ MPX_DEBUG2("CVcxMyVideosVideoCache:: video with %d ID not found from MDS -> prob non video object, skipping add to cache", aMdsIds[j] );
aMdsIds.Remove( j );
+ if ( aNonVideoIds )
+ {
+ aNonVideoIds->AppendL( j );
+ }
}
}
else
{
- MPX_DEBUG2("CVcxMyVideosVideoCache:: %d was already in cache -> skipping add, and deleting from id array", aMdsIds[j]);
+ MPX_DEBUG2("CVcxMyVideosVideoCache:: %d was already in cache -> skipping add", aMdsIds[j]);
aMdsIds.Remove( j );
}
}
@@ -958,23 +890,7 @@
changed = ETrue;
}
}
- // 18
- if ( aVideo.IsSupported( KVcxMediaMyVideosDownloadId ) )
- {
- TUint32 downloadIdInCache( TVcxMyVideosCollectionUtil::DownloadIdL( *videoInCache ) );
- TUint32 downloadIdInNew( TVcxMyVideosCollectionUtil::DownloadIdL( aVideo ) );
- if ( downloadIdInNew != downloadIdInCache )
- {
- videoInCache->SetTObjectValueL<TUint32>( KVcxMediaMyVideosDownloadId,
- downloadIdInNew );
- if ( downloadIdInNew == 0 )
- {
- iDownloadCache->Delete( videoInCache );
- }
- changed = ETrue;
- }
- }
// 19
if ( aVideo.IsSupported( KVcxMediaMyVideosRating ) )
{
@@ -1012,10 +928,6 @@
videoInCache->SetTObjectValueL<TUint32>( KVcxMediaMyVideosAudioFourCc,
AudioFourCcInNew );
- if ( AudioFourCcInNew == 0 )
- {
- iDownloadCache->Delete( videoInCache );
- }
changed = ETrue;
}
}
@@ -1322,18 +1234,17 @@
//
TVcxMyVideosSortingOrder CVcxMyVideosVideoCache::SortingOrderL()
{
-
- if( !iCenRep )
- {
- TUid uid;
- uid.iUid = KVcxMyVideosCollectionCenrepUid;
- iCenRep = CRepository::NewL( uid );
- }
+ TUid uid;
+ uid.iUid = KVcxMyVideosCollectionCenrepUid;
+ CRepository* cenRep = CRepository::NewL( uid );
+ CleanupStack::PushL( cenRep ); // 1->
TInt sortingOrderInCenrep;
- TInt cenRepError = iCenRep->Get( KVcxMyVideosCollectionCenrepKeySortingOrder,
+ TInt cenRepError = cenRep->Get( KVcxMyVideosCollectionCenrepKeySortingOrder,
sortingOrderInCenrep );
+
+ CleanupStack::PopAndDestroy( cenRep ); // <-1
TVcxMyVideosSortingOrder sortingOrder;
@@ -1433,8 +1344,6 @@
return KErrNotFound;
}
- iDownloadCache->Delete( video );
-
TUint32 flags( 0 );
if ( video->IsSupported( KMPXMediaGeneralFlags ) )
{
@@ -1534,10 +1443,6 @@
}
iVideoListIsPartial = ETrue;
-
- delete iDownloadCache;
- iDownloadCache = NULL;
- iDownloadCache = CVcxMyVideosDownloadCache::NewL();
iCollection.CategoriesL().ResetVideoCountersL(); //this does not send events
}
@@ -1576,10 +1481,6 @@
iVideoList = NULL;
iVideoList = newList;
CleanupStack::Pop( newList ); // <-1
-
- delete iDownloadCache;
- iDownloadCache = NULL;
- iDownloadCache = CVcxMyVideosDownloadCache::NewL();
}
// End of file
--- a/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/EABI/VCXMyVideosCollectionPluginTestu.def Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/EABI/VCXMyVideosCollectionPluginTestu.def Thu Apr 01 23:22:15 2010 +0300
@@ -1,15 +1,13 @@
EXPORTS
_Z9LibEntryLR13CTestModuleIf @ 1 NONAME
- _ZTI23CVCXMyVideosTestContent @ 2 NONAME ; #<TI>#
- _ZTI24CVCXMyVideosTestDownload @ 3 NONAME ; #<TI>#
- _ZTI25CVCXMyVideosTestDlWatcher @ 4 NONAME ; #<TI>#
- _ZTI26CVCXMyVideosTestServiceEmu @ 5 NONAME ; #<TI>#
- _ZTI34CVCXMyVideosCollectionPluginTester @ 6 NONAME ; #<TI>#
- _ZTV23CVCXMyVideosTestContent @ 7 NONAME ; #<VT>#
- _ZTV24CVCXMyVideosTestDownload @ 8 NONAME ; #<VT>#
- _ZTV25CVCXMyVideosTestDlWatcher @ 9 NONAME ; #<VT>#
- _ZTV26CVCXMyVideosTestServiceEmu @ 10 NONAME ; #<VT>#
- _ZTV34CVCXMyVideosCollectionPluginTester @ 11 NONAME ; #<VT>#
- _ZTI28CVCXMyVideosTestTransactions @ 12 NONAME ; #<TI>#
- _ZTV28CVCXMyVideosTestTransactions @ 13 NONAME ; #<VT>#
+ _ZTI13CVcxTestTimer @ 2 NONAME
+ _ZTI18CVcxTestActiveWait @ 3 NONAME
+ _ZTI21CVCXMyVideosTestUtils @ 4 NONAME
+ _ZTI28CVCXMyVideosTestTransactions @ 5 NONAME
+ _ZTI34CVCXMyVideosCollectionPluginTester @ 6 NONAME
+ _ZTV13CVcxTestTimer @ 7 NONAME
+ _ZTV18CVcxTestActiveWait @ 8 NONAME
+ _ZTV21CVCXMyVideosTestUtils @ 9 NONAME
+ _ZTV28CVCXMyVideosTestTransactions @ 10 NONAME
+ _ZTV34CVCXMyVideosCollectionPluginTester @ 11 NONAME
--- a/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/conf/VCXDrives.inc Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/conf/VCXDrives.inc Thu Apr 01 23:22:15 2010 +0300
@@ -1,24 +1,28 @@
-//
-// C is not used by Video Center when phone has F drive, change these accordingly.
-//
-// If phone has only C and E drives:
-// C_DRIVE e
-// E_DRIVE f
-//
-// If phone has F drive:
-// C_DRIVE e
-// E_DRIVE f
-//
-
-A_DRIVE a
-C_DRIVE e
-E_DRIVE f
-O_DRIVE o
-Z_DRIVE z
+///*
+//* 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 the License "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:
+//*
+//*/
ANY_DRIVE "anydrive"
-// Don't change these drives
-C_DRIVE_FORCED c
-E_DRIVE_FORCED e
-F_DRIVE_FORCED f
+// emulator use 1: x, 2: t or some other drives that do work.
+
+DRIVE_1 f
+DRIVE_2 e
+DRIVE_3 c
+
+C_DRIVE c
+E_DRIVE e
+F_DRIVE f
--- a/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/conf/VCXErrors.inc Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/conf/VCXErrors.inc Thu Apr 01 23:22:15 2010 +0300
@@ -1,5 +1,22 @@
-KIptvTestErrNotFound -1111
-KIptvTestErrVerifyFailed -1112
+///*
+//* 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 the License "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:
+//*
+//*/
+
+KVcxTestErrNotFound -1111
+KVcxTestErrVerifyFailed -1112
KERRNONE 0
KERRNOTFOUND -1
@@ -24,80 +41,3 @@
KERRABORT -39
KERRTOOBIG -40
KErrCouldNotConnect -34
-
-
-// EPG manager server side error codes
-KIptvErrorGetUpdateInformationLNotFound 123
-KIptvErrorEpgUpdateFailed 133
-KIptvErrorEpgUpdateSuccessed 134
-KIptvVodUpdateNotStarted 137
-KIptvVodUpdateStarted 136
-KIptvErrorVodNoIap 139
-KIptvErrorNoService 140
-KIptvThumbnailCount 141
-KIptvContentUpdateCompleted 146
-KIptvServiceThumbnailDownloaded 143
-KIptvContentThumbnailDownloaded 144
-KIptvRssParserError 145
-
-KIptvErrorRssSearchStarted 170
-KIptvErrorRssSearchFailed 171
-KIptvErrorRssSearchSucceed 172
-KIptvErrorRssSearchNoIap 173
-
-EIptvDlNoError 0
-EIptvDlOutOfMemory 1
-EIptvDlOutOfMemoryInVodDlPluginCreate 2
-EIptvDlVodDlPluginNotFound 3
-EIptvDlGeneralErrorInVodDlPluginCreate 4
-EIptvDlMessageAlreadyPending 5
-EIptvDlTypeNotSupported 6
-EIptvDlMaxDownloadsExceeded 7
-EIptvDlAlreadyExists 8
-KIptvDlCouldNotGetServiceData 9
-EIptvDlEpgManagerNotReady 10
-EIptvDlCouldNotGetContentFullDetails 11
-EIptvDlFailedToAddNewVideoToMyVideos 12
-EIptvDlCouldNotConnectToS60DlMgr 13
-EIptvDlCouldNotSetIapAttrToS60DlMgr 14
-EIptvDlCouldNotCreateS60Download 15
-EIptvDlCouldNotStartS60Download 16
-EIptvDlConnectionFailed 17
-EIptvDlAuthFailed 18
-EIptvDlProxyAuthFailed 19
-EIptvDlContentNotFound 20
-EIptvDlDiskFull 21
-EIptvDlDestFileInUse 22
-EIptvDlBadUrl 23
-EIptvDlMmcRemoved 24
-EIptvDlGeneral 25
-EIptvDlDisconnected 26
-EIptvDlContentUnchanged 27
-
-KIptvSchemaMismatch 301
-KIptvInvalidServiceType 302
-EXmlNoElements -997
-KErrNotFound -1
-
-KErrGsmMMServiceOptionTemporaryOutOfOrder -4162
-
-// From HttpDownloadMgrCommon.h
-EGeneral -30421
-EInternal -30422
-EContentFileIntegrity -30423
-EDiskFull -30424
-EConnectionFailed -30425
-ETransactionFailed -30426
-EMoveFailed -30427
-EDestFileWriteFailed -30428
-EMMCRemoved -30429
-EBadUrl -30430
-EWrongDestFilename -30431
-EDestFileInUse -30432
-EHttpUnhandled -30433
-EHttpAuthenticationFailed -30434
-EProxyAuthenticationFailed -30435
-EObjectNotFound -30436
-EPartialContentModified -30437
-EContentExpired -30438
-EHttpRestartFailed -30450
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/conf/VCXMyVideosCollectionPluginTest.cfg Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,996 @@
+///*
+//* 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 the License "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:
+//*
+//*/
+
+#-----------------------------------------------------------------------------------
+#
+# STIF test script file for testing VCXMyVideosCollectionPluginTest.dll
+#
+# Tests basic functionality.
+#
+#-----------------------------------------------------------------------------------
+
+[StifSettings]
+CapsModifier= VcxTestClientApiCapsMod.exe
+[EndStifSettings]
+
+[Define]
+INCLUDE c:\TestFramework\VCXMVCollectionPluginTest.inc
+INCLUDE c:\TestFramework\VCXDrives.inc
+INCLUDE c:\TestFramework\VCXErrors.inc
+[Enddefine]
+
+
+#------------------------------------------------------------------------------------
+#
+# Removes all videos from the device.
+#
+#------------------------------------------------------------------------------------
+[Sub Cleanup]
+print cleanup start
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV RemoveAllMedia
+
+delete VCXMV
+pause 2000
+print cleanup end
+[EndSub]
+
+
+#------------------------------------------------------------------------------------
+#
+# Open categories level
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Open categories level
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Open All videos level
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Open All videos level
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+print OK!
+delete VCXMV
+[Endtest]
+
+
+#------------------------------------------------------------------------------------
+#
+# Sideload video before collection plugin is opened.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Sideload video before collection plugin is opened.
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_1 "video0.mp4"
+pause 10000
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 1
+VCXMV CheckMediaDetail ANY_DRIVE 0 EVcxTestMapping_KMPXMediaGeneralFlags EVcxMyVideosVideoNew
+VCXMV CheckMediaDetail ANY_DRIVE 0 EVcxTestMapping_KVcxMediaMyVideosOrigin EVcxMyVideosOriginOther
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Sideload video when categories level is open
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Sideload video when categories level is open
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CreateVideoFileNoWait VcxTestVideoMpeg4 DRIVE_1 "video0.mp4"
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxCategoryModified KVCXMYVideosTestMessageMpxVideoInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 1
+VCXMV CheckMediaDetail ANY_DRIVE 0 EVcxTestMapping_KMPXMediaGeneralFlags EVcxMyVideosVideoNew
+VCXMV CheckMediaDetail ANY_DRIVE 0 EVcxTestMapping_KVcxMediaMyVideosOrigin EVcxMyVideosOriginOther
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Sideload video while category is open
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Sideload video while category is open
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFileNoWait VcxTestVideoMpeg4 DRIVE_1 "video0.mp4"
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxCategoryModified KVCXMYVideosTestMessageMpxVideoInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 1
+VCXMV CheckMediaDetail ANY_DRIVE 0 EVcxTestMapping_KMPXMediaGeneralFlags EVcxMyVideosVideoNew
+VCXMV CheckMediaDetail ANY_DRIVE 0 EVcxTestMapping_KVcxMediaMyVideosOrigin EVcxMyVideosOriginOther
+
+print OK!
+delete VCXMV
+[Endtest]
+
+
+#------------------------------------------------------------------------------------
+#
+# Sideload video to 1st drive
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Sideload video to 1st drive
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_1 "video0.mp4"
+
+VCXMV CheckMediaCount ANY_DRIVE 1
+VCXMV CheckMediaDetail ANY_DRIVE 0 EVcxTestMapping_KMPXMediaGeneralFlags EVcxMyVideosVideoNew
+VCXMV CheckMediaDetail ANY_DRIVE 0 EVcxTestMapping_KVcxMediaMyVideosOrigin EVcxMyVideosOriginOther
+
+print OK!
+delete VCXMV
+[Endtest]
+
+
+#------------------------------------------------------------------------------------
+#
+# Sideload video to 2nd drive
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Sideload video to 2nd drive
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_2 "video0.mp4"
+
+VCXMV CheckMediaCount ANY_DRIVE 1
+VCXMV CheckMediaDetail ANY_DRIVE 0 EVcxTestMapping_KMPXMediaGeneralFlags EVcxMyVideosVideoNew
+VCXMV CheckMediaDetail ANY_DRIVE 0 EVcxTestMapping_KVcxMediaMyVideosOrigin EVcxMyVideosOriginOther
+
+print OK!
+delete VCXMV
+[Endtest]
+
+
+#------------------------------------------------------------------------------------
+#
+# Sideload video to 3rd drive
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Sideload video to 3rd drive
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_3 "video0.mp4"
+
+VCXMV CheckMediaCount ANY_DRIVE 1
+VCXMV CheckMediaDetail ANY_DRIVE 0 EVcxTestMapping_KMPXMediaGeneralFlags EVcxMyVideosVideoNew
+VCXMV CheckMediaDetail ANY_DRIVE 0 EVcxTestMapping_KVcxMediaMyVideosOrigin EVcxMyVideosOriginOther
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Sideload multiple videos
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Sideload multiple videos
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_1 "video.mp4" ANY_SIZE 10
+
+VCXMV CheckMediaCount ANY_DRIVE 10
+VCXMV CheckMediaDetail ANY_DRIVE 0 EVcxTestMapping_KMPXMediaGeneralFlags EVcxMyVideosVideoNew
+VCXMV CheckMediaDetail ANY_DRIVE 0 EVcxTestMapping_KVcxMediaMyVideosOrigin EVcxMyVideosOriginOther
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Sideload multiple videos to multiple drives
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Sideload multiple videos to multiple drives
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFileNoWait VcxTestVideoMpeg4 DRIVE_1 "video1_DRIVE1.mp4" ANY_SIZE 3
+VCXMV CreateVideoFileNoWait VcxTestVideoMpeg4 DRIVE_2 "video2_DRIVE2.mp4" ANY_SIZE 3
+VCXMV CreateVideoFileNoWait VcxTestVideoMpeg4 DRIVE_1 "video3_DRIVE1.mp4" ANY_SIZE 3
+VCXMV CreateVideoFileNoWait VcxTestVideoMpeg4 DRIVE_2 "video4_DRIVE2.mp4" ANY_SIZE 3
+
+pause PAUSE_SIDELOAD_MINUTE
+
+VCXMV CheckMediaCount ANY_DRIVE 12
+VCXMV CheckMediaDetail ANY_DRIVE 0 EVcxTestMapping_KMPXMediaGeneralFlags EVcxMyVideosVideoNew
+VCXMV CheckMediaDetail ANY_DRIVE 0 EVcxTestMapping_KVcxMediaMyVideosOrigin EVcxMyVideosOriginOther
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Get details of video
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Get details of video
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_1 "video.mp4"
+
+VCXMV CheckMediaCount ANY_DRIVE 1
+
+VCXMV CheckMediaDetail ANY_DRIVE 0 EVcxTestMapping_KMPXMediaGeneralFlags EVcxMyVideosVideoNew
+VCXMV CheckMediaDetail ANY_DRIVE 0 EVcxTestMapping_KVcxMediaMyVideosOrigin EVcxMyVideosOriginOther
+VCXMV CheckMediaDetail ANY_DRIVE 0 EVcxTestMapping_KMPXMediaGeneralTitle "video"
+
+VCXMV GetMediaFullDetailsByMpxId ANY_DRIVE 0
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Sideload, close category, open category
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Sideload, close category, open category
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_1 "video0.mp4"
+
+VCXMV CloseLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 1
+VCXMV CheckMediaDetail ANY_DRIVE 0 EVcxTestMapping_KMPXMediaGeneralFlags EVcxMyVideosVideoNew
+VCXMV CheckMediaDetail ANY_DRIVE 0 EVcxTestMapping_KVcxMediaMyVideosOrigin EVcxMyVideosOriginOther
+
+print OK!
+delete VCXMV
+[Endtest]
+
+
+#------------------------------------------------------------------------------------
+#
+# Delete file of a video
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Delete file of a video
+
+callsub Cleanup
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_1 "video.mp4"
+VCXMV CheckMediaCount ANY_DRIVE 1
+
+VCXMV DeleteFileOfMedia ANY_DRIVE 0
+
+pause 10000
+
+VCXMV CheckMediaCount ANY_DRIVE 0
+print OK!
+delete VCXMV
+[Endtest]
+
+
+#------------------------------------------------------------------------------------
+#
+# Delete video
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Delete video
+
+callsub Cleanup
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_1 "video.mp4"
+VCXMV CheckMediaCount ANY_DRIVE 1
+
+VCXMV DeleteMedia DRIVE_1 0 0
+VCXMV WaitForMessages KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageDeleteStarted KVCXMYVideosTestMessageDeleteResp KVCXMYVideosTestMessageMpxCategoryModified KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 0
+print OK!
+delete VCXMV
+[Endtest]
+
+
+#------------------------------------------------------------------------------------
+#
+# Delete multiple videos
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Delete multiple videos
+
+callsub Cleanup
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_1 "video.mp4" ANY_SIZE 10
+VCXMV CheckMediaCount ANY_DRIVE 10
+
+VCXMV DeleteMedias ANY_DRIVE 0 10 0
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageDeleteStarted KVCXMYVideosTestMessageDeleteResp KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CoolDown
+
+VCXMV CheckMediaCount ANY_DRIVE 0
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Cancel deletion
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Cancel deletion
+
+callsub Cleanup
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_1 "video.mp4" ANY_SIZE 10
+VCXMV CheckMediaCount ANY_DRIVE 10
+
+VCXMV CancelNextOperation
+VCXMV DeleteMedias ANY_DRIVE 0 10 0
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCommandCanceled
+waittestclass VCXMV
+
+VCXMV CoolDown
+
+VCXMV CheckMinimumMediaCount ANY_DRIVE 2
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Tests getting medias by their MPX IDs when the request is set to have empty list.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title GetMediasByMpxId - Empty list when no videos
+
+callsub Cleanup
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CoolDown
+
+VCXMV GetMediasByMpxId 0 0
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageGotMediasByKMpxId
+allownextresult KERRARGUMENT
+waittestclass VCXMV
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Tests getting medias by their MPX IDs when the request has invalid IDs.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title GetMediasByMpxId - Invalid IDs when no videos
+
+callsub Cleanup
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CoolDown
+
+VCXMV GetMediasByMpxId -1 10
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageGotMediasByKMpxId
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 0
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# This is a setup case for following cases.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Setup, DL 2, sideload 18
+
+callsub Cleanup
+
+// TESTCASE START
+
+// Sideload 48 videos and download 2
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideo3Gp DRIVE_1 "video.mp4" 50000 20
+
+VCXMV CoolDown
+
+VCXMV CreateCopyOfMedia ANY_DRIVE 0 0
+VCXMV SetMediaDetail EVcxTestMapping_KVcxMediaMyVideosOrigin EVcxMyVideosOriginDownloaded
+VCXMV SetMedia 1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxVideoModified
+waittestclass VCXMV
+
+VCXMV CreateCopyOfMedia ANY_DRIVE 1 0
+VCXMV SetMediaDetail EVcxTestMapping_KVcxMediaMyVideosOrigin EVcxMyVideosOriginDownloaded
+VCXMV SetMedia 1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxVideoModified
+waittestclass VCXMV
+
+delete VCXMV
+
+// Open all videos
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 20
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Tests getting medias by their MPX IDs when request has IDs of all the videos in the device.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title GetMediasByMpxId - All videos
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV GetMediasByMpxId 0 20
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageGotMediasByKMpxId
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 20
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Tests getting medias by their MPX IDs when the request has only the ID of first video.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title GetMediasByMpxId - First only
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV GetMediasByMpxId 0 1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageGotMediasByKMpxId
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 1
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Tests getting medias by their MPX IDs when the request has only the ID of last video.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title GetMediasByMpxId - Last only
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV GetMediasByMpxId 19 20
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageGotMediasByKMpxId
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 1
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Tests getting medias by their MPX IDs when the request has few IDs of videos.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title GetMediasByMpxId - Few from middle
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV GetMediasByMpxId 7 13
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageGotMediasByKMpxId
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 6
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Tests getting medias by their MPX IDs when the request has no IDs.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title GetMediasByMpxId - Empty list
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV GetMediasByMpxId 0 0
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageGotMediasByKMpxId
+allownextresult KERRARGUMENT
+waittestclass VCXMV
+
+VCXMV GetMediasByMpxId 0 8
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageGotMediasByKMpxId
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 8
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Tests getting medias by their MPX IDs when the request has invalid IDs.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title GetMediasByMpxId - Invalid IDs
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV GetMediasByMpxId -1 10
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageGotMediasByKMpxId
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 0
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Tests getting medias by their MPX IDs when the request has duplicate IDs.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title GetMediasByMpxId - Duplicate IDs
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV GetMediasByMpxId -2 5
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageGotMediasByKMpxId
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 10
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Tests getting medias by their MPX IDs when the request has every second ID of the videos in device.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title GetMediasByMpxId - Every second item
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV GetMediasByMpxId -3 10
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageGotMediasByKMpxId
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 5
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+print OK!
+delete VCXMV
+[Endtest]
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/conf/VCXMyVideosCollectionPluginTestAlbums.cfg Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,2202 @@
+///*
+//* 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 the License "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:
+//*
+//*/
+
+#-----------------------------------------------------------------------------------
+#
+# STIF test script file for testing VCXMyVideosCollectionPluginTest.dll
+#
+# Tests album functionality.
+#
+#-----------------------------------------------------------------------------------
+
+[StifSettings]
+CapsModifier= VcxTestClientApiCapsMod.exe
+[EndStifSettings]
+
+[Define]
+INCLUDE c:\TestFramework\VCXMVCollectionPluginTest.inc
+INCLUDE c:\TestFramework\VCXDrives.inc
+INCLUDE c:\TestFramework\VCXErrors.inc
+[Enddefine]
+
+
+#------------------------------------------------------------------------------------
+#
+# Removes all videos and albums from the device.
+#
+#------------------------------------------------------------------------------------
+[Sub Cleanup]
+print cleanup start
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV RemoveAllMedia
+delete VCXMV
+
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV DeleteAllAlbums
+VCXMV CoolDown
+
+delete VCXMV
+
+pause 2000
+print cleanup end
+[EndSub]
+
+#------------------------------------------------------------------------------------
+#
+# Create album at collection root level
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Create album at collection root level
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CheckAlbumCount 1
+
+print OK!
+delete VCXMV
+[Endtest]
+
+
+#------------------------------------------------------------------------------------
+#
+# Open and close album
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Open and close album
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CoolDown
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CheckAlbumCount 1
+
+print OK!
+delete VCXMV
+[Endtest]
+
+
+#------------------------------------------------------------------------------------
+#
+# Create album when category is open
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Create album when category is open
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album2
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CheckAlbumCount 1
+
+print OK!
+delete VCXMV
+[Endtest]
+
+
+#------------------------------------------------------------------------------------
+#
+# Create album when album is open
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Create album when album is open
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album2
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CheckAlbumCount 2
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Create album with long name
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Create album with long name
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum "2KString"
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CheckAlbumCount 1
+
+print OK!
+delete VCXMV
+[Endtest]
+
+
+#------------------------------------------------------------------------------------
+#
+# Create album empty name
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Create album empty name
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum "EmptyString"
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CheckAlbumCount 1
+
+print OK!
+delete VCXMV
+[Endtest]
+
+
+#------------------------------------------------------------------------------------
+#
+# Create album request without album name
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Create album request without album name
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum "InvalidRequest"
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted
+waittestclass VCXMV
+
+VCXMV CoolDown
+
+VCXMV CheckAlbumCount 0
+
+print OK!
+delete VCXMV
+[Endtest]
+
+
+#------------------------------------------------------------------------------------
+#
+# Create two albums with same name
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Create two albums with same name
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum "Video Album same name"
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CreateAlbum "Video Album same name"
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CheckAlbumCount 2
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Create multiple albums
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Create multiple albums
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+loop 10
+
+ VCXMV CreateAlbum "Video Album - LOOP_COUNT "
+ VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+ waittestclass VCXMV
+
+endloop
+
+VCXMV CoolDown
+
+VCXMV CheckAlbumCount 10
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Create album with default category name
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Create album with default category name
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum EVcxMyVideosDownloads
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CheckAlbumCount 1
+
+print OK!
+delete VCXMV
+[Endtest]
+
+
+#------------------------------------------------------------------------------------
+#
+# Create album SYNC call
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Create album SYNC call
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album5 1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CheckAlbumCount 1
+
+print OK!
+delete VCXMV
+[Endtest]
+
+
+#------------------------------------------------------------------------------------
+#
+# Create album, opening and closing categories and albums
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Create album, opening and closing categories and albums
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+// Collection root level
+VCXMV CreateAlbum Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+// Category level
+VCXMV CreateAlbum Album2
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+// Collection root level
+VCXMV CreateAlbum Album3
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel Album2
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+// Album level
+VCXMV CreateAlbum Album4
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album5
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CheckAlbumCount 5
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Add videos to album from category
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Add videos to album from category
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_1 "video.mp4" ANY_SIZE 3
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+VCXMV CoolDown
+
+VCXMV AddMediasToAlbum Album1 ANY_DRIVE 0 3
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+// Check that videos have been added.
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Add different videos to multiple albums from category level.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Add different videos to multiple albums from category level.
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album2
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album3
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_1 "video.mp4" ANY_SIZE 3
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+VCXMV CoolDown
+
+VCXMV AddMediasToAlbum Album1 ANY_DRIVE 0 1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV AddMediasToAlbum Album2 ANY_DRIVE 1 2
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV AddMediasToAlbum Album3 ANY_DRIVE 2 3
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+// Check that videos have been added.
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 1
+
+// Check that videos have been added.
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel Album2
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 1
+
+// Check that videos have been added.
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel Album3
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 1
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Add same videos to multiple albums from category level.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Add same videos to multiple albums from category level.
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album2
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album3
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_1 "video.mp4" ANY_SIZE 3
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+VCXMV CoolDown
+
+VCXMV AddMediasToAlbum Album1 ANY_DRIVE 0 3
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV AddMediasToAlbum Album2 ANY_DRIVE 0 3
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV AddMediasToAlbum Album3 ANY_DRIVE 0 3
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+// Check that videos have been added.
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+// Check that videos have been added.
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel Album2
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+// Check that videos have been added.
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel Album3
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+print OK!
+delete VCXMV
+[Endtest]
+
+
+#------------------------------------------------------------------------------------
+#
+# Add videos to album, multiple adds from category level.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Add videos to album, multiple adds from category level.
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_1 "video.mp4" ANY_SIZE 3
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+VCXMV CoolDown
+
+VCXMV AddMediasToAlbum Album1 ANY_DRIVE 0 1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV AddMediasToAlbum Album1 ANY_DRIVE 1 2
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV AddMediasToAlbum Album1 ANY_DRIVE 2 3
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+// Check that videos have been added.
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+print OK!
+delete VCXMV
+[Endtest]
+
+
+#------------------------------------------------------------------------------------
+#
+# Add videos to same album that is open
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Add videos to same album that is open
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_1 "video.mp4" ANY_SIZE 3
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+VCXMV SetUseCopiedMedias 1
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV AddMediasToAlbum Album1 ANY_DRIVE 0 3
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+print OK!
+delete VCXMV
+[Endtest]
+
+
+#------------------------------------------------------------------------------------
+#
+# Add videos to different album that is open
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Add videos to different album that is open
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album2
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_1 "video.mp4" ANY_SIZE 3
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+VCXMV CoolDown
+
+VCXMV SetUseCopiedMedias 1
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV AddMediasToAlbum Album2 ANY_DRIVE 0 3
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CoolDown
+
+// Check that videos have been added.
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel Album2
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 0
+
+print OK!
+delete VCXMV
+[Endtest]
+
+
+#------------------------------------------------------------------------------------
+#
+# Add video that already exists in the album
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Add video that already exists in the album
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_1 "video.mp4" ANY_SIZE 3
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+VCXMV CoolDown
+
+VCXMV AddMediasToAlbum Album1 ANY_DRIVE 0 3
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV AddMediasToAlbum Album1 ANY_DRIVE 0 1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+// Check that videos have been added.
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+print OK!
+delete VCXMV
+[Endtest]
+
+
+#------------------------------------------------------------------------------------
+#
+# Add multiple videos to album, some exist already in the album
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Add multiple videos to album, some exist already in the album
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_1 "video.mp4" ANY_SIZE 20
+VCXMV CheckMediaCount ANY_DRIVE 20
+
+VCXMV CoolDown
+
+// Add first 10 videos to album
+VCXMV AddMediasToAlbum Album1 ANY_DRIVE 0 10
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+// Add from 5 to 15 to album.
+VCXMV AddMediasToAlbum Album1 ANY_DRIVE 5 15
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+// Check that videos have been added.
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 15
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Add videos to album, invalid media ids
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Add videos to album, invalid media ids
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_1 "video.mp4" ANY_SIZE 3
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+VCXMV CoolDown
+
+// Add request with invalid ids
+VCXMV AddMediasToAlbum Album1 ANY_DRIVE -1 5
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+// Ok case
+VCXMV AddMediasToAlbum Album1 ANY_DRIVE 0 1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+// Check that videos have been added.
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 1
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Remove videos from album, collection at root level
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Remove videos from album, collection at root level
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_1 "video.mp4" ANY_SIZE 3
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+VCXMV CoolDown
+
+VCXMV AddMediasToAlbum Album1 ANY_DRIVE 0 3
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV SetUseCopiedMedias 1
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV RemoveMediasFromAlbum Album1 ANY_DRIVE 0 3
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete
+waittestclass VCXMV
+
+VCXMV SetUseCopiedMedias 0
+
+VCXMV OpenLevel Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 0
+
+// Check videos still exist
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+print OK!
+delete VCXMV
+[Endtest]
+
+
+#------------------------------------------------------------------------------------
+#
+# Remove videos from album that is open
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Remove videos from album that is open
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_1 "video.mp4" ANY_SIZE 3
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+VCXMV CoolDown
+
+VCXMV AddMediasToAlbum Album1 ANY_DRIVE 0 3
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV RemoveMediasFromAlbum Album1 ANY_DRIVE 0 3
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 0
+
+// Check videos still exist
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Remove videos from album when category is open
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Remove videos from album when category is open
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_1 "video.mp4" ANY_SIZE 3
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+VCXMV CoolDown
+
+VCXMV AddMediasToAlbum Album1 ANY_DRIVE 0 3
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV RemoveMediasFromAlbum Album1 ANY_DRIVE 0 3
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 0
+
+// Check videos still exist
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+print OK!
+delete VCXMV
+[Endtest]
+
+
+#------------------------------------------------------------------------------------
+#
+# Remove videos from album when other album is open
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Remove videos from album when other album is open
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album2
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_1 "video.mp4" ANY_SIZE 3
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+VCXMV CoolDown
+
+VCXMV AddMediasToAlbum Album1 ANY_DRIVE 0 3
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV AddMediasToAlbum Album2 ANY_DRIVE 0 3
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel Album2
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV RemoveMediasFromAlbum Album1 ANY_DRIVE 0 3
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete
+waittestclass VCXMV
+
+VCXMV CoolDown
+
+// Check current album
+
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+// Check other album
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 0
+
+// Check videos still exist
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+print OK!
+delete VCXMV
+[Endtest]
+
+
+#------------------------------------------------------------------------------------
+#
+# Remove videos from album, invalid media ids
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Remove videos from album, invalid media ids
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_1 "video.mp4" ANY_SIZE 3
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+VCXMV CoolDown
+
+VCXMV AddMediasToAlbum Album1 ANY_DRIVE 0 3
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+// Current items are categories and albums, their ids will be used in request.
+VCXMV RemoveMediasFromAlbum Album1 ANY_DRIVE 0 1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete
+allownextresult KERRARGUMENT
+waittestclass VCXMV
+
+VCXMV OpenLevel Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+// Check videos still exist
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+print OK!
+delete VCXMV
+[Endtest]
+
+
+#------------------------------------------------------------------------------------
+#
+# Delete empty album
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Delete empty album
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CheckAlbumCount 1
+
+VCXMV DeleteAlbums Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumDeleted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CheckAlbumCount 0
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Delete album with videos
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Delete album with videos
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album2
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_1 "video.mp4" ANY_SIZE 3
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+VCXMV AddMediasToAlbum Album1 ANY_DRIVE 0 3
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV DeleteAlbums Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumDeleted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CheckAlbumCount 1
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+print OK!
+delete VCXMV
+[Endtest]
+
+
+#------------------------------------------------------------------------------------
+#
+# Delete album that is open
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Delete album that is open
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album2
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_1 "video.mp4" ANY_SIZE 3
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+VCXMV AddMediasToAlbum Album1 ANY_DRIVE 0 3
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+VCXMV DeleteAlbums Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumDeleted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CheckAlbumCount 1
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+print OK!
+delete VCXMV
+[Endtest]
+
+
+#------------------------------------------------------------------------------------
+#
+# Delete album when category is open
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Delete album when category is open
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album2
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_1 "video.mp4" ANY_SIZE 3
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+VCXMV CoolDown
+
+VCXMV AddMediasToAlbum Album1 ANY_DRIVE 0 3
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+VCXMV DeleteAlbums Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumDeleted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CheckAlbumCount 1
+
+print OK!
+delete VCXMV
+[Endtest]
+
+
+#------------------------------------------------------------------------------------
+#
+# Delete multiple albums with videos
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Delete multiple albums with videos
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album2
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album3
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album4
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_1 "video.mp4" ANY_SIZE 3
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+VCXMV CoolDown
+
+VCXMV AddMediasToAlbum Album1 ANY_DRIVE 0 3
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV AddMediasToAlbum Album2 ANY_DRIVE 0 3
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV AddMediasToAlbum Album3 ANY_DRIVE 0 3
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CoolDown
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV DeleteAlbums Album1 Album2 Album3
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumDeleted KVCXMYVideosTestMessageMpxAlbumDeleted KVCXMYVideosTestMessageMpxAlbumDeleted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CheckAlbumCount 1
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 3
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Delete videos that are in album, category open
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Delete videos that are in album, category open
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_1 "video.mp4" ANY_SIZE 5
+VCXMV CheckMediaCount ANY_DRIVE 5
+
+VCXMV CoolDown
+
+VCXMV AddMediasToAlbum Album1 ANY_DRIVE 0 5
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV DeleteMedias ANY_DRIVE 0 3 0
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageDeleteStarted KVCXMYVideosTestMessageDeleteResp KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CoolDown
+
+VCXMV OpenLevel Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 2
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Delete videos that are in in open album
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Delete videos that are in in open album
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_1 "video.mp4" ANY_SIZE 5
+VCXMV CheckMediaCount ANY_DRIVE 5
+
+VCXMV CoolDown
+
+VCXMV AddMediasToAlbum Album1 ANY_DRIVE 0 5
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CoolDown
+
+VCXMV OpenLevel Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV DeleteMedias ANY_DRIVE 0 3 0
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageDeleteStarted KVCXMYVideosTestMessageDeleteResp KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CoolDown
+
+VCXMV CheckMediaCount ANY_DRIVE 2
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Delete videos that are that are in multiple albums
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Delete videos that are that are in multiple albums
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album2
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album3
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_1 "video.mp4" ANY_SIZE 5
+VCXMV CheckMediaCount ANY_DRIVE 5
+
+VCXMV CoolDown
+
+VCXMV AddMediasToAlbum Album1 ANY_DRIVE 0 5
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV AddMediasToAlbum Album2 ANY_DRIVE 0 5
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV AddMediasToAlbum Album3 ANY_DRIVE 0 5
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV DeleteMedias ANY_DRIVE 0 3 0
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageDeleteStarted KVCXMYVideosTestMessageDeleteResp KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CoolDown
+
+// Check album video count
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CoolDown
+
+VCXMV OpenLevel Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+VCXMV CheckMediaCount ANY_DRIVE 2
+
+// Check album video count
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CoolDown
+
+VCXMV OpenLevel Album2
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+VCXMV CheckMediaCount ANY_DRIVE 2
+
+// Check album video count
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CoolDown
+
+VCXMV OpenLevel Album2
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+VCXMV CheckMediaCount ANY_DRIVE 2
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Delete files of videos in album, category open
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Delete files of videos in album, category open
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_1 "video.mp4" ANY_SIZE 5
+VCXMV CheckMediaCount ANY_DRIVE 5
+
+VCXMV CoolDown
+
+VCXMV AddMediasToAlbum Album1 ANY_DRIVE 0 5
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV DeleteFileOfMedia ANY_DRIVE 2
+VCXMV DeleteFileOfMedia ANY_DRIVE 1
+VCXMV DeleteFileOfMedia ANY_DRIVE 0
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified
+
+VCXMV CoolDown
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CoolDown
+
+VCXMV OpenLevel Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 2
+
+print OK!
+delete VCXMV
+[Endtest]
+
+
+#------------------------------------------------------------------------------------
+#
+# Delete files of videos in open album
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Delete files of videos in open album
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_1 "video.mp4" ANY_SIZE 5
+VCXMV CheckMediaCount ANY_DRIVE 5
+
+VCXMV CoolDown
+
+VCXMV AddMediasToAlbum Album1 ANY_DRIVE 0 5
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CoolDown
+
+VCXMV OpenLevel Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV DeleteFileOfMedia ANY_DRIVE 2
+VCXMV DeleteFileOfMedia ANY_DRIVE 1
+VCXMV DeleteFileOfMedia ANY_DRIVE 0
+
+VCXMV CoolDown
+
+VCXMV CheckMediaCount ANY_DRIVE 2
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Delete files of videos in multiple albums
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Delete files of videos in multiple albums
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album2
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CreateAlbum Album3
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumInserted KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CreateVideoFile VcxTestVideoMpeg4 DRIVE_1 "video.mp4" ANY_SIZE 5
+VCXMV CheckMediaCount ANY_DRIVE 5
+
+VCXMV CoolDown
+
+VCXMV AddMediasToAlbum Album1 ANY_DRIVE 0 5
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV AddMediasToAlbum Album2 ANY_DRIVE 0 5
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV AddMediasToAlbum Album3 ANY_DRIVE 0 5
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxAlbumModified KVCXMYVideosTestMessageCommandComplete KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV DeleteFileOfMedia ANY_DRIVE 2
+VCXMV DeleteFileOfMedia ANY_DRIVE 1
+VCXMV DeleteFileOfMedia ANY_DRIVE 0
+
+VCXMV CoolDown
+
+// Check album video count
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CoolDown
+
+VCXMV OpenLevel Album1
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+VCXMV CheckMediaCount ANY_DRIVE 2
+
+// Check album video count
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CoolDown
+
+VCXMV OpenLevel Album2
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+VCXMV CheckMediaCount ANY_DRIVE 2
+
+// Check album video count
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CoolDown
+
+VCXMV OpenLevel Album2
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+VCXMV CheckMediaCount ANY_DRIVE 2
+
+print OK!
+delete VCXMV
+[Endtest]
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/conf/VCXMyVideosCollectionPluginTestCategories.cfg Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,1396 @@
+///*
+//* 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 the License "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:
+//*
+//*/
+
+#-----------------------------------------------------------------------------------
+#
+# STIF test script file for testing VCXMyVideosCollectionPluginTest.dll
+#
+# Tests functionality for category video lists.
+#
+#-----------------------------------------------------------------------------------
+
+[StifSettings]
+CapsModifier= VcxTestClientApiCapsMod.exe
+[EndStifSettings]
+
+[Define]
+INCLUDE c:\TestFramework\VCXMVCollectionPluginTest.inc
+INCLUDE c:\TestFramework\VCXDrives.inc
+INCLUDE c:\TestFramework\VCXErrors.inc
+[Enddefine]
+
+#************************************************************************************
+# Sub Cleanup
+# Removes all videos from the phone. Collection is opened.
+#************************************************************************************
+[Sub Cleanup]
+print cleanup start
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV RemoveAllMedia
+delete VCXMV
+
+print wait 30sec
+pause 30000
+print cleanup end
+[EndSub]
+
+#************************************************************************************
+# Sub SetupVideos
+# Creates 5 videos with defined origin. List will be:
+#
+# a.mp4
+# b.mp4
+# c.mp4
+# d.mp4
+# e.mp4
+#
+# 2nd and 4th videos have new flag set.
+#************************************************************************************
+[Sub SetupVideos]
+
+callsub Cleanup
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+VCXMV SetSortingOrder EVcxMyVideosSortingName
+
+VCXMV SetFileCheck 0
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+// Create some video objects.
+VCXMV CreateVideoFile VcxTestVideo3Gp DRIVE_1 "a.mp4"
+pause 1000
+VCXMV CreateVideoFile VcxTestVideo3Gp DRIVE_1 "b.mp4"
+pause 1000
+VCXMV CreateVideoFile VcxTestVideo3Gp DRIVE_1 "c.mp4"
+pause 1000
+VCXMV CreateVideoFile VcxTestVideo3Gp DRIVE_1 "d.mp4"
+pause 1000
+VCXMV CreateVideoFile VcxTestVideo3Gp DRIVE_1 "e.mp4"
+
+pause 10000
+
+VCXMV GetAllMediaFullDetails
+
+VCXMV SetAutomaticRefresh 0
+
+VCXMV CreateCopyOfMedia ANY_DRIVE 0
+VCXMV SetMediaDetail EVcxTestMapping_KVcxMediaMyVideosOrigin ORIGIN
+VCXMV SetMediaDetail EVcxTestMapping_KMPXMediaGeneralFlags 0
+VCXMV OutsideMediaUpdate
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxVideoModified
+waittestclass VCXMV
+
+VCXMV CreateCopyOfMedia ANY_DRIVE 1
+VCXMV SetMediaDetail EVcxTestMapping_KVcxMediaMyVideosOrigin ORIGIN
+VCXMV SetMediaDetail EVcxTestMapping_KVcxMediaMyVideosModifiedDateCurrent
+VCXMV SetMediaDetail EVcxTestMapping_KMPXMediaGeneralFlags EVcxMyVideosVideoNew
+VCXMV OutsideMediaUpdate
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxVideoModified
+waittestclass VCXMV
+
+VCXMV CreateCopyOfMedia ANY_DRIVE 2
+VCXMV SetMediaDetail EVcxTestMapping_KVcxMediaMyVideosOrigin ORIGIN
+VCXMV SetMediaDetail EVcxTestMapping_KMPXMediaGeneralFlags 0
+VCXMV OutsideMediaUpdate
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxVideoModified
+waittestclass VCXMV
+
+VCXMV CreateCopyOfMedia ANY_DRIVE 3
+VCXMV SetMediaDetail EVcxTestMapping_KVcxMediaMyVideosOrigin ORIGIN
+VCXMV SetMediaDetail EVcxTestMapping_KVcxMediaMyVideosModifiedDateCurrent
+VCXMV SetMediaDetail EVcxTestMapping_KMPXMediaGeneralFlags EVcxMyVideosVideoNew
+VCXMV OutsideMediaUpdate
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxVideoModified
+waittestclass VCXMV
+
+VCXMV CreateCopyOfMedia ANY_DRIVE 4
+VCXMV SetMediaDetail EVcxTestMapping_KVcxMediaMyVideosOrigin ORIGIN
+VCXMV SetMediaDetail EVcxTestMapping_KMPXMediaGeneralFlags 0
+VCXMV OutsideMediaUpdate
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxVideoModified
+waittestclass VCXMV
+
+delete VCXMV
+[EndSub]
+
+#------------------------------------------------------------------------------------
+#
+# Tests opening 'All videos' category when it's empty.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title All videos - empty
+
+callsub Cleanup
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 0
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Tests opening 'Downloads' category when it's empty.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Downloads - empty
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosDownloads
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 0
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Tests opening 'TV Recordings' category when it's empty.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title TV recordings - empty
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosTvRecordings
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 0
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Tests opening 'Captured videos' category when it's empty.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Captured videos - empty
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosCapturedVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 0
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Tests opening 'Other videos' category when it's empty.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Other videos - empty
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosOther
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 0
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Creates five video files, one for every origin. This case is needed by following cases.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Setup all origins
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+VCXMV SetSortingOrder EVcxMyVideosSortingName
+
+VCXMV SetFileCheck 0
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+// Create some video objects.
+VCXMV CreateVideoFile VcxTestVideo3Gp DRIVE_1 "a.mp4"
+pause 1000
+VCXMV CreateVideoFile VcxTestVideo3Gp DRIVE_1 "b.mp4"
+pause 1000
+VCXMV CreateVideoFile VcxTestVideo3Gp DRIVE_1 "c.mp4"
+pause 1000
+VCXMV CreateVideoFile VcxTestVideo3Gp DRIVE_1 "d.mp4"
+pause 1000
+VCXMV CreateVideoFile VcxTestVideo3Gp DRIVE_1 "e.mp4"
+pause 1000
+
+VCXMV SetAutomaticRefresh 0
+
+VCXMV CreateCopyOfMedia ANY_DRIVE 0
+VCXMV SetMediaDetail EVcxTestMapping_KMPXMediaGeneralTitle "OriginOther"
+VCXMV SetMediaDetail EVcxTestMapping_KVcxMediaMyVideosOrigin EVcxMyVideosOriginOther
+VCXMV OutsideMediaUpdate
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxVideoModified
+waittestclass VCXMV
+
+VCXMV CreateCopyOfMedia ANY_DRIVE 1
+VCXMV SetMediaDetail EVcxTestMapping_KMPXMediaGeneralTitle "OriginCamera"
+VCXMV SetMediaDetail EVcxTestMapping_KVcxMediaMyVideosOrigin EVcxMyVideosOriginCapturedWithCamera
+VCXMV OutsideMediaUpdate
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxVideoModified
+waittestclass VCXMV
+
+VCXMV CreateCopyOfMedia ANY_DRIVE 2
+VCXMV SetMediaDetail EVcxTestMapping_KMPXMediaGeneralTitle "OriginDownloaded"
+VCXMV SetMediaDetail EVcxTestMapping_KVcxMediaMyVideosOrigin EVcxMyVideosOriginDownloaded
+VCXMV OutsideMediaUpdate
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxVideoModified
+waittestclass VCXMV
+
+VCXMV CreateCopyOfMedia ANY_DRIVE 3
+VCXMV SetMediaDetail EVcxTestMapping_KMPXMediaGeneralTitle "OriginSideloaded"
+VCXMV SetMediaDetail EVcxTestMapping_KVcxMediaMyVideosOrigin EVcxMyVideosOriginSideLoaded
+VCXMV OutsideMediaUpdate
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxVideoModified
+waittestclass VCXMV
+
+VCXMV CreateCopyOfMedia ANY_DRIVE 4
+VCXMV SetMediaDetail EVcxTestMapping_KMPXMediaGeneralTitle "OriginRecording"
+VCXMV SetMediaDetail EVcxTestMapping_KVcxMediaMyVideosOrigin EVcxMyVideosOriginTvRecording
+VCXMV OutsideMediaUpdate
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxVideoModified
+waittestclass VCXMV
+
+VCXMV SetAutomaticRefresh 1
+
+VCXMV GetAllMediaFullDetails
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Tests opening 'All videos' category when device has videos with different origins.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title All videos - all origins
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+VCXMV SetFileCheck 0
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 5
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Tests opening 'Downloads' category when device has videos with different origins.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Downloads - all origins
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+VCXMV SetFileCheck 0
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosDownloads
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 1
+
+VCXMV CheckMediaDetail ANY_DRIVE 0 EVcxTestMapping_KMPXMediaGeneralTitle "OriginDownloaded"
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Tests opening 'TV recordings' category when device has videos with different origins.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title TV recordings - all origins
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+VCXMV SetFileCheck 0
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosTvRecordings
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 1
+VCXMV CheckMediaDetail ANY_DRIVE 0 EVcxTestMapping_KMPXMediaGeneralTitle "OriginRecording"
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Tests opening 'Captured videos' category when device has videos with different origins.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Captured videos - all origins
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+VCXMV SetFileCheck 0
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosCapturedVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 1
+VCXMV CheckMediaDetail ANY_DRIVE 0 EVcxTestMapping_KMPXMediaGeneralTitle "OriginCamera"
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Tests opening 'Other videos' category when device has videos with different origins.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Other videos - all origins
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+VCXMV SetFileCheck 0
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosOther
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaCount ANY_DRIVE 2
+VCXMV CheckMediaDetail ANY_DRIVE 0 EVcxTestMapping_KMPXMediaGeneralTitle "OriginOther"
+VCXMV CheckMediaDetail ANY_DRIVE 1 EVcxTestMapping_KMPXMediaGeneralTitle "OriginSideloaded"
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Creates two videos for each different origin, one with new flag and one without.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Setup all origins
+
+callsub Cleanup
+
+// TESTCASE START
+
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+VCXMV SetSortingOrder EVcxMyVideosSortingName
+
+VCXMV SetFileCheck 0
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV OpenLevel EVcxMyVideosAllVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+// Create some video objects.
+VCXMV CreateVideoFile VcxTestVideo3Gp DRIVE_1 "a.mp4"
+pause 1000
+VCXMV CreateVideoFile VcxTestVideo3Gp DRIVE_1 "b.mp4"
+pause 1000
+VCXMV CreateVideoFile VcxTestVideo3Gp DRIVE_1 "c.mp4"
+pause 1000
+VCXMV CreateVideoFile VcxTestVideo3Gp DRIVE_1 "d.mp4"
+pause 1000
+VCXMV CreateVideoFile VcxTestVideo3Gp DRIVE_1 "e.mp4"
+pause 1000
+VCXMV CreateVideoFile VcxTestVideo3Gp DRIVE_1 "f.mp4"
+pause 1000
+VCXMV CreateVideoFile VcxTestVideo3Gp DRIVE_1 "g.mp4"
+pause 1000
+VCXMV CreateVideoFile VcxTestVideo3Gp DRIVE_1 "h.mp4"
+pause 1000
+VCXMV CreateVideoFile VcxTestVideo3Gp DRIVE_1 "i.mp4"
+pause 1000
+VCXMV CreateVideoFile VcxTestVideo3Gp DRIVE_1 "j.mp4"
+pause 1000
+
+VCXMV GetAllMediaFullDetails
+
+VCXMV SetAutomaticRefresh 0
+
+// Set 5 videos with new video flag
+
+VCXMV CreateCopyOfMedia ANY_DRIVE 0
+VCXMV SetMediaDetail EVcxTestMapping_KMPXMediaGeneralTitle "OriginOther"
+VCXMV SetMediaDetail EVcxTestMapping_KVcxMediaMyVideosOrigin EVcxMyVideosOriginOther
+VCXMV SetMediaDetail EVcxTestMapping_KMPXMediaGeneralFlags EVcxMyVideosVideoNew
+VCXMV SetMediaDetail EVcxTestMapping_KVcxMediaMyVideosModifiedDateCurrent
+VCXMV OutsideMediaUpdate
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxVideoModified
+waittestclass VCXMV
+
+VCXMV CreateCopyOfMedia ANY_DRIVE 1
+VCXMV SetMediaDetail EVcxTestMapping_KMPXMediaGeneralTitle "OriginCamera"
+VCXMV SetMediaDetail EVcxTestMapping_KVcxMediaMyVideosOrigin EVcxMyVideosOriginCapturedWithCamera
+VCXMV SetMediaDetail EVcxTestMapping_KMPXMediaGeneralFlags EVcxMyVideosVideoNew
+VCXMV SetMediaDetail EVcxTestMapping_KVcxMediaMyVideosModifiedDateCurrent
+VCXMV OutsideMediaUpdate
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxVideoModified
+waittestclass VCXMV
+
+VCXMV CreateCopyOfMedia ANY_DRIVE 2
+VCXMV SetMediaDetail EVcxTestMapping_KMPXMediaGeneralTitle "OriginDownloaded"
+VCXMV SetMediaDetail EVcxTestMapping_KVcxMediaMyVideosOrigin EVcxMyVideosOriginDownloaded
+VCXMV SetMediaDetail EVcxTestMapping_KMPXMediaGeneralFlags EVcxMyVideosVideoNew
+VCXMV SetMediaDetail EVcxTestMapping_KVcxMediaMyVideosModifiedDateCurrent
+VCXMV OutsideMediaUpdate
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxVideoModified
+waittestclass VCXMV
+
+VCXMV CreateCopyOfMedia ANY_DRIVE 3
+VCXMV SetMediaDetail EVcxTestMapping_KMPXMediaGeneralTitle "OriginSideloaded"
+VCXMV SetMediaDetail EVcxTestMapping_KVcxMediaMyVideosOrigin EVcxMyVideosOriginSideLoaded
+VCXMV SetMediaDetail EVcxTestMapping_KMPXMediaGeneralFlags EVcxMyVideosVideoNew
+VCXMV SetMediaDetail EVcxTestMapping_KVcxMediaMyVideosModifiedDateCurrent
+VCXMV OutsideMediaUpdate
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxVideoModified
+waittestclass VCXMV
+
+VCXMV CreateCopyOfMedia ANY_DRIVE 4
+VCXMV SetMediaDetail EVcxTestMapping_KMPXMediaGeneralTitle "OriginRecording"
+VCXMV SetMediaDetail EVcxTestMapping_KVcxMediaMyVideosOrigin EVcxMyVideosOriginTvRecording
+VCXMV SetMediaDetail EVcxTestMapping_KMPXMediaGeneralFlags EVcxMyVideosVideoNew
+VCXMV SetMediaDetail EVcxTestMapping_KVcxMediaMyVideosModifiedDateCurrent
+VCXMV OutsideMediaUpdate
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxVideoModified
+waittestclass VCXMV
+
+// Set next 5 videos with no flags
+
+VCXMV CreateCopyOfMedia ANY_DRIVE 5
+VCXMV SetMediaDetail EVcxTestMapping_KMPXMediaGeneralTitle "OriginOther2"
+VCXMV SetMediaDetail EVcxTestMapping_KVcxMediaMyVideosOrigin EVcxMyVideosOriginOther
+VCXMV SetMediaDetail EVcxTestMapping_KMPXMediaGeneralFlags 0
+VCXMV OutsideMediaUpdate
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxVideoModified
+waittestclass VCXMV
+
+VCXMV CreateCopyOfMedia ANY_DRIVE 6
+VCXMV SetMediaDetail EVcxTestMapping_KMPXMediaGeneralTitle "OriginCamera2"
+VCXMV SetMediaDetail EVcxTestMapping_KVcxMediaMyVideosOrigin EVcxMyVideosOriginCapturedWithCamera
+VCXMV SetMediaDetail EVcxTestMapping_KMPXMediaGeneralFlags 0
+VCXMV OutsideMediaUpdate
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxVideoModified
+waittestclass VCXMV
+
+VCXMV CreateCopyOfMedia ANY_DRIVE 7
+VCXMV SetMediaDetail EVcxTestMapping_KMPXMediaGeneralTitle "OriginDownloaded2"
+VCXMV SetMediaDetail EVcxTestMapping_KVcxMediaMyVideosOrigin EVcxMyVideosOriginDownloaded
+VCXMV SetMediaDetail EVcxTestMapping_KMPXMediaGeneralFlags 0
+VCXMV OutsideMediaUpdate
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxVideoModified
+waittestclass VCXMV
+
+VCXMV CreateCopyOfMedia ANY_DRIVE 8
+VCXMV SetMediaDetail EVcxTestMapping_KMPXMediaGeneralTitle "OriginSideloaded2"
+VCXMV SetMediaDetail EVcxTestMapping_KVcxMediaMyVideosOrigin EVcxMyVideosOriginSideLoaded
+VCXMV SetMediaDetail EVcxTestMapping_KMPXMediaGeneralFlags 0
+VCXMV OutsideMediaUpdate
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxVideoModified
+waittestclass VCXMV
+
+VCXMV CreateCopyOfMedia ANY_DRIVE 9
+VCXMV SetMediaDetail EVcxTestMapping_KMPXMediaGeneralTitle "OriginRecording2"
+VCXMV SetMediaDetail EVcxTestMapping_KVcxMediaMyVideosOrigin EVcxMyVideosOriginTvRecording
+VCXMV SetMediaDetail EVcxTestMapping_KMPXMediaGeneralFlags 0
+VCXMV OutsideMediaUpdate
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxVideoModified
+waittestclass VCXMV
+
+VCXMV SetAutomaticRefresh 1
+
+VCXMV RefreshContents
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV GetAllMediaFullDetails
+
+VCXMV CloseLevel
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CoolDown
+
+delete VCXMV
+
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Tests that category 'All videos' has correct details when there's videos with different origins.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title All videos - category details
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KMPXMediaGeneralTitle "All videos"
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount 10
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount 5
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName "OriginRecording"
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Tests that category 'Downloads' has correct details when there's videos with different origins.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Downloads - category details
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosDownloads EVcxTestMapping_KMPXMediaGeneralTitle "Downloads"
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosDownloads EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount 2
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosDownloads EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount 1
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosDownloads EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName "OriginDownloaded"
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Tests that category 'TV recorgins' has correct details when there's videos with different origins.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title TV recordings - category details
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosTvRecordings EVcxTestMapping_KMPXMediaGeneralTitle "TV recordings"
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosTvRecordings EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount 2
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosTvRecordings EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount 1
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosTvRecordings EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName "OriginRecording"
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Tests that category 'Captured videos' has correct details when there's videos with different origins.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Captured videos - category details
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosCapturedVideos EVcxTestMapping_KMPXMediaGeneralTitle "Captured videos"
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosCapturedVideos EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount 2
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosCapturedVideos EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount 1
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosCapturedVideos EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName "OriginCamera"
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Tests that category 'Other videos' has correct details when there's videos with different origins.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Other videos - category details
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV
+
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KMPXMediaGeneralTitle "Other"
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount 4
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount 2
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName "OriginSideloaded"
+
+print OK!
+delete VCXMV
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Tests that category 'Other videos' details are updated when videos are deleted.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Other videos - video is deleted, category details
+
+var ORIGIN EVcxMyVideosOriginOther
+callsub SetupVideos
+
+// Create client to modify videos.
+create VCXMyVideosCollectionPluginTest VCXMV2
+VCXMV2 Create
+VCXMV2 OpenCollection VCXCollectionMyVideos
+VCXMV2 WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV2
+VCXMV2 OpenLevel EVcxMyVideosAllVideos
+VCXMV2 WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV2
+
+// And second client to check categories.
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KMPXMediaGeneralTitle "Other"
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount 5
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount 2
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName "d"
+
+// Delete last media, it doesn't have new flag.
+VCXMV2 DeleteMedia ANY_DRIVE 4 0
+
+VCXMV CoolDown
+
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KMPXMediaGeneralTitle "Other"
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount 4
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount 2
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName "d"
+
+// Delete last media, it has new flag.
+VCXMV2 DeleteMedia ANY_DRIVE 3 0
+
+VCXMV CoolDown
+
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KMPXMediaGeneralTitle "Other"
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount 3
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount 1
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName "b"
+
+print OK!
+delete VCXMV
+delete VCXMV2
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Tests that category 'Other videos' details are updated when videos are added by sideloading.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Other videos - video is sideloaded, category details
+
+var ORIGIN EVcxMyVideosOriginOther
+callsub SetupVideos
+
+// Create client to modify videos.
+create VCXMyVideosCollectionPluginTest VCXMV2
+VCXMV2 Create
+VCXMV2 OpenCollection VCXCollectionMyVideos
+VCXMV2 WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV2
+VCXMV2 OpenLevel EVcxMyVideosAllVideos
+VCXMV2 WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV2
+
+// And second client to check categories.
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KMPXMediaGeneralTitle "Other"
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount 5
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount 2
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName "d"
+
+VCXMV2 CreateVideoFile VcxTestVideo3Gp DRIVE_1 "1.mp4"
+pause 500
+VCXMV2 CreateVideoFile VcxTestVideo3Gp DRIVE_1 "2.mp4"
+pause 5000
+VCXMV2 CreateVideoFile VcxTestVideo3Gp DRIVE_1 "3.mp4"
+
+VCXMV CoolDown
+
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KMPXMediaGeneralTitle "Other"
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount 8
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount 5
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName "3"
+
+print OK!
+delete VCXMV
+delete VCXMV2
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Tests that category 'Other videos' details are updated when videos are removed.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Other videos - video is removed, category details
+
+var ORIGIN EVcxMyVideosOriginOther
+callsub SetupVideos
+
+// Create client to modify videos.
+create VCXMyVideosCollectionPluginTest VCXMV2
+VCXMV2 Create
+VCXMV2 OpenCollection VCXCollectionMyVideos
+VCXMV2 WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV2
+VCXMV2 OpenLevel EVcxMyVideosAllVideos
+VCXMV2 WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV2
+
+// And second client to check categories.
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KMPXMediaGeneralTitle "Other"
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount 5
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount 2
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName "d"
+
+// Delete last media, it doesn't have new flag.
+VCXMV2 RemoveMedia ANY_DRIVE 4 0
+VCXMV2 CoolDown
+
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KMPXMediaGeneralTitle "Other"
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount 4
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount 2
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName "d"
+
+// Delete last media, it has new flag.
+VCXMV2 RemoveMedia ANY_DRIVE 3 0
+VCXMV2 CoolDown
+
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KMPXMediaGeneralTitle "Other"
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount 3
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount 1
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName "b"
+
+print OK!
+delete VCXMV
+delete VCXMV2
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Tests that category 'Other videos' details are updated when the file of a video deleted.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Other videos - file of a video is deleted, category details
+
+var ORIGIN EVcxMyVideosOriginOther
+callsub SetupVideos
+
+// Create client to modify videos.
+create VCXMyVideosCollectionPluginTest VCXMV2
+VCXMV2 Create
+VCXMV2 OpenCollection VCXCollectionMyVideos
+VCXMV2 WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV2
+VCXMV2 OpenLevel EVcxMyVideosAllVideos
+VCXMV2 WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV2
+
+// And second client to check categories.
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KMPXMediaGeneralTitle "Other"
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount 5
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount 2
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName "d"
+
+// Delete last media, it doesn't have new flag.
+VCXMV2 DeleteFileOfMedia ANY_DRIVE 4
+VCXMV2 CoolDown
+
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KMPXMediaGeneralTitle "Other"
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount 4
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount 2
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName "d"
+
+// Delete last media, it has new flag.
+VCXMV2 DeleteFileOfMedia ANY_DRIVE 3
+VCXMV2 CoolDown
+
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KMPXMediaGeneralTitle "Other"
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount 3
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount 1
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName "b"
+
+print OK!
+delete VCXMV
+delete VCXMV2
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Tests that category 'Other videos' details are updated when new flag of a video is modified.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title Other videos - video new flag is modified, category details
+
+var ORIGIN EVcxMyVideosOriginOther
+callsub SetupVideos
+
+// Create client to modify videos.
+create VCXMyVideosCollectionPluginTest VCXMV2
+VCXMV2 Create
+VCXMV2 OpenCollection VCXCollectionMyVideos
+VCXMV2 WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV2
+VCXMV2 OpenLevel EVcxMyVideosAllVideos
+VCXMV2 WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV2
+
+// And second client to check categories.
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KMPXMediaGeneralTitle "Other"
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount 5
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount 2
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName "d"
+
+// Set new flag off for a media.
+VCXMV2 CreateCopyOfMedia ANY_DRIVE 3
+VCXMV2 SetMediaDetail EVcxTestMapping_KMPXMediaGeneralFlags 0
+VCXMV2 SetMedia 1
+VCXMV2 WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxVideoModified
+waittestclass VCXMV2
+
+VCXMV CoolDown
+
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KMPXMediaGeneralTitle "Other"
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount 5
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount 1
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName "b"
+
+// Set new flag on for another media.
+VCXMV2 CreateCopyOfMedia ANY_DRIVE 4
+VCXMV2 SetMediaDetail EVcxTestMapping_KMPXMediaGeneralFlags EVcxMyVideosVideoNew
+VCXMV2 SetMedia 1
+VCXMV2 WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxVideoModified
+waittestclass VCXMV2
+
+VCXMV CoolDown
+
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KMPXMediaGeneralTitle "Other"
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount 5
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount 2
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosOther EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName "e"
+
+print OK!
+delete VCXMV
+delete VCXMV2
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Tests that category 'All videos' details are updated when video is deleted.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title All videos - video is deleted, category details
+
+var ORIGIN EVcxMyVideosOriginOther
+callsub SetupVideos
+
+// Create client to modify videos.
+create VCXMyVideosCollectionPluginTest VCXMV2
+VCXMV2 Create
+VCXMV2 OpenCollection VCXCollectionMyVideos
+VCXMV2 WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV2
+VCXMV2 OpenLevel EVcxMyVideosAllVideos
+VCXMV2 WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV2
+
+// And second client to check categories.
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KMPXMediaGeneralTitle "All videos"
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount 5
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount 2
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName "d"
+
+// Delete last media, it doesn't have new flag.
+VCXMV2 DeleteMedia ANY_DRIVE 4 0
+
+VCXMV CoolDown
+
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KMPXMediaGeneralTitle "All videos"
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount 4
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount 2
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName "d"
+
+// Delete last media, it has new flag.
+VCXMV2 DeleteMedia ANY_DRIVE 3 0
+
+VCXMV CoolDown
+
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KMPXMediaGeneralTitle "All videos"
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount 3
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount 1
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName "b"
+
+print OK!
+delete VCXMV
+delete VCXMV2
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Tests that category 'All videos' details are updated when video is added by sideloading.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title All videos - video is sideloaded, category details
+
+var ORIGIN EVcxMyVideosOriginOther
+callsub SetupVideos
+
+// Create client to modify videos.
+create VCXMyVideosCollectionPluginTest VCXMV2
+VCXMV2 Create
+VCXMV2 OpenCollection VCXCollectionMyVideos
+VCXMV2 WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV2
+VCXMV2 OpenLevel EVcxMyVideosAllVideos
+VCXMV2 WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV2
+
+// And second client to check categories.
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KMPXMediaGeneralTitle "All videos"
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount 5
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount 2
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName "d"
+
+VCXMV2 CreateVideoFile VcxTestVideo3Gp DRIVE_1 "1.mp4"
+pause 500
+VCXMV2 CreateVideoFile VcxTestVideo3Gp DRIVE_1 "2.mp4"
+pause 5000
+VCXMV2 CreateVideoFile VcxTestVideo3Gp DRIVE_1 "3.mp4"
+
+VCXMV CoolDown
+
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KMPXMediaGeneralTitle "All videos"
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount 8
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount 5
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName "3"
+
+print OK!
+delete VCXMV
+delete VCXMV2
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Tests that category 'All videos' details are updated when video is removed.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title All videos - video is removed, category details
+
+var ORIGIN EVcxMyVideosOriginOther
+callsub SetupVideos
+
+// Create client to modify videos.
+create VCXMyVideosCollectionPluginTest VCXMV2
+VCXMV2 Create
+VCXMV2 OpenCollection VCXCollectionMyVideos
+VCXMV2 WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV2
+VCXMV2 OpenLevel EVcxMyVideosAllVideos
+VCXMV2 WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV2
+
+// And second client to check categories.
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KMPXMediaGeneralTitle "All videos"
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount 5
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount 2
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName "d"
+
+// Delete last media, it doesn't have new flag.
+VCXMV2 RemoveMedia ANY_DRIVE 4 0
+VCXMV2 CoolDown
+
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KMPXMediaGeneralTitle "All videos"
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount 4
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount 2
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName "d"
+
+// Delete last media, it has new flag.
+VCXMV2 RemoveMedia ANY_DRIVE 3 0
+VCXMV2 CoolDown
+
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KMPXMediaGeneralTitle "All videos"
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount 3
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount 1
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName "b"
+
+print OK!
+delete VCXMV
+delete VCXMV2
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Tests that category 'All videos' details are updated when file of a video is deleted.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title All videos - video file is deleted, category details
+
+var ORIGIN EVcxMyVideosOriginOther
+callsub SetupVideos
+
+// Create client to modify videos.
+create VCXMyVideosCollectionPluginTest VCXMV2
+VCXMV2 Create
+VCXMV2 OpenCollection VCXCollectionMyVideos
+VCXMV2 WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV2
+VCXMV2 OpenLevel EVcxMyVideosAllVideos
+VCXMV2 WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV2
+
+// And second client to check categories.
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KMPXMediaGeneralTitle "All videos"
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount 5
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount 2
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName "d"
+
+// Delete last media, it doesn't have new flag.
+VCXMV2 DeleteFileOfMedia ANY_DRIVE 4
+VCXMV2 CoolDown
+
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KMPXMediaGeneralTitle "All videos"
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount 4
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount 2
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName "d"
+
+// Delete last media, it has new flag.
+VCXMV2 DeleteFileOfMedia ANY_DRIVE 3
+VCXMV2 CoolDown
+
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KMPXMediaGeneralTitle "All videos"
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount 3
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount 1
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName "b"
+
+print OK!
+delete VCXMV
+delete VCXMV2
+[Endtest]
+
+#------------------------------------------------------------------------------------
+#
+# Tests that category 'All videos' details are updated when new flag of a video is modified.
+#
+#------------------------------------------------------------------------------------
+[Test]
+title All videos - video new flag is modified, category details
+
+var ORIGIN EVcxMyVideosOriginOther
+callsub SetupVideos
+
+// Create client to modify videos.
+create VCXMyVideosCollectionPluginTest VCXMV2
+VCXMV2 Create
+VCXMV2 OpenCollection VCXCollectionMyVideos
+VCXMV2 WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV2
+VCXMV2 OpenLevel EVcxMyVideosAllVideos
+VCXMV2 WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened KVCXMYVideosTestMessageListComplete
+waittestclass VCXMV2
+
+// And second client to check categories.
+create VCXMyVideosCollectionPluginTest VCXMV
+VCXMV Create
+
+VCXMV OpenCollection VCXCollectionMyVideos
+VCXMV WaitForMessages 1MINUTE KVCXMYVideosTestMessageCollectionOpened
+waittestclass VCXMV
+
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KMPXMediaGeneralTitle "All videos"
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount 5
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount 2
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName "d"
+
+// Set new flag off for a media.
+VCXMV2 CreateCopyOfMedia ANY_DRIVE 3
+VCXMV2 SetMediaDetail EVcxTestMapping_KMPXMediaGeneralFlags 0
+VCXMV2 SetMedia 1
+VCXMV2 WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxVideoModified
+waittestclass VCXMV2
+
+VCXMV CoolDown
+
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KMPXMediaGeneralTitle "All videos"
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount 5
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount 1
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName "b"
+
+// Set new flag on for another media.
+VCXMV2 CreateCopyOfMedia ANY_DRIVE 4
+VCXMV2 SetMediaDetail EVcxTestMapping_KMPXMediaGeneralFlags EVcxMyVideosVideoNew
+VCXMV2 SetMedia 1
+VCXMV2 WaitForMessages 1MINUTE KVCXMYVideosTestMessageMpxVideoModified
+waittestclass VCXMV2
+
+VCXMV CoolDown
+
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KMPXMediaGeneralTitle "All videos"
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryItemCount 5
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemCount 2
+VCXMV CheckMediaDetail ANY_DRIVE EVcxMyVideosAllVideos EVcxTestMapping_KVcxMediaMyVideosCategoryNewItemName "e"
+
+print OK!
+delete VCXMV
+delete VCXMV2
+[Endtest]
--- a/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/conf/vcxmvcollectionplugintest.inc Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/conf/vcxmvcollectionplugintest.inc Thu Apr 01 23:22:15 2010 +0300
@@ -1,20 +1,38 @@
-
-VCXCollectionMyVideos "20016B97" old
-// 0 is mapped to the VCXCollectionMyVideos constant
-//VCXCollectionMyVideos "0"
-
-VCXCollectionMusic "101FFC3A"
-VCXCollectionPodcast "101FFC3C"
+///*
+//* 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 the License "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:
+//*
+//*/
-// Index, not id of the item. always same?
-// From vcxmyvideoscollection.hrh
-EVcxMyVideosAllVideos 0
-//EVcxMyVideosPlaylists
-EVcxMyVideosDownloads 1
-EVcxMyVideosTvRecordings 2
-EVcxMyVideosCapturedVideos 3 // NO SUPPORT ON UI
-EVcxMyVideosOther 4
-//EVcxMyVideosDownloadList 5 // NOT SUPPORTED
+ANY_SIZE -1
+
+// 0 is mapped to the VCXCollectionMyVideos constant
+VCXCollectionMyVideos "0"
+
+// From vcxmyvideoscategories.cpp
+EVcxMyVideosAllVideos "All videos"
+EVcxMyVideosDownloads "Downloads"
+EVcxMyVideosTvRecordings "TV recordings"
+EVcxMyVideosCapturedVideos "Captured videos"
+EVcxMyVideosOther "Other"
+
+// Album names for tests.
+Album1 "Video album 1"
+Album2 "Video album 2"
+Album3 "Video album 3"
+Album4 "Video album 4"
+Album5 "Video album 5"
// Download state
EVcxMyVideosDlStateNone 0
@@ -42,26 +60,14 @@
PAUSE_MV_CASE_BEGIN 500
MV_LOOP_COUNT 100
-// From CIptvTestVideoCreator.h
-IptvTestVideo3Gp 0 // Extension .3GP
-IptvTestVideo3Gp2 1 // Extension .3G2
-IptvTestVideoMp2 2 // Extension .MP2
-IptvTestVideoMpeg1 3 // Extension .MPG
-IptvTestVideoMpeg2 4 // Extension .MPG
-IptvTestVideoSuperVideoCd 5 // Extension .MPG
-IptvTestVideoMp3 6 // Extension .MP3
-IptvTestVideoAppleMpeg 7 // Extension .MP4
-IptvTestVideoMpeg4 8 // Extension .MP4
-IptvTestVideoMpegAvc 9 // Extension .MP4
-IptvTestVideoQuicktime 10 // Extension .MOV
-IptvTestVideoRealVideo 11 // Extension .RM
-IptvTestVideoAvi 12 // Extension .AVI
-IptvTestVideoWmv 13 // Extension .WMV
-IptvTestVideoAviAC3 14 // Extension .AVI
+// From vcxmyvideostestutils.h
+VcxTestVideo3Gp 0 // Extension .3GP
+VcxTestVideoMpeg4 1 // Extension .MP4
-PAUSE_SIDELOAD 30000 // 30 seconds
-PAUSE_SIDELOAD_LONG 60000 // a minute
-PAUSE_SIDELOAD_VERY_LONG 300000 // 10 minutes
+PAUSE_SIDELOAD_15_SECONDS 15000
+PAUSE_SIDELOAD_30_SECONDS 30000
+PAUSE_SIDELOAD_MINUTE 60000
+PAUSE_SIDELOAD_10_MINUTES 300000
KVCXMYVideosTestMessageNotAccepted 0
@@ -88,12 +94,16 @@
KVCXMYVideosTestMessageCommandCanceled 2012
KVCXMYVideosTestMessageCollectionGeneral 3000
-KVCXMYVideosTestMessageCollectionItemChanged 3001
-KVCXMYVideosTestMessageCollectionCategoryChanged 3002
-KVCXMYVideosTestMessageMpxItemInserted 4000
-KVCXMYVideosTestMessageMpxItemDeleted 4001
-KVCXMYVideosTestMessageMpxItemModified 4002
+KVCXMYVideosTestMessageMpxVideoInserted 4000
+KVCXMYVideosTestMessageMpxCategoryInserted 4001
+KVCXMYVideosTestMessageMpxAlbumInserted 4002
+KVCXMYVideosTestMessageMpxVideoDeleted 4003
+KVCXMYVideosTestMessageMpxCategoryDeleted 4004
+KVCXMYVideosTestMessageMpxAlbumDeleted 4005
+KVCXMYVideosTestMessageMpxVideoModified 4006
+KVCXMYVideosTestMessageMpxCategoryModified 4007
+KVCXMYVideosTestMessageMpxAlbumModified 4008
KVCXMyVideosTestMessageVideoListOrderChanged 5000
@@ -216,16 +226,6 @@
FREESPACE_5MB 5120000
FREESPACE_10MB 10240000
-// http://193.65.182.78/nokia_vod.xml
-SERVICE_1 "NokiaVideos"
-// http://193.65.182.78/testingfeed_iptvengine.xml
-SERVICE_2 "Enginetestingfeed"
-// http://193.65.182.78/miscvideos.xml
-SERVICE_MISCVIDEOS "Miscvideos"
-// http://193.65.182.78/misc/smallvideos/smallvideos.xml
-SERVICE_SMALLVIDEOS "SmallVideos"
-
-
KVcxNsMpxEventDownloadStarted 1
KVcxNsMpxEventAllDownloadsEnded 2
KVcxNsMpxEventDownloadCompleted 4
--- a/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/custom/postrun_custom.xml Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/custom/postrun_custom.xml Thu Apr 01 23:22:15 2010 +0300
@@ -14,30 +14,6 @@
<param path="c:\logs\Fusion\*"/>
</params>
</step>
-<step name="Fetch Livetv logs" harness="STIF" enabled="true" passrate="100" significant="false">
- <command>fetch-log</command>
- <params>
- <param type="text"/>
- <param delete="true"/>
- <param path="c:\logs\Livetv\*"/>
- </params>
-</step>
-<step name="Fetch IPTV logs" harness="STIF" enabled="true" passrate="100" significant="false">
- <command>fetch-log</command>
- <params>
- <param type="text"/>
- <param delete="true"/>
- <param path="c:\logs\iptv\*"/>
- </params>
-</step>
-<step name="Fetch verify files" harness="STIF" enabled="true" passrate="100" significant="false">
- <command>fetch-log</command>
- <params>
- <param type="text"/>
- <param delete="true"/>
- <param path="c:\testing\data\verifynew\*"/>
- </params>
-</step>
<step name="Fetch TestScripter logs" harness="STIF" enabled="true" passrate="100" significant="false">
<command>fetch-log</command>
<params>
--- a/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/custom/prerun_custom.xml Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/custom/prerun_custom.xml Thu Apr 01 23:22:15 2010 +0300
@@ -10,30 +10,6 @@
<param dir="c:\logs\Fusion"/>
</params>
</step>
-<step name="Create log directory for livetv" harness="STIF" enabled="true" passrate="100" significant="false">
- <command>makedir</command>
- <params>
- <param dir="c:\logs\Livetv"/>
- </params>
-</step>
-<step name="Create log directory for iptv" harness="STIF" enabled="true" passrate="100" significant="false">
- <command>makedir</command>
- <params>
- <param dir="c:\logs\iptv"/>
- </params>
-</step>
-<step name="Create directory for verify files" harness="STIF" enabled="true" passrate="100" significant="false">
- <command>makedir</command>
- <params>
- <param dir="c:\testing\data\verifyzip"/>
- </params>
-</step>
-<step name="Create directory for verify files" harness="STIF" enabled="true" passrate="100" significant="false">
- <command>makedir</command>
- <params>
- <param dir="c:\testing\data\verifynew"/>
- </params>
-</step>
<step name="Create directory for TestScripter logs" harness="STIF" enabled="true" passrate="100" significant="false">
<command>makedir</command>
<params>
@@ -52,11 +28,3 @@
<param dir="c:\logs\testframework\Testserver"/>
</params>
</step>
-<step name="Install IAP file" harness="STIF" enabled="true" passrate="100" significant="false">
- <command>install</command>
- <reboot target-alias="*" when="after" />
- <params>
- <param src="cccccc00.cre"/>
- <param dst="c:\private\10202be9\persists\cccccc00.cre"/>
- </params>
-</step>
\ No newline at end of file
Binary file videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/data/mmc/video_3gp.3gp has changed
Binary file videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/data/mmc/video_mpeg4.mp4 has changed
Binary file videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/data/mmc/video_wmv.dat has changed
--- a/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/group/VCXMyVideosCollectionPluginTest.mmp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/group/VCXMyVideosCollectionPluginTest.mmp Thu Apr 01 23:22:15 2010 +0300
@@ -1,4 +1,4 @@
-/*TYPE TESTCLASS*//*
+/*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
@@ -32,7 +32,6 @@
USERINCLUDE ../inc
USERINCLUDE ../../../inc
-USERINCLUDE ../../../../../tsrc/VCXTestCommon/inc
SYSTEMINCLUDE /Epoc32/include/ecom
APP_LAYER_SYSTEMINCLUDE
@@ -42,10 +41,11 @@
SOURCE VCXMyVideosCollectionPluginTest.cpp
SOURCE VCXMyVideosCollectionPluginTestBlocks.cpp
SOURCE VCXMyVideosCollectionPluginTester.cpp
-SOURCE VCXMyVideosTestDlWatcher.cpp
-SOURCE VCXMyVideosTestServiceEmu.cpp
SOURCE VCXTestMdsDbModifier.cpp
SOURCE VCXMyVideosTestTransactions.cpp
+SOURCE VCXMyVideosTestUtils.cpp
+SOURCE CVcxTestTimer.cpp
+SOURCE CVcxTestActiveWait.cpp
//RESOURCE resource_file
//RESOURCE resource_file2
@@ -55,7 +55,6 @@
LIBRARY mpxcollectionutility.lib
LIBRARY estor.lib
LIBRARY stiftestinterface.lib
-LIBRARY VCXTestCommon.lib
LIBRARY FLOGGER.lib
LIBRARY efsrv.lib
LIBRARY bafl.lib
--- a/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/group/VCXMyVideosCollectionPluginTest.pkg Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/group/VCXMyVideosCollectionPluginTest.pkg Thu Apr 01 23:22:15 2010 +0300
@@ -43,49 +43,22 @@
; None
; Install files
-"/epoc32/release/armv5/udeb/VCXMyVideosCollectionPluginTest.dll" - "!:/Sys/Bin/VCXMyVideosCollectionPluginTest.dll"
-"/epoc32/release/armv5/udeb/MediatorEventVerifier.dll" - "!:/Sys/Bin/MediatorEventVerifier.dll"
-"/epoc32/release/armv5/udeb/VCXTestUtilModule.dll" - "!:/Sys/Bin/VCXTestUtilModule.dll"
-"/epoc32/release/armv5/udeb/VCXTestCommon.dll" - "!:/Sys/Bin/VCXTestCommon.dll"
-"/epoc32/release/armv5/udeb/VCXTestMyVideosCollectionClient.dll" - "!:/Sys/Bin/VCXTestMyVideosCollectionClient.dll"
-"../conf/VCXMyVideosCollectionPluginTestAttributes.cfg" - "C:/TestFramework/VCXMyVideosCollectionPluginTestAttributes.cfg"
-"../conf/VCXMyVideosCollectionPluginTestDelete.cfg" - "C:/TestFramework/VCXMyVideosCollectionPluginTestDelete.cfg"
-"../conf/VCXMyVideosCollectionPluginTestDownload.cfg" - "C:/TestFramework/VCXMyVideosCollectionPluginTestDownload.cfg"
-"../conf/VCXMyVideosCollectionPluginTestDownload2.cfg" - "C:/TestFramework/VCXMyVideosCollectionPluginTestDownload2.cfg"
-"../conf/VCXMyVideosCollectionPluginTestMultipleDls.cfg" - "C:/TestFramework/VCXMyVideosCollectionPluginTestMultipleDls.cfg"
-"../conf/VCXMyVideosCollectionPluginTestFullMemory.cfg" - "C:/TestFramework/VCXMyVideosCollectionPluginTestFullMemory.cfg"
-"../conf/VCXMyVideosCollectionPluginTestLists.cfg" - "C:/TestFramework/VCXMyVideosCollectionPluginTestLists.cfg"
-"../conf/VCXMyVideosCollectionPluginTestMoveCopy.cfg" - "C:/TestFramework/VCXMyVideosCollectionPluginTestMoveCopy.cfg"
-"../conf/VCXMyVideosCollectionPluginTestMultiDrives.cfg" - "C:/TestFramework/VCXMyVideosCollectionPluginTestMultiDrives.cfg"
-"../conf/VCXMyVideosCollectionPluginTestSideload.cfg" - "C:/TestFramework/VCXMyVideosCollectionPluginTestSideload.cfg"
-"../conf/VCXMyVideosCollectionPluginTestSorting.cfg" - "C:/TestFramework/VCXMyVideosCollectionPluginTestSorting.cfg"
-"../conf/VCXMyVideosCollectionPluginTestRobustness.cfg" - "C:/TestFramework/VCXMyVideosCollectionPluginTestRobustness.cfg"
-"../conf/VCXMyVideosCollectionPluginTestHelium.cfg" - "C:/TestFramework/VCXMyVideosCollectionPluginTestHelium.cfg"
-"../conf/VCXMyVideosCollectionPluginTestMediator.cfg" - "C:/TestFramework/VCXMyVideosCollectionPluginTestMediator.cfg"
+"/epoc32/release/armv5/urel/VCXMyVideosCollectionPluginTest.dll" - "!:/Sys/Bin/VCXMyVideosCollectionPluginTest.dll"
+
+"../conf/VCXMyVideosCollectionPluginTest.cfg" - "C:/TestFramework/VCXMyVideosCollectionPluginTest.cfg"
+"../conf/VCXMyVideosCollectionPluginTestCategories.cfg" - "C:/TestFramework/VCXMyVideosCollectionPluginTestCategories.cfg"
+"../conf/VCXMyVideosCollectionPluginTestAlbums.cfg" - "C:/TestFramework/VCXMyVideosCollectionPluginTestAlbums.cfg"
+
"../conf/vcxmvcollectionplugintest.inc" - "C:/TestFramework/vcxmvcollectionplugintest.inc"
-"../conf/VCXConsts.inc" - "C:/TestFramework/VCXConsts.inc"
"../conf/VCXDrives.inc" - "C:/TestFramework/VCXDrives.inc"
"../conf/VCXErrors.inc" - "C:/TestFramework/VCXErrors.inc"
-; The cenrep and testframework.ini files won't install with sis, only for ATS test runs.
+; The testframework.ini files won't install with sis, only for ATS test runs.
"../init/TestFramework.ini" - "C:/TestFramework/TestFramework.ini"
-"../data/cccccc00.cre" - "c:\private\10202be9\persists\cccccc00.cre"
"../Data/MMC/video_3gp.3gp" - "e:/testing/data/video_3gp.xxx"
-"../Data/MMC/video_3gp2.3g2" - "e:/testing/data/video_3gp2.xxx"
"../Data/MMC/video_wmv.dat" - "e:/testing/data/video_wmv.xxx"
-"../Data/MMC/video_mp2.mp2" - "e:/testing/data/video_mp2.xxx"
-"../Data/MMC/video_mpeg1.mpg" - "e:/testing/data/video_mpeg1.xxx"
-"../Data/MMC/video_mpeg2.mpg" - "e:/testing/data/video_mpeg2.xxx"
-"../Data/MMC/video_supervideocd.mpg" - "e:/testing/data/video_supervideocd.xxx"
-"../Data/MMC/video_mp3.mp3" - "e:/testing/data/video_mp3.xxx"
-"../Data/MMC/video_applempeg.mp4" - "e:/testing/data/video_applempeg.xxx"
"../Data/MMC/video_mpeg4.mp4" - "e:/testing/data/video_mpeg4.xxx"
-"../Data/MMC/video_mpegavc.mp4" - "e:/testing/data/video_mpegavc.xxx"
-"../Data/MMC/video_quicktime.mov" - "e:/testing/data/video_quicktime.xxx"
-"../Data/MMC/video_realvideo.rm" - "e:/testing/data/video_realvideo.xxx"
-"../Data/MMC/video_avi.avi" - "e:/testing/data/video_avi.xxx"
-"../Data/MMC/video_aviac3.avi" - "e:/testing/data/video_aviac3.xxx"
; Embedded SIS
; None
--- a/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/group/bld.inf Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/group/bld.inf Thu Apr 01 23:22:15 2010 +0300
@@ -15,51 +15,25 @@
*
*/
-
PRJ_PLATFORMS
DEFAULT
PRJ_TESTEXPORTS
../data/mmc/video_3gp.3gp /epoc32/winscw/c/testing/data/video_3gp.xxx
-../data/mmc/video_3gp2.3g2 /epoc32/winscw/c/testing/data/video_3gp2.xxx
-../data/mmc/video_applempeg.mp4 /epoc32/winscw/c/testing/data/video_applempeg.xxx
-../data/mmc/video_avi.avi /epoc32/winscw/c/testing/data/video_avi.xxx
-../data/mmc/video_aviac3.avi /epoc32/winscw/c/testing/data/video_aviac3.xxx
-../data/mmc/video_mp2.mp2 /epoc32/winscw/c/testing/data/video_mp2.xxx
-../data/mmc/video_mp3.mp3 /epoc32/winscw/c/testing/data/video_mp3.xxx
-../data/mmc/video_mpeg1.mpg /epoc32/winscw/c/testing/data/video_mpeg1.xxx
-../data/mmc/video_mpeg2.mpg /epoc32/winscw/c/testing/data/video_mpeg2.xxx
../data/mmc/video_mpeg4.mp4 /epoc32/winscw/c/testing/data/video_mpeg4.xxx
-../data/mmc/video_mpegavc.mp4 /epoc32/winscw/c/testing/data/video_mpegavc.xxx
-../data/mmc/video_quicktime.mov /epoc32/winscw/c/testing/data/video_quicktime.xxx
-../data/mmc/video_realvideo.rm /epoc32/winscw/c/testing/data/video_realvideo.xxx
-../data/mmc/video_supervideocd.mpg /epoc32/winscw/c/testing/data/video_supervideocd.xxx
../data/mmc/video_wmv.dat /epoc32/winscw/c/testing/data/video_wmv.xxx
-../conf/VCXConsts.inc /epoc32/winscw/c/testframework/VCXConsts.inc
../conf/VCXDrives.inc /epoc32/winscw/c/testframework/VCXDrives.inc
../conf/VCXErrors.inc /epoc32/winscw/c/testframework/VCXErrors.inc
../conf/vcxmvcollectionplugintest.inc /epoc32/winscw/c/testframework/vcxmvcollectionplugintest.inc
-../conf/VCXMyVideosCollectionPluginTestAttributes.cfg /epoc32/winscw/c/testframework/VCXMyVideosCollectionPluginTestAttributes.cfg
-../conf/VCXMyVideosCollectionPluginTestDelete.cfg /epoc32/winscw/c/testframework/VCXMyVideosCollectionPluginTestDelete.cfg
-../conf/VCXMyVideosCollectionPluginTestDownload.cfg /epoc32/winscw/c/testframework/VCXMyVideosCollectionPluginTestDownload.cfg
-../conf/VCXMyVideosCollectionPluginTestDownload2.cfg /epoc32/winscw/c/testframework/VCXMyVideosCollectionPluginTestDownload2.cfg
-../conf/VCXMyVideosCollectionPluginTestMultipleDls.cfg /epoc32/winscw/c/testframework/VCXMyVideosCollectionPluginTestMultipleDls.cfg
-../conf/VCXMyVideosCollectionPluginTestFullMemory.cfg /epoc32/winscw/c/testframework/VCXMyVideosCollectionPluginTestFullMemory.cfg
-../conf/VCXMyVideosCollectionPluginTestLists.cfg /epoc32/winscw/c/testframework/VCXMyVideosCollectionPluginTestLists.cfg
-../conf/VCXMyVideosCollectionPluginTestMoveCopy.cfg /epoc32/winscw/c/testframework/VCXMyVideosCollectionPluginTestMoveCopy.cfg
-../conf/VCXMyVideosCollectionPluginTestMultiDrives.cfg /epoc32/winscw/c/testframework/VCXMyVideosCollectionPluginTestMultiDrives.cfg
-../conf/VCXMyVideosCollectionPluginTestSideload.cfg /epoc32/winscw/c/testframework/VCXMyVideosCollectionPluginTestSideload.cfg
-../conf/VCXMyVideosCollectionPluginTestSorting.cfg /epoc32/winscw/c/testframework/VCXMyVideosCollectionPluginTestSorting.cfg
-../conf/VCXMyVideosCollectionPluginTestRobustness.cfg /epoc32/winscw/c/testframework/VCXMyVideosCollectionPluginTestRobustness.cfg
-../conf/VCXMyVideosCollectionPluginTestHelium.cfg /epoc32/winscw/c/testframework/VCXMyVideosCollectionPluginTestHelium.cfg
-../conf/VCXMyVideosCollectionPluginTestMediator.cfg /epoc32/winscw/c/testframework/VCXMyVideosCollectionPluginTestMediator.cfg
+../conf/VCXMyVideosCollectionPluginTest.cfg /epoc32/winscw/c/testframework/VCXMyVideosCollectionPluginTest.cfg
+../conf/VCXMyVideosCollectionPluginTestCategories.cfg /epoc32/winscw/c/testframework/VCXMyVideosCollectionPluginTestCategories.cfg
+../conf/VCXMyVideosCollectionPluginTestAlbums.cfg /epoc32/winscw/c/testframework/VCXMyVideosCollectionPluginTestAlbums.cfg
PRJ_EXPORTS
PRJ_TESTMMPFILES
VCXMyVideosCollectionPluginTest.mmp
-../mediatorevents/group/MediatorEventVerifier.mmp
PRJ_MMPFILES
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/inc/CVcxTestActiveWait.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,108 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:
+*
+*/
+
+#ifndef CVCXTESTACTIVEWAIT_H
+#define CVCXTESTACTIVEWAIT_H
+
+// INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+*
+*
+*
+*
+* @since
+*/
+class CVcxTestActiveWait : public CBase
+ {
+ public: // Constructors and destructor
+ /**
+ * Two-phased constructor.
+ */
+ static CVcxTestActiveWait * NewL();
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVcxTestActiveWait ();
+
+
+ enum TVcxTestActiveWaitCmd
+ {
+ EActiveWaitStart,
+ EActiveWaitStop
+ };
+
+ public: // New functions
+
+ /*
+ * To start and stop CActiveSchedulerWait
+ */
+
+ void ActiveWait( TVcxTestActiveWaitCmd aActiveWaitCmd );
+
+ /*
+ * Returns ETrue if CActiveSchedulerWait is running.
+ */
+ TBool IsWaiting();
+
+ /*
+ * Starts active wait.
+ */
+ TInt Start();
+
+ /*
+ * Stops active wait.
+ */
+ TInt Stop();
+
+
+ protected: // From base classes
+
+ private:
+
+ /**
+ * C++ default constructor.
+ */
+ CVcxTestActiveWait ();
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+ private: // Data
+ CActiveSchedulerWait* iActiveSchedulerWait;
+ };
+
+
+#endif // CVCXTESTACTIVEWAIT_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/inc/CVcxTestTimer.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:
+*
+*/
+
+#ifndef CVCXTESTTIMER_H
+#define CVCXTESTTIMER_H
+
+// INCLUDES
+#include <e32base.h>
+
+// CONSTANTS
+
+// MACROS
+
+// DATA TYPES
+
+// FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+class MVcxTestTimerObserver;
+
+// CLASS DECLARATION
+
+/**
+*
+*
+*
+*
+* @since
+*/
+class CVcxTestTimer : public CActive
+ {
+ public: // Constructors and destructor
+
+ /**
+ * Two-phased constructor.
+ */
+ static CVcxTestTimer* NewL(MVcxTestTimerObserver& aObserver, TInt aId);
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVcxTestTimer();
+
+
+ public: // New functions
+ void After(TTimeIntervalMicroSeconds32 aInterval);
+ void CancelTimer( );
+
+ protected: //from base classes
+ void RunL();
+ void DoCancel();
+
+ private:
+
+ /**
+ * C++ default constructor.
+ */
+ CVcxTestTimer(MVcxTestTimerObserver& aObserver, TInt aId);
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+ private: // Data
+ RTimer iTimer;
+ MVcxTestTimerObserver& iObserver;
+ TInt iId;
+ TBool iRestartAfterCancel;
+ TTimeIntervalMicroSeconds32 iInterval;
+ };
+
+
+#endif // CVCXTESTTIMER_H
+
+// End of File
--- a/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/inc/MVCXMyVideosCollectionPluginTesterObserver.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/inc/MVCXMyVideosCollectionPluginTesterObserver.h Thu Apr 01 23:22:15 2010 +0300
@@ -11,11 +11,9 @@
*
* Contributors:
*
-* Description: ?Description*
+* Description:
*/
-
-
#ifndef MVCXMYVIDEOSCOLLECTIONPLUGINTESTEROBSERVER_H
#define MVCXMYVIDEOSCOLLECTIONPLUGINTESTEROBSERVER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/inc/MVcxTestTimerObserver.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,39 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:
+*
+*/
+
+#ifndef MVCXTESTTIMEROBSERVER_H
+#define MVCXTESTTIMEROBSERVER_H
+
+// INCLUDES
+
+#include <e32def.h>
+
+// FORWARD DECLARATIONS
+
+
+// CLASS DECLARATION
+
+class MVcxTestTimerObserver
+ {
+ public:
+ virtual void TimerComplete(TInt aTimerId, TInt aError) = 0;
+
+ };
+
+#endif // MVCXTESTTIMEROBSERVER_H
+
+// End of File
--- a/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/inc/VCXMyVideosCollectionPluginTest.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/inc/VCXMyVideosCollectionPluginTest.h Thu Apr 01 23:22:15 2010 +0300
@@ -11,11 +11,9 @@
*
* Contributors:
*
-* Description: ?Description*
+* Description:
*/
-
-
#ifndef VCXMYVIDEOSCOLLECTIONPLUGINTEST_H
#define VCXMYVIDEOSCOLLECTIONPLUGINTEST_H
@@ -25,21 +23,15 @@
#include <StifTestModule.h>
#include "MVCXMyVideosCollectionPluginTesterObserver.h"
#include <f32file.h>
-#include "MIptvTestTimerObserver.h"
+#include "MVcxTestTimerObserver.h"
//#ifdef __WINSCW__
#include <harvesterclient.h>
//#endif // __WINSCW__
-#include "CIptvTestVideoCreator.h"
+#include "VCXMyVideosTestUtils.h"
// CONSTANTS
const TInt KTimeoutMinute = 60 * 1000000; // a minute
const TInt KTimeoutSecond = 1000000;
-_LIT( KVCXMYVideosTest2kURLTag, "XXX2kURLXXX" );
-_LIT( KVCXMYVideosTest1200CharsURLTag, "XXX21200charsURLXXX" );
-_LIT( KVCXMYVideosTest1kURLTag, "XXX1kURLXXX" );
-_LIT( KVCXMYVideosTest2kURL, "http://193.65.182.78/Nseries/video1.3gp?123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456_END" );
-//_LIT( KVCXMYVideosTest1200charsURL, "http://193.65.182.78/Nseries/video1.3gp?123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012_END" );
-_LIT( KVCXMYVideosTest1kURL, "http://193.65.182.78/Nseries/video1.3gp?123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012ASDFASDFAADSFDSFASDFSDAFSDFASDFADFASDF_END" );
_LIT( KVCXTestZeroIap, "VcxTestZeroIap" );
_LIT( KVCXTestInvalidIap, "VcxTestInvalidIap" );
_LIT( KVCXTestZeroUrl, "VcxTestZeroUrl" );
@@ -54,17 +46,16 @@
// FORWARD DECLARATIONS
class CVCXMyVideosCollectionPluginTest;
class CVCXMyVideosCollectionPluginTester;
-class CVCXTestCommon;
-class CIptvTestActiveWait;
-class CIptvTestTimer;
+class CVCXMyVideosTestUtils;
+class CVcxTestActiveWait;
+class CVcxTestTimer;
class CMPXMedia;
class TMPXAttributeData;
-class CIptvVodContentContentBriefDetails;
+class CVcxVodContentContentBriefDetails;
class CVCXMyVideosTestServiceEmu;
class CVCXTestMdsDbModifier;
class CFileMan;
class CMPXMediaArray;
-class CVCXTestStatsKeeper;
// DATA TYPES
//enum ?declaration
@@ -122,19 +113,19 @@
EVcxTestMapping_KVcxMediaMyVideosAudioFourCc
};
-typedef RPointerArray<CIptvVodContentContentBriefDetails> TVcxTestContentArray;
+typedef RPointerArray<CVcxVodContentContentBriefDetails> TVcxTestContentArray;
-// CLASS DECLARATION
+// TestUtils DECLARATION
/**
-* CVCXMyVideosCollectionPluginTest test class for STIF Test Framework TestScripter.
+* CVCXMyVideosCollectionPluginTest test TestUtils for STIF Test Framework TestScripter.
* ?other_description_lines
*
* @lib ?library
* @since ?Series60_version
*/
NONSHARABLE_CLASS(CVCXMyVideosCollectionPluginTest) : public CScriptBase,
- public MVCXMyVideosCollectionPluginTesterObserver, public MIptvTestTimerObserver
+ public MVCXMyVideosCollectionPluginTesterObserver, public MVcxTestTimerObserver
{
public: // Constructors and destructor
@@ -164,7 +155,7 @@
virtual void HandleVcxMvTesterMessageL( TInt aMessage, TInt aError );
/**
- * From MIptvTestTimerObserver Handles timer completion
+ * From MVcxTestTimerObserver Handles timer completion
* @since
* @param aTimerId
* @param aError
@@ -202,21 +193,6 @@
virtual TInt CreateL( CStifItemParser& aItem );
/**
- * Enables statistics for this instance. Disables error reporting to STIF for errors from collection plugin.
- *
- * @param Name for the stats.
- * @param Filename for the stats.
- */
- virtual TInt EnableStatsL( CStifItemParser& aItem );
-
- /**
- * Sets CenRep value for My Videos MPX plugin preferred memory for downloads.
- *
- * @param aPreferredMemory, a drive letter
- */
- virtual TInt SetPreferredMemoryL( CStifItemParser& aItem );
-
- /**
* Sets CenRep value for My Videos MPX plugin sort.
* If category is whole collection is refreshed:
* - Sort order set to none.
@@ -248,21 +224,15 @@
virtual TInt CoolDownL( CStifItemParser& aItem );
/**
- * Disables check for missing downloads.
- */
- virtual TInt DisableDownloadCheckL( CStifItemParser& aItem );
-
- /**
* Toggle filecheck on/off.
*/
virtual TInt SetFileCheckL( CStifItemParser& aItem );
/**
- * Enables or disables the resuming paused downloads automaticly.
- *
- * @param TBool
+ * Sets requests that use multiple medias to use copy of the current medias,
+ * those medias will not be updated before this is called again.
*/
- virtual TInt SetAutoResumeL( CStifItemParser& aItem );
+ virtual TInt SetUseCopiedMediasL( CStifItemParser& aItem );
/**
* Opens MPX collection.
@@ -276,11 +246,19 @@
* Opens collection level, e.g. My Videos category.
* Asynchronous, test script will be signaled.
*
- * @param index number of the level.
+ * @param name name of the level.
*/
virtual TInt OpenLevelL( CStifItemParser& aItem );
/**
+ * Opens collection level, e.g. My Videos category.
+ * Asynchronous, test script will be signaled.
+ *
+ * @param index of the level.
+ */
+ virtual TInt OpenLevelByIndexL( CStifItemParser& aItem );
+
+ /**
* Closes collection level, e.g. My Videos category.
* Asynchronous, test script will be signaled.
*/
@@ -335,7 +313,7 @@
* This will fetch the full media from MPX.
*
* @param driveLetter
- * @param itemIndex
+ * @param itemIndex or itemName
* @param media attribute mapping id, see vcxmvcollectionplugintest.inc
* @param expectedValue
* @param expectedValue2...X
@@ -358,6 +336,13 @@
virtual TInt SetMediaDetailL( CStifItemParser& aItem );
/**
+ * Checks the album count.
+ *
+ * @param expectedCount
+ */
+ virtual TInt CheckAlbumCountL( CStifItemParser& aItem );
+
+ /**
* Checks the video count and that the videos really exist.
*
* @param driveLetter, if specified checks only videos only on that drive
@@ -380,22 +365,8 @@
* @param maximumCount
*/
virtual TInt CheckMaximumMediaCountL( CStifItemParser& aItem );
-
- /**
- * Checks the download count.
- *
- * @param expectedCount
- */
- virtual TInt CheckDownloadCountL( CStifItemParser& aItem );
/**
- * Checks the download progress.
- *
- * @param minimum progress
- */
- virtual TInt CheckDownloadProgressL( CStifItemParser& aItem );
-
- /**
* Creates copy of a media from currently listed medias and stores it to
* a member variable. It is used by AddMediaL, SetMediaL and
* SetMediaDetailsL.
@@ -568,6 +539,56 @@
virtual TInt DeleteFilesOfAllMediasL( CStifItemParser& aItem );
/**
+ * Adds an album. If category or album is currently open the change is not
+ * seen by tests before current level is closed.
+ *
+ * @param aAlbumName
+ * @param aAsyncCall, default true
+ */
+ virtual TInt CreateAlbumL( CStifItemParser& aItem );
+
+ /**
+ * Deletes albums. If category or album is currently open the change is not
+ * seen by tests before current level is closed.
+ *
+ * @param aAlbumName(s)
+ */
+ virtual TInt DeleteAlbumsL( CStifItemParser& aItem );
+
+ /**
+ * Deletes all albums. If category or album is currently open the change is not
+ * seen by tests before current level is closed.
+ */
+ virtual TInt DeleteAllAlbumsL( CStifItemParser& aItem );
+
+ /**
+ * Adds medias to an album.
+ *
+ * @param aAlbumName album where medias are added.
+ * @param aDrive drive where medias are
+ * @param aStartIndex index of first media
+ * @param aEndIndex index of last media
+ */
+ virtual TInt AddMediasToAlbumL( CStifItemParser& aItem );
+
+ /**
+ * Removes medias from an album.
+ *
+ * @param aAlbumName album where medias are removed from.
+ * @param aDrive drive where medias are
+ * @param aStartIndex index of first media
+ * @param aEndIndex index of last media
+ */
+ virtual TInt RemoveMediasFromAlbumL( CStifItemParser& aItem );
+
+ /**
+ * Checks the count of albums.
+ *
+ * @param aExpectedAlbumCount
+ */
+ virtual TInt CheckAlbumCount( CStifItemParser& aItem );
+
+ /**
* Creates a video file to the file system.
* Test module keeps track of these files with iSideloadedFiles array.
* If size is -1 video size will not be altered.
@@ -585,7 +606,7 @@
/**
* Creates video file(s).
*/
- void CreateVideoFileL( CIptvTestVideoCreator::TIptvTestVideoType aType, const TDesC& aDriveLetter, const TDesC& aFileName, TInt aSize, TInt aVideoCount, TBool aDoSync );
+ void CreateVideoFileL( CVCXMyVideosTestUtils::TVcxTestVideoType aType, const TDesC& aDriveLetter, const TDesC& aFileName, TInt aSize, TInt aVideoCount, TBool aDoSync );
/**
* Ensures that drive has specified amount of videos, they are created and removed if needed.
@@ -607,112 +628,6 @@
virtual TInt SetDeleteSideloadedVideos( CStifItemParser& aItem );
/**
- * Start a download using My Videos MPX plugin.
- *
- * @param iapName
- * @param serviceName
- * @param contentId
- * @param syncCall
- * @param userName (optional)
- * @param password (optional)
- */
- virtual TInt DownloadL( CStifItemParser& aItem );
-
- /**
- * Resume a download using My Videos MPX plugin.
- *
- * See DownloadL for parameters.
- */
- virtual TInt ResumeDownloadL( CStifItemParser& aItem );
-
- /**
- * Resumes all paused downloads.
- */
- virtual TInt ResumeAllDownloadsL( CStifItemParser& aItem );
-
- /**
- * Start a download using My Videos MPX plugin.
- * The current media from CreateEmptyMediaL or CreateCopyOfMediaL is used to pass
- * attributes to My Videos MPX plugin.
- *
- * See DownloadL for parameters.
- */
- virtual TInt DownloadUsingMediaL( CStifItemParser& aItem );
-
- /**
- * Resume a download using My Videos MPX plugin.
- * The current media from CreateEmptyMediaL or CreateCopyOfMediaL is used to pass
- * attributes to My Videos MPX plugin.
- *
- * See DownloadL for parameters.
- */
- virtual TInt ResumeDownloadUsingMediaL( CStifItemParser& aItem );
-
- /**
- * Starts download or resumes one. Cannot be called from STIF script.
- *
- * @param aUseCurrentMedia, use the attributes of the current media.
- * @param aResume, is this resume download.
- */
- void DownloadOrResumeL( CStifItemParser& aItem, TBool aUseCurrentMedia, TBool aResume );
-
- /**
- * Start or resume a download using My Videos MPX plugin.
- *
- * Can be called with 'Download' and 'ResumeDownload' commands from STIF script.
- *
- * @param iapName
- * @param URL
- * @param syncCall
- * @param userName (optional)
- * @param password (optional)
- */
- virtual TInt DownloadUrlL( CStifItemParser& aItem );
-
- /**
- * Cancel a download using My Videos MPX plugin.
- *
- * @param serviceName
- * @param contentId
- * @param syncCall
- */
- virtual TInt CancelDownloadL( CStifItemParser& aItem );
-
- /**
- * Cancel a download using My Videos MPX plugin.
- *
- * @param mpxId, if -1 then first DL's mpxId is used.
- * @param downloadId, if -1 then first DL's downloadId is used.
- * @param syncCall
- */
- virtual TInt CancelDownloadByIdL( CStifItemParser& aItem );
-
- /**
- * Pause a download using My Videos MPX plugin.
- * Also disables automatic resuming of paused downloads.
- *
- * @param serviceName
- * @param contentId
- * @param syncCall
- */
- virtual TInt PauseDownloadL( CStifItemParser& aItem );
-
- /**
- * Pause a download using My Videos MPX plugin.
- * Also disables automatic resuming of paused downloads.
- *
- * @param url
- */
- TInt PauseDownloadByUrlL( CStifItemParser& aItem );
-
- /**
- * Wait all downloads to complete.
- *
- * @param timeout minutes (default 10)
- */
- virtual TInt WaitAllDownloadsL( CStifItemParser& aItem );
-
- /**
* Starts a wait for message or messages of same type.
* STIF script is signaled when all of the messages have been
* received.
@@ -803,8 +718,8 @@
// Instance of class holding the test logic to test MV MPX collection.
CVCXMyVideosCollectionPluginTester *iTester;
- // CVCXTestCommon
- CVCXTestCommon* iTestCommon;
+ // CVCXMyVideosTestUtils
+ CVCXMyVideosTestUtils* iTestUtils;
// RFs
RFs iFs;
@@ -818,11 +733,11 @@
// Folders used for sideloading.
RPointerArray<HBufC> iSideloadFolders;
- // CIptvTestActiveWait
- CIptvTestActiveWait* iActiveWait;
+ // CVcxTestActiveWait
+ CVcxTestActiveWait* iActiveWait;
- // CIptvTestActiveWait
- CIptvTestActiveWait* iActiveWaitBlocking;
+ // CVcxTestActiveWait
+ CVcxTestActiveWait* iActiveWaitBlocking;
TBool iDeleteSideloadedFilesAndFolders;
@@ -837,8 +752,6 @@
// Seconds to wait before message is got, default is 5
TInt iMessageWaitTimeout;
- TBool iWaitingForAllDownloads;
-
// Wait is not called from script but from test module.
TBool iMessageWaitIsBlocking;
@@ -847,27 +760,22 @@
//#endif // __WINSCW__
// Timeout timer
- CIptvTestTimer* iTimeoutTimer;
+ CVcxTestTimer* iTimeoutTimer;
TBuf<256> iCaseId;
TBool iLoggingEnabled;
- CIptvTestTimer* iCoolDownTimer;
+ CVcxTestTimer* iCoolDownTimer;
TBool iCoolDownWait;
TInt iEventError;
- // Autoresume downloads
- TBool iAutoResume;
-
CMPXMedia* iMpxMedia;
TBool iFileCheckDisabled;
- TInt iLastDownloadError;
-
CVCXMyVideosTestServiceEmu* iServiceEmu;
CVCXTestMdsDbModifier* iMdsDbModifier;
@@ -880,11 +788,6 @@
// This is for passing media count check when mpx plugin build is urel,
// which causes add media cmd to fail.
TInt iAddMediaCmdCount;
-
- // Class to hold robustness and performance data.
- CVCXTestStatsKeeper* iStats;
-
- TBool iStatsEnabled;
};
#endif // VCXMYVIDEOSCOLLECTIONPLUGINTEST_H
--- a/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/inc/VCXMyVideosCollectionPluginTester.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/inc/VCXMyVideosCollectionPluginTester.h Thu Apr 01 23:22:15 2010 +0300
@@ -11,11 +11,9 @@
*
* Contributors:
*
-* Description: ?Description*
+* Description:
*/
-
-
#ifndef VCXMYVIDEOSCOLLECTIONPLUGINTESTER_H
#define VCXMYVIDEOSCOLLECTIONPLUGINTESTER_H
@@ -27,7 +25,7 @@
#include "MVCXMyVideosCollectionPluginTesterObserver.h"
#include <mpxmediabase.h>
#include <f32file.h>
-#include "MIptvTestTimerObserver.h"
+#include "MVcxTestTimerObserver.h"
#include "VCXMyVideosTestTransactions.h"
// CONSTANTS
@@ -42,12 +40,8 @@
// FORWARD DECLARATIONS
class MMPXCollectionUtility;
-class CVCXTestCommon;
-class CVCXMyVideosTestDlWatcher;
-class CIptvTestActiveWait;
-class CVCXMyVideosTestDownload;
-class CIptvTestTimer;
-class CVCXTestStatsKeeper;
+class CVCXMyVideosTestUtils;
+class CVcxTestActiveWait;
// DATA TYPES
@@ -60,8 +54,7 @@
* @since ?Series60_version
*/
class CVCXMyVideosCollectionPluginTester : public CBase,
- public MMPXCollectionObserver,
- public MIptvTestTimerObserver
+ public MMPXCollectionObserver
{
public: // Constructors and destructor
@@ -69,7 +62,7 @@
* Two-phased constructor.
*/
static CVCXMyVideosCollectionPluginTester* NewL( MVCXMyVideosCollectionPluginTesterObserver* aObserver,
- CVCXTestCommon* aTestCommon, CVCXTestStatsKeeper* aStatsKeeper );
+ CVCXMyVideosTestUtils* aTestUtil );
/**
* Destructor.
@@ -88,7 +81,13 @@
* Opens MPX collection level.
* Observer gets message when action is finished.
*/
- void OpenLevelL( TInt aIndex );
+ void OpenLevelL( const TDesC& aLevelName );
+
+ /**
+ * Opens MPX collection level at specified index of current mpx item list.
+ * Observer gets message when action is finished.
+ */
+ void OpenLevelL( TInt aIndex );
/**
* Gets medias by their MPX IDs. A collection must be opened before calling this.
@@ -130,9 +129,8 @@
void GetAllMediaFullDetailsL();
/**
- * Prints details for items in the current MPX level and
- * updates the downloads. This is done when collection or collection
- * level is opened.
+ * Prints details for items in the current MPX level. This is done when collection
+ * or collection level is opened.
*/
void ProcessCurrentEntriesL();
@@ -147,6 +145,16 @@
void PrintMPXMediaL( const CMPXMedia& aMedia, TBool aPrintAllDetails );
/**
+ * Updates local data that keeps track of albums.
+ */
+ void UpdateAlbumsListL();
+
+ /**
+ * Returns mpx id of album if it's found from local data.
+ */
+ TMPXItemId GetAlbumIdL( const TDesC& aAlbumName );
+
+ /**
* Returns count of items of the open MPX level.
*/
TInt GetMediaCount();
@@ -187,6 +195,13 @@
* Gets MPX media from current entries. Contains only brief details of the item.
*/
CMPXMedia* GetMediaL( TInt aDrive, TInt aIndex );
+
+ /**
+ * Gets index of media with specified name.
+ *
+ * @return index
+ */
+ TInt GetIndexOfMediaWithNameL( const TDesC& aName );
/**
* Moves multiple medias to specified drive.
@@ -235,6 +250,44 @@
void CancelDeleteL( TBool aSync );
/**
+ * Creates an album.
+ */
+ void CreateAlbumL( const TDesC& aAlbumName, TBool aSync, TBool aInvalidRequest = EFalse );
+
+ /**
+ * Deletes albums.
+ */
+ void DeleteAlbumsL( RArray<TPtrC>& aAlbumNames );
+
+ /**
+ * Deletes all albums.
+ */
+ void DeleteAllAlbumsL();
+
+ /**
+ * Adds medias to an album.
+ *
+ * @param aDestAlbumName
+ * @param aStartIndex
+ * @param aEndIndex
+ */
+ void AddMediasToAlbumL( const TDesC& aAlbumName, TInt aSourceDrive, TInt aStartIndex, TInt aEndIndex );
+
+ /**
+ * Removes medias from an album.
+ *
+ * @param aDestAlbumName
+ * @param aStartIndex
+ * @param aEndIndex
+ */
+ void RemoveMediasFromAlbumL( const TDesC& aAlbumName, TInt aSourceDrive, TInt aStartIndex, TInt aEndIndex );
+
+ /**
+ * Checks the count of albums.
+ */
+ bool CheckAlbumCount( int aExpectedCount );
+
+ /**
* Use to toggle automatic refresh of contents when open collection changes.
*/
void SetAutomaticRefresh( TBool aValue );
@@ -249,79 +302,6 @@
*/
void SetQuietMode( TBool aValue );
- /**
- * Starts MPX My Videos download.
- * @param aTitle
- * @param aIapId
- * @param aServiceId
- * @param aContentId
- * @param aUrl
- * @param aSync
- * @param aUserName
- * @param aPassword
- * @param aMedia
- */
- void StartDownloadL( const TDesC& aTitle, TInt aIapId, TInt aServiceId, TInt aContentId,
- const TDesC& aUrl, TBool aSync, const TDesC& aUserName, const TDesC& aPassword,
- CMPXMedia* aMedia );
-
- /**
- * Resumes MPX My Videos download.
- * If download is not found from cache then fake download ID is used.
- *
- * @param aTitle
- * @param aIapId
- * @param aServiceId
- * @param aContentId
- * @param aUrl
- * @param aSync
- * @param aUserName
- * @param aPassword
- * @param aMedia
- */
- void ResumeDownloadL( const TDesC& aTitle, TInt aIapId, TInt aServiceId, TInt aContentId,
- const TDesC& aUrl, TBool aSync, const TDesC& aUserName, const TDesC& aPassword,
- CMPXMedia* aMedia );
-
- /**
- * Resumes MPX My Videos downloads.
- */
- void ResumeAllDownloadsL();
-
- /**
- * Cancels MPX My Videos download.
- */
- void CancelDownloadL( CVCXMyVideosTestDownload* aDownload, TBool aSync );
-
- /**
- * Cancels MPX My Videos download.
- */
- void CancelDownloadL( TInt aMpxId, TInt aDownloadId, const TPtrC& aDownloadPath, TBool aSync );
-
- /**
- * Pauses MPX My Videos download.
- */
- void PauseDownloadL( TInt aServiceId, TInt aContentId, const TDesC& aUrl, TBool aSync );
-
- /**
- * Pauses MPX My Videos download.
- */
- void PauseDownloadL( const TDesC& aUrl, TBool aSync );
-
- /**
- * Returns instance of the download watcher.
- */
- CVCXMyVideosTestDlWatcher* GetDownloadWatcher();
-
- /**
- * Returns number of active downloads.
- */
- TInt GetActiveDownloadCountL();
-
- /**
- * Sets automatic resuming of paused download.
- */
- void SetAutoResume( TBool aValue );
/**
* Returns the index of current collection level.
@@ -373,11 +353,14 @@
*/
CMPXMediaArray* SelectMediasL( TInt aDriveFilter, TInt aStartIndex, TInt aEndIndex );
+ /**
+ * With this method the SelectMediasL method can be set to use copied media array
+ * instead of current medias. After that move, copy, delete etc. operations for
+ * multiple medias will use the copied media array and not current medias.
+ */
+ void SetUseCopiedMediasL( TBool aUseCopiedMedias );
+
private:
- /**
- * Updates the downloads using current MPX entries.
- */
- void UpdateDownloadsL( TBool aQuietMode );
/**
* Creates a MPX command.
@@ -414,6 +397,11 @@
*/
void SetRefreshStatus( TBool aRefreshingCollection );
+ /**
+ * Creates copy of iMediaArray to iMediaArrayCopy.
+ */
+ void CreateCopyOfCurrentMediasL();
+
public: // Functions from base classes
/**
@@ -473,21 +461,13 @@
void HandleCommandComplete( CMPXCommand* aCommandResult,
TInt aError);
- /**
- * From MIptvTestTimerObserver Handles timer completion
- * @since
- * @param aTimerId
- * @param aError
- */
- void TimerComplete(TInt aTimerId, TInt aError);
-
private:
/**
* C++ default constructor.
*/
CVCXMyVideosCollectionPluginTester( MVCXMyVideosCollectionPluginTesterObserver* aObserver,
- CVCXTestCommon* aTestCommon, CVCXTestStatsKeeper* aStatsKeeper );
+ CVCXMyVideosTestUtils* aTestUtils );
/**
* By default Symbian 2nd phase constructor is private.
@@ -519,14 +499,17 @@
// Media array of videos tests uses.
CMPXMediaArray* iMediaArray;
+ // Media array of videos tests uses, copy.
+ CMPXMediaArray* iMediaArrayCopy;
+
// Media array of previous videos.
CMPXMediaArray* iOldMediaArray;
// Count of current medias in iMediaArray.
TUint32 iMediaCount;
- // CVCXTestCommon.
- CVCXTestCommon* iTestCommon;
+ // CVCXMyVideosTestUtils.
+ CVCXMyVideosTestUtils* iTestUtils;
// RFs.
RFs iFs;
@@ -534,26 +517,16 @@
// Refresh is already ongoing.
TBool iRefreshingCollection;
- // Member to keep track of downnloads.
- CVCXMyVideosTestDlWatcher* iDlWatcher;
-
// Active wait
- CIptvTestActiveWait* iActiveWait;
+ CVcxTestActiveWait* iActiveWait;
// Refresh contents of open collection when they change
TBool iAutomaticContentRefresh;
// Tester is waiting for item change.
TBool iWaitingForItemChange;
-
- // Autoresume downloads
- TBool iAutoResume;
-
- // Downloads do not start updating before we get DL related commands from script.
- TBool iUpdateDownloads;
-
- TUint32 iCurrentMyVideosMessageId;
-
+
+ // Ids of medias for commands that use multiple medias.
RArray<TInt32> iRequestedMediaIds;
// Full details of media got from GetMediaDetailsL
@@ -574,24 +547,15 @@
// Canceling Move, Copy or Delete cause commmand completion with error KErrCancel
TBool iCancelRequested;
- // Update downloads only after first one is started.
- TBool iDownloadsStarted;
-
TInt iActionCount;
- // Download progress update timer.
- CIptvTestTimer* iProgressTimer;
-
TInt iVideosOnRomCount;
- // Variable to follow what kind of collection opening is going on.
- TInt iCurrentActionId;
+ // Arrays to hold info of albums.
+ RPointerArray<HBufC> iAlbumNames;
+ RArray<TMPXItemId> iAlbumIds;
- // Variable to follow where action ending should be handled.
- TBool iCurrentActionHasResponse;
-
- // Class to hold robustness and performance data.
- CVCXTestStatsKeeper* iStats;
+ TBool iUseCopiedMedias;
};
#endif // VCXMYVIDEOSCOLLECTIONPLUGINTESTER_H
--- a/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/inc/VCXMyVideosTestCommon.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/inc/VCXMyVideosTestCommon.h Thu Apr 01 23:22:15 2010 +0300
@@ -11,11 +11,9 @@
*
* Contributors:
*
-* Description: ?Description*
+* Description:
*/
-
-
#ifndef VCXMYVIDEOSTESTCOMMON_H
#define VCXMYVIDEOSTESTCOMMON_H
@@ -45,18 +43,22 @@
// These are only handled when WaitForMessage is called.
const TInt KVCXMYVideosTestMessageCollectionGeneral = 3000;
-const TInt KVCXMYVideosTestMessageCollectionItemChanged = 3001;
-const TInt KVCXMYVideosTestMessageCollectionCategoryChanged = 3002;
-const TInt KVCXMYVideosTestMessageMpxItemInserted = 4000;
-const TInt KVCXMYVideosTestMessageMpxItemDeleted = 4001;
-const TInt KVCXMYVideosTestMessageMpxItemModified = 4002;
+const TInt KVCXMYVideosTestMessageMpxVideoInserted = 4000;
+const TInt KVCXMYVideosTestMessageMpxCategoryInserted = 4001;
+const TInt KVCXMYVideosTestMessageMpxAlbumInserted = 4002;
+const TInt KVCXMYVideosTestMessageMpxCategoryDeleted = 4003;
+const TInt KVCXMYVideosTestMessageMpxVideoDeleted = 4004;
+const TInt KVCXMYVideosTestMessageMpxAlbumDeleted = 4005;
+const TInt KVCXMYVideosTestMessageMpxVideoModified = 4006;
+const TInt KVCXMYVideosTestMessageMpxCategoryModified = 4007;
+const TInt KVCXMYVideosTestMessageMpxAlbumModified = 4008;
const TInt KVCXMyVideosTestMessageVideoListOrderChanged = 5000;
const TInt KVCXMYVideosTestErrorDownloadNotFound = 10001;
const TInt KVCXMYVideosTestErrorFileNotFound = 10002;
-#endif // VCXMyVideosTestCommon.h
+#endif // VCXMYVIDEOSTESTCOMMON_H
// End of File
--- a/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/inc/VCXMyVideosTestTransactions.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/inc/VCXMyVideosTestTransactions.h Thu Apr 01 23:22:15 2010 +0300
@@ -11,10 +11,9 @@
*
* Contributors:
*
-* Description: ?Description*
+* Description:
*/
-
#ifndef VCXMYVIDEOSTESTTRANSACTIONS_H
#define VCXMYVIDEOSTESTTRANSACTIONS_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/inc/VCXMyVideosTestUtils.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,105 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:
+*/
+
+#ifndef VCXMYVIDEOSTESTUTILS_H
+#define VCXMYVIDEOSTESTUTILS_H
+
+// INCLUDES
+#include <e32base.h>
+#include <f32file.h>
+#include <BAUTILS.H>
+
+// CONSTANTS
+const TInt KVcxTestLargeFile3GB = -1451435;
+
+// MACROS
+
+// FORWARD DECLARATIONS
+
+// DATA TYPES
+
+// FORWARD DECLARATIONS
+
+// CLASS DECLARATION
+
+/**
+* CVCXMyVideosTestUtils
+* ?other_description_lines
+*
+* @lib ?library
+* @since ?Series60_version
+*/
+class CVCXMyVideosTestUtils : public CBase
+{
+ public: // Constructors and destructor
+ /**
+ * Two-phased constructor.
+ */
+ static CVCXMyVideosTestUtils* NewL();
+
+ /**
+ * Destructor.
+ */
+ virtual ~CVCXMyVideosTestUtils();
+
+ public:
+
+ enum TVcxTestVideoType
+ {
+ VcxTestVideo3Gp, // Extension .3GP
+ VcxTestVideoMpeg4, // Extension .MP4
+ VcxTestVideoWmv, // Extension .WMV
+ };
+
+ private:
+
+ /**
+ * C++ default constructor.
+ */
+ CVCXMyVideosTestUtils();
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL( );
+
+ public: // New functions
+
+ TInt EnsureFileIsNotInUse( const TPtrC& aFileName );
+
+ /*
+ * Creates a video file to the system.
+ */
+ void CreateVideoFileL( TVcxTestVideoType aVideoType, TDesC& aFileName, TInt aSize );
+
+ /*
+ * Creates video files to the system.
+ */
+ void CreateVideoFilesL( TVcxTestVideoType aVideoType, TDesC& aFileName, TInt aCount, RPointerArray<HBufC>& aFileArray );
+
+ private:
+
+ void GetVideoFile( TDes& aFileName, CVCXMyVideosTestUtils::TVcxTestVideoType aVideoType, const TDesC& aDrive );
+
+ public: // Data
+
+ RFs iFs;
+ CFileMan* iFileMan;
+};
+
+#endif // VCXMYVIDEOSTESTUTILS_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/inc/VCXTestLog.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,105 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:
+*
+*/
+
+#ifndef VCXTESTLOG_H
+#define VCXTESTLOG_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32svr.h>
+
+//#define FILE_LOGGING_IN_UREL_BUILD 1
+
+// MACROS
+#ifdef _DEBUG
+
+// SELECT LOG TYPE FROM HERE
+// 0 = RDebug
+// 1 = file logging
+// 2 = no logging
+#ifdef __WINSCW__
+ #define LOGTYPE 0
+#else
+ #define LOGTYPE 1
+#endif __WINSCW__
+
+#if LOGTYPE == 0
+
+ #define VCXLOGLO1(s) RDebug::Print(_L(#s))
+ #define VCXLOGLO2(s, a) RDebug::Print(_L(#s), a)
+ #define VCXLOGLO3(s, a, b) RDebug::Print(_L(#s), a, b)
+ #define VCXLOGLO4(s, a, b, c) RDebug::Print(_L(#s), a, b, c)
+ #define VCXLOGLO5(s, a, b, c, d) RDebug::Print(_L(#s), a, b, c, d)
+
+#endif
+
+#if LOGTYPE == 1
+
+ #include <flogger.h>
+
+ _LIT(KVCXLogFolder2,"Fusion");
+ _LIT(KVCXLogFile2,"Fusion.txt");
+
+ #define VCXLOGLO1(AAA) do { _LIT(tempVCXLogDes,AAA); RFileLogger::Write(KVCXLogFolder2(),KVCXLogFile2(),EFileLoggingModeAppend,tempVCXLogDes()); } while ( EFalse )
+ #define VCXLOGLO2(AAA,BBB) do { _LIT(tempVCXLogDes,AAA); RFileLogger::WriteFormat(KVCXLogFolder2(),KVCXLogFile2(),EFileLoggingModeAppend,TRefByValue<const TDesC>(tempVCXLogDes()),BBB); } while ( EFalse )
+ #define VCXLOGLO3(AAA,BBB,CCC) do { _LIT(tempVCXLogDes,AAA); RFileLogger::WriteFormat(KVCXLogFolder2(),KVCXLogFile2(),EFileLoggingModeAppend,TRefByValue<const TDesC>(tempVCXLogDes()),BBB,CCC); } while ( EFalse )
+ #define VCXLOGLO4(AAA,BBB,CCC,DDD) do { _LIT(tempVCXLogDes,AAA); RFileLogger::WriteFormat(KVCXLogFolder2(),KVCXLogFile2(),EFileLoggingModeAppend,TRefByValue<const TDesC>(tempVCXLogDes()),BBB,CCC,DDD); } while ( EFalse )
+ #define VCXLOGLO5(AAA,BBB,CCC,DDD,EEE) do { _LIT(tempVCXLogDes,AAA); RFileLogger::WriteFormat(KVCXLogFolder2(),KVCXLogFile2(),EFileLoggingModeAppend,TRefByValue<const TDesC>(tempVCXLogDes()),BBB,CCC,DDD,EEE); } while ( EFalse )
+
+#endif
+
+#if LOGTYPE == 2
+
+ #define VCXLOGLO1(s)
+ #define VCXLOGLO2(s, a)
+ #define VCXLOGLO3(s, a, b)
+ #define VCXLOGLO4(s, a, b, c)
+ #define VCXLOGLO5(s, a, b, c, d)
+
+#endif
+
+#else // _DEBUG
+
+ #ifdef FILE_LOGGING_IN_UREL_BUILD
+
+ #include <flogger.h>
+
+ _LIT(KVCXLogFolder2,"Fusion");
+ _LIT(KVCXLogFile2,"Fusion.txt");
+
+ #define VCXLOGLO1(AAA) do { _LIT(tempVCXLogDes,AAA); RFileLogger::Write(KVCXLogFolder2(),KVCXLogFile2(),EFileLoggingModeAppend,tempVCXLogDes()); } while ( EFalse )
+ #define VCXLOGLO2(AAA,BBB) do { _LIT(tempVCXLogDes,AAA); RFileLogger::WriteFormat(KVCXLogFolder2(),KVCXLogFile2(),EFileLoggingModeAppend,TRefByValue<const TDesC>(tempVCXLogDes()),BBB); } while ( EFalse )
+ #define VCXLOGLO3(AAA,BBB,CCC) do { _LIT(tempVCXLogDes,AAA); RFileLogger::WriteFormat(KVCXLogFolder2(),KVCXLogFile2(),EFileLoggingModeAppend,TRefByValue<const TDesC>(tempVCXLogDes()),BBB,CCC); } while ( EFalse )
+ #define VCXLOGLO4(AAA,BBB,CCC,DDD) do { _LIT(tempVCXLogDes,AAA); RFileLogger::WriteFormat(KVCXLogFolder2(),KVCXLogFile2(),EFileLoggingModeAppend,TRefByValue<const TDesC>(tempVCXLogDes()),BBB,CCC,DDD); } while ( EFalse )
+ #define VCXLOGLO5(AAA,BBB,CCC,DDD,EEE) do { _LIT(tempVCXLogDes,AAA); RFileLogger::WriteFormat(KVCXLogFolder2(),KVCXLogFile2(),EFileLoggingModeAppend,TRefByValue<const TDesC>(tempVCXLogDes()),BBB,CCC,DDD,EEE); } while ( EFalse )
+
+ #else // FILE_LOGGING_IN_UREL_BUILD
+
+ #define VCXLOGLO1(s)
+ #define VCXLOGLO2(s, a)
+ #define VCXLOGLO3(s, a, b)
+ #define VCXLOGLO4(s, a, b, c)
+ #define VCXLOGLO5(s, a, b, c, d)
+
+ #endif // FILE_LOGGING_IN_UREL_BUILD
+
+#endif // _DEBUG
+
+
+#endif // VCXTESTLOG_H
+
+// End of File
--- a/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/inc/VCXTestMdsDbModifier.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/inc/VCXTestMdsDbModifier.h Thu Apr 01 23:22:15 2010 +0300
@@ -15,8 +15,6 @@
*
*/
-
-
#ifndef CVCXTESTMDSDBMODIFIER_H
#define CVCXTESTMDSDBMODIFIER_H
--- a/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/init/TestFramework.ini Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/init/TestFramework.ini Thu Apr 01 23:22:15 2010 +0300
@@ -1,3 +1,20 @@
+#/*
+#* 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 the License "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:
+#*
+#*/
+
#
# This is STIFTestFramework initialization file
# Comment lines start with '#'-character.
@@ -44,7 +61,7 @@
TestReportFormat= TXT # Possible values: TXT or HTML
TestReportOutput= FILE # Possible values: FILE or RDEBUG
-TestReportFileCreationMode= APPEND # Possible values: OVERWRITE or APPEND
+TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND
UITestingSupport= Yes
SeparateProcesses= YES
[End_Defaults]
@@ -74,7 +91,9 @@
[New_Module]
ModuleName= testscripter
-TestCaseFile= c:\testframework\VCXMyVideosCollectionPluginTestHelium.cfg
+TestCaseFile= c:\testframework\VCXMyVideosCollectionPluginTest.cfg
+TestCaseFile= c:\testframework\VCXMyVideosCollectionPluginTestCategories.cfg
+TestCaseFile= c:\testframework\VCXMyVideosCollectionPluginTestAlbums.cfg
[End_Module]
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/src/CVcxTestActiveWait.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,192 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:
+*
+*/
+
+// INCLUDE FILES
+#include "CVcxTestActiveWait.h"
+#include "VCXTestLog.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVcxTestActiveWait::
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVcxTestActiveWait* CVcxTestActiveWait::NewL()
+ {
+ VCXLOGLO1(">>>CVcxTestActiveWait::NewL");
+ CVcxTestActiveWait* self = new (ELeave) CVcxTestActiveWait();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+ VCXLOGLO1("<<<CVcxTestActiveWait::NewL");
+ return self;
+ }
+// -----------------------------------------------------------------------------
+// CVcxTestActiveWait::~CVcxTestActiveWait
+// destructor
+// -----------------------------------------------------------------------------
+//
+CVcxTestActiveWait::~CVcxTestActiveWait()
+ {
+ VCXLOGLO1(">>>CVcxTestActiveWait::~CVcxTestActiveWait");
+
+ ActiveWait(EActiveWaitStop);
+ delete iActiveSchedulerWait;
+ iActiveSchedulerWait = NULL;
+
+ VCXLOGLO1("<<<CVcxTestActiveWait::~CVcxTestActiveWait");
+ }
+
+// -----------------------------------------------------------------------------
+// CVcxTestActiveWait::~CVcxTestActiveWait
+// destructor
+// -----------------------------------------------------------------------------
+//
+CVcxTestActiveWait::CVcxTestActiveWait()
+ {
+ VCXLOGLO1(">>>CVcxTestActiveWait::CVcxTestActiveWait");
+
+
+ VCXLOGLO1("<<<CVcxTestActiveWait::CVcxTestActiveWait");
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVcxTestActiveWait::ConstructL
+//
+// -----------------------------------------------------------------------------
+//
+void CVcxTestActiveWait::ConstructL()
+ {
+ VCXLOGLO1(">>>CVcxTestActiveWait::ConstructL");
+
+ iActiveSchedulerWait = new (ELeave) CActiveSchedulerWait;
+
+ VCXLOGLO1("<<<CVcxTestActiveWait::ConstructL");
+ }
+
+// -----------------------------------------------------------------------------
+// CVcxTestActiveWait::ActiveWait
+// -----------------------------------------------------------------------------
+//
+void CVcxTestActiveWait::ActiveWait( TVcxTestActiveWaitCmd aActiveWaitCmd )
+ {
+ VCXLOGLO1(">>>CVcxTestActiveWait::ActiveWait");
+
+ VCXLOGLO2("aActiveWaitCmd=%d", aActiveWaitCmd );
+
+ switch( aActiveWaitCmd )
+ {
+ case EActiveWaitStart:
+ {
+ if( !iActiveSchedulerWait->IsStarted() )
+ {
+ iActiveSchedulerWait->Start();
+ }
+ else
+ {
+ VCXLOGLO1("ActiveSchedulerWait already started");
+ }
+ }
+ break;
+ case EActiveWaitStop:
+ {
+ if( iActiveSchedulerWait->IsStarted() )
+ {
+ iActiveSchedulerWait->AsyncStop();
+ }
+ else
+ {
+ VCXLOGLO1("ActiveSchedulerWait already stopped");
+ }
+ }
+ break;
+ default:
+ break;
+ }
+
+ VCXLOGLO1("<<<CVcxTestActiveWait::ActiveWait");
+ }
+
+// -----------------------------------------------------------------------------
+// CVcxTestActiveWait::IsWaiting
+// -----------------------------------------------------------------------------
+//
+TBool CVcxTestActiveWait::IsWaiting()
+ {
+ return iActiveSchedulerWait->IsStarted();
+ }
+
+// -----------------------------------------------------------------------------
+// CVcxTestActiveWait::Start
+// -----------------------------------------------------------------------------
+//
+TInt CVcxTestActiveWait::Start( )
+ {
+ TInt err = KErrNotReady;
+ if( !iActiveSchedulerWait->IsStarted() )
+ {
+ iActiveSchedulerWait->Start();
+ err = KErrNone;
+ }
+ else
+ {
+ VCXLOGLO1("ActiveSchedulerWait already started");
+ }
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVcxTestActiveWait::Stop
+// -----------------------------------------------------------------------------
+//
+TInt CVcxTestActiveWait::Stop( )
+ {
+ TInt err = KErrNotReady;
+ if( iActiveSchedulerWait->IsStarted() )
+ {
+ iActiveSchedulerWait->AsyncStop();
+ err = KErrNone;
+ }
+ else
+ {
+ VCXLOGLO1("ActiveSchedulerWait already stopped");
+ }
+ return err;
+ }
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/src/CVcxTestTimer.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,182 @@
+/*
+* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:
+*
+*/
+
+// INCLUDE FILES
+#include "CVcxTestTimer.h"
+#include "MVcxTestTimerObserver.h"
+#include "VCXTestLog.h"
+
+// EXTERNAL DATA STRUCTURES
+
+// EXTERNAL FUNCTION PROTOTYPES
+
+// CONSTANTS
+
+// MACROS
+
+// LOCAL CONSTANTS AND MACROS
+
+// MODULE DATA STRUCTURES
+
+// LOCAL FUNCTION PROTOTYPES
+
+// FORWARD DECLARATIONS
+
+// ============================= LOCAL FUNCTIONS ===============================
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVcxTestTimer::
+// C++ default constructor can NOT contain any code, that
+// might leave.
+// -----------------------------------------------------------------------------
+//
+CVcxTestTimer* CVcxTestTimer::NewL(MVcxTestTimerObserver& aObserver, TInt aId)
+ {
+ VCXLOGLO1(">>>CVcxTestTimer::NewL");
+ CVcxTestTimer* self = new (ELeave) CVcxTestTimer(aObserver, aId);
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop();
+ VCXLOGLO1("<<<CVcxTestTimer::NewL");
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVcxTestTimer::~CVcxTestTimer
+// destructor
+// -----------------------------------------------------------------------------
+//
+CVcxTestTimer::~CVcxTestTimer()
+ {
+ VCXLOGLO1(">>>CVcxTestTimer::~CVcxTestTimer");
+ iRestartAfterCancel = EFalse;
+ Cancel();
+ iTimer.Close();
+
+ if( IsAdded() )
+ {
+ Deque(); // calls also Cancel()
+ }
+
+ VCXLOGLO1("<<<CVcxTestTimer::~CVcxTestTimer");
+ }
+
+// -----------------------------------------------------------------------------
+// CVcxTestTimer::~CVcxTestTimer
+// destructor
+// -----------------------------------------------------------------------------
+//
+void CVcxTestTimer::CancelTimer()
+ {
+ VCXLOGLO1(">>>CVcxTestTimer::CancelTimer");
+ if( IsActive() )
+ {
+ iRestartAfterCancel = EFalse;
+ Cancel();
+ }
+ VCXLOGLO1("<<<CVcxTestTimer::CancelTimer");
+ }
+
+// -----------------------------------------------------------------------------
+// CVcxTestTimer::CVcxTestTimer
+//
+// -----------------------------------------------------------------------------
+//
+CVcxTestTimer::CVcxTestTimer(MVcxTestTimerObserver& aObserver, TInt aId) : CActive(EPriorityStandard), iObserver(aObserver),
+ iId(aId)
+ {
+ VCXLOGLO1(">>>CVcxTestTimer::CVcxTestTimer");
+ CActiveScheduler::Add(this);
+ VCXLOGLO1("<<<CVcxTestTimer::CVcxTestTimer");
+ }
+
+// -----------------------------------------------------------------------------
+// CVcxTestTimer::ConstructL
+//
+// -----------------------------------------------------------------------------
+//
+void CVcxTestTimer::ConstructL()
+ {
+ VCXLOGLO1(">>>CVcxTestTimer::ConstructL");
+ User::LeaveIfError(iTimer.CreateLocal());
+ VCXLOGLO1("<<<CVcxTestTimer::ConstructL");
+ }
+
+// -----------------------------------------------------------------------------
+// CVcxTestTimer::After
+//
+// -----------------------------------------------------------------------------
+//
+void CVcxTestTimer::After(TTimeIntervalMicroSeconds32 aInterval)
+ {
+
+ iInterval = aInterval;
+
+ if( !IsActive() )
+ {
+ VCXLOGLO2("CVcxTestTimer::After: Setting active. (%d)", this);
+ iTimer.After( iStatus, aInterval );
+ SetActive();
+ iRestartAfterCancel = EFalse;
+ }
+ else
+ {
+ // Cancel and start again when cancel is done.
+ VCXLOGLO2("CVcxTestTimer::After: Restarting! (%d)", this);
+ iRestartAfterCancel = ETrue;
+ iTimer.Cancel();
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVcxTestTimer::RunL
+//
+// -----------------------------------------------------------------------------
+//
+void CVcxTestTimer::RunL()
+ {
+ TInt status = iStatus.Int();
+
+ if( status == KErrNone )
+ {
+ iObserver.TimerComplete( iId, iStatus.Int() );
+ }
+ else
+ if( status == KErrCancel && iRestartAfterCancel )
+ {
+ iRestartAfterCancel = EFalse;
+ iTimer.After( iStatus, iInterval );
+ SetActive();
+ VCXLOGLO2("CVcxTestTimer::RunL: Restarted! (%d)", this);
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVcxTestTimer::DoCancel
+//
+// -----------------------------------------------------------------------------
+//
+void CVcxTestTimer::DoCancel()
+ {
+ VCXLOGLO1(">>>CVcxTestTimer::DoCancel");
+ iTimer.Cancel();
+ VCXLOGLO1("<<<CVcxTestTimer::DoCancel");
+ }
+
+// End of File
--- a/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/src/VCXMyVideosCollectionPluginTest.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/src/VCXMyVideosCollectionPluginTest.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -11,10 +11,9 @@
*
* Contributors:
*
-* Description: ?Description*
+* Description:
*/
-
// INCLUDE FILES
#include <Stiftestinterface.h>
#include "VCXMyVideosCollectionPluginTest.h"
--- a/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/src/VCXMyVideosCollectionPluginTestBlocks.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/src/VCXMyVideosCollectionPluginTestBlocks.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -11,10 +11,9 @@
*
* Contributors:
*
-* Description: ?Description*
+* Description:
*/
-
// INCLUDE FILES
#include <mmf/common/mmfcontrollerpluginresolver.h> // CleanupResetAndDestroyPushL
#include <e32svr.h>
@@ -24,30 +23,35 @@
#include <collate.h>
#include "VCXTestLog.h"
-#include "VCXTestCommon.h"
-#include "CIptvTestActiveWait.h"
-#include "CIptvTestTimer.h"
-#include "VCXTestStatsKeeper.h"
+#include "VCXMyVideosTestUtils.h"
+#include "CVcxTestActiveWait.h"
+#include "CVcxTestTimer.h"
#include "VCXMyVideosCollectionPluginTest.h"
#include "VCXMyVideosCollectionPluginTester.h"
+#include "VCXMyVideosTestUtils.h"
+#include "VCXTestMdsDbModifier.h"
#include "VCXMyVideosTestCommon.h"
-#include "VCXMyVideosTestDlWatcher.h"
-#include "VCXMyVideosTestServiceEmu.h"
-#include "VCXTestMdsDbModifier.h"
#include <mpxmedia.h>
#include <mpxmediageneraldefs.h>
#include <mpxmediageneralextdefs.h>
+#include "vcxmyvideosdefs.h"
#include "vcxmyvideosuids.h"
// CONSTANTS
const TInt KVcxTestFileSize3GB = -999;
+_LIT(KAbout2050CharsString, "asdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjaiasdfiajsdfasdfiasdjfijasdifjisdfjisdjfiasdjfidjai");
+_LIT(KVcxTestEmptyString, "");
+
+_LIT(KStifScriptInvalidRequest, "InvalidRequest");
+_LIT(KStifScriptEmptyString, "EmptyString");
+_LIT(KStifScript2KString, "2KString");
+
// MACROS
-#define VCXMVTEST_ERR(err) ( iStatsEnabled ) ? KErrNone : err
// MODULE DATA STRUCTURES
@@ -106,8 +110,8 @@
iSideloadFolders.ResetAndDestroy();
- delete iTestCommon;
- iTestCommon = NULL;
+ delete iTestUtils;
+ iTestUtils = NULL;
#ifdef __WINSCW__
iClient.Close();
@@ -144,9 +148,6 @@
delete iMpxMedia;
iMpxMedia = NULL;
- delete iServiceEmu;
- iServiceEmu = NULL;
-
delete iMdsDbModifier;
iMdsDbModifier = NULL;
@@ -154,9 +155,6 @@
iFileMan = NULL;
iFs.Close();
-
- delete iStats;
- iStats = NULL;
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::Delete <----------");
}
@@ -177,18 +175,16 @@
// Second is the actual implementation member function.
ENTRY( "Create", CVCXMyVideosCollectionPluginTest::CreateL ),
- ENTRY( "EnableStats", CVCXMyVideosCollectionPluginTest::EnableStatsL ),
- ENTRY( "SetPreferredMemory", CVCXMyVideosCollectionPluginTest::SetPreferredMemoryL ),
ENTRY( "SetSortingOrder", CVCXMyVideosCollectionPluginTest::SetSortingOrderL ),
ENTRY( "SetAutomaticRefresh", CVCXMyVideosCollectionPluginTest::SetAutomaticRefresh ),
ENTRY( "SetQuietMode", CVCXMyVideosCollectionPluginTest::SetQuietMode ),
ENTRY( "CoolDown", CVCXMyVideosCollectionPluginTest::CoolDownL ),
- ENTRY( "DisableDownloadCheck", CVCXMyVideosCollectionPluginTest::DisableDownloadCheckL ),
ENTRY( "SetFileCheck", CVCXMyVideosCollectionPluginTest::SetFileCheckL ),
- ENTRY( "SetAutoResume", CVCXMyVideosCollectionPluginTest::SetAutoResumeL ),
+ ENTRY( "SetUseCopiedMedias", CVCXMyVideosCollectionPluginTest::SetUseCopiedMediasL ),
ENTRY( "OpenCollection", CVCXMyVideosCollectionPluginTest::OpenCollectionL ),
ENTRY( "OpenLevel", CVCXMyVideosCollectionPluginTest::OpenLevelL ),
+ ENTRY( "OpenLevelByIndex", CVCXMyVideosCollectionPluginTest::OpenLevelByIndexL ),
ENTRY( "RefreshContents", CVCXMyVideosCollectionPluginTest::RefreshContentsL ),
ENTRY( "GetMediasByMpxId", CVCXMyVideosCollectionPluginTest::GetMediasByMpxIdL ),
ENTRY( "CloseLevel", CVCXMyVideosCollectionPluginTest::CloseLevelL ),
@@ -198,10 +194,10 @@
ENTRY( "GetAllMediaFullDetails", CVCXMyVideosCollectionPluginTest::GetAllMediaFullDetailsL ),
ENTRY( "SetMediaDetail", CVCXMyVideosCollectionPluginTest::SetMediaDetailL ),
ENTRY( "CheckMediaDetail", CVCXMyVideosCollectionPluginTest::CheckMediaDetailL ),
+ ENTRY( "CheckAlbumCount", CVCXMyVideosCollectionPluginTest::CheckAlbumCountL ),
ENTRY( "CheckMediaCount", CVCXMyVideosCollectionPluginTest::CheckMediaCountL ),
ENTRY( "CheckMinimumMediaCount", CVCXMyVideosCollectionPluginTest::CheckMinimumMediaCountL ),
ENTRY( "CheckMaximumMediaCount", CVCXMyVideosCollectionPluginTest::CheckMaximumMediaCountL ),
- ENTRY( "CheckDownloadCount", CVCXMyVideosCollectionPluginTest::CheckDownloadCountL ),
ENTRY( "CreateCopyOfMedia", CVCXMyVideosCollectionPluginTest::CreateCopyOfMediaL ),
ENTRY( "CreateEmptyMedia", CVCXMyVideosCollectionPluginTest::CreateEmptyMediaL ),
@@ -212,6 +208,7 @@
ENTRY( "DeleteFileOfMedia", CVCXMyVideosCollectionPluginTest::DeleteFileOfMediaL ),
ENTRY( "DeleteFilesOfAllMedias", CVCXMyVideosCollectionPluginTest::DeleteFilesOfAllMediasL ),
+ ENTRY( "CreateAlbum", CVCXMyVideosCollectionPluginTest::CreateAlbumL ),
ENTRY( "RemoveMedia", CVCXMyVideosCollectionPluginTest::RemoveMediaL ),
ENTRY( "RemoveAllMedia", CVCXMyVideosCollectionPluginTest::RemoveAllMediaL ),
ENTRY( "MoveMedia", CVCXMyVideosCollectionPluginTest::MoveMediaL ),
@@ -224,25 +221,19 @@
ENTRY( "DeleteMedias", CVCXMyVideosCollectionPluginTest::DeleteMediasL ),
ENTRY( "CancelDelete", CVCXMyVideosCollectionPluginTest::CancelDeleteL ),
+ ENTRY( "CreateAlbum", CVCXMyVideosCollectionPluginTest::CreateAlbumL ),
+ ENTRY( "DeleteAlbums", CVCXMyVideosCollectionPluginTest::DeleteAlbumsL ),
+ ENTRY( "DeleteAllAlbums", CVCXMyVideosCollectionPluginTest::DeleteAllAlbumsL ),
+ ENTRY( "AddMediasToAlbum", CVCXMyVideosCollectionPluginTest::AddMediasToAlbumL ),
+ ENTRY( "RemoveMediasFromAlbum", CVCXMyVideosCollectionPluginTest::RemoveMediasFromAlbumL ),
+ ENTRY( "CheckAlbumCount", CVCXMyVideosCollectionPluginTest::CheckAlbumCount ),
+
ENTRY( "CreateVideoFile", CVCXMyVideosCollectionPluginTest::CreateVideoFileL ),
ENTRY( "CreateVideoFileNoWait", CVCXMyVideosCollectionPluginTest::CreateVideoFileNoWaitL ),
ENTRY( "EnsureDriveForVideos", CVCXMyVideosCollectionPluginTest::EnsureDriveForVideosL ),
ENTRY( "EmptySideloadFolders", CVCXMyVideosCollectionPluginTest::EmptySideloadFoldersL ),
ENTRY( "SetDeleteSideloadedVideos", CVCXMyVideosCollectionPluginTest::SetDeleteSideloadedVideos ),
- ENTRY( "Download", CVCXMyVideosCollectionPluginTest::DownloadL ),
- ENTRY( "ResumeDownload", CVCXMyVideosCollectionPluginTest::ResumeDownloadL ),
- ENTRY( "ResumeAllDownloads", CVCXMyVideosCollectionPluginTest::ResumeAllDownloadsL ),
- ENTRY( "DownloadUsingMedia", CVCXMyVideosCollectionPluginTest::DownloadUsingMediaL ),
- ENTRY( "ResumeDownloadUsingMedia", CVCXMyVideosCollectionPluginTest::ResumeDownloadUsingMediaL ),
- ENTRY( "DownloadUrl", CVCXMyVideosCollectionPluginTest::DownloadUrlL ),
- ENTRY( "CancelDownload", CVCXMyVideosCollectionPluginTest::CancelDownloadL ),
- ENTRY( "CancelDownloadById", CVCXMyVideosCollectionPluginTest::CancelDownloadByIdL ),
- ENTRY( "PauseDownload", CVCXMyVideosCollectionPluginTest::PauseDownloadL ),
- ENTRY( "PauseDownloadByUrl", CVCXMyVideosCollectionPluginTest::PauseDownloadByUrlL ),
- ENTRY( "CheckDownloadProgress", CVCXMyVideosCollectionPluginTest::CheckDownloadProgressL ),
-
- ENTRY( "WaitAllDownloads", CVCXMyVideosCollectionPluginTest::WaitAllDownloadsL ),
ENTRY( "WaitForMessage", CVCXMyVideosCollectionPluginTest::WaitForMessageL ),
ENTRY( "WaitForAnyMessage", CVCXMyVideosCollectionPluginTest::WaitForAnyMessageL ),
ENTRY( "WaitForMessages", CVCXMyVideosCollectionPluginTest::WaitForMessagesL ),
@@ -257,34 +248,6 @@
}
// -----------------------------------------------------------------------------
-// CVCXMyVideosCollectionPluginTest::EnableStatsL
-// -----------------------------------------------------------------------------
-//
-TInt CVCXMyVideosCollectionPluginTest::EnableStatsL( CStifItemParser& aItem )
- {
- VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::EnableStatsL ---------->");
- // Print to UI
- _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
- _LIT( KWhere, "In EnableStatsL" );
- TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
- // Print to log file
- iLog->Log( KWhere );
-
- aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
-
- TPtrC statsName;
- TPtrC fileName;
- User::LeaveIfError( aItem.GetNextString( statsName) );
- User::LeaveIfError( aItem.GetNextString( fileName) );
-
- TRAP_IGNORE( iStats->StartStatsKeepingL( statsName, fileName ) );
- iStatsEnabled = ETrue;
-
- VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::EnableStatsL <----------");
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
// CVCXMyVideosCollectionPluginTest::CreateL
// -----------------------------------------------------------------------------
//
@@ -303,13 +266,12 @@
aItem.SetParsingType(CStifItemParser::EQuoteStyleParsing);
- iTestCommon = CVCXTestCommon::NewL();
- iStats = CVCXTestStatsKeeper::NewL();
- iTester = CVCXMyVideosCollectionPluginTester::NewL( this, iTestCommon, iStats );
- iActiveWait = CIptvTestActiveWait::NewL();
- iActiveWaitBlocking = CIptvTestActiveWait::NewL();
- iTimeoutTimer = CIptvTestTimer::NewL(*this, 0);
- iCoolDownTimer = CIptvTestTimer::NewL(*this, 1);
+ iTestUtils = CVCXMyVideosTestUtils::NewL();
+ iTester = CVCXMyVideosCollectionPluginTester::NewL( this, iTestUtils );
+ iActiveWait = CVcxTestActiveWait::NewL();
+ iActiveWaitBlocking = CVcxTestActiveWait::NewL();
+ iTimeoutTimer = CVcxTestTimer::NewL(*this, 0);
+ iCoolDownTimer = CVcxTestTimer::NewL(*this, 1);
#ifdef __WINSCW__
TInt err = iClient.Connect();
@@ -319,12 +281,6 @@
}
#endif // __WINSCW__
- iAutoResume = ETrue;
-
- iTester->SetAutoResume( iAutoResume );
-
- iServiceEmu = CVCXMyVideosTestServiceEmu::NewL();
-
iMdsDbModifier = CVCXTestMdsDbModifier::NewL();
iCurrentSortOrder = EVcxMyVideosSortingNone;
@@ -334,40 +290,6 @@
}
// -----------------------------------------------------------------------------
-// CVCXMyVideosCollectionPluginTest::SetPreferredMemoryL
-// -----------------------------------------------------------------------------
-//
-TInt CVCXMyVideosCollectionPluginTest::SetPreferredMemoryL( CStifItemParser& aItem )
- {
- VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::SetPreferredMemoryL ---------->");
- // Print to UI
- _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
- _LIT( KWhere, "In SetPreferredMemoryL" );
- TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
- // Print to log file
- iLog->Log( KWhere );
-
- aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
-
- TInt drive(0);
- User::LeaveIfError( GetDriveParam( aItem, drive ) );
-
- // These were defined in CVcxMyVideosDownloadUtil::PreferredMemoryDesL()
- const TInt KVcxCenRepUid = 0x102750E2; // same as KIptvCenRepUid in CIptvUtil.h
- const TInt KVcxCenRepPreferredMemoryKey = 0x01; // same as KIptvCenRepPreferredMemoryKey in CIptvUtil.h
-
- TUid uid;
- uid.iUid = KVcxCenRepUid;
-
- CRepository* cenRep = CRepository::NewLC( uid );
- User::LeaveIfError( cenRep->Set( KVcxCenRepPreferredMemoryKey, drive ) );
- CleanupStack::PopAndDestroy( cenRep );
-
- VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetPreferredMemoryL <----------");
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
// CVCXMyVideosCollectionPluginTest::SetSortingOrderL
// -----------------------------------------------------------------------------
//
@@ -397,7 +319,7 @@
iCurrentSortOrder = value;
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetSortingOrderL <----------");
- return VCXMVTEST_ERR( err );
+ return err;
}
// -----------------------------------------------------------------------------
@@ -423,7 +345,7 @@
}
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetAutomaticRefresh <----------");
- return VCXMVTEST_ERR( err );
+ return err;
}
// -----------------------------------------------------------------------------
@@ -449,11 +371,11 @@
}
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetQuietMode <----------");
- return VCXMVTEST_ERR( err );
+ return err;
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::CoolDownL
+// CVcxMyVideosApiTest::CoolDownL
// -----------------------------------------------------------------------------
//
TInt CVCXMyVideosCollectionPluginTest::CoolDownL( CStifItemParser& /* aItem */ )
@@ -482,22 +404,7 @@
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::DisableDownloadCheckL
-// -----------------------------------------------------------------------------
-//
-TInt CVCXMyVideosCollectionPluginTest::DisableDownloadCheckL( CStifItemParser& /* aItem */ )
- {
- VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::DisableDownloadCheckL");
- if( iTester )
- {
- iTester->GetDownloadWatcher()->DisableDownloadCheck();
- }
- VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DisableDownloadCheckL");
- return KErrNone;
- }
-
-// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::SetFileCheckL
+// CVcxMyVideosApiTest::SetFileCheckL
// -----------------------------------------------------------------------------
//
TInt CVCXMyVideosCollectionPluginTest::SetFileCheckL( CStifItemParser& aItem )
@@ -513,28 +420,19 @@
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::SetAutoResumeL
+// CVcxMyVideosApiTest::SetUseCopiedMediasL
// -----------------------------------------------------------------------------
//
-TInt CVCXMyVideosCollectionPluginTest::SetAutoResumeL( CStifItemParser& aItem )
+TInt CVCXMyVideosCollectionPluginTest::SetUseCopiedMediasL( CStifItemParser& aItem )
{
- VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::SetAutoResumeL ---------->");
- // Print to UI
- _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
- _LIT( KWhere, "In SetAutoResumeL" );
- TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
- // Print to log file
- iLog->Log( KWhere );
-
- TInt autoResume(0);
- User::LeaveIfError( aItem.GetNextInt( autoResume ) );
- iAutoResume = autoResume;
- if( iTester )
- {
- iTester->SetAutoResume( iAutoResume );
- }
-
- VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetAutoResumeL <----------");
+ VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::SetUseCopiedMediasL");
+
+ TInt value(0);
+ User::LeaveIfError( aItem.GetNextInt( value ) );
+ TBool set = static_cast<TBool>(value);
+ iTester->SetUseCopiedMediasL( set );
+
+ VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetUseCopiedMediasL");
return KErrNone;
}
@@ -579,7 +477,7 @@
VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::OpenCollectionL <----------");
- return VCXMVTEST_ERR( err );
+ return err;
}
// -----------------------------------------------------------------------------
@@ -597,6 +495,41 @@
iLog->Log( KWhere );
aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
+
+ TPtrC name;
+ User::LeaveIfError( aItem.GetNextString( name ) );
+ VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: levelName: %S", &name);
+
+ iLastReceivedMessage = -1;
+
+ TInt err( KErrNotReady );
+ if( iTester )
+ {
+ TRAP( err, iTester->OpenLevelL( name ) );
+ }
+
+ if( err != KErrNone )
+ VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
+
+ VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::OpenLevelL <----------");
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVCXMyVideosCollectionPluginTest::OpenLevelByIndexL
+// -----------------------------------------------------------------------------
+//
+TInt CVCXMyVideosCollectionPluginTest::OpenLevelByIndexL( CStifItemParser& aItem )
+ {
+ VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::OpenLevelByIndexL ---------->");
+ // Print to UI
+ _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
+ _LIT( KWhere, "In OpenLevelL" );
+ TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
+ // Print to log file
+ iLog->Log( KWhere );
+
+ aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
TInt index;
User::LeaveIfError( aItem.GetNextInt( index ) );
VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: index: %d", index);
@@ -612,8 +545,8 @@
if( err != KErrNone )
VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
- VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::OpenLevelL <----------");
- return VCXMVTEST_ERR( err );
+ VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::OpenLevelByIndexL <----------");
+ return err;
}
// -----------------------------------------------------------------------------
@@ -642,7 +575,7 @@
VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CloseLevelL <----------");
- return VCXMVTEST_ERR( err );
+ return err;
}
// -----------------------------------------------------------------------------
@@ -673,7 +606,7 @@
VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::RefreshContentsL <----------");
- return VCXMVTEST_ERR( err );
+ return err;
}
// -----------------------------------------------------------------------------
@@ -720,7 +653,7 @@
VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::GetMediasByMpxIdL <----------");
- return VCXMVTEST_ERR( err );
+ return err;
}
// -----------------------------------------------------------------------------
@@ -776,7 +709,7 @@
messages.Reset();
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::GetMediaFullDetailsL <----------");
- return VCXMVTEST_ERR( err );
+ return err;
}
// -----------------------------------------------------------------------------
@@ -843,7 +776,7 @@
messages.Reset();
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::GetMediaFullDetailsByMpxIdL <----------");
- return VCXMVTEST_ERR( err );
+ return err;
}
// -----------------------------------------------------------------------------
@@ -876,7 +809,7 @@
iLastReceivedMessage = -1;
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::GetAllMediaFullDetailsL <----------");
- return VCXMVTEST_ERR( err );
+ return err;
}
// -----------------------------------------------------------------------------
@@ -903,28 +836,49 @@
TInt drive(0);
User::LeaveIfError( GetDriveParam( aItem, drive ) );
-
- TInt itemIndex(0);
- User::LeaveIfError( aItem.GetNextInt( itemIndex ) );
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: item index: %d", itemIndex);
-
- if( itemIndex < 0 || itemIndex >= iTester->GetMediaCount() )
+
+ // Get the media object to be checked.
+
+ TPtrC itemIndexOrName;
+ User::LeaveIfError( aItem.GetNextString( itemIndexOrName ) );
+ VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: item index or name: %S", &itemIndexOrName);
+
+ TLex lex( itemIndexOrName );
+ TInt itemIndex( -1 );
+ if( lex.Val( itemIndex ) == KErrNone )
{
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: Error. Index (%d) out of bounds.", itemIndex);
+ if( itemIndex < 0 || itemIndex >= iTester->GetMediaCount() )
+ {
+ VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: Error. Index (%d) out of bounds.", itemIndex);
+ User::Leave( KErrArgument );
+ }
+ }
+ else
+ {
+ itemIndex = iTester->GetIndexOfMediaWithNameL( itemIndexOrName );
+ }
+
+ if( itemIndex == KErrNotFound )
+ {
User::Leave( KErrArgument );
}
+ // Attribute to be checked
+
TInt mpxAttributeMappingId(0);
User::LeaveIfError( aItem.GetNextInt( mpxAttributeMappingId ) );
+ // It's type.
+
TVcxTestMediaAttributeType type;
TMPXAttributeData mpxMediaAttribute;
User::LeaveIfError( MapMpxMediaAttribute(
static_cast<TVcxTestMediaAttributeIdMapping>(mpxAttributeMappingId),
mpxMediaAttribute, type ) );
+ // Get the media to be checked.
- CMPXMedia* media( NULL );
+ CMPXMedia* media( NULL );
TRAP( err, media = iTester->GetMediaL( drive, itemIndex ) );
// If attribute is not supported, fetch full media details.
@@ -945,7 +899,7 @@
if( err != KErrNone )
{
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckMediaDetailL <----------");
- return VCXMVTEST_ERR( err );
+ return err;
}
if( !media->IsSupported( mpxMediaAttribute ) )
@@ -956,7 +910,7 @@
iTester->PrintMPXMediaL( *media, ETrue );
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckMediaDetailL <---------");
- return VCXMVTEST_ERR( KErrNotSupported );
+ return KErrNotSupported;
}
if( type == EVcxTestMediaAttributeTypeString )
@@ -1246,7 +1200,7 @@
}
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckMediaDetailL <----------");
- return VCXMVTEST_ERR( err );
+ return err;
}
// -----------------------------------------------------------------------------
@@ -1446,11 +1400,70 @@
}
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetMediaDetailL <----------");
- return VCXMVTEST_ERR( err );
+ return err;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVcxMyVideosApiTest::CheckAlbumCountL
+// -----------------------------------------------------------------------------
+//
+TInt CVCXMyVideosCollectionPluginTest::CheckAlbumCountL( CStifItemParser& aItem )
+ {
+
+ VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CheckAlbumCountL ---------->");
+ // Print to UI
+ _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
+ _LIT( KWhere, "In CheckAlbumCountL" );
+ TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
+ // Print to log file
+ iLog->Log( KWhere );
+
+ WaitForRefreshL( EFalse ); // Wait for possible refresh to finish.
+
+ aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
+
+ TInt expectedCount(0);
+ User::LeaveIfError(aItem.GetNextInt(expectedCount));
+
+ // File check
+ TInt videoCount = iTester->GetMediaCount();
+
+ // attribute check that they are in allowed values
+
+ int err(KErrNone);
+ int actualCount(0);
+
+ for( TInt i = videoCount-1; i >= 0; i-- )
+ {
+ CMPXMedia* media = iTester->GetMediaL( -1, i );
+
+ // Skip categories with empty names, they are for photos.
+ if( !media->IsSupported( KMPXMediaGeneralTitle ) )
+ {
+ continue;
+ }
+
+ TMPXItemId itemId = *( media->Value<TMPXItemId>( KMPXMediaGeneralId ) );
+
+ if(itemId.iId2 == KVcxMvcMediaTypeAlbum)
+ {
+ actualCount++;
+ }
+ }
+
+ if ( actualCount != expectedCount )
+ {
+ VCXLOGLO2("CVCXMyVideosCollectionPluginTest: Error! Count of albums is wrong: %d", actualCount );
+ err = KErrCorrupt;
+ }
+
+ VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckAlbumCountL <----------");
+ return err;
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::CheckMediaCountL
+// CVcxMyVideosApiTest::CheckMediaCountL
// -----------------------------------------------------------------------------
//
TInt CVCXMyVideosCollectionPluginTest::CheckMediaCountL( CStifItemParser& aItem )
@@ -1481,11 +1494,11 @@
}
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckMediaCountL <----------");
- return VCXMVTEST_ERR( err );
+ return err;
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::CheckMinimumMediaCountL
+// CVcxMyVideosApiTest::CheckMinimumMediaCountL
// -----------------------------------------------------------------------------
//
TInt CVCXMyVideosCollectionPluginTest::CheckMinimumMediaCountL( CStifItemParser& aItem )
@@ -1513,11 +1526,11 @@
TRAPD( err, CheckMediasL( expectedCount, drive, -1 ) );
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckMinimumMediaCountL <----------");
- return VCXMVTEST_ERR( err );
+ return err;
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::CheckMaximumMediaCountL
+// CVcxMyVideosApiTest::CheckMaximumMediaCountL
// -----------------------------------------------------------------------------
//
TInt CVCXMyVideosCollectionPluginTest::CheckMaximumMediaCountL( CStifItemParser& aItem )
@@ -1545,43 +1558,7 @@
TRAPD( err, CheckMediasL( expectedCount, drive, 1 ) );
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckMaximumMediaCountL <----------");
- return VCXMVTEST_ERR( err );
- }
-
-// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::CheckDownloadCountL
-// -----------------------------------------------------------------------------
-//
-TInt CVCXMyVideosCollectionPluginTest::CheckDownloadCountL( CStifItemParser& aItem )
- {
- VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CheckDownloadCountL ---------->");
- // Print to UI
- _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
- _LIT( KWhere, "In CheckMediaCountL" );
- TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
- // Print to log file
- iLog->Log( KWhere );
-
- aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
-
- WaitForRefreshL( EFalse ); // Wait for possible refresh to finish.
-
- TInt expectedCount(0);
- User::LeaveIfError(aItem.GetNextInt(expectedCount));
-
- TInt err( KErrNotReady );
- if( iTester )
- {
- err = KErrNone;
- if( iTester->GetDownloadWatcher()->GetDownloadCount() != expectedCount )
- {
- err = KErrCorrupt;
- VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: ERROR: Not expected count of downloads!");
- }
- }
-
- VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckDownloadCountL <----------");
- return VCXMVTEST_ERR( err );
+ return err;
}
// -----------------------------------------------------------------------------
@@ -1622,7 +1599,7 @@
{
VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: ERROR: There's zero medias!");
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CreateCopyOfMediaL <----------");
- return VCXMVTEST_ERR( KErrArgument );
+ return KErrArgument;
}
if( iMpxMedia )
@@ -1679,7 +1656,7 @@
}
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CreateCopyOfMediaL <----------");
- return VCXMVTEST_ERR( err );
+ return err;
}
// -----------------------------------------------------------------------------
@@ -1785,12 +1762,11 @@
}
#endif // __WINSCW__
-
if( err != KErrNone )
VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::AddMediaL <----------");
- return VCXMVTEST_ERR( err );
+ return err;
}
// -----------------------------------------------------------------------------
@@ -1832,7 +1808,7 @@
VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::SetMediaL <----------");
- return VCXMVTEST_ERR( err );
+ return err;
}
// -----------------------------------------------------------------------------
@@ -1865,11 +1841,11 @@
VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::OutsideMediaUpdateL <----------");
- return VCXMVTEST_ERR( err );
+ return err;
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::RemoveMediaL
+// CVcxMyVideosApiTest::RemoveMediaL
// -----------------------------------------------------------------------------
//
TInt CVCXMyVideosCollectionPluginTest::RemoveMediaL( CStifItemParser& aItem )
@@ -1907,11 +1883,11 @@
}
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::RemoveMediaL <----------");
- return VCXMVTEST_ERR( err );
+ return err;
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::RemoveAllMediaL
+// CVcxMyVideosApiTest::RemoveAllMediaL
// -----------------------------------------------------------------------------
//
TInt CVCXMyVideosCollectionPluginTest::RemoveAllMediaL( CStifItemParser& aItem )
@@ -1932,102 +1908,6 @@
TInt error( KErrNone );
- TInt mediaCount = iTester->GetMediaCount();
-
- // Store info about the mpx items.
- RArray<TUint> mpxIds;
- CleanupClosePushL( mpxIds );
-
- RArray<TUint> downloadIds;
- CleanupClosePushL( downloadIds );
-
- RArray<TInt> downloadStates;
- CleanupClosePushL( downloadStates );
-
- RPointerArray<HBufC> filePaths;
- CleanupResetAndDestroyPushL( filePaths );
-
- // Get ids and other needed details.
-
- for( TInt i=0; i<mediaCount; i++ )
- {
- CMPXMedia* media( NULL );
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest::RemoveAllMediaL: GetMedia %d", i);
- TRAP( error, media = iTester->GetMediaL( -1, i ) );
-
- if( error != KErrNone )
- {
- CleanupStack::PopAndDestroy( &filePaths );
- CleanupStack::PopAndDestroy( &downloadStates );
- CleanupStack::PopAndDestroy( &downloadIds );
- CleanupStack::PopAndDestroy( &mpxIds );
-
- VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::RemoveAllMediaL <----------");
- return VCXMVTEST_ERR( error );
- }
-
- if( media && media->IsSupported( KMPXMediaGeneralUri ) )
- {
- TUint32 downloadId = 0;
- if( media->IsSupported( KVcxMediaMyVideosDownloadId ) )
- {
- downloadId = media->ValueTObjectL<TUint32>( KVcxMediaMyVideosDownloadId );
- }
-
- TInt state = -1;
- if( media->IsSupported( KVcxMediaMyVideosDownloadState ) )
- {
- state = media->ValueTObjectL<TUint8>( KVcxMediaMyVideosDownloadState );
- }
-
- HBufC* path( NULL );
- if( media->IsSupported( KMPXMediaGeneralUri ) )
- {
- path = media->ValueText( KMPXMediaGeneralUri ).AllocL();
- }
- else
- {
- path = HBufC::NewL( 32 );
- }
-
- TMPXItemId itemId = *(media->Value<TMPXItemId>( KMPXMediaGeneralId ));
-
- filePaths.Append( path );
- downloadIds.Append( downloadId );
- downloadStates.Append( state );
- mpxIds.Append( itemId.iId1 );
- }
- }
-
- // Cancel downloads.
-
- for( TInt i = mpxIds.Count()-1; i >= 0; i-- )
- {
- if( downloadIds[i] != 0 || downloadStates[i] != -1 )
- {
- // Cancel the download.
- RArray<TInt> messages;
- if( BaflUtils::FileExists( iFs, filePaths[i]->Des() ) )
- {
- messages.Append( KVCXMYVideosTestMessageMpxItemDeleted );
- }
- messages.Append( KVCXMYVideosTestMessageCommandComplete );
- messages.Append( KVCXMYVideosTestMessageCollectionOpened );
- TRAP( error, iTester->CancelDownloadL( mpxIds[i], downloadIds[i], filePaths[i]->Des(), EFalse ) );
- if( error == KErrNone )
- {
- TRAP( error, WaitForMessagesL( ETrue, messages, 30, ETrue ) );
- }
- messages.Reset();
- // Error occured, lets hope deleting works.
- if( error != KErrNone )
- {
- downloadIds[i] = 0;
- downloadStates[i] = -1;
- }
- }
- }
-
// Get current list of medias.
CMPXMediaArray* medias( NULL );
@@ -2082,16 +1962,6 @@
iLastReceivedMessage = -1;
- CleanupStack::PopAndDestroy( &filePaths );
- CleanupStack::PopAndDestroy( &downloadStates );
- CleanupStack::PopAndDestroy( &downloadIds );
- CleanupStack::PopAndDestroy( &mpxIds );
-
- if( iTester && iTester->GetDownloadWatcher() )
- {
- iTester->GetDownloadWatcher()->Reset();
- }
-
if( iTester->GetMediaCount() > 0 )
{
VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: All medias could not be removed.");
@@ -2099,11 +1969,11 @@
}
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::RemoveAllMediaL <----------");
- return VCXMVTEST_ERR( error );
+ return error;
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::MoveMediaL
+// CVcxMyVideosApiTest::MoveMediaL
// -----------------------------------------------------------------------------
//
TInt CVCXMyVideosCollectionPluginTest::MoveMediaL( CStifItemParser& aItem )
@@ -2141,7 +2011,7 @@
if( iTester )
{
TRAP( err, iTester->EnsureMediaFilesAreNotInUseL() );
- err = VCXMVTEST_ERR( err );
+ err = err;
if( err == KErrNone )
{
TRAP( err, iTester->MoveMediasL( sourceDrive, index, index+1, destDrive, syncCall ) );
@@ -2152,11 +2022,11 @@
VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::MoveMediaL <----------");
- return VCXMVTEST_ERR( err );
+ return err;
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::MoveMediasL
+// CVcxMyVideosApiTest::MoveMediasL
// -----------------------------------------------------------------------------
//
TInt CVCXMyVideosCollectionPluginTest::MoveMediasL( CStifItemParser& aItem )
@@ -2197,7 +2067,7 @@
if( iTester )
{
TRAP( err, iTester->EnsureMediaFilesAreNotInUseL() );
- err = VCXMVTEST_ERR( err );
+ err = err;
if( err == KErrNone )
{
TRAP( err, iTester->MoveMediasL( sourceDrive, index, endIndex, destDrive, syncCall ) );
@@ -2208,11 +2078,11 @@
VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::MoveMediasL <----------");
- return VCXMVTEST_ERR( err );
+ return err;
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::CancelMoveL
+// CVcxMyVideosApiTest::CancelMoveL
// -----------------------------------------------------------------------------
//
TInt CVCXMyVideosCollectionPluginTest::CancelMoveL( CStifItemParser& aItem )
@@ -2247,11 +2117,11 @@
VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CancelMoveL <----------");
- return VCXMVTEST_ERR( err );
+ return err;
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::CopyMediaL
+// CVcxMyVideosApiTest::CopyMediaL
// -----------------------------------------------------------------------------
//
TInt CVCXMyVideosCollectionPluginTest::CopyMediaL( CStifItemParser& aItem )
@@ -2295,11 +2165,11 @@
VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CopyMediaL <----------");
- return VCXMVTEST_ERR( err );
+ return err;
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::CopyMediasL
+// CVcxMyVideosApiTest::CopyMediasL
// -----------------------------------------------------------------------------
//
TInt CVCXMyVideosCollectionPluginTest::CopyMediasL( CStifItemParser& aItem )
@@ -2346,11 +2216,11 @@
VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CopyMediasL <----------");
- return VCXMVTEST_ERR( err );
+ return err;
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::CancelCopyL
+// CVcxMyVideosApiTest::CancelCopyL
// -----------------------------------------------------------------------------
//
TInt CVCXMyVideosCollectionPluginTest::CancelCopyL( CStifItemParser& aItem )
@@ -2385,11 +2255,11 @@
VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CancelCopyL <----------");
- return VCXMVTEST_ERR( err );
+ return err;
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::DeleteMediaL
+// CVcxMyVideosApiTest::DeleteMediaL
// -----------------------------------------------------------------------------
//
TInt CVCXMyVideosCollectionPluginTest::DeleteMediaL( CStifItemParser& aItem )
@@ -2424,7 +2294,7 @@
if( iTester )
{
TRAP( err, iTester->EnsureMediaFilesAreNotInUseL() );
- err = VCXMVTEST_ERR( err );
+ err = err;
if( err == KErrNone )
{
TRAP( err, iTester->DeleteMediasL( sourceDrive, index, index+1, syncCall ) );
@@ -2435,11 +2305,11 @@
VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DeleteMediaL <----------");
- return VCXMVTEST_ERR( err );
+ return err;
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::DeleteMediasL
+// CVcxMyVideosApiTest::DeleteMediasL
// -----------------------------------------------------------------------------
//
TInt CVCXMyVideosCollectionPluginTest::DeleteMediasL( CStifItemParser& aItem )
@@ -2477,7 +2347,7 @@
if( iTester )
{
TRAP( err, iTester->EnsureMediaFilesAreNotInUseL() );
- err = VCXMVTEST_ERR( err );
+ err = err;
if( err == KErrNone )
{
TRAP( err, iTester->DeleteMediasL( sourceDrive, index, endIndex, syncCall ) );
@@ -2490,11 +2360,11 @@
}
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DeleteMediasL <----------");
- return VCXMVTEST_ERR( err );
+ return err;
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::CancelDeleteL
+// CVcxMyVideosApiTest::CancelDeleteL
// -----------------------------------------------------------------------------
//
TInt CVCXMyVideosCollectionPluginTest::CancelDeleteL( CStifItemParser& aItem )
@@ -2529,11 +2399,11 @@
VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CancelDeleteL <----------");
- return VCXMVTEST_ERR( err );
+ return err;
}
//----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::CancelNextOperationL
+// CVcxMyVideosApiTest::CancelNextOperationL
// -----------------------------------------------------------------------------
//
TInt CVCXMyVideosCollectionPluginTest::CancelNextOperationL( CStifItemParser& /* aItem */ )
@@ -2553,7 +2423,7 @@
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::DeleteFileOfMediaL
+// CVcxMyVideosApiTest::DeleteFileOfMediaL
// -----------------------------------------------------------------------------
//
TInt CVCXMyVideosCollectionPluginTest::DeleteFileOfMediaL( CStifItemParser& aItem )
@@ -2590,11 +2460,11 @@
}
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DeleteFileOfMediaL <----------");
- return VCXMVTEST_ERR( err );
+ return err;
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::DeleteFilesOfAllMediasL
+// CVcxMyVideosApiTest::DeleteFilesOfAllMediasL
// -----------------------------------------------------------------------------
//
TInt CVCXMyVideosCollectionPluginTest::DeleteFilesOfAllMediasL( CStifItemParser& /* aItem */ )
@@ -2613,7 +2483,7 @@
if( iTester )
{
TRAP( err, iTester->EnsureMediaFilesAreNotInUseL() );
- err = VCXMVTEST_ERR( err );
+ err = err;
if( err == KErrNone )
{
TRAP( err, iTester->DeleteAllMediaFilesL() );
@@ -2621,11 +2491,253 @@
}
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DeleteFilesOfAllMediasL <----------");
- return VCXMVTEST_ERR( err );
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVcxMyVideosApiTest::CreateAlbumL
+// -----------------------------------------------------------------------------
+//
+TInt CVCXMyVideosCollectionPluginTest::CreateAlbumL( CStifItemParser& aItem )
+ {
+ VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CreateAlbumL ---------->");
+ // Print to UI
+ _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
+ _LIT( KWhere, "In CreateAlbumL" );
+ TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
+ // Print to log file
+ iLog->Log( KWhere );
+
+ aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
+
+ iLastReceivedMessage = -1;
+
+ TInt err( KErrNotReady );
+ if( iTester )
+ {
+ TPtrC albumName;
+ User::LeaveIfError( aItem.GetNextString( albumName ) );
+
+ TInt sync;
+ if( aItem.GetNextInt( sync ) != KErrNone )
+ {
+ sync = EFalse;
+ }
+
+ if( albumName.Compare( KStifScript2KString ) == KErrNone )
+ {
+ TRAP( err, iTester->CreateAlbumL( KAbout2050CharsString, sync ) );
+ }
+ else if( albumName.Compare( KStifScriptEmptyString ) == KErrNone )
+ {
+ TRAP( err, iTester->CreateAlbumL( KVcxTestEmptyString, sync ) );
+ }
+ else if( albumName.Compare( KStifScriptInvalidRequest ) == KErrNone )
+ {
+ TRAP( err, iTester->CreateAlbumL( KVcxTestEmptyString, sync, ETrue ) );
+ }
+ else
+ {
+ TRAP( err, iTester->CreateAlbumL( albumName, sync ) );
+ }
+ }
+
+ VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CreateAlbumL <----------");
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVcxMyVideosApiTest::DeleteAlbumsL
+// -----------------------------------------------------------------------------
+//
+TInt CVCXMyVideosCollectionPluginTest::DeleteAlbumsL( CStifItemParser& aItem )
+ {
+ VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::DeleteAlbumsL ---------->");
+ // Print to UI
+ _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
+ _LIT( KWhere, "In DeleteAlbumsL" );
+ TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
+ // Print to log file
+ iLog->Log( KWhere );
+
+ aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
+
+ iLastReceivedMessage = -1;
+
+ TInt err( KErrNotReady );
+
+ if( iTester )
+ {
+ TPtrC albumName;
+ RArray<TPtrC> albumNames;
+
+ while( aItem.GetNextString( albumName ) == KErrNone )
+ {
+ albumNames.Append( albumName );
+ }
+
+ if( albumNames.Count() < 1 )
+ {
+ VCXLOGLO1("CVCXMyVideosCollectionPluginTest::DeleteAlbumsL: No albums specified!");
+ err = KErrArgument;
+ }
+ else
+ {
+ TRAP( err, iTester->DeleteAlbumsL( albumNames ) );
+ }
+ }
+
+ VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DeleteAlbumsL <----------");
+ return err;
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::CreateVideoFileL
+// CVcxMyVideosApiTest::DeleteAllAlbumsL
+// -----------------------------------------------------------------------------
+//
+TInt CVCXMyVideosCollectionPluginTest::DeleteAllAlbumsL( CStifItemParser& aItem )
+ {
+ VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::DeleteAllAlbumsL ---------->");
+ // Print to UI
+ _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
+ _LIT( KWhere, "In DeleteAllAlbumsL" );
+ TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
+ // Print to log file
+ iLog->Log( KWhere );
+
+ aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
+
+ iLastReceivedMessage = -1;
+
+ TInt err( KErrNotReady );
+
+ if( iTester )
+ {
+ TRAP( err, iTester->DeleteAllAlbumsL() );
+ }
+
+ VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DeleteAllAlbumsL <----------");
+ return err;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVcxMyVideosApiTest::AddMediasToAlbumL
+// -----------------------------------------------------------------------------
+//
+TInt CVCXMyVideosCollectionPluginTest::AddMediasToAlbumL( CStifItemParser& aItem )
+ {
+ VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::AddMediasToAlbumL ---------->");
+ // Print to UI
+ _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
+ _LIT( KWhere, "In AddMediasToAlbumL" );
+ TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
+ // Print to log file
+ iLog->Log( KWhere );
+
+ aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
+
+ iLastReceivedMessage = -1;
+
+ TInt err( KErrNotReady );
+
+ if( iTester )
+ {
+ TPtrC albumName;
+ User::LeaveIfError( aItem.GetNextString( albumName ) );
+
+ TInt sourceDrive(0);
+ User::LeaveIfError( GetDriveParam( aItem, sourceDrive ) );
+
+ TInt index(0);
+ User::LeaveIfError( aItem.GetNextInt( index ) );
+
+ TInt endIndex(0);
+ User::LeaveIfError( aItem.GetNextInt( endIndex ) );
+
+ TRAP( err, iTester->AddMediasToAlbumL( albumName, sourceDrive, index, endIndex ) );
+ }
+
+ VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::AddMediasToAlbumL <----------");
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVcxMyVideosApiTest::RemoveMediasFromAlbumL
+// -----------------------------------------------------------------------------
+//
+TInt CVCXMyVideosCollectionPluginTest::RemoveMediasFromAlbumL( CStifItemParser& aItem )
+ {
+ VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::RemoveMediasFromAlbumL ---------->");
+ // Print to UI
+ _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
+ _LIT( KWhere, "In RemoveMediasFromAlbumL" );
+ TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
+ // Print to log file
+ iLog->Log( KWhere );
+
+ aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
+
+ iLastReceivedMessage = -1;
+
+ TInt err( KErrNotReady );
+
+ if( iTester )
+ {
+ TPtrC albumName;
+ User::LeaveIfError( aItem.GetNextString( albumName ) );
+
+ TInt sourceDrive(0);
+ User::LeaveIfError( GetDriveParam( aItem, sourceDrive ) );
+
+ TInt index(0);
+ User::LeaveIfError( aItem.GetNextInt( index ) );
+
+ TInt endIndex(0);
+ User::LeaveIfError( aItem.GetNextInt( endIndex ) );
+
+ TRAP( err, iTester->RemoveMediasFromAlbumL( albumName, sourceDrive, index, endIndex ) );
+ }
+
+ VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::RemoveMediasFromAlbumL <----------");
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVcxMyVideosApiTest::CheckAlbumCount
+// -----------------------------------------------------------------------------
+//
+TInt CVCXMyVideosCollectionPluginTest::CheckAlbumCount( CStifItemParser& aItem )
+ {
+ VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CreateAlbumL ---------->");
+ // Print to UI
+ _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
+ _LIT( KWhere, "In CheckAlbumCount" );
+ TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
+ // Print to log file
+ iLog->Log( KWhere );
+
+ aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
+
+ TInt err( KErrNotReady );
+
+ int expectedCount;
+ User::LeaveIfError( aItem.GetNextInt( expectedCount ) );
+
+ if( iTester )
+ {
+ if( !iTester->CheckAlbumCount( expectedCount ) )
+ {
+ err = KErrCorrupt;
+ }
+ }
+
+ VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckAlbumCount <----------");
+ return err;
+ }
+
+// -----------------------------------------------------------------------------
+// CVcxMyVideosApiTest::CreateVideoFileL
// -----------------------------------------------------------------------------
//
TInt CVCXMyVideosCollectionPluginTest::CreateVideoFileL( CStifItemParser& aItem )
@@ -2643,17 +2755,14 @@
TInt temp(0);
// Parameter video type
- CIptvTestVideoCreator::TIptvTestVideoType videoType;
+ CVCXMyVideosTestUtils::TVcxTestVideoType videoType;
User::LeaveIfError( aItem.GetNextInt(temp) );
- videoType = static_cast<CIptvTestVideoCreator::TIptvTestVideoType>(temp);
+ videoType = static_cast<CVCXMyVideosTestUtils::TVcxTestVideoType>(temp);
VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: videoType: %d", videoType);
// Parameter drive letter
TPtrC driveLetter;
User::LeaveIfError(aItem.GetNextString(driveLetter));
-#ifdef __WINSCW__
- driveLetter.Set(_L("C"));
-#endif
// Parameter path and filename
TPtrC filename;
@@ -2680,11 +2789,11 @@
TRAPD( err, CreateVideoFileL( videoType, driveLetter, filename, size, count, ETrue ) );
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CreateVideoFileL <----------");
- return VCXMVTEST_ERR( err );
+ return err;
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::CreateVideoFileNoWaitL
+// CVcxMyVideosApiTest::CreateVideoFileNoWaitL
// -----------------------------------------------------------------------------
//
TInt CVCXMyVideosCollectionPluginTest::CreateVideoFileNoWaitL( CStifItemParser& aItem )
@@ -2702,17 +2811,14 @@
TInt temp(0);
// Parameter video type
- CIptvTestVideoCreator::TIptvTestVideoType videoType;
+ CVCXMyVideosTestUtils::TVcxTestVideoType videoType;
User::LeaveIfError( aItem.GetNextInt(temp) );
- videoType = static_cast<CIptvTestVideoCreator::TIptvTestVideoType>(temp);
+ videoType = static_cast<CVCXMyVideosTestUtils::TVcxTestVideoType>(temp);
VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: videoType: %d", videoType);
// Parameter drive letter
TPtrC driveLetter;
User::LeaveIfError(aItem.GetNextString(driveLetter));
-#ifdef __WINSCW__
- driveLetter.Set(_L("C"));
-#endif
// Parameter path and filename
TPtrC filename;
@@ -2741,14 +2847,14 @@
TRAPD( err, CreateVideoFileL( videoType, driveLetter, filename, size, count, EFalse ) );
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CreateVideoFileNoWaitL ---------->");
- return VCXMVTEST_ERR( err );
+ return err;
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::CreateVideoFileL
+// CVcxMyVideosApiTest::CreateVideoFileL
// -----------------------------------------------------------------------------
//
-void CVCXMyVideosCollectionPluginTest::CreateVideoFileL( CIptvTestVideoCreator::TIptvTestVideoType aType, const TDesC& aDriveLetter, const TDesC& aFileName, TInt aSize, TInt aVideoCount, TBool aDoSync )
+void CVCXMyVideosCollectionPluginTest::CreateVideoFileL( CVCXMyVideosTestUtils::TVcxTestVideoType aType, const TDesC& aDriveLetter, const TDesC& aFileName, TInt aSize, TInt aVideoCount, TBool aDoSync )
{
HBufC* path = HBufC::NewL( 2048 );
CleanupStack::PushL(path);
@@ -2829,24 +2935,19 @@
iSideloadedFiles.Append( path );
// Create the video.
- TRAP( err, iTestCommon->CreateVideoFileL( aType, *path, aSize ) );
+ TRAP( err, iTestUtils->CreateVideoFileL( aType, *path, aSize ) );
if(err != KErrNone)
{
VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: CreateVideoFileL returned error: %d:", err);
}
- TRAP_IGNORE( iStats->ActionStartL( KSideloadVideoActionId, _L("Sideload video") ) );
}
else
{
- TRAP( err, iTestCommon->CreateVideoFilesL( aType, *path, aVideoCount, iSideloadedFiles ) );
+ TRAP( err, iTestUtils->CreateVideoFilesL( aType, *path, aVideoCount, iSideloadedFiles ) );
if(err != KErrNone)
{
VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: CreateVideoFilesL returned error: %d:", err);
}
- for( TInt i = 0; i < aVideoCount; i++ )
- {
- TRAP_IGNORE( iStats->ActionStartL( KSideloadVideoActionId, _L("Sideload video") ) );
- }
CleanupStack::PopAndDestroy( path );
}
@@ -2866,7 +2967,7 @@
RArray<TInt> messages;
for( TInt i=0; i<aVideoCount; i++ )
{
- messages.Append( KVCXMYVideosTestMessageMpxItemInserted );
+ messages.Append( KVCXMYVideosTestMessageMpxVideoInserted );
}
// Only one video added, refresh is automatic.
if( aVideoCount <= 1 )
@@ -2947,7 +3048,7 @@
TInt createCount = amount - videoCount;
TRAP( err, CreateVideoFileL(
- CIptvTestVideoCreator::IptvTestVideoMpeg4, driveLetter, filename, -1, createCount, ETrue ) );
+ CVCXMyVideosTestUtils::VcxTestVideoMpeg4, driveLetter, filename, -1, createCount, ETrue ) );
}
else
if( videoCount > amount )
@@ -2980,7 +3081,7 @@
}
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::EnsureDriveForVideosL <----------");
- return VCXMVTEST_ERR( err );
+ return err;
}
// -----------------------------------------------------------------------------
@@ -3043,7 +3144,7 @@
filesInUse.Remove( i );
// Delete file
- iTestCommon->EnsureFileIsNotInUse( *path );
+ iTestUtils->EnsureFileIsNotInUse( *path );
TInt err = iFs.Delete( path->Des() );
if( err != KErrNone )
{
@@ -3060,7 +3161,7 @@
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::SetDeleteSideloadedVideos
+// CVcxMyVideosApiTest::SetDeleteSideloadedVideos
// -----------------------------------------------------------------------------
//
TInt CVCXMyVideosCollectionPluginTest::SetDeleteSideloadedVideos( CStifItemParser& /* aItem */ )
@@ -3072,601 +3173,7 @@
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::DownloadL
-// -----------------------------------------------------------------------------
-//
-TInt CVCXMyVideosCollectionPluginTest::DownloadL( CStifItemParser& aItem )
- {
- VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::DownloadL ---------->");
- iLastReceivedMessage = -1;
- TRAPD( err, DownloadOrResumeL( aItem, EFalse, EFalse ) );
- VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DownloadL <----------");
- return VCXMVTEST_ERR( err );
- }
-
-// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::ResumeDownloadL
-// -----------------------------------------------------------------------------
-//
-TInt CVCXMyVideosCollectionPluginTest::ResumeDownloadL( CStifItemParser& aItem )
- {
- VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::ResumeDownloadL ---------->");
- iLastReceivedMessage = -1;
- TRAPD( err, DownloadOrResumeL( aItem, EFalse, ETrue ) );
- VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::ResumeDownloadL <----------");
- return VCXMVTEST_ERR( err );
- }
-
-// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::ResumeAllDownloadsL
-// -----------------------------------------------------------------------------
-//
-TInt CVCXMyVideosCollectionPluginTest::ResumeAllDownloadsL( CStifItemParser& /* aItem */ )
- {
- VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::ResumeAllDownloadsL ---------->");
- // Print to UI
- _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
- _LIT( KWhere, "In ResumeAllDownloadsL" );
- TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
- // Print to log file
- iLog->Log( KWhere );
-
- TRAPD( err, iTester->ResumeAllDownloadsL() );
-
- VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::ResumeAllDownloadsL <----------");
- return VCXMVTEST_ERR( err );
- }
-
-// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::DownloadUsingMediaL
-// -----------------------------------------------------------------------------
-//
-TInt CVCXMyVideosCollectionPluginTest::DownloadUsingMediaL( CStifItemParser& aItem )
- {
- VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::DownloadUsingMediaL ---------->");
-
- if( !iMpxMedia )
- {
- VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Error. iMpxMedia not set!");
- User::Leave( KErrArgument );
- }
-
- iLastReceivedMessage = -1;
-
- TRAPD( err, DownloadOrResumeL( aItem, ETrue, EFalse ) );
- VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DownloadUsingMediaL <----------");
- return VCXMVTEST_ERR( err );
- }
-
-// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::ResumeDownloadUsingMediaL
-// -----------------------------------------------------------------------------
-//
-TInt CVCXMyVideosCollectionPluginTest::ResumeDownloadUsingMediaL( CStifItemParser& aItem )
- {
- VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::ResumeDownloadUsingMediaL ---------->");
-
- if( !iMpxMedia )
- {
- VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Error. iMpxMedia not set!");
- User::Leave( KErrArgument );
- }
-
- iLastReceivedMessage = -1;
-
- TRAPD( err, DownloadOrResumeL( aItem, ETrue, ETrue ) );
- VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::ResumeDownloadUsingMediaL <----------");
- return VCXMVTEST_ERR( err );
- }
-
-// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::DownloadOrResumeL
-// -----------------------------------------------------------------------------
-//
-void CVCXMyVideosCollectionPluginTest::DownloadOrResumeL( CStifItemParser& aItem, TBool aUseCurrentMedia, TBool aResume )
- {
- VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::DownloadOrResumeL");
- // Print to UI
- _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
- _LIT( KWhere, "In DownloadOrResumeL" );
- TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
- // Print to log file
- iLog->Log( KWhere );
-
- aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
-
- iLastReceivedMessage = -1;
-
- TUint32 iapId(0);
- TPtrC iapName;
- User::LeaveIfError( aItem.GetNextString( iapName ) );
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: iapName: %S", &iapName);
-
- if( iapName == KVCXTestZeroIap )
- {
- iapId = 0;
- }
- else
- if( iapName == KVCXTestInvalidIap )
- {
- iapId = 10001;
- }
- else
- {
- User::LeaveIfError( iTestCommon->GetIapIdL(iapName, iapId) );
- }
-
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: iapId: %d", iapId);
-
- TPtrC serviceName;
- User::LeaveIfError( aItem.GetNextString( serviceName ) );
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: serviceName: %S", &serviceName);
-
- TInt serviceId(0);
- User::LeaveIfError( iServiceEmu->GetServiceIdL(serviceName, serviceId) );
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: serviceId: %d", serviceId);
-
- TInt contentId(0);
- User::LeaveIfError( aItem.GetNextInt( contentId ) );
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: contentId: %d", contentId);
-
- TInt syncCallInt(0);
- User::LeaveIfError( aItem.GetNextInt( syncCallInt ) );
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: callTypeInt: %d", syncCallInt);
- TBool syncCall = static_cast<TBool>(syncCallInt);
-
- TPtrC userName;
- if( KErrNone == aItem.GetNextString( userName ) )
- {
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: userName: %S", &userName);
- }
- else
- {
- userName.Set( _L("") );
- }
-
- TPtrC password;
- if( KErrNone == aItem.GetNextString( password ) )
- {
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: password: %S", &password);
- }
- else
- {
- password.Set( _L("") );
- }
-
- const TPtrC url = iServiceEmu->GetContentUrlL( serviceId, contentId );
- const TPtrC title = iServiceEmu->GetContentTitleL( serviceId, contentId );
-
- TInt err(0);
- if( !aUseCurrentMedia )
- {
- if( !aResume )
- {
- TRAP( err, iTester->StartDownloadL( title, iapId, serviceId, contentId, url, syncCall, userName, password, NULL ) );
- }
- else
- {
- TRAP( err, iTester->ResumeDownloadL( title, iapId, serviceId, contentId, url, syncCall, userName, password, NULL ) );
- }
- }
- else
- {
- VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: passing current media to MPX plugin.");
- if( !aResume )
- {
- TRAP( err, iTester->StartDownloadL( title, iapId, serviceId, contentId, url, syncCall, userName, password, iMpxMedia ) );
- }
- else
- {
- TRAP( err, iTester->ResumeDownloadL( title, iapId, serviceId, contentId, url, syncCall, userName, password, iMpxMedia ) );
- }
- }
-
- // Set autoresume on if there's only one paused download.
- CVCXMyVideosTestDlWatcher* dlWatcher = iTester->GetDownloadWatcher();
- if( aResume && dlWatcher && !iAutoResume )
- {
- TInt pausedDlCount = 0;
- for( TInt i=0; i<dlWatcher->GetDownloadCount(); i++ )
- {
- CVCXMyVideosTestDownload* dl = dlWatcher->GetDownloadByIndex( i );
- if( dl->iState == EVcxMyVideosDlStatePaused )
- {
- pausedDlCount++;
- }
- }
- if( pausedDlCount == 1 )
- {
- iAutoResume = ETrue;
- iTester->SetAutoResume( ETrue );
- }
- }
-
- if( err != KErrNone )
- {
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
- User::Leave( err );
- }
-
- VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DownloadOrResumeL");
- }
-
-// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::DownloadUrlL
-// -----------------------------------------------------------------------------
-//
-TInt CVCXMyVideosCollectionPluginTest::DownloadUrlL( CStifItemParser& aItem )
- {
- VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::DownloadUrlL ---------->");
- // Print to UI
- _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
- _LIT( KWhere, "In DownloadUrlL" );
- TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
- // Print to log file
- iLog->Log( KWhere );
-
- iLastReceivedMessage = -1;
-
- aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
-
- TUint32 iapId(0);
- TPtrC iapName;
- User::LeaveIfError( aItem.GetNextString( iapName ) );
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: iapName: %S", &iapName);
- User::LeaveIfError( iTestCommon->GetIapIdL(iapName, iapId) );
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: iapId: %d", iapId);
-
- TPtrC url;
- User::LeaveIfError( aItem.GetNextString( url ) );
-
- TInt syncCallInt(0);
- User::LeaveIfError( aItem.GetNextInt( syncCallInt ) );
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: callTypeInt: %d", syncCallInt);
- TBool syncCall = static_cast<TBool>(syncCallInt);
-
- TPtrC userName;
- if( KErrNone == aItem.GetNextString( userName ) )
- {
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: userName: %S", &userName);
- }
- else
- {
- userName.Set( _L("") );
- }
-
- TPtrC password;
- if( KErrNone == aItem.GetNextString( password ) )
- {
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: password: %S", &password);
- }
- else
- {
- password.Set( _L("") );
- }
-
- if( url == KVCXTestZeroUrl)
- {
- url.Set( _L("" ) );
- }
-
- TInt err( KErrNone );
-
- if( iTester )
- {
- if( url == KVCXMYVideosTest2kURLTag )
- {
- TRAP( err, iTester->StartDownloadL( _L("2kcharsurl"), iapId, 0, 0, KVCXMYVideosTest2kURL, syncCall, userName, password, NULL ) );
- }
- else
- if( url == KVCXMYVideosTest1kURLTag )
- {
- TRAP( err, iTester->StartDownloadL( _L("1kcharsurl"), iapId, 0, 0, KVCXMYVideosTest1kURL, syncCall, userName, password, NULL ) );
- }
- else
- {
- TRAP( err, iTester->StartDownloadL( _L("urldl"), iapId, 0, 0, url, syncCall, userName, password, NULL ) );
- }
- }
-
- if( err != KErrNone )
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
-
- VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::DownloadUrlL <----------");
- return VCXMVTEST_ERR( err );
- }
-
-// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::CancelDownloadL
-// -----------------------------------------------------------------------------
-//
-TInt CVCXMyVideosCollectionPluginTest::CancelDownloadL( CStifItemParser& aItem )
- {
- VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CancelDownloadL ---------->");
- // Print to UI
- _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
- _LIT( KWhere, "In CancelDownloadL" );
- TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
- // Print to log file
- iLog->Log( KWhere );
-
- iLastReceivedMessage = -1;
-
- aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
-
- TPtrC serviceName;
- User::LeaveIfError( aItem.GetNextString( serviceName ) );
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: serviceName: %S", &serviceName);
-
- TInt serviceId(0);
- User::LeaveIfError( iServiceEmu->GetServiceIdL(serviceName, serviceId) );
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: serviceId: %d", serviceId);
-
- TInt contentId(0);
- User::LeaveIfError( aItem.GetNextInt( contentId ) );
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: contentId: %d", contentId);
-
- TInt syncCallInt(0);
- User::LeaveIfError( aItem.GetNextInt( syncCallInt ) );
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: callTypeInt: %d", syncCallInt);
- TBool syncCall = static_cast<TBool>(syncCallInt);
-
- const TPtrC url = iServiceEmu->GetContentUrlL( serviceId, contentId );
-
- CVCXMyVideosTestDownload* dl = iTester->GetDownloadWatcher()->GetDownload( serviceId, contentId, url );
-
- TInt err( KErrNotReady );
- if( !dl )
- {
- VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: Could not find download with specified params!");
- }
- else
- if( iTester )
- {
- TRAP( err, iTester->CancelDownloadL( dl, syncCall ) );
- }
-
- if( err != KErrNone )
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
-
- VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CancelDownloadL <----------");
- return VCXMVTEST_ERR( err );
- }
-
-// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::CancelDownloadByIdL
-// -----------------------------------------------------------------------------
-//
-TInt CVCXMyVideosCollectionPluginTest::CancelDownloadByIdL( CStifItemParser& aItem )
- {
- VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CancelDownloadByIdL ---------->");
- // Print to UI
- _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
- _LIT( KWhere, "In CancelDownloadByIdL" );
- TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
- // Print to log file
- iLog->Log( KWhere );
-
- iLastReceivedMessage = -1;
-
- aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
-
- TInt mpxId(0);
- User::LeaveIfError( aItem.GetNextInt( mpxId ) );
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: mpxId: %d", mpxId);
-
- TInt downloadId(0);
- User::LeaveIfError( aItem.GetNextInt( downloadId ) );
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: downloadId: %d", downloadId);
-
- TInt syncCallInt(0);
- User::LeaveIfError( aItem.GetNextInt( syncCallInt ) );
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: callTypeInt: %d", syncCallInt);
- TBool syncCall = static_cast<TBool>(syncCallInt);
-
- _LIT(KVCxTestEmptyString, "NULL");
- TPtrC downloadPath;
- if( aItem.GetNextString( downloadPath ) != KErrNone )
- {
- downloadPath.Set( KVCxTestEmptyString );
- }
-
- TInt err( KErrNotReady );
- if( iTester )
- {
- TRAP( err, iTester->CancelDownloadL( mpxId, downloadId, downloadPath, syncCall ) );
- }
-
- if( err != KErrNone )
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
-
- VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CancelDownloadByIdL <----------");
- return VCXMVTEST_ERR( err );
- }
-
-// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::PauseDownloadL
-// -----------------------------------------------------------------------------
-//
-TInt CVCXMyVideosCollectionPluginTest::PauseDownloadL( CStifItemParser& aItem )
- {
- VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::PauseDownloadL ---------->");
- // Print to UI
- _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
- _LIT( KWhere, "In PauseDownloadL" );
- TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
- // Print to log file
- iLog->Log( KWhere );
-
- iLastReceivedMessage = -1;
-
- aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
-
- TPtrC serviceName;
- User::LeaveIfError( aItem.GetNextString( serviceName ) );
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: serviceName: %S", &serviceName);
-
- TInt serviceId(0);
- User::LeaveIfError( iServiceEmu->GetServiceIdL(serviceName, serviceId) );
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: serviceId: %d", serviceId);
-
- TInt contentId(0);
- User::LeaveIfError( aItem.GetNextInt( contentId ) );
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: contentId: %d", contentId);
-
- TInt syncCallInt(0);
- User::LeaveIfError( aItem.GetNextInt( syncCallInt ) );
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: callTypeInt: %d", syncCallInt);
- TBool syncCall = static_cast<TBool>(syncCallInt);
-
- const TPtrC url = iServiceEmu->GetContentUrlL( serviceId, contentId );
-
- TInt err( KErrNotReady );
- if( iTester )
- {
- // Disable autoresume
- iAutoResume = EFalse;
- iTester->SetAutoResume( iAutoResume );
-
- TRAP( err, iTester->PauseDownloadL( serviceId, contentId, url, syncCall ) );
- }
-
- if( err != KErrNone )
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
-
- VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::PauseDownloadL <----------");
- return VCXMVTEST_ERR( err );
- }
-
-// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::PauseDownloadByUrlL
-// -----------------------------------------------------------------------------
-//
-TInt CVCXMyVideosCollectionPluginTest::PauseDownloadByUrlL( CStifItemParser& aItem )
- {
- VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::PauseDownloadByUrlL ---------->");
- // Print to UI
- _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
- _LIT( KWhere, "In PauseDownloadByUrlL" );
- TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
- // Print to log file
- iLog->Log( KWhere );
-
- iLastReceivedMessage = -1;
-
- aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
-
- TPtrC url;
- User::LeaveIfError( aItem.GetNextString( url ) );
-
- TInt err( KErrNotReady );
- if( iTester )
- {
- // Disable autoresume
- iAutoResume = EFalse;
- iTester->SetAutoResume( iAutoResume );
-
- TRAP( err, iTester->PauseDownloadL( url, EFalse ) );
- }
-
- if( err != KErrNone )
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: err: %d", err);
-
- VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::PauseDownloadL <----------");
- return VCXMVTEST_ERR( err );
- }
-
-// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::CheckDownloadProgressL
-// -----------------------------------------------------------------------------
-//
-TInt CVCXMyVideosCollectionPluginTest::CheckDownloadProgressL( CStifItemParser& aItem )
- {
- VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CheckDownloadProgressL ---------->");
- // Print to UI
- _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
- _LIT( KWhere, "In CheckDownloadProgressL" );
- TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
- // Print to log file
- iLog->Log( KWhere );
-
- iLastReceivedMessage = -1;
-
- aItem.SetParsingType( CStifItemParser::EQuoteStyleParsing );
-
- TPtrC serviceName;
- User::LeaveIfError( aItem.GetNextString( serviceName ) );
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: serviceName: %S", &serviceName);
-
- TInt serviceId(0);
- User::LeaveIfError( iServiceEmu->GetServiceIdL(serviceName, serviceId) );
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: serviceId: %d", serviceId);
-
- TInt contentId(0);
- User::LeaveIfError( aItem.GetNextInt( contentId ) );
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: contentId: %d", contentId);
-
- TInt minimumProgress( 0 );
- User::LeaveIfError( aItem.GetNextInt( minimumProgress ) );
-
- const TPtrC url = iServiceEmu->GetContentUrlL( serviceId, contentId );
-
- CVCXMyVideosTestDlWatcher* dlWatcher = iTester->GetDownloadWatcher();
-
- TInt err( KErrNotReady );
-
- if( dlWatcher )
- {
- CVCXMyVideosTestDownload* dl = dlWatcher->GetDownload( serviceId, contentId, url );
-
- if( dl )
- {
- if( dl->iProgress < minimumProgress )
- {
- err = KErrCorrupt;
- }
- else
- {
- err = KErrNone;
- }
- }
- }
-
- VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::CheckDownloadProgressL <----------");
- return VCXMVTEST_ERR( err );
- }
-
-// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::WaitAllDownloadsL
-// -----------------------------------------------------------------------------
-//
-TInt CVCXMyVideosCollectionPluginTest::WaitAllDownloadsL( CStifItemParser& aItem )
- {
- VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::WaitAllDownloadsL ---------->");
- // Print to UI
- _LIT( KVCXMyVideosCollectionPluginTest, "VCXMyVideosCollectionPluginTest" );
- _LIT( KWhere, "In WaitAllDownloadsL" );
- TestModuleIf().Printf( 0, KVCXMyVideosCollectionPluginTest, KWhere );
- // Print to log file
- iLog->Log( KWhere );
-
- TInt err( KErrNone );
-
- TInt minutes(0);
- if( aItem.GetNextInt( minutes ) != KErrNone )
- {
- minutes = 10;
- }
- iTimeoutTimer->After( KTimeoutMinute * minutes );
-
- iWaitingForAllDownloads = ETrue;
-
- VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::WaitAllDownloadsL <----------");
- return VCXMVTEST_ERR( err );
- }
-
-// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::WaitForMessageL
+// CVcxMyVideosApiTest::WaitForMessageL
// -----------------------------------------------------------------------------
//
TInt CVCXMyVideosCollectionPluginTest::WaitForMessageL( CStifItemParser& aItem )
@@ -3707,11 +3214,11 @@
messages.Reset();
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::WaitForMessageL <----------");
- return VCXMVTEST_ERR( err );
+ return err;
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::WaitForAnyMessageL
+// CVcxMyVideosApiTest::WaitForAnyMessageL
// -----------------------------------------------------------------------------
//
TInt CVCXMyVideosCollectionPluginTest::WaitForAnyMessageL( CStifItemParser& aItem )
@@ -3754,11 +3261,11 @@
messages.Reset();
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::WaitForAnyMessageL <----------");
- return VCXMVTEST_ERR( error );
+ return error;
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::WaitForMessagesL
+// CVcxMyVideosApiTest::WaitForMessagesL
// -----------------------------------------------------------------------------
//
TInt CVCXMyVideosCollectionPluginTest::WaitForMessagesL( CStifItemParser& aItem )
@@ -3801,11 +3308,11 @@
messages.Reset();
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::WaitForMessagesL <----------");
- return VCXMVTEST_ERR( error );
+ return error;
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::WaitForMessagesL
+// CVcxMyVideosApiTest::WaitForMessagesL
// -----------------------------------------------------------------------------
//
void CVCXMyVideosCollectionPluginTest::WaitForMessagesL( TBool aBlock, RArray<TInt>& aMessages, TInt aTimeout,
@@ -3888,7 +3395,7 @@
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::MapMpxMediaAttribute
+// CVcxMyVideosApiTest::MapMpxMediaAttribute
// -----------------------------------------------------------------------------
//
TInt CVCXMyVideosCollectionPluginTest::MapMpxMediaAttribute(
@@ -4153,11 +3660,11 @@
}
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::MapMpxMediaAttribute");
- return VCXMVTEST_ERR( err );
+ return err;
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::GetMessageDesc
+// CVcxMyVideosApiTest::GetMessageDesc
// -----------------------------------------------------------------------------
//
void CVCXMyVideosCollectionPluginTest::GetMessageDesc( TInt aMessage, TDes& aMsgBuff )
@@ -4270,29 +3777,49 @@
aMsgBuff.Copy( _L("KVCXMYVideosTestMessageCollectionGeneral") );
}
break;
- case KVCXMYVideosTestMessageCollectionItemChanged:
+ case KVCXMYVideosTestMessageMpxVideoInserted:
{
- aMsgBuff.Copy( _L("KVCXMYVideosTestMessageCollectionItemChanged") );
+ aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxVideoInserted") );
}
break;
- case KVCXMYVideosTestMessageCollectionCategoryChanged:
+ case KVCXMYVideosTestMessageMpxCategoryInserted:
+ {
+ aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxCategoryInserted") );
+ }
+ break;
+ case KVCXMYVideosTestMessageMpxAlbumInserted:
{
- aMsgBuff.Copy( _L("KVCXMYVideosTestMessageCollectionCategoryChanged") );
+ aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxAlbumInserted") );
+ }
+ break;
+ case KVCXMYVideosTestMessageMpxVideoDeleted:
+ {
+ aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxVideoDeleted") );
}
break;
- case KVCXMYVideosTestMessageMpxItemInserted:
+ case KVCXMYVideosTestMessageMpxCategoryDeleted:
{
- aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxItemInserted") );
+ aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxCategoryDeleted") );
+ }
+ break;
+ case KVCXMYVideosTestMessageMpxAlbumDeleted:
+ {
+ aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxAlbumDeleted") );
}
break;
- case KVCXMYVideosTestMessageMpxItemDeleted:
+ case KVCXMYVideosTestMessageMpxVideoModified:
{
- aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxItemDeleted") );
+ aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxVideoModified") );
}
break;
- case KVCXMYVideosTestMessageMpxItemModified:
+ case KVCXMYVideosTestMessageMpxCategoryModified:
{
- aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxItemModified") );
+ aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxCategoryModified") );
+ }
+ break;
+ case KVCXMYVideosTestMessageMpxAlbumModified:
+ {
+ aMsgBuff.Copy( _L("KVCXMYVideosTestMessageMpxAlbumModified") );
}
break;
case KVCXMyVideosTestMessageVideoListOrderChanged:
@@ -4321,13 +3848,15 @@
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::CheckMediasL
+// CVcxMyVideosApiTest::CheckMediasL
// -----------------------------------------------------------------------------
//
void CVCXMyVideosCollectionPluginTest::CheckMediasL( TInt aExpectedVideoCount, TInt aDrive, TInt aCheckType )
{
VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTest::CheckMediasL");
+ WaitForRefreshL( false );
+
TInt actualVideoCount(0);
// File check
@@ -4359,20 +3888,7 @@
actualVideoCount++;
- TInt state = -1;
- if( media->IsSupported( KVcxMediaMyVideosDownloadState ) )
- {
- state = media->ValueTObjectL<TUint8>( KVcxMediaMyVideosDownloadState );
- }
-
- TUint32 downloadId = 0;
- if( media->IsSupported( KVcxMediaMyVideosDownloadId ) )
- {
- downloadId = media->ValueTObjectL<TUint32>( KVcxMediaMyVideosDownloadId );
- }
-
- // No file check for ongoing downloads
- if( !iFileCheckDisabled && ( downloadId == 0 || state == EVcxMyVideosDlStateDownloaded ) )
+ if( !iFileCheckDisabled )
{
if( !iFs.IsValidName( localFilePath ) )
{
@@ -4449,7 +3965,7 @@
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::GetDriveParam
+// CVcxMyVideosApiTest::GetDriveParam
// -----------------------------------------------------------------------------
//
TInt CVCXMyVideosCollectionPluginTest::GetDriveParam( CStifItemParser& aItem, TInt& aDrive )
@@ -4471,11 +3987,11 @@
}
}
- return VCXMVTEST_ERR( err );
+ return err;
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::DoTotalRefreshL
+// CVcxMyVideosApiTest::DoTotalRefreshL
// -----------------------------------------------------------------------------
//
void CVCXMyVideosCollectionPluginTest::DoTotalRefreshL()
@@ -4511,7 +4027,7 @@
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::WaitForRefreshL
+// CVcxMyVideosApiTest::WaitForRefreshL
// -----------------------------------------------------------------------------
//
void CVCXMyVideosCollectionPluginTest::WaitForRefreshL( TBool aForcedWait )
@@ -4527,7 +4043,7 @@
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::GetMediasForLevelL
+// CVcxMyVideosApiTest::GetMediasForLevelL
// -----------------------------------------------------------------------------
//
CMPXMediaArray* CVCXMyVideosCollectionPluginTest::GetMediasForLevelL( TInt aLevel, TUint aFlagsFilter )
@@ -4634,7 +4150,7 @@
}
// -----------------------------------------------------------------------------
-// CIptvMyVideosApiTest::HandleVcxMvTesterMessageL
+// CVcxMyVideosApiTest::HandleVcxMvTesterMessageL
// -----------------------------------------------------------------------------
//
void CVCXMyVideosCollectionPluginTest::HandleVcxMvTesterMessageL( TInt aMessage, TInt aError )
@@ -4663,13 +4179,17 @@
aMessage == KVCXMYVideosTestMessageCollectionOpened ||
aMessage == KVCXMYVideosTestMessageGotMediasByKMpxId )
{
- _LIT(KWhat, "VidCount");
- _LIT(KDesc, "%d");
TInt videoCount = iTester->GetMediaCount();
- TestModuleIf().Printf( 0, KWhat, KDesc, videoCount );
+ if( iTester->GetCurrentOpenLevelIndex() == -1 )
+ {
+ TestModuleIf().Printf( 0, _L("Mv"), _L("CatCount %d"), videoCount );
+ }
+ else
+ {
+ TestModuleIf().Printf( 0, _L("Mv"), _L("VidCount %d"), videoCount );
+ }
}
-
// Waiting for messages from mpx plugin to stop.
if( iCoolDownWait )
{
@@ -4678,78 +4198,6 @@
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTest::HandleVcxMvTesterMessageL");
return;
}
-
- if( aMessage == KVCXMYVideosTestMessageDlSucceeded ||
- aMessage == KVCXMYVideosTestMessageDlFailed ||
- aMessage == KVCXMYVideosTestMessageDlPaused ||
- aMessage == KVCXMYVideosTestMessageDlGeneral ||
- aMessage == KVCXMYVideosTestErrorDownloadNotFound )
- {
- TInt activeDownloads = iTester->GetActiveDownloadCountL();
- TInt downloads = iTester->GetDownloadWatcher()->GetDownloadCount();
- _LIT(KWhat, "Downloads");
- _LIT(KDesc, "%d/%d");
- TestModuleIf().Printf( 0, KWhat, KDesc, activeDownloads, downloads );
-
- if( aError != KErrNone )
- {
- iLastDownloadError = aError;
- }
- }
-
- // Inform script of paused download when auto resume is off.
- if( !iWaitingForAllDownloads && aMessage == KVCXMYVideosTestMessageDlPaused && !iAutoResume )
- {
- // Add message to waited list and continue processing, check for signaling is done later.
- iWaitedTestMessages.Reset();
- iWaitedTestMessages.AppendL( aMessage );
- }
-
- // Waiting for all downloads to complete. Check downloads and signal if needed.
- if( iWaitingForAllDownloads )
- {
- TInt activeDownloads = iTester->GetActiveDownloadCountL();
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: Ongoing download count: %d", activeDownloads);
-
- if( activeDownloads <= 0 )
- {
- iTimeoutTimer->CancelTimer();
- iWaitingForAllDownloads = EFalse;
-
- TInt downloadCount = iTester->GetDownloadWatcher()->GetDownloadCount();
- TInt maxFailsToSucceed = downloadCount / 3;
- TInt fails = iTester->GetDownloadWatcher()->GetFailedDownloadCount();
-
- if( maxFailsToSucceed <= 0 )
- {
- maxFailsToSucceed = 0;
- }
-
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: download count: %d", downloadCount);
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: failed download count: %d", fails);
- VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: max allowed fails: %d", maxFailsToSucceed);
-
- if( fails > maxFailsToSucceed )
- {
- if( iLastDownloadError != KErrNone )
- {
- iEventError = iLastDownloadError;
- }
- else
- {
- iEventError = KVCXMYVideosTestMessageDlFailed;
- }
- }
- else
- {
- iEventError = KErrNone;
- }
-
- // Add message to waited list and continue processing, check for signaling is done later.
- iWaitedTestMessages.Reset();
- iWaitedTestMessages.AppendL( aMessage );
- }
- }
// See if there's cancel needed for move, copy or delete.
if( aError == KErrNone && iCancelNextOperation )
@@ -4767,7 +4215,7 @@
}
// Check for errors.
- if( aError != KErrNone && !iWaitingForAllDownloads )
+ if( aError != KErrNone )
{
VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
VCXLOGLO2("CVCXMyVideosCollectionPluginTest:: ----------> MsgQueue: Error: %d <----------", aError);
@@ -4777,7 +4225,7 @@
if( !iMessageWaitIsBlocking )
{
VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: ----------> MsgQueue: Signaling <----------");
- Signal( VCXMVTEST_ERR( aError ) );
+ Signal( aError );
TestModuleIf().Printf( 0, _L("Signal"), _L("%d"), aError );
iEventError = KErrNone;
}
@@ -4846,7 +4294,7 @@
if( !iMessageWaitIsBlocking )
{
VCXLOGLO1("CVCXMyVideosCollectionPluginTest:: ----------> MsgQueue: Signaling <----------");
- Signal( VCXMVTEST_ERR( iEventError ) );
+ Signal( iEventError );
TestModuleIf().Printf( 0, _L("Signal"), _L("%d"), iEventError );
iEventError = KErrNone;
}
@@ -4867,7 +4315,7 @@
}
// -----------------------------------------------------------------------------
-// CIptvEpgEngineTest::TimerComplete
+// CVcxEpgEngineTest::TimerComplete
// -----------------------------------------------------------------------------
//
void CVCXMyVideosCollectionPluginTest::TimerComplete(TInt aTimerId, TInt aError)
@@ -4888,11 +4336,8 @@
if( !iMessageWaitIsBlocking )
{
VCXLOGLO2( "CVCXMyVideosCollectionPluginTest:: Signaling: %d", iEventError);
- Signal( VCXMVTEST_ERR( iEventError ) );
+ Signal( iEventError );
}
-
- TRAP_IGNORE( iStats->ActionEndL( 0, iEventError ) );
-
TestModuleIf().Printf( 0, _L("Timedout"), _L("%d"), iEventError );
}
}
@@ -4903,7 +4348,6 @@
iActiveWait->Stop();
iCoolDownWait = EFalse;
- iWaitingForAllDownloads = EFalse;
iWaitedTestMessages.Reset();
iLastReceivedMessage = 0;
}
--- a/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/src/VCXMyVideosCollectionPluginTester.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/src/VCXMyVideosCollectionPluginTester.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -11,10 +11,9 @@
*
* Contributors:
*
-* Description: ?Description*
+* Description:
*/
-
// INCLUDE FILES
#include <e32svr.h>
#include <e32std.h>
@@ -37,14 +36,12 @@
#include <mpxcommandgeneraldefs.h>
#include <mpxcollectioncommanddefs.h>
-#include "VCXTestCommon.h"
+#include "VCXMyVideosTestUtils.h"
#include "VCXTestLog.h"
-#include "CIptvTestTimer.h"
-#include "CIptvTestActiveWait.h"
-#include "VCXTestStatsKeeper.h"
+#include "CVcxTestActiveWait.h"
#include "VCXMyVideosCollectionPluginTester.h"
-#include "VCXMyVideosTestDlWatcher.h"
+#include "VCXMyVideosTestUtils.h"
#include "VCXMyVideosTestCommon.h"
#include "vcxmyvideoscollection.hrh"
@@ -61,11 +58,11 @@
// -----------------------------------------------------------------------------
//
CVCXMyVideosCollectionPluginTester* CVCXMyVideosCollectionPluginTester::NewL(
- MVCXMyVideosCollectionPluginTesterObserver* aObserver, CVCXTestCommon* aTestCommon, CVCXTestStatsKeeper* aStatsKeeper )
+ MVCXMyVideosCollectionPluginTesterObserver* aObserver, CVCXMyVideosTestUtils* aTestUtils )
{
VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTester::NewL");
CVCXMyVideosCollectionPluginTester* self =
- new (ELeave) CVCXMyVideosCollectionPluginTester( aObserver, aTestCommon, aStatsKeeper );
+ new (ELeave) CVCXMyVideosCollectionPluginTester( aObserver, aTestUtils );
CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop(self);
@@ -79,8 +76,12 @@
//
CVCXMyVideosCollectionPluginTester::CVCXMyVideosCollectionPluginTester(
MVCXMyVideosCollectionPluginTesterObserver* aObserver,
- CVCXTestCommon* aTestCommon, CVCXTestStatsKeeper* aStatsKeeper )
- : iObserver( aObserver ), iTestCommon( aTestCommon ), iStats( aStatsKeeper )
+ CVCXMyVideosTestUtils* aTestUtils ) :
+iObserver( aObserver ),
+iTestUtils( aTestUtils ),
+iCurrentLevelName( NULL ),
+iAutomaticContentRefresh( ETrue),
+iCurrentOpenedLevelIndex( -1 )
{
}
@@ -93,16 +94,6 @@
{
VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTester::~CVCXMyVideosCollectionPluginTester");
- if( iProgressTimer )
- {
- iProgressTimer->CancelTimer();
- delete iProgressTimer;
- iProgressTimer = NULL;
- }
-
- delete iDlWatcher;
- iDlWatcher = NULL;
-
if( iCollectionUtility )
{
iCollectionUtility->Close();
@@ -121,11 +112,19 @@
if( iMediaArray )
{
+ PrintMediasL( iMediaArray, EFalse, _L("Items") );
iMediaArray->Reset();
delete iMediaArray;
iMediaArray = NULL;
}
+ if( iMediaArrayCopy )
+ {
+ iMediaArrayCopy->Reset();
+ delete iMediaArrayCopy;
+ iMediaArrayCopy = NULL;
+ }
+
iFs.Close();
if( iActiveWait )
@@ -153,6 +152,9 @@
delete iTransactions;
iTransactions = NULL;
+ iAlbumNames.ResetAndDestroy();
+ iAlbumNames.Close();
+
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTester::~CVCXMyVideosCollectionPluginTester");
}
@@ -163,18 +165,13 @@
void CVCXMyVideosCollectionPluginTester::ConstructL()
{
VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTester::ConstructL");
- iAutomaticContentRefresh = ETrue;
-
- iActiveWait = CIptvTestActiveWait::NewL();
+
+
+ iActiveWait = CVcxTestActiveWait::NewL();
User::LeaveIfError( iFs.Connect() );
iTransactions = CVCXMyVideosTestTransactions::NewL();
iCollectionUtility = MMPXCollectionUtility::NewL( this, KMcModeIsolated );
- iDlWatcher = CVCXMyVideosTestDlWatcher::NewL( iObserver, iStats );
- iUpdateDownloads = ETrue;
- iCurrentOpenedLevelIndex = -1;
- iProgressTimer = CIptvTestTimer::NewL( *this, 0 );
- iProgressTimer->After( 1000000 );
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTester::ConstructL");
}
@@ -192,12 +189,12 @@
iCollectionUid = TUid::Uid( aCollectionUid );
path->AppendL( aCollectionUid );
- TRAP_IGNORE( iStats->ActionStartL( KOpenCollectionActionId, _L("Open collection") ) );
- iCurrentActionHasResponse = EFalse;
- iCurrentActionId = KOpenCollectionActionId;
SetRefreshStatus( ETrue );
+ VCXLOGLO2("CVCXMyVideosCollectionPluginTester::OpenCollectionL: collectionId: 0x%x", aCollectionUid);
+
iCollectionUtility->Collection().OpenL( *path );
+ iCurrentOpenedLevelIndex = -1;
CleanupStack::PopAndDestroy( path );
@@ -208,6 +205,60 @@
// CVCXMyVideosCollectionPluginTester::OpenLevelL
// -----------------------------------------------------------------------------
//
+void CVCXMyVideosCollectionPluginTester::OpenLevelL( const TDesC& aLevelName )
+ {
+ VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTester::OpenLevelL (by name)");
+
+ if( GetCurrentLevel() != 2 )
+ {
+ VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: Error. My videos collection must be open!");
+ User::Leave( KErrGeneral );
+ }
+
+ CMPXMedia* media;
+
+ int levelIndex(-1);
+
+ // From last to first
+ for( TInt i = iMediaArray->Count()-1; i >= 0; i-- )
+ {
+ media = (*iMediaArray)[i];
+
+ if( media->IsSupported( KMPXMediaGeneralTitle ) )
+ {
+ if( media->ValueText( KMPXMediaGeneralTitle ).Compare( aLevelName ) == KErrNone )
+ {
+ TMPXItemId itemId = *(media->Value<TMPXItemId>( KMPXMediaGeneralId ));
+ VCXLOGLO3("CVCXMyVideosCollectionPluginTester::OpenLevelL: mpx id1: %d, id2: %d", itemId.iId1, itemId.iId2);
+
+ levelIndex = i;
+ delete iCurrentLevelName;
+ iCurrentLevelName = NULL;
+ iCurrentLevelName = media->ValueText( KMPXMediaGeneralTitle ).AllocL();
+ break;
+ }
+ }
+ }
+
+ if( levelIndex == -1 )
+ {
+ VCXLOGLO1("CVCXMyVideosCollectionPluginTester:::OpenLevelL: Couldn't find the level!");
+ User::Leave( KErrNotFound );
+ }
+
+ // Open the level
+ iCollectionUtility->Collection().OpenL( levelIndex );
+
+ iCurrentOpenedLevelIndex = levelIndex;
+ SetRefreshStatus( ETrue );
+
+ VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTester:::OpenLevelL (by name)");
+ }
+
+// -----------------------------------------------------------------------------
+// CVCXMyVideosCollectionPluginTester::OpenLevelL
+// -----------------------------------------------------------------------------
+//
void CVCXMyVideosCollectionPluginTester::OpenLevelL( TInt aIndex )
{
VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTester::OpenLevelL");
@@ -218,29 +269,24 @@
User::Leave( KErrGeneral );
}
- if( aIndex < 0 || aIndex > iMediaArray->Count() )
+ if( aIndex >= 0 || aIndex < iMediaArray->Count() )
{
- VCXLOGLO2("CVCXMyVideosCollectionPluginTester:: Error. Index (%d) out of bounds!", aIndex);
- User::Leave( KErrGeneral );
+ CMPXMedia* media(NULL);
+ media = (*iMediaArray)[aIndex];
+
+ if( media->IsSupported( KMPXMediaGeneralTitle ) )
+ {
+ delete iCurrentLevelName;
+ iCurrentLevelName = NULL;
+ iCurrentLevelName = media->ValueText( KMPXMediaGeneralTitle ).AllocL();
+ }
}
-
- // Save the name of level
-
- CMPXMedia* media(NULL);
- media = (*iMediaArray)[aIndex];
-
- if( media->IsSupported( KMPXMediaGeneralTitle ) )
+ else
{
- delete iCurrentLevelName;
- iCurrentLevelName = NULL;
- iCurrentLevelName = media->ValueText( KMPXMediaGeneralTitle ).AllocL();
+ VCXLOGLO1("CVCXMyVideosCollectionPluginTester::OpenLevelL: level index is invalid. Opening..");
}
// Open the level
- TRAP_IGNORE( iStats->ActionStartL( KOpenCollectionLevelActionId, _L("Open level") ) );
- iCurrentActionHasResponse = EFalse;
- iCurrentActionId = KOpenCollectionLevelActionId;
-
iCollectionUtility->Collection().OpenL( aIndex );
iCurrentOpenedLevelIndex = aIndex;
@@ -257,12 +303,14 @@
{
//VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTester::RefreshContentsL");
+#if 0
// No need to refresh if My Videos category is not open.
if( GetCurrentLevel() != 3)
{
VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: No refresh because level.");
return;
}
+#endif
// Wait previous refresh to complete.
if( IsRefreshing() )
@@ -275,9 +323,6 @@
VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: Refreshing video list ----->");
VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: ----------------------------");
- TRAP_IGNORE( iStats->ActionStartL( KRefreshCollectionActionId, _L("Refreshing collection") ) );
- iCurrentActionHasResponse = EFalse;
- iCurrentActionId = KRefreshCollectionActionId;
iCollectionUtility->Collection().OpenL();
SetRefreshStatus( ETrue );
@@ -319,10 +364,7 @@
cmd->SetTObjectValueL( KMPXMediaArrayCount, requestedMediaObjects->Count() );
}
- VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: Doing request.");
iActionCount++;
- TRAP_IGNORE( iStats->ActionStartL( iTransactions->TransactionId(), _L("Get medias by MPX ID") ) );
- iCurrentActionHasResponse = ETrue;
iCollectionUtility->Collection().CommandL( *cmd );
SetRefreshStatus( ETrue );
@@ -356,8 +398,7 @@
CleanupStack::PushL( path );
VCXLOGLO2("CVCXMyVideosCollectionPluginTester:: Selecting %d", realIndex);
path->SelectL( realIndex );
- TRAP_IGNORE( iStats->ActionStartL( KGetMediaFullDetailsActionId, _L("Get media full details") ) );
- iCurrentActionHasResponse = EFalse;
+
iCollectionUtility->Collection().MediaL( *path, attrs.Array() );
CleanupStack::PopAndDestroy( path );
CleanupStack::PopAndDestroy( &attrs );
@@ -387,11 +428,8 @@
cmd = CreateMpxCommandLC( KVcxCommandIdMyVideos, KVcxCommandMyVideosGetMediaFullDetailsByMpxId, aSync );
cmd->SetTObjectValueL( KMPXMediaGeneralId, itemId );
- TRAP_IGNORE( iStats->ActionStartL( KGetMediaFullDetailsActionId, _L("Get media full details by MPX ID") ) );
iCollectionUtility->Collection().CommandL( *cmd );
- iCurrentActionHasResponse = EFalse;
-
CleanupStack::PopAndDestroy( cmd );
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTester::GetMediaFullDetailsByMpxIdL");
@@ -443,12 +481,8 @@
PrintMediasL( iMediaArray, ETrue, *iCurrentLevelName );
}
}
-
- // Update download states and info
- if( GetCurrentLevel() == 3 && iUpdateDownloads && iDownloadsStarted )
- {
- UpdateDownloadsL( iQuietMode );
- }
+
+ UpdateAlbumsListL();
}
else
{
@@ -460,643 +494,7 @@
}
// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::UpdateDownloadsL
-// -----------------------------------------------------------------------------
-//
-void CVCXMyVideosCollectionPluginTester::UpdateDownloadsL( TBool aQuietMode )
- {
- if( !iMediaArray || !iDlWatcher )
- {
- return;
- }
-
- if( !aQuietMode )
- VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTester::UpdateDownloadsL ---------->");
-
- iDlWatcher->PrepareCheck();
-
- // Print short info about downloads
- CMPXMedia* media( NULL );
-
- for( TInt i = 0; i < iMediaArray->Count(); i++ )
- {
- media = (*iMediaArray)[i];
-
- // If it's download then get info about it and update download watcher.
- if( media->IsSupported( KVcxMediaMyVideosDownloadState ) )
- {
- TInt state = media->ValueTObjectL<TUint8>( KVcxMediaMyVideosDownloadState );
-
- TMPXItemId itemId = *(media->Value<TMPXItemId>( KMPXMediaGeneralId ));
-
- HBufC* titleBuff = NULL;
- HBufC* urlBuff = NULL;
- HBufC* pathBuff = NULL;
-
- if( media->IsSupported( KMPXMediaGeneralUri ) )
- {
- const TDesC& url = media->ValueText( KMPXMediaGeneralUri );
- pathBuff = url.AllocL();
- CleanupStack::PushL( pathBuff );
- }
-
- if( media->IsSupported( KMPXMediaGeneralTitle ) )
- {
- const TDesC& title = media->ValueText( KMPXMediaGeneralTitle );
- titleBuff = title.AllocL();
- CleanupStack::PushL( titleBuff );
- }
-
- if( media->IsSupported( KVcxMediaMyVideosRemoteUrl ) )
- {
- const TDesC& url = media->ValueText( KVcxMediaMyVideosRemoteUrl );
- urlBuff = url.AllocL();
- CleanupStack::PushL( urlBuff );
- }
-
- TInt progress = 0;
- if( media->IsSupported( KVcxMediaMyVideosDownloadProgress ) )
- {
- progress = media->ValueTObjectL<TInt8>( KVcxMediaMyVideosDownloadProgress );
- }
-
- TUint32 downloadId = 0;
- if( media->IsSupported( KVcxMediaMyVideosDownloadId ) )
- {
- downloadId = media->ValueTObjectL<TUint32>( KVcxMediaMyVideosDownloadId );
- }
-
- TInt downloadError = 0;
- if( media->IsSupported( KVcxMediaMyVideosDownloadError ) )
- {
- downloadError = media->ValueTObjectL<TInt32>( KVcxMediaMyVideosDownloadError );
- }
-
- TInt globalError = 0;
- if( media->IsSupported( KVcxMediaMyVideosDownloadGlobalError ) )
- {
- globalError = media->ValueTObjectL<TInt32>( KVcxMediaMyVideosDownloadGlobalError );
- }
-
- CVCXMyVideosTestDownload* dl = iDlWatcher->GetDownloadByMpxId( itemId.iId1 );
-
- if( !dl )
- {
- // Tell dl watcher that dl has started.
- if( state != EVcxMyVideosDlStateNone )
- {
- iDlWatcher->StartDownloadL( *urlBuff, *pathBuff, downloadId, itemId.iId1, *titleBuff,
- static_cast<TVcxMyVideosDownloadState>( state ), progress );
- }
- }
- else
- {
- // Update download.
- iDlWatcher->UpdateDownloadStateL( itemId.iId1, downloadId,
- static_cast<TVcxMyVideosDownloadState>( state ), progress,
- downloadError, globalError );
-
- }
-
- if( state == EVcxMyVideosDlStatePaused && iAutoResume )
- {
- if( dl && !dl->iWaitingResume )
- {
- VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: <---------- Autoresuming the paused download. ---------->");
- ResumeDownloadL( _L("resume"), dl->iIapId, dl->iServiceId, dl->iContentId, *dl->iUrl, dl->iSyncCall, *dl->iUserName, *dl->iPassword, NULL );
- iDlWatcher->SetDownloadResumedFlagL( itemId.iId1, downloadId );
- dl->iWaitingPause = EFalse;
- VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: <---------- Resume ok ---------->");
- }
- }
-
- if( urlBuff )
- {
- CleanupStack::PopAndDestroy( urlBuff );
- }
- if( titleBuff )
- {
- CleanupStack::PopAndDestroy( titleBuff );
- }
- if( pathBuff )
- {
- CleanupStack::PopAndDestroy( pathBuff );
- }
- }
- }
-
- if( !aQuietMode )
- {
- iDlWatcher->PrintDownloads();
- }
-
- iDlWatcher->FinishCheckL();
- if( !aQuietMode )
- VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTester::UpdateDownloadsL <----------");
- }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::CreateMpxCommandLC
-// -----------------------------------------------------------------------------
-//
-CMPXCommand* CVCXMyVideosCollectionPluginTester::CreateMpxCommandLC( TInt aCommandGeneralId, TInt aMyVideosCommandId, TBool aSync )
- {
- CMPXCommand* cmd = CMPXCommand::NewL();
- CleanupStack::PushL( cmd );
-
- cmd->SetTObjectValueL( KMPXCommandGeneralId, aCommandGeneralId );
- if( aCommandGeneralId == KVcxCommandIdMyVideos )
- {
- cmd->SetTObjectValueL( KVcxMediaMyVideosCommandId, aMyVideosCommandId );
- }
-
- cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, aSync );
-
- if( !aSync )
- {
- // Transaction id is used also tracking stats, so increment for every command.
- iTransactions->NextTransactionId();
-
- if( aCommandGeneralId == KVcxCommandIdMyVideos )
- {
- cmd->SetTObjectValueL( KVcxMediaMyVideosTransactionId, iTransactions->TransactionId() );
- iTransactions->AddTransactionId( aMyVideosCommandId );
- }
- }
-
- cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId, iCollectionUid.iUid );
-
- return cmd;
- }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::SelectMediasL
-// -----------------------------------------------------------------------------
-//
-CMPXMediaArray* CVCXMyVideosCollectionPluginTester::SelectMediasL( TInt aDriveFilter, TInt aStartIndex, TInt aEndIndex )
- {
- if( aStartIndex == -4 )
- {
- VCXLOGLO1("CVCXMyVideosCollectionPluginTester::SelectMediasL - returning NULL");
- return NULL;
- }
-
- VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTester::SelectMediasL");
- VCXLOGLO2("CVCXMyVideosCollectionPluginTester::SelectMediasL: aStartIndex: %d", aStartIndex);
-
- if( !iMediaArray )
- {
- User::Leave( KErrNotReady );
- }
-
- iRequestedMediaIds.Reset();
-
- CMPXMediaArray* medias = CMPXMediaArray::NewL();
-
- // None
- if( aStartIndex > aEndIndex )
- {
- VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: Selected none of the videos.");
- VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTester::SelectMediasL");
- return medias;
- }
-
- CleanupStack::PushL( medias );
-
- if( aStartIndex >= 0 )
- {
- if( aEndIndex > iMediaArray->Count() )
- {
- VCXLOGLO2("CVCXMyVideosCollectionPluginTester::SelectMediasL end index: %d is out of bounds.", aEndIndex);
- User::Leave( KErrArgument );
- }
-
- TInt countToSelect = aEndIndex - aStartIndex;
- TInt indexOfVideoOnDrive = 0;
-
- for( TInt i = 0; i < iMediaArray->Count(); i++ )
- {
- CMPXMedia* media = (*iMediaArray)[i];
-
- if( media )
- {
- TBool selectThis( EFalse );
-
- if( aDriveFilter != -1 )
- {
- // Drive specified, check path and index of video on the drive.
- const TDesC& localFilePath = media->ValueText( KMPXMediaGeneralUri );
- TInt drive( 0 );
- User::LeaveIfError( iFs.CharToDrive( localFilePath[0], drive ) );
-
- if( drive == aDriveFilter )
- {
- if( indexOfVideoOnDrive >= aStartIndex && indexOfVideoOnDrive < aEndIndex )
- {
- selectThis = ETrue;
- }
- indexOfVideoOnDrive++;
- }
- }
- else
- {
- // No drive specified, just index check.
- if( i >= aStartIndex && i < aEndIndex )
- {
- selectThis = ETrue;
- }
- }
-
- if( selectThis )
- {
- TMPXItemId mpxId = *(*media).Value<TMPXItemId>( KMPXMediaGeneralId );
- VCXLOGLO2("CVCXMyVideosCollectionPluginTester:: Selected media. MPX ID: %d", mpxId.iId1);
- iRequestedMediaIds.Append( mpxId.iId1 );
- CMPXMedia* newMedia = CMPXMedia::NewL();
- CleanupStack::PushL( newMedia );
- newMedia->SetTObjectValueL( KMPXMessageMediaGeneralId, mpxId );
- newMedia->SetTObjectValueL( KMPXMediaGeneralId, mpxId );
- medias->AppendL( *newMedia );
- CleanupStack::PopAndDestroy( newMedia );
-
- if( medias->Count() >= countToSelect )
- {
- break;
- }
- }
- }
- }
- }
-
- // Invalid IDs
- if( aStartIndex == -1 )
- {
- for( TInt i = 0; i < aEndIndex; i++ )
- {
- TMPXItemId mpxId;
- mpxId.iId1 = i+66666;
- mpxId.iId2 = 0;
-
- VCXLOGLO2("CVCXMyVideosCollectionPluginTester:: Selected media. Invalid MPX ID: %d", mpxId.iId1);
-
- CMPXMedia* newMedia = CMPXMedia::NewL();
- CleanupStack::PushL( newMedia );
- newMedia->SetTObjectValueL( KMPXMessageMediaGeneralId, mpxId );
- newMedia->SetTObjectValueL( KMPXMediaGeneralId, mpxId );
- medias->AppendL( *newMedia );
- CleanupStack::PopAndDestroy( newMedia );
- }
- }
-
- // Duplicate IDs
- if( aStartIndex == -2 )
- {
- if( aEndIndex > iMediaArray->Count() )
- {
- VCXLOGLO2("CVCXMyVideosCollectionPluginTester::SelectMediasL end index: %d is out of bounds.", aEndIndex);
- User::Leave( KErrArgument );
- }
-
- for( TInt i = 0; i < aEndIndex; i++ )
- {
- CMPXMedia* media = (*iMediaArray)[i];
-
- if( media )
- {
- TMPXItemId mpxId = *(*media).Value<TMPXItemId>( KMPXMediaGeneralId );
-
- VCXLOGLO2("CVCXMyVideosCollectionPluginTester:: Selected media. Add twice MPX ID: %d", mpxId.iId1);
- iRequestedMediaIds.Append( mpxId.iId1 );
- iRequestedMediaIds.Append( mpxId.iId1 );
- CMPXMedia* newMedia = CMPXMedia::NewL();
- CleanupStack::PushL( newMedia );
- newMedia->SetTObjectValueL( KMPXMessageMediaGeneralId, mpxId );
- newMedia->SetTObjectValueL( KMPXMediaGeneralId, mpxId );
- medias->AppendL( *newMedia );
- medias->AppendL( *newMedia );
- CleanupStack::PopAndDestroy( newMedia );
- }
- }
- }
-
- // Every second ID
- if( aStartIndex == -3 )
- {
- if( aEndIndex > iMediaArray->Count() )
- {
- VCXLOGLO2("CVCXMyVideosCollectionPluginTester::SelectMediasL end index: %d is out of bounds.", aEndIndex);
- User::Leave( KErrArgument );
- }
-
- for( TInt i = 0; i < aEndIndex; i+=2 )
- {
- CMPXMedia* media = (*iMediaArray)[i];
-
- if( media )
- {
- TMPXItemId mpxId = *(*media).Value<TMPXItemId>( KMPXMediaGeneralId );
-
- VCXLOGLO2("CVCXMyVideosCollectionPluginTester:: Selected media. MPX ID: %d", mpxId.iId1);
- iRequestedMediaIds.Append( mpxId.iId1 );
- CMPXMedia* newMedia = CMPXMedia::NewL();
- CleanupStack::PushL( newMedia );
- newMedia->SetTObjectValueL( KMPXMessageMediaGeneralId, mpxId );
- newMedia->SetTObjectValueL( KMPXMediaGeneralId, mpxId );
- medias->AppendL( *newMedia );
- CleanupStack::PopAndDestroy( newMedia );
- }
- }
- }
-
- CleanupStack::Pop( medias );
-
- VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTester::SelectMediasL");
- return medias;
- }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::UpdateOwnedMediaArray
-// -----------------------------------------------------------------------------
-//
-void CVCXMyVideosCollectionPluginTester::UpdateOwnedMediaArrayL()
- {
- VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTester::UpdateOwnedMediaArrayL");
-
- if ( !iCollectionEntries )
- {
- return;
- }
-
- if( !iCollectionEntries->IsSupported( KMPXMediaArrayContents ) )
- {
- VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: No support for KMPXMediaArrayContents, cannot continue!");
- User::Leave( KErrNotSupported );
- }
-
- // Get up to date list of all medias in collection.
- CMPXMediaArray* medias = iCollectionEntries->Value<CMPXMediaArray>( KMPXMediaArrayContents );
-
- // Delete array of old medias
- if( iOldMediaArray )
- {
- iOldMediaArray->Reset();
- delete iOldMediaArray;
- }
-
- // Update the old array and create new
- iOldMediaArray = iMediaArray;
- iMediaArray = CMPXMediaArray::NewL();
-
- TBool categories( EFalse );
-
- // Make copies of the medias.
- for( TInt i=0; i<medias->Count(); i++ )
- {
- CMPXMedia* media = (*medias)[i];
-
- TMPXItemId itemId = *(media->Value<TMPXItemId>( KMPXMediaGeneralId ));
- if( itemId.iId2 != 0 )
- {
- categories = ETrue;
- }
-
- // Ignore medias on ROM.
- TBool isOnRom( EFalse );
-
- if( media->IsSupported( KMPXMediaGeneralUri ) )
- {
- const TDesC& url = media->ValueText( KMPXMediaGeneralUri );
- if( url.FindC( _L("z:" ) ) != KErrNotFound )
- {
- isOnRom = ETrue;
- }
- }
-
- if( !isOnRom )
- {
- iMediaArray->AppendL( *media );
- }
- }
-
- iMediaCount = iMediaArray->Count();
-
- // Update count of videos on ROM.
- if( !categories )
- {
- iVideosOnRomCount = 0;
-
- for( TInt i=0; i<medias->Count(); i++ )
- {
- CMPXMedia* media = (*medias)[i];
-
- if( media->IsSupported( KMPXMediaGeneralUri ) )
- {
- const TDesC& url = media->ValueText( KMPXMediaGeneralUri );
- if( url.FindC( _L("z:" ) ) != KErrNotFound )
- {
- iVideosOnRomCount++;
- }
- }
- }
-
- VCXLOGLO2("CVCXMyVideosCollectionPluginTester:: iVideosOnRom: %d", iVideosOnRomCount);
- }
-
- VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTester::UpdateOwnedMediaArrayL");
- }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::GetChangedMedias
-// -----------------------------------------------------------------------------
-//
-CMPXMediaArray* CVCXMyVideosCollectionPluginTester::GetChangedMedias( const CMPXMediaArray* aNewMedias )
- {
- VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTester::GetChangedMedias");
-
- CMPXMediaArray* changedMedias = CMPXMediaArray::NewL();
-
- if( !aNewMedias )
- {
- VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTester::GetChangedMedias");
- return changedMedias;
- }
-
- CleanupStack::PushL( changedMedias );
-
- for( TInt i=0; i<aNewMedias->Count(); i++ )
- {
- CMPXMedia* media(NULL);
- media = (*aNewMedias)[i];
-
- if( !media )
- {
- continue;
- }
-
- TMPXItemId mpxId = *(*media).Value<TMPXItemId>( KMPXMediaGeneralId );
-
- CMPXMedia* oldMedia = GetMediaByMpxId( iOldMediaArray, mpxId );
-
- TBool add( EFalse );
-
- // It's a new.
- if( !oldMedia )
- {
- add = ETrue;
- }
- // Check changes
- else
- {
- const TArray<TMPXAttribute> newAttributes = media->Attributes();
- const TArray<TMPXAttribute> oldAttributes = oldMedia->Attributes();
- if( newAttributes.Count() != oldAttributes.Count() )
- {
- add = ETrue;
- }
- else
- {
- for( TInt e=0; e<newAttributes.Count(); e++ )
- {
- if( !oldMedia->Match( *media, newAttributes[e] ) )
- {
- add = ETrue;
- break;
- }
- }
- }
- }
-
- // Add a copy of the media.
- if( add )
- {
- changedMedias->AppendL( *media );
- }
- }
-
- CleanupStack::Pop( changedMedias );
-
- VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTester::GetChangedMedias");
- return changedMedias;
- }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::GetMediaByMpxId
-// -----------------------------------------------------------------------------
-//
-CMPXMedia* CVCXMyVideosCollectionPluginTester::GetMediaByMpxId( CMPXMediaArray* aMedias, TMPXItemId& aMpxId )
- {
- if( !aMedias )
- {
- return NULL;
- }
-
- for( TInt i=0; i<aMedias->Count(); i++ )
- {
- CMPXMedia* media = (*aMedias)[i];
- TMPXItemId mpxId = *(*media).Value<TMPXItemId>( KMPXMediaGeneralId );
-
- if( mpxId == aMpxId )
- {
- return media;
- }
- }
- return NULL;
- }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::SetRefreshStatus
-// -----------------------------------------------------------------------------
-//
-void CVCXMyVideosCollectionPluginTester::SetRefreshStatus( TBool aRefreshingCollection )
- {
- iRefreshingCollection = aRefreshingCollection;
- }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::CheckRequestMediaArrayL
-// -----------------------------------------------------------------------------
-//
-void CVCXMyVideosCollectionPluginTester::CheckRequestMediaArrayL( CMPXMediaArray& aRequestResultMedias, RArray<TInt32>& aRequestedMediaIds )
- {
- VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTester::CheckRequestMediaArrayL");
-
- // Print requested ids
- VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: Requested IDs:");
- for( TInt i = 0; i < aRequestedMediaIds.Count(); i++ )
- {
- VCXLOGLO2("Requested: iId1: %d", aRequestedMediaIds[i] );
- }
-
- // Print actual result ids and check for errors
- VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: Request result media IDs:");
- for( TInt i = 0; i < aRequestResultMedias.Count(); i++ )
- {
- VCXLOGLO2("CVCXMyVideosCollectionPluginTester:: at index: %d:", i);
- CMPXMedia* media = aRequestResultMedias[i];
- VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: got media");
- if( media )
- {
- TMPXItemId mpxId = *(*media).Value<TMPXItemId>( KMPXMediaGeneralId );
- VCXLOGLO3("Result: iId1: %d, iId2: %d", mpxId.iId1, mpxId.iId2 );
- if( media->IsSupported( KVcxMediaMyVideosInt32Value ) )
- {
- TInt32 result = (*media).ValueTObjectL<TInt32>( KVcxMediaMyVideosInt32Value );
- VCXLOGLO2("CVCXMyVideosCollectionPluginTester:: result: %d:", result);
- if( result != KErrNone && !( result == KErrCancel && iCancelRequested ) )
- {
- VCXLOGLO2("CVCXMyVideosCollectionPluginTester:: ERROR in results: %d!", result);
- User::Leave( result );
- }
- }
- }
- else
- {
- VCXLOGLO2("CVCXMyVideosCollectionPluginTester:: Result is NULL at index: %d", i);
- }
- }
-
- VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: rest of the checks");
-
- // First check the counts match
- if( aRequestResultMedias.Count() != aRequestedMediaIds.Count() )
- {
- VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: Did not get all the requested entries!");
- User::Leave( KErrCorrupt );
- }
- else
- // Check that all requested ids are in the results
- for( TInt i = 0; i < aRequestedMediaIds.Count(); i++ )
- {
- TMPXItemId mpxId;
- mpxId.iId1 = aRequestedMediaIds[i];
- mpxId.iId2 = 0;
-
- TBool found( EFalse );
- for( TInt e = 0; e < aRequestResultMedias.Count(); e++ )
- {
- CMPXMedia* media2 = aRequestResultMedias[e];
- if( media2 )
- {
- TMPXItemId mpxId2 = *(*media2).Value<TMPXItemId>( KMPXMediaGeneralId );
-
- if( mpxId == mpxId2 )
- {
- found = ETrue;
- }
- }
- }
-
- if( !found )
- {
- VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: Requested media not found from results!");
- User::Leave( KErrCorrupt );
- }
- }
- VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTester::CheckRequestMediaArrayL");
- }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::PrintMediasL
+// CVCXMyVideosCollectionPluginTester::PrintMediasL
// -----------------------------------------------------------------------------
//
void CVCXMyVideosCollectionPluginTester::PrintMediasL( CMPXMediaArray* aMediaArray, TBool aCheckChanges, const TDesC& aTitle )
@@ -1137,7 +535,7 @@
VCXLOGLO4("CVCXMyVideosCollectionPluginTester:: <----------- %S - %d Entries, %d has changed ----------->", &aTitle, count, changedCount );
}
- CMPXMedia* media(NULL);
+ CMPXMedia* media;
for( TInt i = 0; i < medias->Count(); i++ )
{
media = (*medias)[i];
@@ -1153,7 +551,7 @@
}
// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::PrintMPXMediaL
+// CVCXMyVideosCollectionPluginTester::PrintMPXMediaL
// -----------------------------------------------------------------------------
//
void CVCXMyVideosCollectionPluginTester::PrintMPXMediaL( const CMPXMedia& aMedia, TBool aPrintAllDetails )
@@ -1169,7 +567,7 @@
}
// Category
- if( itemId.iId2 != 0 )
+ if( itemId.iId2 != KVcxMvcMediaTypeVideo )
{
TInt itemCount(0);
TInt newItemCount(0);
@@ -1223,13 +621,21 @@
// Print all details
- if( itemId.iId2 != 0 )
+ if( itemId.iId2 == KVcxMvcMediaTypeCategory )
{
- VCXLOGLO1("--------------------------- MEDIA CATEGORY -------------------------------");
+ VCXLOGLO1("--------------------------- CATEGORY -------------------------------");
+ }
+ else if( itemId.iId2 == KVcxMvcMediaTypeAlbum )
+ {
+ VCXLOGLO1("--------------------------- Album ----------------------------------");
}
- else
+ else if( itemId.iId2 == KVcxMvcMediaTypeVideo )
{
- VCXLOGLO1("--------------------------- MEDIA OBJECT -------------------------------");
+ VCXLOGLO1("--------------------------- VIDEO -------------------------------");
+ }
+ else
+ {
+ VCXLOGLO1("--------------------------- UNKNOWN! -------------------------------");
}
VCXLOGLO3("iId1: %d, iId2: %d", itemId.iId1, itemId.iId2 );
@@ -1459,7 +865,643 @@
}
// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::HandleCollectionMessage
+// CVCXMyVideosCollectionPluginTester::UpdateAlbumsListL
+// -----------------------------------------------------------------------------
+//
+void CVCXMyVideosCollectionPluginTester::UpdateAlbumsListL()
+ {
+ CMPXMedia* media;
+
+ for( TInt i = 0; i < iMediaArray->Count(); i++ )
+ {
+ media = (*iMediaArray)[i];
+
+ if( media )
+ {
+ TMPXItemId itemId = *media->Value<TMPXItemId>( KMPXMediaGeneralId );
+
+ if( itemId.iId2 == KVcxMvcMediaTypeAlbum )
+ {
+ TBool albumFound( EFalse );
+ for( TInt e = 0; e < iAlbumIds.Count(); e++ )
+ {
+ if( iAlbumIds[e] == itemId )
+ {
+ albumFound = ETrue;
+ }
+ }
+
+ if( !albumFound )
+ {
+ TBuf<256> title;
+ if( media->IsSupported( KMPXMediaGeneralTitle ) )
+ {
+ title = media->ValueText( KMPXMediaGeneralTitle );
+ }
+ HBufC* titleBuff = title.AllocL();
+ iAlbumNames.Append( titleBuff );
+ iAlbumIds.Append( itemId );
+ }
+ }
+ }
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// CVCXMyVideosCollectionPluginTester::GetAlbumIdL
+// -----------------------------------------------------------------------------
+//
+TMPXItemId CVCXMyVideosCollectionPluginTester::GetAlbumIdL( const TDesC& aAlbumName )
+ {
+ // Get the last album with the name.
+ for( TInt i = iAlbumNames.Count()-1; i >= 0; i-- )
+ {
+ if( iAlbumNames[i]->Des() == aAlbumName && i < iAlbumIds.Count() )
+ {
+ VCXLOGLO3("CVCXMyVideosCollectionPluginTester::GetAlbumIdL: returning album id1: %d, id2: %d", iAlbumIds[i].iId1, iAlbumIds[i].iId2);
+ return iAlbumIds[i];
+ }
+ }
+
+ VCXLOGLO2("CVCXMyVideosCollectionPluginTester::GetAlbumIdL: could not find album '%S'", &aAlbumName);
+ User::Leave( KErrNotFound );
+
+ return TMPXItemId::InvalidId();
+ }
+
+// -----------------------------------------------------------------------------
+// CVCXMyVideosCollectionPluginTester::CreateMpxCommandLC
+// -----------------------------------------------------------------------------
+//
+CMPXCommand* CVCXMyVideosCollectionPluginTester::CreateMpxCommandLC( TInt aCommandGeneralId, TInt aMyVideosCommandId, TBool aSync )
+ {
+ CMPXCommand* cmd = CMPXCommand::NewL();
+ CleanupStack::PushL( cmd );
+
+ cmd->SetTObjectValueL( KMPXCommandGeneralId, aCommandGeneralId );
+ if( aCommandGeneralId == KVcxCommandIdMyVideos )
+ {
+ cmd->SetTObjectValueL( KVcxMediaMyVideosCommandId, aMyVideosCommandId );
+ }
+
+ cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, aSync );
+
+ if( !aSync )
+ {
+ iTransactions->NextTransactionId();
+
+ if( aCommandGeneralId == KVcxCommandIdMyVideos )
+ {
+ cmd->SetTObjectValueL( KVcxMediaMyVideosTransactionId, iTransactions->TransactionId() );
+ iTransactions->AddTransactionId( aMyVideosCommandId );
+ }
+ }
+
+ VCXLOGLO2("CVCXMyVideosCollectionPluginTester::CreateMpxCommandLC: collectionId: 0x%x", iCollectionUid.iUid);
+ cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId, iCollectionUid.iUid );
+
+ return cmd;
+ }
+
+// -----------------------------------------------------------------------------
+// CVCXMyVideosCollectionPluginTester::SelectMediasL
+// -----------------------------------------------------------------------------
+//
+CMPXMediaArray* CVCXMyVideosCollectionPluginTester::SelectMediasL( TInt aDriveFilter, TInt aStartIndex, TInt aEndIndex )
+ {
+ if( aStartIndex == -4 )
+ {
+ VCXLOGLO1("CVCXMyVideosCollectionPluginTester::SelectMediasL - returning NULL");
+ return NULL;
+ }
+
+ VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTester::SelectMediasL");
+ VCXLOGLO2("CVCXMyVideosCollectionPluginTester::SelectMediasL: aStartIndex: %d", aStartIndex);
+
+ CMPXMediaArray* iSourceMedias;
+
+ if( !iUseCopiedMedias )
+ {
+ if( !iMediaArray )
+ {
+ User::Leave( KErrNotReady );
+ }
+ iSourceMedias = iMediaArray;
+ }
+ else
+ {
+ if( !iMediaArrayCopy )
+ {
+ User::Leave( KErrNotReady );
+ }
+ iSourceMedias = iMediaArrayCopy;
+ }
+
+ iRequestedMediaIds.Reset();
+
+ CMPXMediaArray* medias = CMPXMediaArray::NewL();
+
+ // None
+ if( aStartIndex > aEndIndex )
+ {
+ VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: Selected none of the videos.");
+ VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTester::SelectMediasL");
+ return medias;
+ }
+
+ CleanupStack::PushL( medias );
+
+ if( aStartIndex >= 0 )
+ {
+ if( aEndIndex > iSourceMedias->Count() )
+ {
+ VCXLOGLO2("CVCXMyVideosCollectionPluginTester::SelectMediasL end index: %d is out of bounds.", aEndIndex);
+ User::Leave( KErrArgument );
+ }
+
+ TInt countToSelect = aEndIndex - aStartIndex;
+ TInt indexOfVideoOnDrive = 0;
+
+ for( TInt i = 0; i < iSourceMedias->Count(); i++ )
+ {
+ CMPXMedia* media = (*iSourceMedias)[i];
+
+ if( media )
+ {
+ TBool selectThis( EFalse );
+
+ if( aDriveFilter != -1 )
+ {
+ // Drive specified, check path and index of video on the drive.
+ const TDesC& localFilePath = media->ValueText( KMPXMediaGeneralUri );
+ TInt drive( 0 );
+ User::LeaveIfError( iFs.CharToDrive( localFilePath[0], drive ) );
+
+ if( drive == aDriveFilter )
+ {
+ if( indexOfVideoOnDrive >= aStartIndex && indexOfVideoOnDrive < aEndIndex )
+ {
+ selectThis = ETrue;
+ }
+ indexOfVideoOnDrive++;
+ }
+ }
+ else
+ {
+ // No drive specified, just index check.
+ if( i >= aStartIndex && i < aEndIndex )
+ {
+ selectThis = ETrue;
+ }
+ }
+
+ if( selectThis )
+ {
+ TMPXItemId mpxId = *(*media).Value<TMPXItemId>( KMPXMediaGeneralId );
+ VCXLOGLO2("CVCXMyVideosCollectionPluginTester:: Selected media. MPX ID: %d", mpxId.iId1);
+ iRequestedMediaIds.Append( mpxId.iId1 );
+ CMPXMedia* newMedia = CMPXMedia::NewL();
+ CleanupStack::PushL( newMedia );
+ newMedia->SetTObjectValueL( KMPXMessageMediaGeneralId, mpxId );
+ newMedia->SetTObjectValueL( KMPXMediaGeneralId, mpxId );
+ medias->AppendL( *newMedia );
+ CleanupStack::PopAndDestroy( newMedia );
+
+ if( medias->Count() >= countToSelect )
+ {
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ // Invalid IDs
+ if( aStartIndex == -1 )
+ {
+ for( TInt i = 0; i < aEndIndex; i++ )
+ {
+ TMPXItemId mpxId;
+ mpxId.iId1 = i+66666;
+ mpxId.iId2 = 0;
+
+ VCXLOGLO2("CVCXMyVideosCollectionPluginTester:: Selected media. Invalid MPX ID: %d", mpxId.iId1);
+
+ CMPXMedia* newMedia = CMPXMedia::NewL();
+ CleanupStack::PushL( newMedia );
+ newMedia->SetTObjectValueL( KMPXMessageMediaGeneralId, mpxId );
+ newMedia->SetTObjectValueL( KMPXMediaGeneralId, mpxId );
+ medias->AppendL( *newMedia );
+ CleanupStack::PopAndDestroy( newMedia );
+ }
+ }
+
+ // Duplicate IDs
+ if( aStartIndex == -2 )
+ {
+ if( aEndIndex > iSourceMedias->Count() )
+ {
+ VCXLOGLO2("CVCXMyVideosCollectionPluginTester::SelectMediasL end index: %d is out of bounds.", aEndIndex);
+ User::Leave( KErrArgument );
+ }
+
+ for( TInt i = 0; i < aEndIndex; i++ )
+ {
+ CMPXMedia* media = (*iSourceMedias)[i];
+
+ if( media )
+ {
+ TMPXItemId mpxId = *(*media).Value<TMPXItemId>( KMPXMediaGeneralId );
+
+ VCXLOGLO2("CVCXMyVideosCollectionPluginTester:: Selected media. Add twice MPX ID: %d", mpxId.iId1);
+ iRequestedMediaIds.Append( mpxId.iId1 );
+ iRequestedMediaIds.Append( mpxId.iId1 );
+ CMPXMedia* newMedia = CMPXMedia::NewL();
+ CleanupStack::PushL( newMedia );
+ newMedia->SetTObjectValueL( KMPXMessageMediaGeneralId, mpxId );
+ newMedia->SetTObjectValueL( KMPXMediaGeneralId, mpxId );
+ medias->AppendL( *newMedia );
+ medias->AppendL( *newMedia );
+ CleanupStack::PopAndDestroy( newMedia );
+ }
+ }
+ }
+
+ // Every second ID
+ if( aStartIndex == -3 )
+ {
+ if( aEndIndex > iSourceMedias->Count() )
+ {
+ VCXLOGLO2("CVCXMyVideosCollectionPluginTester::SelectMediasL end index: %d is out of bounds.", aEndIndex);
+ User::Leave( KErrArgument );
+ }
+
+ for( TInt i = 0; i < aEndIndex; i+=2 )
+ {
+ CMPXMedia* media = (*iSourceMedias)[i];
+
+ if( media )
+ {
+ TMPXItemId mpxId = *(*media).Value<TMPXItemId>( KMPXMediaGeneralId );
+
+ VCXLOGLO2("CVCXMyVideosCollectionPluginTester:: Selected media. MPX ID: %d", mpxId.iId1);
+ iRequestedMediaIds.Append( mpxId.iId1 );
+ CMPXMedia* newMedia = CMPXMedia::NewL();
+ CleanupStack::PushL( newMedia );
+ newMedia->SetTObjectValueL( KMPXMessageMediaGeneralId, mpxId );
+ newMedia->SetTObjectValueL( KMPXMediaGeneralId, mpxId );
+ medias->AppendL( *newMedia );
+ CleanupStack::PopAndDestroy( newMedia );
+ }
+ }
+ }
+
+ CleanupStack::Pop( medias );
+
+ VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTester::SelectMediasL");
+ return medias;
+ }
+
+// -----------------------------------------------------------------------------
+// CVCXMyVideosCollectionPluginTester::SetUseCopiedMediasL
+// -----------------------------------------------------------------------------
+//
+void CVCXMyVideosCollectionPluginTester::SetUseCopiedMediasL( TBool aUseCopiedMedias )
+ {
+ if( aUseCopiedMedias )
+ {
+ CreateCopyOfCurrentMediasL();
+ }
+
+ iUseCopiedMedias = aUseCopiedMedias;
+ }
+
+// -----------------------------------------------------------------------------
+// CVCXMyVideosCollectionPluginTester::CreateCopyOfCurrentMediasL
+// -----------------------------------------------------------------------------
+//
+void CVCXMyVideosCollectionPluginTester::CreateCopyOfCurrentMediasL()
+ {
+ VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTester::CreateCopyOfCurrentMediasL");
+
+ if( !iMediaArray )
+ {
+ User::Leave( KErrNotReady );
+ }
+
+ if( iMediaArrayCopy )
+ {
+ iMediaArrayCopy->Reset();
+ delete iMediaArrayCopy;
+ iMediaArrayCopy = NULL;
+ }
+
+ iMediaArrayCopy = CMPXMediaArray::NewL();
+
+ for( TInt i = 0; i < iMediaArray->Count(); i++ )
+ {
+ CMPXMedia* media = (*iMediaArray)[i];
+
+ if( media )
+ {
+ TMPXItemId mpxId = *(*media).Value<TMPXItemId>( KMPXMediaGeneralId );
+
+ CMPXMedia* newMedia = CMPXMedia::NewL();
+ CleanupStack::PushL( newMedia );
+ newMedia->SetTObjectValueL( KMPXMessageMediaGeneralId, mpxId );
+ newMedia->SetTObjectValueL( KMPXMediaGeneralId, mpxId );
+ iMediaArrayCopy->AppendL( *newMedia );
+ CleanupStack::PopAndDestroy( newMedia );
+ }
+ }
+
+ VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTester::CreateCopyOfCurrentMediasL");
+ }
+
+// -----------------------------------------------------------------------------
+// CVCXMyVideosCollectionPluginTester::UpdateOwnedMediaArray
+// -----------------------------------------------------------------------------
+//
+void CVCXMyVideosCollectionPluginTester::UpdateOwnedMediaArrayL()
+ {
+ VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTester::UpdateOwnedMediaArrayL");
+
+ if ( !iCollectionEntries )
+ {
+ return;
+ }
+
+ if( !iCollectionEntries->IsSupported( KMPXMediaArrayContents ) )
+ {
+ VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: No support for KMPXMediaArrayContents, cannot continue!");
+ User::Leave( KErrNotSupported );
+ }
+
+ // Get up to date list of all medias in collection.
+ CMPXMediaArray* medias = iCollectionEntries->Value<CMPXMediaArray>( KMPXMediaArrayContents );
+
+ // Delete array of old medias
+ if( iOldMediaArray )
+ {
+ iOldMediaArray->Reset();
+ delete iOldMediaArray;
+ }
+
+ // Update the old array and create new
+ iOldMediaArray = iMediaArray;
+ iMediaArray = CMPXMediaArray::NewL();
+
+ TBool categories( EFalse );
+
+ // Make copies of the medias.
+ for( TInt i=0; i<medias->Count(); i++ )
+ {
+ CMPXMedia* media = (*medias)[i];
+
+ TMPXItemId itemId = *(media->Value<TMPXItemId>( KMPXMediaGeneralId ));
+
+ if( itemId.iId2 != KVcxMvcMediaTypeVideo )
+ {
+ categories = ETrue;
+ }
+
+ // Ignore medias on ROM.
+ TBool isOnRom( EFalse );
+
+ if( media->IsSupported( KMPXMediaGeneralUri ) )
+ {
+ const TDesC& url = media->ValueText( KMPXMediaGeneralUri );
+ if( url.FindC( _L("z:" ) ) != KErrNotFound )
+ {
+ isOnRom = ETrue;
+ }
+ }
+
+ if( !isOnRom )
+ {
+ iMediaArray->AppendL( *media );
+ }
+ }
+
+ iMediaCount = iMediaArray->Count();
+
+ // Update count of videos on ROM.
+ if( !categories )
+ {
+ iVideosOnRomCount = 0;
+
+ for( TInt i=0; i<medias->Count(); i++ )
+ {
+ CMPXMedia* media = (*medias)[i];
+
+ if( media->IsSupported( KMPXMediaGeneralUri ) )
+ {
+ const TDesC& url = media->ValueText( KMPXMediaGeneralUri );
+ if( url.FindC( _L("z:" ) ) != KErrNotFound )
+ {
+ iVideosOnRomCount++;
+ }
+ }
+ }
+
+ VCXLOGLO2("CVCXMyVideosCollectionPluginTester:: iVideosOnRom: %d", iVideosOnRomCount);
+ }
+
+ VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTester::UpdateOwnedMediaArrayL");
+ }
+
+// -----------------------------------------------------------------------------
+// CVCXMyVideosCollectionPluginTester::GetChangedMedias
+// -----------------------------------------------------------------------------
+//
+CMPXMediaArray* CVCXMyVideosCollectionPluginTester::GetChangedMedias( const CMPXMediaArray* aNewMedias )
+ {
+ VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTester::GetChangedMedias");
+
+ CMPXMediaArray* changedMedias = CMPXMediaArray::NewL();
+
+ if( !aNewMedias )
+ {
+ VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTester::GetChangedMedias");
+ return changedMedias;
+ }
+
+ CleanupStack::PushL( changedMedias );
+
+ for( TInt i=0; i<aNewMedias->Count(); i++ )
+ {
+ CMPXMedia* media(NULL);
+ media = (*aNewMedias)[i];
+
+ if( !media )
+ {
+ continue;
+ }
+
+ TMPXItemId mpxId = *(*media).Value<TMPXItemId>( KMPXMediaGeneralId );
+
+ CMPXMedia* oldMedia = GetMediaByMpxId( iOldMediaArray, mpxId );
+
+ TBool add( EFalse );
+
+ // It's a new.
+ if( !oldMedia )
+ {
+ add = ETrue;
+ }
+ // Check changes
+ else
+ {
+ const TArray<TMPXAttribute> newAttributes = media->Attributes();
+ const TArray<TMPXAttribute> oldAttributes = oldMedia->Attributes();
+ if( newAttributes.Count() != oldAttributes.Count() )
+ {
+ add = ETrue;
+ }
+ else
+ {
+ for( TInt e=0; e<newAttributes.Count(); e++ )
+ {
+ if( !oldMedia->Match( *media, newAttributes[e] ) )
+ {
+ add = ETrue;
+ break;
+ }
+ }
+ }
+ }
+
+ // Add a copy of the media.
+ if( add )
+ {
+ changedMedias->AppendL( *media );
+ }
+ }
+
+ CleanupStack::Pop( changedMedias );
+
+ VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTester::GetChangedMedias");
+ return changedMedias;
+ }
+
+// -----------------------------------------------------------------------------
+// CVCXMyVideosCollectionPluginTester::GetMediaByMpxId
+// -----------------------------------------------------------------------------
+//
+CMPXMedia* CVCXMyVideosCollectionPluginTester::GetMediaByMpxId( CMPXMediaArray* aMedias, TMPXItemId& aMpxId )
+ {
+ if( !aMedias )
+ {
+ return NULL;
+ }
+
+ for( TInt i=0; i<aMedias->Count(); i++ )
+ {
+ CMPXMedia* media = (*aMedias)[i];
+ TMPXItemId mpxId = *(*media).Value<TMPXItemId>( KMPXMediaGeneralId );
+
+ if( mpxId == aMpxId )
+ {
+ return media;
+ }
+ }
+ return NULL;
+ }
+
+// -----------------------------------------------------------------------------
+// CVCXMyVideosCollectionPluginTester::SetRefreshStatus
+// -----------------------------------------------------------------------------
+//
+void CVCXMyVideosCollectionPluginTester::SetRefreshStatus( TBool aRefreshingCollection )
+ {
+ iRefreshingCollection = aRefreshingCollection;
+ }
+
+// -----------------------------------------------------------------------------
+// CVCXMyVideosCollectionPluginTester::CheckRequestMediaArrayL
+// -----------------------------------------------------------------------------
+//
+void CVCXMyVideosCollectionPluginTester::CheckRequestMediaArrayL( CMPXMediaArray& aRequestResultMedias, RArray<TInt32>& aRequestedMediaIds )
+ {
+ VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTester::CheckRequestMediaArrayL");
+
+ // Print requested ids
+ VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: Requested IDs:");
+ for( TInt i = 0; i < aRequestedMediaIds.Count(); i++ )
+ {
+ VCXLOGLO2("Requested: iId1: %d", aRequestedMediaIds[i] );
+ }
+
+ // Print actual result ids and check for errors
+ VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: Request result media IDs:");
+ for( TInt i = 0; i < aRequestResultMedias.Count(); i++ )
+ {
+ VCXLOGLO2("CVCXMyVideosCollectionPluginTester:: at index: %d:", i);
+ CMPXMedia* media = aRequestResultMedias[i];
+ VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: got media");
+ if( media )
+ {
+ TMPXItemId mpxId = *(*media).Value<TMPXItemId>( KMPXMediaGeneralId );
+ VCXLOGLO3("Result: iId1: %d, iId2: %d", mpxId.iId1, mpxId.iId2 );
+ if( media->IsSupported( KVcxMediaMyVideosInt32Value ) )
+ {
+ TInt32 result = (*media).ValueTObjectL<TInt32>( KVcxMediaMyVideosInt32Value );
+ VCXLOGLO2("CVCXMyVideosCollectionPluginTester:: result: %d:", result);
+ if( result != KErrNone && !( result == KErrCancel && iCancelRequested ) )
+ {
+ VCXLOGLO2("CVCXMyVideosCollectionPluginTester:: ERROR in results: %d!", result);
+ User::Leave( result );
+ }
+ }
+ }
+ else
+ {
+ VCXLOGLO2("CVCXMyVideosCollectionPluginTester:: Result is NULL at index: %d", i);
+ }
+ }
+
+ VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: rest of the checks");
+
+ // First check the counts match
+ if( aRequestResultMedias.Count() != aRequestedMediaIds.Count() )
+ {
+ VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: Did not get all the requested entries!");
+ User::Leave( KErrCorrupt );
+ }
+ else
+ // Check that all requested ids are in the results
+ for( TInt i = 0; i < aRequestedMediaIds.Count(); i++ )
+ {
+ TMPXItemId mpxId;
+ mpxId.iId1 = aRequestedMediaIds[i];
+ mpxId.iId2 = 0;
+
+ TBool found( EFalse );
+ for( TInt e = 0; e < aRequestResultMedias.Count(); e++ )
+ {
+ CMPXMedia* media2 = aRequestResultMedias[e];
+ if( media2 )
+ {
+ TMPXItemId mpxId2 = *(*media2).Value<TMPXItemId>( KMPXMediaGeneralId );
+
+ if( mpxId == mpxId2 )
+ {
+ found = ETrue;
+ }
+ }
+ }
+
+ if( !found )
+ {
+ VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: Requested media not found from results!");
+ User::Leave( KErrCorrupt );
+ }
+ }
+ VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTester::CheckRequestMediaArrayL");
+ }
+
+// -----------------------------------------------------------------------------
+// CVCXMyVideosCollectionPluginTester::HandleCollectionMessage
// -----------------------------------------------------------------------------
//
void CVCXMyVideosCollectionPluginTester::HandleCollectionMessage( CMPXMessage* aMessage, TInt aError )
@@ -1532,7 +1574,7 @@
}
// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::HandleSingleCollectionMessage
+// CVCXMyVideosCollectionPluginTester::HandleSingleCollectionMessage
// -----------------------------------------------------------------------------
//
void CVCXMyVideosCollectionPluginTester::HandleSingleCollectionMessageL( CMPXMessage* aMessage )
@@ -1597,11 +1639,7 @@
SetRefreshStatus( EFalse );
- // add downloads to the requested ID array always and update downloads too.
- TBool backup = iUpdateDownloads;
- iUpdateDownloads = EFalse;
ProcessCurrentEntriesL();
- iUpdateDownloads = backup;
// Check
TRAPD( err, CheckRequestMediaArrayL( *iMediaArray, iRequestedMediaIds ) );
@@ -1613,10 +1651,6 @@
// Inform observer
iObserver->HandleVcxMvTesterMessageL( KVCXMYVideosTestMessageGotMediasByKMpxId, KErrNone );
- TRAPD( actionErr, iStats->ActionEndL( transactionId, err ) );
- if( actionErr == KErrAbort )
- iObserver->HandleVcxMvTesterMessageL( KVCXMYVideosTestMessageCollectionGeneral, actionErr );
-
}
break;
@@ -1653,7 +1687,7 @@
case KVcxMessageMyVideosListComplete:
{
VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: ----------------------------------------------------------------");
- VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: KVcxMediaMyVideosCommandId: KVcxMessageMyVideosListComplete");
+ VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: KVcxMediaMyVideosCommandId: KVcxMessageMyVideosListComplete ------>");
VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: ----------------------------------------------------------------");
iObserver->HandleVcxMvTesterMessageL( KVCXMYVideosTestMessageListComplete, KErrNone );
}
@@ -1672,8 +1706,6 @@
iActionCount--;
iObserver->HandleVcxMvTesterMessageL( KVCXMYVideosTestMessageCopyOrMoveStarted, KErrNone );
-
- TRAP_IGNORE( iStats->ActionProgressL( transactionId, _L("Move/Copy started.") ) );
}
break;
@@ -1709,10 +1741,6 @@
TRAP_IGNORE( iObserver->HandleVcxMvTesterMessageL( KVCXMYVideosTestMessageCommandCanceled, KErrNone ) );
iCancelRequested = EFalse;
}
-
- TRAPD( actionErr, iStats->ActionEndL( transactionId, err ) );
- if( actionErr == KErrAbort )
- iObserver->HandleVcxMvTesterMessageL( KVCXMYVideosTestMessageCollectionGeneral, actionErr );
CleanupStack::PopAndDestroy( medias );
}
@@ -1750,10 +1778,6 @@
iCancelRequested = EFalse;
}
- TRAPD( actionErr, iStats->ActionEndL( transactionId, err ) );
- if( actionErr == KErrAbort )
- iObserver->HandleVcxMvTesterMessageL( KVCXMYVideosTestMessageCollectionGeneral, actionErr );
-
CleanupStack::PopAndDestroy( medias );
}
break;
@@ -1771,8 +1795,6 @@
iActionCount--;
iObserver->HandleVcxMvTesterMessageL( KVCXMYVideosTestMessageDeleteStarted, KErrNone );
-
- TRAP_IGNORE( iStats->ActionProgressL( transactionId, _L("Delete started.") ) );
}
break;
@@ -1809,10 +1831,6 @@
iCancelRequested = EFalse;
}
- TRAPD( actionErr, iStats->ActionEndL( transactionId, err ) );
- if( actionErr == KErrAbort )
- iObserver->HandleVcxMvTesterMessageL( KVCXMYVideosTestMessageCollectionGeneral, actionErr );
-
CleanupStack::PopAndDestroy( medias );
}
break;
@@ -1880,28 +1898,8 @@
TMPXItemId itemId = *aMessage->Value<TMPXItemId>(KMPXMessageMediaGeneralId);
VCXLOGLO3("CVCXMyVideosCollectionPluginTester:: Item Id1: %d, Id2: %d", itemId.iId1, itemId.iId2);
-
-#if 1
- // Check the IDs for categories
- if( itemId.iId2 != 0 && ( itemId.iId1 != KVcxMvcCategoryIdAll &&
- itemId.iId1 != KVcxMvcCategoryIdDownloads &&
- itemId.iId1 != KVcxMvcCategoryIdTvRecordings &&
- itemId.iId1 != KVcxMvcCategoryIdCaptured &&
- itemId.iId1 != KVcxMvcCategoryIdOther ) )
- {
- iObserver->HandleVcxMvTesterMessageL( KVCXMYVideosTestMessageCollectionCategoryChanged, KErrCorrupt );
- VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: Error. INVALID ITEM ID.");
- break;
- }
-#endif
- // If event if for category, skip it if it's not for the open category.
- if( iCurrentOpenedLevelIndex != -1 && itemId.iId2 > 0 && itemId.iId1 != iCurrentOpenedLevelIndex )
- {
- VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: Not for open category. Skip.");
- break;
- }
-
- if( iWaitingForItemChange && itemId.iId2 == 0 )
+
+ if( iWaitingForItemChange && itemId.iId2 == KVcxMvcMediaTypeVideo )
{
VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: Stop wait for item change");
iWaitingForItemChange = EFalse;
@@ -1917,14 +1915,20 @@
{
VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: changeEvent EMPXItemInserted");
iInsertedItemIds.Append( itemId.iId1 );
-
refreshNeeded = ETrue;
- iObserver->HandleVcxMvTesterMessageL( KVCXMYVideosTestMessageMpxItemInserted, KErrNone );
- TRAPD( actionErr, iStats->ActionEndL( KSideloadVideoActionId, KErrNone ) );
- if( actionErr == KErrAbort )
- iObserver->HandleVcxMvTesterMessageL( KVCXMYVideosTestMessageCollectionGeneral, actionErr );
-
+ if( itemId.iId2 == KVcxMvcMediaTypeVideo)
+ {
+ iObserver->HandleVcxMvTesterMessageL( KVCXMYVideosTestMessageMpxVideoInserted, KErrNone );
+ }
+ else if( itemId.iId2 == KVcxMvcMediaTypeCategory )
+ {
+ iObserver->HandleVcxMvTesterMessageL( KVCXMYVideosTestMessageMpxCategoryInserted, KErrNone );
+ }
+ else if( itemId.iId2 == KVcxMvcMediaTypeAlbum )
+ {
+ iObserver->HandleVcxMvTesterMessageL( KVCXMYVideosTestMessageMpxAlbumInserted, KErrNone );
+ }
}
break;
@@ -1933,11 +1937,19 @@
VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: changeEvent EMPXItemDeleted");
iDeletedItemIds.Append( itemId.iId1 );
refreshNeeded = ETrue;
- iObserver->HandleVcxMvTesterMessageL( KVCXMYVideosTestMessageMpxItemDeleted, KErrNone );
- TRAPD( actionErr, iStats->ActionEndL( KRemoveMediaActionId, KErrNone ) );
- if( actionErr == KErrAbort )
- iObserver->HandleVcxMvTesterMessageL( KVCXMYVideosTestMessageCollectionGeneral, actionErr );
+ if( itemId.iId2 == KVcxMvcMediaTypeVideo)
+ {
+ iObserver->HandleVcxMvTesterMessageL( KVCXMYVideosTestMessageMpxVideoDeleted, KErrNone );
+ }
+ else if( itemId.iId2 == KVcxMvcMediaTypeCategory )
+ {
+ iObserver->HandleVcxMvTesterMessageL( KVCXMYVideosTestMessageMpxCategoryDeleted, KErrNone );
+ }
+ else if( itemId.iId2 == KVcxMvcMediaTypeAlbum )
+ {
+ iObserver->HandleVcxMvTesterMessageL( KVCXMYVideosTestMessageMpxAlbumDeleted, KErrNone );
+ }
}
break;
@@ -1945,17 +1957,29 @@
{
VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: changeEvent EMPXItemModified");
refreshNeeded = EFalse;
+
if ( aMessage->IsSupported( KVcxMediaMyVideosInt32Value ) )
{
TInt32 extraInfo = aMessage->ValueTObjectL<TInt32>( KVcxMediaMyVideosInt32Value );
if ( extraInfo == EVcxMyVideosVideoListOrderChanged )
{
- VCXLOGLO1("CVcxMyVideosCollectionTester:: Received EVcxMyVideosVideoListOrderChanged ------->");
+ VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: Received EVcxMyVideosVideoListOrderChanged ------->");
iObserver->HandleVcxMvTesterMessageL( KVCXMyVideosTestMessageVideoListOrderChanged, KErrNone );
refreshNeeded = ETrue;
}
}
- iObserver->HandleVcxMvTesterMessageL( KVCXMYVideosTestMessageMpxItemModified, KErrNone );
+ if( itemId.iId2 == KVcxMvcMediaTypeVideo)
+ {
+ iObserver->HandleVcxMvTesterMessageL( KVCXMYVideosTestMessageMpxVideoModified, KErrNone );
+ }
+ else if( itemId.iId2 == KVcxMvcMediaTypeCategory )
+ {
+ iObserver->HandleVcxMvTesterMessageL( KVCXMYVideosTestMessageMpxCategoryModified, KErrNone );
+ }
+ else if( itemId.iId2 == KVcxMvcMediaTypeAlbum )
+ {
+ iObserver->HandleVcxMvTesterMessageL( KVCXMYVideosTestMessageMpxAlbumModified, KErrNone );
+ }
}
break;
@@ -1967,15 +1991,6 @@
break;
}
- if( itemId.iId2 == 0 )
- {
- iObserver->HandleVcxMvTesterMessageL( KVCXMYVideosTestMessageCollectionItemChanged, KErrNone );
- }
- else
- {
- iObserver->HandleVcxMvTesterMessageL( KVCXMYVideosTestMessageCollectionCategoryChanged, KErrNone );
- }
-
// Refresh if there's need and it's possible.
if( refreshNeeded )
{
@@ -1991,13 +2006,14 @@
VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: Auto refresh disabled");
refreshNeeded = EFalse;
}
-
+#if 0
// No need to refresh if My Videos category is not open.
if( GetCurrentLevel() != 3 )
{
VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: No refresh because level");
refreshNeeded = EFalse;
}
+#endif
if( refreshNeeded )
{
@@ -2024,7 +2040,7 @@
}
// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::HandleOpenL
+// CVCXMyVideosCollectionPluginTester::HandleOpenL
// -----------------------------------------------------------------------------
//
void CVCXMyVideosCollectionPluginTester::HandleOpenL( const CMPXMedia& aEntries,
@@ -2038,12 +2054,6 @@
VCXLOGLO2("CVCXMyVideosCollectionPluginTester:: aError: %d", aError);
SetRefreshStatus( EFalse );
-
- TRAPD( actionErr, iStats->ActionEndL( iCurrentActionId, aError ) );
- if( actionErr == KErrAbort )
- iObserver->HandleVcxMvTesterMessageL( KVCXMYVideosTestMessageCollectionGeneral, actionErr );
-
- iCurrentActionId = -1;
if( aError == KErrNone )
{
@@ -2053,7 +2063,7 @@
iCollectionEntries = CMPXMedia::NewL( aEntries );
iCollectionMediaArray = iCollectionEntries->Value<CMPXMediaArray>( KMPXMediaArrayContents );
-
+
UpdateOwnedMediaArrayL();
// There could have been changes to the content during update.
@@ -2063,7 +2073,7 @@
TInt foundInsertedItemCount(0);
- for( TInt e=0; e<iMediaCount; e++ )
+ for( TInt e = 0; e < iMediaCount; e++ )
{
CMPXMedia* media = (*iMediaArray)[e];
TMPXItemId itemId = *(*media).Value<TMPXItemId>( KMPXMediaGeneralId );
@@ -2121,7 +2131,7 @@
}
// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::HandleOpenL
+// CVCXMyVideosCollectionPluginTester::HandleOpenL
// -----------------------------------------------------------------------------
//
void CVCXMyVideosCollectionPluginTester::HandleOpenL( const CMPXCollectionPlaylist& /*aPlaylist*/,
@@ -2134,7 +2144,7 @@
}
// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::HandleCollectionMediaL
+// CVCXMyVideosCollectionPluginTester::HandleCollectionMediaL
// -----------------------------------------------------------------------------
//
void CVCXMyVideosCollectionPluginTester::HandleCollectionMediaL(const CMPXMedia& aMedia,
@@ -2143,10 +2153,6 @@
VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTester::HandleCollectionMediaL");
VCXLOGLO2("CVCXMyVideosCollectionPluginTester:: aError: %d", aError);
- TRAPD( actionErr, iStats->ActionEndL( KGetMediaFullDetailsActionId, aError ) );
- if( actionErr == KErrAbort )
- iObserver->HandleVcxMvTesterMessageL( KVCXMYVideosTestMessageCollectionGeneral, actionErr );
-
if( iGettingFullDetailsForAllMedia )
{
iActiveWait->Stop();
@@ -2162,7 +2168,7 @@
}
// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::HandleCommandComplete
+// CVCXMyVideosCollectionPluginTester::HandleCommandComplete
// -----------------------------------------------------------------------------
//
void CVCXMyVideosCollectionPluginTester::HandleCommandComplete( CMPXCommand* aCommandResult,
@@ -2189,12 +2195,6 @@
{
transactionId = *aCommandResult->Value<TUint32>( KVcxMediaMyVideosTransactionId );
iTransactions->TransactionResponse( transactionId );
- if( !iCurrentActionHasResponse )
- {
- TRAPD( actionErr, iStats->ActionEndL( transactionId, aError ) );
- if( actionErr == KErrAbort )
- iObserver->HandleVcxMvTesterMessageL( KVCXMYVideosTestMessageCollectionGeneral, actionErr );
- }
}
if( aCommandResult->IsSupported( KMPXCommandGeneralId ) )
@@ -2261,7 +2261,7 @@
}
// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::GetMediaCount
+// CVCXMyVideosCollectionPluginTester::GetMediaCount
// -----------------------------------------------------------------------------
//
TInt CVCXMyVideosCollectionPluginTester::GetMediaCount()
@@ -2296,8 +2296,7 @@
CMPXCommand* cmd = CreateMpxCommandLC( KMPXCommandIdCollectionAdd, 0, aSync );
cmd->SetCObjectValueL(KMPXCommandColAddMedia, aMedia );
- TRAP_IGNORE( iStats->ActionStartL( iTransactions->TransactionId(), _L("Add media") ) );
- iCurrentActionHasResponse = EFalse;
+
iCollectionUtility->Collection().CommandL(*cmd);
CleanupStack::PopAndDestroy( cmd );
@@ -2324,14 +2323,13 @@
PrintMPXMediaL( *aMedia, ETrue );
iCollectionUtility->Collection().CommandL( *cmd );
- TRAP_IGNORE( iStats->ActionStartL( iTransactions->TransactionId(), _L("Set media") ) );
- iCurrentActionHasResponse = EFalse;
+
CleanupStack::PopAndDestroy( cmd );
VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTester::SetMediaL");
}
// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::RemoveMediaL
+// CVCXMyVideosCollectionPluginTester::RemoveMediaL
// -----------------------------------------------------------------------------
//
void CVCXMyVideosCollectionPluginTester::RemoveMediaL( TInt aDrive, TInt aIndex, TBool aSync )
@@ -2345,15 +2343,13 @@
media = (*iCollectionMediaArray)[realIndex];
const TDesC& localFilePath = media->ValueText( KMPXMediaGeneralUri );
- iTestCommon->EnsureFileIsNotInUse( localFilePath );
+ iTestUtils->EnsureFileIsNotInUse( localFilePath );
TMPXItemId itemId = *(media->Value<TMPXItemId>( KMPXMediaGeneralId ));
CMPXCommand* cmd = CreateMpxCommandLC( KMPXCommandIdCollectionRemoveMedia, 0, aSync );
cmd->SetTObjectValueL( KMPXMediaGeneralId, itemId );
- TRAP_IGNORE( iStats->ActionStartL( KRemoveMediaActionId, _L("Remove media") ) );
- iCurrentActionHasResponse = EFalse;
iCollectionUtility->Collection().CommandL( *cmd );
CleanupStack::PopAndDestroy( cmd );
@@ -2362,7 +2358,7 @@
}
// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::RemoveMediaByMpxIdL
+// CVCXMyVideosCollectionPluginTester::RemoveMediaByMpxIdL
// -----------------------------------------------------------------------------
//
void CVCXMyVideosCollectionPluginTester::RemoveMediaByMpxIdL( TInt aMpxId, TBool aSync )
@@ -2374,8 +2370,6 @@
CMPXCommand* cmd = CreateMpxCommandLC( KMPXCommandIdCollectionRemoveMedia, 0, aSync );
cmd->SetTObjectValueL( KMPXMediaGeneralId, aMpxId );
- TRAP_IGNORE( iStats->ActionStartL( iTransactions->TransactionId(), _L("Remove media") ) );
- iCurrentActionHasResponse = EFalse;
iCollectionUtility->Collection().CommandL( *cmd );
CleanupStack::PopAndDestroy( cmd );
@@ -2383,7 +2377,7 @@
}
// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::GetAllMediaFullDetailsL
+// CVCXMyVideosCollectionPluginTester::GetAllMediaFullDetailsL
// -----------------------------------------------------------------------------
//
void CVCXMyVideosCollectionPluginTester::GetAllMediaFullDetailsL()
@@ -2437,7 +2431,7 @@
}
// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::DeleteAllMediaFilesL
+// CVCXMyVideosCollectionPluginTester::DeleteAllMediaFilesL
// -----------------------------------------------------------------------------
//
void CVCXMyVideosCollectionPluginTester::DeleteAllMediaFilesL( )
@@ -2477,7 +2471,7 @@
}
// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::DeleteFileOfMediaL
+// CVCXMyVideosCollectionPluginTester::DeleteFileOfMediaL
// -----------------------------------------------------------------------------
//
void CVCXMyVideosCollectionPluginTester::DeleteFileOfMediaL( TInt aDrive, TInt aIndex )
@@ -2494,7 +2488,7 @@
const TDesC& localFilePath = media->ValueText( KMPXMediaGeneralUri );
VCXLOGLO2("Local file path: %S", &localFilePath);
- iTestCommon->EnsureFileIsNotInUse( localFilePath );
+ iTestUtils->EnsureFileIsNotInUse( localFilePath );
TInt err = iFs.Delete( localFilePath );
if( err != KErrNone )
{
@@ -2510,7 +2504,7 @@
}
// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::GetMediaL
+// CVCXMyVideosCollectionPluginTester::GetMediaL
// -----------------------------------------------------------------------------
//
CMPXMedia* CVCXMyVideosCollectionPluginTester::GetMediaL( TInt aDrive, TInt aIndex )
@@ -2524,7 +2518,41 @@
}
// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::MoveMediasL
+// CVCXMyVideosCollectionPluginTester::GetIndexOfMediaWithNameL
+// -----------------------------------------------------------------------------
+//
+TInt CVCXMyVideosCollectionPluginTester::GetIndexOfMediaWithNameL( const TDesC& aName )
+ {
+ VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTester::GetIndexOfMediaWithNameL");
+ CMPXMedia* media = NULL;
+
+ TInt index = -1;
+
+ if( !iMediaArray )
+ {
+ User::Leave( KErrNotReady );
+ }
+
+ // From last to first
+ for( TInt i = iMediaArray->Count()-1; i >= 0; i-- )
+ {
+ media = (*iMediaArray)[i];
+
+ if( media->IsSupported( KMPXMediaGeneralTitle ) )
+ {
+ if( media->ValueText( KMPXMediaGeneralTitle ).Compare( aName ) == KErrNone )
+ {
+ index = i;
+ break;
+ }
+ }
+ }
+ VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTester::GetIndexOfMediaWithNameL");
+ return index;
+ }
+
+// -----------------------------------------------------------------------------
+// CVCXMyVideosCollectionPluginTester::MoveMediasL
// -----------------------------------------------------------------------------
//
void CVCXMyVideosCollectionPluginTester::MoveMediasL( TInt aSourceDrive, TInt aStartIndex, TInt aEndIndex, TInt aDestDrive, TBool aSync )
@@ -2541,8 +2569,6 @@
cmd->SetCObjectValueL( KMPXMediaArrayContents, medias );
}
- TRAP_IGNORE( iStats->ActionStartL( iTransactions->TransactionId(), _L("Move medias") ) );
- iCurrentActionHasResponse = ETrue;
iCollectionUtility->Collection().CommandL( *cmd );
CleanupStack::PopAndDestroy( cmd );
@@ -2554,7 +2580,7 @@
}
// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::CancelMoveL
+// CVCXMyVideosCollectionPluginTester::CancelMoveL
// -----------------------------------------------------------------------------
//
void CVCXMyVideosCollectionPluginTester::CancelMoveOrCopyL( TBool aSync )
@@ -2562,8 +2588,7 @@
VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTester::CancelMoveOrCopyL");
CMPXCommand* cmd = CreateMpxCommandLC( KVcxCommandIdMyVideos, KVcxCommandMyVideosCancelMoveOrCopy, aSync );
- TRAP_IGNORE( iStats->ActionStartL( iTransactions->TransactionId(), _L("Cancel move or copy") ) );
- iCurrentActionHasResponse = EFalse;
+
iCollectionUtility->Collection().CommandL( *cmd );
CleanupStack::PopAndDestroy( cmd );
@@ -2573,7 +2598,7 @@
}
// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::CopyMediasL
+// CVCXMyVideosCollectionPluginTester::CopyMediasL
// -----------------------------------------------------------------------------
//
void CVCXMyVideosCollectionPluginTester::CopyMediasL( TInt aSourceDrive, TInt aStartIndex, TInt aEndIndex, TInt aDestDrive, TBool aSync )
@@ -2590,8 +2615,6 @@
cmd->SetCObjectValueL( KMPXMediaArrayContents, medias );
}
- TRAP_IGNORE( iStats->ActionStartL( iTransactions->TransactionId(), _L("Copy medias") ) );
- iCurrentActionHasResponse = ETrue;
iCollectionUtility->Collection().CommandL( *cmd );
CleanupStack::PopAndDestroy( cmd );
@@ -2603,7 +2626,7 @@
}
// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::DeleteMediasL
+// CVCXMyVideosCollectionPluginTester::DeleteMediasL
// -----------------------------------------------------------------------------
//
void CVCXMyVideosCollectionPluginTester::DeleteMediasL( TInt aSourceDrive, TInt aStartIndex, TInt aEndIndex, TBool aSync )
@@ -2618,8 +2641,7 @@
{
cmd->SetCObjectValueL( KMPXMediaArrayContents, medias );
}
- TRAP_IGNORE( iStats->ActionStartL( iTransactions->TransactionId(), _L("Delete media") ) );
- iCurrentActionHasResponse = ETrue;
+
iCollectionUtility->Collection().CommandL( *cmd );
CleanupStack::PopAndDestroy( cmd );
@@ -2632,7 +2654,7 @@
// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::DeleteMediasByMpxIdsL
+// CVCXMyVideosCollectionPluginTester::DeleteMediasByMpxIdsL
// -----------------------------------------------------------------------------
//
void CVCXMyVideosCollectionPluginTester::DeleteMediasByMpxIdsL( CMPXMediaArray* aMedias, TBool aSync )
@@ -2652,8 +2674,7 @@
{
cmd->SetCObjectValueL( KMPXMediaArrayContents, aMedias );
}
- TRAP_IGNORE( iStats->ActionStartL( iTransactions->TransactionId(), _L("Delete media") ) );
- iCurrentActionHasResponse = ETrue;
+
iCollectionUtility->Collection().CommandL( *cmd );
CleanupStack::PopAndDestroy( cmd );
@@ -2664,7 +2685,7 @@
}
// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::DeleteMediaByMpxIdL
+// CVCXMyVideosCollectionPluginTester::DeleteMediaByMpxIdL
// -----------------------------------------------------------------------------
//
void CVCXMyVideosCollectionPluginTester::DeleteMediaByMpxIdL( TMPXItemId& aMpxId, TBool aSync )
@@ -2689,8 +2710,7 @@
{
cmd->SetCObjectValueL( KMPXMediaArrayContents, medias );
}
- TRAP_IGNORE( iStats->ActionStartL( iTransactions->TransactionId(), _L("Delete media") ) );
- iCurrentActionHasResponse = ETrue;
+
iCollectionUtility->Collection().CommandL( *cmd );
CleanupStack::PopAndDestroy( cmd );
@@ -2702,7 +2722,7 @@
}
// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::CancelDeleteL
+// CVCXMyVideosCollectionPluginTester::CancelDeleteL
// -----------------------------------------------------------------------------
//
void CVCXMyVideosCollectionPluginTester::CancelDeleteL( TBool aSync )
@@ -2710,8 +2730,7 @@
VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTester::CancelDeleteL");
CMPXCommand* cmd = CreateMpxCommandLC( KVcxCommandIdMyVideos, KVcxCommandMyVideosCancelDelete, aSync );
- TRAP_IGNORE( iStats->ActionStartL( iTransactions->TransactionId(), _L("Cancel delete") ) );
- iCurrentActionHasResponse = EFalse;
+
iCollectionUtility->Collection().CommandL( *cmd );
CleanupStack::PopAndDestroy( cmd );
@@ -2721,7 +2740,179 @@
}
// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::SetAutomaticRefresh
+// CVCXMyVideosCollectionPluginTester::CreateAlbumL
+// -----------------------------------------------------------------------------
+//
+void CVCXMyVideosCollectionPluginTester::CreateAlbumL( const TDesC& aName, TBool aSync, TBool aInvalidCmd )
+ {
+ VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTester::CreateAlbumL");
+
+ CMPXCommand* cmd = CreateMpxCommandLC( KVcxCommandIdMyVideos, KVcxCommandMyVideosAddAlbum, aSync );
+
+ if( !aInvalidCmd )
+ {
+ cmd->SetTextValueL( KMPXMediaGeneralTitle, aName );
+ }
+
+ iCollectionUtility->Collection().CommandL( *cmd );
+ CleanupStack::PopAndDestroy( cmd );
+
+ VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTester::CreateAlbumL");
+ }
+
+// -----------------------------------------------------------------------------
+// CVCXMyVideosCollectionPluginTester::DeleteAlbumsL
+// -----------------------------------------------------------------------------
+//
+void CVCXMyVideosCollectionPluginTester::DeleteAlbumsL( RArray<TPtrC>& aAlbumNames )
+ {
+ VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTester::DeleteAlbumsL");
+
+ CMPXMediaArray* array = CMPXMediaArray::NewL();
+ CleanupStack::PushL( array );
+
+ for( int i = 0; i < aAlbumNames.Count(); i++ )
+ {
+ TMPXItemId albumId;
+ TRAPD(err, albumId = GetAlbumIdL( aAlbumNames[i] ));
+ if( err == KErrNone )
+ {
+ CMPXMedia* album = CMPXMedia::NewL();
+ CleanupStack::PushL( album );
+ album->SetTObjectValueL( KMPXMediaGeneralId, albumId );
+ array->AppendL( *album );
+ CleanupStack::PopAndDestroy( album );
+ }
+ }
+
+ CMPXCommand* cmd = CreateMpxCommandLC( KVcxCommandIdMyVideos, KVcxCommandMyVideosRemoveAlbums, EFalse );
+
+ cmd->SetCObjectValueL( KMPXMediaArrayContents, array );
+
+ iCollectionUtility->Collection().CommandL( *cmd );
+
+ CleanupStack::PopAndDestroy( cmd );
+ CleanupStack::PopAndDestroy( array );
+
+ VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTester::DeleteAlbumsL");
+ }
+
+// -----------------------------------------------------------------------------
+// CVCXMyVideosCollectionPluginTester::DeleteAllAlbumL
+// -----------------------------------------------------------------------------
+//
+void CVCXMyVideosCollectionPluginTester::DeleteAllAlbumsL()
+ {
+ VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTester::DeleteAllAlbumsL");
+
+ CMPXMediaArray* array = CMPXMediaArray::NewL();
+ CleanupStack::PushL( array );
+ CMPXMedia* album;
+
+ for( TInt i = 0; i < iAlbumIds.Count(); i++ )
+ {
+ // TODO: removing photos albums causes fails in opening albums.
+ if( iAlbumIds[i].iId1 > 2 )
+ {
+ album = CMPXMedia::NewL();
+ CleanupStack::PushL( album );
+ album->SetTObjectValueL( KMPXMediaGeneralId, iAlbumIds[i] );
+ array->AppendL( *album );
+ CleanupStack::PopAndDestroy( album );
+ }
+ }
+
+ CMPXCommand* cmd = CreateMpxCommandLC( KVcxCommandIdMyVideos, KVcxCommandMyVideosRemoveAlbums, EFalse );
+
+ cmd->SetCObjectValueL( KMPXMediaArrayContents, array );
+
+ iCollectionUtility->Collection().CommandL( *cmd );
+
+ CleanupStack::PopAndDestroy( cmd );
+ CleanupStack::PopAndDestroy( array );
+
+ VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTester::DeleteAllAlbumsL");
+ }
+
+// -----------------------------------------------------------------------------
+// CVCXMyVideosCollectionPluginTester::AddMediasToAlbumL
+// -----------------------------------------------------------------------------
+//
+void CVCXMyVideosCollectionPluginTester::AddMediasToAlbumL( const TDesC& aAlbumName, TInt aSourceDrive, TInt aStartIndex, TInt aEndIndex )
+ {
+ VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTester::AddMediasToAlbumL");
+
+ TMPXItemId albumId = GetAlbumIdL( aAlbumName );
+
+ CMPXMediaArray* medias = SelectMediasL( aSourceDrive, aStartIndex, aEndIndex );
+ CleanupStack::PushL( medias );
+
+ CMPXCommand* cmd = CreateMpxCommandLC( KVcxCommandIdMyVideos, KVcxCommandMyVideosAddToAlbum, EFalse );
+ if( medias )
+ {
+ cmd->SetCObjectValueL( KMPXMediaArrayContents, medias );
+ }
+
+ cmd->SetTObjectValueL( KVcxMediaMyVideosUint32Value, albumId );
+
+ iCollectionUtility->Collection().CommandL( *cmd );
+
+ CleanupStack::PopAndDestroy( cmd );
+ CleanupStack::PopAndDestroy( medias );
+
+ VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTester::AddMediasToAlbumL");
+ }
+
+// -----------------------------------------------------------------------------
+// CVCXMyVideosCollectionPluginTester::RemoveMediasFromAlbumL
+// -----------------------------------------------------------------------------
+//
+void CVCXMyVideosCollectionPluginTester::RemoveMediasFromAlbumL( const TDesC& aAlbumName, TInt aSourceDrive, TInt aStartIndex, TInt aEndIndex )
+ {
+ VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTester::RemoveMediasFromAlbumL");
+
+ TMPXItemId albumId = GetAlbumIdL( aAlbumName );
+
+ CMPXMediaArray* medias = SelectMediasL( aSourceDrive, aStartIndex, aEndIndex );
+ CleanupStack::PushL( medias );
+
+ CMPXCommand* cmd = CreateMpxCommandLC( KVcxCommandIdMyVideos, KVcxCommandMyVideosRemoveFromAlbum, EFalse );
+ if( medias )
+ {
+ cmd->SetCObjectValueL( KMPXMediaArrayContents, medias );
+ }
+
+ cmd->SetTObjectValueL( KVcxMediaMyVideosUint32Value, albumId );
+
+ iCollectionUtility->Collection().CommandL( *cmd );
+
+ CleanupStack::PopAndDestroy( cmd );
+ CleanupStack::PopAndDestroy( medias );
+
+ VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTester::RemoveMediasFromAlbumL");
+ }
+
+// -----------------------------------------------------------------------------
+// CVCXMyVideosCollectionPluginTester::CheckAlbumCount
+// -----------------------------------------------------------------------------
+//
+bool CVCXMyVideosCollectionPluginTester::CheckAlbumCount( int aExpectedCount )
+ {
+ VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTester::CheckAlbumCount");
+
+ TBool ret( ETrue );
+ if( iAlbumNames.Count() != aExpectedCount )
+ {
+ VCXLOGLO3("<<<CVCXMyVideosCollectionPluginTester::CheckAlbumCount: expected: %d, got: %d, error!", aExpectedCount, iAlbumNames.Count());
+ ret = EFalse;
+ }
+
+ VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTester::CheckAlbumCount");
+ return ret;
+ }
+
+// -----------------------------------------------------------------------------
+// CVCXMyVideosCollectionPluginTester::SetAutomaticRefresh
// -----------------------------------------------------------------------------
//
void CVCXMyVideosCollectionPluginTester::SetAutomaticRefresh( TBool aValue )
@@ -2730,15 +2921,16 @@
}
// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::IsRefreshing
+// CVCXMyVideosCollectionPluginTester::IsRefreshing
// -----------------------------------------------------------------------------
//
TBool CVCXMyVideosCollectionPluginTester::IsRefreshing()
{
return iRefreshingCollection;
}
+
// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::SetQuietMode
+// CVCXMyVideosCollectionPluginTester::SetQuietMode
// -----------------------------------------------------------------------------
//
void CVCXMyVideosCollectionPluginTester::SetQuietMode( TBool aValue )
@@ -2747,376 +2939,7 @@
}
// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::StartDownloadL
-// -----------------------------------------------------------------------------
-//
-void CVCXMyVideosCollectionPluginTester::StartDownloadL( const TDesC& aTitle, TInt aIapId, TInt aServiceId,
- TInt aContentId, const TDesC& aUrl, TBool aSync, const TDesC& aUserName, const TDesC& aPassword,
- CMPXMedia* aMedia )
- {
- VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTester::StartDownloadL");
-
- iUpdateDownloads = ETrue;
- iDownloadsStarted = ETrue;
-
- CMPXCommand* cmd = CreateMpxCommandLC( KVcxCommandIdMyVideos, KVcxCommandMyVideosStartDownload, aSync );
-
- CMPXMedia* startDownloadReq(NULL);
- if( !aMedia )
- {
- startDownloadReq = CMPXMedia::NewL();
- CleanupStack::PushL( startDownloadReq );
- }
- else
- {
- startDownloadReq = aMedia;
- }
-
- //startDownloadReq->SetTObjectValueL( KVcxMediaMyVideosIapId, aIapId );
- startDownloadReq->SetTObjectValueL( KVcxMediaMyVideosIapId, 0 );
-
- // read only iap needed?
- TUint flags = EVcxMyVideosServiceHasReadOnlyIap | EVcxMyVideosSilent;
-
- startDownloadReq->SetTObjectValueL( KMPXMediaGeneralFlags, flags );
-
- VCXLOGLO3("CVCXMyVideosCollectionPluginTester:: UserName: %S, Password: %S.", &aUserName, &aPassword);
-
- startDownloadReq->SetTextValueL( KMPXMediaGeneralTitle, aTitle );
- startDownloadReq->SetTextValueL( KVcxMediaMyVideosRemoteUrl, aUrl );
- startDownloadReq->SetTextValueL( KVcxMediaMyVideosUsername, aUserName);
- startDownloadReq->SetTextValueL( KVcxMediaMyVideosPassword, aPassword);
-
- cmd->SetCObjectValueL<CMPXMedia>( KMPXCommandColAddMedia, startDownloadReq );
-
- iDlWatcher->CreateDownloadL( aIapId, aServiceId, aContentId, aUrl, aSync, aUserName, aPassword );
-
- VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: Making command.");
- iCollectionUtility->Collection().CommandL( *cmd );
-
- if( !aMedia )
- {
- CleanupStack::PopAndDestroy( startDownloadReq );
- }
-
- CleanupStack::PopAndDestroy( cmd );
-
- VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTester::StartDownloadL");
- }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::ResumeDownloadL
-// -----------------------------------------------------------------------------
-//
-void CVCXMyVideosCollectionPluginTester::ResumeDownloadL( const TDesC& aTitle, TInt aIapId, TInt aServiceId,
- TInt aContentId, const TDesC& aUrl, TBool aSync, const TDesC& aUserName, const TDesC& aPassword,
- CMPXMedia* aMedia
- )
- {
- VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTester::ResumeDownloadL");
-
- iUpdateDownloads = ETrue;
- iDownloadsStarted = ETrue;
-
- CMPXCommand* cmd = CreateMpxCommandLC( KVcxCommandIdMyVideos, KVcxCommandMyVideosStartDownload, aSync );
-
- CMPXMedia* startDownloadReq(NULL);
- if( !aMedia )
- {
- startDownloadReq = CMPXMedia::NewL();
- CleanupStack::PushL( startDownloadReq );
- }
- else
- {
- startDownloadReq = aMedia;
- }
-
- //startDownloadReq->SetTObjectValueL( KVcxMediaMyVideosIapId, aIapId );
- startDownloadReq->SetTObjectValueL( KVcxMediaMyVideosIapId, 0 );
-
- // read only iap needed?
- TUint flags = EVcxMyVideosServiceHasReadOnlyIap | EVcxMyVideosSilent;
-
- startDownloadReq->SetTObjectValueL( KMPXMediaGeneralFlags, flags );
-
- startDownloadReq->SetTextValueL( KMPXMediaGeneralTitle, aTitle );
- startDownloadReq->SetTextValueL( KVcxMediaMyVideosRemoteUrl, aUrl );
- startDownloadReq->SetTextValueL( KVcxMediaMyVideosUsername, aUserName);
- startDownloadReq->SetTextValueL( KVcxMediaMyVideosPassword, aPassword);
-
- cmd->SetCObjectValueL<CMPXMedia>( KMPXCommandColAddMedia, startDownloadReq );
-
- CVCXMyVideosTestDownload* dl = iDlWatcher->GetDownload( aServiceId, aContentId, aUrl );
- if( dl )
- {
- startDownloadReq->SetTObjectValueL( KVcxMediaMyVideosDownloadId, dl->iDownloadId );
-
- TMPXItemId itemId;
- itemId.iId1 = dl->iMpxId;
- itemId.iId2 = 0;
- startDownloadReq->SetTObjectValueL( KMPXMediaGeneralId, itemId );
-
- dl->iInformed = EFalse;
- dl->iWaitingPause = EFalse;
- }
- else
- {
- startDownloadReq->SetTObjectValueL( KVcxMediaMyVideosDownloadId, 6666 );
- iDlWatcher->CreateDownloadL( aIapId, aServiceId, aContentId, aUrl, aSync, aUserName, aPassword );
- }
-
- EnsureMediaFilesAreNotInUseL();
-
- VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: Making command.");
- TRAP_IGNORE( iStats->ActionStartL( iTransactions->TransactionId(), _L("Resume download") ) );
- iCurrentActionHasResponse = EFalse;
- iCollectionUtility->Collection().CommandL( *cmd );
-
- if( !aMedia )
- {
- CleanupStack::PopAndDestroy( startDownloadReq );
- }
-
- CleanupStack::PopAndDestroy( cmd );
-
- VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTester::ResumeDownloadL");
- }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::ResumeAllDownloadsL
-// -----------------------------------------------------------------------------
-//
-void CVCXMyVideosCollectionPluginTester::ResumeAllDownloadsL()
- {
- VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTester::ResumeAllDownloadsL");
-
- iUpdateDownloads = ETrue;
- iDownloadsStarted = ETrue;
-
- for( TInt i = 0; i < iDlWatcher->GetDownloadCount(); i++ )
- {
- CVCXMyVideosTestDownload* dl;
- dl = iDlWatcher->GetDownloadByIndex( i );
- if( dl && dl->iState == EVcxMyVideosDlStatePaused )
- {
- ResumeDownloadL( _L("resume"), dl->iIapId, dl->iServiceId, dl->iContentId, *dl->iUrl, dl->iSyncCall, *dl->iUserName, *dl->iPassword, NULL );
- }
- }
-
- VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTester::ResumeAllDownloadsL");
- }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::CancelDownloadL
-// -----------------------------------------------------------------------------
-//
-void CVCXMyVideosCollectionPluginTester::CancelDownloadL( CVCXMyVideosTestDownload* aDownload, TBool aSync )
- {
- VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTester::CancelDownloadL");
-
- if( !aDownload )
- {
- User::Leave( KErrArgument );
- }
-
- iUpdateDownloads = ETrue;
-
- CMPXCommand* cmd = CreateMpxCommandLC( KVcxCommandIdMyVideos, KVcxCommandMyVideosCancelDownload, aSync );
-
- CMPXMedia* cancelDownloadReq = CMPXMedia::NewL();
- CleanupStack::PushL( cancelDownloadReq );
-
- cancelDownloadReq->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, TMPXItemId ( aDownload->iMpxId, 0 ) );
- cancelDownloadReq->SetTObjectValueL<TUint32>( KVcxMediaMyVideosDownloadId, aDownload->iDownloadId );
- cancelDownloadReq->SetTextValueL( KMPXMediaGeneralUri, aDownload->iPath->Des() );
-
- cmd->SetCObjectValueL<CMPXMedia>( KMPXCommandColAddMedia, cancelDownloadReq );
-
- iDlWatcher->CancelDownloadL( aDownload->iServiceId, aDownload->iContentId, *aDownload->iUrl );
-
- VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: Making command.");
- TRAP_IGNORE( iStats->ActionStartL( iTransactions->TransactionId(), _L("Cancel download") ) );
- iCurrentActionHasResponse = EFalse;
- iCollectionUtility->Collection().CommandL( *cmd );
-
- CleanupStack::PopAndDestroy( cancelDownloadReq );
- CleanupStack::PopAndDestroy( cmd );
-
- VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTester::CancelDownloadL");
- }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::CancelDownloadL
-// -----------------------------------------------------------------------------
-//
-void CVCXMyVideosCollectionPluginTester::CancelDownloadL( TInt aMpxId, TInt aDownloadId, const TPtrC& aDownloadPath, TBool aSync )
- {
- VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTester::CancelDownloadL (by IDs)");
-
- iUpdateDownloads = ETrue;
-
- CMPXCommand* cmd = CreateMpxCommandLC( KVcxCommandIdMyVideos, KVcxCommandMyVideosCancelDownload, aSync );
-
- CMPXMedia* cancelDownloadReq = CMPXMedia::NewL();
- CleanupStack::PushL( cancelDownloadReq );
-
- CVCXMyVideosTestDownload* dl = iDlWatcher->GetDownloadByIndex(0);
-
- TPtrC downloadPath( aDownloadPath );
-
- if( aMpxId == -1 && dl )
- {
- aMpxId = dl->iMpxId;
- }
-
- if( aDownloadId == -1 && dl )
- {
- aDownloadId = dl->iDownloadId;
- }
-
- if( aDownloadPath == _L("NULL") && dl )
- {
- downloadPath.Set( *dl->iPath );
- }
-
- VCXLOGLO2("CVCXMyVideosCollectionPluginTester:: mpxId: %d", aMpxId);
- VCXLOGLO2("CVCXMyVideosCollectionPluginTester:: downloadId: %d", aDownloadId);
- VCXLOGLO2("CVCXMyVideosCollectionPluginTester:: downloadPath: %S", &aDownloadPath);
-
- cancelDownloadReq->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, TMPXItemId ( aMpxId, 0 ) );
- cancelDownloadReq->SetTObjectValueL<TUint32>( KVcxMediaMyVideosDownloadId, aDownloadId );
- cancelDownloadReq->SetTextValueL( KMPXMediaGeneralUri, downloadPath );
-
- cmd->SetCObjectValueL<CMPXMedia>( KMPXCommandColAddMedia, cancelDownloadReq );
-
- VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: Making command.");
- TRAP_IGNORE( iStats->ActionStartL( iTransactions->TransactionId(), _L("Cancel download") ) );
- iCurrentActionHasResponse = EFalse;
- iCollectionUtility->Collection().CommandL( *cmd );
-
- CleanupStack::PopAndDestroy( cancelDownloadReq );
- CleanupStack::PopAndDestroy( cmd );
-
- VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTester::CancelDownloadL");
- }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::PauseDownloadL
-// -----------------------------------------------------------------------------
-//
-void CVCXMyVideosCollectionPluginTester::PauseDownloadL( TInt aServiceId, TInt aContentId, const TDesC& aUrl, TBool aSync )
- {
- VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTester::PauseDownloadL");
-
- iUpdateDownloads = ETrue;
-
- CVCXMyVideosTestDownload* dl = iDlWatcher->GetDownload( aServiceId, aContentId, aUrl );
- if( dl )
- {
- dl->iWaitingPause = ETrue;
- }
- else
- {
- VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: Download not found!");
- User::Leave( KErrNotFound );
- }
- CMPXCommand* cmd = CreateMpxCommandLC( KVcxCommandIdMyVideos, KVcxCommandMyVideosPauseDownload, aSync );
-
- cmd->SetTObjectValueL( KVcxMediaMyVideosDownloadId, dl->iDownloadId );
-
- VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: Making command.");
- TRAP_IGNORE( iStats->ActionStartL( iTransactions->TransactionId(), _L("Pause download") ) );
- iCurrentActionHasResponse = EFalse;
- iCollectionUtility->Collection().CommandL( *cmd );
-
- CleanupStack::PopAndDestroy( cmd );
- VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTester::PauseDownloadL");
- }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::PauseDownloadL
-// -----------------------------------------------------------------------------
-//
-void CVCXMyVideosCollectionPluginTester::PauseDownloadL( const TDesC& aUrl, TBool aSync )
- {
- VCXLOGLO1(">>>CVCXMyVideosCollectionPluginTester::PauseDownloadL");
-
- iUpdateDownloads = ETrue;
-
- CMPXCommand* cmd = CreateMpxCommandLC( KVcxCommandIdMyVideos, KVcxCommandMyVideosPauseDownload, aSync );
-
- CVCXMyVideosTestDownload* dl = iDlWatcher->GetDownload( aUrl );
- if( !dl )
- {
- VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: Download not found!");
- User::Leave( KErrNotFound );
- }
- else
- {
- dl->iWaitingPause = ETrue;
- }
-
-
- cmd->SetTObjectValueL( KVcxMediaMyVideosDownloadId, dl->iDownloadId );
-
- VCXLOGLO1("CVCXMyVideosCollectionPluginTester:: Making command.");
- TRAP_IGNORE( iStats->ActionStartL( iTransactions->TransactionId(), _L("Pause download") ) );
- iCurrentActionHasResponse = EFalse;
- iCollectionUtility->Collection().CommandL( *cmd );
-
- CleanupStack::PopAndDestroy( cmd );
- VCXLOGLO1("<<<CVCXMyVideosCollectionPluginTester::PauseDownloadL");
- }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::GetDownloadWatcher
-// -----------------------------------------------------------------------------
-//
-CVCXMyVideosTestDlWatcher* CVCXMyVideosCollectionPluginTester::GetDownloadWatcher()
- {
- return iDlWatcher;
- }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::GetActiveDownloadCountL
-// -----------------------------------------------------------------------------
-//
-TInt CVCXMyVideosCollectionPluginTester::GetActiveDownloadCountL()
- {
- TInt count = 0;
-
- CMPXMedia* media ( NULL );
- for( TInt i = 0; i < iMediaArray->Count(); i++ )
- {
- media = (*iMediaArray)[i];
-
- if( media->IsSupported( KVcxMediaMyVideosDownloadState ) )
- {
- TInt state = media->ValueTObjectL<TUint8>( KVcxMediaMyVideosDownloadState );
-
- if( state == EVcxMyVideosDlStateDownloading || ( state == EVcxMyVideosDlStatePaused && iAutoResume ) )
- {
- count++;
- }
- }
- }
-
- VCXLOGLO2(">>>CVCXMyVideosCollectionPluginTester:: Active downloads: %d", count);
-
- return count;
- }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::SetAutoResume
-// -----------------------------------------------------------------------------
-//
-void CVCXMyVideosCollectionPluginTester::SetAutoResume( TBool aValue )
- {
- iAutoResume = aValue;
- }
-
-// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::GetCurrentLevel
+// CVCXMyVideosCollectionPluginTester::GetCurrentLevel
// -----------------------------------------------------------------------------
//
TInt CVCXMyVideosCollectionPluginTester::GetCurrentLevel()
@@ -3133,7 +2956,7 @@
}
// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::GetCurrentOpenLevelIndex
+// CVCXMyVideosCollectionPluginTester::GetCurrentOpenLevelIndex
// -----------------------------------------------------------------------------
//
TInt CVCXMyVideosCollectionPluginTester::GetCurrentOpenLevelIndex()
@@ -3142,7 +2965,7 @@
}
// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::GetLastFullMedia
+// CVCXMyVideosCollectionPluginTester::GetLastFullMedia
// -----------------------------------------------------------------------------
//
CMPXMedia* CVCXMyVideosCollectionPluginTester::GetLastFullMedia()
@@ -3151,7 +2974,7 @@
}
// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::GetMediaIndexInCollectionL
+// CVCXMyVideosCollectionPluginTester::GetMediaIndexInCollectionL
// -----------------------------------------------------------------------------
//
TInt CVCXMyVideosCollectionPluginTester::GetMediaIndexInCollectionL( TInt aDrive, TInt aIndex )
@@ -3231,7 +3054,7 @@
}
// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::GetVideoCountForDrive
+// CVCXMyVideosCollectionPluginTester::GetVideoCountForDrive
// -----------------------------------------------------------------------------
//
TInt CVCXMyVideosCollectionPluginTester::GetVideoCountForDrive( TInt aDrive )
@@ -3260,7 +3083,7 @@
}
// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::GetAllCollectionMedia
+// CVCXMyVideosCollectionPluginTester::GetAllCollectionMedia
// -----------------------------------------------------------------------------
//
const CMPXMediaArray* CVCXMyVideosCollectionPluginTester::GetAllCollectionMedia()
@@ -3269,7 +3092,7 @@
}
// -----------------------------------------------------------------------------
-// CVcxMyVideosCollectionTester::EnsureMediaFilesAreNotInUseL
+// CVCXMyVideosCollectionPluginTester::EnsureMediaFilesAreNotInUseL
// -----------------------------------------------------------------------------
//
void CVCXMyVideosCollectionPluginTester::EnsureMediaFilesAreNotInUseL()
@@ -3282,8 +3105,6 @@
const TInt KEnsureMediasNotInUseID = 1234567;
- TRAP_IGNORE( iStats->ActionStartL( KEnsureMediasNotInUseID, _L("Ensure files.") ) );
-
TBool filesLocked( ETrue );
// Check all files that they are not in use, retry few times.
while( --retries >= 0 && filesLocked )
@@ -3312,72 +3133,11 @@
if( error != KErrNone && error != KErrNotFound && error != KErrBadName )
{
- TRAP_IGNORE( iStats->ActionEndL( KEnsureMediasNotInUseID, error ) );
VCXLOGLO2("CVCXMyVideosCollectionPluginTester::EnsureMediaFilesAreNotInUseL: error: %d", error);
User::Leave( error );
}
- else
- {
- TRAP_IGNORE( iStats->ActionEndL( KEnsureMediasNotInUseID, KErrNone ) );
- }
VCXLOGLO1("CVCXMyVideosCollectionPluginTester::EnsureMediaFilesAreNotInUseL: All ok.");
}
-
-// -----------------------------------------------------------------------------
-// CVCXMyVideosCollectionPluginTester::TimerComplete
-// -----------------------------------------------------------------------------
-//
-void CVCXMyVideosCollectionPluginTester::TimerComplete( TInt /* aTimerId */, TInt /* aError */ )
- {
- if( iProgressTimer )
- {
- iProgressTimer->After( 1000000 );
- }
-
- if( !iMediaArray || !iDlWatcher )
- {
- return;
- }
-
- if( iDownloadsStarted && iUpdateDownloads && GetCurrentLevel() == 3 )
- {
- // Print short info about downloads
- CMPXMedia* media( NULL );
-
- VCXLOGLO2("CVCXMyVideosCollectionPluginTester::TimerComplete: medias: %d", iMediaArray->Count());
- for( TInt i = 0; i < iMediaArray->Count(); i++ )
- {
- media = (*iMediaArray)[i];
-
- if( media->IsSupported( KVcxMediaMyVideosDownloadState ) )
- {
- TInt state = media->ValueTObjectL<TUint8>( KVcxMediaMyVideosDownloadState );
-
- TMPXItemId itemId = *(media->Value<TMPXItemId>( KMPXMediaGeneralId ));
-
- TInt progress = -1;
- if( media->IsSupported( KVcxMediaMyVideosDownloadProgress ) )
- {
- progress = media->ValueTObjectL<TInt8>( KVcxMediaMyVideosDownloadProgress );
- }
-
- TUint32 downloadId = 0;
- if( media->IsSupported( KVcxMediaMyVideosDownloadId ) )
- {
- downloadId = media->ValueTObjectL<TUint32>( KVcxMediaMyVideosDownloadId );
- }
-
- CVCXMyVideosTestDownload* dl = iDlWatcher->GetDownloadByMpxId( itemId.iId1 );
-
- if( dl )
- {
-// VCXLOGLO5("CVCXMyVideosCollectionPluginTester:: DL ID: %d, MPX ID: %d, state: %d, progress: %d", downloadId, itemId.iId1, state, progress );
-// VCXLOGLO3("CVCXMyVideosCollectionPluginTester:: serviceId: %d, contentId: %d", dl->iServiceId, dl->iContentId );
- iDlWatcher->UpdateDownloadProgressL( itemId.iId1, downloadId, progress );
- }
- }
- }
- }
- }
+
// End of File
--- a/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/src/VCXMyVideosTestTransactions.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/src/VCXMyVideosTestTransactions.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -11,10 +11,9 @@
*
* Contributors:
*
-* Description: ?Description*
+* Description:
*/
-
// INCLUDE FILES
#include "VCXMyVideosTestTransactions.h"
#include "VCXTestLog.h"
@@ -24,7 +23,7 @@
// ============================ MEMBER FUNCTIONS ===============================
// -----------------------------------------------------------------------------
-// CVCXMyVideosTestDlWatcher::NewL
+// CVCXMyVideosTestTransactions::NewL
// -----------------------------------------------------------------------------
//
CVCXMyVideosTestTransactions* CVCXMyVideosTestTransactions::NewL()
@@ -56,7 +55,7 @@
}
// -----------------------------------------------------------------------------
-// CVCXMyVideosTestDlWatcher::ConstructL
+// CVCXMyVideosTestTransactions::ConstructL
// -----------------------------------------------------------------------------
//
void CVCXMyVideosTestTransactions::ConstructL( )
@@ -67,7 +66,7 @@
}
// -----------------------------------------------------------------------------
-// CVCXMyVideosTestDlWatcher::TransactionId
+// CVCXMyVideosTestTransactions::TransactionId
// -----------------------------------------------------------------------------
//
TUint32 CVCXMyVideosTestTransactions::TransactionId( )
@@ -76,7 +75,7 @@
}
// -----------------------------------------------------------------------------
-// CVCXMyVideosTestDlWatcher::NextTransactionId
+// CVCXMyVideosTestTransactions::NextTransactionId
// -----------------------------------------------------------------------------
//
TUint32 CVCXMyVideosTestTransactions::NextTransactionId()
@@ -85,7 +84,7 @@
}
// -----------------------------------------------------------------------------
-// CVCXMyVideosTestDlWatcher::AddTransactionId
+// CVCXMyVideosTestTransactions::AddTransactionId
// -----------------------------------------------------------------------------
//
void CVCXMyVideosTestTransactions::AddTransactionId( TUint32 aCommandId )
@@ -96,7 +95,7 @@
}
// -----------------------------------------------------------------------------
-// CVCXMyVideosTestDlWatcher::TransactionResponse
+// CVCXMyVideosTestTransactions::TransactionResponse
// -----------------------------------------------------------------------------
//
TBool CVCXMyVideosTestTransactions::TransactionResponse( TUint32 aTransactionId )
@@ -118,7 +117,7 @@
}
// -----------------------------------------------------------------------------
-// CVCXMyVideosTestDlWatcher::CheckTransactions
+// CVCXMyVideosTestTransactions::CheckTransactions
// -----------------------------------------------------------------------------
//
TInt CVCXMyVideosTestTransactions::CheckTransactions( )
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/src/VCXMyVideosTestUtils.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,321 @@
+/*
+* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "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:
+*/
+
+// INCLUDE FILES
+#include "VCXMyVideosTestUtils.h"
+#include "VCXTestLog.h"
+
+// CONSTANTS
+
+// ============================ MEMBER FUNCTIONS ===============================
+
+// -----------------------------------------------------------------------------
+// CVCXMyVideosTestUtils::NewL
+// -----------------------------------------------------------------------------
+//
+CVCXMyVideosTestUtils* CVCXMyVideosTestUtils::NewL()
+ {
+ VCXLOGLO1(">>>CVCXMyVideosTestUtils::NewL");
+ CVCXMyVideosTestUtils* self = new (ELeave) CVCXMyVideosTestUtils();
+ CleanupStack::PushL(self);
+ self->ConstructL( );
+ CleanupStack::Pop(self);
+ VCXLOGLO1("<<<CVCXMyVideosTestUtils::NewL");
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// CVCXMyVideosTestUtils::CVCXMyVideosTestUtils
+// -----------------------------------------------------------------------------
+//
+CVCXMyVideosTestUtils::CVCXMyVideosTestUtils()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// CVCXMyVideosTestUtils::~CVCXMyVideosTestUtils
+// -----------------------------------------------------------------------------
+//
+CVCXMyVideosTestUtils::~CVCXMyVideosTestUtils( )
+ {
+ delete iFileMan;
+ iFileMan = NULL;
+ iFs.Close();
+ }
+
+// -----------------------------------------------------------------------------
+// CVCXMyVideosTestUtils::ConstructL
+// -----------------------------------------------------------------------------
+//
+void CVCXMyVideosTestUtils::ConstructL( )
+ {
+ VCXLOGLO1(">>>CVCXMyVideosTestUtils::ConstructL");
+ User::LeaveIfError( iFs.Connect() );
+ iFileMan = CFileMan::NewL( iFs );
+ VCXLOGLO1("<<<CVCXMyVideosTestUtils::ConstructL");
+ }
+
+// -----------------------------------------------------------------------------
+// CVCXMyVideosTestUtils::EnsureFileIsNotInUse
+// -----------------------------------------------------------------------------
+//
+TInt CVCXMyVideosTestUtils::EnsureFileIsNotInUse( const TPtrC& aFileName )
+ {
+ TInt error( KErrNone );
+ RFile file;
+
+ for(TInt retry = 0; retry < 6; retry++)
+ {
+ error = file.Open(iFs, aFileName, EFileShareExclusive);
+ if( error == KErrInUse )
+ {
+ User::After( 1000000 * 10 );
+ }
+ else
+ {
+ break;
+ }
+ }
+
+ file.Close();
+ VCXLOGLO2("CVCXTestCommon::EnsureFileIsNotInUse: %d", error);
+ return error;
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVCXMyVideosTestUtils::CreateVideoFilesL
+// -----------------------------------------------------------------------------
+//
+void CVCXMyVideosTestUtils::CreateVideoFileL( TVcxTestVideoType aVideoType, TDesC& aFileName, TInt aSize )
+ {
+ VCXLOGLO1(">>>CVcxTestVideoCreator::CreateVideoL");
+
+ // Resolve source filename
+ TBuf<256> srcFileName;
+
+ GetVideoFile( srcFileName, aVideoType, _L("C") );
+ if( !BaflUtils::FileExists(iFs, srcFileName) )
+ {
+ VCXLOGLO2("CVcxTestVideoCreator:: %S does not exist.", &srcFileName);
+ GetVideoFile( srcFileName, aVideoType, _L("E") );
+ if( !BaflUtils::FileExists(iFs, srcFileName) )
+ {
+ VCXLOGLO2("CVcxTestVideoCreator:: %S does not exist.", &srcFileName);
+ VCXLOGLO2("CVcxTestVideoCreator:: test video file %S missing! PANIC.", &srcFileName);
+ User::Panic(_L("Video files missing!"), KErrNotFound);
+ }
+ }
+
+ BaflUtils::EnsurePathExistsL( iFs, aFileName.Left( aFileName.LocateReverse('\\') ) );
+
+ BaflUtils::DeleteFile( iFs, aFileName );
+
+ VCXLOGLO2("CVcxTestVideoCreator:: aSize = %d", aSize);
+
+ TInt64 wantedSize( 0 );
+
+ // Check the size
+ if( aSize == KVcxTestLargeFile3GB ) {
+ wantedSize = 1024*1024*1024 * 3;
+ }
+ else {
+ wantedSize = aSize;
+ }
+
+ //wantedSize = wantedSize == 0 ? wantedSize -1 : wantedSize;
+
+ VCXLOGLO2("CVcxTestVideoCreator:: Wanted file size: %Ld", wantedSize);
+
+ // Read source file into memory, won't work on huge files.
+ RFile64 srcFile;
+ VCXLOGLO2("CVcxTestVideoCreator:: Opening %S", &srcFileName);
+ User::LeaveIfError( srcFile.Open( iFs, srcFileName, EFileRead ) );
+ CleanupClosePushL( srcFile );
+
+ TInt64 srcSize(0);
+ VCXLOGLO2("CVcxTestVideoCreator:: Getting size of %S", &srcFileName);
+ User::LeaveIfError( srcFile.Size( srcSize ) );
+
+ HBufC8* data = HBufC8::NewL( srcSize );
+ TPtr8 ptr( data->Des() );
+ srcFile.Read( ptr, srcSize );
+ CleanupStack::PopAndDestroy( &srcFile );
+
+ CleanupStack::PushL( data );
+
+ // Write new file.
+ RFile64 dstFile;
+ VCXLOGLO1("CVcxTestVideoCreator:: Replace");
+ User::LeaveIfError( dstFile.Replace( iFs, aFileName, EFileWrite ) );
+ CleanupClosePushL(dstFile);
+
+ if( wantedSize <= srcSize )
+ {
+ if( wantedSize == -1 )
+ {
+ VCXLOGLO2("CVcxTestVideoCreator:: Writing %Ld", srcSize);
+ User::LeaveIfError( dstFile.Write( *data, srcSize ) );
+ }
+ else
+ {
+ VCXLOGLO2("CVcxTestVideoCreator:: Writing %Ld", wantedSize);
+ User::LeaveIfError( dstFile.Write( *data, wantedSize ) );
+ }
+ }
+ else
+ {
+ VCXLOGLO2("CVcxTestVideoCreator:: Writing %Ld", srcSize);
+ User::LeaveIfError( dstFile.Write( *data, srcSize ) );
+
+ const TInt KVcxTest200Kilos = 1024*200;
+ HBufC8* buff = HBufC8::NewL( KVcxTest200Kilos );
+ buff->Des().SetLength( KVcxTest200Kilos );
+ CleanupStack::PushL( buff );
+ TInt64 bytesToWrite = wantedSize - srcSize;
+ while( bytesToWrite > 0 )
+ {
+ if( bytesToWrite >= KVcxTest200Kilos )
+ {
+ bytesToWrite -= KVcxTest200Kilos;
+ User::LeaveIfError( dstFile.Write( *buff ) );
+ }
+ else
+ {
+ User::LeaveIfError( dstFile.Write( *buff, bytesToWrite ) );
+ bytesToWrite = 0;
+ }
+ }
+ CleanupStack::PopAndDestroy( buff );
+ }
+
+ CleanupStack::PopAndDestroy( &dstFile );
+ CleanupStack::PopAndDestroy( data );
+
+ VCXLOGLO1("<<<CVcxTestVideoCreator::CreateVideoL");
+ }
+
+
+// -----------------------------------------------------------------------------
+// CVCXMyVideosTestUtils::CreateVideoFilesL
+// -----------------------------------------------------------------------------
+//
+void CVCXMyVideosTestUtils::CreateVideoFilesL( TVcxTestVideoType aVideoType, TDesC& aFileName, TInt aCount, RPointerArray<HBufC>& aFileArray )
+ {
+ VCXLOGLO1(">>>CVcxTestVideoCreator::CreateVideosL");
+
+ // Resolve source filename
+ TBuf<256> srcFileName;
+
+ GetVideoFile( srcFileName, aVideoType, _L("C") );
+
+ if( !BaflUtils::FileExists(iFs, srcFileName) )
+ {
+ VCXLOGLO2("CVcxTestVideoCreator:: %S does not exist.", &srcFileName);
+ GetVideoFile( srcFileName, aVideoType, _L("E") );
+ if( !BaflUtils::FileExists(iFs, srcFileName) )
+ {
+ VCXLOGLO2("CVcxTestVideoCreator:: %S does not exist.", &srcFileName);
+ VCXLOGLO2("CVcxTestVideoCreator:: test video file %S missing! PANIC.", &srcFileName);
+ // Comment next line if you want dummy files to be created. They won't be recognized by MDS.
+ User::Panic(_L("Video files missing!"), KErrNotFound);
+ }
+ }
+
+ TBool fileExists = BaflUtils::FileExists(iFs, srcFileName);
+
+ HBufC* newFileName = HBufC::NewL( 256 );
+ CleanupStack::PushL( newFileName );
+
+ newFileName->Des().Copy( aFileName.Left( aFileName.LocateReverse('\\') ) );
+ BaflUtils::EnsurePathExistsL(iFs, *newFileName);
+
+ TInt dotPos = aFileName.LocateReverse('.');
+
+ for( TInt i = 0; i < aCount; i++ )
+ {
+ newFileName->Des().Copy( aFileName.Left( dotPos ) );
+ newFileName->Des().Append( _L("_") );
+ newFileName->Des().AppendNum( i );
+ newFileName->Des().Append( aFileName.Right( aFileName.Length() - dotPos ) );
+
+ HBufC* fileForClient = newFileName->Des().AllocL();
+ aFileArray.Append( fileForClient );
+
+ if( fileExists )
+ {
+ User::LeaveIfError( iFileMan->Copy(srcFileName, *newFileName) );
+ VCXLOGLO2("CVcxTestVideoCreator:: copy file: '%S'", newFileName);
+ }
+ else
+ {
+ VCXLOGLO2("CVcxTestVideoCreator:: new fake file: '%S'", newFileName);
+ RFile file;
+ CleanupClosePushL(file);
+ User::LeaveIfError( file.Replace(iFs, *newFileName, EFileWrite) );
+ User::LeaveIfError( file.SetSize( 1024*10 ) );
+ CleanupStack::PopAndDestroy( &file );
+ }
+ User::After( 100000 ); // Wait tenth of a second.
+ }
+
+ CleanupStack::PopAndDestroy( newFileName );
+
+ VCXLOGLO1("<<<CVcxTestVideoCreator::CreateVideosL");
+ }
+
+// -----------------------------------------------------------------------------
+// CVCXMyVideosTestUtils::GetVideoFile
+// -----------------------------------------------------------------------------
+//
+void CVCXMyVideosTestUtils::GetVideoFile( TDes& aFileName, CVCXMyVideosTestUtils::TVcxTestVideoType aVideoType, const TDesC& aDrive )
+ {
+ VCXLOGLO1(">>>CVcxTestVideoCreator::GetVideoFile");
+ aFileName.Copy( aDrive );
+
+ _LIT(KVcxTestVideoBasePath, ":\\testing\\data\\");
+
+ aFileName.Append( KVcxTestVideoBasePath );
+
+ VCXLOGLO2("CVcxTestVideoCreator::GetVideoFile -- using %S", &aFileName);
+
+ switch (aVideoType)
+ {
+ case VcxTestVideo3Gp:
+ {
+ aFileName.Append( _L("video_3gp.xxx") );
+ }
+ break;
+
+ case VcxTestVideoMpeg4:
+ {
+ aFileName.Append( _L("video_mpeg4.xxx") );
+ }
+ break;
+
+ case VcxTestVideoWmv:
+ {
+ aFileName.Append( _L("video_wmv.xxx") );
+ }
+ break;
+
+ default:
+ User::Panic(_L("VcxMyVideosApiTest: Unknown video type!"), KErrCorrupt);
+ }
+ VCXLOGLO1("<<<CVcxTestVideoCreator::GetVideoFile");
+ }
+
+// End of File
--- a/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/src/VCXTestMdsDbModifier.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/src/VCXTestMdsDbModifier.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -11,10 +11,9 @@
*
* Contributors:
*
-* Description: ?Description*
+* Description:
*/
-
// Copied from vcxmyvideosmdsdb.cpp, keep up to date.
//#include <harvesterclient.h>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/centralrepository.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,111 @@
+/*
+* 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 central repository -class for testing CVideoCollectionClient
+*
+*/
+
+#ifndef __CENTRALREPOSITORY_H__
+#define __CENTRALREPOSITORY_H__
+
+#include <e32base.h>
+
+
+class CRepository
+{
+public:
+
+ /**
+ * sets gCRNewLLeave
+ */
+ static void setNewLLeave(bool leave);
+
+ /**
+ * sets gCRSetFail
+ */
+ static void setSetFail(int amount);
+
+ /**
+ * sets gCRGetFail
+ */
+ static void setGetFail(int amount);
+
+ /**
+ * gets gSettedRoleValue;
+ */
+ static int getRoleValue();
+
+ /**
+ * gets gSettedOrderValue;
+ */
+ static int getOrderValue();
+
+ /**
+ * gets gSettedTDesValue;
+ */
+ static TDesC& getTDesValue();
+
+ /**
+ * sets gSettedRoleValue;
+ */
+ static void setRoleValue(int value);
+
+ /**
+ * sets gSettedOrderValue;
+ */
+ static void setOrderValue(int value);
+
+ /**
+ * sets gSettedTDesValue;
+ */
+ static void setTDesValue(const TDesC& value);
+
+ /**
+ * if gCRNewLLeave is true, will leave
+ * if gCRNewLLeave is false returns new CRepository
+ */
+ static CRepository* NewL(TUid aRepositoryUid);
+
+ /**
+ * contructor
+ */
+ CRepository();
+
+ /**
+ * destructor
+ */
+ virtual ~CRepository();
+
+ /**
+ * if gCRGetFail is true, returns KErrGeneral
+ * if gCRGetFail is false, returns gSettedValue and returns KErrNone
+ */
+ TInt Get(TUint32 aKey, TInt& aValue);
+
+ /**
+ * if gCRSetFail is true, returns KErrGeneral
+ * if gCRSetFail is false, saves value to gSettedValue and returns KErrNone
+ */
+ TInt Set(TUint32 aKey, TInt aValue);
+
+ /**
+ * if gCRGetFail is true, returns KErrGeneral
+ * if gCRGetFail is false, returns gSettedValue and returns KErrNone
+ */
+ TInt Get(TUint32 aKey, TDes& aValue);
+
+private:
+
+};
+
+#endif // __CENTRALREPOSITORY_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/hbabstractitemview.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* 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 hbabstractitemview
+*
+*/
+
+
+#ifndef HBABSTRACTITEMVIEW_H
+#define HBABSTRACTITEMVIEW_H
+
+#include <QGraphicsWidget>
+#include <QItemSelectionModel>
+#include "hbwidget.h"
+
+class HbAbstractItemView : public HbWidget
+{
+public:
+
+ enum SelectionMode
+ {
+ InvalidSelection,
+ NoSelection,
+ SingleSelection,
+ MultiSelection,
+ ContiguousSelection
+ };
+
+ HbAbstractItemView(QGraphicsWidget *parent = 0) : HbWidget(parent){}
+
+signals:
+
+ void activated(const QModelIndex &index);
+
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/hbaction.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,128 @@
+/*
+* 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 hbaction
+*
+*/
+
+#ifndef HBACTION_H
+#define HBACTION_H
+
+#include <QObject>
+#include <QString>
+#include <qpointer.h>
+#include <qaction.h>
+#include "hbnamespace.h"
+#include "hbicon.h"
+#include "hbmenu.h"
+
+class HbAction : public QAction
+{
+ Q_OBJECT
+public:
+
+ /**
+ * Constructor
+ */
+ explicit HbAction(QObject *parent = 0) : QAction(parent)
+ {
+ Q_UNUSED(parent);
+ initializeCount++;
+ }
+
+ /**
+ * Contructor.
+ */
+ explicit HbAction(const QString &txt, QObject *parent = 0) : mTxt(txt), QAction(parent)
+ {
+ Q_UNUSED(parent);
+ initializeCount++;
+ }
+
+ /**
+ * Contructor.
+ */
+ explicit HbAction(Hb::SoftKeyAction actType, QObject *parent = 0) : mTxt(""), QAction(parent)
+ {
+ Q_UNUSED(parent);
+ Q_UNUSED(actType);
+ initializeCount++;
+ }
+
+ explicit HbAction(Hb::NavigationAction action, QObject* parent = 0) : mTxt(""), QAction(parent)
+ {
+ Q_UNUSED(parent);
+ Q_UNUSED(action);
+ initializeCount++;
+ }
+
+ /**
+ * destructor
+ */
+ virtual ~HbAction(){initializeCount--;}
+
+ /**
+ * sets mDisable;
+ */
+ void setDisabled(bool disable){mDisable = disable;}
+
+ /**
+ * sets mVisible;
+ */
+ void setVisible(bool visible){mVisible = visible;}
+
+ /**
+ * not stubbed yet.
+ */
+ void setIcon(const HbIcon &icon) { Q_UNUSED(icon); }
+
+ /**
+ * not stubbed yet.
+ */
+ HbIcon icon() const { return HbIcon(); }
+
+ /**
+ * not stubbed yet.
+ */
+ HbMenu *menu() const { return 0; }
+
+ /**
+ * dummy member
+ */
+ bool mDisable;
+
+ /**
+ * dummy member
+ */
+ bool mVisible;
+
+ /**
+ * text setted
+ */
+ QString mTxt;
+
+ /**
+ * counter to make sure alloc dealloc match
+ */
+ static int initializeCount;
+
+signals:
+
+ /**
+ * dummy triggered
+ */
+ void triggered();
+
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/hbcheckbox.h Thu Apr 01 23:22:15 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 hbcheckbox for testing video list selection dialog
+*
+*/
+
+#ifndef HBCHECKBOX_H
+#define HBCHECKBOX_H
+
+#include "hbwidget.h"
+#include <QGraphicsLayout>
+#include <QGraphicsWidget>
+#include <QString>
+
+class HbCheckBox : public HbWidget
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * Contructor.
+ */
+ HbCheckBox(QGraphicsItem *parent = 0) : HbWidget(parent){initializeCount++;}
+
+ /**
+ * Destructor.
+ */
+ virtual ~HbCheckBox(){initializeCount--;}
+
+ /**
+ * sets mChecked
+ */
+ void setChecked(bool check){mChecked = check;}
+
+ /**
+ * counter to make sure alloc dealloc match
+ */
+ static int initializeCount;
+
+ /**
+ * dummy value setted in setchecked
+ */
+ bool mChecked;
+
+signals:
+ /**
+ * state changed -signal
+ */
+ void stateChanged(int);
+
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/hbdeviceprofile.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2008 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 hbdeviceprofile for testing video collection ui uitils
+*
+*/
+
+#ifndef HBDEVICEPROFILE_H
+#define HBDEVICEPROFILE_H
+
+#include <QSize>
+
+
+
+class HbDeviceProfile
+{
+public:
+
+ /**
+ * contructor
+ */
+ HbDeviceProfile(){mSize.setHeight(100); mSize.setWidth(100);}
+
+ /**
+ * destructor
+ */
+ ~HbDeviceProfile(){};
+
+ /**
+ * returns static object reference from this class
+ */
+ static HbDeviceProfile& current(){ static HbDeviceProfile _profile; return _profile; }
+
+ /**
+ * sets mSize
+ */
+ void setLogicalSize(QSize size){
+ mSize.setHeight(size.height());
+ mSize.setWidth(size.width());
+ }
+
+ /**
+ * gets mSize
+ */
+ QSize logicalSize() const{return mSize;}
+
+ QSize mSize;
+
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/hbdialog.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,187 @@
+/*
+* 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 hbdialog
+*
+*/
+
+#ifndef HBDIALOG_H
+#define HBDIALOG_H
+
+#include <QObject>
+#include <qsize.h>
+#include "hbwidget.h"
+class QGraphicsItem;
+class QGraphicsWidget;
+class HbAction;
+
+class HbDialog : public HbWidget
+{
+ Q_OBJECT
+
+public:
+
+ enum DefaultTimeout
+ {
+ NoTimeout,
+ ConfirmationNoteTimeout,
+ StandardTimeout,
+ ContextMenuTimeout,
+ };
+
+ enum DismissPolicy
+ {
+ NoDismiss = 0,
+ TapInside = 1,
+ TapOutside = 2,
+ TapAnywhere = TapInside | TapOutside
+ };
+
+ /**
+ * contructor
+ */
+ HbDialog(QGraphicsItem *parent=0);
+
+ /**
+ * destructor
+ */
+ ~HbDialog();
+
+ /**
+ * sets mDismissPolicy
+ */
+ void setDismissPolicy(HbDialog::DismissPolicy dismissPolicy);
+
+ /**
+ * sets mTimeout
+ */
+ void setTimeout(HbDialog::DefaultTimeout timeout);
+
+ /**
+ * sets mHeadingWidget;
+ */
+ void setHeadingWidget(QGraphicsWidget *headingWidget);
+
+ /**
+ * sets mContentWidget
+ */
+ void setContentWidget(QGraphicsWidget *contentWidget);
+
+ /**
+ * sets mPrimaryAction
+ */
+ void setPrimaryAction(HbAction *action);
+
+ /**
+ * add action into actions -list
+ */
+ void addAction(HbAction *action);
+
+ /**
+ * gets mPrimaryAction;
+ */
+ HbAction* primaryAction();
+
+ /**
+ * sets mSecondaryAction
+ */
+ void setSecondaryAction(HbAction *action);
+
+ /**
+ * gets mSecondaryAction;
+ */
+ HbAction* secondaryAction();
+
+ /**
+ * sets mMinSize
+ */
+ void setMinimumSize(QSize size);
+
+ /**
+ * sets mMaxSize
+ */
+ void setMaximumSize(QSize size);
+
+ /**
+ * returns mPrimaryAction if execReturnPrimary is true.
+ */
+ HbAction* exec();
+
+ /**
+ * stubbed member
+ */
+ QGraphicsWidget *mHeadingWidget;
+
+ /**
+ * stubbed member
+ */
+ QGraphicsWidget *mContentWidget;
+
+ /**
+ * stubbed member
+ */
+ HbAction *mPrimaryAction;
+
+ /**
+ * stubbed member
+ */
+ HbAction *mSecondaryAction;
+
+ /**
+ * stubbed member
+ */
+ QSize mMinSize;
+
+ /**
+ * stubbed member
+ */
+ QSize mMaxSize;
+
+ /**
+ * stubbed member
+ */
+ HbDialog::DefaultTimeout mTimeout;
+
+ /**
+ * stubbed member
+ */
+ HbDialog::DismissPolicy mDismissPolicy;
+
+ /**
+ * actions other tham primary or secondary
+ */
+ QList<HbAction*> mActions;
+
+ /**
+ * address of current instance zeroed during destcructor
+ * this is for making sure object is removed correctly
+ */
+ static HbDialog *currentInstance;
+
+ /**
+ * if true, exec returns mPrimaryAction
+ */
+ static bool execReturnPrimary;
+
+ /**
+ * if true, primaryAction() -method returns null
+ */
+ static bool primaryReturnNull;
+
+ /**
+ * if true, secondaryAction() -method returns null
+ */
+ static bool secondaryReturnNull;
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/hbglobal.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,39 @@
+/*
+* 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 hbglobal
+*
+*/
+
+#ifndef HBGLOBAL_H
+#define HBGLOBAL_H
+
+#include <QtGlobal>
+
+#ifdef BUILD_HB_CORE
+# define HB_CORE_EXPORT Q_DECL_EXPORT
+# define HB_CORE_PRIVATE_EXPORT Q_DECL_EXPORT
+#else
+# define HB_CORE_EXPORT Q_DECL_IMPORT
+# define HB_CORE_PRIVATE_EXPORT Q_DECL_IMPORT
+#endif // BUILD_HB_CORE
+
+#ifdef BUILD_HB_TOOLS
+# define HB_TOOLS_EXPORT Q_DECL_EXPORT
+#else
+# define HB_TOOLS_EXPORT Q_DECL_IMPORT
+#endif // BUILD_HB_TOOLS
+
+QString hbTrId(const char *id, int n = -1);
+
+#endif // HBGLOBAL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/hbgroupbox.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,45 @@
+/*
+* 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: hbgroupbox stub
+*
+*/
+
+#ifndef HBGROUPBOX_H
+#define HBGROUPBOX_H
+
+#include <hbwidget.h>
+
+class HbGroupBox : public HbWidget
+{
+ Q_OBJECT
+
+public:
+ HbGroupBox(QGraphicsItem *parent = 0) : HbWidget(parent) {};
+ HbGroupBox( const QString &titleText, QGraphicsItem *parent = 0 ) : HbWidget(parent) {
+ Q_UNUSED(titleText);
+ }
+ ~HbGroupBox();
+
+ void setHeading(const QString &text) {
+ Q_UNUSED(text);
+ }
+
+ QString heading() const {
+ return QString();
+ }
+
+};
+
+#endif //HbGroupBox_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/hbinputdialog.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,45 @@
+/*
+* 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: hbinputdialog stub
+*
+*/
+
+
+#ifndef HBINPUT_DIALOG_H
+#define HBINPUT_DIALOG_H
+
+#include "hbwidget.h"
+#include <qgraphicsitem.h>
+
+class HbInputDialog : public HbWidget
+{
+ Q_OBJECT
+
+public:
+ HbInputDialog(QGraphicsItem *parent= 0) : HbWidget(parent) {}
+ ~HbInputDialog() {}
+
+ static QString getText(const QString &label,const QString &text = QString(),
+ bool *ok = 0, QGraphicsScene *scene = 0, QGraphicsItem *parent = 0)
+ {
+ Q_UNUSED(label);
+ Q_UNUSED(ok);
+ Q_UNUSED(scene);
+ Q_UNUSED(parent);
+ return text;
+ }
+};
+
+#endif //HBINPUT_DIALOG_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/hbinstance.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* 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 hbinstance
+*
+*/
+
+#ifndef HBINSTANCE_H
+#define HBINSTANCE_H
+
+
+#include "hbmainwindow.h"
+#include "hbglobal.h"
+
+#define hbInstance (HbInstance::instance())
+
+class HbInstance
+{
+public:
+
+ /**
+ * returns static instance
+ */
+ static HbInstance *instance()
+ {
+ static HbInstance __instance;
+ return &__instance;
+ }
+
+ /**
+ * returns list of windowses
+ */
+ QList<HbMainWindow*> allMainWindows()
+ {
+ return mWindowses;
+ }
+
+ /**
+ * list of windowses
+ */
+ QList<HbMainWindow*> mWindowses;
+
+private:
+ /**
+ * no copy contructor
+ */
+ Q_DISABLE_COPY(HbInstance)
+
+ /**
+ * default constuctor
+ */
+ HbInstance(){};
+
+ /**
+ * destructor
+ */
+ ~HbInstance(){};
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/hblabel.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,100 @@
+/*
+* 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 hblabel for testing video collection ui uitils
+*
+*/
+
+#ifndef HBLABEL_H
+#define HBLABEL_H
+
+#include <QString>
+#include "hbwidget.h"
+
+class HbLabel : public HbWidget
+{
+ Q_OBJECT
+public:
+
+ /**
+ * Contructor.
+ */
+ HbLabel() {initializeCount++;}
+
+ /**
+ * Contructor.
+ */
+ HbLabel(const QString&, QGraphicsItem *parent = 0) : HbWidget(parent){initializeCount++;}
+
+ /**
+ * Destructor.
+ */
+ virtual ~HbLabel(){initializeCount--;}
+
+ /**
+ * counter to make sure alloc dealloc match
+ */
+ static int initializeCount;
+
+ /**
+ * set text
+ */
+ void setPlainText(QString txt);
+
+ /**
+ * sets alignment flag
+ */
+ void setAlignment(Qt::AlignmentFlag alignment);
+
+ /**
+ * clears text
+ */
+ void clear();
+
+ int count() const { return 0;}
+
+ QGraphicsLayoutItem *itemAt(int index) const
+ {
+ Q_UNUSED(index);
+ return 0;
+ }
+ void removeAt(int index) { Q_UNUSED(index); }
+
+ void removeItem(QGraphicsLayoutItem* item){Q_UNUSED(item);}
+
+ int indexOf(const QGraphicsLayoutItem* item) const
+ {
+ Q_UNUSED(item);
+ return 0;
+ }
+
+ QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const
+ {
+ Q_UNUSED(which);
+ Q_UNUSED(constraint);
+ return QSizeF();
+ }
+
+ /**
+ * text setted
+ */
+ QString mPlainTxt;
+
+ /**
+ * alinment setted
+ */
+ Qt::AlignmentFlag mAlignment;
+
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/hblistview.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,343 @@
+/*
+* Copyright (c) 2008-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 hbview
+*
+*/
+
+
+#ifndef HBLISTVIEW_H
+#define HBLISTVIEW_H
+
+#include <QGraphicsItem>
+#include <QModelIndex>
+#include <qgraphicswidget.h>
+#include <QList>
+#include <QPointF>
+#include <qitemselectionmodel.h>
+
+#include "videosortfilterproxymodel.h"
+#include "hblistviewitem.h"
+#include "hbscrollbar.h"
+#include "hbabstractitemview.h"
+
+class HbScrollArea
+{
+public:
+ enum ClampingStyle
+ {
+ InvalidClamping,
+ BounceBackClamping
+ };
+ enum ScrollingStyle
+ {
+ InvalidScrolling,
+ PanOrFlick
+ };
+};
+
+class HbListView : public HbAbstractItemView
+{
+ Q_OBJECT
+
+public:
+
+signals:
+
+ /**
+ * dummy signal
+ */
+ void scrollPositionChanged(const QPointF &);
+
+ /**
+ * dummy signal
+ */
+ void scrollingEnded();
+
+public:
+ /**
+ * contructor
+ */
+ HbListView(QGraphicsItem *parent = 0) :
+ mItem(0)
+ {
+ Q_UNUSED(parent);
+ mItem = new HbListViewItem();
+ mVerticalSB = new HbScrollBar();
+ }
+
+ /**
+ * destructor
+ */
+ virtual ~HbListView()
+ {
+ delete mSelectionModel;
+ delete mItem;
+ delete mVerticalSB;
+ QList<HbAbstractViewItem*>::const_iterator iter = mVisibleItems.constBegin();
+ while(iter != mVisibleItems.constEnd())
+ {
+ delete *iter;
+ ++iter;
+ }
+ mVisibleItems.clear();
+ }
+
+ HbScrollBar* verticalScrollBar()
+ {
+ if(mVScrollBarIsNull)
+ {
+ return 0;
+ }
+ return mVerticalSB;
+ }
+
+ /**
+ * dummy method
+ */
+ void setModel(VideoSortFilterProxyModel *model)
+ {
+ mLatestModel = model;
+ }
+
+ /**
+ * dummy method
+ */
+ HbListViewItem *listItemPrototype()
+ {
+ if(mReturnNullPrototype)
+ {
+ return 0;
+ }
+ return mItem;
+ }
+
+ /**
+ * dummy method
+ */
+ void setItemRecycling(bool value)
+ {
+ mLatestrecycling = value;
+ }
+
+ /**
+ * dummy method
+ */
+ void setClampingStyle(HbScrollArea::ClampingStyle style)
+ {
+ mLatestClamping = style;
+ }
+
+ /**
+ * dummy method
+ */
+ void setScrollingStyle(HbScrollArea::ScrollingStyle style)
+ {
+ mLatestScrolling = style;
+ }
+
+ /**
+ * dummy method
+ */
+ void setFrictionEnabled(bool value)
+ {
+ mLatestFrictionEnabled = value;
+ }
+
+ /**
+ * dummy method
+ */
+ void setUniformItemSizes(bool value)
+ {
+ mLatestUniformItemSizes = value;
+ }
+
+ /**
+ * dummy method
+ */
+ void setVisible(bool value)
+ {
+ mLatestVisibility = value;
+ }
+
+ /**
+ * dummy method
+ */
+ void setEnabled(bool value)
+ {
+ mLatestEnableValue = value;
+ }
+
+ /**
+ * dummy method
+ */
+ void setSelectionMode(HbAbstractItemView::SelectionMode mode)
+ {
+ mSelectionMode = mode;
+ }
+
+ QList<HbAbstractViewItem*> visibleItems()
+ {
+ return mVisibleItems;
+ }
+
+ /**
+ * dummy method
+ */
+ HbAbstractItemView::SelectionMode selectionMode()
+ {
+ return mSelectionMode;
+ }
+
+ /**
+ * dummy method
+ */
+ QModelIndex currentIndex()
+ {
+ return mCurrentIndex;
+ }
+
+ /**
+ * sets mLongPressedPoint
+ */
+ void longPressGesture (const QPointF &point)
+ {
+ mLongPressedPoint = point;
+ }
+
+ /**
+ * dummy method
+ */
+ void clearSelection()
+ {
+ // nop
+ }
+
+ /**
+ * dummy method
+ */
+ void scrollTo(const QModelIndex &index)
+ {
+ Q_UNUSED(index);
+
+ // nop
+ }
+
+ /**
+ * dummy method
+ */
+ void selectAll()
+ {
+ // nop
+ }
+
+ /**
+ * dummy method
+ */
+ QItemSelectionModel *selectionModel()
+ {
+ if (!mSelectionModel)
+ {
+ mSelectionModel = new QItemSelectionModel(mLatestModel);
+ }
+ return mSelectionModel;
+ }
+
+ /**
+ * items to be returned from visibleItems
+ */
+ static QList<HbAbstractViewItem*> mVisibleItems;
+
+ /**
+ * selection model to be returned
+ */
+ static HbAbstractItemView::SelectionMode mSelectionMode;
+
+
+ /**
+ * provided model
+ */
+ static VideoSortFilterProxyModel *mLatestModel;
+
+ /**
+ * item to returned from listItemPrototype
+ */
+ HbListViewItem *mItem;
+
+ /**
+ * item to be returned from verticalScrollBar
+ */
+ HbScrollBar *mVerticalSB;
+
+ /**
+ * selection model
+ */
+ QItemSelectionModel *mSelectionModel;
+
+ /**
+ * if true verticalScrollBar return null
+ */
+ static bool mVScrollBarIsNull;
+
+ /**
+ * if true, listItemPrototype returns null
+ */
+ static bool mReturnNullPrototype;
+
+ /**
+ * latest value settes in setItemRecycling
+ */
+ static bool mLatestrecycling;
+
+ /**
+ * value setted in longPressGesture
+ */
+ static QPointF mLongPressedPoint;
+
+ /**
+ * latest value settes in setClampingStyle
+ */
+ static HbScrollArea::ClampingStyle mLatestClamping;
+
+ /**
+ * latest value setted in setScrollingStyle
+ */
+ static HbScrollArea::ScrollingStyle mLatestScrolling;
+
+ /**
+ * latest value setted in setFrictionEnabled
+ */
+ static bool mLatestFrictionEnabled;
+
+ /**
+ * latest value setted in setUniformItemSizes
+ */
+ static bool mLatestUniformItemSizes;
+
+ /**
+ * latest value setted in setVisible
+ */
+ static bool mLatestVisibility;
+
+ /**
+ * latest value setted in setEnabled
+ */
+ static bool mLatestEnableValue;
+
+ /**
+ * index value to be returned from current index
+ */
+ static QModelIndex mCurrentIndex;
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/hblistviewitem.h Thu Apr 01 23:22:15 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 HbListViewItem
+*
+*/
+
+#ifndef HBLISTVIEWITEM_H
+#define HBLISTVIEWITEM_H
+
+#include <QGraphicsItem>
+#include <QModelIndex>
+
+#include "hbwidget.h"
+
+class HbAbstractViewItem : public HbWidget
+{
+public:
+ enum
+ {
+ PositionAtTop
+ };
+
+public:
+
+ /**
+ * contructor
+ */
+ HbAbstractViewItem(QGraphicsItem *parent=0) :
+ HbWidget(parent)
+ {
+ }
+
+ /**
+ * destructor
+ */
+ virtual ~HbAbstractViewItem(){}
+
+ /**
+ * returns mModelIndex
+ */
+ QModelIndex modelIndex()
+ {
+ return mModelIndex;
+ }
+
+ /**
+ * item index
+ */
+ QModelIndex mModelIndex;
+
+};
+
+
+class HbListViewItem : public HbAbstractViewItem
+{
+ Q_OBJECT
+
+
+public:
+
+ enum GraphicsSize
+ {
+ InvalidSize,
+ Thumbnail
+ };
+
+
+ HbListViewItem(QGraphicsItem *parent=0) :
+ HbAbstractViewItem(parent)
+ {
+ }
+
+ virtual ~HbListViewItem(){}
+
+ void setGraphicsSize(GraphicsSize size)
+ {
+ mLatestSize = size;
+ }
+ static GraphicsSize mLatestSize;
+
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/hblistwidget.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,35 @@
+/*
+* 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: hblistwidget stub
+*
+*/
+
+#ifndef HBLISTWIDGET_H
+#define HBLISTWIDGET_H
+
+#include <hbwidget.h>
+
+class HbListWidget : public HbWidget
+{
+ Q_OBJECT
+
+public:
+ HbListWidget(QGraphicsItem *parent = 0) : HbWidget(parent) {};
+ virtual ~HbListWidget();
+
+};
+
+#endif // HBLISTWIDGET_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/hbmainwindow.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,117 @@
+/*
+* 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 hbmainwindow
+*
+*/
+
+#ifndef HBMAINWINDOW_H
+#define HBMAINWINDOW_H
+
+#include <QObject>
+#include "hbwidget.h"
+#include "hbaction.h"
+
+class HbView;
+
+class HbMainWindow : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * constructor
+ */
+ HbMainWindow(QWidget *parent = 0, Hb::WindowFlags windowFlags = Hb::WindowFlagNone) :
+ mSoftKeyAction(0),
+ mOrientation(Qt::Vertical)
+ {
+ Q_UNUSED(parent);
+ Q_UNUSED(windowFlags);
+ }
+
+ /**
+ * destructor
+ */
+ ~HbMainWindow(){};
+
+ /**
+ * dummy
+ */
+ void addSoftKeyAction(Hb::SoftKeyId type, HbAction *action)
+ {
+ Q_UNUSED(type);
+ mSoftKeyAction = action;
+ }
+
+ void removeSoftKeyAction(Hb::SoftKeyId type, HbAction *action)
+ {
+ Q_UNUSED(type);
+ if(mSoftKeyAction == action)
+ {
+ mSoftKeyAction = 0;
+ }
+ }
+
+
+ /**
+ * returns mSoftKeyAction
+ */
+ HbAction* softKeyAction(Hb::SoftKeyId type)
+ {
+ Q_UNUSED(type);
+ return mSoftKeyAction;
+ }
+
+ HbView *addView(QGraphicsWidget *widget = 0);
+
+ void removeView(QGraphicsWidget *widget);
+
+ QList<HbView *> views() const;
+
+ HbView *currentView() const;
+
+ Qt::Orientation orientation() const
+ {
+ return mOrientation;
+ }
+
+ void setOrientation(Qt::Orientation orientation, bool animate = true)
+ {
+ Q_UNUSED(animate);
+ mOrientation = orientation;
+ }
+
+ void unsetOrientation(bool animate = true)
+ {
+ Q_UNUSED(animate);
+ mOrientation = Qt::Vertical;
+ }
+
+ /**
+ * value to return from softKeyAction
+ */
+ HbAction *mSoftKeyAction;
+
+ /**
+ * views
+ */
+ QList<HbView *> mViews;
+
+ /**
+ * orientation
+ */
+ Qt::Orientation mOrientation;
+};
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/hbmenu.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,65 @@
+/*
+* Copyright (c) 2008-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: HbMessageBox class declaration.
+*
+*/
+
+
+#ifndef HBMENU_H
+#define HBMENU_H
+
+#include <hbwidget.h>
+
+class QGraphicsItem;
+class QPointF;
+class HbAction;
+
+class HbMenu: public HbWidget
+{
+ Q_OBJECT
+
+public:
+ HbMenu(QGraphicsItem *parent = 0);
+ virtual ~HbMenu();
+
+public:
+ /** stubbed from HbMenu */
+ HbAction* exec(const QPointF &pos, HbAction *action = 0);
+
+ /** stubbed from HbMenu */
+ HbAction* menuAction();
+
+ /** stubbed from HbMenu */
+ HbAction* activeAction();
+
+ /** stubbed from HbMenu */
+ void setActiveAction(HbAction *action);
+
+ /** stubbed from HbMenu */
+ void setEnabled(bool value);
+
+ /** stubbed from HbMenu */
+ HbAction* addAction(const QString &text,
+ const QObject *receiver,
+ const char *member);
+
+ /** stubbed from HbMenu */
+ QList<HbAction*> actions();
+
+public:
+ /** dummy actions */
+ QMap<QString, HbAction*> mActions;
+};
+
+#endif // HBMENU_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/hbmenudata.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,44 @@
+/*
+* 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: HbMessageBox class declaration.
+*
+*/
+
+
+#ifndef HBMENUDATA_H
+#define HBMENUDATA_H
+
+#include <hbaction.h>
+
+class HbMenuData
+{
+public: // methods
+ static void reset()
+ {
+ delete mMenuAction;
+ delete mActiveAction;
+ mEnabledSetted = false;
+ mReturnEmptyActionList = false;
+ mExecPoint = QPointF();
+ }
+
+public: // data
+ static HbAction *mMenuAction;
+ static HbAction *mActiveAction;
+ static bool mEnabledSetted;
+ static bool mReturnEmptyActionList;
+ static QPointF mExecPoint;
+};
+
+#endif // HBMENUDATA_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/hbmessagebox.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2008-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: HbMessageBox class declaration.
+*
+*/
+
+
+#ifndef HBMESSAGEBOX_H
+#define HBMESSAGEBOX_H
+
+#include <qstring.h>
+
+class QGraphicsWidget;
+class QGraphicsScene;
+class QGraphicsItem;
+
+class HbMessageBox
+{
+public:
+ /** stubbed from HbMessgeBox */
+ static bool question(const QString &questionText,
+ const QString &primaryButtonText = QString(),
+ const QString &secondaryButtonText = QString(),
+ QGraphicsWidget *headWidget = 0,
+ QGraphicsScene *scene = 0,
+ QGraphicsItem *parent = 0);
+
+ /** stubbed from HbMessgeBox */
+ static void information(const QString &informationText,
+ QGraphicsWidget *headWidget = 0,
+ QGraphicsScene *scene = 0,
+ QGraphicsItem *parent = 0);
+
+ /** stubbed from HbMessgeBox */
+ static void warning(const QString &warningText,
+ QGraphicsWidget *headWidget = 0,
+ QGraphicsScene *scene = 0,
+ QGraphicsItem *parent = 0 );
+};
+
+
+
+#endif // HBMESSAGEBOX_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/hbmessageboxdata.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* Copyright (c) 2008-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: HbMessageBox class declaration.
+*
+*/
+
+
+#ifndef HBMESSAGEBOXDATA_H
+#define HBMESSAGEBOXDATA_H
+
+class HbMessageBoxData
+{
+public:
+ static void reset()
+ {
+ mQuestionReturnValue = false;
+ mLatestTxt = "";
+ mWarningCallCount = 0;
+ mInformationCallCount = 0;
+ }
+
+public: // data
+ static bool mQuestionReturnValue;
+ static QString mLatestTxt;
+ static int mWarningCallCount;
+ static int mInformationCallCount;
+};
+
+
+
+#endif // HBMESSAGEBOXDATA_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/hbnamespace.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,386 @@
+/*
+* 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: hbnamespace stub
+*
+*/
+
+#ifndef HBNAMESPACE_H
+#define HBNAMESPACE_H
+
+#include <QtGlobal>
+#include <QObject>
+#include <QGraphicsItem>
+
+class Hb
+{
+
+public:
+/* static const int Key_SoftKeyPrimary = Qt::Key_Launch0;
+ static const int Key_SoftKeySecondary = Qt::Key_Launch1;
+ static const int Key_SoftKeyMiddle = Qt::Key_Launch2;
+
+*/
+ // DEPRECATED - DO NOT USE - These are deprecated along with deprecation of softkey functions in HbMainWindow.
+ // This enumeration will become internal to Hb.
+ enum SoftKeyId
+ {
+ PrimarySoftKey,
+ SecondarySoftKey,
+ MiddleSoftKey,
+
+ //Custom softkey id's start here.
+ CustomSoftKey = 0xFF
+ };
+
+ // DEPRECATED - DO NOT USE - These are deprecated along with deprecation of softkey functions in HbMainWindow.
+ // Use NavigationAction instead.
+ enum SoftKeyAction
+ {
+ QuitAction,
+ BackAction,
+ ConfirmAction,
+ DoneAction
+ };
+
+ enum NavigationAction
+ {
+ QuitNaviAction,
+ BackNaviAction,
+ ConfirmNaviAction,
+ DoneNaviAction
+ };
+
+/* enum EffectEvent
+ {
+ EffectFinished = 1,
+ EffectCancelled = 2,
+ EffectNotStarted = 3
+ };
+
+
+ enum UiAttribute
+ {
+ Ui_NoAttributes = 0x0000,
+ Ui_VisibleInTouch = 0x0001,
+ Ui_VisibleInNonTouch = 0x0002
+ };
+
+ Q_DECLARE_FLAGS(UiAttributes, UiAttribute)
+*/
+ /*!
+ Gesture types.
+ */
+/* enum TouchGesture
+ {
+ TapGesture = 0x0000001,
+ LongPressGesture = 0x0000002,
+ PanGesture = 0x0000004,
+ FlickGesture = 0x0000008
+ };
+
+ Q_DECLARE_FLAGS(TouchGestures, TouchGesture)
+
+
+ enum ItemDataRole
+ {
+ ItemTypeRole = 1001,
+ IndexFeedbackRole,
+ UserRole = 1500
+ };
+
+ enum ModelItemType
+ {
+ StandardItem,
+ ParentItem,
+ SeparatorItem,
+ UserItem = 1000
+ };
+
+ enum GraphicsItemType
+ {
+ ItemType_NotificationDialog = QGraphicsItem::UserType+10000,
+ ItemType_FrameItem,
+ ItemType_GraphicsPixmapItem,
+ ItemType_FormViewItem,
+ ItemType_FormView,
+ ItemType_AbstractItemContainer,
+ ItemType_AbstractItemView,
+ ItemType_ListView,
+ ItemType_AbstractViewItem,
+ ItemType_ListViewItem,
+ ItemType_ItemHighlight,
+ ItemType_ListWidgetItem,
+ ItemType_ListWidgetViewItem,
+ ItemType_GridViewItem,
+ ItemType_Popup,
+ ItemType_Dialog,
+ ItemType_Note,
+ ItemType_CommonNote,
+ ItemType_MessageBox,
+ ItemType_ProgressNote,
+ ItemType_ProgressDialog,
+ ItemType_AbstractButton,
+ ItemType_AbstractItem,
+ ItemType_AbstractSlider,
+ ItemType_Highlight,
+ ItemType_IconItem,
+ ItemType_Label,
+ ItemType_AbstractEdit,
+ ItemType_LineEdit,
+ ItemType_Menu,
+ ItemType_MenuItem,
+ ItemType_ProgressSlider,
+ ItemType_ProgressiveSlider,
+ ItemType_RatingSlider,
+ ItemType_ProgressBar,
+ ItemType_PushButton,
+ ItemType_RadioButtonList,
+ ItemType_ScrollBar,
+ ItemType_Slider,
+ ItemType_SliderPopup,
+ ItemType_StackedWidget,
+ ItemType_TextEdit,
+ ItemType_TextItem,
+ ItemType_ToolBar,
+ ItemType_ToolBarExtension,
+ ItemType_ToolButton,
+ ItemType_Widget,
+ ItemType_View,
+ ItemType_VolumeSlider,
+ ItemType_ZoomSlider,
+ ItemType_RoundRobinLabel,
+ ItemType_ConfirmationQuery,
+ ItemType_CheckBox,
+ ItemType_MessageQuery,
+ ItemType_DataQuery,
+ ItemType_InputDialog,
+ ItemType_DualDataQuery,
+ ItemType_TransparentWindow,
+ ItemType_DateTimeEdit,
+ ItemType_FileDialog,
+ ItemType_ColorDialog,
+ ItemType_InputCharacterButton,
+ ItemType_InputFunctionButton,
+ ItemType_InputCloseButton,
+ ItemType_InputTabButton,
+ ItemType_InputVkbWidget,
+ ItemType_InputCharPreviewPane,
+ ItemType_VirtualTrackPoint,
+ ItemType_WritingBox,
+ ItemType_VolumePopup,
+ ItemType_CombinedQuery,
+ ItemType_ListQuery,
+ ItemType_ListDialog,
+ ItemType_ListDialogContentWidget,
+ ItemType_ZoomPopup,
+ ItemType_CarouselView,
+ ItemType_TreeViewItem,
+ ItemType_ComboBox,
+ ItemType_TouchArea,
+ ItemType_SettingItemContainer,
+ ItemType_SettingFormItem,
+ ItemType_SettingForm,
+ ItemType_DataItemContainer,
+ ItemType_DataFormViewItem,
+ ItemType_DataForm,
+ ItemType_RichTextItem,
+ ItemType_GroupBox,
+ ItemType_DockWidget,
+ ItemType_RadioButtonListViewItem,
+ ItemType_TumbleView,
+ ItemType_TumbleViewItem,
+ ItemType_DateTimePicker,
+ ItemType_MarqueeItem,
+ ItemType_IndexFeedback,
+ ItemType_Last = QGraphicsItem::UserType + 20000
+ };
+
+ enum WidgetAttribute
+ {
+ InteractionDisabled = 0x00000001,
+ InsidePopup = 0x00000002
+ };
+
+ Q_DECLARE_FLAGS(WidgetAttributes, WidgetAttribute)
+
+
+ // DEPRECATED - DO NOT USE - These are deprecated along with deprecation of HbFontProvider
+ // Use HbFontSpec and the font roles defines in HbFontSpec API
+ enum LogicalFontName
+ {
+ FontUndefined = 0,
+ FontPrimary,
+ FontSecondary,
+ FontTitle,
+ FontPrimarySmall,
+ FontDigital
+ };
+
+*/
+ enum SceneItem {
+ NoItem = 0x00000000,
+
+ TitlePaneItem = 0x00000001,
+ // Deprecated
+ NaviPaneItem = 0x00000002,
+ ToolBarItem = 0x00000004,
+ IndicatorItems = 0x00000008,
+ DockWidgetItem = 0x00000010,
+ TitleBarItem = 0x00000020,
+
+ // Deprecated
+ PrimarySoftKeyItem = 0x00010000,
+ // Deprecated
+ SecondarySoftKeyItem = 0x00020000,
+ // Deprecated
+ MiddleSoftKeyItem = 0x00040000,
+ // Deprecated
+ SoftKeyItems = 0x00070000,
+
+ AllItems = 0xFFFFFFFF
+ };
+
+ /*!
+ Anchor edges.
+ */
+/* enum Edge {
+ LeftEdge = 0,
+ TopEdge,
+ RightEdge,
+ BottomEdge,
+ CenterHEdge,
+ CenterVEdge
+ };
+
+ enum ResourceType {
+ IconResource = 0,
+ ThemeResource,
+ EffectResource,
+ StyleSheetResource
+ };
+
+ Q_DECLARE_FLAGS(SceneItems, SceneItem)
+*/
+ enum WindowFlag {
+ WindowFlagNone = 0x00000000,
+ WindowFlagTransparent = 0x00000001,
+ WindowFlagNoBackground = 0x00000002,
+ WindowFlagFixedVertical = 0x00000004,
+ WindowFlagFixedHorizontal = 0x00000008,
+ WindowFlagNoSplash = 0x00000010
+ };
+
+ Q_DECLARE_FLAGS(WindowFlags, WindowFlag)
+/*
+ enum ViewSwitchFlag {
+ ViewSwitchDefault = 0x00,
+ ViewSwitchSequential = 0x01,
+ ViewSwitchFullScreen = 0x02,
+ ViewSwitchUseNormalAnim = 0x04,
+ ViewSwitchUseBackAnim = 0x08,
+ ViewSwitchUseAltEvent = 0x10
+ };
+
+ Q_DECLARE_FLAGS(ViewSwitchFlags, ViewSwitchFlag)
+
+ enum TextCursorVisibility
+ {
+ TextCursorHidden = 0,
+ TextCursorVisible
+ };
+
+ enum SliderTickPosition
+ {
+ NoSliderTicks = 0,
+ SliderTicksAbove = 1,
+ SliderTicksLeft = SliderTicksAbove,
+ SliderTicksBelow = 2,
+ SliderTicksRight = SliderTicksBelow,
+ SliderTicksBothSides = 3,
+ SliderTicksAbsolute
+ };
+
+ Q_DECLARE_FLAGS(SliderTickPositions , SliderTickPosition)
+
+ enum TextContextMenuFlag {
+ ShowTextContextMenuOnSelectionClicked = 1,
+ ShowTextContextMenuOnLongPress = 4
+ };
+ Q_DECLARE_FLAGS(TextContextMenuFlags , TextContextMenuFlag)
+*/
+ /*!
+ A type definition for text wrapping
+ */
+/* enum TextWrapping
+ {
+ TextNoWrap = 0,
+ TextWordWrap = 1,
+ TextWrapAnywhere = 3
+ };
+
+ enum InstantInteraction {
+ InstantPressed = 0,
+ InstantReleased,
+ InstantClicked,
+ InstantKeyRepeated,
+ InstantLongPressed,
+ InstantDraggedOver,
+ InstantFlicked,
+ InstantPopupOpened,
+ InstantPopupClosed,
+ InstantBoundaryReached,
+ InstantRotated90Degrees,
+ InstantSelectionChanged,
+ /* add new standard instant interactions here */
+// NumberOfInstantInteractions,
+// InstantUser = 1000,
+ /* value range for user defined custom instant interactions */
+// InstantMaxUser = 65535
+// };
+
+/* enum ContinuousInteraction {
+ ContinuousScrolled = 0,
+ ContinuousDragged,
+ ContinuousPinched,
+ /* add new standard continuous interactions here */
+// NumberOfContinuousInteractions,
+// ContinuousUser = 1000,
+ /* value range for user defined custom continuous interactions */
+/* ContinuousMaxUser = 65535
+ };
+
+ enum InteractionModifier {
+ ModifierSliderHandle = 0x1,
+ ModifierSliderElement = 0x2,
+ ModifierExpandedItem = 0x4,
+ ModifierCollapsedItem = 0x8,
+ ModifierScrolling = 0x10
+ };
+
+ Q_DECLARE_FLAGS(InteractionModifiers, InteractionModifier)*/
+};
+
+/*Q_DECLARE_METATYPE(Hb::GraphicsItemType)
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(Hb::UiAttributes)
+Q_DECLARE_OPERATORS_FOR_FLAGS(Hb::TouchGestures)
+Q_DECLARE_OPERATORS_FOR_FLAGS(Hb::SceneItems)
+Q_DECLARE_OPERATORS_FOR_FLAGS(Hb::WindowFlags)
+Q_DECLARE_OPERATORS_FOR_FLAGS(Hb::ViewSwitchFlags)
+Q_DECLARE_OPERATORS_FOR_FLAGS(Hb::SliderTickPositions)
+Q_DECLARE_OPERATORS_FOR_FLAGS(Hb::TextContextMenuFlags)
+Q_DECLARE_OPERATORS_FOR_FLAGS(Hb::InteractionModifiers)
+*/
+#endif // HBNAMESPACE_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/hbpushbutton.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,64 @@
+/*
+* 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 hbpushbutton
+*
+*/
+
+#ifndef HBPUSHBUTTON_H
+#define HBPUSHBUTTON_H
+
+#include "hbwidget.h"
+#include "qgraphicsitem.h"
+#include "hbicon.h"
+
+class HbPushButton : public HbWidget
+{
+ Q_OBJECT
+
+public:
+ HbPushButton( QGraphicsItem *parent = 0 ) : HbWidget(parent) {}
+
+ HbPushButton( const QString &text, QGraphicsItem *parent = 0 ) : HbWidget(parent) {
+ Q_UNUSED(text);
+ }
+ HbPushButton( const HbIcon &icon, const QString &text, QGraphicsItem *parent = 0 ) : HbWidget(parent) {
+ Q_UNUSED(icon);
+ Q_UNUSED(text);
+ }
+ virtual ~HbPushButton( ) {}
+
+ QString text( ) const
+ {
+ return mText;
+ }
+
+ void setIcon( const HbIcon &icon )
+ {
+ mIcon = icon;
+ }
+
+ HbIcon icon( ) const
+ {
+ return mIcon;
+ }
+
+public slots:
+ void setText( const QString &text );
+
+public:
+ QString mText;
+ HbIcon mIcon;
+};
+
+#endif // HBPUSHBUTTON_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/hbscrollbar.h Thu Apr 01 23:22:15 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 hbscrollbar
+*
+*/
+
+#ifndef HBSCROLLBAR_H
+#define HBSCROLLBAR_H
+
+#include <QObject>
+
+#include "hbwidget.h"
+
+
+class HbScrollBar : public HbWidget
+{
+ Q_OBJECT
+
+public:
+ /**
+ * Contructor.
+ */
+ HbScrollBar( QGraphicsItem *parent = 0 ) : HbWidget(parent)
+ {
+ initializeCount++;
+ };
+
+
+ /**
+ * destructor
+ */
+ virtual ~HbScrollBar(){initializeCount--;}
+
+ /**
+ * sets mInteractive
+ */
+ void setInteractive(bool interactive)
+ {
+ mInteractive = interactive;
+ }
+
+ /**
+ * counter to make sure alloc dealloc match
+ */
+ static int initializeCount;
+
+ /**
+ * setted in setInteractive
+ */
+ static bool mInteractive;
+
+
+
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/hbstackedwidget.h Thu Apr 01 23:22:15 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: stub HbStackedWidget for testing video list selection dialog
+*
+*/
+
+#ifndef HBSTACKEDWIDGET
+#define HBSTACKEDWIDGET
+
+#include <QGraphicsWidget>
+#include "hbwidget.h"
+
+class HbStackedWidget : public HbWidget
+{
+ Q_OBJECT
+public:
+ /**
+ * constructor
+ */
+ HbStackedWidget(QGraphicsItem *parent = 0) : HbWidget(parent), mCurrentWidget(0){initializeCount++;}
+
+ /**
+ * destructor
+ */
+ ~HbStackedWidget(){initializeCount--; delete mCurrentWidget;}
+
+ /**
+ * dummey member
+ */
+ int addWidget(QObject *widget){mCurrentWidget = widget; return 0;}
+
+ /**
+ * dummy member
+ */
+ QObject* currentWidget(){ return mCurrentWidget;}
+
+ /**
+ * dummy member
+ */
+ QObject *removeAt(int index){Q_UNUSED(index); QObject *tmp = mCurrentWidget; mCurrentWidget = 0; return tmp;}
+
+ /**
+ * counter to make sure alloc dealloc match
+ */
+ static int initializeCount;
+
+ QObject *mCurrentWidget;
+
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/hbstyleloader.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,64 @@
+/*
+* 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 hbaction
+*
+*/
+
+#ifndef HBSTYLELOADER_H
+#define HBSTYLELOADER_H
+
+#include <qglobal.h>
+#include <QObject>
+#include <QString>
+
+class HbStyleLoader : QObject
+{
+ Q_OBJECT
+public:
+ /**
+ * Contructor.
+ */
+ HbStyleLoader( const QString txt )
+ {
+ Q_UNUSED(txt);
+ initializeCount++;
+ };
+
+ /**
+ * destructor
+ */
+ virtual ~HbStyleLoader(){initializeCount--;}
+
+ static bool registerFilePath(const QString &filePath)
+ {
+ Q_UNUSED(filePath);
+ return true;
+ }
+
+ static bool unregisterFilePath(const QString &filePath)
+ {
+ Q_UNUSED(filePath);
+ return true;
+ }
+
+ /**
+ * counter to make sure alloc dealloc match
+ */
+ static int initializeCount;
+
+signals:
+
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/hbtoolbar.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* 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: hbtoolbar stub
+*
+*/
+
+#ifndef HBTOOLBAR_H
+#define HBTOOLBAR_H
+
+#include <hbwidget.h>
+
+class HbToolBar : public HbWidget
+{
+ Q_OBJECT
+
+public:
+ HbToolBar( QGraphicsItem *parent = 0 ) : HbWidget(parent) {};
+ virtual ~HbToolBar();
+
+ using HbWidget::addAction;
+/* HbAction *addAction( const QString &text );
+ HbAction *addAction( const HbIcon &icon, const QString &text );
+ HbAction *addAction( const QString &text, const QObject *receiver, const char *member );
+ HbAction *addAction( const HbIcon &icon, const QString &text, const QObject *receiver, const char *member );
+
+ HbAction *addExtension( HbToolBarExtension *extension );
+ HbAction *insertExtension( HbAction *before, HbToolBarExtension *extension );
+
+ Qt::Orientation orientation() const;
+
+ enum { Type = Hb::ItemType_ToolBar };
+ int type() const { return Type; }
+
+public slots:
+ void setOrientation(Qt::Orientation orientation);
+ void unsetOrientation();
+
+protected:
+ HbToolBar( HbToolBarPrivate &dd, QGraphicsItem *parent = 0 );
+
+ QVariant itemChange( GraphicsItemChange change, const QVariant &value );
+ void gestureEvent(QGestureEvent *event);
+ void changeEvent( QEvent *event );
+ void resizeEvent( QGraphicsSceneResizeEvent *event );
+ void hideEvent(QHideEvent *event);
+ bool event( QEvent *event );
+
+private:
+ Q_DECLARE_PRIVATE_D( d_ptr, HbToolBar )
+ Q_DISABLE_COPY(HbToolBar)
+
+ Q_PRIVATE_SLOT(d_func(), void _q_orientationChanged(Qt::Orientation))
+#ifdef HB_EFFECTS
+ Q_PRIVATE_SLOT(d_func(), void _q_delayedHide(HbEffect::EffectStatus status))
+ //Q_PRIVATE_SLOT(d_func(), void _q_delayedShow(HbEffect::EffectStatus status))
+#endif // HB_EFFECTS*/
+};
+
+#endif // HBTOOLBAR_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/hbview.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2008-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 hbview
+*
+*/
+
+
+#ifndef HBVIEW_H
+#define HBVIEW_H
+
+#include <QGraphicsWidget>
+#include "hbinstance.h"
+#include "hbtoolbar.h"
+
+class HbView : public QGraphicsWidget
+{
+ Q_OBJECT
+
+
+public:
+
+ HbView(QGraphicsItem *parent = 0) : QGraphicsWidget(parent), mToolBar(0)
+ {
+ Q_UNUSED(parent);
+ }
+
+ virtual ~HbView(){}
+
+ HbMainWindow* mainWindow() const
+ {
+ return hbInstance->allMainWindows().value(0);
+ }
+
+ void setTitle(const QString &title)
+ {
+ Q_UNUSED(title);
+ }
+
+ HbToolBar *toolBar() const
+ {
+ if(!mToolBar) {
+ mToolBar = new HbToolBar(qobject_cast<QGraphicsItem*>(this));
+ }
+ return mToolBar;
+ }
+
+ void setItemVisible(Hb::SceneItem item, bool visible)
+ {
+ Q_UNUSED(item);
+ Q_UNUSED(visible);
+ }
+
+ void setNavigationAction(HbAction *action)
+ {
+ Q_UNUSED(action);
+ }
+
+ mutable HbToolBar* mToolBar;
+};
+
+#endif // HBVIEW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/hbwidget.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,41 @@
+/*
+* 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 hbwidget
+*
+*/
+
+#ifndef HBWIDGET_H
+#define HBWIDGET_H
+#include <QGraphicsWidget>
+#include <hbnamespace.h>
+
+ /**
+ * counter to make sure alloc dealloc match
+ */
+
+
+class HbWidget : public QGraphicsWidget
+{
+ Q_OBJECT
+public:
+ HbWidget(QGraphicsItem *parent = 0) : QGraphicsWidget(parent){initializeCount++;}
+
+ virtual ~HbWidget(){initializeCount--;}
+
+ void clearActions() {}
+
+ static int initializeCount;
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/videocollectionexport.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,25 @@
+/*
+* 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: DLL export macro for videocollection.
+*
+*/
+
+#ifndef _VIDEOCOLLECTIONEXPORT_H
+#define _VIDEOCOLLECTIONEXPORT_H
+
+#define VIDEOCOLLECTION_DLL_EXPORT
+
+#endif // _VIDEOCOLLECTIONEXPORT_H
+
+// End of file.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/videocollectionuiloaderdata.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,39 @@
+/*
+* 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 videocollectionuiloaderdata
+*
+*/
+
+#ifndef VIDEOCOLLECTIONUILOADERDATA_H
+#define VIDEOCOLLECTIONUILOADERDATA_H
+
+#include <qstringlist.h>
+
+class VideoCollectionUiLoaderData
+{
+public: // methods
+ static void reset()
+ {
+ mFindFailure = false;
+ mFailDialogLoad = false;
+ mFindFailureNameList.clear();
+ }
+
+public: // data
+ static bool mFindFailure;
+ static bool mFailDialogLoad;
+ static QStringList mFindFailureNameList;
+};
+
+#endif /* VIDEOCOLLECTIONUILOADERDATA_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/videocollectionviewutilsdata.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* 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 videocollectionviewutilsdata
+*
+*/
+
+#ifndef VIDEOCOLLECTIONVIEWUTILSDATA_H
+#define VIDEOCOLLECTIONVIEWUTILSDATA_H
+
+#include <qnamespace.h>
+
+class VideoCollectionViewUtilsData
+{
+public: // methods
+ static void reset()
+ {
+ mLastError = 0;
+ mLoadSortingValuesFails = false;
+ mGetServiceIconStringsFails = false;
+ mSortRole = 0;
+ mSortOrder = Qt::AscendingOrder;
+ mIconString = "";
+ mPressedString = "";
+ }
+
+public: // data
+ static int mLastError;
+ static bool mLoadSortingValuesFails;
+ static bool mGetServiceIconStringsFails;
+ static int mSortRole;
+ static Qt::SortOrder mSortOrder;
+ static QString mIconString;
+ static QString mPressedString;
+};
+
+#endif /* VIDEOCOLLECTIONVIEWUTILSDATA_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/videocollectionwrapperdata.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,56 @@
+/*
+* 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 videocollectionwrapperdata
+*
+*/
+
+#ifndef VIDEOCOLLECTIONWRAPPERDATA_H
+#define VIDEOCOLLECTIONWRAPPERDATA_H
+
+#include "videosortfilterproxymodel.h"
+#include "videolistdatamodel.h"
+
+class VideoCollectionWrapperData
+{
+public: // methods
+ static void reset()
+ {
+ mGetModelFails = 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 VideoListDataModel *mSourceModel;
+ static VideoSortFilterProxyModel *mAllVideosModel;
+ static VideoSortFilterProxyModel *mCollectionsModel;
+ static VideoSortFilterProxyModel *mCollectionContentModel;
+ static VideoSortFilterProxyModel *mGenericModel;
+};
+
+#endif /* VIDEOSORTFILTERPROXYMODEL_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/videolistdatamodeldata.h Thu Apr 01 23:22:15 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 videolistdatamodeldata
+*
+*/
+
+#ifndef VIDEOLISTDATAMODELDATA_H
+#define VIDEOLISTDATAMODELDATA_H
+
+#include "videolistdatamodel.h"
+
+class VideoListDataModelData
+{
+public: // methods
+ static void reset()
+ {
+ mData.clear();
+ mLastIndex = QModelIndex();
+ mDataAccessCount = 0;
+ mRowCount = 0;
+ }
+
+ static QModelIndex lastIndex()
+ {
+ return mLastIndex;
+ }
+
+ static int dataAccessCount()
+ {
+ return mDataAccessCount;
+ }
+
+ static void setData(int role, QVariant data)
+ {
+ mData.insert(role, data);
+ }
+
+ static void setRowCount(VideoListDataModel &model, int count)
+ {
+ if (count != mRowCount)
+ {
+ mRowCount = count;
+ model.initialize();
+ }
+ }
+
+public: // data
+ static QMap<int, QVariant> mData;
+ static QModelIndex mLastIndex;
+ static int mDataAccessCount;
+ static int mRowCount;
+};
+
+#endif /* VIDEOLISTDATAMODELDATA_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/videolistselectiondialogdata.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,39 @@
+/*
+* 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 videolistselectiondialogdata
+*
+*/
+
+#ifndef VIDEOLISTSELECTIONDIALOGDATA_H
+#define VIDEOLISTSELECTIONDIALOGDATA_H
+
+class VideoListSelectionDialogData
+{
+public: // methods
+ static void reset()
+ {
+ mExecReturnPrimary = false;
+ mSelectionCount = 0;
+ mMultiSelectionLaunchCount = 0;
+ mMultiSelectionItemSelectionCount = 0;
+ }
+
+public: // data
+ static bool mExecReturnPrimary;
+ static int mSelectionCount;
+ static int mMultiSelectionLaunchCount;
+ static int mMultiSelectionItemSelectionCount;
+};
+
+#endif /* VIDEOLISTSELECTIONDIALOGDATA_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/videolistviewdata.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,39 @@
+/*
+* 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 hbstackedwidget
+*
+*/
+
+#ifndef VIDEOLISTVIEWDATA_H
+#define VIDEOLISTVIEWDATA_H
+
+class VideoListViewData
+{
+public: // methods
+ static void reset()
+ {
+ mInitializeViewCount = 0;
+ mActivateViewCount = 0;
+ mDeactivateViewCount = 0;
+ mBackCount = 0;
+ }
+
+public: // data
+ static int mInitializeViewCount;
+ static int mActivateViewCount;
+ static int mDeactivateViewCount;
+ static int mBackCount;
+};
+
+#endif /* VIDEOLISTVIEWDATA_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/videolistwidgetdata.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* 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 videolistwidgetdata
+*
+*/
+
+#ifndef VIDEOLISTWIDGETDATA_H
+#define VIDEOLISTWIDGETDATA_H
+
+class VideoListWidgetData
+{
+public: // methods
+ static void reset()
+ {
+ mInitializeCount = 0;
+ mInitializeReturnValue = 0;
+ mActivateCount = 0;
+ mActivateReturnValue = 0;
+ mActive = false;
+ mDeactivateCount = 0;
+ }
+
+public: // data
+ static int mInitializeCount;
+ static int mInitializeReturnValue;
+ static int mActivateCount;
+ static int mActivateReturnValue;
+ static bool mActive;
+ static int mDeactivateCount;
+};
+
+#endif /* VIDEOLISTWIDGETDATA_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/videoplayerappexport.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,25 @@
+/*
+* 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: DLL export macro for videoplayer app.
+*
+*/
+
+#ifndef _VIDEOPLAYERAPPEXPORT_H
+#define _VIDEOPLAYERAPPEXPORT_H
+
+#define VIDEOPLAYERAPP_DLL_EXPORT
+
+#endif // _VIDEOPLAYERAPPEXPORT_H
+
+// End of file.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/videosortfilterproxymodeldata.h Thu Apr 01 23:22:15 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 videosortfilterproxymodeldata
+*
+*/
+
+#ifndef VIDEOSORTFILTERPROXYMODELDATA_H
+#define VIDEOSORTFILTERPROXYMODELDATA_H
+
+#include <qnamespace.h>
+
+class VideoSortFilterProxyModelData
+{
+public: // methods
+ static void reset()
+ {
+ mOpenFails = false;
+ mSortRole = 0;
+ mSortOrder = Qt::AscendingOrder;
+ mSortAsync = false;
+ mDeleteItemsFails = true;
+ mDoSortingCallCount = 0;
+ mItemIds.clear();
+ mLastIndex = QModelIndex();
+ mDetailsReturnValue = 0;
+ }
+
+public: // data
+ static bool mOpenFails;
+ static int mSortRole;
+ static Qt::SortOrder mSortOrder;
+ static bool mSortAsync;
+ static bool mDeleteItemsFails;
+ static int mDoSortingCallCount;
+ static QList<TMPXItemId> mItemIds;
+ static QModelIndex mLastIndex;
+ static TMPXItemId mLastItemId;
+ static int mDetailsReturnValue;
+};
+
+#endif /* VIDEOSORTFILTERPROXYMODEL_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/videothumbnailtestdata.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,39 @@
+/*
+* 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 videothumbnailtestdata
+*
+*/
+
+#ifndef VIDEOTHUMBNAILTESTDATA_H
+#define VIDEOTHUMBNAILTESTDATA_H
+
+class VideoThumbnailTestData
+{
+public: // methods
+ static void reset()
+ {
+ mInstanceCallCount = 0;
+ mFreeThumbnailDataCallCount = 0;
+ mBackgroundThumbnailFetchingEnabled = 0;
+ mStartBackgroundFetchingCallCount = 0;
+ }
+
+public: // data
+ static int mInstanceCallCount;
+ static int mFreeThumbnailDataCallCount;
+ static int mBackgroundThumbnailFetchingEnabled;
+ static int mStartBackgroundFetchingCallCount;
+};
+
+#endif /* VIDEOTHUMBNAILTESTDATA_H */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/xqserviceutil.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,42 @@
+/**
+* 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:
+*
+*/
+
+#ifndef XQSERVICEUTIL_H
+#define XQSERVICEUTIL_H
+
+#include <QObject>
+#include <stub/inc/xqserviceutilxtra.h>
+
+class XQServiceUtilXtra;
+
+namespace XQServiceUtil
+{
+ static void toBackground(bool value){};
+ static bool isEmbedded(){return false;};
+ static bool isService()
+ {
+ bool service;
+ XQServiceUtilXtra* ptr = XQServiceUtilXtra::instance();
+ service = ptr->currentService();
+ ptr->decreaseReferenceCount();
+ return service;
+ };
+}
+
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/inc/xqserviceutilxtra.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,60 @@
+/**
+* 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:
+*
+*/
+
+#ifndef XQSERVICEUTILXTRA_H_
+#define XQSERVICEUTILXTRA_H_
+
+#include <QObject>
+
+class XQServiceUtilXtra;
+
+class XQServiceUtilXtra : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ static XQServiceUtilXtra *instance();
+
+ void decreaseReferenceCount();
+
+ bool currentService();
+
+ void setCurrentService(bool aservice);
+
+private:
+
+ XQServiceUtilXtra();
+
+ static XQServiceUtilXtra* mInstance;
+
+ virtual ~XQServiceUtilXtra();
+
+
+ Q_DISABLE_COPY(XQServiceUtilXtra)
+
+public:
+
+ /**
+ * Reference count.
+ */
+ static int mReferenceCount;
+
+ static bool service;
+
+};
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/centralrepository.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,225 @@
+/*
+* 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 central repository -class for testing CVideoCollectionClient
+*
+*/
+
+
+#include "centralrepository.h"
+
+const int KVideoCollectionViewCenrepSortingRoleKey(0x5);
+const int KVideoCollectionViewCenrepSortingOrderKey(0x6);
+
+/**
+ * if true, Newl will leave
+ */
+bool gCRNewLLeave = false;
+
+/**
+ * if zero, Set will fail. Every Set call decreases this value by one.
+ */
+int gCRSetFail = 255;
+
+/**
+ * if zero, Get will fail. Every Get call decreases this value by one.
+ */
+int gCRGetFail = 255;
+
+/**
+ * role value will be saved here in correct cases
+ */
+int gSettedRoleValue = -1;
+
+/**
+ * order value will be saved here in correct cases
+ */
+int gSettedOrderValue = -1;
+
+/**
+ * order value will be saved here in correct cases
+ */
+TBuf<255> gSettedTDesValue = TBuf<255>();
+
+// -----------------------------------------------------------------------------
+// setNewLLeave
+// -----------------------------------------------------------------------------
+//
+void CRepository::setNewLLeave(bool leave)
+{
+ gCRNewLLeave = leave;
+}
+
+// -----------------------------------------------------------------------------
+// setSetFail
+// -----------------------------------------------------------------------------
+//
+void CRepository::setSetFail(int amount)
+{
+ gCRSetFail = amount;
+}
+
+// -----------------------------------------------------------------------------
+// setGetFail
+// -----------------------------------------------------------------------------
+//
+void CRepository::setGetFail(int amount)
+{
+ gCRGetFail = amount;
+}
+
+// -----------------------------------------------------------------------------
+// getRoleValue
+// -----------------------------------------------------------------------------
+//
+int CRepository::getRoleValue()
+{
+ return gSettedRoleValue;
+}
+
+// -----------------------------------------------------------------------------
+// getOrderValue
+// -----------------------------------------------------------------------------
+//
+int CRepository::getOrderValue()
+{
+ return gSettedOrderValue;
+}
+
+// -----------------------------------------------------------------------------
+// getTDesValue
+// -----------------------------------------------------------------------------
+//
+TDesC& CRepository::getTDesValue()
+{
+ return gSettedTDesValue;
+}
+
+// -----------------------------------------------------------------------------
+// setRoleValue
+// -----------------------------------------------------------------------------
+//
+void CRepository::setRoleValue(int value)
+{
+ gSettedRoleValue = value;
+}
+
+// -----------------------------------------------------------------------------
+// setOrderValue
+// -----------------------------------------------------------------------------
+//
+void CRepository::setOrderValue(int value)
+{
+ gSettedOrderValue = value;
+}
+
+// -----------------------------------------------------------------------------
+// setOrderValue
+// -----------------------------------------------------------------------------
+//
+void CRepository::setTDesValue(const TDesC& value)
+{
+ gSettedTDesValue = value;
+}
+
+// -----------------------------------------------------------------------------
+// NewL
+// -----------------------------------------------------------------------------
+//
+CRepository* CRepository::NewL(TUid /*aRepositoryUid*/)
+{
+ if(gCRNewLLeave)
+ {
+ User::Leave(KErrGeneral);
+ }
+ return new CRepository();
+}
+
+// -----------------------------------------------------------------------------
+// CRepository
+// -----------------------------------------------------------------------------
+//
+CRepository::CRepository()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// ~CRepository
+// -----------------------------------------------------------------------------
+//
+CRepository::~CRepository()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// Get
+// -----------------------------------------------------------------------------
+//
+TInt CRepository::Get(TUint32 aKey, TInt& aValue)
+{
+ if(gCRGetFail == 0)
+ {
+ return KErrGeneral;
+ } else {
+ gCRGetFail--;
+ }
+
+ if(aKey == KVideoCollectionViewCenrepSortingRoleKey) {
+ aValue = gSettedRoleValue;
+ } else {
+ aValue = gSettedOrderValue;
+ }
+
+ return KErrNone;
+}
+
+// -----------------------------------------------------------------------------
+// Set
+// -----------------------------------------------------------------------------
+//
+TInt CRepository::Set(TUint32 aKey, TInt aValue)
+{
+ if(gCRSetFail == 0)
+ {
+ return KErrGeneral;
+ } else {
+ gCRSetFail--;
+ }
+
+ if(aKey == KVideoCollectionViewCenrepSortingRoleKey) {
+ gSettedRoleValue = aValue;
+ } else {
+ gSettedOrderValue = aValue;
+ }
+ return KErrNone;
+}
+
+// -----------------------------------------------------------------------------
+// Get
+// -----------------------------------------------------------------------------
+//
+TInt CRepository::Get(TUint32 /*aKey*/, TDes& aValue)
+{
+ if(gCRGetFail == 0)
+ {
+ return KErrGeneral;
+ } else {
+ gCRGetFail--;
+ }
+
+ aValue = gSettedTDesValue;
+
+ return KErrNone;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/hbaction.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,22 @@
+/*
+* 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 hbstackedwidget
+*
+*/
+
+#include "hbaction.h"
+
+int HbAction::initializeCount = 0;
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/hbcheckbox.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,24 @@
+/*
+* 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 hblabel
+*
+*/
+
+#include "hbcheckbox.h"
+
+int HbCheckBox::initializeCount = 0;
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/hbcheckbox.h Thu Apr 01 23:22:15 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 hbcheckbox for testing video list selection dialog
+*
+*/
+
+#ifndef HBCHECKBOX_H
+#define HBCHECKBOX_H
+
+#include "hbwidget.h"
+#include <QGraphicsLayout>
+#include <QGraphicsWidget>
+#include <QString>
+
+class HbCheckBox : public HbWidget
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * Contructor.
+ */
+ HbCheckBox(QGraphicsItem *parent = 0) : HbWidget(parent){initializeCount++;}
+
+ /**
+ * Destructor.
+ */
+ virtual ~HbCheckBox(){initializeCount--;}
+
+ /**
+ * sets mChecked
+ */
+ void setChecked(bool check){mChecked = check;}
+
+ /**
+ * counter to make sure alloc dealloc match
+ */
+ static int initializeCount;
+
+ /**
+ * dummy value setted in setchecked
+ */
+ bool mChecked;
+
+signals:
+ /**
+ * state changed -signal
+ */
+ void stateChanged(int);
+
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/hbdeviceprofile.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2008 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 hbdeviceprofile for testing video collection ui uitils
+*
+*/
+
+#ifndef HBDEVICEPROFILE_H
+#define HBDEVICEPROFILE_H
+
+#include <QSize>
+
+
+
+class HbDeviceProfile
+{
+public:
+
+ /**
+ * contructor
+ */
+ HbDeviceProfile(){mSize.setHeight(100); mSize.setWidth(100);}
+
+ /**
+ * destructor
+ */
+ ~HbDeviceProfile(){};
+
+ /**
+ * returns static object reference from this class
+ */
+ static HbDeviceProfile& current(){ static HbDeviceProfile _profile; return _profile; }
+
+ /**
+ * sets mSize
+ */
+ void setLogicalSize(QSize size){
+ mSize.setHeight(size.height());
+ mSize.setWidth(size.width());
+ }
+
+ /**
+ * gets mSize
+ */
+ QSize logicalSize() const{return mSize;}
+
+ QSize mSize;
+
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/hbdialog.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,127 @@
+/*
+* 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 HbDialog
+*
+*/
+#include <QGraphicsWidget>
+
+#include "hbaction.h"
+#include "hblabel.h"
+#include "HbDialog.h"
+
+HbDialog *HbDialog::currentInstance = 0;
+bool HbDialog::execReturnPrimary = true;
+bool HbDialog::primaryReturnNull = false;
+bool HbDialog::secondaryReturnNull = false;
+
+HbDialog::HbDialog(QGraphicsItem *parent) :
+HbWidget(parent),
+mHeadingWidget(0),
+mContentWidget(0),
+mPrimaryAction(0),
+mSecondaryAction(0),
+mTimeout(NoTimeout),
+mDismissPolicy(NoDismiss)
+
+{
+ mMinSize.setHeight(0);
+ mMinSize.setWidth(0);
+ mMaxSize.setHeight(0);
+ mMaxSize.setWidth(0);
+ currentInstance = this;
+}
+
+HbDialog::~HbDialog()
+{
+ delete mHeadingWidget;
+ delete mPrimaryAction;
+ delete mSecondaryAction;
+ delete mContentWidget;
+ currentInstance = 0;
+ mActions.clear();
+}
+
+void HbDialog::setDismissPolicy(HbDialog::DismissPolicy dismissPolicy)
+{
+ mDismissPolicy = dismissPolicy;
+}
+
+void HbDialog::setTimeout(HbDialog::DefaultTimeout timeout)
+{
+ mTimeout = timeout;
+}
+
+void HbDialog::setHeadingWidget(QGraphicsWidget *headingWidget)
+{
+ mHeadingWidget = headingWidget;
+}
+
+void HbDialog::setContentWidget(QGraphicsWidget *contentWidget)
+{
+ mContentWidget = contentWidget;
+}
+
+void HbDialog::setPrimaryAction(HbAction *action)
+{
+ mPrimaryAction = action;
+}
+
+HbAction* HbDialog::primaryAction()
+{
+ if(primaryReturnNull)
+ {
+ return 0;
+ }
+ return mPrimaryAction;
+}
+
+void HbDialog::setSecondaryAction(HbAction *action)
+{
+ mSecondaryAction = action;
+}
+
+HbAction* HbDialog::secondaryAction()
+{
+ if(secondaryReturnNull)
+ {
+ return 0;
+ }
+ return mSecondaryAction;
+}
+
+void HbDialog::addAction(HbAction *action)
+{
+ mActions.append(action);
+}
+
+void HbDialog::setMinimumSize(QSize size)
+{
+ mMinSize.setHeight(size.height());
+ mMinSize.setWidth(size.width());
+}
+
+void HbDialog::setMaximumSize(QSize size)
+{
+ mMaxSize.setHeight(size.height());
+ mMaxSize.setWidth(size.width());
+}
+
+HbAction* HbDialog::exec()
+{
+ if(execReturnPrimary)
+ {
+ return mPrimaryAction;
+ }
+ return mSecondaryAction;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/hbglobal.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* 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 hbglobal
+*
+*/
+
+#include "hbglobal.h"
+#include <QString>
+#include <QCoreApplication>
+
+QString hbTrId(const char *id, int n)
+{
+ QString loc = qtTrId(id, n);
+ return loc;
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/hblabel.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* 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 hblabel
+*
+*/
+
+#include "hblabel.h"
+
+int HbLabel::initializeCount = 0;
+
+// ---------------------------------------------------------------------------
+// setPlainText
+// ---------------------------------------------------------------------------
+//
+void HbLabel::setPlainText(QString txt)
+{
+ mPlainTxt = txt;
+}
+
+// ---------------------------------------------------------------------------
+// setAlignment
+// ---------------------------------------------------------------------------
+//
+void HbLabel::setAlignment(Qt::AlignmentFlag alignment)
+{
+ mAlignment = alignment;
+}
+
+// ---------------------------------------------------------------------------
+// clear
+// ---------------------------------------------------------------------------
+//
+void HbLabel::clear()
+{
+ mPlainTxt = "";
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/hblistview.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,38 @@
+/*
+* 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 hblistview
+*
+*/
+
+#include "videosortfilterproxymodel.h"
+#include "hblistview.h"
+
+QList<HbAbstractViewItem*> HbListView::mVisibleItems = QList<HbAbstractViewItem*>();
+HbAbstractItemView::SelectionMode HbListView::mSelectionMode = HbAbstractItemView::InvalidSelection;
+VideoSortFilterProxyModel* HbListView::mLatestModel = 0;
+bool HbListView::mReturnNullPrototype = false;
+bool HbListView::mVScrollBarIsNull = false;
+bool HbListView::mLatestrecycling = false;
+QPointF HbListView::mLongPressedPoint = QPointF();
+HbScrollArea::ClampingStyle HbListView::mLatestClamping = HbScrollArea::InvalidClamping;
+HbScrollArea::ScrollingStyle HbListView::mLatestScrolling = HbScrollArea::InvalidScrolling;
+bool HbListView::mLatestFrictionEnabled = false;
+bool HbListView::mLatestUniformItemSizes = false;
+bool HbListView::mLatestVisibility = false;
+bool HbListView::mLatestEnableValue = false;
+QModelIndex HbListView::mCurrentIndex = QModelIndex();
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/hblistviewItem.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,24 @@
+/*
+* 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 hblistviewitem
+*
+*/
+
+#include "hblistviewitem.h"
+
+HbListViewItem::GraphicsSize HbListViewItem::mLatestSize = HbListViewItem::InvalidSize;
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/hbmainwindow.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* 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 hblabel
+*
+*/
+
+#include "hbmainwindow.h"
+#include "hbview.h"
+#include "qlist.h"
+
+// ---------------------------------------------------------------------------
+// addView
+// ---------------------------------------------------------------------------
+//
+HbView* HbMainWindow::addView(QGraphicsWidget *widget)
+{
+ HbView* view = qobject_cast<HbView*>(widget);
+ mViews.append(view);
+ return view;
+}
+
+// ---------------------------------------------------------------------------
+// removeView
+// ---------------------------------------------------------------------------
+//
+void HbMainWindow::removeView(QGraphicsWidget *widget)
+{
+ mViews.removeAll(qobject_cast<HbView*>(widget));
+}
+
+// ---------------------------------------------------------------------------
+// views
+// ---------------------------------------------------------------------------
+//
+QList<HbView *> HbMainWindow::views() const
+{
+ return mViews;
+}
+
+HbView *currentView() const
+{
+ return 0;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/hbmenu.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,106 @@
+/*
+* 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 hbmessagebox
+*
+*/
+
+#include "hbmenu.h"
+#include "hbmenudata.h"
+
+HbAction *HbMenuData::mMenuAction = 0;
+HbAction *HbMenuData::mActiveAction = 0;
+bool HbMenuData::mEnabledSetted = false;
+bool HbMenuData::mReturnEmptyActionList = false;
+QPointF HbMenuData::mExecPoint = QPointF();
+
+
+HbMenu::HbMenu(QGraphicsItem *parent):
+ HbWidget(parent)
+{
+}
+
+HbMenu::~HbMenu()
+{
+ HbMenuData::reset();
+
+ QMap<QString, HbAction*>::const_iterator iter = mActions.constBegin();
+ while(iter != mActions.constEnd())
+ {
+ delete *iter;
+ iter++;
+ }
+ mActions.clear();
+}
+
+HbAction* HbMenu::exec(const QPointF &pos, HbAction *action)
+{
+ Q_UNUSED(action);
+
+ HbMenuData::mExecPoint = pos;
+
+ return 0;
+}
+
+HbAction* HbMenu::menuAction()
+{
+ return HbMenuData::mMenuAction;
+}
+
+HbAction* HbMenu::activeAction()
+{
+ return HbMenuData::mActiveAction;
+}
+
+void HbMenu::setActiveAction(HbAction *action)
+{
+ if (HbMenuData::mActiveAction)
+ {
+ delete HbMenuData::mActiveAction;
+ HbMenuData::mActiveAction = 0;
+ }
+ HbMenuData::mActiveAction = action;
+}
+
+void HbMenu::setEnabled(bool enabled)
+{
+ HbMenuData::mEnabledSetted = enabled;
+}
+
+HbAction* HbMenu::addAction(const QString &text,
+ const QObject *receiver,
+ const char *member)
+{
+ Q_UNUSED(receiver);
+ Q_UNUSED(member);
+
+ if(mActions.contains(text))
+ {
+ delete mActions[text];
+ }
+ HbAction *action = new HbAction(text);
+ mActions[text] = action;
+
+ return action;
+}
+
+QList<HbAction*> HbMenu::actions()
+{
+ if(HbMenuData::mReturnEmptyActionList)
+ {
+ return QList<HbAction*>();
+ }
+ return mActions.values();
+}
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/hbmessagebox.cpp Thu Apr 01 23:22:15 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: stub hbmessagebox
+*
+*/
+
+#include <qstring.h>
+
+#include "hbmessagebox.h"
+#include "hbmessageboxdata.h"
+
+bool HbMessageBoxData::mQuestionReturnValue = false;
+QString HbMessageBoxData::mLatestTxt = "";
+int HbMessageBoxData::mWarningCallCount = 0;
+int HbMessageBoxData::mInformationCallCount = 0;
+
+bool HbMessageBox::question(const QString &questionText,
+ const QString &primaryButtonText,
+ const QString &secondaryButtonText,
+ QGraphicsWidget *headWidget,
+ QGraphicsScene *scene,
+ QGraphicsItem *parent)
+{
+ Q_UNUSED(primaryButtonText);
+ Q_UNUSED(secondaryButtonText);
+ Q_UNUSED(headWidget);
+ Q_UNUSED(scene);
+ Q_UNUSED(parent);
+
+ HbMessageBoxData::mLatestTxt = questionText;
+ return HbMessageBoxData::mQuestionReturnValue;
+}
+
+void HbMessageBox::information(const QString &informationText,
+ QGraphicsWidget *headWidget,
+ QGraphicsScene *scene,
+ QGraphicsItem *parent)
+{
+ Q_UNUSED(headWidget);
+ Q_UNUSED(scene);
+ Q_UNUSED(parent);
+
+ HbMessageBoxData::mLatestTxt = informationText;
+ HbMessageBoxData::mInformationCallCount++;
+}
+
+void HbMessageBox::warning(const QString &warningText,
+ QGraphicsWidget *headWidget,
+ QGraphicsScene *scene,
+ QGraphicsItem *parent)
+{
+ Q_UNUSED(headWidget);
+ Q_UNUSED(scene);
+ Q_UNUSED(parent);
+
+ HbMessageBoxData::mLatestTxt = warningText;
+ HbMessageBoxData::mWarningCallCount++;
+}
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/hbscrollbar.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,24 @@
+/*
+* 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 hbstackedwidget
+*
+*/
+
+#include "hbscrollbar.h"
+
+int HbScrollBar::initializeCount = 0;
+
+bool HbScrollBar::mInteractive = false;
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/hbstackedwidget.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,22 @@
+/*
+* 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 hbstackedwidget
+*
+*/
+
+#include "hbstackedwidget.h"
+
+int HbStackedWidget::initializeCount = 0;
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/hbstackedwidget.h Thu Apr 01 23:22:15 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: stub HbStackedWidget for testing video list selection dialog
+*
+*/
+
+#ifndef HBSTACKEDWIDGET
+#define HBSTACKEDWIDGET
+
+#include <QGraphicsWidget>
+#include "hbwidget.h"
+
+class HbStackedWidget : public HbWidget
+{
+ Q_OBJECT
+public:
+ /**
+ * constructor
+ */
+ HbStackedWidget(QGraphicsItem *parent = 0) : HbWidget(parent), mCurrentWidget(0){initializeCount++;}
+
+ /**
+ * destructor
+ */
+ ~HbStackedWidget(){initializeCount--; delete mCurrentWidget;}
+
+ /**
+ * dummey member
+ */
+ int addWidget(QObject *widget){mCurrentWidget = widget; return 0;}
+
+ /**
+ * dummy member
+ */
+ QObject* currentWidget(){ return mCurrentWidget;}
+
+ /**
+ * dummy member
+ */
+ QObject *removeAt(int index){Q_UNUSED(index); QObject *tmp = mCurrentWidget; mCurrentWidget = 0; return tmp;}
+
+ /**
+ * counter to make sure alloc dealloc match
+ */
+ static int initializeCount;
+
+ QObject *mCurrentWidget;
+
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/hbstyleloader.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,22 @@
+/*
+* 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 hbstackedwidget
+*
+*/
+
+#include "hbstyleloader.h"
+
+int HbStyleLoader::initializeCount = 0;
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/hbwidget.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,24 @@
+/*
+* 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 hblabel
+*
+*/
+
+#include "hbwidget.h"
+
+int HbWidget::initializeCount = 0;
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/videocollectionuiloader.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,175 @@
+/*
+* 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:
+*
+*/
+
+#include <qset.h>
+#include <qstring.h>
+#include <hblistview.h>
+
+#include "videocollectionuiloader.h"
+#include "videolistview.h"
+#include "videolistwidget.h"
+#include "videohintwidget.h"
+#include "videolistselectiondialog.h"
+
+#include "videocollectionuiloaderdata.h"
+
+bool VideoCollectionUiLoaderData::mFindFailure = false;
+bool VideoCollectionUiLoaderData::mFailDialogLoad = false;
+QStringList VideoCollectionUiLoaderData::mFindFailureNameList;
+
+VideoCollectionUiLoader::VideoCollectionUiLoader():
+ HbDocumentLoader(),
+ mTimerId(0)
+{
+ // not stubbed
+}
+
+VideoCollectionUiLoader::~VideoCollectionUiLoader()
+{
+ VideoCollectionUiLoaderData::reset();
+}
+
+void VideoCollectionUiLoader::startLoading(QSet<QString> uiSections,
+ QObject *receiver,
+ const char *widgetSlot,
+ const char *objectSlot)
+{
+ Q_UNUSED(uiSections);
+ Q_UNUSED(receiver);
+ Q_UNUSED(widgetSlot);
+ Q_UNUSED(objectSlot);
+ // not stubbed
+}
+
+void VideoCollectionUiLoader::setIsService(bool isService)
+{
+ Q_UNUSED(isService);
+ // not stubbed
+}
+
+QGraphicsWidget* VideoCollectionUiLoader::doFindWidget(const QString &name)
+{
+ QGraphicsWidget *widget = 0;
+ widget = HbDocumentLoader::findWidget(name);
+ return widget;
+}
+
+QObject* VideoCollectionUiLoader::doFindObject(const QString &name)
+{
+ QObject *object = 0;
+ object = HbDocumentLoader::findObject(name);
+ return object;
+}
+
+void VideoCollectionUiLoader::addToQueue(Params ¶ms)
+{
+ Q_UNUSED(params);
+ // not stubbed
+}
+
+void VideoCollectionUiLoader::initWidget(QGraphicsWidget *widget,
+ const QString &name)
+{
+ Q_UNUSED(widget);
+ Q_UNUSED(name);
+ // not stubbed
+}
+
+void VideoCollectionUiLoader::initObject(QObject *object,
+ const QString &name)
+{
+ Q_UNUSED(object);
+ Q_UNUSED(name);
+ // not stubbed
+}
+
+void VideoCollectionUiLoader::timerEvent(QTimerEvent *event)
+{
+ Q_UNUSED(event);
+ // not stubbed
+}
+
+QObject* VideoCollectionUiLoader::createObject(const QString& type,
+ const QString &name)
+{
+ QObject* object = doFindObject(name);
+ if (!object)
+ {
+ if (type == VideoListView::staticMetaObject.className())
+ {
+ object = new VideoListView(this);
+ }
+ else if (type == VideoListWidget::staticMetaObject.className())
+ {
+ object = new VideoListWidget(this);
+ }
+ else if ( type == VideoListSelectionDialog::staticMetaObject.className() )
+ {
+ if(!VideoCollectionUiLoaderData::mFailDialogLoad)
+ {
+ object = new VideoListSelectionDialog(this);
+
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ else if (type == VideoHintWidget::staticMetaObject.className())
+ {
+ object = new VideoHintWidget(this);
+ }
+ if (object)
+ {
+ object->setObjectName(name);
+
+ if (VideoCollectionUiLoaderData::mFindFailure)
+ {
+ if (!VideoCollectionUiLoaderData::mFindFailureNameList.empty())
+ {
+ if (VideoCollectionUiLoaderData::mFindFailureNameList.contains(name))
+ {
+ delete object;
+ object = 0;
+ }
+ }
+ else
+ {
+ delete object;
+ object = 0;
+ }
+ }
+ return object;
+ }
+
+ object = HbDocumentLoader::createObject(type, name);
+ }
+
+ return object;
+}
+
+void VideoCollectionUiLoader::runNext()
+{
+ // not stubbed
+}
+
+bool VideoCollectionUiLoader::isValid(const Params ¶ms)
+{
+ Q_UNUSED(params);
+ // not stubbed
+ return true;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/videocollectionviewutils.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,105 @@
+/*
+* 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: video collection view plugin's ui utils class
+*
+*/
+
+#include "videocollectionviewutils.h"
+#include "videocollectionviewutilsdata.h"
+
+int VideoCollectionViewUtilsData::mLastError = 0;
+bool VideoCollectionViewUtilsData::mLoadSortingValuesFails = false;
+bool VideoCollectionViewUtilsData::mGetServiceIconStringsFails = false;
+int VideoCollectionViewUtilsData::mSortRole = 0;
+Qt::SortOrder VideoCollectionViewUtilsData::mSortOrder = Qt::AscendingOrder;
+QString VideoCollectionViewUtilsData::mIconString = "";
+QString VideoCollectionViewUtilsData::mPressedString = "";
+
+VideoCollectionViewUtils& VideoCollectionViewUtils::instance()
+{
+ static VideoCollectionViewUtils _popupInstance;
+ return _popupInstance;
+}
+
+VideoCollectionViewUtils::VideoCollectionViewUtils():
+ mSortRole(-1),
+ mSortOrder(Qt::AscendingOrder)
+{
+ // not stubbed
+}
+
+VideoCollectionViewUtils::~VideoCollectionViewUtils()
+{
+ VideoCollectionViewUtilsData::reset();
+}
+
+int VideoCollectionViewUtils::saveSortingValues(int role, Qt::SortOrder order)
+{
+ VideoCollectionViewUtilsData::mSortRole = role;
+ VideoCollectionViewUtilsData::mSortOrder = order;
+ return 0;
+}
+
+int VideoCollectionViewUtils::loadSortingValues(int &role, Qt::SortOrder &order)
+{
+ if (VideoCollectionViewUtilsData::mLoadSortingValuesFails)
+ {
+ return -1;
+ }
+
+ role = VideoCollectionViewUtilsData::mSortRole;
+ order = VideoCollectionViewUtilsData::mSortOrder;
+
+ return 0;
+}
+
+int VideoCollectionViewUtils::getServiceIconStrings(QString& icon,
+ QString& iconPressed)
+{
+ if (VideoCollectionViewUtilsData::mGetServiceIconStringsFails)
+ {
+ return -1;
+ }
+
+ icon = VideoCollectionViewUtilsData::mIconString;
+ iconPressed = VideoCollectionViewUtilsData::mPressedString;
+
+ return 0;
+}
+
+QString VideoCollectionViewUtils::getServiceUriString()
+{
+ // not stubbed
+ return QString();
+}
+
+void VideoCollectionViewUtils::initListView(HbListView *view)
+{
+ Q_UNUSED(view);
+ // not stubbed
+}
+
+void VideoCollectionViewUtils::sortModel(VideoSortFilterProxyModel *model,
+ bool async)
+{
+ Q_UNUSED(model);
+ Q_UNUSED(async);
+ // not stubbed
+}
+
+void VideoCollectionViewUtils::showStatusMsgSlot(int statusCode, QVariant &additional)
+{
+ Q_UNUSED(additional);
+ VideoCollectionViewUtilsData::mLastError = statusCode;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/videocollectionwrapper.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,137 @@
+/*
+* 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: VideoCollectionWrapper class implementation
+*
+*/
+
+#include "videocollectionwrapper.h"
+#include "videocollectionwrapperdata.h"
+
+bool VideoCollectionWrapperData::mGetModelFails = false;
+VideoListDataModel *VideoCollectionWrapperData::mSourceModel = 0;
+VideoSortFilterProxyModel *VideoCollectionWrapperData::mAllVideosModel = 0;
+VideoSortFilterProxyModel *VideoCollectionWrapperData::mCollectionsModel = 0;
+VideoSortFilterProxyModel *VideoCollectionWrapperData::mCollectionContentModel = 0;
+VideoSortFilterProxyModel *VideoCollectionWrapperData::mGenericModel = 0;
+
+VideoCollectionWrapper &VideoCollectionWrapper::instance()
+{
+ static VideoCollectionWrapper _staticWrapper;
+ return _staticWrapper;
+}
+
+VideoCollectionWrapper::VideoCollectionWrapper()
+{
+ // nop
+}
+
+VideoCollectionWrapper::~VideoCollectionWrapper()
+{
+ VideoCollectionWrapperData::reset();
+}
+
+VideoSortFilterProxyModel* VideoCollectionWrapper::getModel(int type)
+{
+ VideoSortFilterProxyModel *model = 0;
+ if (!VideoCollectionWrapperData::mGetModelFails)
+ {
+ VideoListDataModel *sourceModel = VideoCollectionWrapperData::mSourceModel;
+ if (!sourceModel)
+ {
+ sourceModel = new VideoListDataModel;
+ if (sourceModel)
+ {
+ sourceModel->initialize();
+ VideoCollectionWrapperData::mSourceModel = sourceModel;
+ }
+ }
+
+ switch (type)
+ {
+ case EAllVideos:
+ {
+ model = VideoCollectionWrapperData::mAllVideosModel;
+ if (!model)
+ {
+ model = new VideoSortFilterProxyModel(type);
+ if (model)
+ {
+ model->initialize(sourceModel);
+ VideoCollectionWrapperData::mAllVideosModel = model;
+ }
+ }
+ break;
+ }
+ case ECollections:
+ {
+ model = VideoCollectionWrapperData::mCollectionsModel;
+ if (!model)
+ {
+ model = new VideoSortFilterProxyModel(type);
+ if (model)
+ {
+ model->initialize(sourceModel);
+ VideoCollectionWrapperData::mCollectionsModel = model;
+ }
+ }
+ break;
+ }
+ case ECollectionContent:
+ {
+ model = VideoCollectionWrapperData::mCollectionContentModel;
+ if (!model)
+ {
+ model = new VideoSortFilterProxyModel(type);
+ if (model)
+ {
+ model->initialize(sourceModel);
+ VideoCollectionWrapperData::mCollectionContentModel = model;
+ }
+ }
+ break;
+ }
+ case EGeneric:
+ {
+ model = VideoCollectionWrapperData::mGenericModel;
+ if (!model)
+ {
+ model = new VideoSortFilterProxyModel(type);
+ if (model)
+ {
+ model->initialize(sourceModel);
+ VideoCollectionWrapperData::mGenericModel = model;
+ }
+ }
+ break;
+ }
+ default:
+ {
+ // invalid model type
+ break;
+ }
+ }
+ }
+
+ return model;
+}
+
+void VideoCollectionWrapper::sendAsyncStatus(int statusCode,
+ QVariant &additional)
+{
+ Q_UNUSED(statusCode);
+ Q_UNUSED(additional);
+ // not stubbed
+}
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/videohintwidget.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,75 @@
+/*
+* 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: Videolist content widget implementation
+*
+*/
+
+#include "videohintwidget.h"
+
+VideoHintWidget::VideoHintWidget(VideoCollectionUiLoader *uiLoader,
+ QGraphicsItem *parent):
+ HbWidget(parent),
+ mUiLoader(uiLoader),
+ mServiceIcon(0),
+ mAddVideosIcon(0),
+ mCurrentLevel(AllVideos)
+{
+ // NOP
+}
+
+VideoHintWidget::~VideoHintWidget()
+{
+ // nop
+}
+
+int VideoHintWidget::initialize()
+{
+ // not stubbed
+ return 0;
+}
+
+void VideoHintWidget::setLevel(HintLevel level)
+{
+ Q_UNUSED(level);
+ // not stubbed
+}
+
+void VideoHintWidget::setButtonShown(bool shown)
+{
+ Q_UNUSED(shown);
+ // not stubbed
+}
+
+void VideoHintWidget::orientationChangedSlot(Qt::Orientation targetOrientation)
+{
+ Q_UNUSED(targetOrientation);
+ // not stubbed
+}
+
+void VideoHintWidget::activate()
+{
+ // not stubbed
+}
+
+void VideoHintWidget::deactivate()
+{
+ // not stubbed
+}
+
+void VideoHintWidget::updateUiComponents()
+{
+ // not stubbed
+}
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/videolistdatamodel.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,218 @@
+/*
+* 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: VideoListDataModel class implementation
+*
+*/
+
+#include <qstringlist.h>
+
+#include "videolistdatamodel.h"
+#include "videolistdatamodeldata.h"
+
+QMap<int, QVariant> VideoListDataModelData::mData;
+QModelIndex VideoListDataModelData::mLastIndex;
+int VideoListDataModelData::mDataAccessCount = 0;
+int VideoListDataModelData::mRowCount = 0;
+
+VideoListDataModel::VideoListDataModel(QObject *parent) :
+ QAbstractItemModel(parent),
+ d_ptr(0),
+ mCollectionClient(0),
+ mDeleteWorker(0),
+ mInitialized(false)
+{
+ // nop
+}
+
+VideoListDataModel::~VideoListDataModel()
+{
+ VideoListDataModelData::reset();
+}
+
+int VideoListDataModel::initialize()
+{
+ if (VideoListDataModelData::mRowCount)
+ {
+ int newCount = VideoListDataModelData::mRowCount;
+ int oldCount = VideoListDataModelData::mData.count();
+ if (newCount < oldCount)
+ {
+ beginInsertRows(QModelIndex(), oldCount, newCount - 1);
+ endInsertRows();
+ }
+ else
+ {
+ beginRemoveRows(QModelIndex(), newCount, oldCount);
+ endRemoveRows();
+ }
+ }
+ else
+ {
+ reset();
+ }
+ return 0;
+}
+
+VideoCollectionClient* VideoListDataModel::getCollectionClient()
+{
+ // not stubbed
+ return 0;
+}
+
+int VideoListDataModel::connectSignals()
+{
+ // not stubbed
+ return 0;
+}
+
+void VideoListDataModel::disconnectSignals()
+{
+ // not stubbed
+}
+
+TMPXItemId VideoListDataModel::mediaIdAtIndex(int index) const
+{
+ Q_UNUSED(index);
+ // not stubbed
+ return TMPXItemId();
+}
+
+QString VideoListDataModel::mediaFilePathForId(TMPXItemId mediaId) const
+{
+ Q_UNUSED(mediaId);
+ // not stubbed
+ return QString();
+}
+
+int VideoListDataModel::rowCount(const QModelIndex &parent ) const
+{
+ Q_UNUSED(parent);
+
+ return VideoListDataModelData::mRowCount;
+}
+
+QMap<int, QVariant> VideoListDataModel::itemData(const QModelIndex &index) const
+{
+ QMap<int, QVariant> itemData;
+ if (index.isValid())
+ {
+ // returns only basic data of the item
+ itemData.insert(Qt::DisplayRole, data(index, Qt::DisplayRole));
+ itemData.insert(Qt::DecorationRole, data(index, Qt::DecorationRole));
+ itemData.insert(Qt::BackgroundRole, data(index, Qt::BackgroundRole));
+ }
+ return itemData;
+}
+
+QString VideoListDataModel::prepareDetailRow(int index) const
+{
+ Q_UNUSED(index);
+
+ // not stubbed
+ return QString();
+}
+
+QString VideoListDataModel::prepareSizeString(int index) const
+{
+ Q_UNUSED(index);
+
+ // not stubbed
+ return QString();
+}
+
+QStringList VideoListDataModel::prepareLengthStrings(int index) const
+{
+ Q_UNUSED(index);
+
+ // not stubbed
+ return QStringList();
+}
+
+QVariant VideoListDataModel::data(const QModelIndex &index, int role) const
+{
+ QVariant returnValue = QVariant();
+ VideoListDataModelData::mLastIndex = index;
+ VideoListDataModelData::mDataAccessCount++;
+ if (index.isValid())
+ {
+ returnValue = VideoListDataModelData::mData.value(role);
+ }
+
+ return returnValue;
+}
+
+int VideoListDataModel::columnCount(const QModelIndex &parent) const
+{
+ Q_UNUSED(parent);
+
+ return 1;
+}
+
+QModelIndex VideoListDataModel::index(int row,
+ int column,
+ const QModelIndex &parent) const
+{
+ Q_UNUSED(parent);
+
+ return createIndex(row, column);
+}
+
+QModelIndex VideoListDataModel::parent(const QModelIndex &index) const
+{
+ Q_UNUSED(index);
+
+ // not stubbed
+ return QModelIndex();
+}
+
+bool VideoListDataModel::removeRows(const QModelIndexList &indexList)
+{
+ Q_UNUSED(indexList);
+
+ // not stubbed
+ return false;
+}
+
+bool VideoListDataModel::belongsToAlbum(const TMPXItemId &itemId, TMPXItemId albumId) const
+{
+ Q_UNUSED(albumId);
+ Q_UNUSED(itemId);
+
+ // not stubbed
+ return false;
+}
+
+void VideoListDataModel::setAlbumInUse(TMPXItemId albumId)
+{
+ Q_UNUSED(albumId);
+
+ // not stubbed
+}
+
+void VideoListDataModel::deleteStartingFailsSlot(QList<TMPXItemId> ids)
+{
+ Q_UNUSED(ids);
+
+ // not stubbed
+}
+
+void VideoListDataModel::reportAsyncStatus(int statusCode, QVariant &additional)
+{
+ Q_UNUSED(statusCode);
+ Q_UNUSED(additional);
+
+ // not stubbed
+}
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/videolistselectiondialog.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,159 @@
+/*
+* 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: videolist selection dialog implementation
+*
+*/
+
+#include <hbaction.h>
+
+#include "videolistselectiondialog.h"
+#include "videolistselectiondialogdata.h"
+#include "videocollectionwrapper.h"
+#include "videosortfilterproxymodel.h"
+
+bool VideoListSelectionDialogData::mExecReturnPrimary = false;
+int VideoListSelectionDialogData::mSelectionCount = 0;
+int VideoListSelectionDialogData::mMultiSelectionLaunchCount = 0;
+int VideoListSelectionDialogData::mMultiSelectionItemSelectionCount = 0;
+
+VideoListSelectionDialog::VideoListSelectionDialog(
+ VideoCollectionUiLoader *uiLoader,
+ QGraphicsItem *parent) :
+ HbDialog(parent),
+ mUiLoader(uiLoader),
+ mHeading(0),
+ mCheckboxContainer(0),
+ mItemCount(0),
+ mCheckBox(0),
+ mListContainer(0),
+ mForcedCheck(false),
+ mModel(0),
+ mListWidget(0)
+{
+ setDismissPolicy(HbDialog::NoDismiss);
+ setTimeout(HbDialog::NoTimeout);
+
+ // create primary action
+ HbAction *action = new HbAction();
+ if (action)
+ {
+ setPrimaryAction(action);
+ }
+
+ // create secondary action
+ action = new HbAction();
+ if (action)
+ {
+ setSecondaryAction(action);
+ }
+}
+
+VideoListSelectionDialog::~VideoListSelectionDialog()
+{
+ VideoListSelectionDialogData::reset();
+}
+
+void VideoListSelectionDialog::setupContent(int type, TMPXItemId activeItem)
+{
+ Q_UNUSED(type);
+ Q_UNUSED(activeItem);
+ // not stubbed
+}
+
+bool VideoListSelectionDialog::initDialog()
+{
+ // not stubbed
+ return false;
+}
+
+HbAction* VideoListSelectionDialog::exec()
+{
+ // fill selection
+ VideoListSelectionDialogData::mMultiSelectionLaunchCount++;
+ VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
+ VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionWrapper::EGeneric);
+ if (model)
+ {
+ for (int i = 0; i < VideoListSelectionDialogData::mSelectionCount; i++)
+ {
+ QModelIndex index = model->index(i, 0);
+ if(index.isValid())
+ {
+ mSelection.append(QItemSelectionRange(index));
+ }
+ }
+ }
+ VideoListSelectionDialogData::mMultiSelectionItemSelectionCount = mSelection.indexes().count();
+
+ // return wanted action
+ HbAction *action = 0;
+ if (VideoListSelectionDialogData::mExecReturnPrimary)
+ {
+ action = primaryAction();
+ }
+ else
+ {
+ action = secondaryAction();
+ }
+
+ return action;
+}
+
+void VideoListSelectionDialog::markAllStateChangedSlot(int state)
+{
+ Q_UNUSED(state);
+ // not stubbed
+}
+
+void VideoListSelectionDialog::selectionChangedSlot(
+ const QItemSelection &selected,
+ const QItemSelection &deselected)
+{
+ Q_UNUSED(selected);
+ Q_UNUSED(deselected);
+ // not stubbed
+}
+
+void VideoListSelectionDialog::singleItemSelectedSlot(const QModelIndex &index)
+{
+ Q_UNUSED(index);
+ // not stubbed
+}
+
+void VideoListSelectionDialog::modelReadySlot()
+{
+ // not stubbed
+}
+
+void VideoListSelectionDialog::updateCounterSlot()
+{
+ // not stubbed
+}
+
+void VideoListSelectionDialog::primaryActionTriggeredSlot()
+{
+ // not stubbed
+}
+
+void VideoListSelectionDialog::connectSignals()
+{
+ // not stubbed
+}
+
+void VideoListSelectionDialog::disconnectSignals()
+{
+ // not stubbed
+}
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/videolistview.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,253 @@
+/*
+* 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 view class source code
+*
+*/
+
+#include "videolistview.h"
+#include "videocollectionviewutils.h"
+#include "videocollectionwrapper.h"
+
+#include "videolistviewdata.h"
+
+int VideoListViewData::mActivateViewCount = 0;
+int VideoListViewData::mBackCount = 0;
+int VideoListViewData::mDeactivateViewCount = 0;
+int VideoListViewData::mInitializeViewCount = 0;
+
+VideoListView::VideoListView(VideoCollectionUiLoader *uiLoader, QGraphicsItem *parent) :
+HbView(parent),
+mUiUtils(VideoCollectionViewUtils::instance()),
+mWrapper(VideoCollectionWrapper::instance()),
+mUiLoader(uiLoader),
+mIsService(false),
+mModelReady(false),
+mVideoServices(0),
+mCurrentList(0),
+mToolbarViewsActionGroup(0),
+mToolbarCollectionActionGroup(0)
+{
+ // not stubbed
+}
+
+VideoListView::~VideoListView()
+{
+ VideoListViewData::reset();
+
+ // disconnect signals
+ disconnect();
+}
+
+int VideoListView::initializeView()
+{
+ // not stubbed
+ VideoListViewData::mInitializeViewCount++;
+ return 0;
+}
+
+void VideoListView::titleReadySlot(const QString& title)
+{
+ Q_UNUSED(title);
+ // not stubbed
+}
+
+int VideoListView::activateView()
+{
+ VideoListViewData::mActivateViewCount++;
+ return 0;
+}
+
+void VideoListView::modelReadySlot()
+{
+ // not stubbed
+}
+
+void VideoListView::layoutChangedSlot()
+{
+ // not stubbed
+}
+
+void VideoListView::deactivateView()
+{
+ VideoListViewData::mDeactivateViewCount++;
+}
+
+void VideoListView::back()
+{
+ VideoListViewData::mBackCount++;
+}
+
+void VideoListView::cleanup()
+{
+ // not stubbed
+}
+
+int VideoListView::createToolbar()
+{
+ // not stubbed
+ return 0;
+}
+
+HbAction* VideoListView::createAction(QString icon,
+ QActionGroup* actionGroup,
+ const char *slot)
+{
+ Q_UNUSED(icon);
+ Q_UNUSED(actionGroup);
+ Q_UNUSED(slot);
+ // not stubbed
+ return 0;
+}
+
+void VideoListView::showHint(bool show)
+{
+ Q_UNUSED(show);
+ // not stubbed
+}
+
+void VideoListView::setHintLevel(VideoHintWidget::HintLevel level)
+{
+ Q_UNUSED(level);
+ // not stubbed
+}
+
+void VideoListView::updateSubLabel()
+{
+ // not stubbed
+}
+
+void VideoListView::showAction(bool show, const QString &name)
+{
+ Q_UNUSED(show);
+ Q_UNUSED(name);
+ // not stubbed
+}
+
+bool VideoListView::isActionChecked(const QString &name)
+{
+ Q_UNUSED(name);
+ // not stubbed
+ return true;
+}
+
+void VideoListView::setActionChecked(bool setChecked, const QString &name)
+{
+ Q_UNUSED(setChecked);
+ Q_UNUSED(name);
+ // not stubbed
+}
+
+void VideoListView::openAllVideosViewSlot()
+{
+ // not stubbed
+}
+
+void VideoListView::openCollectionViewSlot()
+{
+ // not stubbed
+}
+
+void VideoListView::openNewAlbumSlot(const QModelIndex &parent,
+ int start,
+ int end)
+{
+ Q_UNUSED(parent);
+ Q_UNUSED(start);
+ Q_UNUSED(end);
+ // not stubbed
+}
+
+void VideoListView::openServicesViewSlot()
+{
+ // not stubbed
+}
+
+void VideoListView::startSorting()
+{
+ // not stubbed
+}
+
+void VideoListView::aboutToChangeOrientationSlot()
+{
+ // not stubbed
+}
+
+void VideoListView::orientationChangedSlot(Qt::Orientation orientation)
+{
+ Q_UNUSED(orientation);
+ // not stubbed
+}
+
+void VideoListView::deleteItemsSlot()
+{
+ // not stubbed
+}
+
+void VideoListView::createCollectionSlot()
+{
+ // not stubbed
+}
+
+void VideoListView::addVideosToCollectionSlot()
+{
+ // not stubbed
+}
+
+void VideoListView::aboutToShowMainMenuSlot()
+{
+ // not stubbed
+}
+
+void VideoListView::handleAsyncStatusSlot(int statusCode, QVariant &additional)
+{
+ Q_UNUSED(statusCode);
+ Q_UNUSED(additional);
+ // not stubbed
+}
+
+void VideoListView::collectionOpenedSlot(bool collectionOpened,
+ const QString& collection,
+ const QModelIndex &index)
+{
+ Q_UNUSED(collectionOpened);
+ Q_UNUSED(collection);
+ Q_UNUSED(index);
+ // not stubbed
+}
+
+void VideoListView::openSortByMenuSlot()
+{
+ // not stubbed
+}
+
+void VideoListView::widgetReadySlot(QGraphicsWidget *widget, const QString &name)
+{
+ Q_UNUSED(widget);
+ Q_UNUSED(name);
+ // not stubbed
+}
+
+void VideoListView::objectReadySlot(QObject *object, const QString &name)
+{
+ Q_UNUSED(object);
+ Q_UNUSED(name);
+ // not stubbed
+}
+
+void VideoListView::debugNotImplementedYet()
+{
+ // not stubbed
+}
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/videolistwidget.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,200 @@
+/*
+* Copyright (c) 2008 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 content widget implementation
+*
+*/
+
+#include "videolistwidget.h"
+#include "videolistwidgetdata.h"
+#include "videocollectioncommon.h"
+
+int VideoListWidgetData::mInitializeCount = 0;
+int VideoListWidgetData::mInitializeReturnValue = 0;
+int VideoListWidgetData::mActivateCount = 0;
+int VideoListWidgetData::mActivateReturnValue = 0;
+bool VideoListWidgetData::mActive = false;
+int VideoListWidgetData::mDeactivateCount = 0;
+
+VideoListWidget::VideoListWidget(VideoCollectionUiLoader* uiLoader, HbView *parent):
+ HbListView(parent),
+ mModel(0),
+ mVideoServices(0),
+ mCurrentLevel(VideoCollectionCommon::ELevelInvalid),
+ mSignalsConnected(false),
+ mDetailsReady(false),
+ mIsService(false),
+ mContextMenu(0),
+ mScrollPositionTimer(0),
+ mUiLoader(uiLoader)
+{
+ // nop
+}
+
+VideoListWidget::~VideoListWidget()
+{
+ VideoListWidgetData::reset();
+}
+
+int VideoListWidget::initialize(VideoSortFilterProxyModel &model,
+ VideoServices *videoServices)
+{
+ Q_UNUSED(videoServices);
+
+ VideoListWidgetData::mInitializeCount++;
+ mModel = &model;
+
+ return VideoListWidgetData::mInitializeReturnValue;
+}
+
+int VideoListWidget::activate()
+{
+ return activate(mCurrentLevel);
+}
+
+int VideoListWidget::activate(VideoCollectionCommon::TCollectionLevels level)
+{
+ VideoListWidgetData::mActive = true;
+ VideoListWidgetData::mActivateCount++;
+ mCurrentLevel = level;
+
+ return VideoListWidgetData::mActivateReturnValue;
+}
+
+void VideoListWidget::deactivate()
+{
+ VideoListWidgetData::mActive = false;
+ VideoListWidgetData::mDeactivateCount++;
+}
+
+int VideoListWidget::connectSignals()
+{
+ // not stubbed
+ return 0;
+}
+
+void VideoListWidget::disConnectSignals()
+{
+ // not stubbed
+}
+
+void VideoListWidget::shareItemSlot()
+{
+ // not stubbed
+}
+
+void VideoListWidget::deleteItemSlot()
+{
+ // not stubbed
+}
+
+void VideoListWidget::createContextMenu()
+{
+ // not stubbed
+}
+
+void VideoListWidget::setContextMenu()
+{
+ // not stubbed
+}
+
+VideoCollectionCommon::TCollectionLevels VideoListWidget::getLevel()
+{
+ // not stubbed
+ return VideoCollectionCommon::ELevelInvalid;
+}
+
+VideoSortFilterProxyModel& VideoListWidget::getModel()
+{
+ return *mModel;
+}
+
+void VideoListWidget::emitActivated (const QModelIndex &modelIndex)
+{
+ Q_UNUSED(modelIndex);
+ // not stubbed
+}
+
+void VideoListWidget::longPressGesture (const QPointF &point)
+{
+ Q_UNUSED(point);
+ // not stubbed
+}
+
+void VideoListWidget::playItemSlot()
+{
+ // not stubbed
+}
+
+void VideoListWidget::openDetailsSlot()
+{
+ // not stubbed
+}
+
+void VideoListWidget::renameSlot()
+{
+ // not stubbed
+}
+
+void VideoListWidget::addToCollectionSlot()
+{
+ // not stubbed
+}
+
+void VideoListWidget::removeCollectionSlot()
+{
+ // not stubbed
+}
+
+void VideoListWidget::playAllSlot()
+{
+ // not stubbed
+}
+
+void VideoListWidget::back()
+{
+ // not stubbed
+}
+
+void VideoListWidget::scrollingStartedSlot()
+{
+ // not stubbed
+}
+
+void VideoListWidget::scrollingEndedSlot()
+{
+ // not stubbed
+}
+
+void VideoListWidget::scrollPositionChangedSlot(const QPointF &newPosition)
+{
+ Q_UNUSED(newPosition);
+ // not stubbed
+}
+
+void VideoListWidget::scrollPositionTimerSlot()
+{
+ // not stubbed
+}
+
+void VideoListWidget::fetchThumbnailsForVisibleItems()
+{
+ // not stubbed
+}
+
+void VideoListWidget::debugNotImplementedYet()
+{
+ // not stubbed
+}
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/videoservices.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,95 @@
+/*
+* 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: Implementation of VideoServices
+*
+*/
+
+#include <qobject.h>
+#include "videoservices.h"
+#include "videoserviceurifetch.h"
+
+VideoServices *VideoServices::mInstance = 0;
+
+VideoServices* VideoServices::instance(QVideoPlayerEngine* engine)
+{
+ if(!mInstance)
+ {
+ mInstance = new VideoServices(engine);
+ }
+ else if(engine && !mInstance->engine())
+ {
+ mInstance->setEngine(engine);
+ }
+ mInstance->mReferenceCount++;
+ return mInstance;
+}
+
+void VideoServices::decreaseReferenceCount()
+{
+ if(mInstance)
+ {
+ if(--mInstance->mReferenceCount == 0)
+ {
+ delete mInstance;
+ mInstance = NULL;
+ }
+ }
+}
+
+void VideoServices::setEngine(QVideoPlayerEngine* engine)
+{
+ Q_UNUSED(engine);
+ // not stubbed
+}
+
+QVideoPlayerEngine* VideoServices::engine()
+{
+ // not stubbed
+ return 0;
+}
+
+VideoServices::VideoServices(QVideoPlayerEngine* engine):
+ mReferenceCount(0),
+ mEngine(engine),
+ mCurrentService(VideoServices::ENoService)
+{
+ mServiceUriFetch = new VideoServiceUriFetch(this);
+}
+
+VideoServices::~VideoServices()
+{
+ delete mServiceUriFetch;
+}
+
+VideoServices::TVideoService VideoServices::currentService()
+{
+ return mCurrentService;
+}
+
+void VideoServices::setCurrentService(VideoServices::TVideoService service)
+{
+ mCurrentService = service;
+}
+QString VideoServices::contextTitle() const
+{
+ // not stubbed
+ return QString();
+}
+
+void VideoServices::itemSelected(const QString& item)
+{
+ Q_UNUSED(item);
+ // not stubbed
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/videoserviceurifetch.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,71 @@
+/*
+ * 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: Implementation of VideoServiceUriFetch
+ *
+ */
+
+#include "videoserviceurifetch.h"
+#include "videoservices.h"
+
+VideoServiceUriFetch::VideoServiceUriFetch(VideoServices* parent):
+ XQServiceProvider("TestListView"),
+ mRequestIndex(0),
+ mServiceApp(parent)
+{
+ // nop
+}
+
+VideoServiceUriFetch::~VideoServiceUriFetch()
+{
+ // nop
+}
+
+void VideoServiceUriFetch::fetchFailed(int errorCode)
+{
+ Q_UNUSED(errorCode);
+ // not stubbed
+}
+
+void VideoServiceUriFetch::complete(QStringList filesList)
+{
+ Q_UNUSED(filesList);
+ // not stubbed
+}
+
+void VideoServiceUriFetch::doComplete(QStringList filesList)
+{
+ Q_UNUSED(filesList);
+ // not stubbed
+}
+
+bool VideoServiceUriFetch::isActive()
+{
+ // not stubbed
+ return false;
+}
+
+QString VideoServiceUriFetch::contextTitle() const
+{
+ // not stubbed
+ return QString();
+}
+
+void VideoServiceUriFetch::fetch(const QString& title)
+{
+ Q_UNUSED(title);
+
+ mServiceApp->setCurrentService(VideoServices::EUriFetcher);
+}
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/videosortfilterproxymodel.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,215 @@
+/*
+* 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"
+
+int VideoSortFilterProxyModelData::mSortRole = -1;
+Qt::SortOrder VideoSortFilterProxyModelData::mSortOrder = Qt::AscendingOrder;
+bool VideoSortFilterProxyModelData::mSortAsync = false;
+bool VideoSortFilterProxyModelData::mDeleteItemsFails = false;
+int VideoSortFilterProxyModelData::mDoSortingCallCount = 0;
+bool VideoSortFilterProxyModelData::mOpenFails = false;
+QList<TMPXItemId> VideoSortFilterProxyModelData::mItemIds = QList<TMPXItemId>();
+QModelIndex VideoSortFilterProxyModelData::mLastIndex = QModelIndex();
+TMPXItemId VideoSortFilterProxyModelData::mLastItemId = TMPXItemId::InvalidId();
+int VideoSortFilterProxyModelData::mDetailsReturnValue = 0;
+
+
+VideoSortFilterProxyModel::VideoSortFilterProxyModel(int type, QObject *parent):
+ QSortFilterProxyModel(parent),
+ mModel(0),
+ mCollectionClient(0),
+ mType(type),
+ mLevel(-1),
+ 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(int 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;
+}
+
+void VideoSortFilterProxyModel::getSorting(int &sortingRole,
+ Qt::SortOrder &order)
+{
+ sortingRole = VideoSortFilterProxyModelData::mSortRole;
+ order = VideoSortFilterProxyModelData::mSortOrder;
+}
+
+int VideoSortFilterProxyModel::deleteItems(const QModelIndexList &indexList)
+{
+ Q_UNUSED(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;
+}
+
+TMPXItemId VideoSortFilterProxyModel::getMediaIdAtIndex(
+ const QModelIndex &index) const
+{
+ if (index.row() >= 0 &&
+ index.row() < VideoSortFilterProxyModelData::mItemIds.count())
+ {
+ return VideoSortFilterProxyModelData::mItemIds[index.row()];
+ }
+ return TMPXItemId::InvalidId();
+}
+
+QString VideoSortFilterProxyModel::getMediaFilePathForId(TMPXItemId mediaId)
+{
+ Q_UNUSED(mediaId);
+ // not stubbed
+ return QString();
+}
+
+TMPXItemId VideoSortFilterProxyModel::addNewAlbum(const QString &title)
+{
+ Q_UNUSED(title);
+ // not stubbed
+ return TMPXItemId::InvalidId();
+}
+
+QString VideoSortFilterProxyModel::resolveAlbumName(
+ const QString& albumName) const
+{
+ Q_UNUSED(albumName);
+ // not stubbed
+ return QString();
+}
+
+int VideoSortFilterProxyModel::addItemsInAlbum(TMPXItemId albumId, const QList<TMPXItemId> &mediaIds)
+{
+ Q_UNUSED(albumId);
+ Q_UNUSED(mediaIds);
+ // not stubbed
+ return 0;
+}
+
+TMPXItemId VideoSortFilterProxyModel::getOpenItem() const
+{
+ // not stubbed
+ return TMPXItemId();
+}
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/videothumbnaildata.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,84 @@
+/*
+* 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: VideoThumbnailData class implementation
+*
+*/
+
+// INCLUDE FILES
+#include "videothumbnaildata.h"
+#include "videothumbnailtestdata.h"
+
+int VideoThumbnailTestData::mInstanceCallCount = 0;
+int VideoThumbnailTestData::mFreeThumbnailDataCallCount = 0;
+int VideoThumbnailTestData::mBackgroundThumbnailFetchingEnabled = 0;
+int VideoThumbnailTestData::mStartBackgroundFetchingCallCount = 0;
+
+VideoThumbnailData &VideoThumbnailData::instance()
+{
+ VideoThumbnailTestData::mInstanceCallCount++;
+ static VideoThumbnailData _thumbnailData;
+ return _thumbnailData;
+}
+
+VideoThumbnailData::VideoThumbnailData()
+{
+ // not stubbed
+}
+
+VideoThumbnailData::~VideoThumbnailData()
+{
+ // not stubbed
+}
+
+bool VideoThumbnailData::removeThumbnail(TMPXItemId mediaId)
+{
+ Q_UNUSED(mediaId);
+
+ // not stubbed
+
+ return true;
+}
+
+const QIcon* VideoThumbnailData::getThumbnail(TMPXItemId mediaId)
+{
+ Q_UNUSED(mediaId);
+
+ // not stubbed
+
+ return 0;
+}
+
+void VideoThumbnailData::startBackgroundFetching(VideoSortFilterProxyModel *model, int fetchIndex)
+{
+ Q_UNUSED(model);
+ Q_UNUSED(fetchIndex);
+
+ VideoThumbnailTestData::mStartBackgroundFetchingCallCount++;
+}
+
+void VideoThumbnailData::enableBackgroundFetching(bool enable)
+{
+ VideoThumbnailTestData::mBackgroundThumbnailFetchingEnabled = enable;
+}
+
+void VideoThumbnailData::enableThumbnailCreation(bool enable)
+{
+ Q_UNUSED(enable);
+ // not stubbed
+}
+
+void VideoThumbnailData::freeThumbnailData()
+{
+ VideoThumbnailTestData::mFreeThumbnailDataCallCount++;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/tsrc/stubs/src/xqserviceutilxtra.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,90 @@
+/**
+* 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:
+*
+*/
+
+#include "xqserviceutilxtra.h"
+
+XQServiceUtilXtra* XQServiceUtilXtra::mInstance = 0;
+int XQServiceUtilXtra::mReferenceCount = 0;
+bool XQServiceUtilXtra::service = false;
+
+// -----------------------------------------------------------------------------
+// XQServiceUtilXtra::instance()
+// -----------------------------------------------------------------------------
+//
+XQServiceUtilXtra* XQServiceUtilXtra::instance()
+{
+ if(!mInstance)
+ {
+ mInstance = new XQServiceUtilXtra();
+ }
+ mInstance->mReferenceCount++;
+ return mInstance;
+}
+
+// -----------------------------------------------------------------------------
+// XQServiceUtilXtra::decreaseReferenceCount()
+// -----------------------------------------------------------------------------
+//
+void XQServiceUtilXtra::decreaseReferenceCount()
+{
+ if(mInstance)
+ {
+ if(--mInstance->mReferenceCount == 0)
+ {
+ delete mInstance;
+ mInstance = NULL;
+ }
+ }
+}
+
+
+// ----------------------------------------------------------------------------
+// XQServiceUtilXtra()
+// ----------------------------------------------------------------------------
+//
+XQServiceUtilXtra::XQServiceUtilXtra()
+{
+}
+
+// ----------------------------------------------------------------------------
+// ~XQServiceUtilXtra()
+// ----------------------------------------------------------------------------
+//
+XQServiceUtilXtra::~XQServiceUtilXtra()
+{
+}
+
+
+// ----------------------------------------------------------------------------
+// currentService()
+// ----------------------------------------------------------------------------
+//
+bool XQServiceUtilXtra::currentService()
+{
+ return mInstance->service;
+}
+
+
+// ----------------------------------------------------------------------------
+// setCurrentService()
+// ----------------------------------------------------------------------------
+//
+void XQServiceUtilXtra::setCurrentService(bool aservice)
+{
+ mInstance->service = aservice;
+}
+
--- a/videocollection/videocollectionview/data/collectionview.docml Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionview/data/collectionview.docml Thu Apr 01 23:22:15 2010 +0300
@@ -1,28 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<hbdocument version="0.9">
<object name="vc:mAddtoCollection" type="HbAction">
- <string locid="Add to collection..." name="text"/>
+ <string locid="txt_videos_opt_add_to_collection" name="text"/>
</object>
<object name="vc:mCreateNewCollection" type="HbAction">
- <string locid="Create new collection..." name="text"/>
+ <string locid="txt_videos_opt_create_new_collection" name="text"/>
</object>
<object name="vc:mDeleteMultiple" type="HbAction">
- <string locid="Delete..." name="text"/>
+ <string locid="txt_common_opt_delete" name="text"/>
</object>
<object name="vc:mDate" type="HbAction">
- <string locid="Date" name="text"/>
+ <string locid="txt_videos_opt_sub_date" name="text"/>
</object>
<object name="vc:mName" type="HbAction">
- <string locid="Name" name="text"/>
+ <string locid="txt_videos_opt_sort_by_sub_name" name="text"/>
</object>
<object name="vc:mNumberOfItems" type="HbAction">
- <string locid="Number of items" name="text"/>
+ <string locid="txt_videos_opt_sort_by_sub_number_of_items" name="text"/>
</object>
<object name="vc:mTotalLength" type="HbAction">
- <string locid="Total length" name="text"/>
+ <string locid="txt_videos_opt_sort_by_sub_total_length" name="text"/>
</object>
<object name="vc:mSize" type="HbAction">
- <string locid="Size" name="text"/>
+ <string locid="txt_videos_opt_sort_by_sub_size" name="text"/>
</object>
<widget name="view" type="VideoListView">
<widget name="vc:mOptionsMenu" role="HbView:menu" type="HbMenu">
@@ -35,38 +35,46 @@
<ref object="vc:mNumberOfItems" role="HbMenu:addAction"/>
<ref object="vc:mTotalLength" role="HbMenu:addAction"/>
<ref object="vc:mSize" role="HbMenu:addAction"/>
- <string locid="Sort by" name="title"/>
+ <string locid="txt_videos_opt_sort_by" name="title"/>
</widget>
</widget>
<widget name="content" role="HbView:widget" type="HbWidget">
- <widget name="vc:mBanner" type="HbGroupBox"/>
<widget name="vc:mStackedLayout" type="HbWidget">
<widget name="vc:mListWidget" type="VideoListWidget">
- <sizehint height="47.7612un" type="PREFERRED" width="35.8209un"/>
+ <sizehint height="77.31344un" type="PREFERRED" width="51.04478un"/>
+ <bool name="visible" value="FALSE"/>
+ </widget>
+ <widget name="vc:mCollectionWidget" type="VideoListWidget">
+ <sizehint height="77.31344un" type="PREFERRED" width="51.04478un"/>
+ <bool name="visible" value="FALSE"/>
+ </widget>
+ <widget name="vc:mCollectionContentWidget" type="VideoListWidget">
+ <sizehint height="77.31344un" type="PREFERRED" width="51.04478un"/>
<bool name="visible" value="FALSE"/>
</widget>
<widget name="vc:mHintWidget" type="VideoHintWidget">
<widget name="vc:mNoVideosLabel" type="HbLabel">
<enums name="alignment" value="AlignVCenter|AlignHCenter"/>
+ <sizehint height="6un" type="PREFERRED"/>
<sizehint height="6un" type="MAXIMUM" width="2504062.01158un"/>
- <bool name="visible" value="TRUE"/>
- <string name="plainText" value="(No videos)"/>
- <sizehint height="6un" type="PREFERRED"/>
+ <bool name="visible" value="FALSE"/>
+ <string locid="txt_videos_info_no_videos" name="plainText" value="(No videos)"/>
</widget>
<widget name="vc:mHintTextLabel" type="HbLabel">
<enums name="textWrapping" value="TextWordWrap"/>
<enums name="alignment" value="AlignVCenter|AlignHCenter"/>
+ <sizehint height="6un" type="PREFERRED"/>
<sizehint height="6un" type="MAXIMUM" width="2504062.01158un"/>
- <bool name="visible" value="TRUE"/>
- <string name="plainText" value="To get videos, visit OVI store"/>
- <sizehint height="6un" type="PREFERRED"/>
+ <bool name="visible" value="FALSE"/>
+ <string locid="txt_videos_info_to_get_videos_visit_ovi_store" name="plainText" value="To get videos, visit OVI store"/>
</widget>
<widget name="vc:mHintButtonLayout" type="HbWidget">
<widget name="vc:mHintButton" type="HbPushButton">
<real name="z" value="1"/>
+ <sizehint type="PREFERRED" width="12un"/>
<sizehint height="6un" type="MAXIMUM" width="12un"/>
- <bool name="visible" value="TRUE"/>
- <sizehint type="PREFERRED" width="12un"/>
+ <bool name="visible" value="FALSE"/>
+ <string name="state" value="normal"/>
</widget>
<real name="z" value="0"/>
<sizehint height="11.9403un" type="PREFERRED" width="23.8806un"/>
@@ -78,6 +86,7 @@
</widget>
<real name="z" value="0"/>
<sizehint height="23.8806un" type="PREFERRED" width="23.8806un"/>
+ <bool name="visible" value="FALSE"/>
<layout orientation="Vertical" type="linear">
<stretchitem stretchfactor="1"/>
<linearitem itemname="vc:mNoVideosLabel"/>
@@ -87,19 +96,34 @@
</layout>
</widget>
<real name="z" value="0"/>
- <sizehint height="23.8806un" type="PREFERRED" width="23.8806un"/>
+ <sizehint height="77.31344un" type="PREFERRED" width="51.04478un"/>
+ <bool name="visible" value="TRUE"/>
<layout type="stacked">
<stackitem itemname="vc:mListWidget"/>
+ <stackitem itemname="vc:mCollectionWidget"/>
+ <stackitem itemname="vc:mCollectionContentWidget"/>
<stackitem itemname="vc:mHintWidget"/>
</layout>
</widget>
- <layout orientation="Vertical" type="linear">
- <linearitem itemname="vc:mBanner"/>
- <linearitem itemname="vc:mStackedLayout"/>
+ <widget name="vc:mBanner" type="HbGroupBox">
+ <string name="titleText" value="Group Box"/>
+ <sizehint height="4.92537un" type="PREFERRED" width="51.04478un"/>
+ <bool name="collapsable" value="FALSE"/>
+ <bool name="visible" value="FALSE"/>
+ </widget>
+ <real name="z" value="0"/>
+ <layout type="anchor">
+ <anchoritem dst="vc:mBanner" dstEdge="LEFT" spacing="var(hb-param-margin-view-right)" src="" srcEdge="LEFT"/>
+ <anchoritem dst="vc:mBanner" dstEdge="TOP" spacing="var(hb-param-margin-view-top)" src="" srcEdge="TOP"/>
+ <anchoritem dst="vc:mBanner" dstEdge="RIGHT" spacing="var(hb-param-margin-view-left)" src="" srcEdge="RIGHT"/>
+ <anchoritem dst="vc:mStackedLayout" dstEdge="LEFT" spacing="var(hb-param-margin-view-left)" src="" srcEdge="LEFT"/>
+ <anchoritem dst="vc:mStackedLayout" dstEdge="RIGHT" spacing="var(hb-param-margin-view-right)" src="" srcEdge="RIGHT"/>
+ <anchoritem dst="vc:mStackedLayout" dstEdge="TOP" spacing="var(hb-param-margin-view-top)" src="vc:mBanner" srcEdge="BOTTOM"/>
+ <anchoritem dst="vc:mStackedLayout" dstEdge="BOTTOM" spacing="var(hb-param-margin-view-bottom)" src="" srcEdge="BOTTOM"/>
</layout>
</widget>
</widget>
- <metadata activeUIState="Common ui state" display="QHD portrait" unit="un">
+ <metadata activeUIState="Common ui state" display="NHD portrait" unit="un">
<uistate name="Common ui state" sections="#common"/>
</metadata>
</hbdocument>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/data/hblistviewitem.css Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,4 @@
+HbListViewItem::icon-1[graphicsSize="Image"]:portrait{
+ fixed-height: 12.0un;
+ fixed-width: 16.8645un;
+}
--- a/videocollection/videocollectionview/data/videocollectionview.qrc Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionview/data/videocollectionview.qrc Thu Apr 01 23:22:15 2010 +0300
@@ -13,4 +13,7 @@
<file>images/services_icon.svg</file>
<file>images/services_icon_pressed.svg</file>
</qresource>
+ <qresource prefix="/style" >
+ <file>hblistviewitem.css</file>
+ </qresource>
</RCC>
--- a/videocollection/videocollectionview/inc/videocollectionuiloader.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionview/inc/videocollectionuiloader.h Thu Apr 01 23:22:15 2010 +0300
@@ -20,6 +20,8 @@
// System includes
#include <hbdocumentloader.h>
+#include <qhash.h>
+#include <qmap.h>
// Constants
static const char* DOCML_VIDEOCOLLECTIONVIEW_FILE = ":/layout/collectionview.docml";
@@ -27,6 +29,8 @@
// Videocollection View
static const char* DOCML_NAME_VC_HEADINGBANNER = "vc:mBanner";
+static const char* DOCML_NAME_VC_COLLECTIONWIDGET = "vc:mCollectionWidget";
+static const char* DOCML_NAME_VC_COLLECTIONCONTENTWIDGET = "vc:mCollectionContentWidget";
static const char* DOCML_NAME_VC_VIDEOLISTWIDGET = "vc:mListWidget";
static const char* DOCML_NAME_VC_VIDEOHINTWIDGET = "vc:mHintWidget";
@@ -51,25 +55,116 @@
// Videocollection hint widget
static const char* DOCML_NAME_HINT_BUTTON = "vc:mHintButton";
static const char* DOCML_NAME_HINT_LABEL = "vc:mHintTextLabel";
+static const char* DOCML_NAME_NO_VIDEOS_LABEL = "vc:mNoVideosLabel";
// video multiselection dialog
static const char* DOCML_VIDEOSELECTIONDIALOG_FILE = ":/layout/videolistselectiondialog.docml";
static const char* DOCML_NAME_DIALOG = "mMultiSelectionDialog";
static const char* DOCML_NAME_DLG_HEADINGLBL = "mHeadingLabel";
+static const char* DOCML_NAME_CHECK_CONTAINER = "mCheckBoxContainer";
static const char* DOCML_NAME_MARKALL = "mCheckMarkAll";
static const char* DOCML_NAME_LBL_SELECTION = "mSelectionCount";
static const char* DOCML_NAME_LIST_CONTAINER = "mListContainer";
+// async loading timeout
+static const int ASYNC_FIND_TIMEOUT = 50; // ms
+
+class QActionGroup;
+class HbAction;
// Class declaration
-class VideoCollectionUiLoader : public HbDocumentLoader
+class VideoCollectionUiLoader:
+ public QObject,
+ public HbDocumentLoader
{
+ Q_OBJECT
+
+private:
+ /** actions used in menus and toolbars */
+ enum ActionIds
+ {
+ EActionSortBy = 1,
+ EActionSortByDate,
+ EActionSortByName,
+ EACtionSortByItemCount,
+ EActionSortByLength,
+ EActionSortBySize,
+ EActionNewCollection,
+ EActionAddToCollection,
+ EActionDelete,
+ ETBActionAllVideos,
+ ETBActionCollections,
+ ETBActionServices,
+ ETBActionAddVideos,
+ ETBActionRemoveVideos,
+ ETBActionSortVideos
+ };
+
+ /** VideoCollectionUiLoader parameter class */
+ class Params
+ {
+ public:
+ Params(const QString& name,
+ bool isWidget = false,
+ QObject *receiver = 0,
+ const char *docml = 0,
+ const char *member = 0):
+ mName(name),
+ mIsWidget(isWidget),
+ mReceiver(receiver),
+ mDocml(docml),
+ mMember(member)
+ {
+ // nothing to do
+ }
+
+ bool isDuplicate(const Params& params) const
+ {
+ bool isSame(false);
+
+ if (mName == params.mName &&
+ mReceiver == params.mReceiver &&
+ mDocml == params.mDocml &&
+ mMember == params.mMember)
+ {
+ isSame = true;
+ }
+
+ return isSame;
+ }
+
+ public:
+ QString mName;
+ bool mIsWidget;
+ QObject *mReceiver;
+ const char *mDocml;
+ const char *mMember;
+ };
public:
-
+ /**
+ * C++ constructor.
+ */
VideoCollectionUiLoader();
-
- ~VideoCollectionUiLoader();
+
+ /**
+ * C++ destructor.
+ */
+ virtual ~VideoCollectionUiLoader();
+
+ /**
+ * Starts to load a specified UI section.
+ *
+ * @param uiSection, UI section to load.
+ * @param receiver, Receiver of a ready signal.
+ * @param widgetSlot, Slot which is called when a widget is ready.
+ * @param objectSlot, Slot which is called when an object is ready.
+ * @return None.
+ */
+ void startLoading(QSet<QString> uiSections,
+ QObject *receiver,
+ const char *widgetSlot,
+ const char *objectSlot);
/**
* Returns the requested widget casted to correct type
@@ -78,9 +173,9 @@
* @return Pointer to the widget
*/
template<class T>
- T* findWidget( QString name )
+ T* findWidget(const QString &name)
{
- return qobject_cast<T*>( HbDocumentLoader::findWidget( name ) );
+ return qobject_cast<T*>(doFindWidget(name));
}
/**
@@ -90,14 +185,112 @@
* @return Pointer to the object
*/
template<class T>
- T* findObject( QString name )
+ T* findObject(const QString &name)
{
- return qobject_cast<T*>( HbDocumentLoader::findObject( name ) );
+ return qobject_cast<T*>(doFindObject(name));
}
+
+ /**
+ * Set video services in use.
+ */
+ void setIsService(bool isService);
+signals:
+ /**
+ * Signals that widget has been loaded asynchonously.
+ *
+ * @param widget, Widget which was loaded.
+ * @param name, Name of the widget in document.
+ * @return None.
+ */
+ void widgetReady(QGraphicsWidget *widget, const QString &name);
+
+ /**
+ * Signals that object has been loaded asynchonously.
+ *
+ * @param object, Object which was loaded.
+ * @param name, Name of the object in document.
+ * @return None.
+ */
+ void objectReady(QObject *object, const QString &name);
+
+public:
+ /**
+ * Loads widget from document.
+ *
+ * @param name, Widget name.
+ * @return QGraphicsWidget*.
+ */
+ QGraphicsWidget* doFindWidget(const QString &name);
+
+ /**
+ * Loads object from document.
+ *
+ * @param name, Widget name.
+ * @return QGraphicsWidget*.
+ */
+ QObject* doFindObject(const QString &name);
+
private:
+ /**
+ * Adds a ui section to async loading queue.
+ */
+ void addToQueue(Params ¶ms);
+
+ /**
+ * Init a specific widget.
+ */
+ void initWidget(QGraphicsWidget *widget,
+ const QString &name);
+
+ /**
+ * Init a specific object.
+ */
+ void initObject(QObject *object,
+ const QString& name);
+
+private:
+ /** from QObject */
+ void timerEvent(QTimerEvent *event);
+
+ /** from HbDocumentLoader */
+ QObject *createObject(const QString& type, const QString &name);
+
+private:
+ /**
+ * Run next async find request from queue.
+ */
+ void runNext();
+
+ /**
+ * Check that set params are valid.
+ */
+ bool isValid(const Params ¶ms);
+
+private:
+ /** async queue */
+ QList<Params> mQueue;
+
+ /** timer id */
+ int mTimerId;
+
+ /** list of loaded widgets */
+ QHash<QString, QGraphicsWidget*> mWidgets;
- QObject *createObject( const QString& type, const QString &name );
+ /** list of loaded objects */
+ QHash<QString, QObject*> mObjects;
+
+ /** menu actions */
+ QMap<ActionIds, HbAction*> mMenuActions;
+
+ /** toolbar actions */
+ QMap<ActionIds, HbAction*> mToolbarActions;
+
+ /** action group for "sort by" actions */
+ QActionGroup* mSortGroup;
+
+ /** is service */
+ bool mIsService;
};
#endif // _VIDEOCOLLECTIONUILOADER_H_
--- a/videocollection/videocollectionview/inc/videocollectionviewplugin.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionview/inc/videocollectionviewplugin.h Thu Apr 01 23:22:15 2010 +0300
@@ -1,37 +1,30 @@
/*
-* 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: VideoCollectionViewPlugin class definition
-*
-*/
+ * 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: VideoCollectionViewPlugin class definition
+ *
+ */
#ifndef VIDEOVIEWPLUGIN_H
#define VIDEOVIEWPLUGIN_H
+#include <mpxviewpluginqt.h>
-// INCLUDES
-#include <qobject>
-#include <mpxviewpluginqt.h>
-#include <qpointer.h>
-
-class HbAction;
class VideoCollectionUiLoader;
class VideoListView;
-
-class VideoCollectionViewPlugin : public MpxViewPlugin
- {
-
+class VideoCollectionViewPlugin: public MpxViewPlugin
+{
Q_OBJECT
public: // Constructor / destructor
@@ -39,41 +32,41 @@
/**
* Contructor.
*
- */
+ */
VideoCollectionViewPlugin();
-
+
/**
* Destructor.
*
- */
+ */
virtual ~VideoCollectionViewPlugin();
public: // from QViewPlugin
-
+
/**
* Allocates view and it's objects to be ready to
* be activated.
*
*/
void createView();
-
+
/**
* Deallocates view and it's objects.
*/
void destroyView();
-
+
/**
* Activates view
*
*/
void activateView();
-
+
/**
* Deactivates view
*
*/
void deactivateView();
-
+
/**
* Returns a pointer to the view
*
@@ -88,7 +81,7 @@
*
* @param command id
*/
- void command( int );
+ void command(int);
public slots: // from QViewPlugin
@@ -98,35 +91,32 @@
*
* @param orientation new orientation
*/
- void orientationChange( Qt::Orientation orientation );
-
+ void orientationChange(Qt::Orientation orientation);
+
/**
* Plugin user can notify oback button changes by connecting into this slot
*
*/
void back();
-
private:
-
+
/**
* docml ui loader, owned
*/
VideoCollectionUiLoader *mUiLoader;
-
+
/**
* View object, owned
*/
VideoListView *mView;
-
+
/**
* Activated flag. Set as true when view is properly activated.
* If flag is false, no operations can be do to the view.
*/
bool mActivated;
-
- };
+};
#endif // VIDEOVIEWPLUGIN_H
-
// End of File
--- a/videocollection/videocollectionview/inc/videocollectionviewutils.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionview/inc/videocollectionviewutils.h Thu Apr 01 23:22:15 2010 +0300
@@ -20,12 +20,14 @@
#include <qobject.h>
+class HbListView;
+class VideoSortFilterProxyModel;
+
class VideoCollectionViewUtils : public QObject
{
Q_OBJECT
public:
-
/**
* Returns singleton instance for this class.
*
@@ -68,7 +70,19 @@
* @return Service URI string. Invalid string in error cases.
*/
QString getServiceUriString();
-
+
+public:
+ /**
+ * Initializes list view for collection and selection dialog with common
+ * properties.
+ */
+ static void initListView(HbListView *view);
+
+ /**
+ * Initilizes model sort values.
+ */
+ static void sortModel(VideoSortFilterProxyModel *model, bool async);
+
public slots:
/**
@@ -96,7 +110,12 @@
*/
virtual ~VideoCollectionViewUtils();
+private:
+ /** current sorting role */
+ int mSortRole;
+ /** current sorting order */
+ Qt::SortOrder mSortOrder;
};
#endif //__VIDEOCOLLECTIONUIUTILS_H__
--- a/videocollection/videocollectionview/inc/videohintwidget.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionview/inc/videohintwidget.h Thu Apr 01 23:22:15 2010 +0300
@@ -20,6 +20,7 @@
#define VIDEOHINTWIDGET_H
#include <hbwidget.h>
+#include <hbicon.h>
class HbPushButton;
class HbLabel;
@@ -71,11 +72,19 @@
void setLevel(HintLevel level);
/**
- * Overridden from QGraphicsItem. Sets the visibility of this widget.
- *
- * @param visible true if widget is set visible, false othervise.
+ * Adjusts if the button is shown in landscape.
+ */
+ void setButtonShown(bool shown);
+
+ /**
+ * Method enables and displays this widget.
*/
- void setVisible(bool visible);
+ void activate();
+
+ /**
+ * Method disables and hides this widget.
+ */
+ void deactivate();
private slots:
@@ -87,18 +96,6 @@
private:
/**
- * Method enables and displays current active view
- *
- * @return int 0 initialization ok, < 0 if fails.
- */
- void activate();
-
- /**
- * Method disables and hides current active view
- */
- void deactivate();
-
- /**
* Shows/hides the correct UI components for current state.
*/
void updateUiComponents();
@@ -112,16 +109,6 @@
*/
VideoCollectionUiLoader *mUiLoader;
- /**
- * Service button object.
- */
- HbPushButton *mServiceButton;
-
- /**
- * Hint text label (ie. the second row label).
- */
- HbLabel *mHintLabel;
-
/**
* Service icon resource string.
*/
@@ -138,9 +125,24 @@
HbIcon *mServiceIcon;
/**
+ * Add videos icon.
+ */
+ HbIcon *mAddVideosIcon;
+
+ /**
* Current hint level.
*/
HintLevel mCurrentLevel;
+
+ /**
+ * If button is shown in landscape at all.
+ */
+ bool mButtonShown;
+
+ /**
+ * true if widget has been activated.
+ */
+ bool mActivated;
};
--- a/videocollection/videocollectionview/inc/videolistselectiondialog.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionview/inc/videolistselectiondialog.h Thu Apr 01 23:22:15 2010 +0300
@@ -19,17 +19,20 @@
#define VIDEOLISTSELECTIONDIALOG_H
#include <hbdialog.h>
-#include <qlist.h>
+#include <qset.h>
#include <qitemselectionmodel.h>
+#include <mpxitemid.h>
class QGraphicItem;
class QItemSelection;
+class HbWidget;
class HbLabel;
class HbCheckBox;
class HbStackedWidget;
+class VideoCollectionUiLoader;
+class VideoCollectionWrapper;
+class VideoSortFilterProxyModel;
class VideoListWidget;
-class VideoCollectionUiLoader;
-class VideoSortFilterProxyModel;
class VideoListSelectionDialog: public HbDialog
{
@@ -46,6 +49,13 @@
public:
+ enum TSelectionFunction
+ {
+ EDeleteVideos,
+ EAddToCollection,
+ ESelectCollection
+ };
+
/**
* Constructor
*
@@ -65,19 +75,11 @@
* If either provided title is empty or widget is NULL, dialog
* is in invalid state and cannot be shown using exec.
*
- * @param title title of the dialog
- * @param videoList videolist widget.
+ * @param type selection dialog function typy
+ * @param activeItem id of item that the selection concerns
*/
- void setContent(const QString &title, VideoListWidget *videoList);
+ void setupContent(int type, TMPXItemId activeItem = TMPXItemId::InvalidId());
- /**
- * Returns selection (mSelection). Selection will be empty in case
- * dialog is closed using cancell button,
- *
- * @return HbAction primary action if "OK" iis pressed
- */
- const QItemSelection& getSelection() const;
-
public slots:
/**
@@ -111,14 +113,51 @@
void selectionChangedSlot(const QItemSelection &selected, const QItemSelection &deselected);
/**
+ * connected to list's activated -signal. Called when singel item is selected.
+ * If dialog's selection type is ESelectCollection, saves mpx id from provided index.
+ * and closes dialog by triggering primary action
+ *
+ * @param index of item selected
+ */
+ void singleItemSelectedSlot(const QModelIndex &index);
+
+ /**
+ * handles model ready signal from model.
+ * In case dialog type is ESelectCollection and there are no data
+ * in model, opens up a selection dialog for user to input new album name
+ * In case type is something else than ESelectCollection, calls
+ * updateCounterSlot()
+ */
+ void modelReadySlot();
+
+ /**
* Changes the counter value. Sets the checkbutton state based on selection count.
*
*/
void updateCounterSlot();
+ /**
+ * Primary action triggered signal slot.
+ *
+ */
+ void primaryActionTriggeredSlot();
+
private:
/**
+ * Method initializes dialog by getting all ui components and
+ * checking if they are valid
+ *
+ * @return bool true if inisializaion ok
+ */
+ bool initDialog();
+
+ /**
+ * Method activated dialog based on value in mTypeOfSelection
+ */
+ void activateSelection();
+
+ /**
* connects all required signals into appropriate slots
* for selection mode
*/
@@ -129,17 +168,32 @@
*/
void disconnectSignals();
-private:
+ /**
+ * Gets selected item's name from appropriate model.
+ *
+ * @return QString item's name
+ */
+ QString getSelectedName();
+
+ /**
+ * opens an input dialog for a user to input new album name
+ * If everything goes well and user accepts, method returns new album id
+ *
+ * @return TMPXItemId new album id or TMPXItemID::Invalid() in case of cancel
+ */
+ TMPXItemId queryNewAlbum();
+
+private:
/**
* docml UI loader, not owned
*/
VideoCollectionUiLoader *mUiLoader;
-
+
/**
- * content videolist, not owned
+ * type for defining selection functionality
*/
- VideoListWidget *mVideoList;
+ int mTypeOfSelection;
/**
* Selection
@@ -147,11 +201,26 @@
QItemSelection mSelection;
/**
+ * Selected video items
+ */
+ QSet<TMPXItemId> mSelectedVideos;
+
+ /**
+ * selected single items album id
+ */
+ TMPXItemId mSelectedAlbumId;
+
+ /**
* header label
*/
HbLabel *mHeading;
/**
+ * container widget for itemcount and checkbox;
+ */
+ HbWidget *mCheckboxContainer;
+
+ /**
* counter label from docml
*/
HbLabel *mItemCount;
@@ -170,8 +239,17 @@
* flag indicating that we've changed check-btn state
* explicitly and don't wanna handle selection based on that
*/
- bool mForcedCheck;
+ bool mForcedCheck;
+ /**
+ * Video list model
+ */
+ VideoSortFilterProxyModel *mModel;
+
+ /**
+ * List widget to show in selection
+ * */
+ VideoListWidget *mListWidget;
};
#endif //VIDEOLISTSELECTIONDIALOG_H
--- a/videocollection/videocollectionview/inc/videolistview.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionview/inc/videolistview.h Thu Apr 01 23:22:15 2010 +0300
@@ -21,11 +21,13 @@
#include <hbview.h>
#include <qnamespace.h>
-#include <QtCore/QtGlobal>
+#include <qabstractitemmodel.h>
+#include <hbaction.h>
+
+#include "videohintwidget.h"
class QGraphicsItem;
class VideoListWidget;
-class VideoHintWidget;
class QActionGroup;
class QVariant;
class VideoCollectionViewUtils;
@@ -95,7 +97,6 @@
*/
void back();
-
signals:
/**
@@ -143,6 +144,12 @@
*
*/
void openCollectionViewSlot();
+
+ /**
+ * Slot is connected to model's about to insert rows signal.
+ * Opens the new album which was created.
+ */
+ void openNewAlbumSlot(const QModelIndex &parent, int start, int end);
/**
* Slot is connected into toolbar's Service tab's
@@ -219,17 +226,28 @@
* @param collectionOpened
* @param collection contains the name of the collection opened
*/
- void collectionOpenedSlot(bool collectionOpened, const QString& collection);
+ void collectionOpenedSlot(bool collectionOpened,
+ const QString& collection,
+ const QModelIndex &index);
/**
* Slot is connected into toolbar's sort by tab's
* triggered signal.
*
* Activates sort by popup menu.
- *
*/
void openSortByMenuSlot();
-
+
+ /**
+ * Slot which is called when a widget has been loaded.
+ */
+ void widgetReadySlot(QGraphicsWidget *widget, const QString &name);
+
+ /**
+ * Slot which is called when an object has been loaded.
+ */
+ void objectReadySlot(QObject *object, const QString &name);
+
// TODO: following can be removed after all implementation ready
/**
* Slot is connected into item signals that are not yet implemented.
@@ -263,32 +281,9 @@
* @param slot Slot for the triggered signal of the action.
* @return HbAction pointer if creation ok, otherwise 0
*/
- HbAction* createAction(QString tooltip, QString icon, QActionGroup* actionGroup, const char *slot);
-
- /**
- * Method creates collection view's main menu and actions
- *
- * @return 0 creation ok, < 0 creation fails
- */
- int createMainMenu();
+ HbAction* createAction(QString icon, QActionGroup* actionGroup, const char *slot);
/**
- * Method initialises all videos widget used to show all videos
- * either in list or grid. Method also connects signals emitted by the view into
- * corresponding slots.
- *
- * @return 0 creation ok, < 0 creation fails
- */
- int createVideoWidget();
-
- /**
- * Method initializes the mVideoHintWidget.
- *
- * @return 0 creation ok, < 0 creation fails.
- */
- int createHintWidget();
-
- /**
* Shows or hides the hint. Only shows the hint if model does not have any
* items.
*
@@ -297,10 +292,30 @@
void showHint(bool show = true);
/**
+ *
+ */
+ void setHintLevel(VideoHintWidget::HintLevel level);
+
+ /**
* Updates the sublabel text.
*/
void updateSubLabel();
-
+
+ /**
+ * Shows or hides a menu action.
+ */
+ void showAction(bool show, const QString &name);
+
+ /**
+ * Check if menu action is checked.
+ */
+ bool isActionChecked(const QString &name);
+
+ /**
+ * Sets an action as checked.
+ */
+ void setActionChecked(bool setChecked, const QString &name);
+
private:
/**
@@ -308,29 +323,14 @@
*/
enum TViewActionIds
{
- EActionSortBy = 1,
- EActionSortByDate,
- EActionSortByName,
- EACtionSortByItemCount,
- EActionSortByLength,
- EActionSortBySize,
- EActionNewCollection,
- EActionAddToCollection,
- EActionDelete,
- ETBActionAllVideos,
- ETBActionCollections,
- ETBActionServices,
- ETBActionAddVideos,
- ETBActionRemoveVideos,
- ETBActionSortVideos
+ ETBActionAllVideos = 10,
+ ETBActionCollections = 11,
+ ETBActionServices = 12,
+ ETBActionAddVideos = 13,
+ ETBActionRemoveVideos = 14,
+ ETBActionSortVideos = 15
};
-
- /**
- * sort menu object.
- */
- HbMenu *mSortMenu;
-
/**
* reference to video collection view utils
*/
@@ -339,7 +339,7 @@
/**
* pointer to videocollectionwrapper
*/
- VideoCollectionWrapper *mWrapper;
+ VideoCollectionWrapper &mWrapper;
/**
* Pointer to the XML UI (DocML) loader, not owned
@@ -347,11 +347,6 @@
VideoCollectionUiLoader* mUiLoader;
/**
- * view model object.
- */
- VideoSortFilterProxyModel *mModel;
-
- /**
* Boolean for knowing when the app was started as a service.
*/
bool mIsService;
@@ -362,31 +357,16 @@
bool mModelReady;
/**
- * HbGroupBox object loaded from docml
- */
- HbGroupBox* mSubLabel;
-
- /**
- * Options menu object loaded from docml
- */
- HbMenu* mOptionsMenu;
-
- /**
* pointer to videoservices instance
*/
VideoServices* mVideoServices;
/**
- * Widget for showing all videos
+ * Currently used list
*/
- VideoListWidget* mVideoListWidget;
+ VideoListWidget* mCurrentList;
/**
- * Widget for showing the hint text.
- */
- VideoHintWidget* mVideoHintWidget;
-
- /**
* Action group for the toolbar.
*/
QActionGroup* mToolbarViewsActionGroup;
@@ -397,11 +377,6 @@
QActionGroup* mToolbarCollectionActionGroup;
/**
- * map containing pointers to main menu actions
- */
- QMap<TViewActionIds, HbAction*> mMenuActions;
-
- /**
* map containing toolbar actions
*/
QMap<TViewActionIds, HbAction*> mToolbarActions;
@@ -415,12 +390,6 @@
* String containing the name of the currently open collection
*/
QString mCollectionName;
-
- /**
- * selection dialog
- */
- VideoListSelectionDialog *mSelectionDialog;
-
};
#endif // VIDEOLISTVIEW_H
--- a/videocollection/videocollectionview/inc/videolistwidget.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionview/inc/videolistwidget.h Thu Apr 01 23:22:15 2010 +0300
@@ -19,20 +19,18 @@
#ifndef VIDEOLISTWIDGET_H
#define VIDEOLISTWIDGET_H
-#include <QGraphicsWidget>
-#include <QPixmap>
-#include <QModelIndex>
-#include <qmap.h>
-#include <qpoint.h>
#include <hbview.h>
#include <hblistview.h>
+#include <qmap.h>
#include <mpxitemid.h>
+#include "videocollectioncommon.h"
class VideoSortFilterProxyModel;
+class VideoServices;
+class VideoCollectionUiLoader;
class HbAction;
class HbMenu;
class QTimer;
-
class QItemSelection;
class VideoServices;
@@ -47,29 +45,16 @@
{
Q_OBJECT
Q_DISABLE_COPY(VideoListWidget)
+
public:
- enum TVideoListLevel
- {
- ELevelCategory = 2,
- ELevelVideos = 3
- };
-
- enum TVideoListType
- {
- EUnknown,
- EAllVideos, // list displaying all videos
- ECollections, // list displaying all collections
- EDefaultColItems, // list displying videos in default collection
- EUserColItems // list displaying videos in user defined collection
- };
/**
* Contructor.
- *
+ * @param uiloader
* @param parent parent of this widget
*/
- VideoListWidget(HbView *parent = 0);
+ VideoListWidget(VideoCollectionUiLoader *uiLoader, HbView *parent = 0);
/**
* Destructor.
@@ -98,20 +83,20 @@
*
* @return int 0 initialization ok, < 0 if fails.
*/
- int activate(VideoListWidget::TVideoListLevel role);
+ int activate(VideoCollectionCommon::TCollectionLevels level);
/**
* Method disables and hides current active view
*
*/
void deactivate();
-
+
/**
- * Used for resolving widget's current type
- *
- * @return TVideoListType current level.
+ * returns current level provided by activate
+ *
+ * @return TCollectionLevels
*/
- TVideoListType getType();
+ VideoCollectionCommon::TCollectionLevels getLevel();
/**
* returns widget's model
@@ -120,7 +105,7 @@
*/
VideoSortFilterProxyModel& getModel();
-protected:
+public:
/**
* Called by the fw when some item is tapped. Method check that
@@ -130,6 +115,16 @@
* @param midelIndex, item's index
*/
void emitActivated (const QModelIndex &modelIndex);
+
+ /**
+ * Overwritten from Abstractitemview.
+ * Sets local selection mode variable value used locally in checks.
+ * If provided value is mode provided by HbAbstractitemview sets
+ * it as view selection mode othervise NoSelection is setted
+ *
+ * @param mode
+ */
+ void setSelectionMode(int mode);
signals:
@@ -147,7 +142,7 @@
* @param true if opened, false if closed.
* @param optional name string
*/
- void collectionOpened(bool, const QString&);
+ void collectionOpened(bool, const QString&, const QModelIndex&);
/**
* signal is connected to service's itemSelected -slot
@@ -189,18 +184,18 @@
void playAllSlot();
/**
- * Signaled to add an item into currently open collection.
- *
- */
- void addItemSlot();
-
- /**
* Signaled to add an item into a collection.
*
*/
void addToCollectionSlot();
/**
+ * Signaled to remove a user created collection.
+ *
+ */
+ void removeCollectionSlot();
+
+ /**
* Signaled when details will be selected from the videolist's
* context menu. Maps mCurrentIndex to model's source index and
* calls collection wrapper to open details
@@ -222,8 +217,14 @@
void back();
/**
+ * Signaled when view scrolling starts, pauses thumbnail creation.
+ *
+ */
+ void scrollingStartedSlot();
+
+ /**
* Signaled when view scrolling ends, initiates thumbnail fetching
- * at index of first visible item.
+ * at index of first visible item and enables creation of thumbnails.
*
*/
void scrollingEndedSlot();
@@ -231,16 +232,32 @@
/**
* Signaled when view scroll position changes, initiates timer to
* fetch thumbnails at index of first visible item.
+ *
+ * @param newPosition scroll position
+ *
*/
void scrollPositionChangedSlot(const QPointF &newPosition);
+ /**
+ * Signaled when scroll position timer triggers. Starts fetching thumbnails
+ * for visible items.
+ *
+ */
+ void scrollPositionTimerSlot();
+
+ /**
+ * Fetches thumbnails for the visible items.
+ *
+ */
+ void fetchThumbnailsForVisibleItems();
+
// TODO: following can be removed after all implementation ready
/**
* Slot is connected into item signals that are not yet implemented.
* Slot shows "Not yet implemented" note
*/
void debugNotImplementedYet();
-
+
private:
enum TContextActionIds
@@ -251,9 +268,7 @@
EACtionRemoveFromCollection,
EACtionAddToCollection,
EACtionRemoveCollection,
- EActionAddVideos,
EActionRename,
- EActionSetThumb,
EActionPlay
};
@@ -267,7 +282,7 @@
* Method sets correct popup menu for specific list items.
*
*/
- void setContextMenu(bool isDefaultCollection);
+ void setContextMenu();
/**
* Method connects signals needed by the widget
@@ -304,7 +319,7 @@
* current level indicating content currently showing:
* category or videos
*/
- VideoListWidget::TVideoListLevel mCurrentLevel;
+ VideoCollectionCommon::TCollectionLevels mCurrentLevel;
/**
* True if signals have been connected
@@ -322,26 +337,35 @@
bool mIsService;
/**
- * Secondary softkey action object
+ * Navigation softkey action object for back.
*/
- HbAction *mSecSkAction;
+ HbAction *mNavKeyBackAction;
+
+ /**
+ * Navigation softkey action object for quit.
+ */
+ HbAction *mNavKeyQuitAction;
/**
* Item sensitive context menu
*/
HbMenu *mContextMenu;
-
+
/**
- * Last opened item id is saved when collection is opened from the
- * collections -list. Value used to indentify the type of list.
- */
- TMPXItemId mLastOpenItemId;
+ * loacal selection mode
+ */
+ int mSelectionMode;
/**
* Timer used to report thumbnail fetches class index of
* first visible item when view is scrolling.
*/
QTimer *mScrollPositionTimer;
+
+ /**
+ * ui loade object, not owned
+ */
+ VideoCollectionUiLoader *mUiLoader;
};
#endif // VIDEOLISTWIDGET_H
--- a/videocollection/videocollectionview/src/videocollectionuiloader.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionview/src/videocollectionuiloader.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -15,27 +15,685 @@
*
*/
+#include <qgraphicswidget.h>
+#include <qaction.h>
+#include <qactiongroup.h>
+#include <hbmenu.h>
+#include <hbaction.h>
+#include <hbgroupbox.h>
+#include <hbpushbutton.h>
+
#include "videocollectionuiloader.h"
#include "videolistview.h"
#include "videolistselectiondialog.h"
#include "videolistwidget.h"
#include "videohintwidget.h"
+#include "videocollectionwrapper.h"
+#include "videosortfilterproxymodel.h"
+#include "videocollectionviewutils.h"
+#include "videoservices.h"
+
+// ---------------------------------------------------------------------------
+// VideoCollectionUiLoader
+// ---------------------------------------------------------------------------
+//
+VideoCollectionUiLoader::VideoCollectionUiLoader():
+ HbDocumentLoader(),
+ mTimerId(0),
+ mSortGroup(0),
+ mIsService(false)
+{
+}
// ---------------------------------------------------------------------------
// VideoCollectionUiLoader
// ---------------------------------------------------------------------------
//
-VideoCollectionUiLoader::VideoCollectionUiLoader() :
- HbDocumentLoader()
+VideoCollectionUiLoader::~VideoCollectionUiLoader()
+{
+ // selection dialog needs to be deleted manually
+ VideoListSelectionDialog *dialog =
+ findWidget<VideoListSelectionDialog>(
+ DOCML_NAME_DIALOG);
+ delete dialog;
+
+ // clear queue and hash tables
+ mQueue.clear();
+ mWidgets.clear();
+ mObjects.clear();
+}
+
+// ---------------------------------------------------------------------------
+// startLoading
+// ---------------------------------------------------------------------------
+//
+void VideoCollectionUiLoader::startLoading(QSet<QString> uiSections,
+ QObject *receiver,
+ const char *widgetSlot,
+ const char *objectSlot)
{
+ if (uiSections.contains(DOCML_NAME_VC_HEADINGBANNER))
+ {
+ VideoCollectionUiLoader::Params params(
+ DOCML_NAME_VC_HEADINGBANNER,
+ true, // is widget
+ receiver,
+ DOCML_VIDEOCOLLECTIONVIEW_FILE,
+ widgetSlot);
+ addToQueue(params);
+ }
+ if (uiSections.contains(DOCML_NAME_VC_VIDEOLISTWIDGET))
+ {
+ VideoCollectionUiLoader::Params params(
+ DOCML_NAME_VC_VIDEOLISTWIDGET,
+ true, // is widget
+ receiver,
+ DOCML_VIDEOCOLLECTIONVIEW_FILE,
+ widgetSlot);
+ addToQueue(params);
+ }
+ if (uiSections.contains(DOCML_NAME_OPTIONS_MENU))
+ {
+ VideoCollectionUiLoader::Params params(
+ DOCML_NAME_OPTIONS_MENU,
+ true, // is widget
+ receiver,
+ DOCML_VIDEOCOLLECTIONVIEW_FILE,
+ widgetSlot);
+ addToQueue(params);
+ }
+ if (uiSections.contains(DOCML_NAME_ADD_TO_COLLECTION))
+ {
+ VideoCollectionUiLoader::Params params(
+ DOCML_NAME_ADD_TO_COLLECTION,
+ false, // is object
+ receiver,
+ DOCML_VIDEOCOLLECTIONVIEW_FILE,
+ objectSlot);
+ addToQueue(params);
+ }
+ if (uiSections.contains(DOCML_NAME_CREATE_COLLECTION))
+ {
+ VideoCollectionUiLoader::Params params(
+ DOCML_NAME_CREATE_COLLECTION,
+ false, // is object
+ receiver,
+ DOCML_VIDEOCOLLECTIONVIEW_FILE,
+ objectSlot);
+ addToQueue(params);
+ }
+ if (uiSections.contains(DOCML_NAME_DELETE_MULTIPLE))
+ {
+ VideoCollectionUiLoader::Params params(
+ DOCML_NAME_DELETE_MULTIPLE,
+ false, // is object
+ receiver,
+ DOCML_VIDEOCOLLECTIONVIEW_FILE,
+ objectSlot);
+ addToQueue(params);
+ }
+ if (uiSections.contains(DOCML_NAME_VC_VIDEOHINTWIDGET))
+ {
+ VideoCollectionUiLoader::Params params(
+ DOCML_NAME_VC_VIDEOHINTWIDGET,
+ true, // is widget
+ receiver,
+ DOCML_VIDEOCOLLECTIONVIEW_FILE,
+ widgetSlot);
+ addToQueue(params);
+ }
+ if (uiSections.contains(DOCML_NAME_HINT_BUTTON))
+ {
+ VideoCollectionUiLoader::Params params(
+ DOCML_NAME_HINT_BUTTON,
+ true, // is widget
+ receiver,
+ DOCML_VIDEOCOLLECTIONVIEW_FILE,
+ widgetSlot);
+ addToQueue(params);
+ }
+ if (uiSections.contains(DOCML_NAME_NO_VIDEOS_LABEL))
+ {
+ VideoCollectionUiLoader::Params params(
+ DOCML_NAME_NO_VIDEOS_LABEL,
+ true, // is widget
+ receiver,
+ DOCML_VIDEOCOLLECTIONVIEW_FILE,
+ widgetSlot);
+ addToQueue(params);
+ }
+ if (uiSections.contains(DOCML_NAME_SORT_BY_DATE))
+ {
+ VideoCollectionUiLoader::Params params(
+ DOCML_NAME_SORT_BY_DATE,
+ false, // is object
+ receiver,
+ DOCML_VIDEOCOLLECTIONVIEW_FILE,
+ objectSlot);
+ addToQueue(params);
+ }
+ if (uiSections.contains(DOCML_NAME_SORT_BY_NAME))
+ {
+ VideoCollectionUiLoader::Params params(
+ DOCML_NAME_SORT_BY_NAME,
+ false, // is object
+ receiver,
+ DOCML_VIDEOCOLLECTIONVIEW_FILE,
+ objectSlot);
+ addToQueue(params);
+ }
+ if (uiSections.contains(DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS))
+ {
+ VideoCollectionUiLoader::Params params(
+ DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS,
+ false, // is object
+ receiver,
+ DOCML_VIDEOCOLLECTIONVIEW_FILE,
+ objectSlot);
+ addToQueue(params);
+ }
+ if (uiSections.contains(DOCML_NAME_SORT_BY_TOTAL_LENGTH))
+ {
+ VideoCollectionUiLoader::Params params(
+ DOCML_NAME_SORT_BY_TOTAL_LENGTH,
+ false, // is object
+ receiver,
+ DOCML_VIDEOCOLLECTIONVIEW_FILE,
+ objectSlot);
+ addToQueue(params);
+ }
+ if (uiSections.contains(DOCML_NAME_SORT_BY_SIZE))
+ {
+ VideoCollectionUiLoader::Params params(
+ DOCML_NAME_SORT_BY_SIZE,
+ false, // is object
+ receiver,
+ DOCML_VIDEOCOLLECTIONVIEW_FILE,
+ objectSlot);
+ addToQueue(params);
+ }
+ if (uiSections.contains(DOCML_NAME_SORT_MENU))
+ {
+ VideoCollectionUiLoader::Params params(
+ DOCML_NAME_SORT_MENU,
+ true, // is widget
+ receiver,
+ DOCML_VIDEOCOLLECTIONVIEW_FILE,
+ widgetSlot);
+ addToQueue(params);
+ }
+ if (uiSections.contains(DOCML_NAME_VC_COLLECTIONWIDGET))
+ {
+ VideoCollectionUiLoader::Params params(
+ DOCML_NAME_VC_COLLECTIONWIDGET,
+ true, // is widget
+ receiver,
+ DOCML_VIDEOCOLLECTIONVIEW_FILE,
+ widgetSlot);
+ addToQueue(params);
+ }
+ if (uiSections.contains(DOCML_NAME_VC_COLLECTIONCONTENTWIDGET))
+ {
+ VideoCollectionUiLoader::Params params(
+ DOCML_NAME_VC_COLLECTIONCONTENTWIDGET,
+ true, // is widget
+ receiver,
+ DOCML_VIDEOCOLLECTIONVIEW_FILE,
+ widgetSlot);
+ addToQueue(params);
+ }
+ if (uiSections.contains(DOCML_NAME_DIALOG))
+ {
+ VideoCollectionUiLoader::Params params(DOCML_NAME_DIALOG,
+ true, // is widget
+ receiver,
+ DOCML_VIDEOSELECTIONDIALOG_FILE,
+ widgetSlot);
+ addToQueue(params);
+ }
+}
+
+// ---------------------------------------------------------------------------
+// setIsService
+// ---------------------------------------------------------------------------
+//
+void VideoCollectionUiLoader::setIsService(bool isService)
+{
+ mIsService = isService;
+}
+
+// ---------------------------------------------------------------------------
+// doFindWidget
+// ---------------------------------------------------------------------------
+//
+QGraphicsWidget* VideoCollectionUiLoader::doFindWidget(const QString &name)
+{
+ QGraphicsWidget *widget = 0;
+
+ // 1. check from hash
+ if (mWidgets.contains(name))
+ {
+ widget = mWidgets.value(name);
+ }
+
+ // 2. load from document
+ else
+ {
+ widget = HbDocumentLoader::findWidget(name);
+ if (widget)
+ {
+ // initialize widget
+ initWidget(widget, name);
+
+ // add it to the hash
+ mWidgets.insert(name, widget);
+
+ // check if the widget is being loaded and remove it from queue
+ int count = mQueue.count();
+ for (int i = 0; i < count; i++)
+ {
+ const Params& params = mQueue.at(i);
+ if (params.mName.compare(name) == 0)
+ {
+ if (connect(
+ this, SIGNAL(widgetReady(QGraphicsWidget*, const QString&)),
+ params.mReceiver, params.mMember))
+ {
+ emit widgetReady(widget, params.mName);
+ disconnect(
+ this, SIGNAL(widgetReady(QGraphicsWidget*, const QString&)),
+ params.mReceiver, params.mMember);
+ }
+ mQueue.removeAt(i);
+ break;
+ }
+ }
+ }
+ }
+
+ return widget;
+}
+
+// ---------------------------------------------------------------------------
+// doFindObject
+// ---------------------------------------------------------------------------
+//
+QObject* VideoCollectionUiLoader::doFindObject(const QString &name)
+{
+ QObject *object = 0;
+
+ // 1. check from hash
+ if (mObjects.contains(name))
+ {
+ object = mObjects.value(name);
+ }
+
+ // 2. load from document and cancel async loading
+ else
+ {
+ object = HbDocumentLoader::findObject(name);
+ if (object)
+ {
+ // initialize widget
+ initObject(object, name);
+
+ // add it to the hash
+ mObjects.insert(name, object);
+
+ // check if the object is being loaded and remove it from queue
+ int count = mQueue.count();
+ for (int i = 0; i < count; i++)
+ {
+ const Params& params = mQueue.at(i);
+ if (params.mName.compare(name) == 0)
+ {
+ if (connect(
+ this, SIGNAL(objectReady(QObject*, const QString&)),
+ params.mReceiver, params.mMember))
+ {
+ emit objectReady(object, params.mName);
+ disconnect(
+ this, SIGNAL(objectReady(QObject*, const QString&)),
+ params.mReceiver, params.mMember);
+ }
+ mQueue.removeAt(i);
+ break;
+ }
+ }
+ }
+ }
+
+ return object;
}
// ---------------------------------------------------------------------------
-// ~VideoCollectionUiLoader
+// addToQueue
+// ---------------------------------------------------------------------------
+//
+void VideoCollectionUiLoader::addToQueue(Params ¶ms)
+{
+ if (isValid(params))
+ {
+ // add the params in async queue
+ mQueue.append(params);
+ runNext();
+ }
+}
+
+// ---------------------------------------------------------------------------
+// initWidget
+// ---------------------------------------------------------------------------
+//
+void VideoCollectionUiLoader::initWidget(QGraphicsWidget *widget,
+ const QString &name)
+{
+ if (widget)
+ {
+ VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
+
+ if (name.compare(DOCML_NAME_VC_VIDEOLISTWIDGET) == 0)
+ {
+ VideoListWidget *videoList = qobject_cast<VideoListWidget*>(widget);
+ if (videoList)
+ {
+ VideoSortFilterProxyModel *model =
+ wrapper.getModel(VideoCollectionWrapper::EAllVideos);
+ if(model)
+ {
+ // open and sort model
+ model->open(VideoCollectionCommon::ELevelVideos);
+ VideoCollectionViewUtils::sortModel(model, true);
+
+ // init widget
+ VideoServices *videoServices = 0;
+ if (mIsService)
+ {
+ videoServices = VideoServices::instance();
+ }
+ videoList->initialize(*model, videoServices);
+ }
+ }
+ }
+ else if (name.compare(DOCML_NAME_VC_COLLECTIONWIDGET) == 0)
+ {
+ VideoSortFilterProxyModel *model = wrapper.getModel(
+ VideoCollectionWrapper::ECollections);
+ if (model)
+ {
+ model->open(VideoCollectionCommon::ELevelCategory);
+
+ // initialize video collection widget
+ VideoListWidget *videoList =
+ qobject_cast<VideoListWidget*>(widget);
+ if (videoList)
+ {
+ // init widget
+ VideoServices *videoServices = 0;
+ if (mIsService)
+ {
+ videoServices = VideoServices::instance();
+ }
+ videoList->initialize(*model, videoServices);
+ }
+ }
+ }
+ else if (name.compare(DOCML_NAME_VC_COLLECTIONCONTENTWIDGET) == 0)
+ {
+ VideoSortFilterProxyModel *model = wrapper.getModel(
+ VideoCollectionWrapper::ECollectionContent);
+ if (model)
+ {
+ VideoListWidget *videoList = qobject_cast<VideoListWidget*>(widget);
+ if (videoList)
+ {
+ // init widget
+ VideoServices *videoServices = 0;
+ if (mIsService)
+ {
+ videoServices = VideoServices::instance();
+ }
+ videoList->initialize(*model, videoServices);
+ }
+ }
+ }
+ else if (name.compare(DOCML_NAME_DIALOG) == 0)
+ {
+ // by default, initialize the selection dialog to delete mode
+ VideoListSelectionDialog *dialog =
+ qobject_cast<VideoListSelectionDialog*>(widget);
+ if (dialog)
+ {
+ dialog->setupContent(VideoListSelectionDialog::EDeleteVideos,
+ TMPXItemId::InvalidId());
+ }
+ }
+ else if (name.compare(DOCML_NAME_SORT_MENU) == 0)
+ {
+ HbMenu *menu = qobject_cast<HbMenu*>(widget);
+ if (menu)
+ {
+ // create sort by menu action
+ mMenuActions[EActionSortBy] = menu->menuAction();
+
+ // ensure that all the actions related to sort menu are loaded
+ // when sort menu is loaded
+ findObject<HbAction>(DOCML_NAME_SORT_BY_DATE);
+ findObject<HbAction>(DOCML_NAME_SORT_BY_NAME);
+ findObject<HbAction>(DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS);
+ findObject<HbAction>(DOCML_NAME_SORT_BY_TOTAL_LENGTH);
+ findObject<HbAction>(DOCML_NAME_SORT_BY_SIZE);
+
+ // add sub menu actions
+ if (!mSortGroup)
+ {
+ mSortGroup = new QActionGroup(menu);
+ mSortGroup->addAction(mMenuActions[EActionSortByDate]);
+ mSortGroup->addAction(mMenuActions[EActionSortByName]);
+ mSortGroup->addAction(mMenuActions[EACtionSortByItemCount]);
+ mSortGroup->addAction(mMenuActions[EActionSortByLength]);
+ mSortGroup->addAction(mMenuActions[EActionSortBySize]);
+
+ // set all sub menu items checkable
+ foreach (QAction *action, menu->actions())
+ {
+ action->setCheckable(true);
+ }
+ }
+ }
+ }
+ else if (name.compare(DOCML_NAME_VC_VIDEOHINTWIDGET) == 0)
+ {
+ VideoHintWidget *hintWidget = qobject_cast<VideoHintWidget*>(widget);
+ if (hintWidget)
+ {
+ hintWidget->initialize();
+ }
+ }
+ else if (name.compare(DOCML_NAME_OPTIONS_MENU) == 0)
+ {
+ // ensure that all the actions related to options menu are loaded
+ // when options menu is loaded
+ findObject<HbAction>(DOCML_NAME_ADD_TO_COLLECTION);
+ findObject<HbAction>(DOCML_NAME_CREATE_COLLECTION);
+ findObject<HbAction>(DOCML_NAME_DELETE_MULTIPLE);
+ }
+ }
+}
+
+// ---------------------------------------------------------------------------
+// initObject
// ---------------------------------------------------------------------------
//
-VideoCollectionUiLoader::~VideoCollectionUiLoader()
+void VideoCollectionUiLoader::initObject(QObject *object,
+ const QString &name)
+{
+ if (object)
+ {
+ if (name.compare(DOCML_NAME_ADD_TO_COLLECTION) == 0)
+ {
+ HbAction *action = qobject_cast<HbAction*>(object);
+ if (action)
+ {
+ mMenuActions[EActionAddToCollection] = action;
+ }
+ }
+ else if (name.compare(DOCML_NAME_CREATE_COLLECTION) == 0)
+ {
+ HbAction *action = qobject_cast<HbAction*>(object);
+ if (action)
+ {
+ mMenuActions[EActionNewCollection] = action;
+ }
+ }
+ else if (name.compare(DOCML_NAME_DELETE_MULTIPLE) == 0)
+ {
+ HbAction *action = qobject_cast<HbAction*>(object);
+ if (action)
+ {
+ mMenuActions[EActionDelete] = action;
+ }
+ }
+ else if (name.compare(DOCML_NAME_SORT_BY_DATE) == 0)
+ {
+ HbAction *action = qobject_cast<HbAction*>(object);
+ if (action)
+ {
+ mMenuActions[EActionSortByDate] = action;
+ }
+ }
+ else if (name.compare(DOCML_NAME_SORT_BY_NAME) == 0)
+ {
+ HbAction *action = qobject_cast<HbAction*>(object);
+ if (action)
+ {
+ mMenuActions[EActionSortByName] = action;
+ }
+ }
+ else if (name.compare(DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS) == 0)
+ {
+ HbAction *action = qobject_cast<HbAction*>(object);
+ if (action)
+ {
+ mMenuActions[EACtionSortByItemCount] = action;
+ }
+ }
+ else if (name.compare(DOCML_NAME_SORT_BY_TOTAL_LENGTH) == 0)
+ {
+ HbAction *action = qobject_cast<HbAction*>(object);
+ if (action)
+ {
+ mMenuActions[EActionSortByLength] = action;
+ }
+ }
+ else if (name.compare(DOCML_NAME_SORT_BY_SIZE) == 0)
+ {
+ HbAction *action = qobject_cast<HbAction*>(object);
+ if (action)
+ {
+ mMenuActions[EActionSortBySize] = action;
+ }
+ }
+ }
+}
+
+// ---------------------------------------------------------------------------
+// timerEvent
+// ---------------------------------------------------------------------------
+//
+void VideoCollectionUiLoader::timerEvent(QTimerEvent *event)
{
+ if (event)
+ {
+ if (event->timerId() == mTimerId)
+ {
+ // get current request from queue
+ const Params ¶ms = mQueue.at(0);
+
+ // load the widget / object
+ if (params.mIsWidget)
+ {
+ // correct timer id, emit signal for receiver
+ bool ok = connect(
+ this, SIGNAL(widgetReady(QGraphicsWidget*, const QString&)),
+ params.mReceiver, params.mMember);
+ if (ok)
+ {
+ QGraphicsWidget *widget =
+ HbDocumentLoader::findWidget(params.mName);
+ if (!widget)
+ {
+ // widget not found, try to load the docml
+ load(params.mDocml, &ok);
+ if (ok)
+ {
+ widget = HbDocumentLoader::findWidget(params.mName);
+ }
+ }
+ if (widget)
+ {
+ // widget found, add it to the hash
+ if (!mWidgets.contains(params.mName))
+ {
+ // initialize widget
+ initWidget(widget, params.mName);
+
+ // insert widget in hash table
+ mWidgets.insert(params.mName, widget);
+ }
+ emit widgetReady(widget, params.mName);
+ }
+ }
+
+ // disconnect
+ disconnect(
+ this, SIGNAL(widgetReady(QGraphicsWidget*, const QString&)),
+ params.mReceiver, params.mMember);
+ }
+ else
+ {
+ // correct timer id, emit signal for receiver
+ bool ok = connect(
+ this, SIGNAL(objectReady(QObject*, const QString&)),
+ params.mReceiver, params.mMember);
+ if (ok)
+ {
+ QObject *object =
+ HbDocumentLoader::findObject(params.mName);
+ if (!object)
+ {
+ // widget not found, try to load the docml
+ load(params.mDocml, &ok);
+ if (ok)
+ {
+ object = HbDocumentLoader::findObject(params.mName);
+ }
+ }
+ if (object)
+ {
+ // object found, add it to the hash
+ if (!mObjects.contains(params.mName))
+ {
+ // initialize object
+ initObject(object, params.mName);
+
+ // add object in hash table
+ mObjects.insert(params.mName, object);
+ }
+ emit objectReady(object, params.mName);
+ }
+ }
+
+ // disconnect
+ disconnect(
+ this, SIGNAL(objectReady(QObject*, const QString&)),
+ params.mReceiver, params.mMember);
+ }
+ }
+
+ // remove the request from the queue and run next request if any
+ mQueue.removeAt(0);
+ runNext();
+ }
}
// ---------------------------------------------------------------------------
@@ -56,7 +714,7 @@
}
else if ( type == VideoListWidget::staticMetaObject.className() )
{
- object = new VideoListWidget();
+ object = new VideoListWidget(this);
}
else if ( type == VideoHintWidget::staticMetaObject.className() )
{
@@ -70,3 +728,73 @@
return HbDocumentLoader::createObject( type, name );
}
+
+// ---------------------------------------------------------------------------
+// runNext
+// ---------------------------------------------------------------------------
+//
+void VideoCollectionUiLoader::runNext()
+{
+ if (mQueue.count())
+ {
+ if (!mTimerId)
+ {
+ // timer not running, start it
+ mTimerId = startTimer(ASYNC_FIND_TIMEOUT);
+ }
+ }
+ else
+ {
+ // no new requests, kill timer
+ if (mTimerId)
+ {
+ killTimer(mTimerId);
+ mTimerId = 0;
+ }
+ }
+}
+
+// ---------------------------------------------------------------------------
+// isValid
+// ---------------------------------------------------------------------------
+//
+bool VideoCollectionUiLoader::isValid(const Params ¶ms)
+{
+ bool valid = true;
+
+ if (params.mName.length() &&
+ params.mDocml &&
+ params.mMember &&
+ params.mReceiver)
+ {
+ // check if the param is already in the queue
+ int count = mQueue.count();
+ for (int i = 0; i < count; i++)
+ {
+ if (mQueue.at(i).isDuplicate(params))
+ {
+ valid = false;
+ break;
+ }
+ }
+
+ // check that the item has not already been loaded
+ if (valid)
+ {
+ if (params.mIsWidget)
+ {
+ valid = !mWidgets.contains(params.mName);
+ }
+ else
+ {
+ valid = !mObjects.contains(params.mName);
+ }
+ }
+ }
+ else
+ {
+ valid = false;
+ }
+
+ return valid;
+}
--- a/videocollection/videocollectionview/src/videocollectionviewutils.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionview/src/videocollectionviewutils.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -15,12 +15,16 @@
*
*/
+#include <hblistview.h>
+#include <hbscrollbar.h>
+#include <hblistviewitem.h>
#include <hbdialog.h>
#include <hbmessagebox.h>
#include <centralrepository.h>
#include "videocollectioncommon.h"
#include "videocollectionviewutils.h"
+#include "videosortfilterproxymodel.h"
const int KVideoCollectionViewCenrepUid(0x2002BC63);
const int KVideoCollectionViewCenrepServiceIconKey(0x2);
@@ -43,7 +47,9 @@
// VideoCollectionViewUtils
// ---------------------------------------------------------------------------
//
-VideoCollectionViewUtils::VideoCollectionViewUtils()
+VideoCollectionViewUtils::VideoCollectionViewUtils():
+ mSortRole(-1),
+ mSortOrder(Qt::AscendingOrder)
{
}
@@ -75,6 +81,10 @@
}
delete cenRep;
}
+
+ mSortRole = role;
+ mSortOrder = order;
+
return status;
}
@@ -82,28 +92,36 @@
// loadSortingValues
// ---------------------------------------------------------------------------
//
-int VideoCollectionViewUtils::loadSortingValues(int& role, Qt::SortOrder& order)
+int VideoCollectionViewUtils::loadSortingValues(int &role, Qt::SortOrder &order)
{
- int status = -1;
- CRepository *cenRep = 0;
- TRAP_IGNORE(cenRep = CRepository::NewL(TUid::Uid(KVideoCollectionViewCenrepUid)));
- if(cenRep)
+ int err(0);
+
+ if (mSortRole == -1)
{
- TInt roleValue(KErrNotFound);
- TInt orderValue(KErrNotFound);
- status = cenRep->Get(KVideoCollectionViewCenrepSortingRoleKey, roleValue);
- if(status == KErrNone)
+ CRepository *cenRep = 0;
+ TRAP_IGNORE(cenRep = CRepository::NewL(TUid::Uid(KVideoCollectionViewCenrepUid)));
+ if(cenRep)
{
- status = cenRep->Get(KVideoCollectionViewCenrepSortingOrderKey, orderValue);
- if(status == KErrNone)
+ int sortRole(-1);
+ int sortOrder(-1);
+ err = cenRep->Get(KVideoCollectionViewCenrepSortingRoleKey, sortRole);
+ if(err == KErrNone)
{
- role = roleValue;
- order = static_cast<Qt::SortOrder>(orderValue);
+ mSortRole = sortRole;
+ err = cenRep->Get(KVideoCollectionViewCenrepSortingOrderKey, sortOrder);
+ if(err == KErrNone)
+ {
+ mSortOrder = static_cast<Qt::SortOrder>(sortOrder);
+ }
}
+ delete cenRep;
}
- delete cenRep;
}
- return status;
+
+ role = mSortRole;
+ order = mSortOrder;
+
+ return err;
}
// ---------------------------------------------------------------------------
@@ -161,33 +179,110 @@
}
// ---------------------------------------------------------------------------
+// initListView
+// ---------------------------------------------------------------------------
+//
+void VideoCollectionViewUtils::initListView(HbListView *view)
+{
+ if (view)
+ {
+ HbListViewItem *prototype = view->listItemPrototype();
+ if(prototype)
+ {
+ //Use image layout in prototype
+ prototype->setGraphicsSize(HbListViewItem::Thumbnail);
+ }
+ view->setItemRecycling(true);
+ view->setClampingStyle(HbScrollArea::BounceBackClamping);
+ view->setScrollingStyle(HbScrollArea::PanOrFlick);
+ view->setFrictionEnabled(true);
+ view->setUniformItemSizes(true);
+ view->setSelectionMode(HbAbstractItemView::NoSelection);
+
+ //Use scrollbar
+ HbScrollBar *scrollBar = view->verticalScrollBar();
+ if (scrollBar)
+ {
+ scrollBar->setInteractive(true);
+ }
+ }
+}
+
+// ---------------------------------------------------------------------------
+// sortModel
+// ---------------------------------------------------------------------------
+//
+void VideoCollectionViewUtils::sortModel(
+ VideoSortFilterProxyModel *model,
+ bool async)
+{
+ if (model)
+ {
+ // setup sorting order for model
+ int sortRole(VideoCollectionCommon::KeyDateTime);
+ Qt::SortOrder sortOrder(Qt::AscendingOrder);
+
+ // return value ignored, as in case of error the sortRole and sortOrder variables
+ // stay at their predefined values, and in error cases those are the sorting values
+ // that are used.
+ VideoCollectionViewUtils &self = VideoCollectionViewUtils::instance();
+ self.loadSortingValues(sortRole, sortOrder);
+ model->doSorting(sortRole, sortOrder, async);
+ }
+}
+
+// ---------------------------------------------------------------------------
// showStatusMsgSlot
// ---------------------------------------------------------------------------
//
void VideoCollectionViewUtils::showStatusMsgSlot(int statusCode, QVariant &additional)
{
QString msg("");
+ QString format("");
bool error(true);
- if(statusCode == VideoCollectionCommon::statusSingleDeleteFail)
- {
- QString format = tr("Unable to delete item %1. It is currently open.");
- if(additional.isValid())
- {
- msg = format.arg(additional.toString());
- }
- }
- else if(statusCode == VideoCollectionCommon::statusMultipleDeleteFail)
+ switch(statusCode)
{
- msg = tr("Unable to delete some items which are currently open.");
- }
- else if(statusCode == VideoCollectionCommon::statusMultipleDeleteSucceed)
- {
- QString format = tr("%1 videos deleted");
- if(additional.isValid())
- {
- msg = format.arg(additional.toString());
- }
- error = false;
+ case VideoCollectionCommon::statusSingleDeleteFail:
+ format = tr("Unable to delete item %1. It is currently open."); //TODO: localisation
+ if(additional.isValid())
+ {
+ msg = format.arg(additional.toString());
+ }
+ break;
+ case VideoCollectionCommon::statusMultipleDeleteFail:
+ msg = tr("Unable to delete some items which are currently open.");
+ break;
+ case VideoCollectionCommon::statusSingleRemoveFail:
+ format = tr("Unable to remove collection %1."); //TODO: localisation
+ if(additional.isValid())
+ {
+ msg = format.arg(additional.toString());
+ }
+ break;
+ case VideoCollectionCommon::statusMultiRemoveFail:
+ msg = tr("Unable to remove some collections.");
+ break;
+ case VideoCollectionCommon::statusVideosAddedToCollection:
+ format = tr("Videos added to %1 collection."); //TODO: localisation
+ if(additional.isValid())
+ {
+ msg = format.arg(additional.toString());
+ }
+ error = false;
+ break;
+ case VideoCollectionCommon::statusAllVideosAlreadyInCollection:
+ msg = tr("All videos already added to this collection.");
+ break;
+ case VideoCollectionCommon::statusDeleteInProgress:
+ format = tr("%1 videos are being deleted."); //TODO: localisation
+ if(additional.isValid())
+ {
+ msg = format.arg(additional.toString());
+ }
+ error = false;
+ break;
+ default: // no msg to show
+ return;
}
if(msg.count() > 0)
@@ -204,5 +299,3 @@
}
}
-
-
--- a/videocollection/videocollectionview/src/videohintwidget.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionview/src/videohintwidget.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -31,10 +31,11 @@
VideoHintWidget::VideoHintWidget(VideoCollectionUiLoader *uiLoader, QGraphicsItem *parent) :
HbWidget(parent),
mUiLoader(uiLoader),
-mServiceButton(0),
-mHintLabel(0),
mServiceIcon(0),
-mCurrentLevel(AllVideos)
+mAddVideosIcon(0),
+mCurrentLevel(AllVideos),
+mButtonShown(false),
+mActivated(false)
{
// NOP
}
@@ -46,6 +47,7 @@
VideoHintWidget::~VideoHintWidget()
{
delete mServiceIcon;
+ delete mAddVideosIcon;
}
// ---------------------------------------------------------------------------
@@ -54,13 +56,6 @@
//
int VideoHintWidget::initialize()
{
- mServiceButton = mUiLoader->findWidget<HbPushButton>(DOCML_NAME_HINT_BUTTON);
- mHintLabel = mUiLoader->findWidget<HbLabel>(DOCML_NAME_HINT_LABEL);
- if(!mServiceButton || !mHintLabel)
- {
- return -1;
- }
-
VideoCollectionViewUtils& utils = VideoCollectionViewUtils::instance();
return utils.getServiceIconStrings(mServiceIconString, mServiceIconPressedString);
}
@@ -72,23 +67,20 @@
void VideoHintWidget::setLevel(HintLevel level)
{
mCurrentLevel = level;
- if(isVisible()) {
+ if(mActivated) {
updateUiComponents();
}
}
// ---------------------------------------------------------------------------
-// setVisible
+// setButtonShown
// ---------------------------------------------------------------------------
//
-void VideoHintWidget::setVisible(bool visible)
+void VideoHintWidget::setButtonShown(bool shown)
{
- HbWidget::setVisible(visible);
-
- if(visible) {
- activate();
- } else {
- deactivate();
+ mButtonShown = shown;
+ if(mActivated) {
+ updateUiComponents();
}
}
@@ -96,8 +88,9 @@
// orientationChanged
// ---------------------------------------------------------------------------
//
-void VideoHintWidget::orientationChangedSlot(Qt::Orientation /*targetOrientation*/)
+void VideoHintWidget::orientationChangedSlot(Qt::Orientation targetOrientation)
{
+ Q_UNUSED(targetOrientation);
updateUiComponents();
}
@@ -107,20 +100,30 @@
//
void VideoHintWidget::activate()
{
- if(mServiceIconString.isNull() || mServiceIconString.isEmpty() ||
- mServiceIconPressedString.isNull() || mServiceIconPressedString.isEmpty())
+ if (!mActivated)
{
- return;
+ if(mServiceIconString.isEmpty() ||
+ mServiceIconPressedString.isEmpty())
+ {
+ return;
+ }
+
+ HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
+ connect(
+ mainWnd, SIGNAL(orientationChanged(Qt::Orientation)),
+ this, SLOT(orientationChangedSlot(Qt::Orientation)));
+
+ mServiceIcon = new HbIcon(mServiceIconString);
+ mServiceIcon->setIconName(mServiceIconPressedString, QIcon::Normal, QIcon::On);
+
+ mAddVideosIcon = new HbIcon(":/images/mono_video_addvideos.svg");
+
+ updateUiComponents();
+
+ setVisible(true);
+
+ mActivated = true;
}
-
- HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
- connect(mainWnd, SIGNAL(orientationChanged(Qt::Orientation)),
- this, SLOT(orientationChangedSlot(Qt::Orientation)));
-
- mServiceIcon = new HbIcon(mServiceIconString);
- mServiceIcon->setIconName(mServiceIconPressedString, QIcon::Normal, QIcon::On);
-
- updateUiComponents();
}
// ---------------------------------------------------------------------------
@@ -129,12 +132,33 @@
//
void VideoHintWidget::deactivate()
{
- disconnect(this, SLOT(orientationChangedSlot(Qt::Orientation)));
-
- mServiceButton->setIcon(HbIcon());
- if(mServiceIcon) {
- delete mServiceIcon;
- mServiceIcon = 0;
+ if (mActivated)
+ {
+ mActivated = false;
+
+ setVisible(false);
+
+ HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
+ disconnect(
+ mainWnd, SIGNAL(orientationChanged(Qt::Orientation)),
+ this, SLOT(orientationChangedSlot(Qt::Orientation)));
+
+ HbPushButton *serviceButton =
+ mUiLoader->findWidget<HbPushButton>(
+ DOCML_NAME_HINT_BUTTON);
+ if (serviceButton)
+ {
+ serviceButton->setIcon(HbIcon());
+ }
+ if(mServiceIcon) {
+ delete mServiceIcon;
+ mServiceIcon = 0;
+ }
+
+ if(mAddVideosIcon) {
+ delete mAddVideosIcon;
+ mAddVideosIcon = 0;
+ }
}
}
@@ -145,16 +169,31 @@
void VideoHintWidget::updateUiComponents()
{
HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
- mServiceButton->setVisible(mainWnd->orientation() == Qt::Horizontal);
-
- if(mCurrentLevel == Collection) {
- mHintLabel->setVisible(false);
- mServiceButton->setIcon(HbIcon());
- mServiceButton->setText(tr("Add videos"));
- } else {
- mHintLabel->setVisible(true);
- mServiceButton->setText(QString());
- mServiceButton->setIcon(*mServiceIcon);
+ if (mainWnd)
+ {
+ HbPushButton *serviceButton =
+ mUiLoader->findWidget<HbPushButton>(
+ DOCML_NAME_HINT_BUTTON);
+ HbLabel *hintLabel =
+ mUiLoader->findWidget<HbLabel>(
+ DOCML_NAME_HINT_LABEL);
+ HbLabel *noVideosLabel =
+ mUiLoader->findWidget<HbLabel>(
+ DOCML_NAME_NO_VIDEOS_LABEL);
+ if (serviceButton && hintLabel && noVideosLabel)
+ {
+ serviceButton->setVisible(mainWnd->orientation() == Qt::Horizontal && mButtonShown);
+ noVideosLabel->setVisible(true);
+ if (mCurrentLevel == Collection)
+ {
+ hintLabel->setVisible(false);
+ serviceButton->setIcon(*mAddVideosIcon);
+ }
+ else
+ {
+ serviceButton->setIcon(*mServiceIcon);
+ }
+ }
}
}
--- a/videocollection/videocollectionview/src/videolistselectiondialog.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionview/src/videolistselectiondialog.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -20,11 +20,27 @@
#include <hbcheckbox.h>
#include <hbaction.h>
#include <hbstackedwidget.h>
-#include <hbdeviceprofile.h>
+#include <hbabstractitemview.h>
+#include <hbinputdialog.h>
+#include <vcxmyvideosdefs.h>
+
#include "videocollectionuiloader.h"
#include "videolistwidget.h"
#include "videosortfilterproxymodel.h"
#include "videolistselectiondialog.h"
+#include "videocollectionwrapper.h"
+#include "videocollectionviewutils.h"
+#include "videocollectionclient.h"
+
+/**
+ * global qHash function required fo creating hash values for TMPXItemId -keys
+ */
+inline uint qHash(TMPXItemId key)
+{
+ QPair<uint, uint> keyPair(key.iId1, key.iId2);
+
+ return qHash(keyPair);
+}
// ---------------------------------------------------------------------------
// VideoListSelectionDialog
@@ -34,15 +50,32 @@
QGraphicsItem *parent) :
HbDialog(parent),
mUiLoader(uiLoader),
-mVideoList(0),
+mTypeOfSelection(-1),
mHeading(0),
+mCheckboxContainer(0),
mItemCount(0),
mCheckBox(0),
mListContainer(0),
-mForcedCheck(false)
+mForcedCheck(false),
+mModel(0),
+mListWidget(0)
{
setDismissPolicy(HbDialog::NoDismiss);
- setTimeout(HbDialog::NoTimeout);
+ setTimeout(HbDialog::NoTimeout);
+
+ // create model for list widget
+ mModel =
+ VideoCollectionWrapper::instance().getModel(
+ VideoCollectionWrapper::EGeneric);
+ if (mModel)
+ {
+ // create list widget
+ mListWidget = new VideoListWidget(mUiLoader);
+ if (mListWidget)
+ {
+ mListWidget->initialize(*mModel);
+ }
+ }
}
// ---------------------------------------------------------------------------
@@ -51,60 +84,150 @@
//
VideoListSelectionDialog::~VideoListSelectionDialog()
{
- // NOP
-}
-
-// ---------------------------------------------------------------------------
-// getSelection
-// ---------------------------------------------------------------------------
-//
-const QItemSelection& VideoListSelectionDialog::getSelection() const
-{
- return mSelection;
+ delete mListWidget;
}
// ---------------------------------------------------------------------------
-// setContent
+// setupContent
// ---------------------------------------------------------------------------
//
-void VideoListSelectionDialog::setContent(const QString &title, VideoListWidget *videoList)
+void VideoListSelectionDialog::setupContent(int type, TMPXItemId activeItem)
{
- mSelection.clear();
- if(!videoList || title.isEmpty())
+ if(type < EDeleteVideos || type > ESelectCollection)
{
- mVideoList = 0;
+ return;
+ }
+
+ mTypeOfSelection = type;
+ if(!initDialog())
+ {
return;
}
+ mSelection.clear();
+ mSelectedVideos.clear();
+ mSelectedAlbumId = TMPXItemId::InvalidId();
- mVideoList = videoList;
+ // if provided "owner" is album or category
+ if(activeItem != TMPXItemId::InvalidId())
+ {
+ // if album, set as "selected"
+ if(activeItem.iId2 == KVcxMvcMediaTypeAlbum)
+ {
+ mSelectedAlbumId = activeItem;
+ }
+ else if(activeItem.iId2 == KVcxMvcMediaTypeVideo)
+ {
+ mSelectedVideos.insert(activeItem);
+ }
+ }
+ // set (or reset) generic id filter
+ mModel->setGenericIdFilter(activeItem, (mTypeOfSelection == EDeleteVideos));
+ activateSelection();
+}
+
+// ---------------------------------------------------------------------------
+// initDialog
+// ---------------------------------------------------------------------------
+//
+bool VideoListSelectionDialog::initDialog()
+{
+ if(!mModel)
+ {
+ mModel = VideoCollectionWrapper::instance().getModel(VideoCollectionWrapper::EGeneric);
+ if (!mModel)
+ {
+ return false;
+ }
+ }
+ if(!mListWidget)
+ {
+ mListWidget = new VideoListWidget(mUiLoader);
+ mListWidget->initialize(*mModel);
+ }
+ if (!mListContainer)
+ {
+ mListContainer =
+ mUiLoader->findWidget<HbStackedWidget>(DOCML_NAME_LIST_CONTAINER);
+ if(mListContainer && mListWidget)
+ {
+ mListContainer->addWidget(mListWidget);
+ }
+ }
if(!mHeading)
{
mHeading = mUiLoader->findWidget<HbLabel>(DOCML_NAME_DLG_HEADINGLBL);
}
- mHeading->setPlainText(title);
+ if(!mCheckboxContainer)
+ {
+ mCheckboxContainer = mUiLoader->findWidget<HbWidget>(DOCML_NAME_CHECK_CONTAINER);
+ }
+
if(!mItemCount)
{
mItemCount = mUiLoader->findWidget<HbLabel>(DOCML_NAME_LBL_SELECTION);
mItemCount->setAlignment(Qt::AlignRight);
- }
- mItemCount->setPlainText(tr("0/%1").arg(mVideoList->getModel().rowCount()));
-
+ }
if(!mCheckBox)
{
mCheckBox = mUiLoader->findWidget<HbCheckBox >(DOCML_NAME_MARKALL);
}
- mCheckBox->setChecked(false);
-
if(!primaryAction())
{
- setPrimaryAction(new HbAction(tr("OK"), this));
+ setPrimaryAction(new HbAction(tr("OK"), this)); //TODO: localisation
}
- primaryAction()->setDisabled(true);
if(!secondaryAction())
{
- setSecondaryAction(new HbAction(tr("Cancel"), this));
+ setSecondaryAction(new HbAction(tr("Cancel"), this)); //TODO: localisation
+ }
+ if(!mListWidget || !mListContainer || !mHeading || !mCheckBox || !primaryAction() || !secondaryAction())
+ {
+ return false;
+ }
+ return true;
+}
+
+// ---------------------------------------------------------------------------
+// activateSelection
+// ---------------------------------------------------------------------------
+//
+void VideoListSelectionDialog::activateSelection()
+{
+ // "add to collection" and "select collection" -selections needs
+ // additional functionality for primary key
+ if(mTypeOfSelection == EAddToCollection ||
+ mTypeOfSelection == ESelectCollection)
+ {
+ primaryAction()->disconnect(SIGNAL(triggered()));
+ connect(primaryAction(), SIGNAL(triggered()), this, SLOT(primaryActionTriggeredSlot()));
}
-
+
+ if(mTypeOfSelection == EDeleteVideos || mTypeOfSelection == EAddToCollection)
+ {
+ mSelection.clear();
+ mListWidget->setSelectionMode(HbAbstractItemView::MultiSelection);
+ mListWidget->activate(VideoCollectionCommon::ELevelVideos);
+ mCheckboxContainer->setVisible(true);
+ mItemCount->setPlainText(tr("0/%1").arg(mModel->rowCount()));
+ mCheckBox->setChecked(false);
+ QString txt("");
+ mTypeOfSelection == EDeleteVideos ? txt = tr("Delete items") : txt = tr("Add to collection"); // localisation missing
+ mHeading->setPlainText(txt);
+ mTypeOfSelection == EDeleteVideos ? txt = hbTrId("txt_common_menu_delete") : txt = tr("Add"); // localisation missing
+ primaryAction()->setText(txt);
+ primaryAction()->setDisabled(true);
+ }
+ else
+ {
+ mListWidget->setSelectionMode(-1);
+ mListWidget->activate(VideoCollectionCommon::ELevelCategory);
+ mCheckboxContainer->setVisible(false);
+ mHeading->setPlainText(tr("Select collection")); // localisation missing
+ primaryAction()->setText(tr("New")); // localisation missing
+ primaryAction()->setDisabled(false);
+ }
+ // sort to make sure dialog has correctly filtered content
+ // at the same order as in view
+ VideoCollectionViewUtils::sortModel(mModel, false);
}
// ---------------------------------------------------------------------------
@@ -113,26 +236,13 @@
//
HbAction* VideoListSelectionDialog::exec()
{
- mSelection.clear();
- if(!mVideoList)
- {
- return 0;
- }
-
- // setup content of the popup
- mVideoList->setSelectionMode(HbAbstractItemView::MultiSelection);
+ // clear checkbox
+ mCheckBox->setChecked(false);
- // clear parent layout item from our widget to be able to insert it
- // to the stackedWidget child
- QGraphicsLayoutItem *currenParentLayout = mVideoList->parentLayoutItem();
- QGraphicsItem *currentParentItem = mVideoList->parentItem();
- mVideoList->setParentLayoutItem(0);
+ mListWidget->clearSelection();
- if(!mListContainer)
- {
- mListContainer = mUiLoader->findWidget<HbStackedWidget>(DOCML_NAME_LIST_CONTAINER);
- }
- mListContainer->addWidget(mVideoList);
+ // scroll list back to top
+ mListWidget->scrollTo(mModel->index(0, 0));
connectSignals();
@@ -141,27 +251,39 @@
HbDialog::exec() == primaryAction() ? accepted = true : accepted = false;
disconnectSignals();
-
- // remove out widget from stacked before poptup is to be destroyed to make sure
- // our widget does not get deleted
- mListContainer->removeAt(0);
-
- // restore widget's original parent and layout.
- mVideoList->setParentItem(currentParentItem);
- mVideoList->setParentLayoutItem(currenParentLayout);
+
+ if(accepted)
+ {
+ // user is adding videos into selected collection
+ // or selecting collection where to add videos
+ if(mTypeOfSelection == EAddToCollection ||
+ mTypeOfSelection == ESelectCollection)
+ {
+ if(mSelectedAlbumId != TMPXItemId::InvalidId() && mSelectedVideos.count())
+ {
+ if(mModel->addItemsInAlbum(mSelectedAlbumId, mSelectedVideos.toList()) == 0)
+ {
+ QVariant data = getSelectedName();
+ VideoCollectionViewUtils::instance().showStatusMsgSlot(
+ VideoCollectionCommon::statusVideosAddedToCollection,
+ data);
+ }
+ }
+ }
+ // user is deleting videos
+ else if(mTypeOfSelection == EDeleteVideos)
+ {
+ QVariant data = mSelection.indexes().count();
+ VideoCollectionViewUtils::instance().showStatusMsgSlot(
+ VideoCollectionCommon::statusDeleteInProgress,
+ data);
+ // delete items
+ mModel->deleteItems(mSelection.indexes());
- mVideoList->setSelectionMode(HbAbstractItemView::NoSelection);
-
- currentParentItem->setVisible(true);
- mVideoList->setVisible(true);
-
- if(!accepted)
- {
- mSelection.clear();
- return secondaryAction();
- }
- return primaryAction();
-
+ }
+ return primaryAction();
+ }
+ return secondaryAction();
}
// ---------------------------------------------------------------------------
@@ -169,23 +291,18 @@
// ---------------------------------------------------------------------------
//
void VideoListSelectionDialog::markAllStateChangedSlot(int state)
-{
- if(!mVideoList)
- {
- return;
- }
-
+{
if(mForcedCheck)
{
return;
}
if( state == Qt::Checked)
{
- mVideoList->selectAll();
+ mListWidget->selectAll();
}
else
{
- mVideoList->clearSelection();
+ mListWidget->clearSelection();
}
}
@@ -200,6 +317,7 @@
{
return;
}
+
if(selected.indexes().count() > 0)
{
mSelection.merge(selected, QItemSelectionModel::Select);
@@ -223,17 +341,63 @@
}
// ---------------------------------------------------------------------------
+// singleItemSelectedSlot
+// ---------------------------------------------------------------------------
+//
+void VideoListSelectionDialog::singleItemSelectedSlot(const QModelIndex &index)
+{
+ if(mTypeOfSelection == ESelectCollection)
+ {
+ if(index.isValid())
+ {
+ mSelectedAlbumId = mModel->getMediaIdAtIndex(index);
+ primaryAction()->trigger();
+ }
+ }
+}
+
+// ---------------------------------------------------------------------------
+// modelReadySlot
+// ---------------------------------------------------------------------------
+//
+void VideoListSelectionDialog::modelReadySlot()
+{
+ if(!mModel)
+ {
+ return;
+ }
+
+ if(mTypeOfSelection == ESelectCollection && ! mModel->rowCount())
+ {
+ // in case there are no albums, start input dialog right away
+ mSelectedAlbumId = queryNewAlbum();
+ if(mSelectedAlbumId != TMPXItemId::InvalidId())
+ {
+ primaryAction()->trigger();
+ }
+ else
+ {
+ secondaryAction()->trigger();
+ }
+ return;
+ }
+ updateCounterSlot();
+}
+
+// ---------------------------------------------------------------------------
// updateCounterSlot
// ---------------------------------------------------------------------------
//
void VideoListSelectionDialog::updateCounterSlot()
{
- if(!mVideoList || !mItemCount)
+ if(!mItemCount || !mModel)
{
return;
}
// orbit does not update HbLabel read from docml in case it isn't cleared first
- int rowCount = mVideoList->getModel().rowCount();
+ int rowCount = mModel->rowCount();
+
+
int selectionCount = mSelection.indexes().count();
mItemCount->setPlainText(tr("%1/%2").arg(selectionCount).arg(rowCount));
@@ -251,23 +415,83 @@
}
// ---------------------------------------------------------------------------
+// primaryActionTriggeredSlot
+// ---------------------------------------------------------------------------
+//
+void VideoListSelectionDialog::primaryActionTriggeredSlot()
+{
+ // reconnect primary action
+ primaryAction()->disconnect(SIGNAL(triggered()));
+ connect(primaryAction(), SIGNAL(triggered()), this, SLOT(close()));
+
+ if(mTypeOfSelection == EDeleteVideos)
+ {
+ primaryAction()->trigger();
+ return;
+ }
+
+ // update video items selection here before content changes.
+ int count = mSelection.indexes().count();
+ TMPXItemId id = TMPXItemId::InvalidId();
+ for(int i = 0; i < count; ++i)
+ {
+ id = mModel->getMediaIdAtIndex(mSelection.indexes().at(i));
+ if(id.iId2 == KVcxMvcMediaTypeVideo)
+ {
+ mSelectedVideos.insert(id);
+ }
+ }
+
+ if(mSelectedAlbumId != TMPXItemId::InvalidId())
+ {
+ primaryAction()->trigger();
+ return;
+ }
+
+
+ else if(mTypeOfSelection == ESelectCollection)
+ {
+ // there's no selected collection and primary action pressed
+ // -> user is willing to create a new collection
+ mSelectedAlbumId = queryNewAlbum();
+ if(mSelectedAlbumId != TMPXItemId::InvalidId())
+ {
+ primaryAction()->trigger();
+ }
+ else
+ {
+ // cancelled
+ secondaryAction()->trigger();
+ }
+ }
+ else if(mTypeOfSelection == EAddToCollection)
+ {
+ // videos for collection selected, but collection
+ // not yet selected, activate selection for it
+ mTypeOfSelection = ESelectCollection;
+ activateSelection();
+ }
+}
+
+// ---------------------------------------------------------------------------
// connectSignals
// ---------------------------------------------------------------------------
//
void VideoListSelectionDialog::connectSignals()
{
// selection changes
- connect(mVideoList->selectionModel(), SIGNAL(selectionChanged (const QItemSelection&, const QItemSelection&)),
- this, SLOT(selectionChangedSlot(const QItemSelection&, const QItemSelection &)));
+ connect(mListWidget, SIGNAL(activated(const QModelIndex&)),
+ this, SLOT(singleItemSelectedSlot(const QModelIndex&)));
+
+ connect(mListWidget->selectionModel(), SIGNAL(selectionChanged (const QItemSelection&, const QItemSelection&)),
+ this, SLOT(selectionChangedSlot(const QItemSelection&, const QItemSelection &)));
// model changes signals
- connect(&(mVideoList->getModel()), SIGNAL(layoutChanged()), this, SLOT(updateCounterSlot()));
- connect(&(mVideoList->getModel()), SIGNAL(rowsInserted(const QModelIndex&, int, int)), this, SLOT(updateCounterSlot()));
- connect(&(mVideoList->getModel()), SIGNAL(rowsRemoved(const QModelIndex&, int, int)), this, SLOT(updateCounterSlot()));
+ connect(mModel, SIGNAL(modelReady()), this, SLOT(modelReadySlot()));
+ connect(mModel, SIGNAL(modelChanged()), this, SLOT(updateCounterSlot()));
// mark all state changes
connect(mCheckBox, SIGNAL(stateChanged(int)), this, SLOT(markAllStateChangedSlot(int)));
-
}
// ---------------------------------------------------------------------------
@@ -275,19 +499,63 @@
// ---------------------------------------------------------------------------
//
void VideoListSelectionDialog::disconnectSignals()
-{
+{
+ disconnect(mListWidget, SIGNAL(activated(const QModelIndex&)),
+ this, SLOT(singleItemSelectedSlot(const QModelIndex&)));
- disconnect(mVideoList->selectionModel(), SIGNAL(selectionChanged (const QItemSelection&, const QItemSelection&)),
+ disconnect(mListWidget->selectionModel(), SIGNAL(selectionChanged (const QItemSelection&, const QItemSelection&)),
this, SLOT(selectionChangedSlot(const QItemSelection&, const QItemSelection &)));
// model changes signals
- disconnect(&(mVideoList->getModel()), SIGNAL(layoutChanged()), this, SLOT(updateCounterSlot()));
- disconnect(&(mVideoList->getModel()), SIGNAL(rowsInserted(const QModelIndex&, int, int)), this, SLOT(updateCounterSlot()));
- disconnect(&(mVideoList->getModel()), SIGNAL(rowsRemoved(const QModelIndex&, int, int)), this, SLOT(updateCounterSlot()));
+ disconnect(mModel, SIGNAL(modelReady()), this, SLOT(modelReadySlot()));
+ disconnect(mModel, SIGNAL(modelChanged()), this, SLOT(updateCounterSlot()));
// mark all state changes
- disconnect(mCheckBox, SIGNAL(stateChanged(int)), this, SLOT(markAllStateChangedSlot(int)));
-
+ disconnect(mCheckBox, SIGNAL(stateChanged(int)), this, SLOT(markAllStateChangedSlot(int)));
}
+// ---------------------------------------------------------------------------
+// getSelectedName
+// ---------------------------------------------------------------------------
+//
+QString VideoListSelectionDialog::getSelectedName()
+{
+ QString name;
+ if(mSelectedAlbumId.iId2 > KVcxMvcMediaTypeVideo)
+ {
+ VideoSortFilterProxyModel *model =
+ VideoCollectionWrapper::instance().getModel(
+ VideoCollectionWrapper::ECollections);
+ if(!model)
+ {
+ return name;
+ }
+ QModelIndex index = model->indexOfId(mSelectedAlbumId);
+ if(index.isValid())
+ {
+ name = model->data(index, Qt::DisplayRole).toStringList().first();
+ }
+ }
+
+ return name;
+}
+// ---------------------------------------------------------------------------
+// queryNewAlbum
+// ---------------------------------------------------------------------------
+//
+TMPXItemId VideoListSelectionDialog::queryNewAlbum()
+{
+ TMPXItemId newId = TMPXItemId::InvalidId();
+ bool ok = false;
+ QString label(tr("Enter name:")); // localisation missing
+ QString text(tr("New collection")); // localisation missing
+ text = HbInputDialog::getText(label, text, &ok);
+ if (ok && text.length())
+ {
+ // check for duplicate album name and add new album
+ newId = mModel->addNewAlbum(mModel->resolveAlbumName(text));
+ }
+ return newId;
+}
+
--- a/videocollection/videocollectionview/src/videolistview.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionview/src/videolistview.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -19,7 +19,6 @@
#include <QActionGroup>
#include <hbinstance.h>
#include <hbmainwindow.h>
-#include <hblabel.h>
#include <hbmessagebox.h>
#include <hbstackedwidget.h>
#include <hbstackedlayout.h>
@@ -29,6 +28,8 @@
#include <hbmenu.h>
#include <hbgroupbox.h>
#include <hbpushbutton.h>
+#include <hbinputdialog.h>
+#include <vcxmyvideosdefs.h>
#include "videoservices.h"
#include "videolistselectiondialog.h"
@@ -44,30 +45,21 @@
// remove these
#include <QDebug>
-const int VIDEO_LIST_VIEW_OPTION_MENU_COUNT = 4;
-const int VIDEO_LIST_VIEW_SORT_MENU_COUNT = 5;
-
// ---------------------------------------------------------------------------
// Constructor
// ---------------------------------------------------------------------------
//
VideoListView::VideoListView(VideoCollectionUiLoader *uiLoader, QGraphicsItem *parent) :
HbView(parent),
-mSortMenu(0),
mUiUtils(VideoCollectionViewUtils::instance()),
mWrapper(VideoCollectionWrapper::instance()),
mUiLoader(uiLoader),
-mModel(0),
mIsService(false),
mModelReady(false),
-mSubLabel(0),
-mOptionsMenu(0),
mVideoServices(0),
-mVideoListWidget(0),
-mVideoHintWidget(0),
+mCurrentList(0),
mToolbarViewsActionGroup(0),
-mToolbarCollectionActionGroup(0),
-mSelectionDialog(0)
+mToolbarCollectionActionGroup(0)
{
// NOP
}
@@ -79,10 +71,7 @@
VideoListView::~VideoListView()
{
qDebug() << "VideoListView::~VideoListView()";
- delete mSelectionDialog;
- // widgets' destructors are being called throught
- // orbit framework. No need to remove them here.
- mMenuActions.clear();
+
mToolbarActions.clear();
mSortingRoles.clear();
@@ -91,12 +80,6 @@
mVideoServices->decreaseReferenceCount();
mVideoServices = 0;
}
-
- if(mWrapper)
- {
- mWrapper->decreaseReferenceCount();
- mWrapper = 0;
- }
}
// ---------------------------------------------------------------------------
@@ -107,6 +90,7 @@
{
if(!mUiLoader)
{
+ cleanup();
return -1;
}
@@ -118,6 +102,7 @@
if (!mVideoServices)
{
+ cleanup();
return -1;
}
else
@@ -125,60 +110,54 @@
connect(mVideoServices, SIGNAL(titleReady(const QString&)), this, SLOT(titleReadySlot(const QString&)));
}
}
-
- // create model
- if(mWrapper)
- {
- mModel = mWrapper->getModel();
- }
-
- if(!mModel || mModel->open(VideoListWidget::ELevelVideos) < 0)
- {
- cleanup();
- return -1;
- }
-
- int sortRole(VideoCollectionCommon::KeyDateTime);
- Qt::SortOrder sortOrder(Qt::AscendingOrder);
-
- // return value ignored, as in case of error the sortRole and sortOrder variables
- // stay at their predefined values, and in error cases those are the sorting values
- // that are used.
- mUiUtils.loadSortingValues(sortRole, sortOrder);
+ mUiLoader->setIsService(mIsService);
- mModel->doSorting(sortRole, sortOrder, false);
-
- mOptionsMenu = mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU);
-
- if(!mOptionsMenu)
+ // start open all videos model
+ VideoSortFilterProxyModel *model =
+ mWrapper.getModel(VideoCollectionWrapper::EAllVideos);
+ if (model)
{
- cleanup();
- return -1;
- }
-
- mSubLabel = mUiLoader->findWidget<HbGroupBox>(DOCML_NAME_VC_HEADINGBANNER);
-
- if(!mSubLabel)
- {
- cleanup();
- return -1;
- }
-
- mSubLabel->setCollapsable(false);
-
- // allocate and initialize views, menus and toolbar
- if(createVideoWidget() != 0
- || createHintWidget() != 0
- || createToolbar() != 0
- || createMainMenu() != 0)
+ model->open(VideoCollectionCommon::ELevelVideos);
+ }
+ else
{
cleanup();
return -1;
}
-
- mSubLabel->setHeading(tr("Retrieving list.."));
-
- mCollectionName = "";
+
+ // start loading widgets
+ QSet<QString> uiItems;
+ uiItems.insert(DOCML_NAME_VC_VIDEOLISTWIDGET);
+ uiItems.insert(DOCML_NAME_OPTIONS_MENU);
+ uiItems.insert(DOCML_NAME_ADD_TO_COLLECTION);
+ uiItems.insert(DOCML_NAME_CREATE_COLLECTION);
+ uiItems.insert(DOCML_NAME_DELETE_MULTIPLE);
+ uiItems.insert(DOCML_NAME_VC_HEADINGBANNER);
+ uiItems.insert(DOCML_NAME_VC_VIDEOHINTWIDGET);
+ uiItems.insert(DOCML_NAME_HINT_BUTTON);
+ uiItems.insert(DOCML_NAME_NO_VIDEOS_LABEL);
+ uiItems.insert(DOCML_NAME_SORT_MENU);
+ uiItems.insert(DOCML_NAME_SORT_BY_DATE);
+ uiItems.insert(DOCML_NAME_SORT_BY_NAME);
+ uiItems.insert(DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS);
+ uiItems.insert(DOCML_NAME_SORT_BY_TOTAL_LENGTH);
+ uiItems.insert(DOCML_NAME_SORT_BY_RATING);
+ uiItems.insert(DOCML_NAME_SORT_BY_SIZE);
+ uiItems.insert(DOCML_NAME_VC_COLLECTIONWIDGET);
+ uiItems.insert(DOCML_NAME_VC_COLLECTIONCONTENTWIDGET);
+ uiItems.insert(DOCML_NAME_DIALOG);
+ mUiLoader->startLoading(uiItems,
+ this,
+ SLOT(widgetReadySlot(QGraphicsWidget*, const QString&)),
+ SLOT(objectReadySlot(QObject*, const QString&)));
+ uiItems.clear();
+
+ // TODO: create toolbar temporarily here until it has been moved to docml
+ if (createToolbar() != 0)
+ {
+ cleanup();
+ return -1;
+ }
return 0;
}
@@ -198,61 +177,65 @@
//
int VideoListView::activateView()
{
- mOptionsMenu->setEnabled(true);
-
- HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
-
- if(!connect(mainWnd, SIGNAL(aboutToChangeOrientation()),
- this, SLOT( aboutToChangeOrientationSlot())) ||
- !connect(mainWnd, SIGNAL(orientationChanged(Qt::Orientation)),
- this, SLOT(orientationChangedSlot(Qt::Orientation))) ||
- !connect(mWrapper, SIGNAL(asyncStatus(int, QVariant&)),
- this, SLOT(handleAsyncStatusSlot(int, QVariant&))) ||
-
- //TODO: seems like rowsremoved is not signaled when files are removed, but layoutchanged
- //TODO: on the other hand, layoutchanged is not signaled when items are added but rowsinserted is
-
- !connect(mModel,
- SIGNAL(rowsInserted(const QModelIndex&, int, int)),
- this, SLOT(layoutChangedSlot())) ||
- !connect(mModel,
- SIGNAL(rowsRemoved(const QModelIndex&, int, int)),
- this, SLOT(layoutChangedSlot())) ||
- //TODO: connect to rowsremoved rowsinserted once delete results emitting removed
- !connect(mModel,
- SIGNAL(layoutChanged()),
- this, SLOT(layoutChangedSlot())) ||
- !connect(mModel,
- SIGNAL(modelReady()),
- this, SLOT(modelReadySlot())))
+ VideoListWidget *videoList =
+ mUiLoader->findWidget<VideoListWidget>(
+ DOCML_NAME_VC_VIDEOLISTWIDGET);
+ if (videoList)
{
- // deactivate view so we get rid of dangling connections.
- deactivateView();
+ VideoCollectionCommon::TCollectionLevels level = VideoCollectionCommon::ELevelVideos;
+ if (mCurrentList)
+ {
+ level = mCurrentList->getLevel();
+ }
+ else
+ {
+ mCurrentList = videoList;
+ }
+
+ int result = mCurrentList->activate(level);
+ if(result < 0)
+ {
+ // activate failed, deactivate view so we get rid of dangling connections.
+ deactivateView();
+ return -1;
+ }
+
+ HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
+ if (mainWnd)
+ {
+ mainWnd->setOrientation(Qt::Vertical, false);
+ if(!connect(
+ mainWnd, SIGNAL(aboutToChangeOrientation()),
+ this, SLOT( aboutToChangeOrientationSlot())) ||
+ !connect(
+ mainWnd, SIGNAL(orientationChanged(Qt::Orientation)),
+ this, SLOT(orientationChangedSlot(Qt::Orientation))) ||
+ !connect(
+ &mWrapper, SIGNAL(asyncStatus(int, QVariant&)),
+ this, SLOT(handleAsyncStatusSlot(int, QVariant&))) ||
+ !connect(
+ mCurrentList->getModel().sourceModel(), SIGNAL(modelChanged()),
+ this, SLOT(layoutChangedSlot())) ||
+ !connect(
+ mCurrentList->getModel().sourceModel(), SIGNAL(modelReady()),
+ this, SLOT(modelReadySlot())))
+ {
+ // deactivate view so we get rid of dangling connections.
+ deactivateView();
+ return -1;
+ }
+ }
+ else
+ {
+ return -1;
+ }
+ }
+ else
+ {
return -1;
}
-
- // activate current vidget, first make sure it's one that can be activated
- if(mVideoListWidget)
- {
- int result = mVideoListWidget->activate();
- if(result < 0) {
- // activate failed, deactivate view so we get rid of dangling connections.
- deactivateView();
- }
- else if (mSubLabel->heading() != tr("Retrieving list.."))
- {
- updateSubLabel();
- }
-
- showHint();
- mainWnd->unsetOrientation();
-
- return result;
- }
-
- // deactivate view so we get rid of dangling connections.
- deactivateView();
- return -1;
+
+ return 0;
}
// ---------------------------------------------------------------------------
@@ -262,6 +245,7 @@
void VideoListView::modelReadySlot()
{
mModelReady = true;
+
// since the reset signal arrives after
// layout changed, need to make sure that
// view is updated in case needed
@@ -289,37 +273,39 @@
void VideoListView::deactivateView()
{
HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
-
+
+ mainWnd->unsetOrientation();
+
disconnect(mainWnd, SIGNAL(aboutToChangeOrientation()),
this, SLOT(aboutToChangeOrientationSlot()));
disconnect(mainWnd, SIGNAL(orientationChanged(Qt::Orientation)),
this, SLOT(orientationChangedSlot(Qt::Orientation)));
- disconnect(mWrapper, SIGNAL(asyncStatus(int, QVariant&)),
+ disconnect(&mWrapper, SIGNAL(asyncStatus(int, QVariant&)),
this, SLOT(handleAsyncStatusSlot(int, QVariant&)));
+
+ HbMenu *menu = mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU);
+ if (menu)
+ {
+ menu->hide();
+ }
+
+ if(mCurrentList && &(mCurrentList->getModel()) && mCurrentList->getModel().sourceModel())
+ {
+ disconnect(mCurrentList->getModel().sourceModel(),
+ SIGNAL(modelChanged()),
+ this, SLOT(layoutChangedSlot()));
+ disconnect(mCurrentList->getModel().sourceModel(),
+ SIGNAL(modelReady()),
+ this, SLOT(modelReadySlot()));
- disconnect(mModel,
- SIGNAL(rowsInserted(const QModelIndex&, int, int)),
- this, SLOT(layoutChangedSlot()));
- disconnect(mModel,
- SIGNAL(rowsRemoved(const QModelIndex&, int, int)),
- this, SLOT(layoutChangedSlot()));
- disconnect(mModel,
- SIGNAL(layoutChanged()),
- this, SLOT(layoutChangedSlot()));
- disconnect(mModel,
- SIGNAL(modelReady()),
- this, SLOT(modelReadySlot()));
-
- mOptionsMenu->setVisible(false);
- mOptionsMenu->setEnabled(false);
+ showHint(false);
+ }
- showHint(false);
-
- if(mVideoListWidget)
+ if(mCurrentList)
{
- mVideoListWidget->deactivate();
+ mCurrentList->deactivate();
}
}
@@ -344,71 +330,7 @@
delete mToolbarCollectionActionGroup;
mToolbarCollectionActionGroup = 0;
- // not deleted as the uiloader owns these.
- mVideoListWidget = 0;
- mVideoHintWidget = 0;
-}
-
-// ---------------------------------------------------------------------------
-// createMainMenu()
-// ---------------------------------------------------------------------------
-//
-int VideoListView::createMainMenu()
-{
- if(mMenuActions.count() > 0)
- {
- // Menu is already created.
- return 0;
- }
-
- if(!connect(mOptionsMenu, SIGNAL(aboutToShow()), this, SLOT(aboutToShowMainMenuSlot())))
- {
- return -1;
- }
-
- mMenuActions[EActionAddToCollection] = (HbAction*)mUiLoader->findObject<QObject>(DOCML_NAME_ADD_TO_COLLECTION);
- connect(mMenuActions[EActionAddToCollection], SIGNAL(triggered()), this, SLOT(debugNotImplementedYet()));
-
- mMenuActions[EActionNewCollection] = (HbAction*)mUiLoader->findObject<QObject>(DOCML_NAME_CREATE_COLLECTION);
- connect(mMenuActions[EActionNewCollection], SIGNAL(triggered()), this, SLOT(createCollectionSlot()));
-
- mMenuActions[EActionDelete] = (HbAction*)mUiLoader->findObject<QObject>(DOCML_NAME_DELETE_MULTIPLE);
- connect(mMenuActions[EActionDelete], SIGNAL(triggered()), this, SLOT(deleteItemsSlot()));
-
- mSortMenu = mUiLoader->findWidget<HbMenu>(DOCML_NAME_SORT_MENU);
-
- mMenuActions[EActionSortBy] = mSortMenu->menuAction();
-
- // submenu items and roles for sorting
- mMenuActions[EActionSortByDate] = (HbAction*)mUiLoader->findObject<QObject>(DOCML_NAME_SORT_BY_DATE);
- connect(mMenuActions[EActionSortByDate], SIGNAL(triggered()), this, SLOT(startSorting()));
- mSortingRoles[mMenuActions[EActionSortByDate]] = VideoCollectionCommon::KeyDateTime;
-
- mMenuActions[EActionSortByName] = (HbAction*)mUiLoader->findObject<QObject>(DOCML_NAME_SORT_BY_NAME);
- connect(mMenuActions[EActionSortByName], SIGNAL(triggered()), this, SLOT(startSorting()));
- mSortingRoles[mMenuActions[EActionSortByName]] = Qt::DisplayRole;
-
- mMenuActions[EACtionSortByItemCount] = (HbAction*)mUiLoader->findObject<QObject>(DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS);
- connect(mMenuActions[EACtionSortByItemCount], SIGNAL(triggered()), this, SLOT(startSorting()));
- // TODO:
- mSortingRoles[mMenuActions[EACtionSortByItemCount]] = 0;
-
- mMenuActions[EActionSortByLength] = (HbAction*)mUiLoader->findObject<QObject>(DOCML_NAME_SORT_BY_TOTAL_LENGTH);
- connect(mMenuActions[EActionSortByLength], SIGNAL(triggered()), this, SLOT(startSorting()));
- // TODO:
- mSortingRoles[mMenuActions[EActionSortByLength]] = 0;
-
- mMenuActions[EActionSortBySize] = (HbAction*)mUiLoader->findObject<QObject>(DOCML_NAME_SORT_BY_SIZE);
- connect(mMenuActions[EActionSortBySize], SIGNAL(triggered()), this, SLOT(startSorting()));
- mSortingRoles[mMenuActions[EActionSortBySize]] = VideoCollectionCommon::KeySizeValue;
-
- if(mSortMenu->actions().count() != VIDEO_LIST_VIEW_SORT_MENU_COUNT
- || mOptionsMenu->actions().count() != VIDEO_LIST_VIEW_OPTION_MENU_COUNT)
- {
- return -1;
- }
-
- return 0;
+ mCurrentList = 0;
}
// ---------------------------------------------------------------------------
@@ -440,29 +362,29 @@
// create toolbar item actions
// All Videos tab
- mToolbarActions[ETBActionAllVideos] = createAction(tr("All videos"), ":/images/qtg_mono_video_all.svg",
+ mToolbarActions[ETBActionAllVideos] = createAction(":/images/qtg_mono_video_all.svg",
mToolbarViewsActionGroup, SLOT(openAllVideosViewSlot()));
// Collections tab
- mToolbarActions[ETBActionCollections] = createAction(tr("Collections"), ":/images/qtg_mono_video_collection.svg",
+ mToolbarActions[ETBActionCollections] = createAction(":/images/qtg_mono_video_collection.svg",
mToolbarViewsActionGroup, SLOT(openCollectionViewSlot()));
if (!mIsService)
{
// Services tab
- mToolbarActions[ETBActionServices] = createAction(tr("Services"), ":/images/qtg_mono_video_services.svg",
+ mToolbarActions[ETBActionServices] = createAction(":/images/qtg_mono_video_services.svg",
mToolbarViewsActionGroup, SLOT(openServicesViewSlot()));
// Add Videos tab
- mToolbarActions[ETBActionAddVideos] = createAction(tr("Add videos"), ":/images/mono_video_addvideos.svg",
+ mToolbarActions[ETBActionAddVideos] = createAction(":/images/mono_video_addvideos.svg",
mToolbarCollectionActionGroup, SLOT(addVideosToCollectionSlot()));
// Remove Videos tab
- mToolbarActions[ETBActionRemoveVideos] = createAction(tr("Remove videos"), ":/images/mono_video_removevideos.svg",
+ mToolbarActions[ETBActionRemoveVideos] = createAction(":/images/mono_video_removevideos.svg",
mToolbarCollectionActionGroup, SLOT(debugNotImplementedYet()));
}
// Sort by tab
- mToolbarActions[ETBActionSortVideos] = createAction(tr("Sort by"), ":/images/mono_video_sortvideos.svg",
+ mToolbarActions[ETBActionSortVideos] = createAction(":/images/mono_video_sortvideos.svg",
mToolbarCollectionActionGroup, SLOT(openSortByMenuSlot()));
HbToolBar *bar = toolBar(); // First call to toolBar() creates the object, so on failure it could return 0.
@@ -497,6 +419,7 @@
mToolbarActions[ETBActionAllVideos]->setChecked(true);
bar->addActions(mToolbarViewsActionGroup->actions());
+ bar->setVisible(true);
}
return 0;
@@ -506,7 +429,7 @@
// createAction()
// ---------------------------------------------------------------------------
//
-HbAction* VideoListView::createAction(QString tooltip, QString icon,
+HbAction* VideoListView::createAction(QString icon,
QActionGroup* actionGroup, const char *slot)
{
HbAction* action = new HbAction(actionGroup);
@@ -514,7 +437,6 @@
return 0;
}
- action->setToolTip(tooltip);
HbIcon hbIcon(icon);
action->setIcon(hbIcon);
@@ -528,133 +450,226 @@
return action;
}
-
-// ---------------------------------------------------------------------------
-// createVideoWidget()
-// ---------------------------------------------------------------------------
-//
-int VideoListView::createVideoWidget()
-{
- if(!mModel)
- {
- return -1;
- }
- if(!mVideoListWidget)
- {
- mVideoListWidget = mUiLoader->findWidget<VideoListWidget>(DOCML_NAME_VC_VIDEOLISTWIDGET);
- if(!mVideoListWidget )
- {
- return -1;
- }
- if(mVideoListWidget->initialize(*mModel, mVideoServices) < 0)
- {
- return -1;
- }
-
- if(!connect(mVideoListWidget, SIGNAL( command(int)), this, SIGNAL(command(int))) ||
- !connect(mVideoListWidget, SIGNAL( collectionOpened(bool, const QString&)), this, SLOT(collectionOpenedSlot(bool, const QString&))))
- {
- return -1;
- }
- }
-
- return 0;
-}
-
-// ---------------------------------------------------------------------------
-// createHintWidget()
-// ---------------------------------------------------------------------------
-//
-int VideoListView::createHintWidget()
-{
- if(!mVideoHintWidget)
- {
- mVideoHintWidget = mUiLoader->findWidget<VideoHintWidget>(DOCML_NAME_VC_VIDEOHINTWIDGET);
- if(!mVideoHintWidget )
- {
- return -1;
- }
- if(mVideoHintWidget->initialize() < 0)
- {
- return -1;
- }
-
- HbPushButton* button = mUiLoader->findWidget<HbPushButton>(DOCML_NAME_HINT_BUTTON);
- if(!connect(button, SIGNAL(clicked(bool)), this, SLOT(openServicesViewSlot())))
- {
- return -1;
- }
- }
-
- return 0;
-}
-
// ---------------------------------------------------------------------------
// showHint
// ---------------------------------------------------------------------------
//
void VideoListView::showHint(bool show)
{
- if (mModel && mModelReady && (mModel->rowCount() == 0) && mVideoHintWidget)
+ if(!mCurrentList)
{
- mVideoHintWidget->setVisible(show);
+ return;
}
- else if (mVideoHintWidget)
+
+ VideoSortFilterProxyModel &model = mCurrentList->getModel();
+ VideoHintWidget *hintWidget =
+ mUiLoader->findWidget<VideoHintWidget>(
+ DOCML_NAME_VC_VIDEOHINTWIDGET);
+ if (mModelReady &&
+ model.rowCount() == 0 &&
+ hintWidget)
+ {
+ show ? hintWidget->activate() : hintWidget->deactivate();
+ }
+ else if (hintWidget)
{
show = false;
- mVideoHintWidget->setVisible(false);
+ hintWidget->deactivate();
}
if(show && mToolbarViewsActionGroup && mToolbarCollectionActionGroup)
{
if(!mIsService)
{
- mToolbarActions[ETBActionRemoveVideos]->setEnabled(false);
+ mToolbarActions[ETBActionRemoveVideos]->setVisible(false);
}
- mToolbarActions[ETBActionSortVideos]->setEnabled(false);
+ mToolbarActions[ETBActionSortVideos]->setVisible(false);
+
+ if(mCurrentList->getLevel() == VideoCollectionCommon::ELevelDefaultColl)
+ {
+ if(!mIsService)
+ {
+ mToolbarActions[ETBActionAddVideos]->setVisible(false);
+ }
+ hintWidget->setButtonShown(false);
+ }
+ else
+ {
+ hintWidget->setButtonShown(true);
+ }
}
- else
+ else if(mToolbarViewsActionGroup && mToolbarCollectionActionGroup)
{
if(!mIsService)
{
- if(mToolbarActions[ETBActionRemoveVideos]->isEnabled() == false)
+ if(mToolbarActions[ETBActionRemoveVideos]->isVisible() == false)
{
- mToolbarActions[ETBActionRemoveVideos]->setEnabled(true);
+ mToolbarActions[ETBActionRemoveVideos]->setVisible(true);
}
+ if(mToolbarActions[ETBActionAddVideos]->isVisible() == false)
+ {
+ mToolbarActions[ETBActionAddVideos]->setVisible(true);
+ }
}
- if(mToolbarActions[ETBActionSortVideos]->isEnabled() == false)
+ if(mToolbarActions[ETBActionSortVideos]->isVisible() == false)
+ {
+ mToolbarActions[ETBActionSortVideos]->setVisible(true);
+ }
+ hintWidget->setButtonShown(true);
+ }
+
+ HbGroupBox *subLabel =
+ mUiLoader->findWidget<HbGroupBox>(DOCML_NAME_VC_HEADINGBANNER);
+ if (subLabel)
+ {
+ if (show &&
+ subLabel &&
+ mCurrentList->getLevel() == VideoCollectionCommon::ELevelVideos)
{
- mToolbarActions[ETBActionSortVideos]->setEnabled(true);
+ subLabel->hide();
+ }
+ else
+ {
+ subLabel->show();
}
}
}
// ---------------------------------------------------------------------------
+// setHintLevel
+// ---------------------------------------------------------------------------
+//
+void VideoListView::setHintLevel(VideoHintWidget::HintLevel level)
+{
+ VideoHintWidget *hintWidget =
+ mUiLoader->findWidget<VideoHintWidget>(
+ DOCML_NAME_VC_VIDEOHINTWIDGET);
+ if (hintWidget)
+ {
+ hintWidget->setLevel(level);
+ }
+}
+
+// ---------------------------------------------------------------------------
// updateSubLabel
// ---------------------------------------------------------------------------
//
void VideoListView::updateSubLabel()
{
- //TODO: reduce unnecessary updates
- if (mModel && mVideoListWidget)
+ VideoSortFilterProxyModel *model = 0;
+ if(mCurrentList)
+ {
+ model = &mCurrentList->getModel();
+ }
+
+ if (model)
{
- int itemCount = mModel->rowCount();
+ int itemCount = model->rowCount();
+ VideoListWidget *videoListWidget =
+ mUiLoader->findWidget<VideoListWidget>(
+ DOCML_NAME_VC_VIDEOLISTWIDGET);
+
+ VideoListWidget *collectionWidget =
+ mUiLoader->findWidget<VideoListWidget>(
+ DOCML_NAME_VC_COLLECTIONWIDGET);
+
+ VideoListWidget *collectionContentWidget =
+ mUiLoader->findWidget<VideoListWidget>(
+ DOCML_NAME_VC_COLLECTIONCONTENTWIDGET);
+
+ HbGroupBox *subLabel =
+ mUiLoader->findWidget<HbGroupBox>(
+ DOCML_NAME_VC_HEADINGBANNER);
+
+ if (mCurrentList == videoListWidget)
+ {
+ subLabel->setHeading(hbTrId("txt_videos_subtitle_ln_videos", itemCount));
+ }
+ else if (mCurrentList == collectionWidget)
+ {
+ subLabel->setHeading(hbTrId("txt_videos_subtitle_l1_collections", itemCount));
+ }
+ else if(mCurrentList == collectionContentWidget)
+ {
+ subLabel->setHeading(hbTrId("txt_videos_subtitle_1_l2").arg(mCollectionName).arg(itemCount));
+ }
+ }
+}
- VideoListWidget::TVideoListType type = mVideoListWidget->getType();
- if (type == VideoListWidget::EAllVideos)
+// ---------------------------------------------------------------------------
+// showAction()
+// ---------------------------------------------------------------------------
+//
+void VideoListView::showAction(bool show, const QString &name)
+{
+ HbAction *action = mUiLoader->findObject<HbAction>(name);
+ if (!action)
+ {
+ // must be menu widget
+ HbMenu *menu = mUiLoader->findWidget<HbMenu>(name);
+ if (menu)
{
- mSubLabel->setHeading(tr("%1 videos").arg(itemCount));
+ action = menu->menuAction();
}
- else if (type == VideoListWidget::ECollections)
+ }
+
+ // hide or show action
+ if (action)
+ {
+ action->setVisible(show);
+ }
+}
+
+// ---------------------------------------------------------------------------
+// isActionChecked()
+// ---------------------------------------------------------------------------
+//
+bool VideoListView::isActionChecked(const QString &name)
+{
+ bool isChecked = false;
+
+ HbAction *action = mUiLoader->findObject<HbAction>(name);
+ if (!action)
+ {
+ // must be menu widget
+ HbMenu *menu = mUiLoader->findWidget<HbMenu>(name);
+ if (menu)
{
- mSubLabel->setHeading(tr("%1 collections").arg(itemCount));
- }
- else if (type == VideoListWidget::EDefaultColItems ||
- type == VideoListWidget::EUserColItems)
+ action = menu->menuAction();
+ }
+ }
+
+ // check if action is checked
+ if (action)
+ {
+ isChecked = action->isChecked();
+ }
+
+ return isChecked;
+}
+
+// ---------------------------------------------------------------------------
+// isActionChecked()
+// ---------------------------------------------------------------------------
+//
+void VideoListView::setActionChecked(bool setChecked, const QString &name)
+{
+ HbAction *action = mUiLoader->findObject<HbAction>(name);
+ if (!action)
+ {
+ // must be menu widget
+ HbMenu *menu = mUiLoader->findWidget<HbMenu>(name);
+ if (menu)
{
- mSubLabel->setHeading(tr("%1 (%2)").arg(mCollectionName).arg(itemCount));
+ action = menu->menuAction();
}
}
+
+ // update action check state
+ if (action)
+ {
+ action->setChecked(setChecked);
+ }
}
// ---------------------------------------------------------------------------
@@ -663,10 +678,26 @@
//
void VideoListView::openAllVideosViewSlot()
{
- mModel->open(VideoListWidget::ELevelVideos);
- mVideoListWidget->activate(VideoListWidget::ELevelVideos);
- mVideoHintWidget->setLevel(VideoHintWidget::AllVideos);
- updateSubLabel();
+ VideoListWidget *videoListWidget =
+ mUiLoader->findWidget<VideoListWidget>(
+ DOCML_NAME_VC_VIDEOLISTWIDGET);
+ if (mCurrentList &&
+ videoListWidget &&
+ mCurrentList != videoListWidget)
+ {
+ // deactivate old list
+ mCurrentList->deactivate();
+
+ // activate all videos list
+ mCurrentList = videoListWidget;
+ mCurrentList->activate(VideoCollectionCommon::ELevelVideos);
+
+ // since collection is not to be opened at this point,
+ // we do not receive lauoutChanged for updating the hind -widget
+ // if needed, need to show it here is needed
+ setHintLevel(VideoHintWidget::AllVideos);
+ showHint();
+ }
}
// ---------------------------------------------------------------------------
@@ -675,14 +706,54 @@
//
void VideoListView::openCollectionViewSlot()
{
- mModel->open(VideoListWidget::ELevelCategory);
- mVideoListWidget->activate(VideoListWidget::ELevelCategory);
- mVideoHintWidget->setLevel(VideoHintWidget::Collection);
-
- // the collection view is not empty, so we can hide the hint in advance.
- showHint(false);
-
- updateSubLabel();
+ VideoListWidget *collectionWidget =
+ mUiLoader->findWidget<VideoListWidget>(
+ DOCML_NAME_VC_COLLECTIONWIDGET);
+ if (mCurrentList &&
+ mCurrentList != collectionWidget)
+ {
+ // deactivate all videos widget
+ mCurrentList->deactivate();
+
+ // activate video collection widget
+ mCurrentList = collectionWidget;
+ mCurrentList->activate(VideoCollectionCommon::ELevelCategory);
+
+ VideoSortFilterProxyModel &model = mCurrentList->getModel();
+ VideoCollectionViewUtils::sortModel(&model, false);
+
+ // the collection view is not empty, so we can hide the hint in advance.
+ showHint(false);
+ }
+}
+
+// ---------------------------------------------------------------------------
+// openNewAlbumSlot()
+// ---------------------------------------------------------------------------
+//
+void VideoListView::openNewAlbumSlot(const QModelIndex &parent,
+ int start,
+ int end)
+{
+ Q_UNUSED(end);
+ if(!mCurrentList)
+ {
+ return;
+ }
+ // invalidate model
+ VideoSortFilterProxyModel &model = mCurrentList->getModel();
+ model.invalidate();
+
+ // activate new index
+ QModelIndex index = model.index(start, 0, parent);
+ if (index.isValid())
+ {
+ // disconnect rowsInserted signal to prevent obsolete slot calls
+ disconnect( &model, SIGNAL(rowsInserted(const QModelIndex&, int, int)),
+ this, SLOT(openNewAlbumSlot(const QModelIndex&, int, int)));
+
+ mCurrentList->emitActivated(index);
+ }
}
// ---------------------------------------------------------------------------
@@ -700,28 +771,27 @@
//
void VideoListView::startSorting()
{
- if(!mModel || !mOptionsMenu)
+ HbMenu *optionsMenu =
+ mUiLoader->findWidget<HbMenu>(
+ DOCML_NAME_OPTIONS_MENU);
+ if (optionsMenu)
{
- return;
- }
- // Check that action is sort by and it has a sub menu.
- if(mOptionsMenu->activeAction() != mMenuActions[EActionSortBy] || !mOptionsMenu->activeAction()->menu())
- {
- return;
- }
+ // get sorting role from active action
+ HbAction *action = optionsMenu->activeAction()->menu()->activeAction();
+ int role = mSortingRoles[action];
- int role = mSortingRoles[mOptionsMenu->activeAction()->menu()->activeAction()];
+ // sort model
+ Qt::SortOrder order(Qt::AscendingOrder);
+ VideoSortFilterProxyModel &model = mCurrentList->getModel();
+ if(model.sortRole() == role && model.sortOrder() == Qt::AscendingOrder)
+ {
+ order = Qt::DescendingOrder;
+ }
+ model.doSorting(role, order);
- Qt::SortOrder order(Qt::AscendingOrder);
-
- if(mModel->sortRole() == role && mModel->sortOrder() == Qt::AscendingOrder)
- {
- order = Qt::DescendingOrder;
- }
-
- mModel->doSorting(role, order);
-
- mUiUtils.saveSortingValues(role, order);
+ // save sorting values
+ mUiUtils.saveSortingValues(role, order);
+ }
}
// -------------------------------------------------------------------------------------------------
@@ -754,28 +824,18 @@
//
void VideoListView::deleteItemsSlot()
{
- if(!mModel)
+ if(!mCurrentList)
{
return;
}
- if(!mSelectionDialog)
+ VideoListSelectionDialog *dialog =
+ mUiLoader->findWidget<VideoListSelectionDialog>(
+ DOCML_NAME_DIALOG);
+ if (dialog)
{
- bool ok(false);
- mUiLoader->load(DOCML_VIDEOSELECTIONDIALOG_FILE, &ok);
- if(!ok)
- {
- return;
- }
- mSelectionDialog = mUiLoader->findObject<VideoListSelectionDialog>( DOCML_NAME_DIALOG );
- }
- mSelectionDialog->setContent(tr("Delete items"), mVideoListWidget);
- if(mSelectionDialog->exec() == mSelectionDialog->primaryAction())
- {
- // get selection and remove
- QItemSelection selection = mSelectionDialog->getSelection();
- mModel->deleteItems(selection.indexes());
- // invalid model to get UI updated
- mModel->invalidate();
+ TMPXItemId collectionId = mCurrentList->getModel().getOpenItem();
+ dialog->setupContent(VideoListSelectionDialog::EDeleteVideos, collectionId);
+ dialog->exec();
}
}
@@ -785,7 +845,34 @@
//
void VideoListView::createCollectionSlot()
{
- debugNotImplementedYet();
+ if(!mCurrentList)
+ {
+ return;
+ }
+
+ VideoSortFilterProxyModel &model = mCurrentList->getModel();
+
+
+ bool ok = false;
+ // query a name for the collection
+ QString label(tr("Enter name:")); // TODO: localization missing!
+ QString text(tr("New collection")); // TODO: localization missing!
+ text = HbInputDialog::getText(label, text, &ok);
+ if (ok && text.length())
+ {
+ // resolve collection true name and add new album
+ text = model.resolveAlbumName(text);
+
+ // when collection reports about new collection, we open it right away,
+ // for that, connect to rowsInserted so that the new album can be opened
+ if(!connect(&model, SIGNAL(rowsInserted(const QModelIndex&, int, int)),
+ this, SLOT(openNewAlbumSlot(const QModelIndex&, int, int))))
+ {
+ return;
+ }
+
+ model.addNewAlbum(text);
+ }
}
// -------------------------------------------------------------------------------------------------
@@ -794,7 +881,38 @@
//
void VideoListView::addVideosToCollectionSlot()
{
- debugNotImplementedYet();
+ if(!mCurrentList)
+ {
+ return;
+ }
+
+ VideoListSelectionDialog *dialog =
+ mUiLoader->findWidget<VideoListSelectionDialog>(
+ DOCML_NAME_DIALOG);
+ if (dialog)
+ {
+ if(mCurrentList->getLevel() == VideoCollectionCommon::ELevelAlbum)
+ {
+ // album is opened, do not proceed in case it already have same amount
+ // of videos than all videos view.
+ VideoListWidget *allVideos = mUiLoader->findWidget<VideoListWidget>(
+ DOCML_NAME_VC_VIDEOLISTWIDGET);
+ if(allVideos)
+ {
+ if(allVideos->getModel().rowCount() == mCurrentList->getModel().rowCount())
+ {
+ QVariant emptyAdditional;
+ mUiUtils.showStatusMsgSlot(
+ VideoCollectionCommon::statusAllVideosAlreadyInCollection,
+ emptyAdditional);
+ return;
+ }
+ }
+ }
+ TMPXItemId collectionId = mCurrentList->getModel().getOpenItem();
+ dialog->setupContent(VideoListSelectionDialog::EAddToCollection, collectionId);
+ dialog->exec();
+ }
}
// -------------------------------------------------------------------------------------------------
@@ -803,47 +921,66 @@
//
void VideoListView::aboutToShowMainMenuSlot()
{
- if(!mModel || !mToolbarViewsActionGroup || !mToolbarCollectionActionGroup)
+ if (!mCurrentList ||
+ !mToolbarViewsActionGroup ||
+ !mToolbarCollectionActionGroup)
{
return;
}
-
- int menuActionCount = 0;
- HbAction *action = 0;
- foreach(action, mMenuActions.values())
+
+ // hide all actions by default
+ showAction(false, DOCML_NAME_ADD_TO_COLLECTION);
+ showAction(false, DOCML_NAME_CREATE_COLLECTION);
+ showAction(false, DOCML_NAME_DELETE_MULTIPLE);
+ showAction(false, DOCML_NAME_SORT_BY_DATE);
+ showAction(false, DOCML_NAME_SORT_BY_NAME);
+ showAction(false, DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS);
+ showAction(false, DOCML_NAME_SORT_BY_TOTAL_LENGTH);
+ showAction(false, DOCML_NAME_SORT_BY_RATING);
+ showAction(false, DOCML_NAME_SORT_BY_SIZE);
+ showAction(false, DOCML_NAME_SORT_MENU);
+
+ VideoSortFilterProxyModel &model = mCurrentList->getModel();
+ if (!model.rowCount(QModelIndex()))
{
- if(action)
- {
- ++menuActionCount;
- action->setVisible(false);
- }
- }
- if(menuActionCount != mMenuActions.values().count() || mMenuActions.values().count() == 0)
- {
- // fatal error, some action(s) was not created.
- return;
- }
-
- if(!mModel->rowCount(QModelIndex()))
- {
- // no items, no menu
return;
}
+
+ // get current sorting values
+ int role;
+ Qt::SortOrder order;
+ model.getSorting(role, order);
HbAction *firstAction = (HbAction*)(toolBar()->actions().first());
if(mToolbarViewsActionGroup->checkedAction() == mToolbarActions[ETBActionAllVideos] &&
firstAction == mToolbarActions[ETBActionAllVideos])
{
- mMenuActions[EActionSortBy]->setVisible(true);
- mMenuActions[EActionSortByDate]->setVisible(true);
- mMenuActions[EActionSortByName]->setVisible(true);
- mMenuActions[EActionSortBySize]->setVisible(true);
+ showAction(true, DOCML_NAME_SORT_MENU);
+ showAction(true, DOCML_NAME_SORT_BY_DATE);
+ if (isActionChecked(DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS) ||
+ isActionChecked(DOCML_NAME_SORT_BY_TOTAL_LENGTH))
+ {
+ //TODO: when changing between videos and categories, sorting order needs to be changed, if new
+ // view does not have the previously active sorting order supported
+ showAction(true, DOCML_NAME_SORT_BY_DATE);
+ }
+ else
+ {
+ HbAction* action = mSortingRoles.key(role);
+ if (action)
+ {
+ action->setChecked(true);
+ }
+ }
+
+ showAction(true, DOCML_NAME_SORT_BY_NAME);
+ showAction(true, DOCML_NAME_SORT_BY_SIZE);
if (!mIsService)
{
- mMenuActions[EActionAddToCollection]->setVisible(true);
- mMenuActions[EActionDelete]->setVisible(true);
+ showAction(true, DOCML_NAME_ADD_TO_COLLECTION);
+ showAction(true, DOCML_NAME_DELETE_MULTIPLE);
}
}
else if(mToolbarViewsActionGroup->checkedAction() == mToolbarActions[ETBActionCollections] &&
@@ -851,19 +988,36 @@
{
if (!mIsService)
{
- mMenuActions[EActionNewCollection]->setVisible(true);
+ showAction(true, DOCML_NAME_CREATE_COLLECTION);
}
- mMenuActions[EActionSortBy]->setVisible(true);
- mMenuActions[EActionSortByName]->setVisible(true);
- mMenuActions[EACtionSortByItemCount]->setVisible(true);
- mMenuActions[EActionSortByLength]->setVisible(true);
+ showAction(true, DOCML_NAME_SORT_MENU);
+ showAction(true, DOCML_NAME_SORT_BY_NAME);
+
+ if (isActionChecked(DOCML_NAME_SORT_BY_DATE) ||
+ isActionChecked(DOCML_NAME_SORT_BY_SIZE))
+ {
+ //TODO: when changing between videos and categories, sorting order needs to be changed, if new
+ // view does not have the previously active sorting order supported
+ setActionChecked(true, DOCML_NAME_SORT_BY_NAME);
+ }
+ else
+ {
+ HbAction* action = mSortingRoles.key(role);
+ if (action)
+ {
+ action->setChecked(true);
+ }
+ }
+
+ showAction(true, DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS);
+ showAction(true, DOCML_NAME_SORT_BY_TOTAL_LENGTH);
}
else if(firstAction != mToolbarActions[ETBActionAllVideos])
{
//Add, Remove and Sort by will be launched from toolbar
if (!mIsService)
{
- mMenuActions[EActionDelete]->setVisible(true);
+ showAction(true, DOCML_NAME_DELETE_MULTIPLE);
}
}
}
@@ -874,15 +1028,6 @@
//
void VideoListView::handleAsyncStatusSlot(int statusCode, QVariant &additional)
{
- // in case of error concerns delete, need to reset filtering
- if(statusCode == VideoCollectionCommon::statusSingleDeleteFail ||
- statusCode == VideoCollectionCommon::statusMultipleDeleteFail)
- {
- if(mModel)
- {
- mModel->clear();
- }
- }
// show msg from status
mUiUtils.showStatusMsgSlot(statusCode, additional);
}
@@ -891,26 +1036,79 @@
// collectionOpenedSlot
// -------------------------------------------------------------------------------------------------
//
-void VideoListView::collectionOpenedSlot(bool collectionOpened, const QString& collection)
+void VideoListView::collectionOpenedSlot(bool collectionOpened,
+ const QString& collection,
+ const QModelIndex &index)
{
if(!mToolbarCollectionActionGroup || !mToolbarViewsActionGroup || !mToolbarActions.contains(ETBActionCollections))
{
return;
}
+
+ // update collection specific information
+ mCollectionName = collection;
- mCollectionName = collection;
+ HbToolBar* bar = toolBar();
+ bar->clearActions();
- HbToolBar* bar = toolBar();
- bar->clearActions();
-
- if (collectionOpened)
+ if (collectionOpened)
{
- mToolbarActions[ETBActionCollections]->setChecked(false);
- bar->addActions(mToolbarCollectionActionGroup->actions());
+ if(!index.isValid())
+ {
+ return;
+ }
+
+ // open album view
+ VideoListWidget *collectionContentWidget =
+ mUiLoader->findWidget<VideoListWidget>(
+ DOCML_NAME_VC_COLLECTIONCONTENTWIDGET);
+ if (mCurrentList &&
+ mCurrentList != collectionContentWidget)
+ {
+ // get item id before deactivating
+ TMPXItemId itemId = TMPXItemId::InvalidId();
+ itemId = mCurrentList->getModel().getMediaIdAtIndex(index);
+
+ // only category or album can be activated here
+ if(itemId == TMPXItemId::InvalidId() ||
+ (itemId.iId2 != KVcxMvcMediaTypeCategory &&
+ itemId.iId2 != KVcxMvcMediaTypeAlbum))
+ {
+ return;
+ }
+
+ // deactivat current
+ mCurrentList->deactivate();
+
+ // activate video collection content widget
+ mCurrentList = collectionContentWidget;
+
+ if(itemId.iId2 == KVcxMvcMediaTypeCategory)
+ {
+ mCurrentList->activate(VideoCollectionCommon::ELevelDefaultColl);
+ }
+ else if(itemId.iId2 == KVcxMvcMediaTypeAlbum)
+ {
+ mCurrentList->activate(VideoCollectionCommon::ELevelAlbum);
+ }
+ mCurrentList->getModel().openItem(itemId);
+
+ // update hint widget, but don't show yet
+ setHintLevel(VideoHintWidget::Collection);
+ showHint(false);
+
+ // update toolbar
+ mToolbarActions[ETBActionCollections]->setChecked(false);
+ bar->addActions(mToolbarCollectionActionGroup->actions());
+ }
}
else
{
- bar->addActions(mToolbarViewsActionGroup->actions());
+ // open collection view
+ openCollectionViewSlot();
+
+ // update toolbar
+ bar->addActions(mToolbarViewsActionGroup->actions());
mToolbarActions[ETBActionCollections]->setChecked(true);
}
}
@@ -921,41 +1119,160 @@
//
void VideoListView::openSortByMenuSlot()
{
- if(!mModel)
+ if(!mCurrentList)
{
return;
}
-
- int menuActionCount = 0;
- HbAction *action = 0;
- foreach(action, mMenuActions.values())
- {
- if(action)
- {
- ++menuActionCount;
- action->setVisible(false);
- }
- }
- if(menuActionCount != mMenuActions.values().count() || mMenuActions.values().count() == 0)
- {
- // fatal error, some action(s) was not created.
- return;
- }
-
- if(!mModel->rowCount(QModelIndex()))
+
+ VideoSortFilterProxyModel &model = mCurrentList->getModel();
+ if (!model.rowCount(QModelIndex()))
{
// no items, no menu
return;
}
+
+ // hide all actions by default
+ showAction(false, DOCML_NAME_ADD_TO_COLLECTION);
+ showAction(false, DOCML_NAME_CREATE_COLLECTION);
+ showAction(false, DOCML_NAME_DELETE_MULTIPLE);
+ showAction(false, DOCML_NAME_SORT_BY_DATE);
+ showAction(false, DOCML_NAME_SORT_BY_NAME);
+ showAction(false, DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS);
+ showAction(false, DOCML_NAME_SORT_BY_TOTAL_LENGTH);
+ showAction(false, DOCML_NAME_SORT_BY_RATING);
+ showAction(false, DOCML_NAME_SORT_BY_SIZE);
+ showAction(false, DOCML_NAME_SORT_MENU);
+
+ // if sort menu found, show all sort items
+ HbMenu *sortMenu = mUiLoader->findWidget<HbMenu>(DOCML_NAME_SORT_MENU);
+ if (sortMenu)
+ {
+ // show actions
+ showAction(true, DOCML_NAME_SORT_MENU);
+ showAction(true, DOCML_NAME_SORT_BY_DATE);
+ showAction(true, DOCML_NAME_SORT_BY_NAME);
+ showAction(true, DOCML_NAME_SORT_BY_SIZE);
- mSortMenu->setVisible(true);
- mMenuActions[EActionSortBy]->setVisible(true);
- mMenuActions[EActionSortByDate]->setVisible(true);
- mMenuActions[EActionSortByName]->setVisible(true);
- mMenuActions[EActionSortBySize]->setVisible(true);
+ // show sort menu
+ sortMenu->show();
+
+ // execute sort menu
+ QPointF coords((size()/2).width(), (size()/3).height());
+ sortMenu->exec(coords);
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// widgetReadySlot
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListView::widgetReadySlot(QGraphicsWidget *widget, const QString &name)
+{
+ if (name.compare(DOCML_NAME_VC_VIDEOLISTWIDGET) == 0)
+ {
+ connect(widget, SIGNAL(command(int)), this, SIGNAL(command(int)));
+ }
+ else if (name.compare(DOCML_NAME_VC_COLLECTIONWIDGET) == 0)
+ {
+ connect(
+ widget, SIGNAL(collectionOpened(bool, const QString&, const QModelIndex&)),
+ this, SLOT(collectionOpenedSlot(bool, const QString&, const QModelIndex&)));
+ }
+ else if (name.compare(DOCML_NAME_VC_COLLECTIONCONTENTWIDGET) == 0)
+ {
+ connect(widget, SIGNAL(command(int)), this, SIGNAL(command(int)));
+ connect(
+ widget, SIGNAL(collectionOpened(bool, const QString&, const QModelIndex&)),
+ this, SLOT(collectionOpenedSlot(bool, const QString&, const QModelIndex&)));
+ }
+ else if (name.compare(DOCML_NAME_OPTIONS_MENU) == 0)
+ {
+ connect(
+ widget, SIGNAL(aboutToShow()), this, SLOT(aboutToShowMainMenuSlot()));
+ }
+ else if (name.compare(DOCML_NAME_HINT_BUTTON) == 0)
+ {
+ connect(widget, SIGNAL(clicked(bool)), this, SLOT(openServicesViewSlot()));
+ }
+}
- QPointF coords((size()/2).width(), (size()/3).height());
- mSortMenu->exec(coords);
+// -------------------------------------------------------------------------------------------------
+// objectReadySlot
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListView::objectReadySlot(QObject *object, const QString &name)
+{
+ if (name.compare(DOCML_NAME_SORT_BY_DATE) == 0)
+ {
+ HbAction *action = qobject_cast<HbAction*>(object);
+ if (action)
+ {
+ connect(action, SIGNAL(triggered()), this, SLOT(startSorting()));
+ mSortingRoles[action] = VideoCollectionCommon::KeyDateTime;
+ }
+ }
+ else if (name.compare(DOCML_NAME_SORT_BY_NAME) == 0)
+ {
+ HbAction *action = qobject_cast<HbAction*>(object);
+ if (action)
+ {
+ connect(action, SIGNAL(triggered()), this, SLOT(startSorting()));
+ mSortingRoles[action] = Qt::DisplayRole;
+ }
+ }
+ else if (name.compare(DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS) == 0)
+ {
+ HbAction *action = qobject_cast<HbAction*>(object);
+ if (action)
+ {
+ // TODO: implement
+ connect(action, SIGNAL(triggered()), this, SLOT(debugNotImplementedYet()));
+ mSortingRoles[action] = 0;
+ }
+ }
+ else if (name.compare(DOCML_NAME_SORT_BY_TOTAL_LENGTH) == 0)
+ {
+ HbAction *action = qobject_cast<HbAction*>(object);
+ if (action)
+ {
+ // TODO: implement
+ connect(action, SIGNAL(triggered()), this, SLOT(debugNotImplementedYet()));
+ mSortingRoles[action] = 0;
+ }
+ }
+ else if (name.compare(DOCML_NAME_SORT_BY_SIZE) == 0)
+ {
+ HbAction *action = qobject_cast<HbAction*>(object);
+ if (action)
+ {
+ connect(action, SIGNAL(triggered()), this, SLOT(startSorting()));
+ mSortingRoles[action] = VideoCollectionCommon::KeySizeValue;
+ }
+ }
+ else if (name.compare(DOCML_NAME_ADD_TO_COLLECTION) == 0)
+ {
+ HbAction *action = qobject_cast<HbAction*>(object);
+ if (action)
+ {
+ connect(action, SIGNAL(triggered()), this, SLOT(addVideosToCollectionSlot()));
+ }
+ }
+ else if (name.compare(DOCML_NAME_CREATE_COLLECTION) == 0)
+ {
+ HbAction *action = qobject_cast<HbAction*>(object);
+ if (action)
+ {
+ connect(action, SIGNAL(triggered()), this, SLOT(createCollectionSlot()));
+ }
+ }
+ else if (name.compare(DOCML_NAME_DELETE_MULTIPLE) == 0)
+ {
+ HbAction *action = qobject_cast<HbAction*>(object);
+ if (action)
+ {
+ connect(action, SIGNAL(triggered()), this, SLOT(deleteItemsSlot()));
+ }
+ }
}
// Just for testing, remove this
--- a/videocollection/videocollectionview/src/videolistwidget.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionview/src/videolistwidget.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -17,6 +17,7 @@
#include "videolistwidget.h"
+#include <qcoreapplication.h>
#include <qtimer.h>
#include <hbscrollbar.h>
#include <xqserviceutil.h>
@@ -26,8 +27,13 @@
#include <hbmainwindow.h>
#include <hblistviewitem.h>
#include <hbmessagebox.h>
+#include <hbstyleloader.h>
#include <vcxmyvideosdefs.h>
+#include "videocollectionuiloader.h"
+#include "videocollectionviewutils.h"
+#include "videocollectionuiloader.h"
+#include "videolistselectiondialog.h"
#include "videoservices.h"
#include "videothumbnaildata.h"
#include "videosortfilterproxymodel.h"
@@ -41,18 +47,20 @@
// Constructor
// ---------------------------------------------------------------------------
//
-VideoListWidget::VideoListWidget(HbView *parent) :
+VideoListWidget::VideoListWidget(VideoCollectionUiLoader *uiLoader, HbView *parent) :
HbListView(parent),
mModel(0),
mVideoServices(0),
-mCurrentLevel(VideoListWidget::ELevelVideos),
+mCurrentLevel(VideoCollectionCommon::ELevelInvalid),
mSignalsConnected(false),
mDetailsReady(false),
mIsService(false),
-mSecSkAction(0),
+mNavKeyBackAction(0),
+mNavKeyQuitAction(0),
mContextMenu(0),
-mLastOpenItemId(TMPXItemId::InvalidId()),
-mScrollPositionTimer(0)
+mSelectionMode(HbAbstractItemView::NoSelection),
+mScrollPositionTimer(0),
+mUiLoader(uiLoader)
{
// NOP
}
@@ -63,14 +71,17 @@
//
VideoListWidget::~VideoListWidget()
{
+ HbStyleLoader::unregisterFilePath( ":/style/hblistviewitem.css" );
delete mScrollPositionTimer;
mScrollPositionTimer = 0;
mContextMenuActions.clear();
disconnect();
delete mContextMenu;
mContextMenu = 0;
- delete mSecSkAction;
- mSecSkAction = 0;
+ delete mNavKeyBackAction;
+ mNavKeyBackAction = 0;
+ delete mNavKeyQuitAction;
+ mNavKeyQuitAction = 0;
}
// ---------------------------------------------------------------------------
@@ -88,36 +99,15 @@
mIsService = true;
}
- // init widget
- HbListViewItem *prototype = listItemPrototype();
- if(!prototype)
- {
- return -1;
- }
- //Use image layout in prototype
- prototype->setGraphicsSize(HbListViewItem::Thumbnail);
- setItemRecycling(true);
- setClampingStyle(HbScrollArea::BounceBackClamping);
- setScrollingStyle(HbScrollArea::PanOrFlick);
- setFrictionEnabled(true);
- setUniformItemSizes(true);
- setSelectionMode(HbAbstractItemView::NoSelection);
-
- //Use scrollbar
- HbScrollBar *scrollBar = verticalScrollBar();
- if (!scrollBar)
- {
- return -1;
- }
- scrollBar->setInteractive(true);
+ // init list view
+ VideoCollectionViewUtils::initListView(this);
- mSecSkAction = new HbAction( Hb::BackAction );
+ // Navigation keys.
+ mNavKeyBackAction = new HbAction(Hb::BackNaviAction);
+
+ mNavKeyQuitAction = new HbAction(Hb::QuitNaviAction);
- if(!mSecSkAction)
- {
- return -1;
- }
- // initial setup for widget is hidden
+ // initial setup for widget is hidden
setVisible(false);
mScrollPositionTimer = new QTimer();
@@ -128,6 +118,15 @@
connect(this, SIGNAL(fileUri(const QString&)), mVideoServices, SLOT(itemSelected(const QString&)));
}
+ bool ret = HbStyleLoader::registerFilePath( ":/style/hblistviewitem.css" );
+
+ if(!ret)
+ {
+ return -1;
+ }
+
+ setModel(mModel);
+
return 0;
}
@@ -144,30 +143,49 @@
// activate
// ---------------------------------------------------------------------------
//
-int VideoListWidget::activate(VideoListWidget::TVideoListLevel level)
+int VideoListWidget::activate(VideoCollectionCommon::TCollectionLevels level)
{
- mLastOpenItemId = TMPXItemId::InvalidId();
if(!mModel)
{
return -1;
}
mCurrentLevel = level;
- setModel(mModel);
setVisible(true);
- if(mContextMenu)
- {
- mContextMenu->setEnabled(true);
- }
-
if ( connectSignals() < 0)
{
return -1;
}
+ HbView *currentView = hbInstance->allMainWindows().value(0)->currentView();
+
+ // Set navigation key only when widget is not in selection mode.
+ if(currentView && mSelectionMode == HbAbstractItemView::NoSelection)
+ {
+ if(level != VideoCollectionCommon::ELevelDefaultColl &&
+ level != VideoCollectionCommon::ELevelAlbum)
+ {
+ if(mNavKeyQuitAction)
+ {
+ currentView->setNavigationAction(mNavKeyQuitAction);
+ }
+ }
+ else if(mNavKeyBackAction)
+ {
+ currentView->setNavigationAction(mNavKeyBackAction);
+ }
+ }
+ // 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);
+ thumbnailData.startBackgroundFetching(mModel, 0);
return 0;
}
@@ -182,7 +200,9 @@
{
mContextMenu->hide();
}
+ setVisible(false);
disConnectSignals();
+
// Free allocated memory for list thumbnails and disable background fetching.
VideoThumbnailData &thumbnailData = VideoThumbnailData::instance();
thumbnailData.enableBackgroundFetching(false);
@@ -190,19 +210,30 @@
}
// ---------------------------------------------------------------------------
+// getLevel
+// ---------------------------------------------------------------------------
+//
+VideoCollectionCommon::TCollectionLevels VideoListWidget::getLevel()
+{
+ return mCurrentLevel;
+}
+
+// ---------------------------------------------------------------------------
// connectSignals
// ---------------------------------------------------------------------------
//
int VideoListWidget::connectSignals()
{
-
if (!mSignalsConnected)
{
- if(!connect(this, SIGNAL(scrollingEnded()), this, SLOT(scrollingEndedSlot())) ||
+ if(!connect(this, SIGNAL(scrollingStarted()), this, SLOT(scrollingStartedSlot())) ||
+ !connect(this, SIGNAL(scrollingEnded()), this, SLOT(scrollingEndedSlot())) ||
!connect(this, SIGNAL(scrollPositionChanged(const QPointF &)),
this, SLOT(scrollPositionChangedSlot(const QPointF &))) ||
- !connect(mScrollPositionTimer, SIGNAL(timeout()), this, SLOT(scrollingEndedSlot()))
- )
+ !connect(mScrollPositionTimer, SIGNAL(timeout()), this, SLOT(scrollPositionTimerSlot())) ||
+ !connect(mNavKeyBackAction, SIGNAL(triggered()), this, SLOT(back())) ||
+ !connect(mNavKeyQuitAction, SIGNAL(triggered()), qApp, SLOT(quit())))
+
{
return -1;
}
@@ -217,10 +248,14 @@
//
void VideoListWidget::disConnectSignals()
{
- disconnect(this, SIGNAL(scrollingEnded()), this, SLOT(scrollingEndedSlot()));
+ disconnect(this, SIGNAL(scrollingStarted()), this, SLOT(scrollingStartedSlot()));
+ disconnect(this, SIGNAL(scrollingEnded()), this, SLOT(scrollingEndedSlot()));
disconnect(this, SIGNAL(scrollPositionChanged(const QPointF&)),
this, SLOT(scrollPositionChangedSlot(const QPointF&)));
- disconnect(mScrollPositionTimer, SIGNAL(timeout()), this, SLOT(scrollingEndedSlot()));
+ disconnect(mScrollPositionTimer, SIGNAL(timeout()), this, SLOT(scrollPositionTimerSlot()));
+ disconnect(mNavKeyBackAction, SIGNAL(triggered()), this, SLOT(back()));
+ disconnect(mNavKeyQuitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
+
mSignalsConnected = false;
}
@@ -250,16 +285,13 @@
if (variant.isValid())
{
- QString text = tr("Do you want to delete \"%1\"?").arg(
+ QString text = tr("Do you want to delete \"%1\"?").arg( //TODO: localisation
variant.toStringList().first());
if(HbMessageBox::question(text))
{
QModelIndexList list;
list.append(index);
mModel->deleteItems(list);
-
- // exec filtering
- mModel->invalidate();
}
}
}
@@ -278,21 +310,18 @@
if (mIsService)
{
- mContextMenuActions[EActionPlay] = mContextMenu->addAction(tr("Play"), this, SLOT(playItemSlot()));
- mContextMenuActions[EActionDetails] = mContextMenu->addAction(tr("Details"), this, SLOT(openDetailsSlot()));
-
+ mContextMenuActions[EActionPlay] = mContextMenu->addAction(hbTrId("txt_videos_menu_play"), this, SLOT(playItemSlot())); //TODO: localisation
+ mContextMenuActions[EActionDetails] = mContextMenu->addAction(hbTrId("txt_common_menu_details"), this, SLOT(openDetailsSlot()));
}
else
{
- mContextMenuActions[EACtionAddToCollection] = mContextMenu->addAction(tr("Add to collection"), this, SLOT(addToCollectionSlot()));
- mContextMenuActions[EActionAddVideos] = mContextMenu->addAction(tr("Add videos..."), this, SLOT(addItemSlot()));
- mContextMenuActions[EACtionRemoveFromCollection] = mContextMenu->addAction(tr("Remove from collection"), this, SLOT(debugNotImplementedYet()));
- mContextMenuActions[EActionShare] = mContextMenu->addAction(tr("Share"), this, SLOT(shareItemSlot()));
- mContextMenuActions[EActionRename] = mContextMenu->addAction(tr("Rename"), this, SLOT(renameSlot()));
- mContextMenuActions[EActionSetThumb] = mContextMenu->addAction(tr("Set thumbnail..."), this, SLOT(debugNotImplementedYet()));
- mContextMenuActions[EACtionRemoveCollection] = mContextMenu->addAction(tr("Remove collection"), this, SLOT(debugNotImplementedYet()));
- mContextMenuActions[EActionDelete] = mContextMenu->addAction(tr("Delete"), this, SLOT(deleteItemSlot()));
- mContextMenuActions[EActionDetails] = mContextMenu->addAction(tr("Details"), this, SLOT(openDetailsSlot()));
+ mContextMenuActions[EACtionAddToCollection] = mContextMenu->addAction(hbTrId("txt_videos_menu_add_to_collection"), this, SLOT(addToCollectionSlot()));
+ mContextMenuActions[EACtionRemoveFromCollection] = mContextMenu->addAction(hbTrId("txt_videos_menu_remove_collection"), this, SLOT(debugNotImplementedYet()));
+ mContextMenuActions[EActionShare] = mContextMenu->addAction(hbTrId("txt_videos_menu_share"), this, SLOT(shareItemSlot()));
+ mContextMenuActions[EActionRename] = mContextMenu->addAction(hbTrId("txt_common_menu_rename_item"), this, SLOT(renameSlot()));
+ mContextMenuActions[EACtionRemoveCollection] = mContextMenu->addAction(hbTrId("txt_videos_menu_remove_collection"), this, SLOT(removeCollectionSlot()));
+ mContextMenuActions[EActionDelete] = mContextMenu->addAction(hbTrId("txt_common_menu_delete"), this, SLOT(deleteItemSlot()));
+ mContextMenuActions[EActionDetails] = mContextMenu->addAction(hbTrId("txt_common_menu_details"), this, SLOT(openDetailsSlot()));
}
}
@@ -300,7 +329,7 @@
// setContextMenu
// -------------------------------------------------------------------------------------------------
//
-void VideoListWidget::setContextMenu(bool isDefaultCollection)
+void VideoListWidget::setContextMenu()
{
if(!mContextMenu)
{
@@ -327,10 +356,8 @@
HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
- TVideoListType type = getType();
-
- if(type == EAllVideos ||
- type == EDefaultColItems)
+ if(mCurrentLevel == VideoCollectionCommon::ELevelVideos ||
+ mCurrentLevel == VideoCollectionCommon::ELevelDefaultColl)
{
if (!mIsService)
{
@@ -344,17 +371,15 @@
}
mContextMenuActions[EActionDetails]->setVisible(true);
}
- else if(type == ECollections)
+ else if(mCurrentLevel == VideoCollectionCommon::ELevelCategory)
{
if(!mIsService)
{
- mContextMenuActions[EActionAddVideos]->setVisible(true);
mContextMenuActions[EActionRename]->setVisible(true);
- mContextMenuActions[EActionSetThumb]->setVisible(true);
mContextMenuActions[EACtionRemoveCollection]->setVisible(true);
}
}
- else if(type == EUserColItems)
+ else if(mCurrentLevel == VideoCollectionCommon::ELevelAlbum)
{
if (!mIsService)
{
@@ -370,37 +395,6 @@
}
}
-// -------------------------------------------------------------------------------------------------
-// getLevel
-// -------------------------------------------------------------------------------------------------
-//
-VideoListWidget::TVideoListType VideoListWidget::getType()
-{
- TVideoListType type(EUnknown);
- HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
-
- if(mCurrentLevel == ELevelVideos)
- {
- type = EAllVideos;
- }
- else if(mCurrentLevel == ELevelCategory)
- {
- if(mLastOpenItemId == TMPXItemId::InvalidId())
- {
- type = ECollections;
- }
- else if(mLastOpenItemId.iId2 == KVcxMvcCategoryIdDownloads ||
- mLastOpenItemId.iId2 == KVcxMvcCategoryIdCaptured)
- {
- type = EDefaultColItems;
- }
- else
- {
- type = EUserColItems;
- }
- }
- return type;
-}
// ---------------------------------------------------------------------------
// getModel
@@ -418,34 +412,32 @@
//
void VideoListWidget::emitActivated (const QModelIndex &modelIndex)
{
- if(selectionMode() == HbAbstractItemView::MultiSelection)
+ if(mSelectionMode != HbAbstractItemView::NoSelection)
{
- // do nothing in case selection mode
- return;
+ // no custom functionality defined
+ emit activated(modelIndex);
+ return;
}
if (!mModel || !modelIndex.isValid())
{
return;
}
- if (mCurrentLevel == ELevelCategory)
+
+ if (mCurrentLevel == VideoCollectionCommon::ELevelCategory)
{
- if (getType() == ECollections)
+ QVariant variant = mModel->data(modelIndex, Qt::DisplayRole);
+ if (variant.isValid())
{
- QVariant variant = mModel->data(modelIndex, Qt::DisplayRole);
- if (variant.isValid())
- {
- HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
- mainWnd->addSoftKeyAction( Hb::SecondarySoftKey, mSecSkAction );
-
- connect(mainWnd->softKeyAction(Hb::SecondarySoftKey),
- SIGNAL(triggered()), this, SLOT(back()));
- mLastOpenItemId = mModel->getMediaIdAtIndex(modelIndex);
- emit(collectionOpened(true, variant.toStringList().first()));
- }
+ // signal view that item has been activated
+ emit(collectionOpened(true,
+ variant.toStringList().first(),
+ modelIndex));
+
+ return;
}
}
- if(mIsService && (mCurrentLevel == ELevelCategory) && (getType() != ECollections))
+ if(mIsService && (mCurrentLevel != VideoCollectionCommon::ELevelCategory))
{
QVariant variant = mModel->data(modelIndex, VideoCollectionCommon::KeyFilePath);
if ( variant.isValid() )
@@ -456,11 +448,29 @@
}
else
{
- mModel->openItem(modelIndex);
+ mModel->openItem(mModel->getMediaIdAtIndex(modelIndex));
}
}
// ---------------------------------------------------------------------------
+// setSelectionMode
+// called by the fw when user long presses some item
+// ---------------------------------------------------------------------------
+//
+//
+void VideoListWidget::setSelectionMode(int mode)
+{
+ HbAbstractItemView::SelectionMode selMode = HbAbstractItemView::NoSelection;
+ if(mode >= HbAbstractItemView::NoSelection && mode <= HbAbstractItemView::ContiguousSelection)
+ {
+ selMode = HbAbstractItemView::SelectionMode(mode);
+ }
+
+ HbListView::setSelectionMode(selMode);
+ mSelectionMode = mode;
+}
+
+// ---------------------------------------------------------------------------
// longPressGesture
// called by the fw when user long presses some item
// ---------------------------------------------------------------------------
@@ -473,7 +483,7 @@
emit command(MpxHbVideoCommon::LoadVideoDetailsView);
mDetailsReady = true;
}
- if(selectionMode() == HbAbstractItemView::MultiSelection)
+ if(mSelectionMode != HbAbstractItemView::NoSelection)
{
// do not activate context menu during selection mode
return;
@@ -481,29 +491,22 @@
QModelIndex index = currentIndex();
if(mModel && index.isValid())
- {
-
+ {
TMPXItemId mpxId = mModel->getMediaIdAtIndex(index);
-
- bool defaultCollection(true);
- if ( ((mpxId.iId2 == 1) && //Category
- ((mpxId.iId1 != KVcxMvcCategoryIdDownloads) &&
- (mpxId.iId1 != KVcxMvcCategoryIdCaptured))) ||
- (mCurrentLevel != ELevelCategory))
+ // Only videos and user created albums have context menu.
+ if((mpxId.iId2 == KVcxMvcMediaTypeVideo) ||
+ (!mIsService && mpxId.iId2 == KVcxMvcMediaTypeAlbum ))
{
- defaultCollection = false;
- }
-
-
- setContextMenu(defaultCollection);
- // if menu not yet exists, it has been created
- // setup might fails causing menu to be removed
- if(mContextMenu)
- {
- mContextMenu->exec(point);
- }
+ setContextMenu();
+ // if menu not yet exists, it has been created
+ // setup might fail causing menu to be removed
+ if(mContextMenu)
+ {
+ mContextMenu->exec(point);
+ }
+ }
}
- HbListView::longPressGesture(point);
+ HbListView::longPressGesture(point);
}
// ---------------------------------------------------------------------------
@@ -512,7 +515,7 @@
//
void VideoListWidget::playItemSlot()
{
- mModel->openItem(currentIndex());
+ mModel->openItem(mModel->getMediaIdAtIndex(currentIndex()));
}
// ---------------------------------------------------------------------------
@@ -526,6 +529,7 @@
emit command(MpxHbVideoCommon::ActivateVideoDetailsView);
}
}
+
// ---------------------------------------------------------------------------
// renameSlot
// ---------------------------------------------------------------------------
@@ -535,25 +539,54 @@
debugNotImplementedYet();
}
-
-// ---------------------------------------------------------------------------
-// addItemSlot
-// ---------------------------------------------------------------------------
-//
-void VideoListWidget::addItemSlot()
-{
- debugNotImplementedYet();
-}
-
// ---------------------------------------------------------------------------
// addToCollectionSlot
// ---------------------------------------------------------------------------
//
void VideoListWidget::addToCollectionSlot()
{
- debugNotImplementedYet();
+ VideoListSelectionDialog *dialog =
+ mUiLoader->findWidget<VideoListSelectionDialog>(
+ DOCML_NAME_DIALOG);
+ if (!dialog || !mModel)
+ {
+ return;
+ }
+ TMPXItemId itemId = mModel->getMediaIdAtIndex(currentIndex());
+ if(itemId != TMPXItemId::InvalidId())
+ {
+ dialog->setupContent(VideoListSelectionDialog::ESelectCollection, itemId);
+ dialog->exec();
+ }
}
+// ---------------------------------------------------------------------------
+// removeCollectionSlot
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::removeCollectionSlot()
+{
+ if(!mModel)
+ {
+ return;
+ }
+
+ QVariant variant;
+ QModelIndex index = currentIndex();
+ variant = mModel->data(index, Qt::DisplayRole);
+
+ if (variant.isValid())
+ {
+ QString text = tr("Do you want to remove collection \"%1\"?").arg( //TODO: localisation
+ variant.toStringList().first());
+ if(HbMessageBox::question(text))
+ {
+ QModelIndexList list;
+ list.append(index);
+ mModel->removeAlbums(list);
+ }
+ }
+}
// ---------------------------------------------------------------------------
// playAllSlot
@@ -570,38 +603,31 @@
//
void VideoListWidget::back()
{
- mLastOpenItemId = TMPXItemId::InvalidId();
if(mModel)
{
- HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
-
- disconnect(mainWnd->softKeyAction(Hb::SecondarySoftKey),
- SIGNAL(triggered()), this, SLOT(back()));
-
- mainWnd->removeSoftKeyAction(Hb::SecondarySoftKey, mSecSkAction);
-
- emit(collectionOpened(false, QString("")));
-
- mModel->back();
+ emit collectionOpened(false, QString(), QModelIndex());
}
}
// ---------------------------------------------------------------------------
+// scrollingStartedSlot
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::scrollingStartedSlot()
+{
+ VideoThumbnailData::instance().enableThumbnailCreation(false);
+}
+
+// ---------------------------------------------------------------------------
// scrollingEndedSlot
// ---------------------------------------------------------------------------
//
void VideoListWidget::scrollingEndedSlot()
{
if(mScrollPositionTimer)
- mScrollPositionTimer->stop();
-
- const QList<HbAbstractViewItem *> itemsVisible = visibleItems();
-
- if(itemsVisible.count() > 0)
- {
- int row = itemsVisible.value(0)->modelIndex().row();
- VideoThumbnailData::instance().startBackgroundFetching(row);
- }
+ mScrollPositionTimer->stop();
+ VideoThumbnailData::instance().enableThumbnailCreation(true);
+ fetchThumbnailsForVisibleItems();
}
// ---------------------------------------------------------------------------
@@ -616,6 +642,30 @@
}
// ---------------------------------------------------------------------------
+// scrollPositionTimerSlot
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::scrollPositionTimerSlot()
+{
+ fetchThumbnailsForVisibleItems();
+}
+
+// ---------------------------------------------------------------------------
+// fetchThumbnailsForVisibleItems
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::fetchThumbnailsForVisibleItems()
+{
+ const QList<HbAbstractViewItem *> itemsVisible = visibleItems();
+
+ if(itemsVisible.count() > 0)
+ {
+ int row = itemsVisible.value(0)->modelIndex().row();
+ VideoThumbnailData::instance().startBackgroundFetching(mModel, row);
+ }
+}
+
+// ---------------------------------------------------------------------------
// debugNotImplementedYet
// ---------------------------------------------------------------------------
//
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testcollectionview/inc/testcollectionview.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,80 @@
+/**
+* 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 VideoSortFilterProxyModel
+*
+*/
+
+#ifndef __TESTCOLLECTIONVIEW_H__
+#define __TESTCOLLECTIONVIEW_H__
+
+
+// INCLUDES
+#include <QtTest/QtTest>
+
+class HbMainWindow;
+class VideoCollectionViewPlugin;
+
+class TestCollectionView : public QObject
+{
+ Q_OBJECT
+
+ /**
+ * call to init a testcase
+ *
+ */
+ void init();
+
+ /**
+ * call to cleanup a testcase
+ *
+ */
+ void cleanup();
+
+ // test functions for the test framework
+private slots:
+
+ /**
+ * called before anything else when test starts
+ */
+ void initTestCase();
+
+ /**
+ * will be called after testing ends
+ *
+ */
+ void cleanupTestCase();
+
+ void testCreateView();
+ void testActivateView();
+ void testDeactivateView();
+ void testDestroyView();
+ void testGetView();
+ void testBack();
+ void testOrientationChange();
+
+signals:
+
+ void commandSignal(int);
+
+private:
+ VideoCollectionViewPlugin* mTestView;
+};
+
+
+#endif // __TESTCOLLECTIONVIEW_H__
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testcollectionview/src/testcollectionview.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,310 @@
+/**
+* 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 VideoSortFilterProxyModel
+*
+*/
+#include <hbaction.h>
+#include <qpointer.h>
+#include <hbapplication.h>
+#include <hbinstance.h>
+#include <hblabel.h>
+#include "videocollectionuiloader.h"
+#include "testcollectionview.h"
+#include "videocollectioncommon.h"
+#include "videolistview.h"
+
+#include "videolistviewdata.h"
+#include "videocollectionuiloaderdata.h"
+
+#define private public
+#include "videocollectionviewplugin.h"
+#undef private
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ HbApplication app(argc, argv);
+ HbMainWindow window;
+
+ TestCollectionView 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\\testcollectionview.txt";
+ res = QTest::qExec(&tv, 3, pass);
+ }
+
+ return res;
+}
+
+// ---------------------------------------------------------------------------
+// initTestCase
+// ---------------------------------------------------------------------------
+//
+void TestCollectionView::initTestCase()
+{
+ // nop
+}
+
+// ---------------------------------------------------------------------------
+// cleanupTestCase
+// ---------------------------------------------------------------------------
+//
+void TestCollectionView::cleanupTestCase()
+{
+ // nop
+}
+
+// ---------------------------------------------------------------------------
+// init
+// ---------------------------------------------------------------------------
+//
+void TestCollectionView::init()
+{
+ VideoCollectionUiLoaderData::reset();
+ VideoListViewData::reset();
+
+ mTestView = new VideoCollectionViewPlugin();
+ mTestView->createView();
+
+ HbMainWindow *window = hbInstance->allMainWindows().value(0);
+ if (window)
+ {
+ window->addView(mTestView->getView());
+ }
+}
+
+// ---------------------------------------------------------------------------
+// cleanup
+// ---------------------------------------------------------------------------
+//
+void TestCollectionView::cleanup()
+{
+ HbMainWindow *window = hbInstance->allMainWindows().value(0);
+ if (window)
+ {
+ QList<HbView*> views = window->views();
+ int count = views.count();
+ for (int i = 0; i < count; i++)
+ {
+ window->removeView(views.at(i));
+ }
+ }
+
+ delete mTestView;
+ mTestView = 0;
+}
+
+// ---------------------------------------------------------------------------
+// Slot: test create view
+// ---------------------------------------------------------------------------
+//
+void TestCollectionView::testCreateView()
+{
+ VideoCollectionUiLoaderData::reset();
+ VideoListViewData::reset();
+
+ VideoCollectionUiLoaderData::mFindFailure = true;
+
+ mTestView = new VideoCollectionViewPlugin();
+
+ QVERIFY( mTestView->mView == NULL );
+
+ mTestView->createView();
+
+ QVERIFY( mTestView->mView == NULL );
+
+ delete mTestView;
+
+ VideoCollectionUiLoaderData::mFindFailure = false;
+
+ mTestView = new VideoCollectionViewPlugin();
+
+ QVERIFY( mTestView->mView == NULL );
+
+ mTestView->createView();
+
+ QVERIFY( mTestView->mView != NULL );
+ QCOMPARE( VideoListViewData::mInitializeViewCount, 1 );
+ QVERIFY( mTestView->mActivated == false );
+
+ connect( this, SIGNAL(commandSignal(int)), mTestView->mView, SIGNAL(command(int)));
+ QSignalSpy commandSpy(mTestView, SIGNAL(command(int)));
+ emit commandSignal(5);
+ QCOMPARE( commandSpy.count(), 1 );
+ QList<QVariant> arguments = commandSpy.takeFirst();
+ QCOMPARE( arguments.at(0).toInt(), 5 );
+ disconnect();
+
+ VideoListView* current = mTestView->mView;
+
+ mTestView->createView();
+
+ QCOMPARE( mTestView->mView, current );
+
+ HbMainWindow *window = hbInstance->allMainWindows().value(0);
+ if (window)
+ {
+ window->addView(current);
+ }
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: test activate view
+// ---------------------------------------------------------------------------
+//
+void TestCollectionView::testActivateView()
+{
+ init();
+
+ mTestView->activateView();
+ QVERIFY( mTestView->mActivated == true );
+ QCOMPARE( VideoListViewData::mActivateViewCount, 1 );
+
+ mTestView->activateView();
+ HbAction *tmpAction = 0;
+ HbMainWindow *window = hbInstance->allMainWindows().value(0);
+ if (window)
+ {
+ tmpAction = window->softKeyAction(Hb::SecondarySoftKey);
+ }
+ QCOMPARE( VideoListViewData::mActivateViewCount, 1 );
+ QVERIFY(tmpAction != 0);
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: test deactivate view
+// ---------------------------------------------------------------------------
+//
+void TestCollectionView::testDeactivateView()
+{
+ init();
+
+ mTestView->deactivateView();
+ QCOMPARE( VideoListViewData::mDeactivateViewCount, 0 );
+ QVERIFY( mTestView->mActivated == false );
+
+ mTestView->activateView();
+
+ mTestView->deactivateView();
+ QCOMPARE( VideoListViewData::mDeactivateViewCount, 1 );
+
+ QVERIFY( mTestView->mActivated == false );
+
+ mTestView->deactivateView();
+ QCOMPARE( VideoListViewData::mDeactivateViewCount, 1 );
+ QVERIFY( mTestView->mActivated == false );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: test destroy view
+// ---------------------------------------------------------------------------
+//
+void TestCollectionView::testDestroyView()
+{
+ init();
+
+ mTestView->activateView();
+
+ mTestView->destroyView();
+
+ QCOMPARE( VideoListViewData::mDeactivateViewCount, 1 );
+ QVERIFY( mTestView->mActivated == false );
+ QVERIFY( mTestView->mView == 0 );
+
+ mTestView->createView();
+ QVERIFY( mTestView->mView != 0 );
+ mTestView->destroyView();
+ QCOMPARE( VideoListViewData::mDeactivateViewCount, 1 );
+ QVERIFY( mTestView->mActivated == false );
+ QVERIFY( mTestView->mView == 0 );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: test get view
+// ---------------------------------------------------------------------------
+//
+void TestCollectionView::testGetView()
+{
+ mTestView = new VideoCollectionViewPlugin();
+
+ QVERIFY( mTestView->getView() == 0 );
+ mTestView->createView();
+ QVERIFY( mTestView->getView() == mTestView->mView );
+ mTestView->activateView();
+ QVERIFY( mTestView->getView() == mTestView->mView );
+ mTestView->deactivateView();
+ QVERIFY( mTestView->getView() == mTestView->mView );
+ mTestView->destroyView();
+ QVERIFY( mTestView->getView() == 0 );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: test get view
+// ---------------------------------------------------------------------------
+//
+void TestCollectionView::testBack()
+{
+ init();
+
+ mTestView->back();
+ QCOMPARE( VideoListViewData::mBackCount, 0 );
+ mTestView->activateView();
+ mTestView->back();
+ QCOMPARE( VideoListViewData::mBackCount, 1 );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: test orientation change
+// ---------------------------------------------------------------------------
+//
+void TestCollectionView::testOrientationChange()
+{
+ // there's nothing to be tested yet for this.
+ // implementation is requires due inherited mpxviewplugin
+ init();
+ QVERIFY(mTestView);
+ mTestView->orientationChange(Qt::Horizontal);
+ mTestView->orientationChange(Qt::Vertical);
+
+ cleanup();
+}
+
+
+
+// End of file
+
--- a/videocollection/videocollectionview/tsrc/testcollectionview/testcollectionview.pro Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionview/tsrc/testcollectionview/testcollectionview.pro Thu Apr 01 23:22:15 2010 +0300
@@ -15,19 +15,20 @@
#
TEMPLATE = app
+
TARGET =
+
DEPENDPATH += . \
inc \
src
+
INCLUDEPATH += . \
- /epoc32/include/domain \
- /epoc32/include/domain/middleware \
- /epoc32/include/domain/applications \
- /epoc32/include/osextensions \
- /epoc32/include/middleware \
- /epoc32/include/osextensions/stdapis/stlport \
- stub/inc \
+ inc \
+ ../../../tsrc/stubs/inc \
+ \ # keep these at bottom so that stubbed headers are taken first
../../../inc \
+ ../../../videocollectionview/inc \
+ ../../../videocollectionwrapper/inc
CONFIG += qtestlib \
Hb \
@@ -38,18 +39,35 @@
-lbitgdi.dll \
-lgdi.dll \
-lxqplugins.dll \
- -lmpxviewframeworkqt.dll
+ -lmpxviewframeworkqt.dll \
+ -lvideocollectionwrapper.dll
-# Input
-HEADERS += inc/testcollectionview.h \
- stub/inc/videolistview.h \
- stub/inc/videocollectionuiloader.h \
- ../../inc/videocollectionviewplugin.h \
-
-SOURCES += src/testcollectionview.cpp \
- stub/src/videolistview.cpp \
- stub/src/videocollectionuiloader.cpp \
- ../../src/videocollectionviewplugin.cpp
+HEADERS += inc/testcollectionview.h \
+ \ # headers needed in test
+ ../../inc/videocollectionviewplugin.h \
+ \ # headers needed in stubs
+ ../../../videocollectionview/inc/videocollectionuiloader.h \
+ ../../../videocollectionview/inc/videocollectionviewutils.h \
+ ../../../videocollectionview/inc/videolistview.h \
+ ../../../videocollectionview/inc/videolistwidget.h \
+ ../../../videocollectionview/inc/videolistselectiondialog.h \
+ ../../../videocollectionview/inc/videohintwidget.h
+
+SOURCES += src/testcollectionview.cpp \
+ \ # sources needed in test
+ ../../src/videocollectionviewplugin.cpp \
+ \ # sources needed in stubs
+ ../../../tsrc/stubs/src/hbmainwindow.cpp \
+ ../../../tsrc/stubs/src/hblistview.cpp \
+ ../../../tsrc/stubs/src/hbwidget.cpp \
+ ../../../tsrc/stubs/src/hbscrollbar.cpp \
+ ../../../tsrc/stubs/src/hbdialog.cpp \
+ ../../../tsrc/stubs/src/hbaction.cpp \
+ ../../../tsrc/stubs/src/videocollectionuiloader.cpp \
+ ../../../tsrc/stubs/src/videocollectionviewutils.cpp \
+ ../../../tsrc/stubs/src/videolistview.cpp \
+ ../../../tsrc/stubs/src/videolistwidget.cpp \
+ ../../../tsrc/stubs/src/videolistselectiondialog.cpp \
+ ../../../tsrc/stubs/src/videohintwidget.cpp
RESOURCES += ../../data/videocollectionview.qrc
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testhintwidget/inc/testhintwidget.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,77 @@
+/**
+* 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 VideoSortFilterProxyModel
+*
+*/
+
+#ifndef __TESTHINTWIDGET_H__
+#define __TESTHINTWIDGET_H__
+
+
+// INCLUDES
+#include <QtTest/QtTest>
+
+class VideoHintWidget;
+class VideoCollectionUiLoader;
+
+class TestHintWidget : public QObject
+{
+ Q_OBJECT
+
+public:
+ TestHintWidget();
+ ~TestHintWidget();
+
+ void init(bool callInitialize);
+ void cleanup();
+
+ // test functions for the test framework
+private slots:
+
+ void testInitialize();
+ void testSetLevel();
+ void testActivate();
+ void testDeactivate();
+ void testUpdateUiComponents();
+ void testOrientationChangedSlot();
+
+signals:
+
+ /**
+ * test signal
+ */
+ void testSignal();
+
+
+private:
+
+
+ /**
+ * object under test
+ */
+ VideoHintWidget* mTestObject;
+
+ /**
+ * Ui loader
+ */
+ VideoCollectionUiLoader* mUiLoader;
+
+ /** docml object list */
+ QObjectList mObjectList;
+};
+
+
+#endif // __TESTLISTWIDGET_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testhintwidget/src/testhintwidget.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,357 @@
+/**
+* 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 VideoListWidget
+*
+*/
+
+#include <hbicon.h>
+#include <hbmainwindow.h>
+#include <hbinstance.h>
+#include <hblabel.h>
+#include <hbpushbutton.h>
+#include <hbapplication.h>
+
+#include "videocollectionuiloader.h"
+#include "videocollectionviewutils.h"
+#include "videocollectionviewutilsdata.h"
+#include "videocollectionuiloaderdata.h"
+#include "testhintwidget.h"
+
+#define private public
+#include "videohintwidget.h"
+#undef private
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ HbApplication app(argc, argv);
+ HbApplication::setKeypadNavigationEnabled(false);
+ HbMainWindow mainWnd;
+
+ TestHintWidget 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\\testhintwidget.txt";
+ res = QTest::qExec(&tv, 3, pass);
+ }
+
+ return res;
+}
+
+// ---------------------------------------------------------------------------
+// constructor
+// ---------------------------------------------------------------------------
+//
+TestHintWidget::TestHintWidget():
+ mTestObject(0),
+ mUiLoader(0)
+{
+ // nop
+}
+
+// ---------------------------------------------------------------------------
+// destructor
+// ---------------------------------------------------------------------------
+//
+TestHintWidget::~TestHintWidget()
+{
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// init
+// ---------------------------------------------------------------------------
+//
+void TestHintWidget::init(bool callInitialize)
+{
+ mUiLoader = new VideoCollectionUiLoader;
+
+ bool ok(false);
+ bool shouldBeOk(VideoCollectionUiLoaderData::mFindFailure);
+
+ mObjectList = mUiLoader->load(DOCML_VIDEOCOLLECTIONVIEW_FILE, &ok);
+ if(!ok && shouldBeOk)
+ {
+ cleanup();
+ QFAIL("docml loading failed!");
+ }
+
+ mTestObject = mUiLoader->findObject<VideoHintWidget>(DOCML_NAME_VC_VIDEOHINTWIDGET);
+ if(!mTestObject)
+ {
+ mTestObject = new VideoHintWidget(mUiLoader);
+ }
+
+ if (callInitialize)
+ {
+ QVERIFY(mTestObject->initialize() == 0);
+ }
+}
+
+// ---------------------------------------------------------------------------
+// cleanup
+// ---------------------------------------------------------------------------
+//
+void TestHintWidget::cleanup()
+{
+ if (mUiLoader)
+ {
+ VideoHintWidget* temp = mUiLoader->findObject<VideoHintWidget>(DOCML_NAME_VC_VIDEOHINTWIDGET);
+ if (!temp)
+ {
+ // need to delete mTestObject as it is not owned by uiloader.
+ delete mTestObject;
+ mTestObject = 0;
+ }
+ mTestObject = 0;
+
+ delete mUiLoader;
+ mUiLoader = 0;
+ }
+
+ int count = mObjectList.count();
+ for (int i = count - 1; i >= 0; i--)
+ {
+ QObject *object = mObjectList.takeAt(i);
+ delete object;
+ }
+
+ VideoCollectionViewUtilsData::reset();
+ VideoCollectionUiLoaderData::reset();
+}
+
+// ---------------------------------------------------------------------------
+// testInitialize
+// ---------------------------------------------------------------------------
+//
+void TestHintWidget::testInitialize()
+{
+ // getServiceIconStrings fails and returns -1;
+ init(false);
+ VideoCollectionViewUtilsData::mGetServiceIconStringsFails = true;
+ QCOMPARE(mTestObject->initialize(), -1);
+ cleanup();
+
+ // succeed
+ init(false);
+ VideoCollectionViewUtilsData::mGetServiceIconStringsFails = false;
+ VideoCollectionViewUtilsData::mIconString = "test";
+ VideoCollectionViewUtilsData::mPressedString = "test2";
+ QCOMPARE(mTestObject->initialize(), 0);
+ QCOMPARE(mTestObject->mServiceIconString, VideoCollectionViewUtilsData::mIconString);
+ QCOMPARE(mTestObject->mServiceIconPressedString, VideoCollectionViewUtilsData::mPressedString);
+
+ // second call to initialize.
+ VideoCollectionViewUtilsData::mIconString = "test3";
+ VideoCollectionViewUtilsData::mPressedString = "test4";
+ QCOMPARE(mTestObject->initialize(), 0);
+ QCOMPARE(mTestObject->mServiceIconString, VideoCollectionViewUtilsData::mIconString);
+ QCOMPARE(mTestObject->mServiceIconPressedString, VideoCollectionViewUtilsData::mPressedString);
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testSetLevel
+// ---------------------------------------------------------------------------
+//
+void TestHintWidget::testSetLevel()
+{
+ init(true);
+ mTestObject->setVisible(false);
+
+ mTestObject->setLevel(VideoHintWidget::Collection);
+ QCOMPARE(mTestObject->mCurrentLevel, VideoHintWidget::Collection);
+
+ mTestObject->setLevel(VideoHintWidget::AllVideos);
+ QCOMPARE(mTestObject->mCurrentLevel, VideoHintWidget::AllVideos);
+
+ mTestObject->setLevel(VideoHintWidget::AllVideos);
+ QCOMPARE(mTestObject->mCurrentLevel, VideoHintWidget::AllVideos);
+
+ mTestObject->setLevel(VideoHintWidget::Collection);
+ QCOMPARE(mTestObject->mCurrentLevel, VideoHintWidget::Collection);
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testActivate
+// ---------------------------------------------------------------------------
+//
+void TestHintWidget::testActivate()
+{
+ init(true);
+
+ HbLabel *hintLabel = mUiLoader->findWidget<HbLabel>(DOCML_NAME_HINT_LABEL);
+ QVERIFY(hintLabel);
+
+ mTestObject->setVisible(false);
+
+ // mServiceIconString empty.
+ mTestObject->mServiceIconString = QString();
+ mTestObject->activate();
+ QVERIFY(mTestObject->mServiceIcon == 0);
+ QVERIFY(mTestObject->isVisible() == false);
+
+ // mServiceIconPressedString empty.
+ mTestObject->mServiceIconString = "test";
+ mTestObject->mServiceIconPressedString = QString();
+ mTestObject->activate();
+ QVERIFY(mTestObject->mServiceIcon == 0);
+ QVERIFY(mTestObject->isVisible() == false);
+
+ // successful case.
+ mTestObject->mServiceIconPressedString = "test2";
+ hintLabel->setVisible(false);
+
+ mTestObject->activate();
+ QVERIFY(mTestObject->isVisible());
+ QVERIFY(mTestObject->mServiceIcon != 0);
+ QCOMPARE(mTestObject->mServiceIcon->iconName(), mTestObject->mServiceIconString);
+ QCOMPARE(mTestObject->mServiceIcon->iconName(QIcon::Normal, QIcon::On),
+ mTestObject->mServiceIconPressedString);
+ QVERIFY(hintLabel->isVisible()); // checks that updateUiComponents() has been called.
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testDeactivate
+// ---------------------------------------------------------------------------
+//
+void TestHintWidget::testDeactivate()
+{
+ init(true);
+
+ HbPushButton *serviceButton = mUiLoader->findWidget<HbPushButton>(DOCML_NAME_HINT_BUTTON);
+ QVERIFY(serviceButton);
+
+ mTestObject->setVisible(true);
+
+ serviceButton->setIcon(HbIcon(QIcon(QPixmap(QSize(100,100)))));
+ mTestObject->mServiceIcon = 0;
+ mTestObject->mAddVideosIcon = 0;
+ QVERIFY(serviceButton->icon().isNull() == false); // make sure test is valid.
+
+ mTestObject->deactivate();
+ QVERIFY(serviceButton->icon().isNull());
+ QVERIFY(mTestObject->isVisible() == false);
+
+ mTestObject->setVisible(true);
+ mTestObject->mServiceIcon = new HbIcon;
+ mTestObject->mAddVideosIcon = new HbIcon;
+
+ mTestObject->deactivate();
+ QVERIFY(mTestObject->mServiceIcon == 0);
+ QVERIFY(mTestObject->mAddVideosIcon == 0);
+ QVERIFY(mTestObject->isVisible() == false);
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testUpdateUiComponents
+// ---------------------------------------------------------------------------
+//
+void TestHintWidget::testUpdateUiComponents()
+{
+ HbMainWindow *mainWnd = hbInstance->allMainWindows()[0];
+ mainWnd->setOrientation(Qt::Horizontal);
+
+ init(true);
+
+ HbLabel *hintLabel = mUiLoader->findWidget<HbLabel>(DOCML_NAME_HINT_LABEL);
+ QVERIFY(hintLabel);
+ HbPushButton *serviceButton = mUiLoader->findWidget<HbPushButton>(DOCML_NAME_HINT_BUTTON);
+ QVERIFY(serviceButton);
+
+ mTestObject->mServiceIcon = new HbIcon(QIcon(QPixmap(QSize(100,100))));
+ mTestObject->mAddVideosIcon = new HbIcon(QIcon(QPixmap(QSize(50,50))));
+ mTestObject->setVisible(true);
+
+ mainWnd->setOrientation(Qt::Vertical);
+ mTestObject->setLevel(VideoHintWidget::AllVideos);
+ QVERIFY(serviceButton->isVisible() == false);
+ QVERIFY(serviceButton->icon().isNull() == false);
+ QVERIFY(serviceButton->icon().qicon().cacheKey() == mTestObject->mServiceIcon->qicon().cacheKey());
+ QVERIFY(hintLabel->isVisible());
+
+ mainWnd->setOrientation(Qt::Horizontal);
+ mTestObject->setLevel(VideoHintWidget::Collection);
+ QVERIFY(serviceButton->isVisible());
+ QVERIFY(serviceButton->icon().isNull() == false);
+ QVERIFY(serviceButton->icon().qicon().cacheKey() == mTestObject->mAddVideosIcon->qicon().cacheKey());
+ QVERIFY(hintLabel->isVisible() == false);
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testOrientationChangedSlot
+// ---------------------------------------------------------------------------
+//
+void TestHintWidget::testOrientationChangedSlot()
+{
+ // NOTE: This also checks that the signals are connected and
+ // disconnected correctly.
+
+ HbMainWindow *mainWnd = hbInstance->allMainWindows()[0];
+ mainWnd->setOrientation(Qt::Horizontal);
+
+ init(true);
+
+ HbPushButton *serviceButton = mUiLoader->findWidget<HbPushButton>(DOCML_NAME_HINT_BUTTON);
+ QVERIFY(serviceButton);
+
+ mTestObject->mServiceIconString = "dummy";
+ mTestObject->mServiceIconPressedString = "dummy2";
+
+ // test that updateUiComponents is not called when only initialize has been called,
+ // ie that no activate calls have been made yet.
+ mTestObject->setVisible(true);
+ serviceButton->setVisible(true);
+ mainWnd->setOrientation(Qt::Vertical);
+ QVERIFY(serviceButton->isVisible());
+ mTestObject->setVisible(false);
+
+ // tests that updateUiComponents is called when widget is visible.
+ mTestObject->activate();
+ serviceButton->setVisible(false);
+ mainWnd->setOrientation(Qt::Horizontal);
+ QVERIFY(serviceButton->isVisible());
+ mTestObject->deactivate();
+
+ // tests that updateUiComponents is not called when widget is not visible:
+
+ // this is needed because othervise childs cannot be set visible, ie the next line does not work as expected.
+ mTestObject->setVisible(true);
+ serviceButton->setVisible(true);
+ mainWnd->setOrientation(Qt::Vertical);
+ QVERIFY(serviceButton->isVisible());
+
+ cleanup();
+}
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testhintwidget/testhintwidget.pro Thu Apr 01 23:22:15 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:
+#
+
+TEMPLATE = app
+
+TARGET =
+
+DEPENDPATH += . \
+ inc \
+ src
+
+INCLUDEPATH += . \
+ inc \
+ ../../../tsrc/stubs/inc \
+ \ # keep these at bottom so that stubbed headers are searched first
+ ../../../inc \
+ ../../../videocollectionview/inc \
+ ../../../videocollectionwrapper/inc \
+
+CONFIG += qtestlib \
+ Hb \
+ symbian_test
+
+LIBS += -lestor.dll \
+ -lfbscli.dll \
+ -lbitgdi.dll \
+ -lgdi.dll \
+ -lvideocollectionwrapper.dll
+
+HEADERS += inc/testhintwidget.h \
+ \ # headers needed in test
+ ../../../videocollectionview/inc/videohintwidget.h \
+ \ # headers needed in stubs
+ ../../../videocollectionview/inc/videolistview.h \
+ ../../../videocollectionview/inc/videolistwidget.h \
+ ../../../videocollectionview/inc/videocollectionuiloader.h \
+ ../../../videocollectionview/inc/videocollectionviewutils.h \
+ ../../../videocollectionview/inc/videolistselectiondialog.h
+
+SOURCES += src/testhintwidget.cpp \
+ \ # sources needed in test
+ ../../../videocollectionview/src/videohintwidget.cpp \
+ \ # sources needed in stubs
+ ../../../tsrc/stubs/src/hblistview.cpp \
+ ../../../tsrc/stubs/src/hbwidget.cpp \
+ ../../../tsrc/stubs/src/hbscrollbar.cpp \
+ ../../../tsrc/stubs/src/hbdialog.cpp \
+ ../../../tsrc/stubs/src/hbaction.cpp \
+ ../../../tsrc/stubs/src/videocollectionuiloader.cpp \
+ ../../../tsrc/stubs/src/videocollectionviewutils.cpp \
+ ../../../tsrc/stubs/src/videolistview.cpp \
+ ../../../tsrc/stubs/src/videolistwidget.cpp \
+ ../../../tsrc/stubs/src/videolistselectiondialog.cpp
+
+RESOURCES += ../../data/videocollectionview.qrc
--- a/videocollection/videocollectionview/tsrc/testlistview/inc/testlistview.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionview/tsrc/testlistview/inc/testlistview.h Thu Apr 01 23:22:15 2010 +0300
@@ -43,6 +43,11 @@
*/
int visibleMenuActions();
+ /**
+ * Set row count in model.
+ */
+ void setRowCount(int count);
+
// Test functions for the test framework.
private slots:
--- a/videocollection/videocollectionview/tsrc/testlistview/src/testlistview.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionview/tsrc/testlistview/src/testlistview.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -16,7 +16,6 @@
*/
#include <QtTest/QtTest>
-#include <QMap>
#include <hbapplication.h>
#include <hbinstance.h>
#include <qactiongroup.h>
@@ -26,20 +25,32 @@
#include <videocollectioncommon.h>
#include <hbstackedwidget.h>
#include <hbgroupbox.h>
+#include <hbdocumentloader.h>
+#include <qhash.h>
+#include <qmap.h>
+#include <hbview.h>
+#include <hblistview.h>
+#include <mpxitemid.h>
+#include <vcxmyvideosdefs.h>
-#include "dummyhbmenu.h"
#include "videocollectionwrapper.h"
#include "testlistview.h"
-#include "videolistwidget.h"
#include "videocollectionviewutils.h"
#include "videolistselectiondialog.h"
#include "videosortfilterproxymodel.h"
#include "videocollectionwrapper.h"
-#include "dummydatamodel.h"
-#include "videocollectionuiloader.h"
#include "videohintwidget.h"
+#include "videolistwidgetdata.h"
+#include "videocollectionwrapperdata.h"
+#include "videocollectionviewutilsdata.h"
+#include "videolistselectiondialogdata.h"
+#include "videosortfilterproxymodeldata.h"
+#include "videocollectionuiloaderdata.h"
+#include "videolistdatamodeldata.h"
#define private public
+#include "videolistwidget.h"
+#include "videocollectionuiloader.h"
#include "videolistview.h"
#undef private
@@ -54,12 +65,19 @@
TestListView tv;
- char *pass[3];
- pass[0] = argv[0];
- pass[1] = "-o";
- pass[2] = "c:\\data\\testlistview.txt";
-
- int res = QTest::qExec(&tv, 3, pass);
+ 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\\testlistview.txt";
+ res = QTest::qExec(&tv, 3, pass);
+ }
return res;
}
@@ -70,51 +88,28 @@
//
void TestListView::init(bool initTestView)
{
- VideoListWidget::mInitializeCount = 0;
- VideoListWidget::mInitializeReturnValue = 0;
- VideoListWidget::mActivateCount = 0;
- VideoListWidget::mActivateReturnValue = 0;
- VideoListWidget::mActive = false;
- VideoListWidget::mDeactivateCount = 0;
- VideoCollectionWrapper::mOpenFails = false;
- VideoCollectionWrapper::mGetModelFails = false;
- VideoCollectionViewUtils::mSortRole = -1;
- VideoListSelectionDialog::mSelectionCount = 0;
- VideoListSelectionDialog::mMultiSelectionLaunchCount = 0;
- VideoListSelectionDialog::mMultiSelectionItemSelectionCount = 0;
- VideoListSelectionDialog::mExecReturnPrimary = false;
- VideoCollectionViewUtils::mSortOrder = Qt::AscendingOrder;
- VideoSortFilterProxyModel::mOpenFails = 0;
- VideoSortFilterProxyModel::mDoSortingCallCount = 0;
-
mUiLoader = new VideoCollectionUiLoader();
-
mUiLoader->reset();
bool ok(false);
-
QList<QObject *> objects = mUiLoader->load(DOCML_VIDEOCOLLECTIONVIEW_FILE, &ok);
-
if (!ok)
{
return;
}
mTestView = mUiLoader->findObject<VideoListView>( DOCML_NAME_VIEW );
-
QVERIFY(mTestView);
+ if(initTestView)
+ {
+ QVERIFY(mTestView->initializeView() == 0);
+ }
mListWidget = mUiLoader->findWidget<VideoListWidget>(DOCML_NAME_VC_VIDEOLISTWIDGET);
+ QVERIFY(mListWidget);
- if(initTestView)
- {
- QVERIFY(mTestView->initializeView() == 0);
- VideoSortFilterProxyModel::mDoSortingCallCount = 0;
- VideoSortFilterProxyModel::mSortRole = -1;
- VideoSortFilterProxyModel::mSortOrder = Qt::AscendingOrder;
- }
- mWrapper = VideoCollectionWrapper::instance();
- QVERIFY(mWrapper->open(VideoListWidget::ELevelVideos) != 0);
+ mWrapper = &VideoCollectionWrapper::instance();
+ QVERIFY(mWrapper);
}
// ---------------------------------------------------------------------------
@@ -125,13 +120,16 @@
{
delete mTestView;
mTestView = 0;
- if(mWrapper)
- {
- mWrapper->decreaseReferenceCount();
- QCOMPARE(mWrapper->mReferenceCount, 0);
- }
+
+ mWrapper = 0;
disconnect();
+
+ VideoListWidgetData::reset();
+ VideoCollectionWrapperData::reset();
+ VideoCollectionViewUtilsData::reset();
+ VideoListSelectionDialogData::reset();
+ VideoSortFilterProxyModelData::reset();
}
// ---------------------------------------------------------------------------
@@ -141,11 +139,11 @@
int TestListView::visibleMenuActions()
{
int visibleActions(0);
- VideoListView::TViewActionIds key;
+ VideoCollectionUiLoader::ActionIds key;
HbAction *action(0);
- foreach(key,mTestView->mMenuActions.keys())
+ foreach(key,mUiLoader->mMenuActions.keys())
{
- action = dynamic_cast<HbAction*>(mTestView->mMenuActions[key]);
+ action = dynamic_cast<HbAction*>(mUiLoader->mMenuActions[key]);
if(action && action->isVisible())
visibleActions++;
}
@@ -153,6 +151,32 @@
}
// ---------------------------------------------------------------------------
+// setRowCount
+// ---------------------------------------------------------------------------
+//
+void TestListView::setRowCount(int count)
+{
+ if (mTestView)
+ {
+ if (!mTestView->mCurrentList)
+ {
+ mTestView->activateView();
+ }
+ VideoSortFilterProxyModel *model = mTestView->mCurrentList->mModel;
+ if (model)
+ {
+ VideoListDataModel *sourceModel =
+ qobject_cast<VideoListDataModel*>(
+ model->sourceModel());
+ if (sourceModel)
+ {
+ VideoListDataModelData::setRowCount(*sourceModel, count);
+ }
+ }
+ }
+}
+
+// ---------------------------------------------------------------------------
// testCreateDelete
// ---------------------------------------------------------------------------
//
@@ -185,12 +209,13 @@
//
void TestListView::testInitializeView()
{
- init(false);
+ VideoListWidget *videoListWidget = 0;
+ VideoHintWidget *hintWidget = 0;
+
+ init(false);
// Test videolist widget creation failure.
- VideoListWidget::mInitializeReturnValue = -1;
+ VideoListWidgetData::mInitializeReturnValue = -1;
QVERIFY( mTestView->initializeView() < 0 );
- QVERIFY( mTestView->mVideoListWidget == 0 );
- QVERIFY( mTestView->mVideoHintWidget == 0 );
QVERIFY( mTestView->mToolbarViewsActionGroup == 0 );
QVERIFY( mTestView->mToolbarCollectionActionGroup == 0 );
QVERIFY( mTestView->mVideoServices == 0 );
@@ -200,24 +225,21 @@
// Test widget creation succeed.
init(false);
- VideoCollectionViewUtils::mSortRole = Qt::DisplayRole;
- VideoCollectionViewUtils::mSortOrder = Qt::DescendingOrder;
+ VideoCollectionViewUtilsData::mSortRole = Qt::DisplayRole;
+ VideoCollectionViewUtilsData::mSortOrder = Qt::DescendingOrder;
QVERIFY( mTestView->initializeView() == 0 );
// Verify
- QVERIFY( mTestView->mVideoListWidget != 0 );
- QVERIFY( mTestView->mVideoHintWidget != 0 );
- QCOMPARE( VideoListWidget::mInitializeCount, 1 );
+ QCOMPARE( VideoListWidgetData::mInitializeCount, 1 );
QVERIFY( mTestView->mToolbarViewsActionGroup != 0 );
QVERIFY( mTestView->mToolbarCollectionActionGroup != 0 );
QCOMPARE( mTestView->mToolbarViewsActionGroup->actions().count(), 3 );
QCOMPARE( mTestView->mToolbarCollectionActionGroup->actions().count(), 3 );
QCOMPARE( mTestView->toolBar()->actions().count(), 3 );
// to my understanding the all videos action should always be first.
- QCOMPARE( mTestView->mToolbarViewsActionGroup->actions().first()->toolTip(), tr("All videos") );
QVERIFY( mTestView->mToolbarViewsActionGroup->actions().first()->isChecked() );
- QCOMPARE( VideoSortFilterProxyModel::mSortRole, (int)Qt::DisplayRole );
- QCOMPARE( VideoSortFilterProxyModel::mSortOrder, Qt::DescendingOrder );
- QVERIFY( VideoSortFilterProxyModel::mSortAsync == false );
+ QCOMPARE( VideoSortFilterProxyModelData::mSortRole, (int)Qt::DisplayRole );
+ QCOMPARE( VideoSortFilterProxyModelData::mSortOrder, Qt::DescendingOrder );
+ QVERIFY( VideoSortFilterProxyModelData::mSortAsync == false );
QVERIFY( mTestView->mVideoServices == 0 );
QVERIFY( mTestView->mIsService == false );
cleanup();
@@ -225,7 +247,9 @@
// Test command signal.
init(true);
- connect( this, SIGNAL(testSignal(int)), mTestView->mVideoListWidget, SIGNAL(command(int)) );
+ videoListWidget = mUiLoader->findWidget<VideoListWidget>(DOCML_NAME_VC_VIDEOLISTWIDGET);
+ QVERIFY(videoListWidget);
+ connect( this, SIGNAL(testSignal(int)), videoListWidget, SIGNAL(command(int)) );
QSignalSpy spy(mTestView, SIGNAL(command(int)));
emit testSignal(5);
QCOMPARE( spy.count(), 1 );
@@ -235,8 +259,6 @@
cleanup();
init(true);
- VideoListWidget* list = mTestView->mVideoListWidget;
- VideoHintWidget* hint = mTestView->mVideoHintWidget;
QPointer<QActionGroup> toolbar = mTestView->mToolbarViewsActionGroup;
QPointer<QActionGroup> toolbar2 = mTestView->mToolbarCollectionActionGroup;
@@ -245,8 +267,6 @@
QVERIFY( toolbar != 0 );
QVERIFY( toolbar2 != 0 );
- QVERIFY( mTestView->mVideoListWidget == list );
- QVERIFY( mTestView->mVideoHintWidget == hint );
QVERIFY( mTestView->mToolbarViewsActionGroup == toolbar );
QVERIFY( mTestView->mToolbarCollectionActionGroup == toolbar2 );
@@ -258,10 +278,8 @@
// Test get model failure.
init(false);
QVERIFY(mTestView);
- VideoCollectionWrapper::mGetModelFails = true;
+ VideoCollectionWrapperData::mGetModelFails = true;
QVERIFY( mTestView->initializeView() < 0 );
- QVERIFY( mTestView->mVideoListWidget == 0 );
- QVERIFY( mTestView->mVideoHintWidget == 0 );
QVERIFY( mTestView->mToolbarViewsActionGroup == 0 );
QVERIFY( mTestView->mToolbarCollectionActionGroup == 0 );
cleanup();
@@ -269,23 +287,21 @@
// Test model open failure.
init(false);
QVERIFY(mTestView);
- VideoSortFilterProxyModel::mOpenFails = true;
+ VideoSortFilterProxyModelData::mOpenFails = true;
QVERIFY( mTestView->initializeView() < 0 );
- QVERIFY( mTestView->mVideoListWidget == 0 );
- QVERIFY( mTestView->mVideoHintWidget == 0 );
QVERIFY( mTestView->mToolbarViewsActionGroup == 0 );
QVERIFY( mTestView->mToolbarCollectionActionGroup == 0 );
cleanup();
// Test sorting value load 'failure'.
init(false);
- VideoCollectionViewUtils::mSortRole = Qt::DisplayRole;
- VideoCollectionViewUtils::mSortOrder = Qt::DescendingOrder;
- VideoCollectionViewUtils::mLoadSortingValuesFails = true;
+ VideoCollectionViewUtilsData::mSortRole = Qt::DisplayRole;
+ VideoCollectionViewUtilsData::mSortOrder = Qt::DescendingOrder;
+ VideoCollectionViewUtilsData::mLoadSortingValuesFails = true;
QVERIFY( mTestView->initializeView() == 0 );
- QCOMPARE( VideoSortFilterProxyModel::mSortRole, (int)VideoCollectionCommon::KeyDateTime );
- QCOMPARE( VideoSortFilterProxyModel::mSortOrder, Qt::AscendingOrder );
- QVERIFY( VideoSortFilterProxyModel::mSortAsync == false );
+ QCOMPARE( VideoSortFilterProxyModelData::mSortRole, (int)VideoCollectionCommon::KeyDateTime );
+ QCOMPARE( VideoSortFilterProxyModelData::mSortOrder, Qt::AscendingOrder );
+ QVERIFY( VideoSortFilterProxyModelData::mSortAsync == false );
cleanup();
}
@@ -296,7 +312,7 @@
void TestListView::testCreateListMenu()
{
init(false);
- VideoListWidget::mInitializeReturnValue = -1;
+ VideoListWidgetData::mInitializeReturnValue = -1;
QVERIFY( mTestView->initializeView() < 0 );
HbMenu* menu = mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU);
QVERIFY( menu );
@@ -305,7 +321,7 @@
cleanup();
init(false);
- VideoListWidget::mInitializeReturnValue = 0;
+ VideoListWidgetData::mInitializeReturnValue = 0;
QVERIFY( mTestView->initializeView() == 0 );
menu = mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU);
QVERIFY( menu );
@@ -317,7 +333,7 @@
QVERIFY(menu != 0);
QVERIFY( menu->actions().count() == 4 );
- QVERIFY( mTestView->mMenuActions.count() == 9 );
+ QVERIFY( mUiLoader->mMenuActions.count() == 9 );
QVERIFY( mTestView->mSortingRoles.count() == 5 );
cleanup();
@@ -426,32 +442,26 @@
HbAction* allVideos = static_cast<HbAction*>(actions.at(0));
QVERIFY( allVideos->isCheckable() );
- QCOMPARE( allVideos->toolTip(), tr("All videos") );
QCOMPARE( allVideos->icon().iconName(), QString(":/images/qtg_mono_video_all.svg") );
HbAction* collections = static_cast<HbAction*>(actions.at(1));
QVERIFY( collections->isCheckable() );
- QCOMPARE( collections->toolTip(), tr("Collections") );
QCOMPARE( collections->icon().iconName(), QString(":/images/qtg_mono_video_collection.svg") );
HbAction* services = static_cast<HbAction*>(actions.at(2));
QVERIFY( services->isCheckable() );
- QCOMPARE( services->toolTip(), tr("Services") );
QCOMPARE( services->icon().iconName(), QString(":/images/qtg_mono_video_services.svg") );
HbAction* addVideos = static_cast<HbAction*>(actions.at(3));
QVERIFY( !addVideos->isCheckable() );
- QCOMPARE( addVideos->toolTip(), tr("Add videos") );
QCOMPARE( addVideos->icon().iconName(), QString(":/images/mono_video_addvideos.svg") );
HbAction* removeVideos = static_cast<HbAction*>(actions.at(4));
QVERIFY( !removeVideos->isCheckable() );
- QCOMPARE( removeVideos->toolTip(), tr("Remove videos") );
QCOMPARE( removeVideos->icon().iconName(), QString(":/images/mono_video_removevideos.svg") );
HbAction* sortVideos = static_cast<HbAction*>(actions.at(5));
QVERIFY( !sortVideos->isCheckable() );
- QCOMPARE( sortVideos->toolTip(), tr("Sort by") );
QCOMPARE( sortVideos->icon().iconName(), QString(":/images/mono_video_sortvideos.svg") );
cleanup();
@@ -463,39 +473,41 @@
//
void TestListView::testActivateView()
{
+ VideoListWidget* videoListWidget = 0;
+
init();
- VideoListWidget* list = mTestView->mVideoListWidget;
- mTestView->mVideoListWidget = 0;
+ videoListWidget = mUiLoader->findWidget<VideoListWidget>(DOCML_NAME_VC_VIDEOLISTWIDGET);
+ QVERIFY(videoListWidget);
+ mTestView->mCurrentList = 0;
QCOMPARE( mTestView->activateView(), -1 );
- QVERIFY( mTestView->mVideoListWidget->mActive == false );
- QCOMPARE( mTestView->mVideoListWidget->mActivateCount, 0 );
- QCOMPARE( mTestView->mVideoListWidget->mDeactivateCount, 0 );
+ QVERIFY( VideoListWidgetData::mActive == false );
+ QCOMPARE( mTestView->mCurrentList, videoListWidget );
+ QCOMPARE( VideoListWidgetData::mActivateCount, 0 );
+ QCOMPARE( VideoListWidgetData::mDeactivateCount, 0 );
QVERIFY( mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->isEnabled() == false );
- mTestView->mVideoListWidget = list;
-
- VideoListWidget::mActivateReturnValue = -1;
+ VideoListWidgetData::mActivateReturnValue = -1;
QCOMPARE( mTestView->activateView(), -1 );
- QVERIFY( mTestView->mVideoListWidget->mActive == false );
- QCOMPARE( mTestView->mVideoListWidget->mActivateCount, 1 );
- QCOMPARE( mTestView->mVideoListWidget->mDeactivateCount, 1 );
+ QVERIFY( VideoListWidgetData::mActive == false );
+ QCOMPARE( VideoListWidgetData::mActivateCount, 1 );
+ QCOMPARE( VideoListWidgetData::mDeactivateCount, 1 );
QVERIFY( mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->isEnabled() == false );
- VideoListWidget::mActivateReturnValue = 0;
+ VideoListWidgetData::mActivateReturnValue = 0;
QCOMPARE( mTestView->activateView(), 0 );
- QVERIFY( mTestView->mVideoListWidget->mActive );
- QCOMPARE( mTestView->mVideoListWidget->mActivateCount, 2 );
- QCOMPARE( mTestView->mVideoListWidget->mDeactivateCount, 1 );
+ QVERIFY( VideoListWidgetData::mActive );
+ QCOMPARE( VideoListWidgetData::mActivateCount, 2 );
+ QCOMPARE( VideoListWidgetData::mDeactivateCount, 1 );
QVERIFY( mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->isEnabled() );
QCOMPARE( mTestView->activateView(), 0 );
- QVERIFY( mTestView->mVideoListWidget->mActive );
- QCOMPARE( mTestView->mVideoListWidget->mActivateCount, 3 );
- QCOMPARE( mTestView->mVideoListWidget->mDeactivateCount, 1 );
+ QVERIFY( VideoListWidgetData::mActive );
+ QCOMPARE( VideoListWidgetData::mActivateCount, 3 );
+ QCOMPARE( VideoListWidgetData::mDeactivateCount, 1 );
QVERIFY( mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->isEnabled() );
cleanup();
@@ -507,30 +519,31 @@
//
void TestListView::testDeactivateView()
{
- init();
+ VideoListWidget* videoListWidget = 0;
+
+ init();
- VideoListWidget* list = mTestView->mVideoListWidget;
- mTestView->mVideoListWidget = 0;
+ videoListWidget = mUiLoader->findWidget<VideoListWidget>(DOCML_NAME_VC_VIDEOLISTWIDGET);
+ QVERIFY(videoListWidget);
+ mTestView->mCurrentList = 0;
mTestView->deactivateView();
QVERIFY( mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->isVisible() == false );
QVERIFY( mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->isEnabled() == false );
- QCOMPARE( mTestView->mVideoListWidget->mDeactivateCount, 0 );
-
- mTestView->mVideoListWidget = list;
+ QCOMPARE( VideoListWidgetData::mDeactivateCount, 0 );
mTestView->deactivateView();
QVERIFY( mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->isVisible() == false );
QVERIFY( mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->isEnabled() == false );
- QCOMPARE( mTestView->mVideoListWidget->mDeactivateCount, 1 );
+ QCOMPARE( VideoListWidgetData::mDeactivateCount, 1 );
- VideoListWidget::mActivateReturnValue = 0;
+ VideoListWidgetData::mActivateReturnValue = 0;
mTestView->activateView();
mTestView->deactivateView();
QVERIFY( mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->isVisible() == false );
QVERIFY( mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->isEnabled() == false );
- QCOMPARE( mTestView->mVideoListWidget->mActivateCount, 1 );
- QCOMPARE( mTestView->mVideoListWidget->mDeactivateCount, 2 );
+ QCOMPARE( VideoListWidgetData::mActivateCount, 1 );
+ QCOMPARE( VideoListWidgetData::mDeactivateCount, 2 );
cleanup();
}
@@ -554,43 +567,47 @@
//
void TestListView::testOpenAllVideosViewSlot()
{
+ VideoListWidget *videoListWidget = 0;
+ HbGroupBox *subLabel = 0;
+
init();
+
+ videoListWidget = mUiLoader->findWidget<VideoListWidget>(DOCML_NAME_VC_VIDEOLISTWIDGET);
+ QVERIFY(videoListWidget);
+ subLabel = mUiLoader->findWidget<HbGroupBox>(DOCML_NAME_VC_HEADINGBANNER);
+ QVERIFY(subLabel);
QList<QAction*> actions = mTestView->mToolbarViewsActionGroup->actions();
HbAction* action = static_cast<HbAction*>(actions.at(0));
- mTestView->mVideoListWidget->mType = VideoListWidget::EAllVideos;
- mTestView->mVideoListWidget->mCurrentLevel = VideoListWidget::ELevelCategory;
- mTestView->mSubLabel->setHeading("invalid");
- mTestView->mModel->mLevel = -1;
+ videoListWidget->mCurrentLevel = VideoCollectionCommon::ELevelCategory;
+ subLabel->setHeading("invalid");
// action wont emit if it's already checked.
action->setChecked(false);
action->trigger();
- QCOMPARE( mTestView->mVideoListWidget->mCurrentLevel, VideoListWidget::ELevelVideos );
- QVERIFY( mTestView->mVideoListWidget->mActive == true );
- QCOMPARE( mTestView->mVideoListWidget->mActivateCount, 1 );
- QCOMPARE( mTestView->mVideoListWidget->mDeactivateCount, 0 );
- QCOMPARE( mTestView->mSubLabel->heading(), tr("%1 videos").arg(mTestView->mModel->rowCount()) );
- QCOMPARE( mTestView->mModel->mLevel, (int)VideoListWidget::ELevelVideos );
+ QCOMPARE( mTestView->mCurrentList->mCurrentLevel, VideoCollectionCommon::ELevelVideos );
+ QVERIFY( VideoListWidgetData::mActive == true );
+ QCOMPARE( VideoListWidgetData::mActivateCount, 1 );
+ QCOMPARE( VideoListWidgetData::mDeactivateCount, 0 );
+ QCOMPARE( subLabel->heading(), tr("txt_videos_subtitle_ln_videos" ));
+ QCOMPARE(mTestView->mCurrentList, videoListWidget);
mTestView->activateView();
- mTestView->mVideoListWidget->mActivateCount = 0;
- mTestView->mVideoListWidget->mType = VideoListWidget::EAllVideos;
- mTestView->mVideoListWidget->mCurrentLevel = VideoListWidget::ELevelCategory;
- mTestView->mSubLabel->setHeading("invalid");
- mTestView->mModel->mLevel = -1;
+ VideoListWidgetData::mActivateCount = 0;
+ mTestView->mCurrentList->mCurrentLevel = VideoCollectionCommon::ELevelCategory;
+ subLabel->setHeading("invalid");
// action wont emit if it's already checked.
action->setChecked(false);
action->trigger();
- QCOMPARE( mTestView->mVideoListWidget->mCurrentLevel, VideoListWidget::ELevelVideos );
- QVERIFY( mTestView->mVideoListWidget->mActive == true );
- QCOMPARE( mTestView->mVideoListWidget->mActivateCount, 1 );
- QCOMPARE( mTestView->mVideoListWidget->mDeactivateCount, 0 );
- QCOMPARE( mTestView->mSubLabel->heading(), tr("%1 videos").arg(mTestView->mModel->rowCount()) );
- QCOMPARE( mTestView->mModel->mLevel, (int)VideoListWidget::ELevelVideos );
+ QCOMPARE( mTestView->mCurrentList->mCurrentLevel, VideoCollectionCommon::ELevelVideos );
+ QVERIFY( VideoListWidgetData::mActive == true );
+ QCOMPARE( VideoListWidgetData::mActivateCount, 1 );
+ QCOMPARE( VideoListWidgetData::mDeactivateCount, 0 );
+ QCOMPARE( subLabel->heading(), tr("txt_videos_subtitle_ln_videos" ));
+ QCOMPARE(mTestView->mCurrentList, videoListWidget);
cleanup();
}
@@ -601,43 +618,47 @@
//
void TestListView::testOpenCollectionViewSlot()
{
- init();
+ VideoListWidget *collectionWidget = 0;
+ HbGroupBox *subLabel = 0;
+
+ init();
QList<QAction*> actions = mTestView->mToolbarViewsActionGroup->actions();
HbAction* action = static_cast<HbAction*>(actions.at(1));
- mTestView->mVideoListWidget->mType = VideoListWidget::ECollections;
- mTestView->mVideoListWidget->mCurrentLevel = VideoListWidget::ELevelVideos;
- mTestView->mSubLabel->setHeading("invalid");
- mTestView->mModel->mLevel = -1;
+ collectionWidget = mUiLoader->findWidget<VideoListWidget>(DOCML_NAME_VC_COLLECTIONWIDGET);
+ QVERIFY(collectionWidget);
+ subLabel = mUiLoader->findWidget<HbGroupBox>(DOCML_NAME_VC_HEADINGBANNER);
+ QVERIFY(subLabel);
+
+ mTestView->mCurrentList->mCurrentLevel = VideoCollectionCommon::ELevelVideos;
+ subLabel->setHeading("invalid");
// action wont emit if it's already checked.
action->setChecked(false);
action->trigger();
- QCOMPARE( mTestView->mVideoListWidget->mCurrentLevel, VideoListWidget::ELevelCategory );
- QVERIFY( mTestView->mVideoListWidget->mActive == true );
- QCOMPARE( mTestView->mVideoListWidget->mActivateCount, 1 );
- QCOMPARE( mTestView->mVideoListWidget->mDeactivateCount, 0 );
- QCOMPARE( mTestView->mSubLabel->heading(), tr("%1 collections").arg(mTestView->mModel->rowCount()) );
- QCOMPARE( mTestView->mModel->mLevel, (int)VideoListWidget::ELevelCategory );
+ QCOMPARE( mTestView->mCurrentList->mCurrentLevel, VideoCollectionCommon::ELevelCategory );
+ QVERIFY( VideoListWidgetData::mActive == true );
+ QCOMPARE( VideoListWidgetData::mActivateCount, 1 );
+ QCOMPARE( VideoListWidgetData::mDeactivateCount, 0 );
+ QCOMPARE( subLabel->heading(), tr("txt_videos_subtitle_l1_collections" ));
+ QCOMPARE(mTestView->mCurrentList, collectionWidget);
mTestView->activateView();
- mTestView->mVideoListWidget->mActivateCount = 0;
- mTestView->mVideoListWidget->mType = VideoListWidget::ECollections;
- mTestView->mVideoListWidget->mCurrentLevel = VideoListWidget::ELevelVideos;
- mTestView->mSubLabel->setHeading("invalid");
- mTestView->mModel->mLevel = -1;
+ VideoListWidgetData::mActivateCount = 0;
+ mTestView->mCurrentList->mCurrentLevel = VideoCollectionCommon::ELevelVideos;
+ subLabel->setHeading("invalid");
// action wont emit if it's already checked.
action->setChecked(false);
action->trigger();
- QCOMPARE( mTestView->mVideoListWidget->mCurrentLevel, VideoListWidget::ELevelCategory );
- QVERIFY( mTestView->mVideoListWidget->mActive == true );
- QCOMPARE( mTestView->mVideoListWidget->mActivateCount, 1 );
- QCOMPARE( mTestView->mVideoListWidget->mDeactivateCount, 0 );
- QCOMPARE( mTestView->mSubLabel->heading(), tr("%1 collections").arg(mTestView->mModel->rowCount()) );
- QCOMPARE( mTestView->mModel->mLevel, (int)VideoListWidget::ELevelCategory );
+ QCOMPARE( mTestView->mCurrentList->mCurrentLevel, VideoCollectionCommon::ELevelCategory );
+ QVERIFY( VideoListWidgetData::mActive == true );
+ QCOMPARE( VideoListWidgetData::mActivateCount, 1 );
+ QCOMPARE( VideoListWidgetData::mDeactivateCount, 0 );
+ QCOMPARE( subLabel->heading(), tr("txt_videos_subtitle_l1_collections" ));
+ QCOMPARE(mTestView->mCurrentList, collectionWidget);
cleanup();
}
@@ -669,31 +690,31 @@
// Active action is not sort by.
init(true);
- action = mTestView->mMenuActions[VideoListView::EActionDelete];
+ action = mUiLoader->mMenuActions[VideoCollectionUiLoader::EActionDelete];
QVERIFY(action != 0);
mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->setActiveAction(action);
connect(this, SIGNAL(testSignal(int)), mTestView, SLOT(startSorting()));
emit testSignal(0);
- QCOMPARE(VideoSortFilterProxyModel::mDoSortingCallCount, 0);
- QCOMPARE(VideoSortFilterProxyModel::mSortRole, -1);
+ QCOMPARE(VideoSortFilterProxyModelData::mDoSortingCallCount, 0);
+ QCOMPARE(VideoSortFilterProxyModelData::mSortRole, -1);
cleanup();
// Sort by action has no menu.
init(true);
// Change sort by action to delete action which has no menu.
- HbAction *sortByAction = mTestView->mMenuActions[VideoListView::EActionSortBy];
- HbAction *deleteAction = mTestView->mMenuActions[VideoListView::EActionDelete];
- mTestView->mMenuActions[VideoListView::EActionSortBy] = deleteAction;
+ HbAction *sortByAction = mUiLoader->mMenuActions[VideoCollectionUiLoader::EActionSortBy];
+ HbAction *deleteAction = mUiLoader->mMenuActions[VideoCollectionUiLoader::EActionDelete];
+ mUiLoader->mMenuActions[VideoCollectionUiLoader::EActionSortBy] = deleteAction;
mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->setActiveAction(deleteAction);
connect(this, SIGNAL(testSignal(int)), mTestView, SLOT(startSorting()));
emit testSignal(0);
- QCOMPARE(VideoSortFilterProxyModel::mDoSortingCallCount, 0);
- QCOMPARE(VideoSortFilterProxyModel::mSortRole, -1);
+ QCOMPARE(VideoSortFilterProxyModelData::mDoSortingCallCount, 0);
+ QCOMPARE(VideoSortFilterProxyModelData::mSortRole, -1);
// Change the action back.
- mTestView->mMenuActions[VideoListView::EActionSortBy] = sortByAction;
+ mUiLoader->mMenuActions[VideoCollectionUiLoader::EActionSortBy] = sortByAction;
cleanup();
@@ -701,52 +722,52 @@
init(false);
connect(this, SIGNAL(testSignal(int)), mTestView, SLOT(startSorting()));
emit testSignal(0);
- QCOMPARE(VideoSortFilterProxyModel::mDoSortingCallCount, 0);
- QCOMPARE(VideoSortFilterProxyModel::mSortRole, -1);
+ QCOMPARE(VideoSortFilterProxyModelData::mDoSortingCallCount, 0);
+ QCOMPARE(VideoSortFilterProxyModelData::mSortRole, -1);
cleanup();
// Good case.
init();
- action = mTestView->mMenuActions[VideoListView::EActionSortBy];
+ action = mUiLoader->mMenuActions[VideoCollectionUiLoader::EActionSortBy];
QVERIFY(action != 0);
mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->setActiveAction(action);
- HbAction* sortAction = mTestView->mMenuActions[VideoListView::EActionSortByName];
+ HbAction* sortAction = mUiLoader->mMenuActions[VideoCollectionUiLoader::EActionSortByName];
QVERIFY(sortAction != 0);
action->menu()->setActiveAction(sortAction);
connect(this, SIGNAL(testSignal(int)), mTestView, SLOT(startSorting()));
emit testSignal(0);
- QCOMPARE(VideoSortFilterProxyModel::mDoSortingCallCount, 1);
- QCOMPARE(VideoSortFilterProxyModel::mSortRole, (int)Qt::DisplayRole);
- QCOMPARE(VideoSortFilterProxyModel::mSortOrder, Qt::AscendingOrder);
- QVERIFY(VideoSortFilterProxyModel::mSortAsync);
+ QCOMPARE(VideoSortFilterProxyModelData::mDoSortingCallCount, 1);
+ QCOMPARE(VideoSortFilterProxyModelData::mSortRole, (int)Qt::DisplayRole);
+ QCOMPARE(VideoSortFilterProxyModelData::mSortOrder, Qt::AscendingOrder);
+ QVERIFY(VideoSortFilterProxyModelData::mSortAsync);
// emit test signal again, with same parameters. Sorting should be switched to
// descending order.
emit testSignal(0);
- QCOMPARE(VideoSortFilterProxyModel::mDoSortingCallCount, 2);
- QCOMPARE(VideoSortFilterProxyModel::mSortRole, (int)Qt::DisplayRole);
- QCOMPARE(VideoSortFilterProxyModel::mSortOrder, Qt::DescendingOrder);
- QVERIFY(VideoSortFilterProxyModel::mSortAsync);
+ QCOMPARE(VideoSortFilterProxyModelData::mDoSortingCallCount, 2);
+ QCOMPARE(VideoSortFilterProxyModelData::mSortRole, (int)Qt::DisplayRole);
+ QCOMPARE(VideoSortFilterProxyModelData::mSortOrder, Qt::DescendingOrder);
+ QVERIFY(VideoSortFilterProxyModelData::mSortAsync);
// on third emit, sorting should be switched back to ascending
emit testSignal(0);
- QCOMPARE(VideoSortFilterProxyModel::mDoSortingCallCount, 3);
- QCOMPARE(VideoSortFilterProxyModel::mSortRole, (int)Qt::DisplayRole);
- QCOMPARE(VideoSortFilterProxyModel::mSortOrder, Qt::AscendingOrder);
- QVERIFY(VideoSortFilterProxyModel::mSortAsync);
+ QCOMPARE(VideoSortFilterProxyModelData::mDoSortingCallCount, 3);
+ QCOMPARE(VideoSortFilterProxyModelData::mSortRole, (int)Qt::DisplayRole);
+ QCOMPARE(VideoSortFilterProxyModelData::mSortOrder, Qt::AscendingOrder);
+ QVERIFY(VideoSortFilterProxyModelData::mSortAsync);
// test that after changing the sort role, the order is also switched to ascending.
- VideoSortFilterProxyModel::mSortOrder = Qt::DescendingOrder;
- sortAction = mTestView->mMenuActions[VideoListView::EActionSortByDate];
+ VideoSortFilterProxyModelData::mSortOrder = Qt::DescendingOrder;
+ sortAction = mUiLoader->mMenuActions[VideoCollectionUiLoader::EActionSortByDate];
QVERIFY(sortAction != 0);
action->menu()->setActiveAction(sortAction);
emit testSignal(0);
- QCOMPARE(VideoSortFilterProxyModel::mDoSortingCallCount, 4);
- QCOMPARE(VideoSortFilterProxyModel::mSortRole, (int)VideoCollectionCommon::KeyDateTime);
- QCOMPARE(VideoSortFilterProxyModel::mSortOrder, Qt::AscendingOrder);
- QVERIFY(VideoSortFilterProxyModel::mSortAsync);
+ QCOMPARE(VideoSortFilterProxyModelData::mDoSortingCallCount, 4);
+ QCOMPARE(VideoSortFilterProxyModelData::mSortRole, (int)VideoCollectionCommon::KeyDateTime);
+ QCOMPARE(VideoSortFilterProxyModelData::mSortOrder, Qt::AscendingOrder);
+ QVERIFY(VideoSortFilterProxyModelData::mSortAsync);
cleanup();
}
@@ -792,12 +813,9 @@
////////////
// no model
////////////
- VideoSortFilterProxyModel *tmpModel = mTestView->mModel;
- mTestView->mModel = 0;
emit testSignal();
- QVERIFY(VideoListSelectionDialog::mMultiSelectionLaunchCount == 0);
- QVERIFY(VideoListSelectionDialog::mMultiSelectionItemSelectionCount == 0);
- mTestView->mModel = tmpModel;
+ QVERIFY(VideoListSelectionDialogData::mMultiSelectionLaunchCount == 0);
+ QVERIFY(VideoListSelectionDialogData::mMultiSelectionItemSelectionCount == 0);
cleanup();
init();
@@ -807,8 +825,8 @@
// no selection dialog
////////////
emit testSignal();
- QVERIFY(VideoListSelectionDialog::mMultiSelectionLaunchCount == 1);
- QVERIFY(VideoListSelectionDialog::mMultiSelectionItemSelectionCount == 0);
+ QVERIFY(VideoListSelectionDialogData::mMultiSelectionLaunchCount == 1);
+ QVERIFY(VideoListSelectionDialogData::mMultiSelectionItemSelectionCount == 0);
cleanup();
init();
@@ -817,18 +835,13 @@
////////////
// dialog loading fails
////////////
- VideoCollectionUiLoader::mFailDialogLoad = true;
+ VideoCollectionUiLoaderData::mFailDialogLoad = true;
emit testSignal();
- QVERIFY(VideoListSelectionDialog::mMultiSelectionLaunchCount == 0);
- QVERIFY(VideoListSelectionDialog::mMultiSelectionItemSelectionCount == 0);
- VideoCollectionUiLoader::mFailDialogLoad = false;
+ QVERIFY(VideoListSelectionDialogData::mMultiSelectionLaunchCount == 0);
+ QVERIFY(VideoListSelectionDialogData::mMultiSelectionItemSelectionCount == 0);
+ VideoCollectionUiLoaderData::mFailDialogLoad = false;
//////////
// document loader deletes all objects in case of error, so we cannot cleanup all
- if(mWrapper)
- {
- mWrapper->decreaseReferenceCount();
- QCOMPARE(mWrapper->mReferenceCount, 0);
- }
disconnect();
///////////////
init();
@@ -838,11 +851,11 @@
// selection dialog exists
////////////
emit testSignal();
- QVERIFY(VideoListSelectionDialog::mMultiSelectionLaunchCount == 1);
- QVERIFY(VideoListSelectionDialog::mMultiSelectionItemSelectionCount == 0);
+ QVERIFY(VideoListSelectionDialogData::mMultiSelectionLaunchCount == 1);
+ QVERIFY(VideoListSelectionDialogData::mMultiSelectionItemSelectionCount == 0);
emit testSignal();
- QVERIFY(VideoListSelectionDialog::mMultiSelectionLaunchCount == 2);
- QVERIFY(VideoListSelectionDialog::mMultiSelectionItemSelectionCount == 0);
+ QVERIFY(VideoListSelectionDialogData::mMultiSelectionLaunchCount == 2);
+ QVERIFY(VideoListSelectionDialogData::mMultiSelectionItemSelectionCount == 0);
cleanup();
init();
@@ -851,11 +864,11 @@
////////////
// exec returns primary key (just for the coverity's sake)
////////////
- VideoListSelectionDialog:: mExecReturnPrimary = true;
- VideoListSelectionDialog::mSelectionCount = 5;
+ VideoListSelectionDialogData::mExecReturnPrimary = true;
+ VideoListSelectionDialogData::mSelectionCount = 5;
emit testSignal();
- QVERIFY(VideoListSelectionDialog::mMultiSelectionLaunchCount == 1);
- QVERIFY(VideoListSelectionDialog::mMultiSelectionItemSelectionCount == 5);
+ QVERIFY(VideoListSelectionDialogData::mMultiSelectionLaunchCount == 1);
+ QVERIFY(VideoListSelectionDialogData::mMultiSelectionItemSelectionCount == 5);
cleanup();
}
@@ -868,14 +881,13 @@
{
// All ok.
init();
- mWrapper->getDataModel()->setRowCount(1);
+ setRowCount(1);
mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->show();
QVERIFY(visibleMenuActions() == 6);
cleanup();
// View is not initialized.
init(false);
- mWrapper->getDataModel()->setRowCount(1);
connect( this, SIGNAL(testSignal(int)), mTestView, SLOT(aboutToShowMainMenuSlot()) );
emit testSignal(0);
cleanup();
@@ -884,7 +896,7 @@
// Collections is triggered from toolbar.
init();
- mWrapper->getDataModel()->setRowCount(1);
+ setRowCount(1);
action = mTestView->mToolbarActions[VideoListView::ETBActionCollections];
QVERIFY(action != 0);
action->setChecked(false);
@@ -896,7 +908,7 @@
// All videos is triggered from toolbar.
init();
- mWrapper->getDataModel()->setRowCount(1);
+ setRowCount(1);
action = mTestView->mToolbarActions[VideoListView::ETBActionAllVideos];
QVERIFY(action != 0);
action->setChecked(false);
@@ -908,7 +920,7 @@
// Services is triggered from toolbar.
init();
- mWrapper->getDataModel()->setRowCount(1);
+ setRowCount(1);
action = mTestView->mToolbarActions[VideoListView::ETBActionServices];
QVERIFY(action != 0);
action->setChecked(false);
@@ -920,10 +932,10 @@
// Add videos action is visible.
init();
+ mTestView->activateView();
mTestView->toolBar()->clearActions();
mTestView->toolBar()->addActions( mTestView->mToolbarCollectionActionGroup->actions() );
-
- mWrapper->getDataModel()->setRowCount(1);
+ setRowCount(1);
QVERIFY(action != 0);
mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->show();
visible = visibleMenuActions();
@@ -932,11 +944,11 @@
// Menu action is null
init();
- mWrapper->getDataModel()->setRowCount(1);
- action = mTestView->mMenuActions.take(VideoListView::EActionSortBy);
+ setRowCount(1);
+ action = mUiLoader->mMenuActions.take(VideoCollectionUiLoader::EActionSortBy);
delete action;
action = NULL;
- mTestView->mMenuActions[VideoListView::EActionSortBy] = action;
+ mUiLoader->mMenuActions[VideoCollectionUiLoader::EActionSortBy] = action;
mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->show();
visible = visibleMenuActions();
QCOMPARE(visible, 0);
@@ -944,17 +956,17 @@
// No menu actions.
init();
- mWrapper->getDataModel()->setRowCount(1);
- QMap<VideoListView::TViewActionIds, HbAction*> backupActions =
- QMap<VideoListView::TViewActionIds, HbAction*>(mTestView->mMenuActions);
- mTestView->mMenuActions.clear();
+ setRowCount(1);
+ QMap<VideoCollectionUiLoader::ActionIds, HbAction*> backupActions =
+ QMap<VideoCollectionUiLoader::ActionIds, HbAction*>(mUiLoader->mMenuActions);
+ mUiLoader->mMenuActions.clear();
mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->show();
- mTestView->mMenuActions.unite(backupActions);
+ mUiLoader->mMenuActions.unite(backupActions);
cleanup();
// Model has no items.
init();
- mWrapper->getDataModel()->setRowCount(0);
+ setRowCount(0);
mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->show();
visible = visibleMenuActions();
QCOMPARE(visible, 0);
@@ -962,7 +974,7 @@
// Toolbar action group is null
init();
- mWrapper->getDataModel()->setRowCount(1);
+ setRowCount(1);
QActionGroup* actionGroup = mTestView->mToolbarViewsActionGroup;
mTestView->mToolbarViewsActionGroup = NULL;
mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->show();
@@ -976,48 +988,41 @@
//
void TestListView::testOpenSortByMenuSlot()
{
- DummyHbMenu *dummyMenu = new DummyHbMenu;
- HbMenu *tmpMenu;
+ HbMenu *optionsMenu = 0;
+ HbMenu *sortMenu = 0;
// All ok.
init();
- tmpMenu = mTestView->mSortMenu;
- mTestView->mSortMenu = dummyMenu;
+ sortMenu = mUiLoader->findWidget<HbMenu>(DOCML_NAME_SORT_MENU);
connect( this, SIGNAL(testSignal(int)), mTestView, SLOT(openSortByMenuSlot()) );
- mWrapper->getDataModel()->setRowCount(1);
+ setRowCount(1);
mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->hide();
emit testSignal(0);
// sorting menu should be visible
QVERIFY(visibleMenuActions() == 4);
- mTestView->mSortMenu = tmpMenu;
cleanup();
// View is not initialized.
init(false);
- tmpMenu = mTestView->mSortMenu;
- mTestView->mSortMenu = dummyMenu;
+ sortMenu = mUiLoader->findWidget<HbMenu>(DOCML_NAME_SORT_MENU);
+ optionsMenu = mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU);
connect( this, SIGNAL(testSignal(int)), mTestView, SLOT(openSortByMenuSlot()) );
- mWrapper->getDataModel()->setRowCount(1);
- mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->hide();
+ setRowCount(1);
+ optionsMenu->hide();
emit testSignal(0);
QCOMPARE(visibleMenuActions(), 0);
- mTestView->mSortMenu = tmpMenu;
cleanup();
// no items
init();
- tmpMenu = mTestView->mSortMenu;
- mTestView->mSortMenu = dummyMenu;
+ sortMenu = mUiLoader->findWidget<HbMenu>(DOCML_NAME_SORT_MENU);
+ optionsMenu = mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU);
connect( this, SIGNAL(testSignal(int)), mTestView, SLOT(openSortByMenuSlot()) );
- mWrapper->getDataModel()->setRowCount(0);
+ setRowCount(0);
mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->hide();
emit testSignal(0);
QCOMPARE(visibleMenuActions(), 0);
- mTestView->mSortMenu = tmpMenu;
cleanup();
-
- delete dummyMenu;
-
}
// ---------------------------------------------------------------------------
@@ -1032,35 +1037,35 @@
init();
connect(this, SIGNAL(testStatusSignal(int, QVariant&)), mTestView, SLOT(handleAsyncStatusSlot(int, QVariant&)));
emit testStatusSignal(0, *variant);
- QVERIFY(VideoCollectionViewUtils::mLastError == 0);
+ QVERIFY(VideoCollectionViewUtilsData::mLastError == 0);
cleanup();
// Multiple deletion error.
init();
connect(this, SIGNAL(testStatusSignal(int, QVariant&)), mTestView, SLOT(handleAsyncStatusSlot(int, QVariant&)));
emit testStatusSignal(VideoCollectionCommon::statusMultipleDeleteFail, *variant);
- QVERIFY(VideoCollectionViewUtils::mLastError == VideoCollectionCommon::statusMultipleDeleteFail);
+ QVERIFY(VideoCollectionViewUtilsData::mLastError == VideoCollectionCommon::statusMultipleDeleteFail);
cleanup();
// Deletion error.
init();
connect(this, SIGNAL(testStatusSignal(int, QVariant&)), mTestView, SLOT(handleAsyncStatusSlot(int, QVariant&)));
emit testStatusSignal(VideoCollectionCommon::statusSingleDeleteFail, *variant);
- QVERIFY(VideoCollectionViewUtils::mLastError == VideoCollectionCommon::statusSingleDeleteFail);
+ QVERIFY(VideoCollectionViewUtilsData::mLastError == VideoCollectionCommon::statusSingleDeleteFail);
cleanup();
// status multidelete succeed
init();
connect(this, SIGNAL(testStatusSignal(int, QVariant&)), mTestView, SLOT(handleAsyncStatusSlot(int, QVariant&)));
- emit testStatusSignal(VideoCollectionCommon::statusMultipleDeleteSucceed, *variant);
- QVERIFY(VideoCollectionViewUtils::mLastError == VideoCollectionCommon::statusMultipleDeleteSucceed);
+ emit testStatusSignal(VideoCollectionCommon::statusDeleteSucceed, *variant);
+ QVERIFY(VideoCollectionViewUtilsData::mLastError == VideoCollectionCommon::statusDeleteSucceed);
cleanup();
// No model.
init(false);
connect(this, SIGNAL(testStatusSignal(int, QVariant&)), mTestView, SLOT(handleAsyncStatusSlot(int, QVariant&)));
emit testStatusSignal(1, *variant);
- QVERIFY(VideoCollectionViewUtils::mLastError == 1);
+ QVERIFY(VideoCollectionViewUtilsData::mLastError == 1);
cleanup();
delete variant;
@@ -1176,87 +1181,64 @@
void TestListView::testUpdateSubLabel()
{
init(true);
+ setRowCount(1);
connect(this, SIGNAL(testLayoutChangedSignal()), mTestView, SLOT(layoutChangedSlot()));
connect(this, SIGNAL(testCollectionOpenedSignal(bool, const QString&)), mTestView, SLOT(collectionOpenedSlot(bool, const QString&)));
- mWrapper->getDataModel()->setRowCount(1);
- mTestView->mVideoListWidget->mType = VideoListWidget::EAllVideos;
+ VideoListWidget *videoListWidget = mUiLoader->findWidget<VideoListWidget>(DOCML_NAME_VC_VIDEOLISTWIDGET);
+ VideoListWidget *collectionWidget = mUiLoader->findWidget<VideoListWidget>(DOCML_NAME_VC_COLLECTIONWIDGET);
+ VideoListWidget *collectionContentWidget = mUiLoader->findWidget<VideoListWidget>(DOCML_NAME_VC_COLLECTIONCONTENTWIDGET);
+ mTestView->mCurrentList = videoListWidget;
+ mTestView->mCurrentList->mCurrentLevel = VideoCollectionCommon::ELevelVideos;
emit testLayoutChangedSignal();
-
HbGroupBox* label = mUiLoader->findWidget<HbGroupBox>(DOCML_NAME_VC_HEADINGBANNER);
-
QString returnString = label->heading();
- QString expectedString = "1 videos";
-
+ QString expectedString = "txt_videos_subtitle_ln_videos";
QCOMPARE(returnString, expectedString);
- mTestView->mVideoListWidget->mType = VideoListWidget::EUnknown;
-
+ mTestView->mCurrentList = 0;
+ mTestView->mCurrentList->mCurrentLevel = VideoCollectionCommon::ELevelVideos;
emit testLayoutChangedSignal();
-
returnString = label->heading();
- expectedString = "1 videos";
-
- QCOMPARE(returnString, expectedString);
-
- mTestView->mVideoListWidget->mType = VideoListWidget::ECollections;
-
- emit testLayoutChangedSignal();
-
- returnString = label->heading();
- expectedString = "1 collections";
-
+ expectedString = "txt_videos_subtitle_ln_videos";
QCOMPARE(returnString, expectedString);
- mTestView->mVideoListWidget->mType = VideoListWidget::EUnknown;
-
+ mTestView->mCurrentList = collectionWidget;
+ mTestView->mCurrentList->mCurrentLevel = VideoCollectionCommon::ELevelCategory;
emit testLayoutChangedSignal();
-
returnString = label->heading();
- expectedString = "1 collections";
-
+ expectedString = "txt_videos_subtitle_l1_collections";
QCOMPARE(returnString, expectedString);
- mTestView->mVideoListWidget->mType = VideoListWidget::EDefaultColItems;
-
+ mTestView->mCurrentList = 0;
+ mTestView->mCurrentList->mCurrentLevel = VideoCollectionCommon::ELevelVideos;
emit testLayoutChangedSignal();
-
returnString = label->heading();
- expectedString = " (1)";
-
+ expectedString = "txt_videos_subtitle_l1_collections";
QCOMPARE(returnString, expectedString);
- mTestView->mVideoListWidget->mType = VideoListWidget::EUnknown;
- expectedString = " (1)";
-
+ mTestView->mCurrentList = collectionContentWidget;
+ mTestView->mCurrentList->mCurrentLevel = VideoCollectionCommon::ELevelAlbum;
emit testLayoutChangedSignal();
-
returnString = label->heading();
-
+ expectedString = "txt_videos_subtitle_1_l2";
QCOMPARE(returnString, expectedString);
- mTestView->mVideoListWidget->mType = VideoListWidget::EUserColItems;
-
+ mTestView->mCurrentList = 0;
+ mTestView->mCurrentList->mCurrentLevel = VideoCollectionCommon::ELevelVideos;
+ expectedString = "txt_videos_subtitle_1_l2";
+ emit testLayoutChangedSignal();
+ returnString = label->heading();
+ QCOMPARE(returnString, expectedString);
+
+ mTestView->mCurrentList = collectionContentWidget;
+ mTestView->mCurrentList->mCurrentLevel = VideoCollectionCommon::ELevelAlbum;
emit testCollectionOpenedSignal(true, QString("NAME"));
emit testLayoutChangedSignal();
-
returnString = label->heading();
- expectedString = "NAME (1)";
-
+ expectedString = "txt_videos_subtitle_1_l2";
QCOMPARE(returnString, expectedString);
-
- mTestView->mVideoListWidget->mType = VideoListWidget::EAllVideos;
- VideoSortFilterProxyModel* model = mTestView->mModel;
- mTestView->mModel = 0;
- expectedString = "testtesttesttest";
- label->setHeading(expectedString);
-
- // should not crash.
- emit testLayoutChangedSignal();
-
- // make sure that the heading has not changed.
- QCOMPARE(label->heading(), expectedString);
}
// ---------------------------------------------------------------------------
@@ -1265,49 +1247,28 @@
//
void TestListView::testShowHint()
{
+ VideoHintWidget *hintWidget = 0;
+
init(true);
connect(this, SIGNAL(testLayoutChangedSignal()), mTestView, SLOT(layoutChangedSlot()));
- mWrapper->getDataModel()->setRowCount(1);
+ setRowCount(1);
+ hintWidget = mUiLoader->findWidget<VideoHintWidget>(DOCML_NAME_VC_VIDEOHINTWIDGET);
mTestView->mModelReady = false;
- // tests that the showhint is not called, and currently only way of doing that
- // is to set hint widget visible and check that it is not hidden.
- mTestView->mVideoHintWidget->setVisible(true);
-
+ hintWidget->setVisible(true);
emit testLayoutChangedSignal();
-
- QVERIFY(mTestView->mVideoHintWidget->isVisible());
-
- VideoSortFilterProxyModel* model = mTestView->mModel;
- mTestView->mModel = 0;
- mTestView->mModelReady = true;
-
- emit testLayoutChangedSignal();
-
- QVERIFY(mTestView->mVideoHintWidget->isVisible() == false);
+ QVERIFY(hintWidget->isVisible());
- mTestView->mModel = model;
- mWrapper->getDataModel()->setRowCount(0);
- mTestView->mVideoHintWidget->setVisible(true);
- VideoHintWidget* hint = mTestView->mVideoHintWidget;
- mTestView->mVideoHintWidget = 0;
-
- // should not crash. No other verification possible.
+ VideoSortFilterProxyModel* model = mTestView->mCurrentList->mModel;
+ mTestView->mCurrentList->mModel = 0;
+ mTestView->mModelReady = true;
emit testLayoutChangedSignal();
-
- mTestView->mVideoHintWidget = hint;
- mTestView->mVideoHintWidget->setVisible(false);
-
+ QVERIFY(hintWidget->isVisible() == false);
+
+ setRowCount(1);
+ hintWidget->setVisible(true);
emit testLayoutChangedSignal();
-
- QVERIFY(mTestView->mVideoHintWidget->isVisible());
-
- mWrapper->getDataModel()->setRowCount(1);
- mTestView->mVideoHintWidget->setVisible(true);
-
- emit testLayoutChangedSignal();
-
- QVERIFY(mTestView->mVideoHintWidget->isVisible() == false);
+ QVERIFY(hintWidget->isVisible() == false);
}
// End of file
--- a/videocollection/videocollectionview/tsrc/testlistview/testlistview.pro Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionview/tsrc/testlistview/testlistview.pro Thu Apr 01 23:22:15 2010 +0300
@@ -15,20 +15,21 @@
#
TEMPLATE = app
+
TARGET =
DEPENDPATH += . \
inc \
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
+
+INCLUDEPATH += . \
+ inc \
+ ../../../tsrc/stubs/inc \
+ \ # keep these at bottom so that stubbed headers are taken first
+ ../../../inc \
+ ../../../videocollectionview/inc \
+ ../../../videocollectionwrapper/inc \
+ ../../../../videoplayerapp/videoplayerengine/inc
CONFIG += qtestlib \
Hb \
@@ -40,37 +41,50 @@
-lgdi.dll \
-lxqplugins.dll \
-lmpxviewframeworkqt.dll \
+ -lxqservice.dll \
-lxqserviceutil.dll
-# Input
-HEADERS += stub/inc/hbmessagebox.h \
- inc/testlistview.h \
- stub/inc/videolistwidget.h \
- stub/inc/videohintwidget.h \
- stub/inc/videocollectionviewutils.h \
- stub/inc/videolistselectiondialog.h \
- stub/inc/videosortfilterproxymodel.h \
- stub/inc/videocollectionwrapper.h \
- stub/inc/dummydatamodel.h \
- stub/inc/videocollectionuiloader.h \
- stub/inc/dummyhbmenu.h \
- stub/inc/videoservices.h \
- stub/inc/videoserviceurifetch.h \
- ../../inc/videolistview.h \
-
-SOURCES += stub/src/hbmessagebox.cpp \
- src/testlistview.cpp \
- stub/src/videolistwidget.cpp \
- stub/src/videohintwidget.cpp \
- stub/src/videocollectionviewutils.cpp \
- stub/src/videolistselectiondialog.cpp \
- stub/src/videosortfilterproxymodel.cpp \
- stub/src/videocollectionwrapper.cpp \
- stub/src/dummydatamodel.cpp \
- stub/src/videocollectionuiloader.cpp \
- stub/src/videoservices.cpp \
- stub/src/videoserviceurifetch.cpp \
- ../../src/videolistview.cpp \
+HEADERS += inc/testlistview.h \
+ \ # headers needed in test
+ ../../../videocollectionview/inc/videolistview.h \
+ \ # headers needed in stubs
+ ../../../tsrc/stubs/inc/hbmenu.h \
+ ../../../tsrc/stubs/inc/hbmessagebox.h \
+ ../../../tsrc/stubs/inc/xqserviceutil.h \
+ ../../../tsrc/stubs/inc/xqserviceutilxtra.h \
+ ../../../videocollectionview/inc/videocollectionuiloader.h \
+ ../../../videocollectionview/inc/videolistselectiondialog.h \
+ ../../../videocollectionview/inc/videocollectionviewutils.h \
+ ../../../videocollectionview/inc/videohintwidget.h \
+ ../../../videocollectionview/inc/videolistwidget.h \
+ ../../../videocollectionwrapper/inc/videocollectionwrapper.h \
+ ../../../videocollectionwrapper/inc/videosortfilterproxymodel.h \
+ ../../../videocollectionwrapper/inc/videolistdatamodel.h \
+ ../../../../videoplayerapp/videoplayerengine/inc/videoservices.h \
+ ../../../../videoplayerapp/videoplayerengine/inc/videoserviceurifetch.h
+
+SOURCES += src/testlistview.cpp \
+ \ # sources needed in test
+ ../../../videocollectionview/src/videolistview.cpp \
+ \ # sources needed in stubs
+ ../../../tsrc/stubs/src/hbmessagebox.cpp \
+ ../../../tsrc/stubs/src/hbmenu.cpp \
+ ../../../tsrc/stubs/src/hbwidget.cpp \
+ ../../../tsrc/stubs/src/hbaction.cpp \
+ ../../../tsrc/stubs/src/hbdialog.cpp \
+ ../../../tsrc/stubs/src/hblistview.cpp \
+ ../../../tsrc/stubs/src/hbscrollbar.cpp \
+ ../../../tsrc/stubs/src/xqserviceutilxtra.cpp \
+ ../../../tsrc/stubs/src/videocollectionuiloader.cpp \
+ ../../../tsrc/stubs/src/videolistselectiondialog.cpp \
+ ../../../tsrc/stubs/src/videocollectionviewutils.cpp \
+ ../../../tsrc/stubs/src/videohintwidget.cpp \
+ ../../../tsrc/stubs/src/videolistwidget.cpp \
+ ../../../tsrc/stubs/src/videocollectionwrapper.cpp \
+ ../../../tsrc/stubs/src/videosortfilterproxymodel.cpp \
+ ../../../tsrc/stubs/src/videolistdatamodel.cpp \
+ ../../../tsrc/stubs/src/videoservices.cpp \
+ ../../../tsrc/stubs/src/videoserviceurifetch.cpp
RESOURCES += ../../data/videocollectionview.qrc
--- a/videocollection/videocollectionview/tsrc/testlistwidget/inc/testlistwidget.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionview/tsrc/testlistwidget/inc/testlistwidget.h Thu Apr 01 23:22:15 2010 +0300
@@ -31,6 +31,7 @@
class HbMainWindow;
class ListWidgetTester;
class VideoServices;
+class VideoListDataModel;
class TestListWidget : public QObject
{
@@ -38,6 +39,7 @@
public:
+ void setRowCount(int count, int type = 0, VideoListDataModel *model = 0);
// test functions for the test framework
private slots:
@@ -71,9 +73,9 @@
void testDeactivate();
/**
- * verifies getType
+ * verifies getLevel
*/
- void testGetType();
+ void testGetLevel();
/**
* verifies getModel
@@ -158,24 +160,12 @@
void testSignal(const QPointF&);
private:
-
-
/**
* object under test, ListWidgetTester is inherited from VideoListWidget
*/
ListWidgetTester* mTestWidget;
/**
- * dummy model
- */
- DummyDataModel* mDummyModel;
-
- /**
- * dummy proxy model
- */
- VideoSortFilterProxyModel *mDummyProxyModel;
-
- /**
* dummy view
*/
HbView *mTempView;
--- a/videocollection/videocollectionview/tsrc/testlistwidget/src/testlistwidget.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionview/tsrc/testlistwidget/src/testlistwidget.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -15,21 +15,30 @@
*
*/
-#include <QMap>
+#include <qmap.h>
+#include <vcxmyvideosdefs.h>
+#include <mpxhbvideocommondefs.h>
+
+#include "hbglobal.h"
#include "hblistview.h"
#include "hbview.h"
-
#include "videoservices.h"
#include "videosortfilterproxymodel.h"
-#include "dummydatamodel.h"
#include "hbscrollbar.h"
#include "hbmenu.h"
#include "hbmessagebox.h"
#include "hbinstance.h"
#include "hbmainwindow.h"
-#include "mpxhbvideocommondefs.h"
#include "videothumbnaildata.h"
#include "videocollectioncommon.h"
+#include "videocollectionwrapper.h"
+#include "videocollectionwrapperdata.h"
+#include "hbmenudata.h"
+#include "videothumbnailtestdata.h"
+#include "videolistdatamodel.h"
+#include "videolistdatamodeldata.h"
+#include "videosortfilterproxymodeldata.h"
+#include "hbmessageboxdata.h"
#include "testlistwidget.h"
@@ -48,8 +57,8 @@
/**
* constructor
*/
- ListWidgetTester(HbView *parent) :
- VideoListWidget(parent)
+ ListWidgetTester(VideoCollectionUiLoader* uiLoader, HbView *parent) :
+ VideoListWidget(uiLoader, parent)
{
}
@@ -75,19 +84,50 @@
// main
// ---------------------------------------------------------------------------
//
-int main(int /*argc*/, char *argv[])
+int main(int argc, char *argv[])
{
-
TestListWidget tv;
- char *pass[3];
- pass[0] = argv[0];
- pass[1] = "-o";
- pass[2] = "c:\\data\\testlistwidget.txt";
+ 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\\testlistwidget.txt";
+ res = QTest::qExec(&tv, 3, pass);
+ }
+
+ return res;
+}
- int res = QTest::qExec(&tv, 3, pass);
-
- return res;
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::setRowCount(int count, int type, VideoListDataModel *model)
+{
+ if (!model)
+ {
+ VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
+ VideoSortFilterProxyModel *model = wrapper.getModel(type);
+ QVERIFY(model);
+
+ VideoListDataModel *sourceModel = qobject_cast<VideoListDataModel*>(model->sourceModel());
+ QVERIFY(sourceModel);
+
+ VideoListDataModelData::setRowCount(*sourceModel, count);
+ sourceModel->initialize();
+ }
+ else
+ {
+ VideoListDataModelData::setRowCount(*model, count);
+ model->initialize();
+ }
}
// ---------------------------------------------------------------------------
@@ -98,11 +138,8 @@
{
mDummyMainWnd = new HbMainWindow;
mTempView = new HbView;
- mDummyModel = new DummyDataModel();
- mDummyProxyModel = new VideoSortFilterProxyModel();
- mDummyProxyModel->setSourceModel(mDummyModel);
- mTestWidget = new ListWidgetTester(mTempView);
+ mTestWidget = new ListWidgetTester(0, mTempView);
}
// ---------------------------------------------------------------------------
@@ -114,12 +151,6 @@
delete mTestWidget;
mTestWidget = 0;
- delete mDummyProxyModel;
- mDummyProxyModel = 0;
-
- delete mDummyModel;
- mDummyModel = 0;
-
delete mTempView;
mTempView = 0;
@@ -127,6 +158,13 @@
mDummyMainWnd = 0;
hbInstance->mWindowses.clear();
+
+ VideoCollectionWrapperData::reset();
+ HbMenuData::reset();
+ VideoThumbnailTestData::reset();
+ VideoListDataModelData::reset();
+ VideoSortFilterProxyModelData::reset();
+ HbMessageBoxData::reset();
}
// ---------------------------------------------------------------------------
@@ -135,19 +173,22 @@
//
void TestListWidget::testInitialize()
{
+ VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
+ VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionWrapper::EAllVideos);
+
// no prototype
HbListView::mReturnNullPrototype = true;
- QVERIFY(mTestWidget->initialize(*mDummyProxyModel) == -1);
+ QVERIFY(mTestWidget->initialize(*model) == -1);
HbListView::mReturnNullPrototype = false;
// no scroll bar
HbListView::mVScrollBarIsNull = true;
- QVERIFY(mTestWidget->initialize(*mDummyProxyModel) == -1);
+ QVERIFY(mTestWidget->initialize(*model) == -1);
// succeed case ( new operator cannot be stubbed)
HbListView::mVScrollBarIsNull = false;
HbListView::mReturnNullPrototype = false;
- QVERIFY(mTestWidget->initialize(*mDummyProxyModel) == 0);
+ QVERIFY(mTestWidget->initialize(*model) == 0);
QCOMPARE(HbListView::mLatestrecycling, true);
QCOMPARE(HbListView::mLatestClamping, HbScrollArea::BounceBackClamping);
QCOMPARE(HbListView::mLatestScrolling, HbScrollArea::PanOrFlick);
@@ -156,7 +197,7 @@
QCOMPARE(HbListView::mLatestVisibility, false);
QCOMPARE(HbListView::mLatestEnableValue, false);
QCOMPARE(HbScrollBar::mInteractive, true);
- QVERIFY(mTestWidget->mModel == mDummyProxyModel);
+ QVERIFY(mTestWidget->mModel == model);
QVERIFY(mTestWidget->mVideoServices == 0);
QVERIFY(mTestWidget->mIsService == false);
}
@@ -167,35 +208,37 @@
//
void TestListWidget::testActivate()
{
+ VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
+ VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionWrapper::EAllVideos);
+
// no model: fails
- VideoSortFilterProxyModel *nullModel = 0;
QVERIFY(mTestWidget->activate() == -1);
- QCOMPARE(HbMenu::mEnabledSetted, false);
+ QCOMPARE(HbMenuData::mEnabledSetted, false);
QCOMPARE(HbListView::mLatestVisibility, false);
- QCOMPARE(HbListView::mLatestModel, nullModel);
- QCOMPARE(VideoThumbnailData::mBackgroundThumbnailFetchingEnabled, 1);
+ QVERIFY(!HbListView::mLatestModel);
+ QCOMPARE(VideoThumbnailTestData::mBackgroundThumbnailFetchingEnabled, 1);
// no context menu, model exist: succeeds
- QVERIFY(mTestWidget->initialize(*mDummyProxyModel) == 0);
+ QVERIFY(mTestWidget->initialize(*model) == 0);
QVERIFY(mTestWidget->activate() == 0);
- QCOMPARE(HbMenu::mEnabledSetted, false);
+ QCOMPARE(HbMenuData::mEnabledSetted, false);
QCOMPARE(HbListView::mLatestVisibility, true);
- QCOMPARE(HbListView::mLatestModel, mDummyProxyModel);
- QCOMPARE(VideoThumbnailData::mBackgroundThumbnailFetchingEnabled, 1);
+ QCOMPARE(HbListView::mLatestModel, model);
+ QCOMPARE(VideoThumbnailTestData::mBackgroundThumbnailFetchingEnabled, 1);
- HbMenu::mEnabledSetted = true;
+ HbMenuData::mEnabledSetted = true;
HbListView::mLatestVisibility = false;
HbListView::mLatestEnableValue = false;
HbListView::mLatestModel = 0;
- VideoThumbnailData::mBackgroundThumbnailFetchingEnabled = 0;
+ VideoThumbnailTestData::mBackgroundThumbnailFetchingEnabled = 0;
// context menu exists, succeed (signal connecting failure cannot be tested here)
mTestWidget->mContextMenu = new HbMenu;
QVERIFY(mTestWidget->activate() == 0);
- QCOMPARE(HbMenu::mEnabledSetted, true);
+ QCOMPARE(HbMenuData::mEnabledSetted, true);
QCOMPARE(HbListView::mLatestVisibility, true);
- QCOMPARE(HbListView::mLatestModel, mDummyProxyModel);
- QCOMPARE(VideoThumbnailData::mBackgroundThumbnailFetchingEnabled, 1);
+ QCOMPARE(HbListView::mLatestModel, model);
+ QCOMPARE(VideoThumbnailTestData::mBackgroundThumbnailFetchingEnabled, 1);
}
// ---------------------------------------------------------------------------
@@ -204,11 +247,14 @@
//
void TestListWidget::testDeactivate()
{
- HbMenu::mEnabledSetted = false;
+ VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
+ VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionWrapper::EAllVideos);
+
+ HbMenuData::mEnabledSetted = false;
HbListView::mLatestVisibility = false;
HbListView::mLatestEnableValue = false;
HbListView::mLatestModel = 0;
- VideoThumbnailData::mBackgroundThumbnailFetchingEnabled = 0;
+ VideoThumbnailTestData::mBackgroundThumbnailFetchingEnabled = 0;
VideoSortFilterProxyModel *nullModel = 0;
mTestWidget->activate();
@@ -217,16 +263,16 @@
mTestWidget->deactivate();
QCOMPARE(HbListView::mLatestVisibility, false);
QCOMPARE(HbListView::mLatestModel, nullModel);
- QCOMPARE(VideoThumbnailData::mBackgroundThumbnailFetchingEnabled, 0);
+ QCOMPARE(VideoThumbnailTestData::mBackgroundThumbnailFetchingEnabled, 0);
// context menu exists and activated with model
mTestWidget->mContextMenu = new HbMenu;
- QVERIFY(mTestWidget->initialize(*mDummyProxyModel) == 0);
+ QVERIFY(mTestWidget->initialize(*model) == 0);
mTestWidget->activate();
mTestWidget->deactivate();
QCOMPARE(HbListView::mLatestVisibility, true);
- QCOMPARE(HbListView::mLatestModel, mDummyProxyModel);
- QCOMPARE(VideoThumbnailData::mBackgroundThumbnailFetchingEnabled, 0);
+ QCOMPARE(HbListView::mLatestModel, model);
+ QCOMPARE(VideoThumbnailTestData::mBackgroundThumbnailFetchingEnabled, 0);
}
@@ -234,45 +280,15 @@
// testGetLevel
// ---------------------------------------------------------------------------
//
-void TestListWidget::testGetType()
+void TestListWidget::testGetLevel()
{
- mTestWidget->initialize(*mDummyProxyModel);
-
-
- // level != ELevelVideos and role != ELevelCategory
- mTestWidget->mCurrentLevel = (VideoListWidget::TVideoListLevel)0;
- QCOMPARE(mTestWidget->getType(), VideoListWidget::EUnknown);
-
- // level == ELevelVideos
- mTestWidget->mCurrentLevel = VideoListWidget::ELevelVideos;
- QCOMPARE(mTestWidget->getType(), VideoListWidget::EAllVideos);
-
- // level == ELevelCategory and mLastOpenItemId == TMPXItemId::InvalidId
- mTestWidget->mCurrentLevel = VideoListWidget::ELevelCategory;
- mTestWidget->mLastOpenItemId = TMPXItemId::InvalidId();
- QCOMPARE(mTestWidget->getType(), VideoListWidget::ECollections);
+ VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
+ VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionWrapper::EAllVideos);
+
+ mTestWidget->initialize(*model);
- // level == ELevelCategory and mLastOpenItemId.iId2 == KVcxMvcCategoryIdDownloads
- mTestWidget->mLastOpenItemId.iId2 = KVcxMvcCategoryIdDownloads;
- mTestWidget->mCurrentLevel = VideoListWidget::ELevelCategory;
- mDummyMainWnd->mSoftKeyAction = mTestWidget->mSecSkAction;
- QCOMPARE(mTestWidget->getType(), VideoListWidget::EDefaultColItems);
-
- // level == ELevelCategory and mLastOpenItemId.iId2 == KVcxMvcCategoryIdCaptured
- mTestWidget->mLastOpenItemId.iId2 = KVcxMvcCategoryIdDownloads;
- mTestWidget->mCurrentLevel = VideoListWidget::ELevelCategory;
- mDummyMainWnd->mSoftKeyAction = mTestWidget->mSecSkAction;
- QCOMPARE(mTestWidget->getType(), VideoListWidget::EDefaultColItems);
-
-
- // level == ELevelCategory and mLastOpenItemId.iId2 is neither above
- mTestWidget->mLastOpenItemId.iId2 = 0;
- mTestWidget->mCurrentLevel = VideoListWidget::ELevelCategory;
- mDummyMainWnd->mSoftKeyAction = mTestWidget->mSecSkAction;
- QCOMPARE(mTestWidget->getType(), VideoListWidget::EUserColItems);
-
-
-
+ mTestWidget->mCurrentLevel = VideoCollectionCommon::ELevelVideos;
+ QCOMPARE(mTestWidget->getLevel(), VideoCollectionCommon::ELevelVideos);
}
// ---------------------------------------------------------------------------
@@ -281,13 +297,16 @@
//
void TestListWidget::testGetModel()
{
+ VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
+ VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionWrapper::EAllVideos);
+
QVERIFY(&(mTestWidget->getModel()) == 0);
HbListView::mVScrollBarIsNull = false;
HbListView::mReturnNullPrototype = false;
- mTestWidget->initialize(*mDummyProxyModel);
+ mTestWidget->initialize(*model);
- QVERIFY(&(mTestWidget->getModel()) == mDummyProxyModel);
+ QVERIFY(&(mTestWidget->getModel()) == model);
}
// ---------------------------------------------------------------------------
@@ -296,25 +315,28 @@
//
void TestListWidget::testEmitActivated()
{
+ VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
+ VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionWrapper::EAllVideos);
+
QSignalSpy spysignal(mTestWidget, SIGNAL(collectionOpened(bool, const QString&)));
- mTestWidget->initialize(*mDummyProxyModel);
+ mTestWidget->initialize(*model);
mTestWidget->activate();
hbInstance->mWindowses.append(mDummyMainWnd);
QVariant data = QString("test");
// correct data to index 0
- mDummyModel->setData( Qt::DisplayRole, data);
- mDummyModel->setRowCount(1);
- mDummyProxyModel->mItemIds.append(TMPXItemId(0,0));
+ VideoListDataModelData::setData( Qt::DisplayRole, data);
+ setRowCount(1);
+ VideoSortFilterProxyModelData::mItemIds.append(TMPXItemId(0,0));
- QModelIndex fetchIndex = mDummyProxyModel->index(0, 0, QModelIndex());
+ QModelIndex fetchIndex = model->index(0, 0, QModelIndex());
// selection mode == HbAbstractItemView::MultiSelection
HbListView::mSelectionMode = HbAbstractItemView::MultiSelection;
mTestWidget->callEmiteActivated(fetchIndex);
QVERIFY(spysignal.count() == 0);
QVERIFY(mDummyMainWnd->mSoftKeyAction == 0);
- QVERIFY(!VideoSortFilterProxyModel::mLastIndex.isValid());
+ QVERIFY(!VideoSortFilterProxyModelData::mLastIndex.isValid());
// modelIndex is not valid
HbListView::mSelectionMode = HbAbstractItemView::NoSelection;
@@ -322,51 +344,43 @@
mTestWidget->callEmiteActivated(fetchIndex);
QVERIFY(spysignal.count() == 0);
QVERIFY(mDummyMainWnd->mSoftKeyAction == 0);
- QVERIFY(!VideoSortFilterProxyModel::mLastIndex.isValid());
- QVERIFY(mTestWidget->mLastOpenItemId == TMPXItemId::InvalidId());
-
+ QVERIFY(!VideoSortFilterProxyModelData::mLastIndex.isValid());
+
// current level is not ELevelCategory
- fetchIndex = mDummyProxyModel->index(0, 0, QModelIndex());
+ fetchIndex = model->index(0, 0, QModelIndex());
mTestWidget->callEmiteActivated(fetchIndex);
QVERIFY(spysignal.count() == 0);
- QVERIFY(VideoSortFilterProxyModel::mLastIndex.row() == 0);
- QVERIFY(mTestWidget->mLastOpenItemId == TMPXItemId::InvalidId());
- VideoSortFilterProxyModel::mLastIndex = QModelIndex();
+ QVERIFY(VideoSortFilterProxyModelData::mLastIndex.row() == 0);
+ VideoSortFilterProxyModelData::mLastIndex = QModelIndex();
// current level is ELevelCategory
- mTestWidget->mCurrentLevel= VideoListWidget::ELevelCategory;
- mTestWidget->mLastOpenItemId = TMPXItemId();
-
+ mTestWidget->mCurrentLevel= VideoCollectionCommon::ELevelCategory;
+
// -> getType() != ECollections
- mTestWidget->mLastOpenItemId.iId2 = 0;
mTestWidget->callEmiteActivated(fetchIndex);
QVERIFY(spysignal.count() == 0);
QVERIFY(mDummyMainWnd->mSoftKeyAction == 0);
- QVERIFY(VideoSortFilterProxyModel::mLastIndex.row() == 0);
- QVERIFY(mTestWidget->mLastOpenItemId != TMPXItemId::InvalidId());
- VideoSortFilterProxyModel::mLastIndex = QModelIndex();
+ QVERIFY(VideoSortFilterProxyModelData::mLastIndex.row() == 0);
+ VideoSortFilterProxyModelData::mLastIndex = QModelIndex();
// -> getType() == ECollections
- mTestWidget->mLastOpenItemId = TMPXItemId::InvalidId();
-
+
// --> variant is not valid (invalid data at row index 1)
- fetchIndex = mDummyProxyModel->index(1, 0, QModelIndex());
+ fetchIndex = model->index(1, 0, QModelIndex());
mTestWidget->callEmiteActivated(fetchIndex);
QVERIFY(spysignal.count() == 0);
QVERIFY(mDummyMainWnd->mSoftKeyAction == 0);
- QVERIFY(VideoSortFilterProxyModel::mLastIndex.row() == 1);
- QVERIFY(mTestWidget->mLastOpenItemId == TMPXItemId::InvalidId());
- VideoSortFilterProxyModel::mLastIndex = QModelIndex();
-
+ QVERIFY(VideoSortFilterProxyModelData::mLastIndex.row() == 1);
+ VideoSortFilterProxyModelData::mLastIndex = QModelIndex();
+
// --> variant is valid (correct data at index 0),5 collectionOpened -signal should be emitted
mDummyMainWnd->mSoftKeyAction = 0;
- fetchIndex = mDummyProxyModel->index(0, 0, QModelIndex());
+ fetchIndex = model->index(0, 0, QModelIndex());
mTestWidget->callEmiteActivated(fetchIndex);
QVERIFY(spysignal.count() == 1);
- QVERIFY(mDummyMainWnd->mSoftKeyAction == mTestWidget->mSecSkAction);
- QVERIFY(VideoSortFilterProxyModel::mLastIndex.row() == 0);
- QVERIFY(mTestWidget->mLastOpenItemId != TMPXItemId::InvalidId());
- VideoSortFilterProxyModel::mLastIndex = QModelIndex();
+// QVERIFY(mDummyMainWnd->mSoftKeyAction == mTestWidget->mSecSkAction);
+ QVERIFY(VideoSortFilterProxyModelData::mLastIndex.row() == 0);
+ VideoSortFilterProxyModelData::mLastIndex = QModelIndex();
hbInstance->mWindowses.clear();
}
@@ -378,103 +392,106 @@
//
void TestListWidget::testLongPressGesture()
{
+ VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
+ VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionWrapper::EAllVideos);
+
QVariant data = QString("test");
// correct data to index 0
- mDummyModel->setData( Qt::DisplayRole, data);
- mDummyModel->setRowCount(1);
+ VideoListDataModelData::setData( Qt::DisplayRole, data);
+ setRowCount(1);
QPointF point(1,1);
QSignalSpy spysignal(mTestWidget, SIGNAL(command(int)));
- mTestWidget->initialize(*mDummyProxyModel);
+ mTestWidget->initialize(*model);
hbInstance->mWindowses.append(mDummyMainWnd);
HbListView::mSelectionMode = HbAbstractItemView::MultiSelection;
// mDetailsReady is false
mTestWidget->callLongPressGesture(point);
QVERIFY(spysignal.count() == 1);
- QVERIFY(HbMenu::mExecPoint != point);
+ QVERIFY(HbMenuData::mExecPoint != point);
QVERIFY(HbListView::mLongPressedPoint != point);
spysignal.clear();
// multiselection is on
mTestWidget->callLongPressGesture(point);
QVERIFY(spysignal.count() == 0);
- QVERIFY(HbMenu::mExecPoint != point);
+ QVERIFY(HbMenuData::mExecPoint != point);
// current index is invalid
HbListView::mSelectionMode = HbAbstractItemView::NoSelection;
HbListView::mCurrentIndex = QModelIndex();
mTestWidget->callLongPressGesture(point);
QVERIFY(spysignal.count() == 0);
- QVERIFY(HbMenu::mExecPoint != point);
+ QVERIFY(HbMenuData::mExecPoint != point);
QVERIFY(HbListView::mLongPressedPoint == point);
// current index is valid
- HbListView::mCurrentIndex = mDummyProxyModel->index(0, 0, QModelIndex());
+ HbListView::mCurrentIndex = model->index(0, 0, QModelIndex());
// model is == 0
VideoSortFilterProxyModel *tmp = mTestWidget->mModel;
mTestWidget->mModel = 0;
mTestWidget->callLongPressGesture(point);
QVERIFY(spysignal.count() == 0);
- QVERIFY(HbMenu::mExecPoint != point);
+ QVERIFY(HbMenuData::mExecPoint != point);
QVERIFY(HbListView::mLongPressedPoint == point);
mTestWidget->mModel = tmp;
// mCurrentLevel != ELevelCategory
- mTestWidget->mCurrentLevel = VideoListWidget::ELevelVideos;
+ mTestWidget->mCurrentLevel = VideoCollectionCommon::ELevelVideos;
mTestWidget->callLongPressGesture(point);
QVERIFY(spysignal.count() == 0);
- QVERIFY(HbMenu::mExecPoint == point);
+ QVERIFY(HbMenuData::mExecPoint == point);
QVERIFY(HbListView::mLongPressedPoint == point);
- HbMenu::mExecPoint = QPointF();
+ HbMenuData::mExecPoint = QPointF();
// mCurrentLevel == ELevelCategory
- mTestWidget->mCurrentLevel = VideoListWidget::ELevelCategory;
+ mTestWidget->mCurrentLevel = VideoCollectionCommon::ELevelCategory;
// --> mpxId.iId2 != 1
TMPXItemId itemId;
itemId.iId2 = 0;
- mDummyProxyModel->mItemIds.append(itemId);
+ VideoSortFilterProxyModelData::mItemIds.append(itemId);
mTestWidget->callLongPressGesture(point);
QVERIFY(spysignal.count() == 0);
- QVERIFY(HbMenu::mExecPoint == point);
+ QVERIFY(HbMenuData::mExecPoint == point);
QVERIFY(HbListView::mLongPressedPoint == point);
- HbMenu::mExecPoint = QPointF();
- mDummyProxyModel->mItemIds.clear();
+ HbMenuData::mExecPoint = QPointF();
+ VideoSortFilterProxyModelData::mItemIds.clear();
// --> mpxId.iId2 == 1
itemId.iId2 = 1;
// ---> mpxId.iId1 == KVcxMvcCategoryIdDownloads
itemId.iId1 = KVcxMvcCategoryIdDownloads;
- mDummyProxyModel->mItemIds.append(itemId);
+ VideoSortFilterProxyModelData::mItemIds.append(itemId);
mTestWidget->callLongPressGesture(point);
QVERIFY(spysignal.count() == 0);
- QVERIFY(HbMenu::mExecPoint == point);
+ QVERIFY(HbMenuData::mExecPoint == point);
QVERIFY(HbListView::mLongPressedPoint == point);
- HbMenu::mExecPoint = QPointF();
- mDummyProxyModel->mItemIds.clear();
+ HbMenuData::mExecPoint = QPointF();
+ VideoSortFilterProxyModelData::mItemIds.clear();
// ---> mpxId.iId1 == KVcxMvcCategoryIdCaptured
itemId.iId1 = KVcxMvcCategoryIdCaptured;
- mDummyProxyModel->mItemIds.append(itemId);
+ VideoSortFilterProxyModelData::mItemIds.append(itemId);
mTestWidget->callLongPressGesture(point);
QVERIFY(spysignal.count() == 0);
- QVERIFY(HbMenu::mExecPoint == point);
+ QVERIFY(HbMenuData::mExecPoint == point);
QVERIFY(HbListView::mLongPressedPoint == point);
- HbMenu::mExecPoint = QPointF();
- mDummyProxyModel->mItemIds.clear();
+ HbMenuData::mExecPoint = QPointF();
+ VideoSortFilterProxyModelData::mItemIds.clear();
// ---> mpxId.iId1 != KVcxMvcCategoryIdDownloads and mpxId.iId1 != KVcxMvcCategoryIdCaptured
itemId.iId1 = KVcxMvcCategoryIdAll;
- mDummyProxyModel->mItemIds.append(itemId);
+ VideoSortFilterProxyModelData::mItemIds.append(itemId);
mTestWidget->callLongPressGesture(point);
QVERIFY(spysignal.count() == 0);
- QVERIFY(HbMenu::mExecPoint == point);
+ QVERIFY(HbMenuData::mExecPoint == point);
QVERIFY(HbListView::mLongPressedPoint == point);
- HbMenu::mExecPoint = QPointF();
+ HbMenuData::mExecPoint = QPointF();
// context menu setup fails, due invalid amount of correct actions
QMap<VideoListWidget::TContextActionIds, HbAction*>::iterator iter = mTestWidget->mContextMenuActions.begin();
@@ -483,7 +500,7 @@
iter.value() = nullAction;
mTestWidget->callLongPressGesture(point);
QVERIFY(spysignal.count() == 0);
- QVERIFY(HbMenu::mExecPoint != point);
+ QVERIFY(HbMenuData::mExecPoint != point);
QVERIFY(HbListView::mLongPressedPoint == point);
}
@@ -494,14 +511,18 @@
//
void TestListWidget::testSetContextMenu()
{
- mDummyProxyModel->mItemIds.clear();
- mTestWidget->initialize(*mDummyProxyModel);
+ VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
+ VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionWrapper::EAllVideos);
+ VideoListDataModel *sourceModel = qobject_cast<VideoListDataModel*>(model->sourceModel());
+
+ VideoSortFilterProxyModelData::mItemIds.clear();
+ mTestWidget->initialize(*model);
hbInstance->mWindowses.append(mDummyMainWnd);
TMPXItemId itemId;
QPointF point(1,1);
itemId.iId2 = 0;
- mDummyProxyModel->mItemIds.append(itemId);
+ VideoSortFilterProxyModelData::mItemIds.append(itemId);
// no context menu
delete mTestWidget->mContextMenu;
@@ -509,7 +530,7 @@
// mCurrentLevel == ELevelVideos
int visibleCount = 0;
- mTestWidget->mCurrentLevel = VideoListWidget::ELevelVideos;
+ mTestWidget->mCurrentLevel = VideoCollectionCommon::ELevelVideos;
mTestWidget->callLongPressGesture(point);
QMap<VideoListWidget::TContextActionIds, HbAction*>::iterator iter = mTestWidget->mContextMenuActions.begin();
@@ -535,7 +556,7 @@
QVERIFY(mTestWidget->mContextMenuActions.count() == 0);
// mCurrentLevel == ELevelCategory
- mTestWidget->mCurrentLevel = VideoListWidget::ELevelCategory;
+ mTestWidget->mCurrentLevel = VideoCollectionCommon::ELevelCategory;
// --> getType returns ECollections
// ---> default collection flag is on
mTestWidget->callLongPressGesture(point);
@@ -553,10 +574,10 @@
QVERIFY(visibleCount == 0);
// ---> default collection flag is off
- mDummyProxyModel->mItemIds.clear();
+ VideoSortFilterProxyModelData::mItemIds.clear();
itemId.iId2 = 1;
itemId.iId1 = KVcxMvcCategoryIdAll;
- mDummyProxyModel->mItemIds.append(itemId);
+ VideoSortFilterProxyModelData::mItemIds.append(itemId);
mTestWidget->callLongPressGesture(point);
iter = mTestWidget->mContextMenuActions.begin();
QVERIFY(iter != mTestWidget->mContextMenuActions.end());
@@ -572,7 +593,6 @@
QVERIFY(visibleCount == 4);
// --> getType returns EUserColItems
- mTestWidget->mLastOpenItemId.iId2 = 0;
mTestWidget->callLongPressGesture(point);
iter = mTestWidget->mContextMenuActions.begin();
QVERIFY(iter != mTestWidget->mContextMenuActions.end());
@@ -588,7 +608,7 @@
QVERIFY(visibleCount == 4);
// --> getType returns EUnknow
- mTestWidget->mCurrentLevel = (VideoListWidget::TVideoListLevel)0;
+ mTestWidget->mCurrentLevel = (VideoCollectionCommon::TCollectionLevels)0;
mTestWidget->callLongPressGesture(point);
iter = mTestWidget->mContextMenuActions.begin();
QVERIFY(iter != mTestWidget->mContextMenuActions.end());
@@ -610,12 +630,16 @@
//
void TestListWidget::testShareItemSlot()
{
+ VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
+ VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionWrapper::EAllVideos);
+ VideoListDataModel *sourceModel = qobject_cast<VideoListDataModel*>(model->sourceModel());
+
// nothing to test yet
- HbMessageBox::mLatestTxt = "";
- mTestWidget->initialize(*mDummyProxyModel);
+ HbMessageBoxData::mLatestTxt = "";
+ mTestWidget->initialize(*model);
connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(shareItemSlot()));
emit testSignal();
- QVERIFY(!HbMessageBox::mLatestTxt.isEmpty());
+ QVERIFY(!HbMessageBoxData::mLatestTxt.isEmpty());
disconnect(this, SIGNAL(testSignal()), mTestWidget, SLOT(shareItemSlot()));
}
@@ -626,63 +650,64 @@
//
void TestListWidget::testDeleteItemSlot()
{
- HbMessageBox::mLatestTxt = "";
- VideoSortFilterProxyModel::mLastIndex = QModelIndex();
- mDummyModel->reset();
- mTestWidget->initialize(*mDummyProxyModel);
+ VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
+ VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionWrapper::EAllVideos);
+
+ HbMessageBoxData::mLatestTxt = "";
+ VideoSortFilterProxyModelData::mLastIndex = QModelIndex();
+ mTestWidget->initialize(*model);
connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(deleteItemSlot()));
// no model
VideoSortFilterProxyModel *tmp = mTestWidget->mModel;
mTestWidget->mModel = 0;
emit testSignal();
- QVERIFY(mDummyModel->dataAccessCount() == 0);
- QVERIFY(HbMessageBox::mLatestTxt.isEmpty());
- QVERIFY(!VideoSortFilterProxyModel::mLastIndex.isValid());
- mDummyModel->reset();
+ QVERIFY(VideoListDataModelData::dataAccessCount() == 0);
+ QVERIFY(HbMessageBoxData::mLatestTxt.isEmpty());
+ QVERIFY(!VideoSortFilterProxyModelData::mLastIndex.isValid());
+ setRowCount(1);
mTestWidget->mModel = tmp;
// current index is invalid
mTestWidget->mCurrentIndex = QModelIndex();
emit testSignal();
- QVERIFY(mDummyModel->dataAccessCount() == 1);
- QVERIFY(HbMessageBox::mLatestTxt.isEmpty());
- QVERIFY(!VideoSortFilterProxyModel::mLastIndex.isValid());
- mDummyModel->reset();
+ QVERIFY(VideoListDataModelData::dataAccessCount() == 1);
+ QVERIFY(HbMessageBoxData::mLatestTxt.isEmpty());
+ QVERIFY(!VideoSortFilterProxyModelData::mLastIndex.isValid());
+ setRowCount(0);
// data fetched from item is invalid
- mDummyModel->setRowCount(1);
- mTestWidget->mCurrentIndex = mDummyProxyModel->index(0, 0, QModelIndex());
+ setRowCount(1);
+ mTestWidget->mCurrentIndex = model->index(0, 0, QModelIndex());
emit testSignal();
- QVERIFY(mDummyModel->dataAccessCount() == 1);
- QVERIFY(HbMessageBox::mLatestTxt.isEmpty());
- QVERIFY(!VideoSortFilterProxyModel::mLastIndex.isValid());
- mDummyModel->reset();
+ QVERIFY(VideoListDataModelData::dataAccessCount() == 1);
+ QVERIFY(HbMessageBoxData::mLatestTxt.isEmpty());
+ QVERIFY(!VideoSortFilterProxyModelData::mLastIndex.isValid());
+ setRowCount(0);
// data is valid
- mDummyModel->setRowCount(1);
+ setRowCount(1);
QVariant data = QString("test");
- mDummyModel->setData( Qt::DisplayRole, data);
- mTestWidget->mCurrentIndex = mDummyProxyModel->index(0, 0, QModelIndex());
+ VideoListDataModelData::setData( Qt::DisplayRole, data);
+ mTestWidget->mCurrentIndex = model->index(0, 0, QModelIndex());
// messagebox question returns false
- HbMessageBox::mQuestionReturnValue = false;
+ HbMessageBoxData::mQuestionReturnValue = false;
emit testSignal();
- QVERIFY(mDummyModel->dataAccessCount() == 1);
- QVERIFY(!HbMessageBox::mLatestTxt.isEmpty());
- QVERIFY(!VideoSortFilterProxyModel::mLastIndex.isValid());;
- HbMessageBox::mLatestTxt = "";
- mDummyModel->reset();
- mDummyModel->setRowCount(1);
+ QVERIFY(VideoListDataModelData::dataAccessCount() == 1);
+ QVERIFY(!HbMessageBoxData::mLatestTxt.isEmpty());
+ QVERIFY(!VideoSortFilterProxyModelData::mLastIndex.isValid());;
+ HbMessageBoxData::mLatestTxt = "";
+ setRowCount(1);
data = QString("test");
- mDummyModel->setData( Qt::DisplayRole, data);
+ VideoListDataModelData::setData( Qt::DisplayRole, data);
// messagebox question returns true
- HbMessageBox::mQuestionReturnValue = true;
+ HbMessageBoxData::mQuestionReturnValue = true;
emit testSignal();
- QVERIFY(mDummyModel->dataAccessCount() == 1);
- QVERIFY(!HbMessageBox::mLatestTxt.isEmpty());
- QVERIFY(VideoSortFilterProxyModel::mLastIndex.row() == 0);
+ QVERIFY(VideoListDataModelData::dataAccessCount() == 1);
+ QVERIFY(!HbMessageBoxData::mLatestTxt.isEmpty());
+ QVERIFY(VideoSortFilterProxyModelData::mLastIndex.row() == 0);
disconnect(this, SIGNAL(testSignal()), mTestWidget, SLOT(deleteItemSlot()));
}
@@ -693,12 +718,15 @@
//
void TestListWidget::testRenameSlot()
{
+ VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
+ VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionWrapper::EAllVideos);
+
// nothing to test yet
- HbMessageBox::mLatestTxt = "";
- mTestWidget->initialize(*mDummyProxyModel);
+ HbMessageBoxData::mLatestTxt = "";
+ mTestWidget->initialize(*model);
connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(renameSlot()));
emit testSignal();
- QVERIFY(!HbMessageBox::mLatestTxt.isEmpty());
+ QVERIFY(!HbMessageBoxData::mLatestTxt.isEmpty());
disconnect(this, SIGNAL(testSignal()), mTestWidget, SLOT(renameSlot()));
}
@@ -708,12 +736,15 @@
//
void TestListWidget::testPlayAllSlot()
{
+ VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
+ VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionWrapper::EAllVideos);
+
// nothing to test yet
- HbMessageBox::mLatestTxt = "";
- mTestWidget->initialize(*mDummyProxyModel);
+ HbMessageBoxData::mLatestTxt = "";
+ mTestWidget->initialize(*model);
connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(playAllSlot()));
emit testSignal();
- QVERIFY(!HbMessageBox::mLatestTxt.isEmpty());
+ QVERIFY(!HbMessageBoxData::mLatestTxt.isEmpty());
disconnect(this, SIGNAL(testSignal()), mTestWidget, SLOT(playAllSlot()));
}
@@ -723,12 +754,15 @@
//
void TestListWidget::testAddItemSlot()
{
+ VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
+ VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionWrapper::EAllVideos);
+
// nothing to test yet
- HbMessageBox::mLatestTxt = "";
- mTestWidget->initialize(*mDummyProxyModel);
+ HbMessageBoxData::mLatestTxt = "";
+ mTestWidget->initialize(*model);
connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(addItemSlot()));
emit testSignal();
- QVERIFY(!HbMessageBox::mLatestTxt.isEmpty());
+ QVERIFY(!HbMessageBoxData::mLatestTxt.isEmpty());
disconnect(this, SIGNAL(testSignal()), mTestWidget, SLOT(addItemSlot()));
}
@@ -738,12 +772,15 @@
//
void TestListWidget::testAddToCollectionSlot()
{
+ VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
+ VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionWrapper::EAllVideos);
+
// nothing to test yet
- HbMessageBox::mLatestTxt = "";
- mTestWidget->initialize(*mDummyProxyModel);
+ HbMessageBoxData::mLatestTxt = "";
+ mTestWidget->initialize(*model);
connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(addToCollectionSlot()));
emit testSignal();
- QVERIFY(!HbMessageBox::mLatestTxt.isEmpty());
+ QVERIFY(!HbMessageBoxData::mLatestTxt.isEmpty());
disconnect(this, SIGNAL(testSignal()), mTestWidget, SLOT(addToCollectionSlot()));
}
@@ -753,11 +790,14 @@
//
void TestListWidget::testOpenDetailsSlot()
{
+ VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
+ VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionWrapper::EAllVideos);
+
QSignalSpy spysignal(mTestWidget, SIGNAL(command(int)));
- HbMessageBox::mLatestTxt = "";
- VideoSortFilterProxyModel::mLastIndex = QModelIndex();
- mDummyModel->reset();
- mTestWidget->initialize(*mDummyProxyModel);
+ HbMessageBoxData::mLatestTxt = "";
+ VideoSortFilterProxyModelData::mLastIndex = QModelIndex();
+ setRowCount(0);
+ mTestWidget->initialize(*model);
connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(openDetailsSlot()));
// no model
@@ -765,28 +805,28 @@
mTestWidget->mModel = 0;
emit testSignal();
QVERIFY(spysignal.count() == 0);
- QVERIFY(!VideoSortFilterProxyModel::mLastIndex.isValid());
+ QVERIFY(!VideoSortFilterProxyModelData::mLastIndex.isValid());
mTestWidget->mModel = tmp;
// detail fetch fails
- mDummyModel->setRowCount(1);
+ setRowCount(1);
QVariant data = QString("test");
- mDummyModel->setData( Qt::DisplayRole, data);
- mTestWidget->mCurrentIndex = mDummyProxyModel->index(0, 0, QModelIndex());
- VideoSortFilterProxyModel::mDetailsReturnValue = -1;
+ VideoListDataModelData::setData( Qt::DisplayRole, data);
+ mTestWidget->mCurrentIndex = model->index(0, 0, QModelIndex());
+ VideoSortFilterProxyModelData::mDetailsReturnValue = -1;
emit testSignal();
QVERIFY(spysignal.count() == 0);
- QVERIFY(VideoSortFilterProxyModel::mLastIndex.row() == 0);
+ QVERIFY(VideoSortFilterProxyModelData::mLastIndex.row() == 0);
// detail fetch succeeds
- VideoSortFilterProxyModel::mDetailsReturnValue = 0;
- VideoSortFilterProxyModel::mLastIndex = QModelIndex();
+ VideoSortFilterProxyModelData::mDetailsReturnValue = 0;
+ VideoSortFilterProxyModelData::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(VideoSortFilterProxyModel::mLastIndex.row() == 0);
+ QVERIFY(VideoSortFilterProxyModelData::mLastIndex.row() == 0);
disconnect(this, SIGNAL(testSignal()), mTestWidget, SLOT(openDetailsSlot()));
}
@@ -797,6 +837,9 @@
//
void TestListWidget::testBack()
{
+ VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
+ VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionWrapper::EAllVideos);
+
QSignalSpy spysignal(mTestWidget, SIGNAL(collectionOpened(bool, const QString&)));
connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(back()));
// no model
@@ -805,7 +848,7 @@
QVERIFY(spysignal.count() == 0);
// model exist
- mTestWidget->initialize(*mDummyProxyModel);
+ mTestWidget->initialize(*model);
emit testSignal();
QVERIFY(spysignal.count() == 1);
QVERIFY(spysignal.value(0).at(0).isValid());
@@ -822,38 +865,40 @@
//
void TestListWidget::testScrollingEndedSlot()
{
- mTestWidget->initialize(*mDummyProxyModel);
+ VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
+ VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionWrapper::EAllVideos);
+
+ mTestWidget->initialize(*model);
connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(scrollingEndedSlot()));
// no visible items
HbListView::mVisibleItems.clear();
emit testSignal();
- QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 0);
+ QVERIFY(VideoThumbnailTestData::mStartBackgroundFetchingCallCount == 0);
QVERIFY(!mTestWidget->mScrollPositionTimer->isActive());
// setup few "visible" items and make sure item count match at thumbnail data
int count = 10;
- mDummyModel->setRowCount(count);
+ setRowCount(count);
HbAbstractViewItem *item = 0;
for(int i = 0; i < count; ++i)
{
item = new HbAbstractViewItem();
- item->mModelIndex = mDummyModel->index(i, 0, QModelIndex());
+ item->mModelIndex = model->index(i, 0, QModelIndex());
HbListView::mVisibleItems.append(item);
}
// Test
emit testSignal();
- QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 1);
+ QVERIFY(VideoThumbnailTestData::mStartBackgroundFetchingCallCount == 1);
QVERIFY(!mTestWidget->mScrollPositionTimer->isActive());
// Test again when timer is null.
- VideoThumbnailData::mStartBackgroundFetchingCallCount = 0;
+ VideoThumbnailTestData::mStartBackgroundFetchingCallCount = 0;
QTimer *backup = mTestWidget->mScrollPositionTimer;
mTestWidget->mScrollPositionTimer = 0;
- VideoThumbnailData::mStartFetchingThumbnailsThumbnailCount = 0;
emit testSignal();
- QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 1);
+ QVERIFY(VideoThumbnailTestData::mStartBackgroundFetchingCallCount == 1);
mTestWidget->mScrollPositionTimer = backup;
backup = 0;
@@ -866,7 +911,10 @@
//
void TestListWidget::testScrollPositionChangedSlot()
{
- mTestWidget->initialize(*mDummyProxyModel);
+ VideoCollectionWrapper &wrapper = VideoCollectionWrapper::instance();
+ VideoSortFilterProxyModel *model = wrapper.getModel(VideoCollectionWrapper::EAllVideos);
+
+ mTestWidget->initialize(*model);
const QPointF point;
connect(this, SIGNAL(testSignal(const QPointF&)), mTestWidget, SLOT(scrollPositionChangedSlot(const QPointF&)));
--- a/videocollection/videocollectionview/tsrc/testlistwidget/testlistwidget.pro Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionview/tsrc/testlistwidget/testlistwidget.pro Thu Apr 01 23:22:15 2010 +0300
@@ -15,62 +15,82 @@
#
TEMPLATE = app
-TARGET =
+
+TARGET =
+
DEPENDPATH += . \
inc \
src
+
INCLUDEPATH += . \
- /epoc32/include/domain \
- /epoc32/include/domain/middleware \
- /epoc32/include/domain/applications \
- /epoc32/include/osextensions \
- /epoc32/include/middleware \
- /epoc32/include/osextensions/stdapis/stlport \
- stub/inc \
+ inc \
+ ../../../tsrc/stubs/inc \
+ \ # keep these at bottom so that stub headers are taken first
../../../inc \
+ ../../../videocollectionview/inc \
+ ../../../videocollectionwrapper/inc \
../../../../inc \
+ ../../../../videoplayerapp/videoplayerengine/inc
CONFIG += qtestlib \
- symbian_test
+ Hb \
+ symbian_test
LIBS += -lestor.dll \
-lfbscli.dll \
-lbitgdi.dll \
-lgdi.dll \
-lvideocollectionwrapper.dll \
- -lxqserviceutil.dll \
+ -lxqservice.dll \
+ -lxqserviceutil.dll
-# Input
HEADERS += inc/testlistwidget.h \
- stub/inc/videosortfilterproxymodel.h \
- stub/inc/hbmainwindow.h \
- stub/inc/hbwidget.h \
- stub/inc/hbinstance.h \
- stub/inc/hbscrollbar.h \
- stub/inc/hbaction.h \
- stub/inc/hbwidget.h \
- stub/inc/hbmenu.h \
- stub/inc/hbview.h \
- stub/inc/hblistview.h \
- stub/inc/hblistviewitem.h \
- stub/inc/dummydatamodel.h \
- stub/inc/hbmessagebox.h \
- stub/inc/videothumbnaildata.h \
- stub/inc/videoservices.h \
- stub/inc/videoserviceurifetch.h \
- ../../inc/videolistwidget.h
-
+ \ # headers needed in test
+ ../../../videocollectionview/inc/videolistwidget.h \
+ \ # headers needed in stubs
+ ../../../tsrc/stubs/inc/hbmainwindow.h \
+ ../../../tsrc/stubs/inc/hbwidget.h \
+ ../../../tsrc/stubs/inc/hbinstance.h \
+ ../../../tsrc/stubs/inc/hbscrollbar.h \
+ ../../../tsrc/stubs/inc/hbaction.h \
+ ../../../tsrc/stubs/inc/hbview.h \
+ ../../../tsrc/stubs/inc/hblistviewitem.h \
+ ../../../tsrc/stubs/inc/hblistview.h \
+ ../../../tsrc/stubs/inc/hbglobal.h \
+ ../../../tsrc/stubs/inc/hbstyleloader.h \
+ ../../../tsrc/stubs/inc/hbmenu.h \
+ ../../../tsrc/stubs/inc/hbmessagebox.h \
+ ../../../tsrc/stubs/inc/xqserviceutil.h \
+ ../../../videocollectionview/inc/videocollectionviewutils.h \
+ ../../../videocollectionview/inc/videocollectionuiloader.h \
+ ../../../videocollectionview/inc/videolistselectiondialog.h \
+ ../../../videocollectionwrapper/inc/videocollectionwrapper.h \
+ ../../../videocollectionwrapper/inc/videosortfilterproxymodel.h \
+ ../../../videocollectionwrapper/inc/videolistdatamodel.h \
+ ../../../videocollectionwrapper/inc/videothumbnaildata.h \
+ ../../../../videoplayerapp/videoplayerengine/inc/videoserviceurifetch.h
+
SOURCES += src/testlistwidget.cpp \
- stub/src/hbaction.cpp \
- stub/src/hbscrollbar.cpp \
- stub/src/hbwidget.cpp \
- stub/src/hblistview.cpp \
- stub/src/hblistviewitem.cpp \
- stub/src/hbmenu.cpp \
- stub/src/videosortfilterproxymodel.cpp \
- stub/src/dummydatamodel.cpp \
- stub/src/hbmessagebox.cpp \
- stub/src/videothumbnaildata.cpp \
- stub/src/videoservices.cpp \
- stub/src/videoserviceurifetch.cpp \
- ../../src/videolistwidget.cpp
+ \ # sources needed in test
+ ../../../videocollectionview/src/videolistwidget.cpp \
+ \ # sources needed in stubs
+ ../../../tsrc/stubs/src/hbwidget.cpp \
+ ../../../tsrc/stubs/src/hbscrollbar.cpp \
+ ../../../tsrc/stubs/src/hbaction.cpp \
+ ../../../tsrc/stubs/src/hblistviewitem.cpp \
+ ../../../tsrc/stubs/src/hblistview.cpp \
+ ../../../tsrc/stubs/src/hbglobal.cpp \
+ ../../../tsrc/stubs/src/hbstyleloader.cpp \
+ ../../../tsrc/stubs/src/hbmenu.cpp \
+ ../../../tsrc/stubs/src/hbmessagebox.cpp \
+ ../../../tsrc/stubs/src/hbdialog.cpp \
+ ../../../tsrc/stubs/src/videocollectionviewutils.cpp \
+ ../../../tsrc/stubs/src/videocollectionuiloader.cpp \
+ ../../../tsrc/stubs/src/videolistselectiondialog.cpp \
+ ../../../tsrc/stubs/src/videocollectionwrapper.cpp \
+ ../../../tsrc/stubs/src/videosortfilterproxymodel.cpp \
+ ../../../tsrc/stubs/src/videolistdatamodel.cpp \
+ ../../../tsrc/stubs/src/videothumbnaildata.cpp \
+ ../../../tsrc/stubs/src/videoservices.cpp \
+ ../../../tsrc/stubs/src/videoserviceurifetch.cpp \
+
\ No newline at end of file
--- a/videocollection/videocollectionview/tsrc/testvideocollectionviewutils/inc/testvideocollectionviewutils.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionview/tsrc/testvideocollectionviewutils/inc/testvideocollectionviewutils.h Thu Apr 01 23:22:15 2010 +0300
@@ -59,6 +59,16 @@
* verifies loadSortingValues
*/
void testLoadSortingValues();
+
+ /**
+ * verifies getServiceIconStrings
+ */
+ void testGetServiceIconStrings();
+
+ /**
+ * verifies getServiceUriString
+ */
+ void testGetServiceUriString();
};
--- a/videocollection/videocollectionview/tsrc/testvideocollectionviewutils/src/testvideocollectionviewutils.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionview/tsrc/testvideocollectionviewutils/src/testvideocollectionviewutils.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -16,12 +16,14 @@
*/
#include <qapplication.h>
-#include "stub/inc/centralrepository.h"
+#include "centralrepository.h"
#include "testvideocollectionviewutils.h"
#include "hblabel.h"
#include "hbaction.h"
#include "videocollectioncommon.h"
#include "centralrepository.h"
+#include "hbmessageboxdata.h"
+
#define private public
#include "videocollectionviewutils.h"
#undef private
@@ -36,13 +38,20 @@
TestVideoVideoCollectionViewUtils tv;
- char *pass[3];
- pass[0] = argv[0];
- pass[1] = "-o";
- pass[2] = "c:\\data\\testvideocollectionviewutils.txt";
-
- int res = QTest::qExec(&tv, 3, pass);
-
+ 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\\testvideocollectionviewutils.txt";
+ res = QTest::qExec(&tv, 3, pass);
+ }
+
return res;
}
@@ -74,48 +83,48 @@
QVariant additional;
QString txt = "__test__";
additional = txt;
- HbMessageBox::mWarningCallCount = 0;
- HbMessageBox::mInformationCallCount = 0;
+ HbMessageBoxData::mWarningCallCount = 0;
+ HbMessageBoxData::mInformationCallCount = 0;
// status: VideoCollectionCommon::statusSingleDeleteFail
testObject.showStatusMsgSlot(VideoCollectionCommon::statusSingleDeleteFail, additional);
- QVERIFY(HbMessageBox::mWarningCallCount == 1);
- QVERIFY(HbMessageBox::mInformationCallCount == 0);
- HbMessageBox::mWarningCallCount = 0;
- HbMessageBox::mInformationCallCount = 0;
+ QVERIFY(HbMessageBoxData::mWarningCallCount == 1);
+ QVERIFY(HbMessageBoxData::mInformationCallCount == 0);
+ HbMessageBoxData::mWarningCallCount = 0;
+ HbMessageBoxData::mInformationCallCount = 0;
additional = QVariant();
// - invalid additional
testObject.showStatusMsgSlot(VideoCollectionCommon::statusSingleDeleteFail, additional);
- QVERIFY(HbMessageBox::mWarningCallCount == 0);
- QVERIFY(HbMessageBox::mInformationCallCount == 0);
+ QVERIFY(HbMessageBoxData::mWarningCallCount == 0);
+ QVERIFY(HbMessageBoxData::mInformationCallCount == 0);
// status: VideoCollectionCommon::statusMultipleDeleteFail (additional not needed)
testObject.showStatusMsgSlot(VideoCollectionCommon::statusMultipleDeleteFail, additional);
- QVERIFY(HbMessageBox::mWarningCallCount == 1);
- QVERIFY(HbMessageBox::mInformationCallCount == 0);
- HbMessageBox::mWarningCallCount = 0;
- HbMessageBox::mInformationCallCount = 0;
+ QVERIFY(HbMessageBoxData::mWarningCallCount == 1);
+ QVERIFY(HbMessageBoxData::mInformationCallCount == 0);
+ HbMessageBoxData::mWarningCallCount = 0;
+ HbMessageBoxData::mInformationCallCount = 0;
additional = QVariant();
additional = 5;
// status: VideoCollectionCommon::statusMultipleDeleteSucceed
- testObject.showStatusMsgSlot(VideoCollectionCommon::statusMultipleDeleteSucceed, additional);
- QVERIFY(HbMessageBox::mWarningCallCount == 0);
- QVERIFY(HbMessageBox::mInformationCallCount == 1);
- HbMessageBox::mWarningCallCount = 0;
- HbMessageBox::mInformationCallCount = 0;
+ testObject.showStatusMsgSlot(VideoCollectionCommon::statusDeleteSucceed, additional);
+ QVERIFY(HbMessageBoxData::mWarningCallCount == 0);
+ QVERIFY(HbMessageBoxData::mInformationCallCount == 1);
+ HbMessageBoxData::mWarningCallCount = 0;
+ HbMessageBoxData::mInformationCallCount = 0;
additional = QVariant();
// -> invalid additional
- testObject.showStatusMsgSlot(VideoCollectionCommon::statusMultipleDeleteSucceed, additional);
- QVERIFY(HbMessageBox::mWarningCallCount == 0);
- QVERIFY(HbMessageBox::mInformationCallCount == 0);
+ testObject.showStatusMsgSlot(VideoCollectionCommon::statusDeleteSucceed, additional);
+ QVERIFY(HbMessageBoxData::mWarningCallCount == 0);
+ QVERIFY(HbMessageBoxData::mInformationCallCount == 0);
// status: invalid
- testObject.showStatusMsgSlot(VideoCollectionCommon::statusMultipleDeleteSucceed + 1, additional);
- QVERIFY(HbMessageBox::mWarningCallCount == 0);
- QVERIFY(HbMessageBox::mInformationCallCount == 0);
+ testObject.showStatusMsgSlot(VideoCollectionCommon::statusDeleteSucceed + 1, additional);
+ QVERIFY(HbMessageBoxData::mWarningCallCount == 0);
+ QVERIFY(HbMessageBoxData::mInformationCallCount == 0);
/*
@@ -139,7 +148,7 @@
additional = txt;
testObject.showErrorMsgSlot(VideoCollectionCommon::errorCollectionSingleDelete, additional);
QVERIFY(HbMessageBox::staticInstance);
- QVERIFY(HbMessageBox::staticInstance->mType == HbMessageBox::MessageTypeWarning);
+ QVERIFY(HbMessageBox::staticInstance->mType == HbMessageBoxData::messageTypeWarning);
QVERIFY(!HbMessageBox::staticInstance->mBGFaded);
QVERIFY(!HbMessageBox::staticInstance->mModal);
QVERIFY(HbMessageBox::staticInstance->mText.count() > 0);
@@ -152,7 +161,7 @@
additional.clear();
testObject.showErrorMsgSlot(VideoCollectionCommon::errorCollectionMultipleDelete, additional);
QVERIFY(HbMessageBox::staticInstance);
- QVERIFY(HbMessageBox::staticInstance->mType == HbMessageBox::MessageTypeWarning);
+ QVERIFY(HbMessageBox::staticInstance->mType == HbMessageBoxData::messageTypeWarning);
QVERIFY(!HbMessageBox::staticInstance->mBGFaded);
QVERIFY(!HbMessageBox::staticInstance->mModal);
QVERIFY(HbMessageBox::staticInstance->mText.count() > 0);
@@ -165,7 +174,7 @@
additional = txt;
testObject.showErrorMsgSlot(VideoCollectionCommon::errorCollectionMultipleDelete, additional);
QVERIFY(HbMessageBox::staticInstance);
- QVERIFY(HbMessageBox::staticInstance->mType == HbMessageBox::MessageTypeWarning);
+ QVERIFY(HbMessageBox::staticInstance->mType == HbMessageBoxData::messageTypeWarning);
QVERIFY(!HbMessageBox::staticInstance->mBGFaded);
QVERIFY(!HbMessageBox::staticInstance->mModal);
QVERIFY(HbMessageBox::staticInstance->mText.count() > 0);
@@ -236,6 +245,63 @@
QCOMPARE(sortOrder, Qt::DescendingOrder);
}
+// -----------------------------------------------------------------------------
+// testGetServiceIconStrings
+// -----------------------------------------------------------------------------
+//
+void TestVideoVideoCollectionViewUtils::testGetServiceIconStrings()
+{
+ VideoCollectionViewUtils &testObject(VideoCollectionViewUtils::instance());
+ CRepository::setNewLLeave(true);
+ _LIT(KExpectedTDesValue, "expected");
+ CRepository::setTDesValue(KExpectedTDesValue());
+ QString expected((QChar*)KExpectedTDesValue().Ptr(),KExpectedTDesValue().Length());
+
+ QString icon;
+ QString pressed;
+ QVERIFY(testObject.getServiceIconStrings(icon, pressed) < 0);
+ QVERIFY(icon.isNull());
+ QVERIFY(pressed.isNull());
+
+ CRepository::setNewLLeave(false);
+ CRepository::setGetFail(0);
+ QVERIFY(testObject.getServiceIconStrings(icon, pressed) < 0);
+ QVERIFY(icon.isNull());
+ QVERIFY(pressed.isNull());
+
+ CRepository::setGetFail(1);
+ QVERIFY(testObject.getServiceIconStrings(icon, pressed) < 0);
+ QVERIFY(icon.isNull());
+ QVERIFY(pressed.isNull());
+
+ CRepository::setGetFail(255);
+ QVERIFY(testObject.getServiceIconStrings(icon, pressed) == 0);
+ QCOMPARE(icon, expected);
+ QCOMPARE(pressed, expected);
+}
+
+// -----------------------------------------------------------------------------
+// testGetServiceIconStrings
+// -----------------------------------------------------------------------------
+//
+void TestVideoVideoCollectionViewUtils::testGetServiceUriString()
+{
+ VideoCollectionViewUtils &testObject(VideoCollectionViewUtils::instance());
+ CRepository::setNewLLeave(true);
+ _LIT(KExpectedTDesValue, "expected");
+ CRepository::setTDesValue(KExpectedTDesValue());
+ QString expected((QChar*)KExpectedTDesValue().Ptr(),KExpectedTDesValue().Length());
+
+ QVERIFY(testObject.getServiceUriString().isNull());
+
+ CRepository::setNewLLeave(false);
+ CRepository::setGetFail(0);
+ QVERIFY(testObject.getServiceUriString().isNull());
+
+ CRepository::setGetFail(255);
+ QCOMPARE(testObject.getServiceUriString(), expected);
+}
+
// End of file
--- a/videocollection/videocollectionview/tsrc/testvideocollectionviewutils/testvideocollectionviewutils.pro Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionview/tsrc/testvideocollectionviewutils/testvideocollectionviewutils.pro Thu Apr 01 23:22:15 2010 +0300
@@ -1,33 +1,37 @@
-# #####################################################################
-# Automatically generated by qmake (2.01a) Tue 5. May 13:25:42 2009
-# #####################################################################
+#
+# 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:
+#
+
TEMPLATE = app
+
TARGET =
+
DEPENDPATH += . \
inc \
- src \
- stub\inc \
- stub\src \
+ src
-INCLUDEPATH = inc \
- stub/inc \
- /epoc32/include \
- /epoc32/include/osextensions/stdapis \
- /epoc32/include/osextensions/stdapis/sys \
- /epoc32/include/stdapis \
- /epoc32/include/stdapis/sys \
- . \
- /epoc32/include \
- /epoc32/include/domain \
- /epoc32/include/domain/middleware \
- /epoc32/include/domain/applications \
- /epoc32/include/osextensions \
- /epoc32/include/middleware \
- /epoc32/include/osextensions/stdapis/stlport \
- ../../../inc
+INCLUDEPATH = . \
+ inc \
+ ../../../tsrc/stubs/inc \
+ \ # keep these at bottom so that stubbed headers are taken first
+ ../../../inc \
+ ../../../videocollectionwrapper/inc
CONFIG += qtestlib \
- symbian_test
+ Hb \
+ symbian_test
LIBS += -lestor.dll \
-lfbscli.dll \
@@ -36,20 +40,26 @@
# Input
HEADERS += inc/testvideocollectionviewutils.h \
- stub/inc/hbaction.h \
- stub/inc/hblabel.h \
- stub/inc/hbmessagebox.h \
- stub/inc/hbdialog.h \
- stub/inc/hbwidget.h \
- stub/inc/centralrepository.h \
- ../../inc/videocollectionviewutils.h
+ \ # headers needed in test
+ ../../inc/videocollectionviewutils.h \
+ \ # headers needed in stubs
+ ../../../tsrc/stubs/inc/hbaction.h \
+ ../../../tsrc/stubs/inc/hblabel.h \
+ ../../../tsrc/stubs/inc/hbmessagebox.h \
+ ../../../tsrc/stubs/inc/hbdialog.h \
+ ../../../tsrc/stubs/inc/hbwidget.h \
+ ../../../tsrc/stubs/inc/centralrepository.h \
+ ../../../videocollectionwrapper/inc/videocollectionwrapper.h
SOURCES += src/testvideocollectionviewutils.cpp \
- stub/src/hbaction.cpp \
- stub/src/hblabel.cpp \
- stub/src/hbmessagebox.cpp \
- stub/src/hbdialog.cpp \
- stub/src/hbwidget.cpp \
- stub/src/centralrepository.cpp \
- ../../src/videocollectionviewutils.cpp \
+ \ # sources needed in test
+ ../../src/videocollectionviewutils.cpp \
+ \ # sources needed in stubs
+ ../../../tsrc/stubs/src/hbaction.cpp \
+ ../../../tsrc/stubs/src/hblabel.cpp \
+ ../../../tsrc/stubs/src/hbmessagebox.cpp \
+ ../../../tsrc/stubs/src/hbdialog.cpp \
+ ../../../tsrc/stubs/src/hbwidget.cpp \
+ ../../../tsrc/stubs/src/centralrepository.cpp \
+ ../../../tsrc/stubs/src/videocollectionwrapper.cpp
--- a/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/inc/testvideolistselectiondialog.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/inc/testvideolistselectiondialog.h Thu Apr 01 23:22:15 2010 +0300
@@ -22,32 +22,12 @@
// INCLUDES
#include <QtTest/QtTest>
-#include <QItemSelection>
-
-class VideoCollectionUiLoader;
-class VideoListWidget;
-class DummyDataModel;
-class VideoSortFilterProxyModel;
-class VideoListSelectionDialog;
-
class TestVideoListSelectionDialog : public QObject
{
Q_OBJECT
// test functions for the test framework
-signals:
-
- /**
- * signal for testing markAllStateChangedSlot
- */
- void signalTestMarkAll(int);
-
- /**
- * signal for testing selectionChangedSlot
- */
- void signalTestSelectionChanged(const QItemSelection&, const QItemSelection&);
-
private slots:
/**
@@ -60,63 +40,8 @@
* will be called after every testfunction.
*
*/
- void cleanup();
-
- /**
- * test of setContent with empty title
- */
- void testSetContentEmptyTitle();
-
- /**
- * test of setContent with null content
- */
- void testSetContentNullcontent();
-
- /**
- * test of setContent while finding items
- */
- void tesSetContentItemFinding();
-
- /**
- * verifies exec
- */
- void testExec();
-
- /**
- * verifies markAllStateChangedSlot
- */
- void testmMarkAllStateChangedSlot();
-
- /**
- * verifies selectionChangedSlot
- */
- void testSelectionChangedSlot();
-
+ void cleanup();
private:
- /**
- * object under test
- */
- VideoListSelectionDialog *mTestObject;
-
- /**
- * dummy UI loader object
- */
- VideoCollectionUiLoader *mTestUiLoader;
-
- /**
- * dummy source model
- */
- DummyDataModel *mSourceModel;
-
- /**
- * dummy model
- */
- VideoSortFilterProxyModel *mModel;
-
- /**
- * dummy widget
- */
- VideoListWidget *mTestWidget;
};
--- a/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/src/testvideolistselectiondialog.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/src/testvideolistselectiondialog.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -14,20 +14,15 @@
* Description: tester for methods in VideoListSelectionDialog
*
*/
-#include "testvideolistselectiondialog.h"
+
#include <qapplication.h>
-#include "hbaction.h"
-#include "videocollectionuiloader.h"
-#include "videolistwidget.h"
-#include "dummydatamodel.h"
-#include "videosortfilterproxymodel.h"
+
+#include "testvideolistselectiondialog.h"
#define private public
#include "videolistselectiondialog.h"
#undef private
-const int DEFAULT_ROW_COUNT = 10;
-
// ---------------------------------------------------------------------------
// main
// ---------------------------------------------------------------------------
@@ -38,12 +33,19 @@
TestVideoListSelectionDialog tv;
- char *pass[3];
- pass[0] = argv[0];
- pass[1] = "-o";
- pass[2] = "c:\\data\\testvideolistselectiondialog.txt";
-
- int res = QTest::qExec(&tv, 3, pass);
+ 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\\testvideolistselectiondialog.txt";
+ res = QTest::qExec(&tv, 3, pass);
+ }
return res;
}
@@ -54,17 +56,6 @@
//
void TestVideoListSelectionDialog::init()
{
- mTestUiLoader = new VideoCollectionUiLoader();
- mTestObject = new VideoListSelectionDialog(mTestUiLoader);
-
- mSourceModel = new DummyDataModel();
- mSourceModel->setRowCount(DEFAULT_ROW_COUNT);
-
- mModel = new VideoSortFilterProxyModel();
- mModel->setSourceModel(mSourceModel);
-
- mTestWidget = new VideoListWidget(*mModel);
-
}
// ---------------------------------------------------------------------------
@@ -73,378 +64,6 @@
//
void TestVideoListSelectionDialog::cleanup()
{
- delete mTestObject;
- mTestObject = 0;
-
- delete mTestUiLoader;
- mTestUiLoader = 0;
-
- delete mTestWidget;
- mTestWidget = 0;
-
- delete mSourceModel;
- mSourceModel = 0;
-
- delete mModel;
- mModel = 0;
-}
-
-// ---------------------------------------------------------------------------
-// testSetContentEmptyTitle
-// ---------------------------------------------------------------------------
-//
-void TestVideoListSelectionDialog::testSetContentEmptyTitle()
-{
- QVERIFY(mTestObject != 0);
-
- QString title = "";
- mTestObject->setContent(title, mTestWidget);
- // at first invalid setContent, all
- // members remain null
- QVERIFY(mTestObject->mVideoList == 0);
- QVERIFY(mTestObject->mHeading == 0);
- QVERIFY(mTestObject->mItemCount == 0);
- QVERIFY(mTestObject->mCheckBox == 0);
- QVERIFY(mTestObject->mListContainer == 0);
-
- title = "test";
- mTestObject->setContent(title, mTestWidget);
- // succeed setContent. All members are initialized
- QVERIFY(mTestObject->mVideoList != 0);
- QVERIFY(mTestObject->mHeading != 0);
- QVERIFY(mTestObject->mItemCount != 0);
- QVERIFY(mTestObject->mCheckBox != 0);
- // list container gets initialized at exec
- QVERIFY(mTestObject->mListContainer == 0);
-
- title = "";
- mTestObject->setContent(title, mTestWidget);
- // invalid setContent after one or more succeed one:
- // videolist is nul indicating invalid state, whereas
- // UI components have been fetched from ui loader
- QVERIFY(mTestObject->mVideoList == 0);
- QVERIFY(mTestObject->mHeading != 0);
- QVERIFY(mTestObject->mItemCount != 0);
- QVERIFY(mTestObject->mCheckBox != 0);
- // list container gets initialized at exec
- QVERIFY(mTestObject->mListContainer == 0);
-}
-
-// ---------------------------------------------------------------------------
-// testSetContentNullcontent
-// ---------------------------------------------------------------------------
-//
-void TestVideoListSelectionDialog::testSetContentNullcontent()
-{
- QVERIFY(mTestObject != 0);
-
- QString title = "test";
- mTestObject->setContent(title, 0);
- // at first invalid setContent, all
- // members remain null
- QVERIFY(mTestObject->mVideoList == 0);
- QVERIFY(mTestObject->mHeading == 0);
- QVERIFY(mTestObject->mItemCount == 0);
- QVERIFY(mTestObject->mCheckBox == 0);
- QVERIFY(mTestObject->mListContainer == 0);
-
- mTestObject->setContent(title, mTestWidget);
- // succeed setContent. All members are initialized
- QVERIFY(mTestObject->mVideoList != 0);
- QVERIFY(mTestObject->mHeading != 0);
- QVERIFY(mTestObject->mItemCount != 0);
- QVERIFY(mTestObject->mCheckBox != 0);
- // list container gets initialized at exec
- QVERIFY(mTestObject->mListContainer == 0);
-
- title = "";
- mTestObject->setContent(title, 0);
- // invalid setContent after one or more succeed one:
- // videolist is nul indicating invalid state, whereas
- // UI components have been fetched from ui loader
- QVERIFY(mTestObject->mVideoList == 0);
- QVERIFY(mTestObject->mHeading != 0);
- QVERIFY(mTestObject->mItemCount != 0);
- QVERIFY(mTestObject->mCheckBox != 0);
- // list container gets initialized at exec
- QVERIFY(mTestObject->mListContainer == 0);
-}
-
-// ---------------------------------------------------------------------------
-// tesSetContentItemFinding
-// ---------------------------------------------------------------------------
-//
-void TestVideoListSelectionDialog::tesSetContentItemFinding()
-{
- // all items are not yet created -> they are to be created
- QString title = "test";
- mTestObject->setContent(title, mTestWidget);
- QVERIFY(mTestObject->mVideoList != 0);
- QVERIFY(mTestObject->mHeading != 0);
- QVERIFY(mTestObject->mItemCount != 0);
- QVERIFY(mTestObject->mCheckBox != 0);
- // list container gets initialized at exec
- QVERIFY(mTestObject->mListContainer == 0);
- QVERIFY(mTestObject->primaryAction());
- QVERIFY(mTestObject->secondaryAction());
- QVERIFY(mTestObject->mHeading->mPlainTxt == title);
- QVERIFY(mTestObject->mItemCount->mAlignment == Qt::AlignRight);
- QVERIFY(mTestObject->mItemCount->mPlainTxt == "0/" + QString::number(DEFAULT_ROW_COUNT));
- QVERIFY(mTestObject->mCheckBox->mChecked == false);
- QVERIFY(mTestObject->primaryAction()->mTxt == "OK");
- QVERIFY(mTestObject->secondaryAction()->mTxt == "Cancel");
-
- // all items exists beforehand
- title = "test2";
- mTestObject->setContent(title, mTestWidget);
- QVERIFY(mTestObject->mVideoList != 0);
- QVERIFY(mTestObject->mHeading != 0);
- QVERIFY(mTestObject->mItemCount != 0);
- QVERIFY(mTestObject->mCheckBox != 0);
- // list container gets initialized at exec
- QVERIFY(mTestObject->mListContainer == 0);
- QVERIFY(mTestObject->primaryAction());
- QVERIFY(mTestObject->secondaryAction());
- QVERIFY(mTestObject->mHeading->mPlainTxt == title);
- QVERIFY(mTestObject->mItemCount->mAlignment == Qt::AlignRight);
- QVERIFY(mTestObject->mItemCount->mPlainTxt == "0/" + QString::number(DEFAULT_ROW_COUNT));
- QVERIFY(mTestObject->mCheckBox->mChecked == false);
- QVERIFY(mTestObject->primaryAction()->mTxt == "OK");
- QVERIFY(mTestObject->secondaryAction()->mTxt == "Cancel");
-
}
-// ---------------------------------------------------------------------------
-// testExec
-// ---------------------------------------------------------------------------
-//
-void TestVideoListSelectionDialog::testExec()
-{
- // no videolist
- mTestObject->exec();
- QVERIFY(mTestObject->mVideoList == 0);
- QVERIFY(mTestObject->mHeading == 0);
- QVERIFY(mTestObject->mItemCount == 0);
- QVERIFY(mTestObject->mCheckBox == 0);
- QVERIFY(mTestObject->mListContainer == 0);
- QVERIFY(mTestObject->mSelection.count() == 0);
-
- QString title = "test";
- mTestObject->setContent(title, mTestWidget);
-
- // mListContainer not yet loaded
- HbDialog::execReturnPrimary = false;
- mTestObject->exec();
- QVERIFY(mTestObject->mVideoList != 0);
- QVERIFY(mTestObject->mHeading != 0);
- QVERIFY(mTestObject->mItemCount != 0);
- QVERIFY(mTestObject->mCheckBox != 0);
- QVERIFY(mTestObject->mListContainer != 0);
- QVERIFY(mTestObject->mSelection.count() == 0);
- QVERIFY(mTestObject->mVideoList->mVisibility = true);
- QVERIFY(mTestObject->mVideoList->mEndSelModelStartedCount == 1);
- QVERIFY(mTestObject->mVideoList->mStartSelModeStartedCount == 1);
- QVERIFY(mTestObject->mVideoList->mSelectionMode == HbAbstractItemView::NoSelection);
-
- // mListContainer loaded
- mTestObject->mVideoList->mVisibility = false;
- mTestObject->mVideoList->mEndSelModelStartedCount = 0;
- mTestObject->mVideoList->mStartSelModeStartedCount = 0;
-
- HbDialog::execReturnPrimary = false;
- mTestObject->exec();
- QVERIFY(mTestObject->mVideoList != 0);
- QVERIFY(mTestObject->mHeading != 0);
- QVERIFY(mTestObject->mItemCount != 0);
- QVERIFY(mTestObject->mCheckBox != 0);
- QVERIFY(mTestObject->mListContainer != 0);
- QVERIFY(mTestObject->mSelection.count() == 0);
-
- QVERIFY(mTestObject->mVideoList->mVisibility = true);
- QVERIFY(mTestObject->mVideoList->mEndSelModelStartedCount == 1);
- QVERIFY(mTestObject->mVideoList->mStartSelModeStartedCount == 1);
- QVERIFY(mTestObject->mVideoList->mSelectionMode == HbAbstractItemView::NoSelection);
-
- mTestObject->mVideoList->mVisibility = false;
- mTestObject->mVideoList->mEndSelModelStartedCount = 0;
- mTestObject->mVideoList->mStartSelModeStartedCount = 0;
- // not accepted
- HbDialog::execReturnPrimary = true;
- mTestObject->exec();
- QVERIFY(mTestObject->mVideoList != 0);
- QVERIFY(mTestObject->mHeading != 0);
- QVERIFY(mTestObject->mItemCount != 0);
- QVERIFY(mTestObject->mCheckBox != 0);
- QVERIFY(mTestObject->mListContainer != 0);
- QVERIFY(mTestObject->mSelection.count() == 0);
-
- QVERIFY(mTestObject->mVideoList->mVisibility = true);
- QVERIFY(mTestObject->mVideoList->mEndSelModelStartedCount == 1);
- QVERIFY(mTestObject->mVideoList->mStartSelModeStartedCount == 1);
- QVERIFY(mTestObject->mVideoList->mSelectionMode == HbAbstractItemView::NoSelection);
-}
-
-// ---------------------------------------------------------------------------
-// testmMarkAllStateChangedSlot
-// ---------------------------------------------------------------------------
-//
-void TestVideoListSelectionDialog::testmMarkAllStateChangedSlot()
-{
- connect(this, SIGNAL(signalTestMarkAll(int)), mTestObject, SLOT(markAllStateChangedSlot(int)));
- // without videolist
- emit signalTestMarkAll(Qt::Checked);
- QVERIFY(mTestWidget->mInitiallySelected.indexes().count() == 0);
-
- QString title = "test";
- mTestObject->setContent(title, mTestWidget);
- mTestObject->mForcedCheck = true;
- // with forcedcheck
- emit signalTestMarkAll(Qt::Checked);
- QVERIFY(mTestWidget->mInitiallySelected.indexes().count() == 0);
-
- mTestObject->mForcedCheck = false;
- // checked
- emit signalTestMarkAll(Qt::Checked);
- QVERIFY(mTestWidget->mInitiallySelected.indexes().count() == DEFAULT_ROW_COUNT);
-
- // not checked (== everything else than Qt::Checked
- emit signalTestMarkAll(Qt::Checked + 1);
- QVERIFY(mTestWidget->mInitiallySelected.indexes().count() == 0);
- disconnect(this, SIGNAL(signalTestMarkAll(int)), mTestObject, SLOT(markAllStateChangedSlot(int)));
-}
-
-// ---------------------------------------------------------------------------
-// testSelectionChangedSlot
-// ---------------------------------------------------------------------------
-//
-void TestVideoListSelectionDialog::testSelectionChangedSlot()
-{
- connect(this, SIGNAL(signalTestSelectionChanged(const QItemSelection&, const QItemSelection&)),
- mTestObject, SLOT(selectionChangedSlot(const QItemSelection&, const QItemSelection &)));
- ////////////////
- // no primary
- ////////////////
- emit signalTestSelectionChanged(QItemSelection (), QItemSelection ());
- QVERIFY(mTestObject->mSelection.count() == 0);
-
- ////////////////
- // selected == 0 and deselected == 0
- ////////////////
- QString title = "test";
- mTestObject->setContent(title, mTestWidget);
- emit signalTestSelectionChanged(QItemSelection (), QItemSelection ());
- QVERIFY(mTestObject->getSelection().indexes().count() == 0);
- QVERIFY(mTestObject->primaryAction()->mDisable == true);
- QVERIFY(mTestObject->mCheckBox->mChecked == false);
-
- ////////////////
- // deselected > 0
- ////////////////
- // "deselect" items from 0 to DEFAULT_ROW_COUNT / 2
- QItemSelection deselection(mSourceModel->index(0, 0, QModelIndex()), mSourceModel->index(DEFAULT_ROW_COUNT / 2, 0, QModelIndex()));
-
- emit signalTestSelectionChanged(QItemSelection (), deselection);
- QVERIFY(mTestObject->getSelection().indexes().count() == 0);
- QVERIFY(mTestObject->primaryAction()->mDisable == true);
- QVERIFY(mTestObject->mItemCount->mPlainTxt == "0/" + QString::number(DEFAULT_ROW_COUNT));
- QVERIFY(mTestObject->mCheckBox->mChecked == false);
-
- ////////////////
- // selected > 0
- ////////////////
- mTestObject->mSelection.clear();
- // "select" items from (DEFAULT_ROW_COUNT / 2) + 1 to DEFAULT_ROW_COUNT - 1
- QItemSelection selection(mSourceModel->index((DEFAULT_ROW_COUNT / 2) + 1, 0, QModelIndex()),
- mSourceModel->index(DEFAULT_ROW_COUNT - 1, 0, QModelIndex()));
-
- int count = 1 + ((DEFAULT_ROW_COUNT - 1) - ((DEFAULT_ROW_COUNT / 2) + 1));
-
- ///////////////
- // selected > 0
- ///////////////
- emit signalTestSelectionChanged(selection, deselection);
- QVERIFY(mTestObject->getSelection().indexes().count() == count);
- QVERIFY(mTestObject->primaryAction()->mDisable == false);
- QVERIFY(mTestObject->mItemCount->mPlainTxt == QString::number(count) + "/" + QString::number(DEFAULT_ROW_COUNT));
- QVERIFY(mTestObject->mCheckBox->mChecked == false);
-
- //////////////////
- // without videolist
- ///////////////
- mTestObject->mVideoList = 0;
- selection.clear();
- deselection.clear();
- mTestObject->mSelection.clear();
-
- // "select" 2 items
- selection.select(mSourceModel->index(DEFAULT_ROW_COUNT - 2, 0, QModelIndex()),
- mSourceModel->index(DEFAULT_ROW_COUNT - 1, 0, QModelIndex()));
- deselection.select( mSourceModel->index(0, 0, QModelIndex()),
- mSourceModel->index(DEFAULT_ROW_COUNT - 3, 0, QModelIndex()));
-
- emit signalTestSelectionChanged(selection, deselection);
- QVERIFY(mTestObject->getSelection().indexes().count() == 2);
- QVERIFY(mTestObject->primaryAction()->mDisable == false);
- QVERIFY(mTestObject->mCheckBox->mChecked == false);
- // count should have not changed
- QVERIFY(mTestObject->mItemCount->mPlainTxt == QString::number(count) + "/" + QString::number(DEFAULT_ROW_COUNT));
-
- ///////////////
- // wihtout mItemCount
- ///////////////
- mTestObject->mVideoList = mTestWidget;
- HbLabel *tmpLabel = mTestObject->mItemCount;
- mTestObject->mItemCount = 0;
- selection.clear();
- deselection.clear();
- mTestObject->mSelection.clear();
-
- // "select" 2 items
- selection.select(mSourceModel->index(DEFAULT_ROW_COUNT - 2, 0, QModelIndex()),
- mSourceModel->index(DEFAULT_ROW_COUNT - 1, 0, QModelIndex()));
- deselection.select( mSourceModel->index(0, 0, QModelIndex()),
- mSourceModel->index(DEFAULT_ROW_COUNT - 3, 0, QModelIndex()));
-
- emit signalTestSelectionChanged(selection, deselection);
- QVERIFY(mTestObject->getSelection().indexes().count() == 2);
- QVERIFY(mTestObject->primaryAction()->mDisable == false);
- QVERIFY(mTestObject->mCheckBox->mChecked == false);
- mTestObject->mItemCount = tmpLabel;
-
- ///////////////
- // selectionCount == rowCount and rowcount == 0
- ///////////////
- mSourceModel->setRowCount(0);
- selection.clear();
- deselection.clear();
- mTestObject->mSelection.clear();
-
- emit signalTestSelectionChanged(selection, deselection);
- QVERIFY(mTestObject->getSelection().indexes().count() == 0);
- QVERIFY(mTestObject->primaryAction()->mDisable == true);
- QVERIFY(mTestObject->mItemCount->mPlainTxt == "0/0");
- QVERIFY(mTestObject->mCheckBox->mChecked == false);
-
- mSourceModel->setRowCount(DEFAULT_ROW_COUNT);
-
- ///////////////
- // selectionCount == rowCount and rowcount > 0
- ///////////////
- selection.clear();
- deselection.clear();
- selection.select(mSourceModel->index(0, 0, QModelIndex()),
- mSourceModel->index(DEFAULT_ROW_COUNT - 1, 0, QModelIndex()));
-
- emit signalTestSelectionChanged(selection, deselection);
- QVERIFY(mTestObject->getSelection().indexes().count() == DEFAULT_ROW_COUNT);
- QVERIFY(mTestObject->primaryAction()->mDisable == false);
- QVERIFY(mTestObject->mCheckBox->mChecked == true);
- QVERIFY(mTestObject->mItemCount->mPlainTxt == QString::number(DEFAULT_ROW_COUNT) + "/" + QString::number(DEFAULT_ROW_COUNT));
-
- disconnect(this, SIGNAL(signalTestSelectionChanged(const QItemSelection&, const QItemSelection&)),
- mTestObject, SLOT(selectionChangedSlot(const QItemSelection&, const QItemSelection &)));
-}
-// End of file
-
-
-
+// end of file
--- a/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/testvideolistselectiondialog.pro Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/testvideolistselectiondialog.pro Thu Apr 01 23:22:15 2010 +0300
@@ -1,67 +1,74 @@
-# #####################################################################
-# Automatically generated by qmake (2.01a) Tue 5. May 13:25:42 2009
-# #####################################################################
+#
+# 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:
+#
+
TEMPLATE = app
+
TARGET =
+
DEPENDPATH += . \
inc \
- src \
- stub\inc \
- stub\src \
+ src
-INCLUDEPATH = inc \
- stub/inc \
- /epoc32/include \
- /epoc32/include/osextensions/stdapis \
- /epoc32/include/osextensions/stdapis/sys \
- /epoc32/include/stdapis \
- /epoc32/include/stdapis/sys \
- . \
- /epoc32/include \
- /epoc32/include/domain \
- /epoc32/include/domain/middleware \
- /epoc32/include/domain/applications \
- /epoc32/include/osextensions \
- /epoc32/include/middleware \
- /epoc32/include/osextensions/stdapis/stlport \
- ../../../inc
+INCLUDEPATH = . \
+ inc \
+ ../../../tsrc/stubs/inc \
+ \ # keep these at bottom so that stub headers are taken first
+ ../../../inc \
+ ../../../videocollectionview/inc \
+ ../../../videocollectionwrapper/inc
CONFIG += qtestlib \
- symbian_test
+ hb \
+ symbian_test
LIBS += -lestor.dll \
-lfbscli.dll \
-lbitgdi.dll \
-lgdi.dll
-# Input
-HEADERS += inc/testvideolistselectiondialog.h \
- stub/inc/videocollectionwrapper.h \
- stub/inc/videolistwidget.h \
- stub/inc/hbdialog.h \
- stub/inc/hblabel.h \
- stub/inc/hbcheckbox.h \
- stub/inc/hbstackedwidget.h \
- stub/inc/hbdeviceprofile.h \
- stub/inc/hbaction.h \
- stub/inc/hbwidget.h \
- stub/inc/hbview.h \
- stub/inc/hbabstractitemview.h \
- stub/inc/videocollectionuiloader.h \
- stub/inc/dummydatamodel.h \
- stub/inc/videosortfilterproxymodel.h \
- ../../inc/videolistselectiondialog.h
+HEADERS += inc/testvideolistselectiondialog.h \
+ \ # headers needed in test
+ ../../inc/videolistselectiondialog.h \
+ \ # headers needed in stubs
+ ../../../tsrc/stubs/inc/hbdialog.h \
+ ../../../tsrc/stubs/inc/hblabel.h \
+ ../../../tsrc/stubs/inc/hbcheckbox.h \
+ ../../../tsrc/stubs/inc/hbwidget.h \
+ ../../../tsrc/stubs/inc/hbstackedwidget.h \
+ ../../../tsrc/stubs/inc/hbdeviceprofile.h \
+ ../../../tsrc/stubs/inc/hbabstractitemview.h \
+ ../../../tsrc/stubs/inc/hbaction.h \
+ ../../../tsrc/stubs/inc/hbview.h \
+ ../../../videocollectionview/inc/videolistwidget.h \
+ ../../../videocollectionview/inc/videocollectionuiloader.h \
+ ../../../videocollectionwrapper/inc/videocollectionwrapper.h \
+ ../../../videocollectionwrapper/inc/videolistdatamodel.h \
+ ../../../videocollectionwrapper/inc/videosortfilterproxymodel.h
SOURCES += src/testvideolistselectiondialog.cpp \
- stub/src/videolistwidget.cpp \
- stub/src/hbdialog.cpp \
- stub/src/hbstackedwidget.cpp \
- stub/src/hblabel.cpp \
- stub/src/hbcheckbox.cpp \
- stub/src/hbwidget.cpp \
- stub/src/hbaction.cpp \
- stub/src/videocollectionuiloader.cpp \
- stub/src/videosortfilterproxymodel.cpp \
- stub/src/dummydatamodel.cpp \
- ../../src/videolistselectiondialog.cpp \
-
+ \ # sources needed in test
+ ../../src/videolistselectiondialog.cpp \
+ \ # sources needed in stubs
+ ../../../tsrc/stubs/src/hbdialog.cpp \
+ ../../../tsrc/stubs/src/hblabel.cpp \
+ ../../../tsrc/stubs/src/hbcheckbox.cpp \
+ ../../../tsrc/stubs/src/hbwidget.cpp \
+ ../../../tsrc/stubs/src/hbstackedwidget.cpp \
+ ../../../tsrc/stubs/src/hbaction.cpp \
+ ../../../tsrc/stubs/src/videolistwidget.cpp \
+ ../../../tsrc/stubs/src/videocollectionuiloader.cpp \
+ ../../../tsrc/stubs/src/videosortfilterproxymodel.cpp \
+ ../../../tsrc/stubs/src/videolistdatamodel.cpp
--- a/videocollection/videocollectionwrapper/inc/videocollectionclient.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/inc/videocollectionclient.h Thu Apr 01 23:22:15 2010 +0300
@@ -19,7 +19,7 @@
#include <vcxmyvideosdefs.h>
#include <QList>
-
+#include "videocollectioncommon.h"
// FORWARD DECLARATIONS
class MMPXCollectionUtility;
@@ -52,21 +52,14 @@
/**
* Initializes object and allocates members
*
+ * @param signal receiver
+ *
* @return 0 if ok, < 0 in case of error
*/
- int initialize();
+ int initialize(VideoDataSignalReceiver *signalReceiver);
public:
- /**
- * Collection level app browsed to
- */
- enum TCollectionLevels
- {
- ELevelInvalid = -1,
- ELevelCategory = 2,
- ELevelVideos = 3
- };
/**
* Collection opening status
@@ -101,11 +94,10 @@
int getCollectionLevel();
/**
- * Returns the current category
+ * Returns the current category requested to open
*
- * @return int
*/
- void getCategoryIds(int& id, int& type);
+ void getCategoryId(TMPXItemId &id);
/**
* Returns reference to collection open status. Client can use
@@ -146,12 +138,12 @@
int deleteVideos(QList<TMPXItemId> *mediaIds);
/**
- * calls collection to open video object defined by the given id
+ * Calls collection to open item defined by the given id.
*
* @param aMediaId id of the item
* @return KErrNone if ok
*/
- int openVideo(TMPXItemId &mediaId);
+ int openItem(TMPXItemId &mediaId);
/**
* calls collection to go back to collection level
@@ -181,16 +173,29 @@
int getVideoDetails(TMPXItemId& aMediaId);
/**
- * Creates a new collection (album).
+ * Add a new album.
+ *
+ * @param title, Album title.
+ * @return TMPXItemId id of created album TMPXItemId:::InvalidId() in case of failure
+ */
+ TMPXItemId addNewAlbum(const QString &title);
+
+ /**
+ * Add a new album.
*
- * @param name Name for the collection.
- * @param thumbnail Path for the image file to use as a thumbnail for the
- * collection. Can be empty.
- * @param mediaIds Media ids of the videos that are added to the collection
- * at creation time. Size can be zero.
- * @return 0, if collection creation was success, below 0 if there was an error.
+ * @param mediaIds, list of album id's to be removed.
+ * @return 0 if no errors.
*/
- int addNewCollection(QString name, QString thumbnail, QList<TMPXItemId> mediaIds);
+ int removeAlbums(const QList<TMPXItemId> &mediaIds);
+
+ /**
+ * Add items in existing album.
+ *
+ * @param albumId, Album where to add items.
+ * @param mediaIds, Items which to add.
+ * @return 0 if no errors.
+ */
+ int addItemsInAlbum(TMPXItemId albumId, const QList<TMPXItemId> &mediaIds);
private:
@@ -234,16 +239,14 @@
* @param videoId id of the video to get details from
*/
void getVideoDetailsL(TMPXItemId &videoId);
-
+
/**
- * Creates a new collection (album).
+ * Removes user created albums.
*
- * @param name Name for the collection.
- * @param mediaIds Media ids of the videos that are added to the collection
- * at creation time. Size can be zero.
+ * @param mediaIds, list of album id's to be removed
*/
- void addNewCollectionL(QString name, QString thumbnail, QList<TMPXItemId> mediaIds);
-
+ void removeAlbumsL(const QList<TMPXItemId> &mediaIds);
+
/**
* Private implementation to handle leaving code while starting to fetch video
* object from collection
@@ -252,6 +255,23 @@
*/
void fetchMpxMediaByMpxIdL(TMPXItemId &mpxId);
+ /**
+ * Create a new album.
+ *
+ * @param title, Album title.
+ * @return album id.
+ */
+ TMPXItemId createAlbumL(const QString &title);
+
+ /**
+ * Add items in an album.
+ *
+ * @param albumId, Album where to add items.
+ * @param mediaIds, Items to add in the album.
+ * @return None.
+ */
+ void addItemsInAlbumL(TMPXItemId albumId, const QList<TMPXItemId> &mediaIds);
+
private:
@@ -279,7 +299,7 @@
/**
* Variable for storing My Videos collection path level.
*/
- TCollectionLevels mCollectionPathLevel;
+ VideoCollectionCommon::TCollectionLevels mCollectionPathLevel;
};
#endif // __VIDEOCOLLECTIONCLIENT_H
--- a/videocollection/videocollectionwrapper/inc/videocollectionlistener.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/inc/videocollectionlistener.h Thu Apr 01 23:22:15 2010 +0300
@@ -25,7 +25,7 @@
// FORWARD DECLARATIONS
class VideoCollectionClient;
class VideoCollectionUtils;
-
+class VideoDataSignalReceiver;
// CLASS DECLARATION
class VideoCollectionListener : public QObject, public MMPXCollectionObserver
@@ -45,17 +45,13 @@
/**
* Constructor
*/
- VideoCollectionListener(VideoCollectionClient &collectionClient);
+ VideoCollectionListener(VideoCollectionClient &collectionClient,
+ VideoDataSignalReceiver &mSignalReceiver);
/**
* Destructor.
*/
virtual ~VideoCollectionListener();
-
- /**
- * Sets provided value for mNewArrayRequest
- */
- void setRequestNewMediaArray(bool request = true );
signals:
@@ -107,6 +103,14 @@
* @param id of video whose details have bee fetched.
*/
void videoDetailsCompleted(TMPXItemId);
+
+ /**
+ * Emitted when album items are recieved.
+ *
+ * @param albumId, Album which items are received.
+ * @param albumItems, Items belonging to the current album.
+ */
+ void albumListAvailable(TMPXItemId albumId, CMPXMediaArray *albumItems);
private: // From MMPXCollectionObserver
@@ -251,17 +255,16 @@
VideoCollectionClient &mCollectionClient;
/**
+ * reference to collection message signal receiver.
+ * Used as observer for performance.
+ */
+ VideoDataSignalReceiver &mSignalReceiver;
+
+ /**
* Reference to utility objetc used to parse CMPXMessages and
* CMPXMedias
*/
VideoCollectionUtils &mVideoUtils;
-
- /**
- * tells wether we have new array requests pending.
- * if true, newVideoList is emitted to notify model we have totally new video list.
- * If false, videoListAppended is emitted.
- */
- bool mNewArrayRequest;
};
--- a/videocollection/videocollectionwrapper/inc/videocollectionutils.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/inc/videocollectionutils.h Thu Apr 01 23:22:15 2010 +0300
@@ -21,6 +21,7 @@
// INCLUDES
#include <QObject>
#include <QString>
+#include <QStringList>
#include <mpxmedia.h>
class VideoCollectionUtils
@@ -124,6 +125,14 @@
QString prepareLengthString(quint32 length);
/**
+ * Prepares length strings from given value.
+ *
+ * @param length Length value in seconds.
+ * @return Lengths as QStringList, first item tells the minutes, second tells seconds
+ */
+ const QStringList prepareLengthStrings(quint32 total);
+
+ /**
* Prepares size string from the given value.
*
* @param size Size value in bytes
@@ -151,5 +160,3 @@
// End of file
-
-
--- a/videocollection/videocollectionwrapper/inc/videocollectionwrapper.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/inc/videocollectionwrapper.h Thu Apr 01 23:22:15 2010 +0300
@@ -77,6 +77,14 @@
public: // Constructor
+ enum TModelType
+ {
+ EAllVideos,
+ ECollections,
+ ECollectionContent,
+ EGeneric
+ };
+
/**
* Returns singleton instance for this class.
*
@@ -84,20 +92,16 @@
*
* @return The singleton instance.
*/
- static VideoCollectionWrapper *instance();
-
- /**
- * Decreases the reference count, when count reaches zero cleanup is done.
- *
- */
- void decreaseReferenceCount();
+ static VideoCollectionWrapper &instance();
/**
* Returns pointer to model
*
+ * @param type of the model
+ *
* @return address to model or NULL if fails.
*/
- VideoSortFilterProxyModel* getModel();
+ VideoSortFilterProxyModel* getModel(int type);
/**
* Method can be used by client to emit status signal
@@ -153,10 +157,6 @@
*/
int mReferenceCount;
- /**
- * Singleton instance.
- */
- static VideoCollectionWrapper* mInstance;
};
#endif // __VIDEOCOLLECTIONWRAPPER_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/inc/videocollectionwrapper_p.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,107 @@
+/*
+* 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: VideoCollectionWrapperPrivate class definition
+*
+*/
+
+#ifndef __VIDEOCOLLECTIONWRAPPERPRIVATE_H__
+#define __VIDEOCOLLECTIONWRAPPERPRIVATE_H__
+
+
+// INCLUDES
+#include <QObject>
+#include <QPointer>
+#include <qabstractitemmodel.h>
+
+
+// FORWARD DECLARATIONS
+class CMPXMediaArray;
+class CMPXMedia;
+class VideoListDataModel;
+class VideoSortFilterProxyModel;
+
+// TODO: MVcxNsMyVideosCategoryModelObserver implementation should probably not be in this class
+class VideoCollectionWrapperPrivate : public QObject
+{
+ Q_DISABLE_COPY(VideoCollectionWrapperPrivate)
+
+ /**
+ * define to be able to use signals and slots
+ */
+ Q_OBJECT
+
+public: // Constructor
+
+ /**
+ * Default constructor
+ */
+ VideoCollectionWrapperPrivate();
+
+ /**
+ * Destructor
+ */
+ ~VideoCollectionWrapperPrivate();
+
+ /**
+ * Returns the pointer into model. Creates the model if it doesn't exists yet.
+ *
+ * @param type type of model
+ * @return address of model, NULL if creation did not succeed.
+ */
+ VideoSortFilterProxyModel* getModel(int &type);
+
+private slots:
+
+
+ /**
+ * Signaled when UI environment is about to be destroyed.
+ * Source model needs to be cleaned up before of that
+ *
+ */
+ void aboutToQuitSlot();
+
+private:
+
+ /**
+ * data model for all videos
+ */
+ QPointer<VideoSortFilterProxyModel> mAllVideosModel;
+
+ /**
+ * data model for collections
+ */
+ QPointer<VideoSortFilterProxyModel> mCollectionsModel;
+
+ /**
+ * data model for collection content
+ */
+ QPointer<VideoSortFilterProxyModel> mCollectionContentModel;
+
+ /**
+ * data model for collection content
+ */
+ QPointer<VideoSortFilterProxyModel> mGenericModel;
+
+ /**
+ * source model
+ */
+ QPointer<VideoListDataModel> mSourceModel;
+
+};
+#endif // __VIDEOCOLLECTIONWRAPPERPRIVATE_H__
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/inc/videodatacontainer.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,180 @@
+/*
+* 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: videodatacontainer class definition*
+*/
+
+#ifndef __VIDEODATACONTAINER_H__
+#define __VIDEODATACONTAINER_H__
+
+// INCLUDES
+#include <qhash.h>
+#include <qlist.h>
+#include <qpair.h>
+#include <mpxitemid.h>
+
+// FORWARD DECLARATIONS
+class CMPXMedia;
+
+class VideoDataContainer
+{
+public:
+
+ /**
+ * contructor
+ */
+ VideoDataContainer();
+
+ /**
+ * destructor
+ */
+ virtual ~VideoDataContainer();
+
+public: // from QHash
+
+ /**
+ * Deallocates all CMPXMedia objects and clear containers
+ */
+ void clear();
+
+ /**
+ * Deallocates and removes item of provided id.
+ *
+ * @param id media item id
+ */
+ void remove(const TMPXItemId &id);
+
+ /**
+ * Appends provided media object to container.
+ * If item with same id exists allready, old item is being
+ * removed and replaced by the new item
+ *
+ * @param media - media object to append
+ */
+ void append(CMPXMedia *media);
+
+ /**
+ * Returns a media object from provided index
+ *
+ * @param index position of wanted object
+ *
+ * @return CMPXMedia pointer to media object or null if
+ * object is not found from wanted index
+ *
+ */
+ CMPXMedia* fromIndex(int index) const;
+
+ /**
+ * Returns an index of id.
+ *
+ * @param id item id
+ *
+ * @return int index of item or -1 if item with provided id is not found
+ */
+ int indexOfId(const TMPXItemId &id) const;
+
+ /**
+ * Returns id of item from provided index
+ *
+ * @param index potisiotn where to look for item
+ *
+ * @return id of item or invalid TMPXItemId if item is not found from provided index
+ */
+ TMPXItemId idFromIndex(int index) const;
+
+ /**
+ * returns count of items
+ *
+ * @return int
+ */
+ int count() const;
+
+ /**
+ * Method removes item from data container at provided index and
+ * appends it into removed buffer.
+ *
+ * Note that calling this method decreases item count and causes
+ * indexes after provided index to be resynch. This causes callers
+ * index list to be out of sync if not called starting from the
+ * biggest index
+ *
+ * @param inteIndex index of item
+ * @return TMPXItemId id of the item marked as removed
+ */
+ TMPXItemId markItemRemoved(const int &itemIndex);
+
+ /**
+ * Method removes provided items from mRemovedMedia
+ *
+ * @param itemIds ids of items to be removed. If null, removes all
+ * @return int count of items actually removed
+ */
+ int clearRemoved(QList<TMPXItemId> *itemIds = 0);
+
+ /**
+ * Method removed provided items from mRemovedMedia and returns them
+ * int actual container
+ *
+ * @param itemIds ids of items to be restored. If null, restores all
+ *
+ * @return int count of items actually restored
+ */
+ int restoreRemovedItems(QList<TMPXItemId> *itemIds = 0);
+
+ /**
+ * Returns item from removed buffer
+ *
+ * @param itemId id of item to be returned
+ */
+ CMPXMedia* getRemovedMedia(TMPXItemId itemId);
+
+private:
+
+ /**
+ * Decrements indexes of items in mMediaData by one after
+ * provided items.
+ * Item iterator is first found based on item id gotten from id list
+ * and items' indexes after that are to be decreased.
+ *
+ * @param fromindex - index from where to start decreasing
+ */
+ void decIndexesAfter(int fromIndex);
+
+private: // data
+
+ /**
+ * list of media ids used to fetch item thought index.
+ */
+ QList<TMPXItemId> mMediaIds;
+
+ /**
+ * lookup hash for fetching correct item based on id
+ * Key: item id
+ * value: pair, where first is item index and second is item data
+ */
+ QHash<TMPXItemId, QPair<int, CMPXMedia*> > mMediaData;
+
+ /**
+ * lookup hash for media items that are deleted, but not yet completely
+ * removed from the filesystem.
+ */
+ QHash<TMPXItemId, CMPXMedia*> mRemovedMedia;
+
+};
+
+#endif // __VIDEODATACONTAINER_H__
+
+
+
+
+
--- a/videocollection/videocollectionwrapper/inc/videodatasignalreceiver.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/inc/videodatasignalreceiver.h Thu Apr 01 23:22:15 2010 +0300
@@ -23,7 +23,7 @@
#include <QObject>
#include <mpxcollectionmessagedefs.h>
#include <mpxitemid.h>
-#include <Qlist>
+#include <QList>
// FORWARD DECLARATIONS
class CMPXMediaArray;
@@ -69,11 +69,11 @@
virtual void newVideoAvailableSlot( CMPXMedia* aVideo ) = 0;
/**
- * Signaled when received an avent about externally removed video.
+ * Signaled when received an avent about externally removed item.
*
- * @param videoId video id
+ * @param itemId item id
*/
- virtual void videoDeletedSlot( TMPXItemId videoId ) = 0;
+ virtual void itemDeletedSlot( TMPXItemId itemId ) = 0;
/**
* Signaled when multiple video deletion command is completed.
@@ -84,11 +84,27 @@
virtual void videoDeleteCompletedSlot( int overallCount, QList<TMPXItemId> *failedMediaIds ) = 0;
/**
+ * Signaled when album remove command is completed and some albums were not removed.
+ *
+ * @param failedMediaIds media-array containing failed medias
+ */
+ virtual void albumRemoveFailureSlot( QList<TMPXItemId> *failedMediaIds ) = 0;
+
+ /**
* Signaled when all details for a video have been fetched.
*
* @param aMedia MPX Media that contains all details.
*/
virtual void videoDetailsCompletedSlot( TMPXItemId videoId ) = 0;
+
+ /**
+ * Signalled when album items are recieved.
+ *
+ * @param albumId, Album which items are received.
+ * @param albumItems, Items belonging to the current album.
+ */
+ virtual void albumListAvailableSlot(TMPXItemId albumId,
+ CMPXMediaArray *albumItems) = 0;
};
#endif // __VIDEOMODELOBSERVER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/inc/videodeleteworker.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,176 @@
+/*
+* 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: VideoDeleteWorker class definition*
+*/
+
+#ifndef __VIDEODELETEWORKER_H__
+#define __VIDEODELETEWORKER_H__
+
+
+// INCLUDES
+#include <QObject>
+#include <qvariant.h>
+#include <qset.h>
+#include <qlist.h>
+#include <e32const.h>
+#include <mpxitemid.h>
+
+// FORWARD DECLARATIONS
+class QTimer;
+class VideoListDataModelPrivate;
+class VideoCollectionClient;
+
+
+class VideoDeleteWorker : public QObject
+{
+ /**
+ * define to be able to use signals and slots
+ */
+ Q_OBJECT
+
+ /**
+ * disable copy-constructor and assignment operator
+ */
+ Q_DISABLE_COPY(VideoDeleteWorker)
+
+public:
+
+ /**
+ * Default constructor
+ */
+ VideoDeleteWorker(VideoCollectionClient &collection, QObject *parent = 0);
+
+ /**
+ * Destructor
+ */
+ ~VideoDeleteWorker();
+
+ /**
+ * Sets items into mRemoveBuffer. And starts deleting of items in
+ * blocks using mRequestWaitTimer interval
+ *
+ * @param itemList items to be deleted
+ */
+ void requestDelete(const QList<TMPXItemId> &itemList);
+
+ /**
+ * Removes item from the delete and pending buffer
+ *
+ * @param itemId item id to removed
+ *
+ * @returns a coutn of remaining requests
+ */
+ int removeFromRequest(TMPXItemId &itemId);
+
+ /**
+ * returns true in case there are items at the delete buffer
+ *
+ * @return bool
+ */
+ bool isDeleting();
+
+ /**
+ * Updates error status
+ *
+ * @param status value to update
+ * @param data data to update
+ *
+ */
+ void updateStatus(int status, QVariant data);
+
+ /**
+ * returns latest status and data
+ *
+ * @param data to return
+ *
+ * @return status code
+ */
+ int getLastStatus(QVariant &data);
+
+ /**
+ * method resets status and statusdatas
+ */
+ void clearStatus();
+
+public slots:
+
+ /**
+ * Continues deleting in case there are items
+ * yet to be deleted
+ */
+ void continueSlot();
+
+private:
+
+ /**
+ * methods dumps all remaining deletes to collection
+ * without caring the result codes.
+ */
+ void flushAll();
+
+private slots:
+
+ /**
+ * creates a block of deleted items and calls collection
+ * to startup deletion
+ */
+ void execDeleteBlockSlot();
+
+
+
+signals:
+
+ /**
+ * Emitted if some delete startup fails.
+ *
+ * @param list of item ids whose edletion does not start
+ */
+ void deleteStartupFailed(QList<TMPXItemId>);
+
+private:
+
+ /**
+ * reference to collection client.
+ * Not own.
+ */
+ VideoCollectionClient &mCollectionClient;
+
+ /**
+ * buffer for items to be removed
+ */
+ QSet<TMPXItemId> mRemoveBuffer;
+
+ /**
+ * timer whose interval is used between delete
+ * requests to collection
+ */
+ QTimer *mRequestWaitTimer;
+
+ /**
+ * last error status
+ */
+ int mLastStatus;
+
+ /**
+ * last error data
+ */
+ QVariant mLastStatusData;
+
+};
+#endif // __VIDEODELETEWORKER_H__
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/inc/videolistdatamodel.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,320 @@
+/*
+* 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: VideoListDataModel class definition*
+*/
+
+#ifndef __VIDEOLISTDATAMODEL_H__
+#define __VIDEOLISTDATAMODEL_H__
+
+
+// INCLUDES
+#include <QObject>
+#include <qabstractitemmodel.h>
+#include <e32const.h>
+#include <mpxitemid.h>
+
+
+// FORWARD DECLARATIONS
+class VideoListDataModelPrivate;
+class VideoThumbnailData;
+class VideoCollectionClient;
+class VideoDeleteWorker;
+
+
+class VideoListDataModel : public QAbstractItemModel
+{
+ /**
+ * define to be able to use signals and slots
+ */
+ Q_OBJECT
+
+ /**
+ * disable copy-constructor and assignment operator
+ */
+ Q_DISABLE_COPY(VideoListDataModel)
+
+ /**
+ * private class declaration macro
+ */
+ Q_DECLARE_PRIVATE_D( d_ptr, VideoListDataModel )
+
+public:
+
+ /**
+ * Default constructor
+ */
+ VideoListDataModel(QObject *parent = 0);
+
+ /**
+ * Destructor
+ */
+ ~VideoListDataModel();
+
+ /**
+ * Initializes model. Sets model cache proxy and cache's plugin to
+ * to be this object. Creates videolist and puts it to observe
+ * collection client. Calls connectSignals to connect signals into
+ * appropriate slots
+ *
+ *
+ * @return int: 0 if everything ok
+ */
+ int initialize( );
+
+ /**
+ * returns collectionclient object
+ *
+ * @return VideoCollectionClient*
+ */
+ VideoCollectionClient* getCollectionClient();
+
+ /**
+ * Method calls video list data to check if there are valid media object
+ * at the given index. If there is, item id is returned.
+ *
+ * @param index index of the item to be opened
+ * @return TMPXItemId item id or TMPXItemId::Invalid() if no valid item.
+ */
+ TMPXItemId mediaIdAtIndex(int index) const;
+
+ /**
+ * returns model index of id provided
+ *
+ * @param id of the item
+ * @return modelIndex
+ */
+ QModelIndex indexOfId(TMPXItemId id);
+
+ /**
+ * Method calls video list data to check if there are valid media object
+ * for the given media id. If there is, file path for is returned.
+ *
+ * @param mediaId id of the item to be opened
+ * @return QString file path of the media at index, empty string if not valid item.
+ */
+ QString mediaFilePathForId(TMPXItemId mediaId) const;
+
+ /**
+ * Called by the client when removal of videos are requested.
+ * Sets video status to be removed to videolistdata and
+ * eventually calls collection to handle the actual removing.
+ *
+ * @param indexlist list of indeces of items requested for deletion
+ *
+ * @return bool true if removal startup succeeds
+ */
+ bool removeRows(const QModelIndexList &indexList);
+
+ /**
+ * Checks if the specified item belongs to currently open album.
+ *
+ * @param albumId, Album to be checked. If zero, using the currently open album.
+ * @param itemId, Item to be checked.
+ * @return true if item belongs to the album.
+ */
+ bool belongsToAlbum(const TMPXItemId &itemId, TMPXItemId albumId = TMPXItemId::InvalidId()) const;
+
+ /**
+ * Set album in use.
+ *
+ * @param albumId, Album to set in use.
+ * @return None.
+ */
+ void setAlbumInUse(TMPXItemId albumId);
+
+ /**
+ * returns album id currently in use
+ *
+ * @return TMPXItemId
+ */
+ TMPXItemId albumInUse();
+
+public: // from QAbstractItemModel
+
+ /**
+ * Returns video item count to the proxy cache
+ *
+ * @param parent, parent's index, not used
+ *
+ * @return int count of items
+ */
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+
+ /**
+ * Returns video item data from index pointed by
+ * given QModelIndex's row index:
+ * - video name
+ * - video detail row
+ * - video thumbnail
+ *
+ * If fetch more is setted for given index tries to append
+ * additional details into map as well.
+ *
+ * @param index, index of the item data is requested
+ *
+ * @return QMap<int, QVariant> item data
+ */
+ QMap<int, QVariant> itemData(const QModelIndex &index) const;
+
+ /**
+ * data
+ */
+ QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
+
+ /**
+ * columnCount
+ */
+ int columnCount(const QModelIndex & parent = QModelIndex()) const;
+
+ /**
+ * index
+ */
+ QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const;
+
+ /**
+ * Parent
+ */
+ QModelIndex parent(const QModelIndex & index) const;
+
+signals:
+
+ /**
+ * This signal is connected to video list's details ready
+ * -signal indicating that video details data is fetched ok
+ *
+ * @param id of the video item
+ */
+ void fullVideoDetailsReady(TMPXItemId id);
+
+ /**
+ * This signal is connected to proxy models short details ready
+ * -signal indicating that video details data fetching started ok
+ *
+ * @param id of the video item
+ */
+ void shortDetailsReady(TMPXItemId id);
+
+ /**
+ * Signals that the model is ready, ie. loaded all data from
+ * myvideocollection.
+ */
+ void modelReady();
+
+ /**
+ * Signal to be emitted when something has happened in the
+ * model's data container
+ */
+ void modelChanged();
+
+ /**
+ * Signals that album content has been updated.
+ */
+ void albumChanged();
+
+private slots:
+
+ /**
+ * signaled by the deleteworker in case some delete startup fails
+ *
+ * @param ids list of ids whose deletion fails
+ */
+ void deleteStartingFailsSlot(QList<TMPXItemId> ids);
+
+private:
+
+ /**
+ * Method connects signals emitted from or throught this object
+ */
+ int connectSignals();
+
+ /**
+ * method disconnects signals
+ */
+ void disconnectSignals();
+
+ /**
+ * Generates a detail row string for the video item
+ * at the given index.
+ *
+ * In case item is not found in the provided index, empty
+ * string is returned.
+ *
+ * @param index, index of the item data is requested
+ *
+ * @return QString detail string
+ */
+ QString prepareDetailRow( int index ) const;
+
+ /**
+ * Generates a video size string from video item at given index
+ *
+ * In case item is not found in the provided index, empty
+ * string is returned.
+ *
+ * @param index, index of the item data is requested
+ *
+ * @return QString size string
+ */
+ QString prepareSizeString( int index ) const;
+
+ /**
+ * Called when there are status changes in some async operation
+ *
+ * @param statusCode status of operation
+ * @data data from operation
+ */
+ void reportAsyncStatus(int statusCode, QVariant &additional);
+
+ /**
+ * Generates a video length strings from video item at given index
+ *
+ * In case item is not found in the provided index, empty
+ * strings are returned.
+ *
+ * @param index, index of the item data is requested
+ *
+ * @return Lengths as QStringList, first item tells the minutes, second tells seconds
+ */
+ QStringList prepareLengthStrings( int index ) const;
+
+private:
+
+ /**
+ * Private implementation Contains the actual video data and
+ * video array. Own.
+ */
+ VideoListDataModelPrivate* const d_ptr;
+
+ /**
+ * Pointer to collection client. Used to send commands to collection.
+ * Owned.
+ */
+ VideoCollectionClient *mCollectionClient;
+
+ /**
+ * object for handling item deletion conveniently in small blocks.
+ * Own
+ */
+ VideoDeleteWorker *mDeleteWorker;
+
+ /**
+ * initialized flag
+ */
+ bool mInitialized;
+
+};
+#endif // __VIDEOLISTDATAMODEL_H__
+
+// End of file
+
--- a/videocollection/videocollectionwrapper/inc/videolistdatamodel_p.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/inc/videolistdatamodel_p.h Thu Apr 01 23:22:15 2010 +0300
@@ -22,6 +22,7 @@
#include <QObject>
#include <qicon.h>
#include <qdatetime.h>
+#include <qhash.h>
#include <qset.h>
#include <qabstractitemmodel.h>
#include <e32const.h>
@@ -32,6 +33,7 @@
// FORWARD DECLARATIONS
class VideoListDataModel;
class CMPXMediaArray;
+class CMPXMedia;
class VideoThumbnailData;
class VideoListDataModelPrivate : public VideoDataSignalReceiver
@@ -45,6 +47,11 @@
* disable copy-constructor and assignment operator
*/
Q_DISABLE_COPY(VideoListDataModelPrivate)
+
+ /**
+ * we're friend of the actual model object
+ */
+ friend class VideoListDataModel;
public: // Constructor
@@ -85,10 +92,10 @@
* This signal is emitted, collection notifies details for item has been
* fetched
*
- * @param rowindex
+ * @param itemId
*
*/
- void videoDetailsReady(int rowIndex);
+ void videoDetailsReady(TMPXItemId itemId);
private slots:
@@ -135,12 +142,12 @@
/**
* Signaled by the collection client when
- * video removal has detected.
+ * item removal has detected.
*
- * @param videoId id of the removed video
+ * @param itemId id of the removed item
*/
- void videoDeletedSlot(TMPXItemId videoId);
-
+ void itemDeletedSlot(TMPXItemId itemId);
+
/**
* Signaled by the collection client video deletion request
* has completed
@@ -148,8 +155,16 @@
* @param overallCount count of ALL videos in this delete procedure
* @param failedMediaIds list of item ids that failed to be removed.
*/
- void videoDeleteCompletedSlot( int overallCount, QList<TMPXItemId> *failedMediaIds);
+ void videoDeleteCompletedSlot(int overallCount, QList<TMPXItemId> *failedMediaIds);
+
+ /**
+ * Signaled when album remove command is completed and some albums were not removed.
+ *
+ * @param failedMediaIds media-array containing failed medias
+ */
+ void albumRemoveFailureSlot(QList<TMPXItemId> *failedMediaIds);
+
/**
* Signaled by the collection client when video details fetching
* has completed.
@@ -157,6 +172,14 @@
*/
void videoDetailsCompletedSlot(TMPXItemId videoId);
+ /**
+ * Signalled when album items are recieved.
+ *
+ * @param albumId, Album which items are received.
+ * @param albumItems, Items belonging to the current album.
+ */
+ void albumListAvailableSlot(TMPXItemId albumId, CMPXMediaArray *albumItems);
+
public: // services
/**
@@ -247,30 +270,22 @@
QMap<QString, QVariant> getMetaDataFromIndex(int index) const;
/**
- * Returns video status
- *
- * @param index: item position where client wants the status from.
+ * marks videos to be removed: it's id and index are saved to
+ * remove buffer in data container
*
- * @return int status code
- */
- int getVideoStatusFromIndex(int index) const;
-
- /**
- * marks videos to be removed: it's id and index are saved to
- * mItemsUnderDeletion
- *
- * @param itemIndexes: indexes of items to be removed
- * @return QList: list of ids about removed items
+ * @param itemIndex: index of item to be removed
+ * @return TMPXItemId: id of the item marked
*
*/
- QList<TMPXItemId> markVideosRemoved(const QModelIndexList &itemIndexes);
+ TMPXItemId markVideoRemoved(const QModelIndex &itemIndex);
/**
* Removes provided ids from the remove -list
+ * and restores them into actual container in case
+ * our current collection level is correct.
*
- * @param itemIds ids of the items to be removed
*/
- void unMarkVideosRemoved(QList<TMPXItemId> &itemIds);
+ void restoreRemoved(QList<TMPXItemId> *idList);
/**
* Returns the file path of the video.
@@ -286,6 +301,23 @@
*/
const QString getFilePathForId(TMPXItemId mediaId) const;
+ /**
+ * Checks if the specified item belongs to currently open album.
+ *
+ * @albumId, Album where the item is to be checked.
+ * @param itemId, Item to be checked.
+ * @return true if item belongs to the album.
+ */
+ bool belongsToAlbum(const TMPXItemId &itemId, TMPXItemId albumId = TMPXItemId::InvalidId()) const;
+
+ /**
+ * Set album in use.
+ *
+ * @param albumId, Album to set in use.
+ * @return None.
+ */
+ void setAlbumInUse(TMPXItemId albumId);
+
private: // private methods
/**
@@ -321,7 +353,34 @@
*
*/
void appendDataToContainerL(CMPXMediaArray *videoArray, unsigned int startIndex = 0);
-
+
+ /**
+ * Check that a media item is valid.
+ *
+ * @param itemId, Item to be checked.
+ * @return true if valid.
+ */
+ bool isValid(const CMPXMedia &media, const TMPXItemId &itemId) const;
+
+ /**
+ * Appends data in album.
+ */
+ void appendDataToAlbumL(TMPXItemId albumId, CMPXMediaArray *videoArray);
+
+ /**
+ * Called when an album has been removed.
+ *
+ * @param albumId, Album which items are received.
+ */
+ void albumRemoved(TMPXItemId albumId);
+
+ /**
+ * Called when a video has been removed.
+ *
+ * @param videoId id of the removed video
+ */
+ void videoDeleted(TMPXItemId videoId);
+
private:
/**
@@ -334,23 +393,27 @@
* media object container
*/
VideoDataContainer mMediaData;
-
- /**
- * set containing item(s)' ids whose, removal
- * is underway.
- */
- QSet<TMPXItemId> mItemsUnderDeletion;
/**
- * Thumbnail handler object.
+ * Thumbnail handler object, not owned
*/
- VideoThumbnailData &mVideoThumbnailData;
+ VideoThumbnailData *mVideoThumbnailData;
/**
* Object is initialized.
*/
bool mInitialized;
-
+
+ /**
+ * "wrapped" album container, contains item ids belongint into a particular album
+ * or category
+ */
+ QHash<TMPXItemId, QSet<TMPXItemId> > mAlbumData;
+
+ /**
+ * currently open album
+ */
+ TMPXItemId mCurrentAlbum;
};
#endif // __VIDEOLISTDATAMODEL_P_H__
--- a/videocollection/videocollectionwrapper/inc/videosortfilterproxymodel.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/inc/videosortfilterproxymodel.h Thu Apr 01 23:22:15 2010 +0300
@@ -39,7 +39,7 @@
* @param parent parent of this widget
* @param client Collection client pointer to use.
*/
- VideoSortFilterProxyModel(QObject *parent=0);
+ VideoSortFilterProxyModel(int type, QObject *parent=0);
/**
* Destructor.
@@ -59,7 +59,7 @@
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.
@@ -81,6 +81,15 @@
* 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
@@ -95,10 +104,10 @@
* on the type of the item, the behaviour or result could be
* quite different.
*
- * @param index index of the item to be opened
+ * @param item id id of the item to be opened
* @return int 0 succeeds, <0 if opening does not succeed.
*/
- int openItem(const QModelIndex &index);
+ int openItem(TMPXItemId mediaId);
/**
* Return to collection level
@@ -122,8 +131,16 @@
* @return TMPXItemId mpx id if succeeds TMPXItemId::InvalidId() in case of error
*
*/
- TMPXItemId getMediaIdAtIndex(const QModelIndex &index);
-
+ TMPXItemId getMediaIdAtIndex(const QModelIndex &index) const;
+
+ /**
+ * returns qmodelindex of item id provided.
+ *
+ * @param item id
+ * @return QModelIndex;
+ */
+ QModelIndex indexOfId(TMPXItemId id);
+
/**
* Method checks that model exists and asks for file path from
* given object.
@@ -135,40 +152,90 @@
QString getMediaFilePathForId(TMPXItemId mediaId);
/**
- * Adds a collection (album).
+ * 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 name Name for the collection.
- * @param thumbnail Path for the image file to use as a thumbnail for the
- * collection. Can be empty.
- * @param mediaIds Media ids of the videos that are added to the collection
- * at creation time. Size can be zero.
- * @return 0, if collection creation was success, below 0 if there was an error.
+ * @param indexList, list of album indexes to be removed.
+ * @return 0 if no errors.
*/
- int addNewCollection(QString name, QString thumbnail, QList<TMPXItemId> mediaIds);
+ 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<TMPXItemId> &mediaIds);
+
+ /**
+ * 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 TMPXItemId item id used as filter
+ */
+ void setGenericIdFilter(TMPXItemId itemId, bool filterValue);
+
+ /**
+ * Gets the currently opened item.
+ *
+ * @param None.
+ * @return TMPXItemId.
+ */
+ TMPXItemId getOpenItem() const;
+
signals:
-// TODO should the index be QModelIndex instead?
/**
* Signal to be emitted if detail fetching started ok
*
* @param index, index of the item
*/
- void shortDetailsReady(int index);
+ void shortDetailsReady(TMPXItemId itemId);
/**
* Signal to be emitted after all details are being fetched.
*
* @param index, index of the item
*/
- void fullDetailsReady(int index);
+ void fullDetailsReady(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();
protected: // from QSortFilterProxyModel
@@ -197,6 +264,31 @@
*/
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:
/**
@@ -212,11 +304,26 @@
VideoCollectionClient *mCollectionClient;
/**
+ * type of data excepted
+ */
+ int mType;
+
+ /**
* Currently open level.
*/
int mLevel;
/**
+ * item id used as filter if model type is generic model
+ */
+ TMPXItemId mGenericFilterId;
+
+ /**
+ * flag used
+ */
+ bool mGenericFilterValue;
+
+ /**
* Timer object. Owned.
*/
QTimer *mIdleSortTimer;
--- a/videocollection/videocollectionwrapper/inc/videothumbnaildata.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/inc/videothumbnaildata.h Thu Apr 01 23:22:15 2010 +0300
@@ -18,18 +18,16 @@
#define __VIDEOTHUMBNAILDATA_H__
// INCLUDES
-#include <QObject>
-#include <QHash>
-#include <QPair>
-#include <QIcon>
-#include <QSet>
-#include <QPointer>
+#include <qobject.h>
+#include <qicon.h>
+#include <qpointer.h>
#include <mpxitemid.h>
#include "videocollectionexport.h"
// FORWARD DECLARATIONS
class VideoThumbnailDataPrivate;
+class VideoSortFilterProxyModel;
// CLASS DECLARATIONS
@@ -64,24 +62,6 @@
*
*/
static VideoThumbnailData &instance();
-
- /**
- * Method starts fetching thumbnail for the video specified by given mediaId
- * Media IDs are used as a key identification in the thumbnail map where data is
- * collected. Id is passed to thumbnail manager as internal data and when
- * thumbnail is fetched and thumbnailReadySlot is signaled, id is used to notify
- * client about which item's thumbnail is ready.
- *
- * If thumbnail fetching is started succesfully, method saves thumbnail item
- * into local repository with default thumbnail data.
- *
- * @param mediaId media id for which to start fetching thumbnail
- * @param priority priority for the fetch
- *
- * @return int: thumbnail id or -1 if fetch starting fails.
- *
- */
- int startFetchingThumbnail(int mediaId, int priority);
/**
* Method removes thumbnail data from the local repository.
@@ -108,12 +88,14 @@
const QIcon* getThumbnail(TMPXItemId mediaId);
/**
- * Starts background thumbnail fetching.
+ * Starts background thumbnail fetching, the model used for the background fetching
+ * is also changed.
*
+ * @param model model of the items for the fetching.
* @param fetchIndex index where to start the background thumbnail fetching.
*
*/
- void startBackgroundFetching(int fetchIndex);
+ void startBackgroundFetching(VideoSortFilterProxyModel *model, int fetchIndex);
/**
* Enables or disables thumbnail background fetching. Default is enabled.
@@ -123,6 +105,14 @@
void enableBackgroundFetching(bool enable);
/**
+ * Enables or disables thumbnail creation. Default is enabled. Thumbnails
+ * that have been already generated are fetched still.
+ *
+ * @param enable true enables and false disables thumbnail creation.
+ */
+ void enableThumbnailCreation(bool enable);
+
+ /**
* Frees allocated data for thumbnails and cancels ongoing fetches.
*
*/
--- a/videocollection/videocollectionwrapper/inc/videothumbnaildata_p.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/inc/videothumbnaildata_p.h Thu Apr 01 23:22:15 2010 +0300
@@ -29,11 +29,11 @@
#include <mpxitemid.h>
// FORWARD DECLARATIONS
-class ThumbnailManager;
class VideoCollectionWrapper;
class VideoSortFilterProxyModel;
class QModelIndex;
class QTimer;
+class VideoThumbnailFetcher;
class VideoThumbnailDataPrivate : public QObject
{
@@ -43,8 +43,7 @@
Q_OBJECT
public:
-
-
+
/**
* Default constructor
*/
@@ -56,38 +55,6 @@
virtual ~VideoThumbnailDataPrivate();
/**
- * Starts fetching thumbnails for medias in the model defined by the indexes
- * parameter. Priority for the thumbnails is ascending starting from the
- * defined priority. Uses method startFetchingThumbnail for the actual
- * fetching.
-
- *
- * param @indexes indexes of the medias in the model
- * param @priority starting priority for the thumbnails
- *
- * @return int count of fetches started or -1 in case of error.
- */
- int startFetchingThumbnails(const QList<QModelIndex> &indexes, int priority);
-
- /**
- * Method starts fetching thumbnail for the video specified by given mediaId
- * Media IDs are used as a key identification in the thumbnail map where data is
- * collected. Id is passed to thumbnail manager as internal data and when
- * thumbnail is fetched and thumbnailReadySlot is signaled, id is used to notify
- * client about which item's thumbnail is ready.
- *
- * If thumbnail fetching is started succesfully, method saves thumbnail item
- * into local repository with default thumbnail data.
- *
- * @param mediaId media id for which to start fetching thumbnail
- * @param priority priority for the fetch
- *
- * @return int: thumbnail id or -1 if fetch starting fails.
- *
- */
- int startFetchingThumbnail(TMPXItemId mediaId, int priority);
-
- /**
* Method returns a pointer to video's thumbnail.
*
* If thumbnail fetching is ongoing or not yet started, pointer to default thumbnail
@@ -102,7 +69,7 @@
const QIcon* getThumbnail(TMPXItemId mediaId);
/**
- * Method removes thumbnail data from the local repository.
+ * Method removes thumbnail data from the icon cache.
*
* @param mediaId id for media whose thumbnail is to be removed
*
@@ -114,9 +81,10 @@
/**
* Starts background thumbnail fetching from the given fetch index.
*
+ * @param model model of the items for the fetching.
* @param fetchIndex index where to start the background thumbnail fetching.
*/
- void startBackgroundFetching(int fetchIndex);
+ void startBackgroundFetching(VideoSortFilterProxyModel *model, int fetchIndex);
/**
* Enables or disables thumbnail background fetching.
@@ -124,7 +92,15 @@
* @param enable true enables and false disables thumbnail background fetching.
*/
void enableBackgroundFetching(bool enable);
-
+
+ /**
+ * Enables or disables thumbnail creation. Default is enabled. Thumbnails
+ * that have been already generated are fetched still.
+ *
+ * @param enable true enables and false disables thumbnail creation.
+ */
+ void enableThumbnailCreation(bool enable);
+
/**
* Frees allocated data for thumbnails and cancels ongoing fetches.
*/
@@ -159,6 +135,31 @@
void disconnectSignals();
/**
+ * Starts fetching thumbnails for medias in the model defined by the indexes
+ * parameter. Priority for the thumbnails is ascending starting from the
+ * defined priority.
+ *
+ * param @indexes indexes of the medias in the model
+ * param @priority starting priority for the thumbnails
+ *
+ * @return int count of fetches started or -1 in case of error.
+ */
+ int startFetchingThumbnails(const QList<QModelIndex> &indexes, int priority);
+
+ /**
+ * Method starts fetching thumbnail for the video specified by given mediaId
+ * Media IDs are used as a key identification in the thumbnail map where data is
+ * collected.
+ *
+ * @param mediaId media id for which to start fetching thumbnail
+ * @param priority priority for the fetch
+ *
+ * @return int: thumbnail id or -1 if fetch starting fails.
+ *
+ */
+ int startFetchingThumbnail(TMPXItemId mediaId, int priority);
+
+ /**
* Appends indexes in the source model to the list between start and end.
*
* @param indexes list of indexes
@@ -178,18 +179,6 @@
const QIcon* defaultThumbnail(TMPXItemId mediaId);
/**
- * Removes given id from the fetch list. Fetch list is an internal id list containing
- * thumbnail ids currently under fetching.
- *
- * When list is emptied the background thumbnail fetching is continued.
- *
- * @param tnId thumbnail id to be removed from the list
- *
- * @return true if id was found from fetch list, otherwise false.
- */
- bool removeFromFetchList(int tnId);
-
- /**
* Starts timer that continues the background thumbnail fetching at timeout.
*/
void continueBackgroundFetch();
@@ -207,29 +196,21 @@
private slots:
/**
- * Thumbnail manager signals this slot when thumbnail is ready
- * for some item.
+ * Thumbnail fetcher signals this slot when thumbnail is ready
+ * for some item. Thumbnail data is saved to icon cache.
*
* @param tnData: thumbnail
* @param internal: internal data contains pointer to the media id used in emitted signal
- * @param id: thumbnail id
* @param error: possible error code from thumbnail manager ( 0 == ok )
*
*/
- void thumbnailReadySlot(QPixmap tnData, void *internal , int id , int error);
+ void thumbnailReadySlot(QPixmap tnData, void *internal, int error);
/**
- * VideoSortFilterProxyModel signals this slot when the layout of items in the model have
- * changed.
+ * VideoListDataModel signals this slot when the model has been changed.
*
*/
- void layoutChangedSlot();
-
- /**
- * VideoSortFilterProxyModel signals this slot when the rows have been inserted to the model.
- *
- */
- void rowsInsertedSlot(const QModelIndex & parent, int start, int end);
+ void modelChangedSlot();
/**
* Fetches thumbnails around of mCurrentFetchIndex in batches of THUMBNAIL_BACKGROUND_FETCH_AMOUNT.
@@ -251,29 +232,23 @@
*
*/
void reportThumbnailsReadySlot();
+
+ /**
+ * Thumbnail fetcher signals this when all thumbnails have been fetched.
+ */
+ void allThumbnailsFetchedSlot();
private: // Data
- /**
- * Thumbnail manager object.
- */
- ThumbnailManager *mThumbnailManager;
-
- /**
- * list containing thumbnails ids which data is
- * currently being fetched from the tn wrapper.
- * empty if there are no thumbnail fetching
- * ongoing
- */
- QSet<int> mFetchList;
-
+ VideoThumbnailFetcher *mThumbnailFetcher;
+
/**
* Local data map for thumbnail data:
* - key is the video's media id
* - data is the actual thumbnail data.
* If thumbnail data is not yet fetched, QIcon is default thumbnail.
*/
- QCache<TMPXItemId, QIcon> mThumbnailData;
+ QCache<TMPXItemId, QIcon> mThumbnailData;
/**
* Default thumbnail for a video.
@@ -286,15 +261,10 @@
QIcon *mDefaultTnCategory;
/**
- * Wrapper to collection.
+ * Current model, set at call to startBackgroundFetching.
*/
- VideoCollectionWrapper *mCollectionWrapper;
-
- /**
- * Model containing the media, not owned.
- */
- QPointer<VideoSortFilterProxyModel> mModel;
-
+ QPointer<VideoSortFilterProxyModel> mCurrentModel;
+
/**
* Current index for background thumbnail fetching.
*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/inc/videothumbnailfetcher.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,201 @@
+/*
+* 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: VideoThumbnailFetcher class definition
+*
+*/
+
+#ifndef __VIDEOTHUMBNAILDATAFETCHER_H__
+#define __VIDEOTHUMBNAILDATAFETCHER_H__
+
+// INCLUDES
+#include <qobject.h>
+#include <qicon.h>
+#include <qlist.h>
+#include <qhash.h>
+
+#include <thumbnailmanager_qt.h>
+
+// FORWARD DECLARATIONS
+
+class VideoThumbnailFetcher : public QObject
+{
+ /**
+ * defined to be able to use signals and slots
+ */
+ Q_OBJECT
+
+public:
+
+ /**
+ * Default constructor
+ */
+ VideoThumbnailFetcher();
+
+ /**
+ * Desctructor
+ */
+ ~VideoThumbnailFetcher();
+
+ /**
+ * Adds thumbnail fetch to the fetch list. pauseFetching should be called
+ * before adding fetches for performance reasons. After all fetches have
+ * been added, call continueFetching to start the fetch process which passes
+ * the internal data to thumbnail manager. Signal thumbnailReady is emitted
+ * when fetch is complete.
+ *
+ * @param fileName path to the media.
+ * @param internal data identifying the media.
+ * @param priority priority for the fetch.
+ *
+ */
+ void addFetch(const QString fileName, void *internal, int priority);
+
+ /**
+ * Empties fetch list. This does not cancel the possible ongoing fetch on
+ * thumbnail manager side.
+ *
+ */
+ void cancelFetches();
+
+ /**
+ * Returns count of the fetches.
+ *
+ */
+ int fetchCount();
+
+ /**
+ * Pauses thumbnail fetching process. This does not pause the possible
+ * ongoing fetch on thumbnail manager side.
+ *
+ */
+ void pauseFetching();
+
+ /**
+ * Continues the fetching process. All fetches added with addFetch are
+ * started without create thumbnail flag. If there's not any of those,
+ * starts creating thumbnails for fetches that have no thumbnail yet.
+ * Signal allThumbnailsFetched is emitted if there's nothing to do.
+ *
+ */
+ void continueFetching();
+
+ /**
+ * Enables or disables the thumbnail creation for videos that do
+ * not have thumbnail already in the database.
+ *
+ * @param enable true enables thumbnail creation, false disables.
+ *
+ */
+ void enableThumbnailCreation(bool enable);
+
+private:
+
+ class ThumbnailFetchData
+ {
+ public:
+ ThumbnailFetchData() { mInternal = 0; };
+ QString mFileName;
+ int mPriority;
+ void *mInternal;
+ };
+
+protected:
+
+ /**
+ * Starts fetching all the thumbnails in fetch list. Create flag is
+ * disabled. Thumbnail manager signals to thumbnailReadySlot. If thumbnail
+ * fetch fails with -1 the fetch is added to thumbnail creation list,
+ * otherwise signal thumbnailReady signal emitted.
+ *
+ */
+ void startThumbnailFetches();
+
+ /**
+ * Starts fetching thumbnail with highest priority from creation list.
+ * Create flag is enabled. Thumbnail manager signals to thumbnailReadySlot,
+ * from there signal thumbnailReady is emitted.
+ *
+ */
+ void startThumbnailCreation();
+
+signals:
+
+ /**
+ * Signaled after signal from thumbnail manager has been processed and
+ * thumbnail fetch process is complete.
+ *
+ * @param tnData thumbnail
+ * @param internal internal data to identify the request
+ * @param error possible error code from thumbnail manager ( 0 == ok )
+ *
+ */
+ void thumbnailReady(QPixmap tnData, void *internal, int error);
+
+ /**
+ * Signaled when all the fetches have been done.
+ *
+ */
+ void allThumbnailsFetched();
+
+private slots:
+
+ /**
+ * Thumbnail manager signals this slot when thumbnail is ready
+ * for some item.
+ *
+ * @param tnData thumbnail
+ * @param internal internal data to identify the request
+ * @param requestId thumbnail manager request id
+ * @param error: possible error code from thumbnail manager ( 0 == ok )
+ *
+ */
+ void thumbnailReadySlot(QPixmap tnData, void *internal, int requestId, int error);
+
+private: // Data
+
+ /**
+ * Thumbnail manager object.
+ */
+ ThumbnailManager *mThumbnailManager;
+
+ /**
+ * List containing not started thumbnail fetches.
+ */
+ QList<ThumbnailFetchData *> mFetchList;
+
+ /**
+ * Hash containing ongoing thumbnail fetches.
+ *
+ * key is thumbnail request id.
+ * value is thumbnail fetch data.
+ */
+ QHash<int, ThumbnailFetchData *> mStartedFetchList;
+
+ /**
+ * List containing thumbnails that have not been created yet.
+ */
+ QList<ThumbnailFetchData *> mCreationList;
+
+ /**
+ * Flag indicating if fetching has been paused.
+ */
+ bool mPaused;
+
+ /**
+ * Flag indicating if thumbnail creation is enabled.
+ */
+ bool mTbnCreationEnabled;
+};
+
+#endif // __VIDEOTHUMBNAILDATAFETCHER_H__
--- a/videocollection/videocollectionwrapper/src/videocollectionclient.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/src/videocollectionclient.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -43,8 +43,8 @@
mCollectionUtility(0),
mCollectionOpenStatus(ECollectionNotOpen),
mCollectionListener(0),
-mOpenCategoryAlbum(0,9),
-mCollectionPathLevel(VideoCollectionClient::ELevelInvalid)
+mOpenCategoryAlbum(TMPXItemId::InvalidId()),
+mCollectionPathLevel(VideoCollectionCommon::ELevelInvalid)
{
}
@@ -53,8 +53,12 @@
// initialize()
// -----------------------------------------------------------------------------
//
-int VideoCollectionClient::initialize()
+int VideoCollectionClient::initialize(VideoDataSignalReceiver *signalReceiver)
{
+ if(!signalReceiver)
+ {
+ return -1;
+ }
if(mCollectionUtility && mCollectionListener)
{
// already initialized
@@ -62,7 +66,7 @@
}
if(!mCollectionListener)
{
- mCollectionListener = new VideoCollectionListener(*this);
+ mCollectionListener = new VideoCollectionListener(*this, *signalReceiver);
if(!mCollectionListener)
{
return -1;
@@ -95,73 +99,14 @@
delete mCollectionListener;
}
-
-// -----------------------------------------------------------------------------
-// setVideoModelObserver
-// -----------------------------------------------------------------------------
-//
-int VideoCollectionClient::connectCollectionSignalReceiver(
- VideoDataSignalReceiver *signalReceiver)
-{
- if(!mCollectionListener || !signalReceiver)
- {
- return -1;
- }
-
-
- if(!QObject::connect(mCollectionListener, SIGNAL(newVideoList(CMPXMediaArray*)),
- signalReceiver, SLOT(newVideoListSlot(CMPXMediaArray*)),
- Qt::DirectConnection))
- {
- return -1;
- }
-
- if(!QObject::connect(mCollectionListener, SIGNAL(videoListAppended(CMPXMediaArray*)),
- signalReceiver, SLOT(appendVideoListSlot(CMPXMediaArray*)),
- Qt::DirectConnection))
- {
- return -1;
- }
-
- if(!QObject::connect(mCollectionListener, SIGNAL(newVideoAvailable(CMPXMedia*)),
- signalReceiver, SLOT(newVideoAvailableSlot(CMPXMedia*)),
- Qt::DirectConnection))
- {
- return -1;
- }
-
- if(!QObject::connect(mCollectionListener, SIGNAL(videoDeleted(TMPXItemId)),
- signalReceiver, SLOT(videoDeletedSlot(TMPXItemId)),
- Qt::DirectConnection))
- {
- return -1;
- }
-
- if(!QObject::connect(mCollectionListener, SIGNAL(videoDeleteCompleted(int, QList<TMPXItemId>*)),
- signalReceiver, SLOT(videoDeleteCompletedSlot(int, QList<TMPXItemId>*)),
- Qt::DirectConnection))
- {
- return -1;
- }
-
- if(!QObject::connect(mCollectionListener, SIGNAL(videoDetailsCompleted(TMPXItemId)),
- signalReceiver, SLOT(videoDetailsCompletedSlot(TMPXItemId)),
- Qt::DirectConnection))
- {
- return -1;
- }
- return 0;
-}
-
-
// ---------------------------------------------------------------------------
// categoryIds
// ---------------------------------------------------------------------------
//
-void VideoCollectionClient::getCategoryIds(int& id, int& type)
+
+void VideoCollectionClient::getCategoryId(TMPXItemId &id)
{
- id = mOpenCategoryAlbum.iId1; //unique id
- type = mOpenCategoryAlbum.iId2; //category or album
+ id = mOpenCategoryAlbum;
}
// ---------------------------------------------------------------------------
@@ -244,10 +189,10 @@
}
// -----------------------------------------------------------------------------
-// openMedia
+// openItem
// -----------------------------------------------------------------------------
//
-int VideoCollectionClient::openVideo(TMPXItemId &mediaId)
+int VideoCollectionClient::openItem(TMPXItemId &mediaId)
{
if(!mCollectionUtility)
{
@@ -255,7 +200,7 @@
}
TInt error;
- if (getCollectionLevel() == VideoCollectionClient::ELevelVideos)
+ if (mediaId.iId2 == KVcxMvcMediaTypeVideo)
{
TRAP(error, openVideoL(mediaId));
}
@@ -312,19 +257,57 @@
}
// -----------------------------------------------------------------------------
-// addNewCollection
+// addNewAlbum
+// -----------------------------------------------------------------------------
+//
+TMPXItemId VideoCollectionClient::addNewAlbum(const QString &title)
+{
+ TMPXItemId id = TMPXItemId::InvalidId();
+
+ if (mCollectionUtility && title.length())
+ {
+ TRAPD(err, id = createAlbumL(title));
+ if(err)
+ {
+ id = TMPXItemId::InvalidId();
+ }
+ }
+
+ return id;
+}
+
+// -----------------------------------------------------------------------------
+// removeAlbums
// -----------------------------------------------------------------------------
//
-int VideoCollectionClient::addNewCollection(QString name, QString thumbnail, QList<TMPXItemId> mediaIds)
+int VideoCollectionClient::removeAlbums(const QList<TMPXItemId> &mediaIds)
{
- if(!mCollectionUtility)
+ int err(-1);
+
+ if (mCollectionUtility)
{
- return -1;
+ TRAP(err, removeAlbumsL(mediaIds));
+ }
+
+ return err;
+}
+
+// -----------------------------------------------------------------------------
+// addItemsInAlbum
+// -----------------------------------------------------------------------------
+//
+int VideoCollectionClient::addItemsInAlbum(TMPXItemId albumId,
+ const QList<TMPXItemId> &mediaIds)
+{
+ int err(-1);
+
+ if (mCollectionUtility && albumId != TMPXItemId::InvalidId() &&
+ albumId.iId2 == KVcxMvcMediaTypeAlbum)
+ {
+ TRAP(err, addItemsInAlbumL(albumId, mediaIds));
}
- TRAPD(error, addNewCollectionL(name, thumbnail, mediaIds));
-
- return error;
+ return err;
}
// -----------------------------------------------------------------------------
@@ -341,25 +324,24 @@
CleanupStack::PushL( collectionPath );
collectionPath->AppendL( KVcxUidMyVideosMpxCollection );
- if (level == VideoCollectionClient::ELevelVideos)
+ if (level == VideoCollectionCommon::ELevelVideos)
{
collectionPath->AppendL( KVcxMvcCategoryIdAll );
mOpenCategoryAlbum.iId1 = KVcxMvcCategoryIdAll;
mOpenCategoryAlbum.iId2 = 1;
- mCollectionPathLevel = VideoCollectionClient::ELevelVideos;
+ mCollectionPathLevel = VideoCollectionCommon::ELevelVideos;
}
else
{
- mOpenCategoryAlbum.iId1 = 0;
- mOpenCategoryAlbum.iId2 = 9;
+ mOpenCategoryAlbum = TMPXItemId::InvalidId();
- mCollectionPathLevel = VideoCollectionClient::ELevelCategory;
+ mCollectionPathLevel = VideoCollectionCommon::ELevelCategory;
}
mCollectionUtility->Collection().OpenL( *collectionPath );
CleanupStack::PopAndDestroy( collectionPath );
- mCollectionListener->setRequestNewMediaArray(true);
+
mCollectionOpenStatus = ECollectionOpening;
}
@@ -419,8 +401,8 @@
CleanupStack::PushL( path );
path->AppendL( KVcxUidMyVideosMpxCollection );
path->AppendL( KVcxMvcCategoryIdAll );
- path->AppendL( TMPXItemId( videoId, 0 ) );
- path->SelectL( TMPXItemId( videoId, 0 ) );
+ path->AppendL( videoId );
+ path->SelectL( videoId );
mCollectionUtility->Collection().OpenL( *path );
CleanupStack::PopAndDestroy( path );
@@ -443,13 +425,9 @@
collectionPath->AppendL( id );
mCollectionUtility->Collection().OpenL( *collectionPath );
CleanupStack::PopAndDestroy( collectionPath );
- mCollectionListener->setRequestNewMediaArray(true);
- mOpenCategoryAlbum.iId1 = id;
- mOpenCategoryAlbum.iId2 = 1;
-
- mCollectionPathLevel = VideoCollectionClient::ELevelVideos;
-
+ mOpenCategoryAlbum = id;
+ mCollectionPathLevel = VideoCollectionCommon::ELevelAlbum;
mCollectionOpenStatus = ECollectionOpening;
}
@@ -468,11 +446,10 @@
{
mCollectionUtility->Collection().BackL();
mCollectionOpenStatus = ECollectionOpening;
- mCollectionListener->setRequestNewMediaArray(true);
- mOpenCategoryAlbum.iId1 = 0;
- mOpenCategoryAlbum.iId2 = 9;
- mCollectionPathLevel = VideoCollectionClient::ELevelCategory;
+ mOpenCategoryAlbum = TMPXItemId::InvalidId();
+
+ mCollectionPathLevel = VideoCollectionCommon::ELevelCategory;
}
}
@@ -498,61 +475,109 @@
}
// -----------------------------------------------------------------------------
-// addNewCollectionL
+// removeAlbumsL
// -----------------------------------------------------------------------------
//
-void VideoCollectionClient::addNewCollectionL(QString name, QString thumbnail, QList<TMPXItemId> mediaIds)
+void VideoCollectionClient::removeAlbumsL(const QList<TMPXItemId> &mediaIds)
{
if(!mCollectionUtility)
{
User::Leave(KErrGeneral);
}
+
+ CMPXCommand* cmd = CMPXCommand::NewL();
+ CleanupStack::PushL( cmd );
+ cmd->SetTObjectValueL( KMPXCommandGeneralId, KVcxCommandIdMyVideos );
+ cmd->SetTObjectValueL(KVcxMediaMyVideosCommandId, KVcxCommandMyVideosRemoveAlbums);
+ cmd->SetTObjectValueL(KMPXCommandGeneralDoSync, EFalse);
+ cmd->SetTObjectValueL(KMPXCommandGeneralCollectionId, TUid::Uid(KVcxUidMyVideosMpxCollection));
+
+ CMPXMediaArray* array = CMPXMediaArray::NewL();
+ CleanupStack::PushL( array );
+ CMPXMedia* media = 0;
+ int count = mediaIds.count();
+ for (int i = 0; i < count; i++)
+ {
+ media = CMPXMedia::NewL();
+ CleanupStack::PushL(media);
+ media->SetTObjectValueL(KMPXMediaGeneralId, mediaIds.at(i));
+ array->AppendL(*media);
+ CleanupStack::PopAndDestroy(media);
+ }
+ cmd->SetCObjectValueL(KMPXMediaArrayContents, array);
+
+ mCollectionUtility->Collection().CommandL(*cmd);
+
+ CleanupStack::PopAndDestroy( array );
+ CleanupStack::PopAndDestroy( cmd );
+}
+
+// -----------------------------------------------------------------------------
+// createAlbumL
+// -----------------------------------------------------------------------------
+//
+TMPXItemId VideoCollectionClient::createAlbumL(const QString &title)
+{
+ TMPXItemId albumId = TMPXItemId::InvalidId();
CMPXCommand* cmd = CMPXCommand::NewL();
CleanupStack::PushL( cmd );
+
+ // 1. create album
+ TPtrC titlePtrC(title.utf16());
+ cmd->SetTObjectValueL(KMPXCommandGeneralId, KVcxCommandIdMyVideos);
+ cmd->SetTObjectValueL(KVcxMediaMyVideosCommandId, KVcxCommandMyVideosAddAlbum);
+ cmd->SetTextValueL(KMPXMediaGeneralTitle, titlePtrC);
+ cmd->SetTObjectValueL(KMPXCommandGeneralDoSync, ETrue);
+ cmd->SetTObjectValueL(KMPXCommandGeneralCollectionId, TUid::Uid(KVcxUidMyVideosMpxCollection));
- cmd->SetTObjectValueL( KMPXCommandGeneralId, KVcxCommandIdMyVideos );
- cmd->SetTObjectValueL( KVcxMediaMyVideosCommandId, -1 );
- cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, ETrue );
- cmd->SetTObjectValueL( KMPXMediaGeneralTitle, name );
- cmd->SetTObjectValueL( KMPXMediaGeneralThumbnail1, thumbnail );
-
- // TODO real command id missing, uncomment only after the collection supports adding collections
-// mCollectionUtility->Collection().CommandL( *cmd );
-
- CleanupStack::PopAndDestroy( cmd );
+ mCollectionUtility->Collection().CommandL(*cmd);
- if(mediaIds.size() > 0) {
- cmd = CMPXCommand::NewL();
- CleanupStack::PushL( cmd );
- CMPXMediaArray* idMediaArray = CMPXMediaArray::NewL();
- CleanupStack::PushL( idMediaArray );
-
- cmd->SetTObjectValueL( KMPXCommandGeneralId, KVcxCommandIdMyVideos );
- cmd->SetTObjectValueL( KVcxMediaMyVideosCommandId, -1 );
- cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId,
- TUid::Uid( KVcxUidMyVideosMpxCollection ) );
-
- // TODO need to add the mpxid of the newly created collection here.
-
- TMPXItemId mediaId;
- foreach(mediaId, mediaIds) {
- CMPXMedia* media = CMPXMedia::NewL();
- CleanupStack::PushL( media );
- media->SetTObjectValueL( KMPXMessageMediaGeneralId, mediaId );
- idMediaArray->AppendL( *media );
- CleanupStack::PopAndDestroy( media );
- }
-
- cmd->SetCObjectValueL<CMPXMediaArray>( KMPXMediaArrayContents, idMediaArray );
- cmd->SetTObjectValueL( KMPXMediaArrayCount, idMediaArray->Count() );
-
- // TODO real command id missing, only uncomment after collection supports adding collections.
-// mCollectionUtility->Collection().CommandL( *cmd );
-
- CleanupStack::PopAndDestroy( idMediaArray );
- CleanupStack::PopAndDestroy( cmd );
+ // get album id
+ if (cmd->IsSupported(KMPXMediaGeneralId))
+ {
+ albumId = cmd->ValueTObjectL<TMPXItemId>(KMPXMediaGeneralId);
}
+
+ // cleanup
+ CleanupStack::PopAndDestroy(cmd);
+
+ return albumId;
+}
+
+// -----------------------------------------------------------------------------
+// addItemsInAlbumL
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionClient::addItemsInAlbumL(TMPXItemId albumId,
+ const QList<TMPXItemId> &mediaIds)
+{
+ CMPXCommand* cmd = CMPXCommand::NewL();
+ CleanupStack::PushL(cmd);
+ cmd->SetTObjectValueL(KMPXCommandGeneralId, KVcxCommandIdMyVideos);
+ cmd->SetTObjectValueL(KVcxMediaMyVideosCommandId, KVcxCommandMyVideosAddToAlbum);
+ cmd->SetTObjectValueL(KVcxMediaMyVideosUint32Value, albumId.iId1);
+ cmd->SetTObjectValueL(KMPXCommandGeneralDoSync, EFalse);
+ cmd->SetTObjectValueL(KMPXCommandGeneralCollectionId, TUid::Uid(KVcxUidMyVideosMpxCollection));
+
+ CMPXMediaArray* array = CMPXMediaArray::NewL();
+ CleanupStack::PushL( array );
+ CMPXMedia* video = 0;
+ int count = mediaIds.count();
+ for (int i = 0; i < count; i++)
+ {
+ video = CMPXMedia::NewL();
+ CleanupStack::PushL(video);
+ video->SetTObjectValueL(KMPXMediaGeneralId, mediaIds.at(i));
+ array->AppendL(*video);
+ CleanupStack::PopAndDestroy(video);
+ }
+ cmd->SetCObjectValueL(KMPXMediaArrayContents, array);
+
+ mCollectionUtility->Collection().CommandL(*cmd);
+
+ CleanupStack::PopAndDestroy(array);
+ CleanupStack::PopAndDestroy(cmd);
}
// -----------------------------------------------------------------------------
@@ -588,4 +613,3 @@
CleanupStack::PopAndDestroy( cmd );
}
-
--- a/videocollection/videocollectionwrapper/src/videocollectionlistener.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/src/videocollectionlistener.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -31,16 +31,19 @@
#include "videocollectionlistener.h"
#include "videocollectionclient.h"
+#include "videodatasignalreceiver.h"
#include "videocollectionutils.h"
+#include "videocollectioncommon.h"
// -----------------------------------------------------------------------------
// VideoCollectionListener
// -----------------------------------------------------------------------------
//
-VideoCollectionListener::VideoCollectionListener(VideoCollectionClient &collectionClient) :
+VideoCollectionListener::VideoCollectionListener(VideoCollectionClient &collectionClient,
+ VideoDataSignalReceiver &signalReceiver) :
mCollectionClient(collectionClient),
-mVideoUtils(VideoCollectionUtils::instance()),
-mNewArrayRequest(true)
+mSignalReceiver(signalReceiver),
+mVideoUtils(VideoCollectionUtils::instance())
{
}
@@ -66,16 +69,6 @@
}
// -----------------------------------------------------------------------------
-// setRequestNewMediaArray
-// -----------------------------------------------------------------------------
-//
-void VideoCollectionListener::setRequestNewMediaArray(bool request)
-{
- mNewArrayRequest = request;
-}
-
-
-// -----------------------------------------------------------------------------
// HandleOpenL
// -----------------------------------------------------------------------------
//
@@ -90,42 +83,48 @@
return;
}
- int level = mCollectionClient.getCollectionLevel();
-
- if((level != VideoCollectionClient::ELevelVideos) &&
- (level != VideoCollectionClient::ELevelCategory))
+ // Check that current level is valid and entries has collection path.
+ if(mCollectionClient.getCollectionLevel() < VideoCollectionCommon::ELevelCategory ||
+ !aEntries.IsSupported(KMPXMediaGeneralContainerPath))
{
return;
}
+
CMPXMediaArray *array =
mVideoUtils.mediaValuePtr<CMPXMessageArray>(&aEntries, KMPXMediaArrayContents);
-
if(!array)
{
// no videos!
return;
}
- // if there's item's, compare gotten items' level to wanted level.
- // If they do not match, do nothing
- if(array->Count() > 0)
+
+ CMPXCollectionPath* path = aEntries.Value<CMPXCollectionPath>(KMPXMediaGeneralContainerPath);
+ if(!path)
+ {
+ return;
+ }
+
+ TMPXItemId pathId = path->Id();
+
+ TBool categoryOrAlbumVideoList = false;
+ if(path->Levels() == VideoCollectionCommon::PathLevelVideos && pathId.iId2 != 0)
+ {
+ categoryOrAlbumVideoList = true;
+ }
+
+ if(categoryOrAlbumVideoList)
{
- TMPXItemId id( 0, 0 );
- mVideoUtils.mediaValue<TMPXItemId>((*array)[0], KMPXMediaGeneralId, id );
- if((id.iId2 == 1 && level != VideoCollectionClient::ELevelCategory) ||
- id.iId2 != 1 && level != VideoCollectionClient::ELevelVideos)
- {
- return;
- }
-
- }
- if(mNewArrayRequest)
- {
- emit newVideoList(array);
- mNewArrayRequest = false;
+ mSignalReceiver.albumListAvailableSlot(pathId, array);
+
+ // Update also all video list in case this is a default category.
+ if(pathId.iId2 == KVcxMvcMediaTypeCategory)
+ {
+ mSignalReceiver.newVideoListSlot(array);
+ }
}
else
{
- emit videoListAppended(array);
+ mSignalReceiver.newVideoListSlot(array);
}
}
@@ -160,6 +159,46 @@
{
handleGetVideoDetailsResp(aCommandResult);
}
+ else if(commandId == KVcxCommandMyVideosRemoveAlbums)
+ {
+ CMPXMediaArray *messageArray =
+ mVideoUtils.mediaValuePtr<CMPXMediaArray>(aCommandResult, KMPXMediaArrayContents);
+
+ if(!messageArray || messageArray->Count() == 0)
+ {
+ return;
+ }
+ QList<TMPXItemId> failedIds;
+ TMPXItemId itemId;
+ int count = messageArray->Count();
+ int failedFlag = 0;
+ CMPXMedia* item = NULL;
+
+ // go throught all removed albums and see if some has failed
+ for (int i = 0; i < count; ++i)
+ {
+ item = (*messageArray)[i];
+ if(!mVideoUtils.mediaValue<TMPXItemId>(item, KMPXMediaGeneralId, itemId))
+ {
+ // invalid message, return
+ return;
+ }
+ // if there's error while fetching value, it means that value does not exists,
+ // so we can assume remove was succefull
+ if(mVideoUtils.mediaValue<int>(item, KVcxMediaMyVideosInt32Value, failedFlag))
+ {
+ if (failedFlag)
+ {
+ failedIds.append(itemId);
+ }
+ failedFlag = 0;
+ }
+ }
+ if (failedIds.count())
+ {
+ mSignalReceiver.albumRemoveFailureSlot(&failedIds);
+ }
+ }
}
}
@@ -185,7 +224,7 @@
if(mCollectionClient.getOpenStatus() == VideoCollectionClient::ECollectionOpened )
{
// after colletion has been opened we handle messages from our collection plugin only
- TUid collectionUid;
+ TUid collectionUid = {0};
bool status = mVideoUtils.mediaValue<TUid>(aMessage, KMPXMessageCollectionId, collectionUid);
if(!status || collectionUid.iUid != KVcxUidMyVideosMpxCollection)
{
@@ -347,19 +386,16 @@
//
void VideoCollectionListener::handleMyVideosItemsChanged(CMPXMessage* aMessage)
{
- if(mCollectionClient.getCollectionLevel() != VideoCollectionClient::ELevelVideos)
- {
- // we do not handle events from other levels than ones concerning videos
- return;
- }
-
- TMPXChangeEventType eventType;
- if(!mVideoUtils.mediaValue<TMPXChangeEventType>(aMessage,KMPXMessageChangeEventType, eventType))
+
+ TMPXChangeEventType eventType = EMPXItemModified;
+ if(!mVideoUtils.mediaValue<TMPXChangeEventType>(
+ aMessage,KMPXMessageChangeEventType, eventType))
{
return;
}
- TMPXItemId eventData;
- if(!mVideoUtils.mediaValue<TMPXItemId>(aMessage,KMPXMessageMediaGeneralId, eventData))
+ TMPXItemId itemId = TMPXItemId::InvalidId();
+ if(!mVideoUtils.mediaValue<TMPXItemId>(
+ aMessage,KMPXMessageMediaGeneralId, itemId))
{
return;
}
@@ -367,53 +403,39 @@
switch(eventType)
{
case EMPXItemDeleted:
- emit videoDeleted(eventData);
- break;
- case EMPXItemInserted:
- if(eventData.iId2 < 2)
+ {
+ mSignalReceiver.itemDeletedSlot(itemId);
+ break;
+ }
+ case EMPXItemInserted:
+ {
+ CMPXMedia *media = mVideoUtils.mediaValuePtr<CMPXMedia>(
+ aMessage, KMPXCommandColAddMedia);
+ if (media)
+ {
+ mSignalReceiver.newVideoAvailableSlot(media);
+ }
+ else
{
- CMPXMedia *media = mVideoUtils.mediaValuePtr<CMPXMedia>(aMessage, KMPXCommandColAddMedia);
-
- if(media)
- {
- //TODO: album support
- TUint8 origin = EVcxMyVideosOriginOther;
- mVideoUtils.mediaValue<TUint8>(media, KVcxMediaMyVideosOrigin, origin);
-
- int id = -1;
- int type = -1;
-
- mCollectionClient.getCategoryIds(id, type);
-
- if ((1 == type) || (0 == type)) //TODO: KVcxMvcCategoryIdAll has type 0, but it should be 1
- {
- if (id == KVcxMvcCategoryIdAll)
- {
- emit newVideoAvailable(media);
- }
- else if ((id == KVcxMvcCategoryIdDownloads) && (origin == EVcxMyVideosOriginDownloaded) && (1 == type))
- {
- emit newVideoAvailable(media);
- }
- else if ((id == KVcxMvcCategoryIdCaptured) && (origin == EVcxMyVideosOriginCapturedWithCamera) && (1 == type))
- {
- emit newVideoAvailable(media);
- }
- }
- else if (2 == type) //album
- {
- //TODO: check album
- }
-
- }
- else
- {
- mCollectionClient.fetchMpxMediaByMpxId(eventData);
- }
+ mCollectionClient.fetchMpxMediaByMpxId(itemId);
}
- break;
- default:
- break;
+ break;
+ }
+ case EMPXItemModified:
+ {
+ if (itemId.iId2 == KVcxMvcMediaTypeAlbum)
+ {
+ // re-open the album in case album corresponds recently opened.
+ // to fetch the album contents.
+ mCollectionClient.openItem(itemId);
+ }
+ break;
+ }
+ default:
+ {
+ // invalid event type
+ break;
+ }
}
}
@@ -457,7 +479,7 @@
failedFlag = 0;
}
}
- emit videoDeleteCompleted(count, &failedIds);
+ mSignalReceiver.videoDeleteCompletedSlot(count, &failedIds);
}
// -----------------------------------------------------------------------------
@@ -473,7 +495,7 @@
{
return;
}
- emit newVideoAvailable((*array)[0]);
+ mSignalReceiver.newVideoAvailableSlot((*array)[0]);
}
// -----------------------------------------------------------------------------
@@ -492,8 +514,6 @@
{
return;
}
- emit videoDetailsCompleted(itemId);
+ mSignalReceiver.videoDetailsCompletedSlot(itemId);
}
-
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/src/videocollectionutils.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,206 @@
+/*
+* 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: VideoCollectionUtils class implementation
+*
+*/
+
+// INCLUDE FILES
+
+
+#include <qobject.h>
+#include "videocollectionutils.h"
+
+
+// -----------------------------------------------------------------------------
+// instance
+// -----------------------------------------------------------------------------
+//
+VideoCollectionUtils& VideoCollectionUtils::instance()
+{
+ static VideoCollectionUtils _collectionUtilsInstance;
+ return _collectionUtilsInstance;
+}
+
+// -----------------------------------------------------------------------------
+// VideoCollectionUtils
+// -----------------------------------------------------------------------------
+//
+VideoCollectionUtils::VideoCollectionUtils()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// ~CVideoCollectionUtils
+// -----------------------------------------------------------------------------
+//
+VideoCollectionUtils::~VideoCollectionUtils()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// prepareLengthString
+// -----------------------------------------------------------------------------
+//
+QString VideoCollectionUtils::prepareLengthString(quint32 length)
+{
+ const int secondsInMinute( 60 );
+ const int secondsInHour( 3600 );
+ QString lengthStr("");
+
+ if ( length > 0 )
+ {
+ quint32 hours = length / secondsInHour;
+ quint32 minutes = length / secondsInMinute % secondsInMinute;
+ quint32 seconds = length % secondsInMinute;
+
+ if ( hours > 0 )
+ {
+ if(hours == 1)
+ {
+ lengthStr = QObject::tr("%1 hour ").arg(QString::number(hours)); //TODO: Localisation
+ }
+ else
+ {
+ lengthStr += QObject::tr("%1 hours ").arg(QString::number(hours)); //TODO: Localisation
+ }
+ }
+
+ if ( minutes > 0 )
+ {
+ if(minutes == 1)
+ {
+ lengthStr += QObject::tr("%1 minute ").arg(QString::number(minutes)); //TODO: Localisation
+ }
+ else
+ {
+ lengthStr += QObject::tr("%1 minutes ").arg(QString::number(minutes)); //TODO: Localisation
+ }
+ }
+ if (seconds > 0 && hours == 0)
+ {
+ if(seconds == 1)
+ {
+ lengthStr += QObject::tr("%1 second").arg(QString::number(seconds)); //TODO: Localisation
+ }
+ else
+ {
+ lengthStr += QObject::tr("%1 seconds").arg(QString::number(seconds)); //TODO: Localisation
+ }
+ }
+ } else {
+ lengthStr += QObject::tr("0 seconds"); //TODO: Localisation
+ }
+
+ return lengthStr;
+}
+// -----------------------------------------------------------------------------
+// VideoCollectionUtils::prepareLengthStrings()
+// -----------------------------------------------------------------------------
+//
+const QStringList VideoCollectionUtils::prepareLengthStrings(quint32 total)
+{
+ const int secondsInMinute( 60 );
+
+ quint32 minutes(0);
+ quint32 seconds(0);
+
+ if ( total > 0 )
+ {
+ minutes = (total / secondsInMinute);
+ seconds = (total % secondsInMinute);
+ }
+
+ QString mins("");
+ QString secs("");
+
+ if (minutes < 10)
+ {
+ mins = "0" + QString::number(minutes);
+
+ }
+ else
+ {
+ mins = QString::number(minutes);
+ }
+
+ QString secondsStr("");
+
+ if (seconds < 10)
+ {
+ secs = "0" + QString::number(seconds);
+
+ }
+ else
+ {
+ secs = QString::number(seconds);
+ }
+
+ QStringList retVal;
+
+ retVal.append(mins);
+ retVal.append(secs);
+
+ return retVal;
+}
+
+
+// -----------------------------------------------------------------------------
+// prepareSizeString
+// -----------------------------------------------------------------------------
+//
+QString VideoCollectionUtils::prepareSizeString(quint32 size)
+{
+ const int videoSizeGB( 0x40000000 );
+ const int videoSizeHalfGB( 0x20000000 );
+ const int videoSizeMB( 0x100000 );
+ const int videoSizeHalfMB( 0x80000 );
+ const int videoSizeKB( 0x400 );
+ const int videoSizeHalfKB( 0x200 );
+
+ QString sizeStr("");
+
+ if ( size > 0 )
+ {
+ quint32 dispSize = 0;
+
+ if ( size >= videoSizeGB )
+ {
+ dispSize = size + videoSizeHalfGB;
+ dispSize /= videoSizeGB;
+ sizeStr = QString(QObject::tr("%1 GB").arg(QString::number(dispSize))); //TODO: Localisation
+ }
+ else if ( size >= videoSizeMB )
+ {
+ dispSize = size + videoSizeHalfMB;
+ dispSize /= videoSizeMB;
+ sizeStr = QString(QObject::tr("%1 MB").arg(QString::number(dispSize))); //TODO: Localisation
+ }
+ else if (size >= videoSizeKB)
+ {
+ dispSize = size + videoSizeHalfKB;
+ dispSize /= videoSizeKB;
+ sizeStr = QString(QObject::tr("%1 kB").arg(QString::number(dispSize))); //TODO: Localisation
+ }
+ else
+ {
+ sizeStr = QString(QObject::tr("%1B").arg(QString::number(size))); //TODO: Localisation
+ }
+ }
+
+ return sizeStr;
+}
+
+// End of file
--- a/videocollection/videocollectionwrapper/src/videocollectionwrapper.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/src/videocollectionwrapper.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -22,36 +22,15 @@
#include "videocollectionwrapper_p.h"
#include "videosortfilterproxymodel.h"
-VideoCollectionWrapper *VideoCollectionWrapper::mInstance = 0;
-
// -----------------------------------------------------------------------------
// VideoCollectionWrapper::CVideoCollectionWrapper()
// -----------------------------------------------------------------------------
//
-VideoCollectionWrapper *VideoCollectionWrapper::instance()
+VideoCollectionWrapper &VideoCollectionWrapper::instance()
{
- if(!mInstance)
- {
- mInstance = new VideoCollectionWrapper();
- }
- mInstance->mReferenceCount++;
- return mInstance;
-}
+ static VideoCollectionWrapper _staticWrapper;
-// -----------------------------------------------------------------------------
-// VideoCollectionWrapper::cleanup()
-// -----------------------------------------------------------------------------
-//
-void VideoCollectionWrapper::decreaseReferenceCount()
-{
- if(mInstance)
- {
- if(--mInstance->mReferenceCount == 0)
- {
- delete mInstance;
- mInstance = NULL;
- }
- }
+ return _staticWrapper;
}
// -----------------------------------------------------------------------------
@@ -71,19 +50,18 @@
//
VideoCollectionWrapper::~VideoCollectionWrapper()
{
- delete d;
- d = 0;
+ // NOP
}
// -----------------------------------------------------------------------------
// CVideoCollectionWrapper::getModel()
// -----------------------------------------------------------------------------
//
-VideoSortFilterProxyModel* VideoCollectionWrapper::getModel()
+VideoSortFilterProxyModel* VideoCollectionWrapper::getModel(int type)
{
if(d)
{
- return d->getModel();
+ return d->getModel(type);
}
return 0;
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/src/videocollectionwrapper_p.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,139 @@
+/*
+* 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: VideoCollectionWrapperPrivate class implementation
+*
+*/
+
+// INCLUDE FILES
+
+#include <qapplication.h>
+#include <qabstractitemmodel.h>
+#include <vcxmyvideosdefs.h>
+#include "videocollectionwrapper.h"
+#include "videocollectionwrapper_p.h"
+#include "videolistdatamodel.h"
+#include "videosortfilterproxymodel.h"
+#include "videocollectionclient.h"
+#include "videocollectioncommon.h"
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// -----------------------------------------------------------------------------
+// VideoCollectionWrapperPrivate::VideoCollectionWrapperPrivate()
+// -----------------------------------------------------------------------------
+//
+VideoCollectionWrapperPrivate::VideoCollectionWrapperPrivate() :
+mAllVideosModel(0),
+mCollectionsModel(0),
+mGenericModel(0),
+mSourceModel(0)
+{
+ // NOP
+}
+
+// -----------------------------------------------------------------------------
+// VideoCollectionWrapperPrivate::~VideoCollectionWrapperPrivate()
+// -----------------------------------------------------------------------------
+//
+VideoCollectionWrapperPrivate::~VideoCollectionWrapperPrivate()
+{
+ // NOP here
+}
+
+
+// -----------------------------------------------------------------------------
+// VideoCollectionWrapperPrivate::getModel()
+// -----------------------------------------------------------------------------
+//
+VideoSortFilterProxyModel* VideoCollectionWrapperPrivate::getModel(int &type)
+{
+
+ VideoSortFilterProxyModel *model = 0;
+ if(!mSourceModel)
+ {
+ mSourceModel = new VideoListDataModel();
+ if(!mSourceModel || mSourceModel->initialize() < 0 ||
+ !connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(aboutToQuitSlot())) )
+ {
+ return 0;
+ }
+ }
+ bool needsInitialization = false;
+ if(type == VideoCollectionWrapper::EAllVideos)
+ {
+ if(!mAllVideosModel)
+ {
+ mAllVideosModel = new VideoSortFilterProxyModel(type);
+ needsInitialization = true;
+ }
+ model = mAllVideosModel;
+ }
+ else if(type == VideoCollectionWrapper::ECollections)
+ {
+ if(!mCollectionsModel)
+ {
+ mCollectionsModel = new VideoSortFilterProxyModel(type);
+ needsInitialization = true;
+ }
+ model = mCollectionsModel;
+ }
+ else if(type == VideoCollectionWrapper::ECollectionContent)
+ {
+ if(!mCollectionContentModel)
+ {
+ mCollectionContentModel = new VideoSortFilterProxyModel(type);
+ needsInitialization = true;
+ }
+ model = mCollectionContentModel;
+ }
+ else if(type == VideoCollectionWrapper::EGeneric)
+ {
+ if(!mGenericModel)
+ {
+ mGenericModel = new VideoSortFilterProxyModel(type);
+ needsInitialization = true;
+ }
+ model = mGenericModel;
+ }
+
+ if(needsInitialization)
+ {
+ if(model && model->initialize(mSourceModel) < 0 )
+ {
+ delete model;
+ return 0;
+ }
+ if (!connect(model, SIGNAL(shortDetailsReady(TMPXItemId)), mSourceModel, SIGNAL(shortDetailsReady(TMPXItemId))))
+ {
+ delete model;
+ return 0;
+ }
+ }
+ return model;
+}
+
+// -----------------------------------------------------------------------------
+// VideoCollectionWrapperPrivate::aboutToQuitSlot()
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionWrapperPrivate::aboutToQuitSlot()
+{
+ if(!mSourceModel.isNull())
+ {
+ delete mSourceModel;
+ }
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/src/videodatacontainer.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,309 @@
+/*
+* 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: VideoListData class declaration*
+*/
+
+#include <mpxmediageneraldefs.h>
+#include <mpxmedia.h>
+#include <vcxmyvideosdefs.h>
+#include "videodatacontainer.h"
+#include "videocollectionutils.h"
+
+/**
+ * global qHash function required fo creating hash values for TMPXItemId -keys
+ */
+inline uint qHash(TMPXItemId key)
+{
+ QPair<uint, uint> keyPair(key.iId1, key.iId2);
+
+ return qHash(keyPair);
+}
+
+
+// -----------------------------------------------------------------------------
+// VideoDataContainer
+// -----------------------------------------------------------------------------
+//
+VideoDataContainer::VideoDataContainer()
+{
+ // NOP
+}
+
+// -----------------------------------------------------------------------------
+// VideoDataContainer
+// -----------------------------------------------------------------------------
+//
+VideoDataContainer::~VideoDataContainer()
+{
+ clear();
+ clearRemoved();
+}
+
+// -----------------------------------------------------------------------------
+// clear
+// -----------------------------------------------------------------------------
+//
+void VideoDataContainer::clear()
+{
+ QHash<TMPXItemId, QPair<int, CMPXMedia*> >::iterator i = mMediaData.begin();
+ while(i != mMediaData.end())
+ {
+ delete (*i).second;
+ ++i;
+ }
+ mMediaData.clear();
+ mMediaIds.clear();
+}
+
+// -----------------------------------------------------------------------------
+// remove
+// -----------------------------------------------------------------------------
+//
+void VideoDataContainer::remove(const TMPXItemId &id)
+{
+ QHash<TMPXItemId, QPair<int, CMPXMedia*> >::iterator removeIter = mMediaData.find(id);
+ if(removeIter == mMediaData.end())
+ {
+ return;
+ }
+ QHash<TMPXItemId, QPair<int, CMPXMedia*> >::iterator hashIter;
+ mMediaIds.removeAt(removeIter->first);
+ // sync item indexes whose ids exist in id- list after
+ // recently removoved.
+ decIndexesAfter(removeIter->first);
+
+ delete removeIter->second;
+ mMediaData.erase(removeIter);
+}
+
+// -----------------------------------------------------------------------------
+// append
+// -----------------------------------------------------------------------------
+//
+void VideoDataContainer::append(CMPXMedia *media)
+{
+ TMPXItemId mediaId = TMPXItemId::InvalidId();
+ VideoCollectionUtils::instance().mediaValue<TMPXItemId>(media, KMPXMediaGeneralId, mediaId );
+
+ if(mediaId == TMPXItemId::InvalidId())
+ {
+ // could not get id or id does not match ==> NOP
+ return;
+ }
+ QHash<TMPXItemId, QPair<int, CMPXMedia*> >::iterator iter = mMediaData.find(mediaId);
+ // if item is in the removal list, not allowed to append
+ if(mRemovedMedia.contains(mediaId))
+ {
+ delete media;
+ return;
+ }
+
+ // if item exist, do not add into container
+ if(iter != mMediaData.end())
+ {
+ return;
+ }
+ mMediaIds.append(mediaId);
+ mMediaData[mediaId] = qMakePair( mMediaIds.count() - 1, media);
+}
+
+
+// -----------------------------------------------------------------------------
+// fromIndex
+// -----------------------------------------------------------------------------
+//
+CMPXMedia* VideoDataContainer::fromIndex(int index) const
+{
+ if(index >= 0 && index < mMediaIds.count() && mMediaData.contains(mMediaIds[index]))
+ {
+ return (mMediaData.find(mMediaIds[index]))->second;
+ }
+ return 0;
+}
+
+
+// -----------------------------------------------------------------------------
+// indexOfId
+// -----------------------------------------------------------------------------
+//
+int VideoDataContainer::indexOfId(const TMPXItemId &id) const
+{
+ QHash<TMPXItemId, QPair<int, CMPXMedia*> >::const_iterator iter = mMediaData.find(id);
+ if( iter != mMediaData.constEnd())
+ {
+ return iter->first;
+ }
+
+ return -1;
+}
+
+// -----------------------------------------------------------------------------
+// idFromIndex
+// -----------------------------------------------------------------------------
+//
+TMPXItemId VideoDataContainer::idFromIndex(int index) const
+{
+ if(index >= 0 && index < mMediaIds.count())
+ {
+ return mMediaIds[index];
+ }
+ return TMPXItemId::InvalidId();
+}
+
+// -----------------------------------------------------------------------------
+// count
+// -----------------------------------------------------------------------------
+//
+int VideoDataContainer::count() const
+{
+ return mMediaData.count();
+}
+
+// -----------------------------------------------------------------------------
+// decIndexesAfter
+// -----------------------------------------------------------------------------
+//
+void VideoDataContainer::decIndexesAfter(int fromIndex)
+{
+ int count = mMediaIds.count();
+ QMultiHash<TMPXItemId, QPair<int, CMPXMedia*> >::iterator hashIter;
+ for(int i = fromIndex; i < count; ++i)
+ {
+ hashIter = mMediaData.find(mMediaIds[i]);
+ if(hashIter != mMediaData.end())
+ {
+ hashIter->first--;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+// markItemsRemoved
+// -----------------------------------------------------------------------------
+//
+TMPXItemId VideoDataContainer::markItemRemoved(const int &itemIndex)
+{
+ // for all provided indexes:
+ // - get item address from mMediaData
+ // - get item index from mMediaData
+ // - remove item from mMediaData, do not deallocate object
+ // - remove item's id from mMediaIds -list
+ // - append item into mRemovedMedia
+ // - append item's id into returned id -list
+ TMPXItemId id = TMPXItemId::InvalidId();
+ CMPXMedia *media = 0;
+ id = idFromIndex(itemIndex);
+ media = fromIndex(itemIndex);
+ if(id == TMPXItemId::InvalidId() || !media)
+ {
+ return id;
+ }
+ if(!mRemovedMedia.contains(id))
+ {
+ mRemovedMedia[id] = media;
+ }
+ mMediaData.remove(id);
+ mMediaIds.removeAt(itemIndex);
+ decIndexesAfter(itemIndex);
+ return id;
+}
+
+// -----------------------------------------------------------------------------
+// clearRemoved
+// -----------------------------------------------------------------------------
+//
+int VideoDataContainer::clearRemoved(QList<TMPXItemId> *itemIds)
+{
+ int count = 0;
+ QList<TMPXItemId> ids;
+
+ QList<TMPXItemId>::const_iterator iterEnd;
+ if(!itemIds)
+ {
+ ids = mRemovedMedia.keys();
+ }
+ else
+ {
+ ids = *itemIds;
+ }
+ QList<TMPXItemId>::const_iterator idIter = ids.constBegin();
+ QHash<TMPXItemId, CMPXMedia*>::iterator iter;
+ while(idIter != ids.constEnd())
+ {
+ iter = mRemovedMedia.find((*idIter));
+ if(iter != mRemovedMedia.end())
+ {
+ delete (*iter);
+ mRemovedMedia.remove((*idIter));
+ count++;
+ }
+ ++idIter;
+ }
+ return count;
+}
+
+// -----------------------------------------------------------------------------
+// restoreRemovedItems
+// -----------------------------------------------------------------------------
+//
+int VideoDataContainer::restoreRemovedItems(QList<TMPXItemId> *itemIds)
+{
+
+ int count = 0;
+ QList<TMPXItemId> ids;
+
+ QList<TMPXItemId>::const_iterator iterEnd;
+ if(!itemIds)
+ {
+ ids = mRemovedMedia.keys();
+ }
+ else
+ {
+ ids = *itemIds;
+ }
+
+ QList<TMPXItemId>::const_iterator idIter = ids.constBegin();
+ QHash<TMPXItemId, CMPXMedia*>::iterator iter;
+ while(idIter != ids.constEnd())
+ {
+ iter = mRemovedMedia.find((*idIter));
+ if(iter != mRemovedMedia.constEnd() && !mMediaData.contains(iter.key()))
+ {
+ // append data to actual containers and remove item from deleted hash
+ mMediaIds.append(iter.key());
+ mMediaData[iter.key()] = qMakePair(mMediaIds.count() - 1, iter.value());
+ mRemovedMedia.remove((*idIter));
+ count++;
+ }
+ ++idIter;
+ }
+ return count;
+}
+
+// -----------------------------------------------------------------------------
+// getRemovedMedia
+// -----------------------------------------------------------------------------
+//
+CMPXMedia* VideoDataContainer::getRemovedMedia(TMPXItemId itemId)
+{
+ QHash<TMPXItemId, CMPXMedia*>::const_iterator itemIter =
+ mRemovedMedia.constFind(itemId);
+ if(itemIter != mRemovedMedia.constEnd())
+ {
+ return itemIter.value();
+ }
+ return 0;
+}
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/src/videodeleteworker.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,240 @@
+/*
+* 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: VideoDeleteWorker class implementation
+*
+*/
+// INCLUDE FILES
+
+#include <qtimer.h>
+#include "videocollectioncommon.h"
+#include "videocollectionclient.h"
+#include "videodeleteworker.h"
+
+
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+/**
+ * private global inline hash function for TMPXItemId keys in QSet
+ */
+inline uint qHash(TMPXItemId key)
+{
+ QPair<uint, uint> keyPair(key.iId1, key.iId2);
+
+ return qHash(keyPair);
+}
+
+// -----------------------------------------------------------------------------
+// VideoDeleteWorker()
+// -----------------------------------------------------------------------------
+//
+VideoDeleteWorker::VideoDeleteWorker(VideoCollectionClient &collection, QObject *parent) :
+QObject(parent),
+mCollectionClient(collection),
+mRequestWaitTimer(0),
+mLastStatus(0),
+mLastStatusData(QVariant())
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// ~VideoDeleteWorker()
+// -----------------------------------------------------------------------------
+//
+VideoDeleteWorker::~VideoDeleteWorker()
+{
+ if(mRequestWaitTimer && mRequestWaitTimer->isActive())
+ {
+ mRequestWaitTimer->stop();
+ }
+ // if we're still doing some background deletion,
+ // dump all deletes to collection and stop timer
+ flushAll();
+}
+
+// -----------------------------------------------------------------------------
+// requestDelete()
+// -----------------------------------------------------------------------------
+//
+void VideoDeleteWorker::requestDelete(const QList<TMPXItemId> &indexList)
+{
+ if(!mRequestWaitTimer)
+ {
+ mRequestWaitTimer = new QTimer();
+ connect(mRequestWaitTimer, SIGNAL(timeout()), this, SLOT(execDeleteBlockSlot()));
+ }
+
+ mRemoveBuffer.unite(QSet<TMPXItemId>::fromList(indexList));
+
+ if(!mRequestWaitTimer->isActive())
+ {
+ // first startup throught zero timer, after that
+ // deletion is chained. Next delete block starts from
+ // modelChangedSlot
+ mRequestWaitTimer->setSingleShot(true);
+ mRequestWaitTimer->start(0);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// removeFromRequest()
+// -----------------------------------------------------------------------------
+//
+int VideoDeleteWorker::removeFromRequest(TMPXItemId &itemId)
+{
+ mRemoveBuffer.remove(itemId);
+ return mRemoveBuffer.count();
+}
+
+// -----------------------------------------------------------------------------
+// isDeleting()
+// -----------------------------------------------------------------------------
+//
+bool VideoDeleteWorker::isDeleting()
+{
+ return mRemoveBuffer.count() ? true : false;
+}
+
+// -----------------------------------------------------------------------------
+// updateStatus()
+// -----------------------------------------------------------------------------
+//
+void VideoDeleteWorker::updateStatus(int status, QVariant data)
+{
+ // do not update invalid status
+ if(status != VideoCollectionCommon::statusDeleteSucceed &&
+ status != VideoCollectionCommon::statusSingleDeleteFail &&
+ status != VideoCollectionCommon::statusMultipleDeleteFail)
+ {
+ return;
+ }
+
+ if(!mLastStatus || mLastStatus == VideoCollectionCommon::statusDeleteSucceed)
+ {
+ mLastStatus = status;
+ mLastStatusData = data;
+ return;
+ }
+ if(status == VideoCollectionCommon::statusDeleteSucceed)
+ {
+ return;
+ }
+ int count = 0;
+ if(mLastStatus == VideoCollectionCommon::statusSingleDeleteFail)
+ {
+ // old status was single fail
+ mLastStatus = VideoCollectionCommon::statusMultipleDeleteFail;
+ count = 2;
+ if(status == VideoCollectionCommon::statusMultipleDeleteFail)
+ {
+ count = data.toInt() + 1;
+ }
+ // count of failed is now 2
+ mLastStatusData = count;
+ return;
+ }
+ // all other cases mean multi
+ count = data.toInt();
+ mLastStatus = VideoCollectionCommon::statusMultipleDeleteFail;
+ count ? mLastStatusData = mLastStatusData.toInt() + count :
+ mLastStatusData = mLastStatusData.toInt() + 1;
+}
+
+// -----------------------------------------------------------------------------
+// getStatus()
+// -----------------------------------------------------------------------------
+//
+int VideoDeleteWorker::getLastStatus(QVariant &data)
+{
+ data = mLastStatusData;
+ return mLastStatus;
+}
+
+// -----------------------------------------------------------------------------
+// clearStatus()
+// -----------------------------------------------------------------------------
+//
+void VideoDeleteWorker::clearStatus()
+{
+ mLastStatus = 0;
+ mLastStatusData = QVariant();
+}
+
+// -----------------------------------------------------------------------------
+// continueSlot()
+// -----------------------------------------------------------------------------
+//
+void VideoDeleteWorker::continueSlot()
+{
+ if(!mRequestWaitTimer || !mRemoveBuffer.count())
+ {
+ return;
+ }
+ if(!mRequestWaitTimer->isActive())
+ {
+ mRequestWaitTimer->setSingleShot(true);
+ mRequestWaitTimer->start(0);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// doBackgroundDeleteSlot()
+// -----------------------------------------------------------------------------
+//
+void VideoDeleteWorker::execDeleteBlockSlot()
+{
+ if(!mRemoveBuffer.count())
+ {
+ return;
+ }
+ QList<TMPXItemId> deleteBlock;
+
+ // create block of max 3 items
+ int counter = 0;
+ QSet<TMPXItemId>::iterator iter = mRemoveBuffer.begin();
+ while(iter != mRemoveBuffer.end() && counter < 3)
+ {
+ deleteBlock.append((*iter));
+ iter = mRemoveBuffer.erase(iter);
+ counter++;
+ }
+
+ // need to handle errors somehow
+ if(mCollectionClient.deleteVideos(&deleteBlock) != 0)
+ {
+ // signal block delete startup failed
+ emit deleteStartupFailed(deleteBlock);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// flushAll()
+// -----------------------------------------------------------------------------
+//
+void VideoDeleteWorker::flushAll()
+{
+ if(!mRemoveBuffer.count())
+ {
+ return;
+ }
+ QList<TMPXItemId> ids = mRemoveBuffer.toList();
+ mCollectionClient.deleteVideos(&ids);
+ mRemoveBuffer.clear();
+}
+
+
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/src/videolistdatamodel.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,506 @@
+/*
+* 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: VideoListDataModel class implementation
+*
+*/
+// INCLUDE FILES
+
+#include <hbglobal.h>
+#include <vcxmyvideosdefs.h>
+#include "videolistdatamodel.h"
+#include "videolistdatamodel_p.h"
+#include "videocollectionclient.h"
+#include "videocollectioncommon.h"
+#include "videocollectionutils.h"
+#include "videodeleteworker.h"
+#include "videocollectionwrapper.h"
+
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// -----------------------------------------------------------------------------
+// VideoListDataModel()
+// -----------------------------------------------------------------------------
+//
+VideoListDataModel::VideoListDataModel(QObject *parent) :
+QAbstractItemModel(parent),
+d_ptr( new VideoListDataModelPrivate(this)),
+mCollectionClient(0),
+mDeleteWorker(0),
+mInitialized(false)
+{
+}
+
+// -----------------------------------------------------------------------------
+// ~VideoListDataModel()
+// -----------------------------------------------------------------------------
+//
+VideoListDataModel::~VideoListDataModel()
+{
+ delete mDeleteWorker;
+ delete d_ptr;
+ delete mCollectionClient;
+}
+
+// -----------------------------------------------------------------------------
+// initialize()
+// -----------------------------------------------------------------------------
+//
+int VideoListDataModel::initialize()
+{
+ if(mInitialized)
+ {
+ return 0;
+ }
+ if(!mCollectionClient)
+ {
+ mCollectionClient = new VideoCollectionClient();
+ if(!mCollectionClient || mCollectionClient->initialize(d_ptr) < 0)
+ {
+ delete mCollectionClient;
+ mCollectionClient = 0;
+ return -1;
+ }
+ }
+
+ if(!mDeleteWorker)
+ {
+ mDeleteWorker = new VideoDeleteWorker(*mCollectionClient);
+ if(!mDeleteWorker)
+ {
+ delete mCollectionClient;
+ mCollectionClient = 0;
+ return -1;
+ }
+ }
+
+ if( d_ptr->initialize() == -1)
+ {
+ return -1;
+ }
+
+ if(connectSignals() == -1)
+ {
+ disconnectSignals();
+ return -1;
+ }
+
+ mInitialized = true;
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// getCollectionClient()
+// -----------------------------------------------------------------------------
+//
+VideoCollectionClient* VideoListDataModel::getCollectionClient()
+{
+ return mCollectionClient;
+}
+
+// -----------------------------------------------------------------------------
+// connectSignals()
+// -----------------------------------------------------------------------------
+//
+int VideoListDataModel::connectSignals()
+{
+ if(!connect(d_ptr, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)),
+ this, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&))))
+ {
+ return -1;
+ }
+ if(!connect(d_ptr, SIGNAL(videoDetailsReady(TMPXItemId)),
+ this, SIGNAL(fullVideoDetailsReady(TMPXItemId))))
+ {
+ return -1;
+ }
+ if(!connect(this, SIGNAL(modelChanged()), mDeleteWorker, SLOT(continueSlot())))
+ {
+ return -1;
+ }
+ if(!connect(this, SIGNAL(modelReady()), mDeleteWorker, SLOT(continueSlot())))
+ {
+ return -1;
+ }
+ if(!connect(mDeleteWorker, SIGNAL(deleteStartupFailed(QList<TMPXItemId>)),
+ this, SLOT(deleteStartingFailsSlot(QList<TMPXItemId>))))
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// disconnectSignals()
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModel::disconnectSignals()
+{
+ disconnect(d_ptr, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)),
+ this, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)));
+ disconnect(d_ptr, SIGNAL(videoDetailsReady(TMPXItemId)),
+ this, SIGNAL(fullVideoDetailsReady(TMPXItemId)));
+ disconnect(this, SIGNAL(modelChanged()), mDeleteWorker, SLOT(continueSlot()));
+ disconnect(this, SIGNAL(modelReady()), mDeleteWorker, SLOT(continueSlot()));
+ disconnect(mDeleteWorker, SIGNAL(deleteStartupFailed(QList<TMPXItemId>)),
+ this, SLOT(deleteStartingFailsSlot(QList<TMPXItemId>)));
+}
+
+// -----------------------------------------------------------------------------
+// mediaIdAtIndex()
+// -----------------------------------------------------------------------------
+//
+TMPXItemId VideoListDataModel::mediaIdAtIndex(int index) const
+{
+ TMPXItemId mpxId =TMPXItemId::InvalidId();
+
+ if(index >= 0 && index < d_ptr->getVideoCount())
+ {
+ mpxId = d_ptr->getMediaIdFromIndex(index);
+ }
+
+ return mpxId;
+}
+
+// -----------------------------------------------------------------------------
+// indexOfId()
+// -----------------------------------------------------------------------------
+//
+QModelIndex VideoListDataModel::indexOfId(TMPXItemId id)
+{
+ int rowIndex = d_ptr->mMediaData.indexOfId(id);
+ return index(rowIndex, 0, QModelIndex());
+}
+
+// -----------------------------------------------------------------------------
+// mediaFilePathForId()
+// -----------------------------------------------------------------------------
+//
+QString VideoListDataModel::mediaFilePathForId(TMPXItemId mediaId) const
+{
+ QString filePath;
+ filePath = d_ptr->getFilePathForId(mediaId);
+
+ return filePath;
+}
+
+// -----------------------------------------------------------------------------
+// rowCount()
+// -----------------------------------------------------------------------------
+//
+int VideoListDataModel::rowCount(const QModelIndex &parent ) const
+{
+ // according to Qt documentation if parent is valid this should return 0 if
+ // implementing a table based implementation like this.
+ if (parent.isValid())
+ {
+ return 0;
+ }
+
+ return d_ptr->getVideoCount();
+}
+
+// -----------------------------------------------------------------------------
+// itemData()
+// -----------------------------------------------------------------------------
+//
+QMap<int, QVariant> VideoListDataModel::itemData(const QModelIndex &index) const
+{
+ QMap<int, QVariant> itemData;
+
+ if (index.isValid())
+ {
+ // returns only basic data of the item
+ itemData.insert(Qt::DisplayRole, data(index, Qt::DisplayRole));
+ itemData.insert(Qt::DecorationRole, data(index, Qt::DecorationRole));
+ itemData.insert(Qt::BackgroundRole, data(index, Qt::BackgroundRole));
+ }
+ return itemData;
+
+}
+
+// -----------------------------------------------------------------------------
+// prepareDetailRow()
+// -----------------------------------------------------------------------------
+//
+QString VideoListDataModel::prepareDetailRow( int index ) const
+{
+ // TODO: download -status?
+
+ QString retString;
+
+ TMPXItemId itemId = mediaIdAtIndex(index);
+
+ if(itemId.iId2 != KVcxMvcMediaTypeVideo) //category || album
+ {
+ //TODO: get real items and total length
+ int items = 99;
+ QString minutesStr = "10";
+ QString secondsStr = "01";
+ retString = hbTrId("txt_videos_dblist_val_ln_videos_l1l2", items).arg(minutesStr).arg(secondsStr);
+ }
+ else //video
+ {
+ const QString sizeStr = prepareSizeString(index);
+ const QStringList list = prepareLengthStrings( index );
+ retString = hbTrId("txt_videos_dblist_captured_val_1_l1l2").arg(sizeStr).arg(list.at(0)).arg(list.at(1));
+ }
+ return retString;
+}
+
+// -----------------------------------------------------------------------------
+// prepareSizeString()
+// -----------------------------------------------------------------------------
+//
+QString VideoListDataModel::prepareSizeString( int index ) const
+{
+ QString sizeStr("");
+
+ quint32 size = d_ptr->getVideoSizeFromIndex(index);
+ sizeStr = VideoCollectionUtils::instance().prepareSizeString(size);
+
+ return sizeStr;
+}
+
+// -----------------------------------------------------------------------------
+// VideoListDataModel::prepareLengthStrings()
+// -----------------------------------------------------------------------------
+//
+QStringList VideoListDataModel::prepareLengthStrings( int index ) const
+{
+ quint32 total = d_ptr->getVideodurationFromIndex(index);
+ return VideoCollectionUtils::instance().prepareLengthStrings(total);
+}
+
+// -----------------------------------------------------------------------------
+// data()
+// -----------------------------------------------------------------------------
+//
+QVariant VideoListDataModel::data(const QModelIndex & index, int role) const
+{
+ QVariant returnValue = QVariant();
+
+
+ if (index.isValid())
+ {
+ int rowIndex = index.row();
+
+ if (role == Qt::DisplayRole)
+ {
+ QStringList itemTxt;
+ itemTxt.append(d_ptr->getVideoNameFromIndex(rowIndex));
+
+ // Item's 2nd row: details
+ itemTxt.append(prepareDetailRow(rowIndex));
+ returnValue = itemTxt;
+ }
+ else if (role == Qt::DecorationRole)
+ {
+ const QIcon *thumbnail = d_ptr->getVideoThumbnailFromIndex(rowIndex);
+ QVariant tnVariant(QVariant::Icon, thumbnail);
+ returnValue = tnVariant;
+ }
+ else if (role == VideoCollectionCommon::KeyDateTime)
+ {
+ QDateTime date = d_ptr->getVideoDateFromIndex(rowIndex);
+ returnValue = date;
+ }
+ else if(role == VideoCollectionCommon::KeySizeValue)
+ {
+ quint32 size = d_ptr->getVideoSizeFromIndex(rowIndex);
+ returnValue = size;
+
+ }
+ else if(role == VideoCollectionCommon::KeyMetaData)
+ {
+ returnValue = d_ptr->getMetaDataFromIndex(rowIndex);
+ }
+ else if(role == VideoCollectionCommon::KeyFilePath)
+ {
+ QString path = d_ptr->getFilePathFromIndex(rowIndex);
+ if(!(path.isNull()) && !(path.isEmpty())) {
+ returnValue = path;
+ }
+ }
+ }
+
+ return returnValue;
+}
+
+// -----------------------------------------------------------------------------
+// columnCount()
+// -----------------------------------------------------------------------------
+//
+int VideoListDataModel::columnCount(const QModelIndex & parent) const
+{
+ // according to Qt documentation if parent is valid this should return 0 if
+ // implementing a table based implementation like this.
+ if (parent.isValid())
+ {
+ return 0;
+ }
+ else
+ {
+ return 1;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// index()
+// -----------------------------------------------------------------------------
+//
+QModelIndex VideoListDataModel::index(int row, int column, const QModelIndex & /*parent*/) const
+{
+
+ if(row >= 0 && row < d_ptr->getVideoCount())
+ {
+ return createIndex(row, column);
+ }
+
+ return QModelIndex();
+}
+
+// -----------------------------------------------------------------------------
+// parent()
+// -----------------------------------------------------------------------------
+//
+QModelIndex VideoListDataModel::parent(const QModelIndex & /*index*/) const
+{
+ return QModelIndex();
+}
+
+// -----------------------------------------------------------------------------
+// removeRows()
+// -----------------------------------------------------------------------------
+//
+bool VideoListDataModel::removeRows(const QModelIndexList &indexList)
+{
+ if(!mCollectionClient || !mDeleteWorker)
+ {
+ return false;
+ }
+ // generate list of deletable item ids
+ TMPXItemId id = TMPXItemId::InvalidId();
+ QList<TMPXItemId> removedIds;
+ QModelIndexList sortable(indexList);
+ qSort(sortable);
+
+ // since items are removed from actual container when being marked
+ // causing total item count to be decreased,
+ // we need to mark items starting from biggest index, otherwise we might
+ // end up to mark invalid items or we are referring into null item
+ QModelIndexList::const_iterator iter = sortable.constEnd();
+ while(iter != sortable.constBegin())
+ {
+ iter--;
+ beginRemoveRows(QModelIndex(), (*iter).row(), (*iter).row());
+ // marking might fail if either because
+ // item does no exist or index is incorrect.
+ // Both reasons mean that item is incorrect and should be removed
+ // from the view. No need to restain them
+ id = d_ptr->markVideoRemoved((*iter));
+ endRemoveRows();
+ if(id != TMPXItemId::InvalidId())
+ {
+ removedIds.append(id);
+ }
+ }
+ emit modelChanged();
+ if(removedIds.count() > 0 )
+ {
+ mDeleteWorker->requestDelete(removedIds);
+ return true;
+ }
+ return false;
+}
+
+// -----------------------------------------------------------------------------
+// belongsToAlbum()
+// -----------------------------------------------------------------------------
+//
+bool VideoListDataModel::belongsToAlbum(const TMPXItemId &itemId,
+ TMPXItemId albumId ) const
+{
+ return d_ptr->belongsToAlbum(itemId, albumId);
+}
+
+// -----------------------------------------------------------------------------
+// setAlbumInUse()
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModel::setAlbumInUse(TMPXItemId albumId)
+{
+ d_ptr->setAlbumInUse(albumId);
+}
+
+// -----------------------------------------------------------------------------
+// albumInUse()
+// -----------------------------------------------------------------------------
+//
+
+TMPXItemId VideoListDataModel::albumInUse()
+{
+ return d_ptr->mCurrentAlbum;
+}
+
+// -----------------------------------------------------------------------------
+// deleteStartingFailsSlot()
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModel::deleteStartingFailsSlot(QList<TMPXItemId> ids)
+{
+ if(ids.count())
+ {
+ d_ptr->restoreRemoved(&ids);
+ QVariant data = ids.count();
+ reportAsyncStatus(VideoCollectionCommon::statusMultipleDeleteFail, data);
+ }
+ // signal for worker to proceed
+ emit modelChanged();
+}
+
+// -----------------------------------------------------------------------------
+// reportAsyncStatus()
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModel::reportAsyncStatus(int statusCode, QVariant &additional)
+{
+ bool report = true;
+ if(statusCode == VideoCollectionCommon::statusSingleDeleteFail ||
+ statusCode == VideoCollectionCommon::statusMultipleDeleteFail ||
+ statusCode == VideoCollectionCommon::statusDeleteSucceed)
+ {
+ report = false;
+ if(!mDeleteWorker)
+ {
+ return;
+ }
+ mDeleteWorker->updateStatus(statusCode, additional);
+ statusCode = mDeleteWorker->getLastStatus(additional);
+ if(!mDeleteWorker->isDeleting())
+ {
+ report = true;
+ // delete procedure ends, reset statuses
+ mDeleteWorker->clearStatus();
+ }
+ }
+ if(report)
+ {
+ VideoCollectionWrapper::instance().sendAsyncStatus(statusCode, additional);
+ }
+}
+
+// End of file
--- a/videocollection/videocollectionwrapper/src/videolistdatamodel_p.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/src/videolistdatamodel_p.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -24,7 +24,9 @@
#include <qvariant.h>
#include "videolistdatamodel.h"
-#include "videocollectionwrapper.h"
+#include "videocollectionclient.h"
+#include "videodeleteworker.h"
+
#include "videolistdatamodel_p.h"
#include "videothumbnaildata.h"
#include "vcxmyvideosdefs.h"
@@ -32,7 +34,7 @@
#include "videocollectioncommon.h"
/**
- * private global inline hash function for TMPXItemId keys in QSet
+ * global qHash function required fo creating hash values for TMPXItemId -keys
*/
inline uint qHash(TMPXItemId key)
{
@@ -50,8 +52,9 @@
//
VideoListDataModelPrivate::VideoListDataModelPrivate(VideoListDataModel *model) :
q_ptr(model),
-mVideoThumbnailData(VideoThumbnailData::instance()),
-mInitialized(false)
+mVideoThumbnailData(0),
+mInitialized(false),
+mCurrentAlbum(TMPXItemId::InvalidId())
{
}
@@ -61,6 +64,13 @@
//
VideoListDataModelPrivate::~VideoListDataModelPrivate()
{
+ QHash<TMPXItemId, QSet<TMPXItemId> >::iterator iter = mAlbumData.begin();
+ while(iter != mAlbumData.end())
+ {
+ iter->clear();
+ ++iter;
+ }
+ mAlbumData.clear();
mMediaData.clear();
}
@@ -74,7 +84,8 @@
{
return 0;
}
- if(!connect( &mVideoThumbnailData, SIGNAL(thumbnailsFetched( QList<TMPXItemId> )),
+ mVideoThumbnailData = &(VideoThumbnailData::instance());
+ if(!connect( mVideoThumbnailData, SIGNAL(thumbnailsFetched( QList<TMPXItemId> )),
this, SLOT(thumbnailsFetchedSlot( QList<TMPXItemId> ))))
{
return -1;
@@ -120,7 +131,11 @@
//
const QIcon* VideoListDataModelPrivate::getVideoThumbnailFromIndex( int index ) const
{
- return mVideoThumbnailData.getThumbnail( mMediaData.idFromIndex(index) );
+ if(mVideoThumbnailData)
+ {
+ return mVideoThumbnailData->getThumbnail( mMediaData.idFromIndex(index) );
+ }
+ return 0;
}
// -----------------------------------------------------------------------------
@@ -198,6 +213,7 @@
map[MetaKeyDate] = date.date();
}
+ //TODO: Localisation
// MetaKeyDurationString
quint32 dur = getVideodurationFromIndex(index);
QString duration = VideoCollectionUtils::instance().prepareLengthString(dur);
@@ -205,6 +221,7 @@
map[MetaKeyDurationString] = duration;
}
+ //TODO: Localisation
// MetaKeySizeString
quint32 s = getVideoSizeFromIndex(index);
QString size = VideoCollectionUtils::instance().prepareSizeString(s);
@@ -276,52 +293,26 @@
}
// -----------------------------------------------------------------------------
-// getVideoStatusFromIndex
-// -----------------------------------------------------------------------------
-//
-int VideoListDataModelPrivate::getVideoStatusFromIndex(int index) const
-{
- int status = 0;
- if(mItemsUnderDeletion.contains(getMediaIdFromIndex(index)))
- {
- status = VideoCollectionCommon::StatusDeleted;
- }
- return status;
-}
-
-// -----------------------------------------------------------------------------
// markVideosRemoved
// -----------------------------------------------------------------------------
//
-QList<TMPXItemId> VideoListDataModelPrivate::markVideosRemoved(const QModelIndexList &itemIndexes)
+TMPXItemId VideoListDataModelPrivate::markVideoRemoved(const QModelIndex &itemIndex)
{
- QList<TMPXItemId> idList;
- TMPXItemId id;
- QModelIndexList::const_iterator iter = itemIndexes.constBegin();
- while(iter != itemIndexes.constEnd())
- {
- id = getMediaIdFromIndex((*iter).row());
- if(id != TMPXItemId::InvalidId())
- {
- mItemsUnderDeletion.insert(id);
- idList.append(id);
- }
- iter++;
- }
- return idList;
+ return mMediaData.markItemRemoved(itemIndex.row());
}
// -----------------------------------------------------------------------------
-// unMarkVideosRemoved
+// restoreRemoved
// -----------------------------------------------------------------------------
//
-void VideoListDataModelPrivate::unMarkVideosRemoved(QList<TMPXItemId> &itemIds)
+void VideoListDataModelPrivate::restoreRemoved(QList<TMPXItemId> *idList)
{
- QList<TMPXItemId>::const_iterator iter = itemIds.constBegin();
- while(iter != itemIds.constEnd())
+ int startIndex = mMediaData.count();
+ int restored = mMediaData.restoreRemovedItems(idList);
+ if(restored > 0)
{
- mItemsUnderDeletion.remove(*iter);
- iter++;
+ q_ptr->beginInsertRows(QModelIndex(), startIndex, startIndex + (restored - 1));
+ q_ptr->endInsertRows();
}
}
@@ -351,6 +342,39 @@
}
// -----------------------------------------------------------------------------
+// belongsToAlbum
+// -----------------------------------------------------------------------------
+//
+bool VideoListDataModelPrivate::belongsToAlbum(const TMPXItemId &itemId, TMPXItemId albumId) const
+{
+ bool contains(false);
+ QHash<TMPXItemId, QSet<TMPXItemId> >::const_iterator iter;
+ if(albumId == TMPXItemId::InvalidId())
+ {
+ // album id not specified, use the current album
+ iter = mAlbumData.constFind(mCurrentAlbum);
+ }
+ else
+ {
+ iter = mAlbumData.constFind(albumId);
+ }
+ if (iter != mAlbumData.constEnd())
+ {
+ contains = iter->contains(itemId);
+ }
+ return contains;
+}
+
+// -----------------------------------------------------------------------------
+// belongsToAlbum
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModelPrivate::setAlbumInUse(TMPXItemId albumId)
+{
+ mCurrentAlbum = albumId;
+}
+
+// -----------------------------------------------------------------------------
// getMediaId
// -----------------------------------------------------------------------------
//
@@ -367,43 +391,112 @@
// appendDataToContainerL
// -----------------------------------------------------------------------------
//
-void VideoListDataModelPrivate::appendDataToContainerL(CMPXMediaArray *videoArray, unsigned int startIndex)
+void VideoListDataModelPrivate::appendDataToContainerL(
+ CMPXMediaArray *videoArray,
+ unsigned int startIndex)
{
- if(!videoArray || startIndex >= videoArray->Count())
+ int count = videoArray->Count();
+ if (!videoArray ||
+ startIndex >= count)
{
return;
}
- // get id used check wether we need category or video list masking
- TMPXItemId mpxFirstId = TMPXItemId::InvalidId();
- VideoCollectionUtils::instance().mediaValue<TMPXItemId>(videoArray->AtL(0), KMPXMediaGeneralId, mpxFirstId );
- if(mpxFirstId == TMPXItemId::InvalidId())
- {
- // invalid
- return;
- }
- int count = videoArray->Count();
CMPXMedia *newMedia = 0;
+ CMPXMedia *mediaFromArray = 0;
TMPXItemId itemId = TMPXItemId::InvalidId();
for(int i = startIndex; i < count; ++i)
{
- newMedia = 0;
- itemId = TMPXItemId::InvalidId();
- itemId = getMediaId(videoArray->AtL(i));
- // type of list is taken from the first item
- // remaining items are accepted only if they match the type
- // TODO: currently albums are filtered out
- if((mpxFirstId.iId2 == 0 && itemId != TMPXItemId::InvalidId()) ||
- (mpxFirstId.iId2 >= 1 && (itemId.iId1 == KVcxMvcCategoryIdDownloads) ||
- (itemId.iId1 == KVcxMvcCategoryIdCaptured)) && mpxFirstId.iId2 == itemId.iId2)
+ mediaFromArray = videoArray->AtL(i);
+ itemId = getMediaId(mediaFromArray);
+ if (isValid(*mediaFromArray, itemId))
{
- newMedia = CMPXMedia::NewL(*(videoArray->AtL(i)));
+ newMedia = CMPXMedia::NewL(*mediaFromArray);
mMediaData.append(newMedia);
+ newMedia = 0;
}
}
}
// -----------------------------------------------------------------------------
+// isValid
+// -----------------------------------------------------------------------------
+//
+bool VideoListDataModelPrivate::isValid(const CMPXMedia &media,
+ const TMPXItemId &itemId) const
+{
+ if(itemId == TMPXItemId::InvalidId())
+ {
+ return false;
+ }
+ // temporary to remove all items with out a title
+ QString title;
+ VideoCollectionUtils::instance().mediaValue<QString>(&media,
+ KMPXMediaGeneralTitle,
+ title);
+ if (!title.length())
+ {
+ return false;
+ }
+ // recently played and podcasts are not yet supported
+ if(itemId.iId2 == KVcxMvcMediaTypeCategory &&
+ (itemId.iId1 != KVcxMvcCategoryIdDownloads &&
+ itemId.iId1 != KVcxMvcCategoryIdCaptured))
+ {
+ return false;
+ }
+ return true;
+}
+
+// -----------------------------------------------------------------------------
+// appendDataToAlbumL
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModelPrivate::appendDataToAlbumL(TMPXItemId albumId,
+ CMPXMediaArray *videoArray)
+{
+ if (!videoArray || albumId == TMPXItemId::InvalidId())
+ {
+ return;
+ }
+ QSet<TMPXItemId> items;
+ QHash<TMPXItemId, QSet<TMPXItemId> >::iterator iter;
+ // if album exists fetch existing items
+ iter = mAlbumData.find(albumId);
+ if(iter != mAlbumData.end())
+ {
+ items = iter.value();
+ }
+ bool albumUpdated = false;
+ int videoCount = videoArray->Count();
+ CMPXMedia *media = 0;
+ TMPXItemId id = TMPXItemId::InvalidId();
+ QModelIndex index;
+ for (int i = videoCount - 1; i >= 0; i--)
+ {
+ media = videoArray->AtL(i);
+ id = getMediaId(media);
+ if (id != TMPXItemId::InvalidId())
+ {
+
+ items.insert(id);
+ albumUpdated = true;
+ }
+ }
+ // overwrite existing or create new
+ mAlbumData[albumId] = items;
+ // signal that album has been updated
+ if (albumUpdated)
+ {
+ emit q_ptr->albumChanged();
+ }
+
+ // signal that model is ready
+ emit q_ptr->modelReady();
+}
+
+
+// -----------------------------------------------------------------------------
// thumbnailsFetchedSlot
// -----------------------------------------------------------------------------
//
@@ -436,22 +529,17 @@
return;
}
- int count = newVideoList->Count();
-
- // clear old content
- if((mMediaData.count() > 0))
- {
- q_ptr->beginRemoveRows(QModelIndex(), 0, mMediaData.count() - 1);
- mMediaData.clear();
- q_ptr->endRemoveRows();
- }
-
- // decide wether we we are inserting new or not, if provided list is empty -> we do not insert any videos
- count == 0 ? q_ptr->beginInsertRows(QModelIndex(), 0, 0) : q_ptr->beginInsertRows(QModelIndex(), 0, count - 1);
+ int startIndex = mMediaData.count();
TRAP_IGNORE(appendDataToContainerL(newVideoList));
- q_ptr->endInsertRows();
+ int endIndex = mMediaData.count() - 1;
+ if(startIndex <= endIndex)
+ {
+ q_ptr->beginInsertRows(QModelIndex(), startIndex, endIndex);
+ q_ptr->endInsertRows();
+ }
+
emit q_ptr->modelReady();
}
@@ -481,6 +569,7 @@
TRAP_IGNORE(appendDataToContainerL(videoList, startIndex));
q_ptr->endInsertRows();
+ emit q_ptr->modelChanged();
}
// -----------------------------------------------------------------------------
@@ -503,38 +592,116 @@
// append video into list, ownership of provided mediaobject is not transferred,
// so we need to create copy of CMPXMedia
- CMPXMedia *videoToAppend = 0;
- TRAP_IGNORE(videoToAppend = CMPXMedia::NewL(*newVideo));
+ if (isValid(*newVideo, mediaId))
+ {
+ CMPXMedia *videoToAppend = 0;
+ TRAP_IGNORE(videoToAppend = CMPXMedia::NewL(*newVideo));
- q_ptr->beginInsertRows(QModelIndex(), mMediaData.count(), mMediaData.count());
+ q_ptr->beginInsertRows(QModelIndex(), mMediaData.count(), mMediaData.count());
+
+ mMediaData.append(videoToAppend);
+
+ q_ptr->endInsertRows();
- mMediaData.append(videoToAppend);
-
- q_ptr->endInsertRows();
+ emit q_ptr->modelChanged();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// itemDeletedSlot
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModelPrivate::itemDeletedSlot(TMPXItemId itemId)
+{
+ if(itemId == TMPXItemId::InvalidId())
+ {
+ return;
+ }
+
+ if(itemId.iId2 == KVcxMvcMediaTypeVideo)
+ {
+ videoDeleted(itemId);
+ }
+ else if (itemId.iId2 == KVcxMvcMediaTypeAlbum)
+ {
+ albumRemoved(itemId);
+ }
+}
+// -----------------------------------------------------------------------------
+// albumRemoved
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModelPrivate::albumRemoved(TMPXItemId albumId)
+{
+ if (albumId == TMPXItemId::InvalidId() || albumId.iId2 != KVcxMvcMediaTypeAlbum)
+ {
+ return;
+ }
+
+ bool changed(false);
+
+ if(mVideoThumbnailData)
+ {
+ mVideoThumbnailData->removeThumbnail( albumId );
+ }
+
+ int index = mMediaData.indexOfId(albumId);
+ if(index >= 0)
+ {
+ q_ptr->beginRemoveRows(QModelIndex(), index, index);
+ mMediaData.remove(albumId);
+ q_ptr->endRemoveRows();
+ changed = true;
+ }
+
+ //remove album data
+ QHash<TMPXItemId, QSet<TMPXItemId> >::iterator iter;
+ iter = mAlbumData.find(albumId);
+ if(iter != mAlbumData.end())
+ {
+ iter->clear();
+ changed = true;
+ }
+
+ if(changed)
+ {
+ emit q_ptr->modelChanged();
+ }
}
// -----------------------------------------------------------------------------
// videoDeleted
// -----------------------------------------------------------------------------
//
-void VideoListDataModelPrivate::videoDeletedSlot(TMPXItemId videoId)
+void VideoListDataModelPrivate::videoDeleted(TMPXItemId videoId)
{
- int index = -1;
-
- if(mItemsUnderDeletion.contains(videoId))
+ if(videoId == TMPXItemId::InvalidId())
+ {
+ return;
+ }
+ // check if provided id is in the deleted -container and remove
+ // it from there if it is.
+ QList<TMPXItemId> ids;
+ ids.append(videoId);
+ if(!mMediaData.clearRemoved(&ids))
{
- mItemsUnderDeletion.remove(videoId);
- }
- index = mMediaData.indexOfId(videoId);
-
- if(index >= 0 && index < mMediaData.count())
- {
- q_ptr->beginRemoveRows(QModelIndex(), index, index);
- mMediaData.remove(videoId);
- mVideoThumbnailData.removeThumbnail( videoId );
- q_ptr->endRemoveRows();
- }
+ q_ptr->mDeleteWorker->removeFromRequest(videoId);
+ if(mVideoThumbnailData)
+ {
+ mVideoThumbnailData->removeThumbnail( videoId );
+ }
+ // media removed was not in the deleted -container, so we have external
+ // removal: in this case we need to indicate UI
+ int index = mMediaData.indexOfId(videoId);
+ if(index >= 0)
+ {
+ q_ptr->beginRemoveRows(QModelIndex(), index, index);
+ mMediaData.remove(videoId);
+ q_ptr->endRemoveRows();
+ emit q_ptr->modelChanged();
+ }
+ }
}
// -----------------------------------------------------------------------------
@@ -542,56 +709,61 @@
// -----------------------------------------------------------------------------
//
void VideoListDataModelPrivate::videoDeleteCompletedSlot(int overallCount, QList<TMPXItemId> *failedMediaIds)
-{
- // overallCount not used at the moment, since there is no need of
- // reporting UI about succeed deletion
+{
Q_UNUSED(overallCount);
-
if(!failedMediaIds)
{
+ // invalid signal received, do nothing
return;
}
- QModelIndex failedIndex;
- int failedCount = 0;
-
- // delete requested from UI
- // go failed list throught and remove all failed from
- // list under deletion
- QList<TMPXItemId>::const_iterator iter = failedMediaIds->constBegin();
- while(iter != failedMediaIds->constEnd())
- {
- if(mItemsUnderDeletion.contains(*iter))
+ int status(VideoCollectionCommon::statusDeleteSucceed);
+ QVariant data;
+ if(failedMediaIds->count() > 0)
+ {
+ QString nameOfFirstFailed("");
+ CMPXMedia *media = mMediaData.getRemovedMedia( TMPXItemId(failedMediaIds->at(0)));
+ VideoCollectionUtils::instance().mediaValue<QString>(media, KMPXMediaGeneralTitle, nameOfFirstFailed );
+ if(failedMediaIds->count() == 1)
{
- // failure found, remove from list and notify UI about changed status
- failedIndex = q_ptr->index(mMediaData.indexOfId(*iter), 0);
- mItemsUnderDeletion.remove(*iter);
- failedCount++;
- emit dataChanged( failedIndex, failedIndex);
- }
- iter++;
- }
- // send status throught videocollectionwraper:
- // - failed status, if some user requested deletion failed:
- // --- if one item, get name and pass it along signal
- // --- if multiple items, pass count of items
- if(failedCount > 0)
- {
- VideoCollectionWrapper *wrapper = VideoCollectionWrapper::instance();
- QVariant data;
- if(failedCount == 1)
- {
- data = getVideoNameFromIndex(failedIndex.row());
- wrapper->sendAsyncStatus(VideoCollectionCommon::statusSingleDeleteFail, data);
-
+ status = VideoCollectionCommon::statusSingleDeleteFail;
+ data = nameOfFirstFailed;
}
else
{
- data = failedCount;
- wrapper->sendAsyncStatus(VideoCollectionCommon::statusMultipleDeleteFail, data);
- }
- wrapper->decreaseReferenceCount();
- wrapper = 0;
- }
+ status = VideoCollectionCommon::statusMultipleDeleteFail;
+ data = failedMediaIds->count();
+ }
+ restoreRemoved(failedMediaIds);
+ }
+ q_ptr->reportAsyncStatus(status, data);
+ emit q_ptr->modelChanged();
+}
+
+// -----------------------------------------------------------------------------
+// albumRemoveFailureSlot
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModelPrivate::albumRemoveFailureSlot(QList<TMPXItemId> *failedMediaIds)
+{
+ int status(VideoCollectionCommon::statusRemoveSucceed);
+ QVariant data;
+ if(failedMediaIds->count() > 0)
+ {
+ QString nameOfFirstFailed("");
+ CMPXMedia *media = mMediaData.getRemovedMedia( TMPXItemId(failedMediaIds->at(0)));
+ VideoCollectionUtils::instance().mediaValue<QString>(media, KMPXMediaGeneralTitle, nameOfFirstFailed );
+ if(failedMediaIds->count() == 1)
+ {
+ status = VideoCollectionCommon::statusSingleRemoveFail;
+ data = nameOfFirstFailed;
+ }
+ else
+ {
+ status = VideoCollectionCommon::statusMultiRemoveFail;
+ data = failedMediaIds->count();
+ }
+ }
+ q_ptr->reportAsyncStatus(status, data);
}
// -----------------------------------------------------------------------------
@@ -600,11 +772,21 @@
//
void VideoListDataModelPrivate::videoDetailsCompletedSlot(TMPXItemId videoId)
{
- int index = mMediaData.indexOfId(videoId);
- if(index >= 0)
+ if(videoId != TMPXItemId::InvalidId())
{
- emit videoDetailsReady(index);
+ emit videoDetailsReady(videoId);
}
}
+// -----------------------------------------------------------------------------
+// albumListAvailableSlot
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModelPrivate::albumListAvailableSlot(TMPXItemId albumId,
+ CMPXMediaArray *albumItems)
+{
+ // currently only one album is kept in memory
+ TRAP_IGNORE(appendDataToAlbumL(albumId, albumItems));
+}
+
// End of file
--- a/videocollection/videocollectionwrapper/src/videosortfilterproxymodel.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/src/videosortfilterproxymodel.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -16,24 +16,30 @@
*/
#include <qstringlist.h>
+#include <qset.h>
#include <qtimer.h>
#include <qdatetime.h>
+#include <vcxmyvideosdefs.h>
#include "videothumbnaildata.h"
#include "videocollectioncommon.h"
#include "videosortfilterproxymodel.h"
#include "videolistdatamodel.h"
#include "videocollectionclient.h"
+#include "videocollectionwrapper.h"
// -----------------------------------------------------------------------------
// VideoSortFilterProxyModel::VideoSortFilterProxyModel
// -----------------------------------------------------------------------------
//
-VideoSortFilterProxyModel::VideoSortFilterProxyModel(QObject *parent) :
+VideoSortFilterProxyModel::VideoSortFilterProxyModel(int type, QObject *parent) :
QSortFilterProxyModel(parent),
mModel(0),
mCollectionClient(0),
+ mType(type),
mLevel(-1),
+ mGenericFilterId(TMPXItemId::InvalidId()),
+mGenericFilterValue(false),
mIdleSortTimer(0),
mWantedSortRole(VideoCollectionCommon::KeyDateTime)
{
@@ -46,7 +52,7 @@
//
VideoSortFilterProxyModel::~VideoSortFilterProxyModel()
{
- delete mCollectionClient;
+ // NOP
}
// -----------------------------------------------------------------------------
@@ -55,37 +61,67 @@
//
int VideoSortFilterProxyModel::initialize(VideoListDataModel *sourceModel)
{
- if(!mCollectionClient) {
- if(!connect(sourceModel, SIGNAL(fullVideoDetailsReady(int)),
- this, SIGNAL(fullDetailsReady(int)))) {
- return -1;
- }
-
- if(!connect(sourceModel, SIGNAL(modelReady()),
- this, SIGNAL(modelReady()))) {
+ if(!sourceModel)
+ {
+ return -1;
+ }
+
+ if(!mModel)
+ {
+ mModel = sourceModel;
+ if(!connectSignals())
+ {
+ disconnectSignals();
+ mModel = 0;
return -1;
}
+ mCollectionClient = mModel->getCollectionClient();
+ setSourceModel(sourceModel);
+ }
+ return 0;
+}
- mCollectionClient = new VideoCollectionClient();
- if(!mCollectionClient ||
- mCollectionClient->initialize() < 0 ||
- sourceModel->initialize(mCollectionClient) < 0) {
- delete mCollectionClient;
- mCollectionClient = 0;
- disconnect(sourceModel, SIGNAL(fullVideoDetailsReady(int)),
- this, SIGNAL(fullDetailsReady(int)));
- return -1;
- }
-
- } else {
- if(sourceModel->initialize(mCollectionClient) < 0) {
- return -1;
- }
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::connectSignals
+// -----------------------------------------------------------------------------
+//
+bool VideoSortFilterProxyModel::connectSignals()
+{
+ if(!connect(mModel, SIGNAL(fullVideoDetailsReady(TMPXItemId)),
+ this, SIGNAL(fullDetailsReady(TMPXItemId))))
+ {
+ return false;
+ }
+
+ if(!connect(mModel, SIGNAL(modelReady()),
+ this, SIGNAL(modelReady())))
+ {
+ return false;
}
-
- mModel = sourceModel;
- setSourceModel(sourceModel);
- return 0;
+ if(!connect(mModel, SIGNAL(modelChanged()),
+ this, SIGNAL(modelChanged())))
+ {
+ return false;
+ }
+ if(!connect(mModel, SIGNAL(albumChanged()),
+ this, SLOT(albumChangedSlot())))
+ {
+ return false;
+ }
+ return true;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::disconnectSignals
+// -----------------------------------------------------------------------------
+//
+void VideoSortFilterProxyModel::disconnectSignals()
+{
+ disconnect(mModel, SIGNAL(fullVideoDetailsReady(TMPXItemId)),
+ this, SIGNAL(fullDetailsReady(TMPXItemId)));
+ disconnect(mModel, SIGNAL(modelReady()), this, SIGNAL(modelReady()));
+ disconnect(mModel, SIGNAL(modelChanged()), this, SIGNAL(modelChanged()));
+ disconnect(mModel, SIGNAL(albumChanged()), this, SLOT(albumChangedSlot()));
}
// -----------------------------------------------------------------------------
@@ -94,12 +130,19 @@
//
int VideoSortFilterProxyModel::open(int level)
{
- if(mLevel != level) {
- mLevel = level;
- return mCollectionClient->startOpenCollection(level);
+ if(!mCollectionClient)
+ {
+ return -1;
}
-
- return 0;
+
+ if(mLevel != level)
+ {
+ mLevel = level;
+ invalidateFilter();
+ }
+ // 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);
}
// -----------------------------------------------------------------------------
@@ -142,6 +185,15 @@
processSorting();
}
}
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::getSorting
+// -----------------------------------------------------------------------------
+//
+void VideoSortFilterProxyModel::getSorting(int &sortingRole, Qt::SortOrder &order)
+{
+ sortingRole = mWantedSortRole;
+ order = mWantedSortOrder;
+}
// -----------------------------------------------------------------------------
// VideoSortFilterProxyModel::deleteItems
@@ -160,7 +212,7 @@
if(mModel->removeRows(mappedList))
{
// Start fetching thumbnails at start of the model.
- VideoThumbnailData::instance().startBackgroundFetching(0);
+ VideoThumbnailData::instance().startBackgroundFetching(0, 0);
return 0;
}
@@ -172,13 +224,22 @@
// VideoSortFilterProxyModel::openItem
// -----------------------------------------------------------------------------
//
-int VideoSortFilterProxyModel::openItem(const QModelIndex &index)
+int VideoSortFilterProxyModel::openItem(TMPXItemId mediaId)
{
- // getMediaIdAtIndex maps index to source
- TMPXItemId mpxId1 = getMediaIdAtIndex(index);
- if(mpxId1 != TMPXItemId::InvalidId() && mCollectionClient)
+ if(mediaId != TMPXItemId::InvalidId() && mCollectionClient)
{
- return mCollectionClient->openVideo(mpxId1);
+ mModel->setAlbumInUse(TMPXItemId::InvalidId());
+
+ if(mCollectionClient->openItem(mediaId) == 0)
+ {
+ if(mediaId.iId2 != KVcxMvcMediaTypeVideo)
+ {
+ mLevel = VideoCollectionCommon::ELevelAlbum;
+ mModel->setAlbumInUse(mediaId);
+ invalidateFilter();
+ }
+ return 0;
+ }
}
return -1;
}
@@ -189,10 +250,21 @@
//
int VideoSortFilterProxyModel::back()
{
- if(mCollectionClient)
+
+ if(mCollectionClient && mCollectionClient->back() == 0)
{
- return mCollectionClient->back();
+
+ if(mLevel == VideoCollectionCommon::ELevelAlbum)
+ {
+ mLevel = VideoCollectionCommon::ELevelCategory;
+ }
+ else
+ {
+ mLevel = VideoCollectionCommon::ELevelVideos;
+ }
+ return 0;
}
+
return -1;
}
@@ -209,10 +281,8 @@
{
if(mCollectionClient->getVideoDetails(mpxId1) == 0)
{
- // because full details comes from model, map index gotten from UI
- // into sourcemodel index as well for consistency's sake
- QModelIndex sourceIndex = mapToSource(index);
- emit shortDetailsReady(sourceIndex.row());
+
+ emit shortDetailsReady(mpxId1);
return 0;
}
}
@@ -249,18 +319,67 @@
}
// Start fetching thumbnails at start of the model.
- VideoThumbnailData::instance().startBackgroundFetching(0);
+ VideoThumbnailData::instance().startBackgroundFetching(0, 0);
}
// -----------------------------------------------------------------------------
// VideoSortFilterProxyModel::lessThan
// -----------------------------------------------------------------------------
//
-bool VideoSortFilterProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
+bool VideoSortFilterProxyModel::lessThan(const QModelIndex &left,
+ const QModelIndex &right) const
{
- // do comparisation based on the role, if role is different than Qt::DisplayRole,
- // VideoCollectionCommon::KeySizeValue or VideoCollectionCommon::KeyDateValue, method does not sort at all
+ if (!mModel)
+ {
+ return false;
+ }
+ TMPXItemId leftId = mModel->mediaIdAtIndex(left.row());
+ TMPXItemId rightId = mModel->mediaIdAtIndex(right.row());
+
+ // 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:
+ // Qt::DisplayRole,
+ // VideoCollectionCommon::KeySizeValue,
+ // 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);
@@ -297,19 +416,67 @@
//
bool VideoSortFilterProxyModel::filterAcceptsRow (int source_row, const QModelIndex &source_parent) const
{
+ Q_UNUSED(source_parent);
+
if(!sourceModel())
return false;
- QModelIndex index = sourceModel()->index(source_row, 0, source_parent);
- if(index.isValid())
+ if(source_row < 0 || source_row >= sourceModel()->rowCount())
+ {
+ return false;
+ }
+ TMPXItemId id = mModel->mediaIdAtIndex(source_row);
+ if(id == TMPXItemId::InvalidId())
+ {
+ return false;
+ }
+
+ if (mType == VideoCollectionWrapper::EAllVideos)
+ {
+ if(id.iId2 == KVcxMvcMediaTypeVideo)
+ {
+ return true;
+ }
+ }
+ else if(mType == VideoCollectionWrapper::ECollections)
+ {
+
+ if(mLevel == VideoCollectionCommon::ELevelCategory && id.iId2 != KVcxMvcMediaTypeVideo)
+ {
+ return true;
+ }
+ }
+ else if (mType == VideoCollectionWrapper::ECollectionContent)
{
- QVariant data = sourceModel()->data(index, VideoCollectionCommon::KeyStatus);
- if(data.isValid() && data.toInt() == VideoCollectionCommon::StatusDeleted)
+ // if item belongs to the open album, accept it
+ if (mModel->belongsToAlbum(id))
+ {
+ return true;
+ }
+ }
+ else if(mType == VideoCollectionWrapper::EGeneric)
+ {
+
+ if(mLevel == VideoCollectionCommon::ELevelVideos && id.iId2 == KVcxMvcMediaTypeVideo)
{
- return false;
+ // 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;
+ }
+
}
- return true;
+ else if(mLevel == VideoCollectionCommon::ELevelCategory && id.iId2 == KVcxMvcMediaTypeAlbum)
+ {
+ // we do not filter albums yet
+ return true;
+ }
}
+
return false;
}
@@ -317,7 +484,7 @@
// VideoSortFilterProxyModel::getMediaIdAtIndex()
// -----------------------------------------------------------------------------
//
-TMPXItemId VideoSortFilterProxyModel::getMediaIdAtIndex(const QModelIndex &index)
+TMPXItemId VideoSortFilterProxyModel::getMediaIdAtIndex(const QModelIndex &index) const
{
QModelIndex sourceIndex = mapToSource(index);
TMPXItemId mpxId = TMPXItemId::InvalidId();
@@ -329,6 +496,21 @@
}
// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::indexOfId()
+// -----------------------------------------------------------------------------
+//
+QModelIndex VideoSortFilterProxyModel::indexOfId(TMPXItemId id)
+{
+ QModelIndex sourceIndex;
+ if(!mModel || id == TMPXItemId::InvalidId())
+ {
+ return sourceIndex;
+ }
+ sourceIndex = mModel->indexOfId(id);
+ return mapFromSource(sourceIndex);
+}
+
+// -----------------------------------------------------------------------------
// VideoSortFilterProxyModel::getMediaFilePathForId()
// -----------------------------------------------------------------------------
//
@@ -343,16 +525,168 @@
}
// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::addNewCollection()
+// VideoSortFilterProxyModel::addNewAlbum()
+// -----------------------------------------------------------------------------
+//
+TMPXItemId VideoSortFilterProxyModel::addNewAlbum(const QString &title)
+{
+ TMPXItemId id = TMPXItemId::InvalidId();
+
+ if (mCollectionClient)
+ {
+ id = mCollectionClient->addNewAlbum(title);
+ }
+
+ return id;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::removeAlbums()
+// -----------------------------------------------------------------------------
+//
+int VideoSortFilterProxyModel::removeAlbums(const QModelIndexList &indexList)
+{
+ int err(-1);
+
+ if (mCollectionClient)
+ {
+ TMPXItemId mpxId;
+ QList<TMPXItemId> 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()
// -----------------------------------------------------------------------------
//
-int VideoSortFilterProxyModel::addNewCollection(QString name, QString thumbnail, QList<TMPXItemId> mediaIds)
+QString VideoSortFilterProxyModel::resolveAlbumName(
+ const QString& albumName) const
+{
+ 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(
+ VideoCollectionWrapper::ECollections);
+ if(!collectionModel || !mModel)
+ {
+ return resolvedName;
+ }
+
+ int i(0);
+ QModelIndex proxyIndex = collectionModel->index(i, 0);
+ QSet<QString> names;
+ QVariant data;
+ // create set of existing names
+ while (proxyIndex.isValid())
+ {
+ data = mModel->data(collectionModel->mapToSource(proxyIndex), Qt::DisplayRole);
+ if (data.isValid())
+ {
+ QStringList stringList = data.toStringList();
+ names.insert(stringList.at(0));
+ }
+ 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<TMPXItemId> &mediaIds)
{
- int error = -1;
- if(mCollectionClient) {
- error = mCollectionClient->addNewCollection(name, thumbnail, mediaIds);
+ int err(-1);
+
+ if (mCollectionClient)
+ {
+ // add items in album
+ err = mCollectionClient->addItemsInAlbum(albumId, mediaIds);
}
- return error;
+
+ return err;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::getOpenItem()
+// -----------------------------------------------------------------------------
+//
+TMPXItemId VideoSortFilterProxyModel::getOpenItem() const
+{
+ TMPXItemId itemId = TMPXItemId::InvalidId();
+
+ if(mModel && mCollectionClient)
+ {
+ if(mType == VideoCollectionWrapper::EAllVideos)
+ {
+ itemId.iId1 = KVcxMvcCategoryIdAll;
+ itemId.iId2 = KVcxMvcMediaTypeCategory;
+ }
+ else if(mType == VideoCollectionWrapper::ECollectionContent)
+ {
+ itemId = mModel->albumInUse();
+ }
+ }
+
+ return itemId;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::setGenericIdFilter()
+// -----------------------------------------------------------------------------
+//
+void VideoSortFilterProxyModel::setGenericIdFilter(TMPXItemId itemId, bool filterValue)
+{
+ if(mType == VideoCollectionWrapper::EGeneric)
+ {
+ mGenericFilterId = itemId;
+ mGenericFilterValue = filterValue;
+ invalidateFilter();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::albumChangedSlot()
+// -----------------------------------------------------------------------------
+//
+void VideoSortFilterProxyModel::albumChangedSlot()
+{
+ // ignore if not collection content model
+ if (mType == VideoCollectionWrapper::ECollectionContent)
+ {
+ invalidateFilter();
+ }
}
// end of file
--- a/videocollection/videocollectionwrapper/src/videothumbnaildata.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/src/videothumbnaildata.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -55,15 +55,6 @@
}
// -----------------------------------------------------------------------------
-// VideoThumbnailData::startFetchingThumbnail()
-// -----------------------------------------------------------------------------
-//
-int VideoThumbnailData::startFetchingThumbnail(int mediaId, int priority)
-{
- return d_ptr->startFetchingThumbnail(mediaId, priority);
-}
-
-// -----------------------------------------------------------------------------
// VideoThumbnailData::removeThumbnail()
// -----------------------------------------------------------------------------
//
@@ -85,9 +76,9 @@
// VideoThumbnailData::startBackgroundFetching()
// -----------------------------------------------------------------------------
//
-void VideoThumbnailData::startBackgroundFetching(int fetchIndex)
+void VideoThumbnailData::startBackgroundFetching(VideoSortFilterProxyModel *model, int fetchIndex)
{
- d_ptr->startBackgroundFetching(fetchIndex);
+ d_ptr->startBackgroundFetching(model, fetchIndex);
}
// -----------------------------------------------------------------------------
@@ -100,6 +91,15 @@
}
// -----------------------------------------------------------------------------
+// VideoThumbnailData::enableThumbnailCreation()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailData::enableThumbnailCreation(bool enable)
+{
+ d_ptr->enableThumbnailCreation(enable);
+}
+
+// -----------------------------------------------------------------------------
// VideoThumbnailData::freeThumbnailData()
// -----------------------------------------------------------------------------
//
--- a/videocollection/videocollectionwrapper/src/videothumbnaildata_p.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/src/videothumbnaildata_p.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -16,15 +16,16 @@
*/
// INCLUDE FILES
-#include <QApplication>
-#include <QPixmap>
-#include <QTimer>
+#include <qapplication.h>
+#include <qpixmap.h>
+#include <qtimer.h>
#include <mpxmediageneraldefs.h>
-#include <thumbnailmanager_qt.h>
+#include <vcxmyvideosdefs.h>
#include "videothumbnaildata_p.h"
#include "videocollectionwrapper.h"
#include "videosortfilterproxymodel.h"
+#include "videothumbnailfetcher.h"
// Maximum thumbnails kept in memory.
const int THUMBNAIL_CACHE_SIZE = 60;
@@ -32,8 +33,6 @@
const int THUMBNAIL_BACKGROUND_FETCH_AMOUNT = 20;
// Milliseconds for the background fetch timer.
const int THUMBNAIL_BACKGROUND_TIMEOUT = 100;
-// Maximum simultaneous thumbnail fetches.
-const int THUMBNAIL_MAX_SIMULTANEOUS_FETCHES = THUMBNAIL_BACKGROUND_FETCH_AMOUNT * 10;
// Milliseconds while thumbnail ready events are gathered before they
// are signaled.
const int THUMBNAIL_READY_SIGNAL_TIMEOUT = 50;
@@ -58,11 +57,10 @@
// -----------------------------------------------------------------------------
//
VideoThumbnailDataPrivate::VideoThumbnailDataPrivate() :
- mThumbnailManager(0),
+ mThumbnailFetcher(0),
mDefaultTnVideo(0),
mDefaultTnCategory(0),
- mCollectionWrapper(VideoCollectionWrapper::instance()),
- mModel(0),
+ mCurrentModel(0),
mCurrentFetchIndex(0),
mCurrentBackgroundFetchCount(0),
mBgFetchTimer(0),
@@ -90,23 +88,9 @@
{
mThumbnailData.setMaxCost(THUMBNAIL_CACHE_SIZE);
- if(!mCollectionWrapper)
- {
- return -1;
- }
-
- if(!mThumbnailManager)
+ if(!mThumbnailFetcher)
{
- mThumbnailManager = new ThumbnailManager();
- mThumbnailManager->setThumbnailSize( ThumbnailManager::ThumbnailMedium );
- mThumbnailManager->setQualityPreference( ThumbnailManager::OptimizeForPerformance );
- }
-
- mModel = mCollectionWrapper->getModel();
- if(!mModel)
- {
- cleanup();
- return -1;
+ mThumbnailFetcher = new VideoThumbnailFetcher();
}
if(!mBgFetchTimer)
@@ -134,14 +118,11 @@
//
void VideoThumbnailDataPrivate::cleanup()
{
- if(mCollectionWrapper)
- {
- mCollectionWrapper->decreaseReferenceCount();
- mCollectionWrapper = 0;
- }
-
disconnectSignals();
+ delete mThumbnailFetcher;
+ mThumbnailFetcher = 0;
+
freeThumbnailData();
if(mTbnReportTimer)
@@ -157,9 +138,6 @@
delete mBgFetchTimer;
mBgFetchTimer = 0;
}
-
- delete mThumbnailManager;
- mThumbnailManager = 0;
}
// -----------------------------------------------------------------------------
@@ -170,11 +148,17 @@
{
if(mSignalsConnected)
{
- disconnect(mThumbnailManager, SIGNAL(thumbnailReady( QPixmap , void * , int , int )),
- this, SLOT(thumbnailReadySlot( QPixmap , void * , int , int )));
- disconnect(mModel, SIGNAL(layoutChanged()), this, SLOT(layoutChangedSlot()));
- disconnect(mModel, SIGNAL(rowsInserted(const QModelIndex &, int, int)),
- this, SLOT(rowsInsertedSlot(const QModelIndex &, int, int)));
+ VideoSortFilterProxyModel *model =
+ VideoCollectionWrapper::instance().getModel(VideoCollectionWrapper::EAllVideos);
+ if(model)
+ {
+ disconnect(model->sourceModel(), SIGNAL(modelReady()), this, SLOT(modelChangedSlot()));
+ disconnect(model->sourceModel(), SIGNAL(modelChanged()), this, SLOT(modelChangedSlot()));
+ }
+ disconnect(mThumbnailFetcher, SIGNAL(thumbnailReady( QPixmap , void *, int )),
+ this, SLOT(thumbnailReadySlot( QPixmap , void *, int )));
+ disconnect(mThumbnailFetcher, SIGNAL(allThumbnailsFetched()),
+ this, SLOT(allThumbnailsFetchedSlot()));
disconnect(mBgFetchTimer, SIGNAL(timeout()), this, SLOT(doBackgroundFetching()));
disconnect(mTbnReportTimer, SIGNAL(timeout()), this, SLOT(reportThumbnailsReadySlot()));
}
@@ -189,11 +173,16 @@
{
if(!mSignalsConnected)
{
- if(!connect(mThumbnailManager, SIGNAL(thumbnailReady( QPixmap , void * , int , int )),
- this, SLOT(thumbnailReadySlot( QPixmap , void * , int , int ))) ||
- !connect(mModel, SIGNAL(layoutChanged()), this, SLOT(layoutChangedSlot())) ||
- !connect(mModel, SIGNAL(rowsInserted(const QModelIndex &, int, int)),
- this, SLOT(rowsInsertedSlot(const QModelIndex &, int, int))) ||
+ VideoSortFilterProxyModel *model =
+ VideoCollectionWrapper::instance().getModel(VideoCollectionWrapper::EAllVideos);
+ if(!model)
+ return -1;
+ if(!connect(mThumbnailFetcher, SIGNAL(thumbnailReady( QPixmap , void *, int )),
+ this, SLOT(thumbnailReadySlot( QPixmap , void *, int))) ||
+ !connect(mThumbnailFetcher, SIGNAL(allThumbnailsFetched()),
+ this, SLOT(allThumbnailsFetchedSlot())) ||
+ !connect(model->sourceModel(), SIGNAL(modelReady()), this, SLOT(modelChangedSlot())) ||
+ !connect(model->sourceModel(), SIGNAL(modelChanged()), this, SLOT(modelChangedSlot())) ||
!connect(mBgFetchTimer, SIGNAL(timeout()), this, SLOT(doBackgroundFetching())) ||
!connect(mTbnReportTimer, SIGNAL(timeout()), this, SLOT(reportThumbnailsReadySlot())))
{
@@ -231,7 +220,7 @@
//
int VideoThumbnailDataPrivate::startFetchingThumbnails(const QList<QModelIndex> &indexes, int priority)
{
- if(!mModel || !mThumbnailManager)
+ if(!mCurrentModel || !mThumbnailFetcher)
{
return -1;
}
@@ -240,21 +229,21 @@
return 0;
}
- // Now we fetch the requested thumbnails with higher priority than any of the current fetches.
- // TODO: Better would be to cancel the current fetches but it causes crashes in 10.1.
-
- int fetchCountBefore = mFetchList.count();
+ mThumbnailFetcher->pauseFetching();
+
+ int fetchCountBefore = mThumbnailFetcher->fetchCount();
- // Fetch the thumbnails in ascending priority.
-
- int startPriority = fetchCountBefore + priority + indexes.count();
-
+ // Fetch the thumbnails
for(int i = 0; i < indexes.count(); i++)
{
- startFetchingThumbnail(mModel->getMediaIdAtIndex(indexes[i]), startPriority-i);
+ startFetchingThumbnail(mCurrentModel->getMediaIdAtIndex(indexes[i]), priority--);
}
- return mFetchList.count() - fetchCountBefore;
+ int started = mThumbnailFetcher->fetchCount() - fetchCountBefore;
+
+ mThumbnailFetcher->continueFetching();
+
+ return started;
}
// -----------------------------------------------------------------------------
@@ -263,11 +252,7 @@
//
int VideoThumbnailDataPrivate::startFetchingThumbnail(TMPXItemId mediaId, int priority)
{
- if(!mModel || !mThumbnailManager)
- {
- return -1;
- }
- if(mFetchList.count() >= THUMBNAIL_MAX_SIMULTANEOUS_FETCHES)
+ if(!mCurrentModel || !mThumbnailFetcher)
{
return -1;
}
@@ -278,30 +263,19 @@
return 0;
}
- QString fileName = mModel->getMediaFilePathForId(mediaId);
-
+ QString fileName = mCurrentModel->getMediaFilePathForId(mediaId);
+
// object containing media id to be passed throught
// thumbnail generation process.
TMPXItemId *internal = new TMPXItemId(mediaId.iId1, mediaId.iId2);
- int tnId = -1;
- // mThumbnailManager signals into thumbnailReadySlot when thumbnail ready
+ // Thumbnail fetcher signals into thumbnailReadySlot when thumbnail ready
if(fileName.length() > 0)
{
- tnId = mThumbnailManager->getThumbnail(fileName, internal, priority);
+ mThumbnailFetcher->addFetch(fileName, internal, priority);
}
- if( tnId != -1 )
- {
- // add to fetching list to indicate we're fetching this tn.
- mFetchList.insert(tnId);
- }
- else
- {
- // tn getting starting failed for some reason
- delete internal;
- }
- return tnId;
+ return 0;
}
// -----------------------------------------------------------------------------
@@ -310,7 +284,7 @@
//
void VideoThumbnailDataPrivate::doBackgroundFetching()
{
- if(!mModel)
+ if(!mCurrentModel || !mThumbnailFetcher)
{
return;
}
@@ -320,7 +294,7 @@
return;
}
- int maxIndex = mModel->rowCount();
+ int maxIndex = mCurrentModel->rowCount();
if(maxIndex == 0)
{
return;
@@ -334,16 +308,16 @@
QList<QModelIndex> indexes;
- // Items before the current fetch index.
- int startIndex = mCurrentFetchIndex-currentDelta-fetchAmount;
- int endIndex = mCurrentFetchIndex-currentDelta;
+ // Items after the current fetch index.
+ int startIndex = mCurrentFetchIndex+currentDelta;
+ int endIndex = mCurrentFetchIndex+currentDelta+fetchAmount;
getModelIndexes(indexes, startIndex, endIndex);
- // Items after the current fetch index.
- startIndex = mCurrentFetchIndex+currentDelta;
- endIndex = mCurrentFetchIndex+currentDelta+fetchAmount;
+ // Items before the current fetch index.
+ startIndex = mCurrentFetchIndex-currentDelta-fetchAmount;
+ endIndex = mCurrentFetchIndex-currentDelta;
getModelIndexes(indexes, startIndex, endIndex);
-
+
mCurrentBackgroundFetchCount += THUMBNAIL_BACKGROUND_FETCH_AMOUNT;
int fetchesStarted = startFetchingThumbnails(indexes, BACKGROUND_FETCH_PRIORITY);
@@ -366,7 +340,7 @@
{
if(i >= 0)
{
- index = mModel->index(i, 0);
+ index = mCurrentModel->index(i, 0);
if(index.isValid())
{
indexes.append(index);
@@ -379,17 +353,8 @@
// VideoThumbnailDataPrivate::thumbnailReadySlot()
// -----------------------------------------------------------------------------
//
-void VideoThumbnailDataPrivate::thumbnailReadySlot(QPixmap tnData, void *internal , int id, int error)
+void VideoThumbnailDataPrivate::thumbnailReadySlot(QPixmap tnData, void *internal, int error)
{
- // Tn ready, either failed or not it must be removed from the fetch list.
- // It's not stored if it's not found from the list.
- if(!removeFromFetchList(id))
- {
- if(internal)
- delete internal;
- return;
- }
-
TMPXItemId mediaId(0, 0);
if(internal)
{
@@ -429,21 +394,21 @@
}
// -----------------------------------------------------------------------------
-// VideoThumbnailDataPrivate::layoutChangedSlot()
+// VideoThumbnailDataPrivate::allThumbnailsFetchedSlot()
// -----------------------------------------------------------------------------
//
-void VideoThumbnailDataPrivate::layoutChangedSlot()
+void VideoThumbnailDataPrivate::allThumbnailsFetchedSlot()
{
- startBackgroundFetching(mCurrentFetchIndex);
+ continueBackgroundFetch();
}
// -----------------------------------------------------------------------------
-// VideoThumbnailDataPrivate::rowsInsertedSlot()
+// VideoThumbnailDataPrivate::modelChangedSlot()
// -----------------------------------------------------------------------------
//
-void VideoThumbnailDataPrivate::rowsInsertedSlot(const QModelIndex & /* parent */, int /* start */, int /* end */)
+void VideoThumbnailDataPrivate::modelChangedSlot()
{
- startBackgroundFetching(mCurrentFetchIndex);
+ startBackgroundFetching(mCurrentModel, mCurrentFetchIndex);
}
// -----------------------------------------------------------------------------
@@ -453,7 +418,7 @@
const QIcon* VideoThumbnailDataPrivate::defaultThumbnail(TMPXItemId mediaId)
{
// Is thumbnail for a video or a category.
- if(mediaId.iId2 == 0)
+ if(mediaId.iId2 == KVcxMvcMediaTypeVideo)
{
if(!mDefaultTnVideo)
mDefaultTnVideo = new QIcon(":/icons/default_thumbnail_video.svg");
@@ -483,7 +448,17 @@
void VideoThumbnailDataPrivate::enableBackgroundFetching(bool enable)
{
mBackgroundFetchingEnabled = enable;
- startBackgroundFetching(0);
+ startBackgroundFetching(mCurrentModel, 0);
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataPrivate::enableThumbnailCreation()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailDataPrivate::enableThumbnailCreation(bool enable)
+{
+ if(mThumbnailFetcher)
+ mThumbnailFetcher->enableThumbnailCreation(enable);
}
// -----------------------------------------------------------------------------
@@ -499,8 +474,10 @@
if(mTbnReportTimer)
mTbnReportTimer->stop();
+ if(mThumbnailFetcher)
+ mThumbnailFetcher->cancelFetches();
+
// Clear data.
- mFetchList.clear();
mReadyThumbnailMediaIds.clear();
mThumbnailData.clear();
@@ -512,32 +489,20 @@
}
// -----------------------------------------------------------------------------
-// VideoThumbnailDataPrivate::removeFromFetchList()
-// -----------------------------------------------------------------------------
-//
-bool VideoThumbnailDataPrivate::removeFromFetchList(int tnId)
-{
- if(mFetchList.isEmpty())
- {
- return false;
- }
- bool removed = mFetchList.remove(tnId);
- if(mFetchList.isEmpty())
- {
- continueBackgroundFetch();
- }
- return removed;
-}
-
-// -----------------------------------------------------------------------------
// VideoThumbnailDataPrivate::startBackgroundFetching()
// -----------------------------------------------------------------------------
//
-void VideoThumbnailDataPrivate::startBackgroundFetching(int fetchIndex)
+void VideoThumbnailDataPrivate::startBackgroundFetching(VideoSortFilterProxyModel *model, int fetchIndex)
{
- if(!mBackgroundFetchingEnabled)
+ if(!mBackgroundFetchingEnabled || !mThumbnailFetcher)
return;
-
+
+ mThumbnailFetcher->cancelFetches();
+
+ // If model is null, we continue using the current one.
+ if(model)
+ mCurrentModel = model;
+
mCurrentFetchIndex = fetchIndex;
mCurrentBackgroundFetchCount = 0;
doBackgroundFetching();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/src/videothumbnailfetcher.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,268 @@
+/*
+* 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: VideoThumbnailFetcher class implementation
+*
+*/
+
+// INCLUDE FILES
+
+#include <qpixmap.h>
+#include <thumbnailmanager_qt.h>
+
+#include "videothumbnailfetcher.h"
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailFetcher::VideoThumbnailFetcher()
+// -----------------------------------------------------------------------------
+//
+VideoThumbnailFetcher::VideoThumbnailFetcher() :
+ mThumbnailManager(0),
+ mPaused(false),
+ mTbnCreationEnabled(true)
+{
+ mThumbnailManager = new ThumbnailManager();
+ mThumbnailManager->setThumbnailSize(ThumbnailManager::ThumbnailMedium);
+ mThumbnailManager->setQualityPreference(ThumbnailManager::OptimizeForPerformance);
+ mThumbnailManager->setMode(ThumbnailManager::CropToAspectRatio);
+
+ connect(mThumbnailManager, SIGNAL(thumbnailReady( QPixmap , void * , int , int )),
+ this, SLOT(thumbnailReadySlot( QPixmap , void * , int , int )));
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailFetcher::~VideoThumbnailFetcher()
+// -----------------------------------------------------------------------------
+//
+VideoThumbnailFetcher::~VideoThumbnailFetcher()
+{
+ cancelFetches();
+
+ disconnect(mThumbnailManager, SIGNAL(thumbnailReady( QPixmap , void * , int , int )),
+ this, SLOT(thumbnailReadySlot( QPixmap , void * , int , int )));
+
+ delete mThumbnailManager;
+ mThumbnailManager = 0;
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailFetcher::addFetch()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailFetcher::addFetch(const QString fileName, void *internal, int priority)
+{
+ ThumbnailFetchData *fetch = new ThumbnailFetchData;
+ fetch->mFileName = fileName;
+ fetch->mInternal = internal;
+ fetch->mPriority = priority;
+ mFetchList.append(fetch);
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailFetcher::continueFetching()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailFetcher::continueFetching()
+{
+ mPaused = false;
+
+ // First fetch all thumbnails that have been created already, next
+ // start thumbnail creation for one thumbnail at a time.
+ if(!mFetchList.isEmpty())
+ {
+ startThumbnailFetches();
+ }
+ else if(!mCreationList.isEmpty())
+ {
+ startThumbnailCreation();
+ }
+
+ // All thumbnails have been fetched, report it.
+ if(mFetchList.isEmpty() && mCreationList.isEmpty() && mStartedFetchList.isEmpty())
+ {
+ emit allThumbnailsFetched();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailFetcher::startThumbnailFetches()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailFetcher::startThumbnailFetches()
+{
+ if(!mThumbnailManager)
+ return;
+
+ // Only fetch those thumbnails that are already been created.
+ mThumbnailManager->setMode(ThumbnailManager::DoNotCreate);
+
+ // Push all from thumbnail manager.
+ while(!mFetchList.isEmpty())
+ {
+ ThumbnailFetchData *fetch = mFetchList.takeFirst();
+
+ int requestId = mThumbnailManager->getThumbnail(fetch->mFileName,
+ fetch->mInternal, fetch->mPriority);
+
+ if(requestId != -1)
+ {
+ // Request succeed, add to list of started fetches.
+ mStartedFetchList.insert(requestId, fetch);
+ }
+ else
+ {
+ // Request failed, free internal data.
+ delete fetch->mInternal;
+ delete fetch;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailFetcher::startThumbnailCreation()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailFetcher::startThumbnailCreation()
+{
+ if(!mThumbnailManager || !mTbnCreationEnabled)
+ return;
+
+ mThumbnailManager->setMode(ThumbnailManager::CropToAspectRatio);
+
+ // Do nothing if list is empty.
+ if(mCreationList.isEmpty())
+ return;
+
+ // Find fetch with highest priority.
+ int highestPriority = 0;
+ int indexWithHighestPriority = 0;
+
+ for(int i = 0; i < mCreationList.count(); i++)
+ {
+ if(mCreationList.at(i)->mPriority > highestPriority)
+ {
+ indexWithHighestPriority = i;
+ highestPriority = mCreationList.at(i)->mPriority;
+ }
+ }
+
+ ThumbnailFetchData *fetch = mCreationList.takeAt(indexWithHighestPriority);
+
+ // Do request to thumbnail manager.
+ int requestId = mThumbnailManager->getThumbnail(fetch->mFileName,
+ fetch->mInternal, fetch->mPriority);
+
+ // Request failed, free internal data.
+ if(requestId == -1)
+ {
+ delete fetch->mInternal;
+ delete fetch;
+ }
+ else
+ {
+ // Don't keep track of fetches when creating thumbnails, if
+ // it fails with -1 it would be only tried to create again.
+ delete fetch;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailFetcher::pauseFetching()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailFetcher::pauseFetching()
+{
+ mPaused = true;
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailFetcher::cancelFetches()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailFetcher::cancelFetches()
+{
+ // Clear list of started fetches, thumbnail manager has the internal
+ // pointer.
+ QList<int> keys = mStartedFetchList.keys();
+ for(int i = 0; i < keys.count(); i++ )
+ {
+ delete mStartedFetchList.take(keys[i]);
+ }
+
+ // Merge lists and free data.
+ mFetchList.append(mCreationList);
+ mCreationList.clear();
+ while(!mFetchList.isEmpty())
+ {
+ ThumbnailFetchData *fetch = mFetchList.takeFirst();
+ delete fetch->mInternal;
+ delete fetch;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailFetcher::fetchCount()
+// -----------------------------------------------------------------------------
+//
+int VideoThumbnailFetcher::fetchCount()
+{
+ return mFetchList.count() + mCreationList.count() + mStartedFetchList.count();
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailFetcher::enableThumbnailCreation()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailFetcher::enableThumbnailCreation(bool enable)
+{
+ mTbnCreationEnabled = enable;
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailFetcher::thumbnailReadySlot()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailFetcher::thumbnailReadySlot(QPixmap tnData, void *internal, int requestId, int error)
+{
+ // Thumbnail has not been generated yet, put it into creation list.
+ if(error == -1 && internal)
+ {
+ if(mStartedFetchList.contains(requestId))
+ {
+ ThumbnailFetchData *fetch = mStartedFetchList.take(requestId);
+ mCreationList.append(fetch);
+ }
+ else
+ {
+ // Fetch data was not found, meaning cancelFetches was called.
+ delete internal;
+ }
+ }
+ else
+ {
+ // Report that thumbnail was fetched.
+ emit thumbnailReady(tnData, internal, error);
+
+ if(mStartedFetchList.contains(requestId))
+ delete mStartedFetchList.take(requestId);
+ }
+
+ // Continue the fetching process.
+ if(!mPaused && mStartedFetchList.isEmpty())
+ continueFetching();
+}
+
+// End of file.
--- a/videocollection/videocollectionwrapper/tsrc/testvideocollectionclient/inc/testvideocollectionclient.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionclient/inc/testvideocollectionclient.h Thu Apr 01 23:22:15 2010 +0300
@@ -33,6 +33,7 @@
class VideoCollectionClient;
+class StubSignalReceiver;
class TestVideoCollectionClient : public QObject
{
@@ -73,18 +74,18 @@
void testInitializeUtilCreateFail();
/**
+ * initialization and collection utility creation fails
+ *
+ */
+ void testInitializeNullReceiverCreateFail();
+
+ /**
* succeeded initialization test
*
*/
void testInitializeSucceed();
/**
- * verifies connectCollectionSignalReceiver -call
- *
- */
- void testConnectCollectionSignalReceiver();
-
- /**
* verifies collectionLevel -call
*
*/
@@ -147,16 +148,16 @@
void testGetVideoDetails();
/**
- * Data for the testAddNewCollection test.
- */
- void testAddNewCollection_data();
-
- /**
* verifies addNewCollection -call.
*/
void testAddNewCollection();
/**
+ * verifies addItemsInAlbum
+ */
+ void testAddItemsInAlbum();
+
+ /**
* verifies back -call
*
*/
@@ -169,6 +170,11 @@
* testobject
*/
VideoCollectionClient* mTestObject;
+
+ /**
+ * stubbed signal receiver
+ */
+ StubSignalReceiver* mSignalReceiver;
};
--- a/videocollection/videocollectionwrapper/tsrc/testvideocollectionclient/src/testvideocollectionclient.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionclient/src/testvideocollectionclient.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -21,13 +21,14 @@
#include "testvideocollectionclient.h"
#include "videocollectioncommon.h"
-#include "stub/inc/videocollectionlistener.h"
+#include "stubcollectionsignalreceiver.h"
+#include "videocollectionlistener.h"
#define private public
#include "videocollectionclient.h"
#undef private
-#include "stub/inc/stubcollectionsignalclasses.h"
+
Q_DECLARE_METATYPE(QList<int>)
@@ -39,12 +40,19 @@
{
TestVideoCollectionClient tv;
- char *pass[3];
- pass[0] = argv[0];
- pass[1] = "-o";
- pass[2] = "c:\\data\\testvideocollectionclient.txt";
-
- int res = QTest::qExec(&tv, 3, pass);
+ 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\\testvideocollectionclient.txt";
+ res = QTest::qExec(&tv, 3, pass);
+ }
return res;
}
@@ -58,6 +66,7 @@
void TestVideoCollectionClient::init()
{
mTestObject = new VideoCollectionClient();
+ mSignalReceiver = new StubSignalReceiver();
}
// -----------------------------------------------------------------------------
@@ -78,7 +87,7 @@
{
MMPXCollectionUtility *tmpUtility = new MMPXCollectionUtility();
mTestObject->mCollectionUtility = tmpUtility;
- QVERIFY(mTestObject->initialize() == 0);
+ QVERIFY(mTestObject->initialize(mSignalReceiver) == 0);
QVERIFY(mTestObject->mCollectionUtility != 0);
QVERIFY(mTestObject->mCollectionListener != 0);
}
@@ -89,9 +98,9 @@
//
void TestVideoCollectionClient::testInitializeCollListenerExist()
{
- VideoCollectionListener *tmpListener = new VideoCollectionListener(*mTestObject);
+ VideoCollectionListener *tmpListener = new VideoCollectionListener(*mTestObject, *mSignalReceiver);
mTestObject->mCollectionListener = tmpListener;
- QVERIFY(mTestObject->initialize() == 0);
+ QVERIFY(mTestObject->initialize(mSignalReceiver) == 0);
QVERIFY(mTestObject->mCollectionUtility != 0);
QVERIFY(mTestObject->mCollectionListener != 0);
}
@@ -103,11 +112,22 @@
void TestVideoCollectionClient::testInitializeUtilCreateFail()
{
MMPXCollectionUtility::setNewLLeave(true);
- QVERIFY(mTestObject->initialize() < 0);
+ QVERIFY(mTestObject->initialize(mSignalReceiver) < 0);
QVERIFY(mTestObject->mCollectionUtility == 0);
QVERIFY(mTestObject->mCollectionListener == 0);
MMPXCollectionUtility::setNewLLeave(false);
}
+
+// -----------------------------------------------------------------------------
+// testInitializeNullReceiverCreateFail
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionClient::testInitializeNullReceiverCreateFail()
+{
+ QVERIFY(mTestObject->initialize(0) < 0);
+ QVERIFY(mTestObject->mCollectionUtility == 0);
+ QVERIFY(mTestObject->mCollectionListener == 0);
+}
// -----------------------------------------------------------------------------
// testInitializeCollUtilityExists
@@ -116,14 +136,14 @@
void TestVideoCollectionClient::testInitializeSucceed()
{
MMPXCollectionUtility::setNewLLeave(false);
- QVERIFY(mTestObject->initialize() == 0);
+ QVERIFY(mTestObject->initialize(mSignalReceiver) == 0);
// none exists
- QVERIFY(mTestObject->initialize() == 0);
+ QVERIFY(mTestObject->initialize(mSignalReceiver) == 0);
QVERIFY(mTestObject->mCollectionUtility != 0);
QVERIFY(mTestObject->mCollectionListener != 0);
// both items exists
- QVERIFY(mTestObject->initialize() == 0);
+ QVERIFY(mTestObject->initialize(mSignalReceiver) == 0);
QVERIFY(mTestObject->mCollectionUtility != 0);
QVERIFY(mTestObject->mCollectionListener != 0);
@@ -135,78 +155,7 @@
QVERIFY(MMPXCollectionUtility::getCloseCounter() == 1);
QVERIFY(listener == 0);
}
-
-// -----------------------------------------------------------------------------
-// testInitializeCollUtilityExists
-// -----------------------------------------------------------------------------
-//
-void TestVideoCollectionClient::testConnectCollectionSignalReceiver()
-{
- // no collection listener or signal receiver
- QVERIFY(mTestObject->connectCollectionSignalReceiver(0) == -1);
-
- // no collection listener
- StubSignalReceiver stubReceiver;
- QVERIFY(mTestObject->connectCollectionSignalReceiver(&stubReceiver) == -1);
-
- // collection listener exists, no signal receiver
- QVERIFY(mTestObject->initialize() == 0);
- QVERIFY(mTestObject->connectCollectionSignalReceiver(0) == -1);
-
- VideoCollectionListener *tmp = mTestObject->mCollectionListener;
-
- // no newVideoList signal
- StubListenerNoNewVideoList *noNewVideoList =
- new StubListenerNoNewVideoList(*mTestObject);
- mTestObject->mCollectionListener = noNewVideoList;
- QVERIFY(mTestObject->connectCollectionSignalReceiver(&stubReceiver) == -1);
- delete noNewVideoList;
-
- // no videoListAppended signal
- StubListenerNoVideoListAppended *noVideoListAppended =
- new StubListenerNoVideoListAppended(*mTestObject);
- mTestObject->mCollectionListener = noVideoListAppended;
- QVERIFY(mTestObject->connectCollectionSignalReceiver(&stubReceiver) == -1);
- delete noVideoListAppended;
-
- // no newVideoAvailable signal
- StubListenerNoNewVideoAvailable *noNewVideo =
- new StubListenerNoNewVideoAvailable(*mTestObject);
- mTestObject->mCollectionListener = noNewVideo;
- QVERIFY(mTestObject->connectCollectionSignalReceiver(&stubReceiver) == -1);
- delete noNewVideo;
-
- // no videoDeleted signal
- StubListenerNoVideoDeleted *noVideoDeleted =
- new StubListenerNoVideoDeleted(*mTestObject);
- mTestObject->mCollectionListener = noVideoDeleted;
- QVERIFY(mTestObject->connectCollectionSignalReceiver(&stubReceiver) == -1);
- delete noVideoDeleted;
-
- // no videoDeleteCompleted signal
- StubListenerNoVideoDeleteCompleted *noVideoDelCompl =
- new StubListenerNoVideoDeleteCompleted(*mTestObject);
- mTestObject->mCollectionListener = noVideoDelCompl;
- QVERIFY(mTestObject->connectCollectionSignalReceiver(&stubReceiver) == -1);
- delete noVideoDelCompl;
-
- // no videoDetailsCompleted signal
- StubListenerNoVideoDetailsCompleted *noVideoDetails =
- new StubListenerNoVideoDetailsCompleted(*mTestObject);
- mTestObject->mCollectionListener = noVideoDetails;
- QVERIFY(mTestObject->connectCollectionSignalReceiver(&stubReceiver) == -1);
- delete noVideoDetails;
-
- // all signals exists
- StubListenerAllSignals *allSignals =
- new StubListenerAllSignals(*mTestObject);
- mTestObject->mCollectionListener = allSignals;
- QVERIFY(mTestObject->connectCollectionSignalReceiver(&stubReceiver) == 0);
- delete allSignals;
-
- mTestObject->mCollectionListener = tmp;
-}
-
+
// -----------------------------------------------------------------------------
// testInitializeCollUtilityExists
// -----------------------------------------------------------------------------
@@ -216,14 +165,14 @@
// no collection utility
QVERIFY(mTestObject->getCollectionLevel() == -1);
- QVERIFY(mTestObject->initialize() == 0);
+ QVERIFY(mTestObject->initialize(mSignalReceiver) == 0);
// path level not setted
QVERIFY(mTestObject->getCollectionLevel() == -1);
// succeeds
- mTestObject->mCollectionPathLevel = VideoCollectionClient::ELevelCategory;
- QVERIFY(mTestObject->getCollectionLevel() == VideoCollectionClient::ELevelCategory);
+ mTestObject->mCollectionPathLevel = VideoCollectionCommon::ELevelCategory;
+ QVERIFY(mTestObject->getCollectionLevel() == VideoCollectionCommon::ELevelCategory);
}
// -----------------------------------------------------------------------------
@@ -263,60 +212,59 @@
void TestVideoCollectionClient::testStartOpenCollection()
{
// no collection utility
- QVERIFY(mTestObject->startOpenCollection(VideoCollectionClient::ELevelVideos) == -1);
+ QVERIFY(mTestObject->startOpenCollection(VideoCollectionCommon::ELevelVideos) == -1);
- QVERIFY(mTestObject->startOpenCollection(VideoCollectionClient::ELevelCategory) == -1);
+ QVERIFY(mTestObject->startOpenCollection(VideoCollectionCommon::ELevelCategory) == -1);
- QVERIFY(mTestObject->initialize() == 0);
+ QVERIFY(mTestObject->initialize(mSignalReceiver) == 0);
// open status setted allready
mTestObject->setOpenStatus(VideoCollectionClient::ECollectionOpening);
- QVERIFY(mTestObject->startOpenCollection(VideoCollectionClient::ELevelVideos) == 0);
+ QVERIFY(mTestObject->startOpenCollection(VideoCollectionCommon::ELevelVideos) == 0);
mTestObject->setOpenStatus(VideoCollectionClient::ECollectionOpened);
- QVERIFY(mTestObject->startOpenCollection(VideoCollectionClient::ELevelVideos) == 0);
+ QVERIFY(mTestObject->startOpenCollection(VideoCollectionCommon::ELevelVideos) == 0);
mTestObject->setOpenStatus(VideoCollectionClient::ECollectionOpening);
- QVERIFY(mTestObject->startOpenCollection(VideoCollectionClient::ELevelCategory) == 0);
+ QVERIFY(mTestObject->startOpenCollection(VideoCollectionCommon::ELevelCategory) == 0);
mTestObject->setOpenStatus(VideoCollectionClient::ECollectionOpened);
- QVERIFY(mTestObject->startOpenCollection(VideoCollectionClient::ELevelCategory) == 0);
+ QVERIFY(mTestObject->startOpenCollection(VideoCollectionCommon::ELevelCategory) == 0);
// open status and level setted allready
mTestObject->setOpenStatus(VideoCollectionClient::ECollectionOpening);
- mTestObject->mCollectionPathLevel = VideoCollectionClient::ELevelVideos;
- QVERIFY(mTestObject->startOpenCollection(VideoCollectionClient::ELevelVideos) == 0);
+ mTestObject->mCollectionPathLevel = VideoCollectionCommon::ELevelVideos;
+ QVERIFY(mTestObject->startOpenCollection(VideoCollectionCommon::ELevelVideos) == 0);
mTestObject->setOpenStatus(VideoCollectionClient::ECollectionOpened);
- QVERIFY(mTestObject->startOpenCollection(VideoCollectionClient::ELevelVideos) == 0);
+ QVERIFY(mTestObject->startOpenCollection(VideoCollectionCommon::ELevelVideos) == 0);
- mTestObject->mCollectionPathLevel = VideoCollectionClient::ELevelCategory;
+ mTestObject->mCollectionPathLevel = VideoCollectionCommon::ELevelCategory;
mTestObject->setOpenStatus(VideoCollectionClient::ECollectionOpening);
- QVERIFY(mTestObject->startOpenCollection(VideoCollectionClient::ELevelCategory) == 0);
+ QVERIFY(mTestObject->startOpenCollection(VideoCollectionCommon::ELevelCategory) == 0);
mTestObject->setOpenStatus(VideoCollectionClient::ECollectionOpened);
- QVERIFY(mTestObject->startOpenCollection(VideoCollectionClient::ELevelCategory) == 0);
+ QVERIFY(mTestObject->startOpenCollection(VideoCollectionCommon::ELevelCategory) == 0);
- mTestObject->setOpenStatus(VideoCollectionClient::ECollectionNotOpen);
+ mTestObject->setOpenStatus(VideoCollectionClient::ECollectionNotOpen);
+
// startOpenCollectionL -leaves
MMPXCollection::setOpenLPathLeave(true);
- QVERIFY(mTestObject->startOpenCollection(VideoCollectionClient::ELevelVideos) < 0);
+ QVERIFY(mTestObject->startOpenCollection(VideoCollectionCommon::ELevelVideos) < 0);
- QVERIFY(mTestObject->startOpenCollection(VideoCollectionClient::ELevelCategory) < 0);
+ QVERIFY(mTestObject->startOpenCollection(VideoCollectionCommon::ELevelCategory) < 0);
MMPXCollection::setOpenLPathLeave(false);
- QVERIFY(mTestObject->startOpenCollection(VideoCollectionClient::ELevelVideos) == 0);
+ QVERIFY(mTestObject->startOpenCollection(VideoCollectionCommon::ELevelVideos) == 0);
QVERIFY(mTestObject->getOpenStatus() == VideoCollectionClient::ECollectionOpening);
- int id = 0;
- int type = 0;
- mTestObject->getCategoryIds(id, type);
- QVERIFY(id == KVcxMvcCategoryIdAll);
- QVERIFY(type == 1);
+ TMPXItemId categoryId;
+ mTestObject->getCategoryId(categoryId);
+ QVERIFY(categoryId.iId1 == KVcxMvcCategoryIdAll);
+ QVERIFY(categoryId.iId2 == 1);
mTestObject->setOpenStatus(VideoCollectionClient::ECollectionOpened);
- QVERIFY(mTestObject->startOpenCollection(VideoCollectionClient::ELevelCategory) == 0);
+ QVERIFY(mTestObject->startOpenCollection(VideoCollectionCommon::ELevelCategory) == 0);
QVERIFY(mTestObject->getOpenStatus() == VideoCollectionClient::ECollectionOpening);
- mTestObject->getCategoryIds(id, type);
- QVERIFY(id == 0);
- QVERIFY(type == 9);
+ mTestObject->getCategoryId(categoryId);
+ QVERIFY(categoryId == TMPXItemId::InvalidId());
mTestObject->setOpenStatus(VideoCollectionClient::ECollectionOpened);
- QVERIFY(mTestObject->startOpenCollection(VideoCollectionClient::ELevelVideos) == 0);
+ QVERIFY(mTestObject->startOpenCollection(VideoCollectionCommon::ELevelVideos) == 0);
QVERIFY(mTestObject->getOpenStatus() == VideoCollectionClient::ECollectionOpening);
}
@@ -333,7 +281,7 @@
QVERIFY(mTestObject->startOpenCurrentState() == -1);
// collection not opened
- QVERIFY(mTestObject->initialize() == 0);
+ QVERIFY(mTestObject->initialize(mSignalReceiver) == 0);
QVERIFY(mTestObject->startOpenCurrentState() == -1);
// OpenL -leaves
@@ -358,7 +306,7 @@
QList<TMPXItemId> ids;
QVERIFY(mTestObject->deleteVideos(&ids) == -1);
- QVERIFY(mTestObject->initialize() == 0);
+ QVERIFY(mTestObject->initialize(mSignalReceiver) == 0);
// empty list
QVERIFY(mTestObject->deleteVideos(&ids) < 0);
@@ -387,19 +335,19 @@
{
TMPXItemId id(0,0);
// no collection utility
- QVERIFY(mTestObject->openVideo(id) == -1);
+ QVERIFY(mTestObject->openItem(id) == -1);
// collection exists
- QVERIFY(mTestObject->initialize() == 0);
+ QVERIFY(mTestObject->initialize(mSignalReceiver) == 0);
MMPXCollection::setOpenLPathLeave(true);
- QVERIFY(mTestObject->openVideo(id)< 0);
+ QVERIFY(mTestObject->openItem(id)< 0);
MMPXCollection::setOpenLPathLeave(false);
- mTestObject->mCollectionPathLevel = VideoCollectionClient::ELevelCategory;
- QVERIFY(mTestObject->openVideo(id) == 0);
+ mTestObject->mCollectionPathLevel = VideoCollectionCommon::ELevelCategory;
+ QVERIFY(mTestObject->openItem(id) == 0);
}
@@ -411,16 +359,21 @@
{
TMPXItemId id(0,0);
// no collection utility
- QVERIFY(mTestObject->openVideo(id) == -1);
+ QVERIFY(mTestObject->openItem(id) == -1);
- // collection exists
- QVERIFY(mTestObject->initialize() == 0);
- mTestObject->mCollectionPathLevel = VideoCollectionClient::ELevelVideos;
+ // collection exists: media type KVcxMvcMediaTypeVideo
+ QVERIFY(mTestObject->initialize(mSignalReceiver) == 0);
MMPXCollection::setOpenLPathLeave(true);
- QVERIFY(mTestObject->openVideo(id)< 0);
- MMPXCollection::setOpenLPathLeave(false);
+ QVERIFY(mTestObject->openItem(id)< 0);
+ MMPXCollection::setOpenLPathLeave(false);
+ QVERIFY(mTestObject->openItem(id) == 0);
- QVERIFY(mTestObject->openVideo(id) == 0);
+ // collection exists: media type != KVcxMvcMediaTypeVideo
+ id.iId2 = 2;
+ MMPXCollection::setOpenLPathLeave(true);
+ QVERIFY(mTestObject->openItem(id)< 0);
+ MMPXCollection::setOpenLPathLeave(false);
+ QVERIFY(mTestObject->openItem(id) == 0);
}
// -----------------------------------------------------------------------------
@@ -434,7 +387,7 @@
QVERIFY(mTestObject->fetchMpxMediaByMpxId(id) == -1);
// collection exists
- QVERIFY(mTestObject->initialize() == 0);
+ QVERIFY(mTestObject->initialize(mSignalReceiver) == 0);
MMPXCollection::setCommandLLeave(true);
QVERIFY(mTestObject->fetchMpxMediaByMpxId(id) < 0);
@@ -455,7 +408,7 @@
QVERIFY(mTestObject->getVideoDetails(id) == -1);
// collection exists
- QVERIFY(mTestObject->initialize() == 0);
+ QVERIFY(mTestObject->initialize(mSignalReceiver) == 0);
MMPXCollection::setCommandLLeave(true);
QVERIFY(mTestObject->getVideoDetails(id) < 0);
@@ -465,63 +418,6 @@
}
-// -----------------------------------------------------------------------------
-// testAddNewCollection_data
-// -----------------------------------------------------------------------------
-//
-void TestVideoCollectionClient::testAddNewCollection_data()
-{
- QTest::addColumn<QString>("name");
- QTest::addColumn<QString>("thumb");
- QTest::addColumn<QList<TMPXItemId> >("ids");
-
-
-
- QList<TMPXItemId> testIds;
- testIds.append(TMPXItemId(5,0));
- testIds.append(TMPXItemId(9,0));
-
- QTest::newRow("All params empty")
- << QString()
- << QString()
- << QList<TMPXItemId>();
-
- QTest::newRow("Only name")
- << QString("testname")
- << QString()
- << QList<TMPXItemId>();
-
- QTest::newRow("Only thumb")
- << QString()
- << QString("testthumb")
- << QList<TMPXItemId>();
-
- QTest::newRow("Name and thumb")
- << QString("testname")
- << QString("testthumb")
- << QList<TMPXItemId>();
-
- QTest::newRow("Only ids")
- << QString()
- << QString()
- << testIds;
-
- QTest::newRow("Name and ids")
- << QString("testname")
- << QString()
- << testIds;
-
- QTest::newRow("Thumb and ids")
- << QString()
- << QString("testthumb")
- << testIds;
-
- QTest::newRow("All params")
- << QString("testname")
- << QString("testthumb")
- << testIds;
-
-}
// -----------------------------------------------------------------------------
// testAddNewCollection
@@ -529,18 +425,77 @@
//
void TestVideoCollectionClient::testAddNewCollection()
{
-
- QFETCH(QString, name);
- QFETCH(QString, thumb);
- QFETCH(QList<TMPXItemId>, ids);
+ QString name("");
+ // no collection utility
+ TMPXItemId id = TMPXItemId(1,1);
+ id = mTestObject->addNewAlbum(name);
+ QVERIFY(id == TMPXItemId::InvalidId());
+ id = TMPXItemId(1,1);
+
+ // empty title
+ mTestObject->initialize(mSignalReceiver);
+ id = mTestObject->addNewAlbum(name);
+ QVERIFY(id == TMPXItemId::InvalidId());
+ id = TMPXItemId(1,1);
+ name = "TestAlbum";
+
+ // cmd not supported
+ CMPXMedia::mIsSupported = false;
+ id = mTestObject->addNewAlbum(name);
+ QVERIFY(id == TMPXItemId::InvalidId());
+ CMPXMedia::mIsSupported = true;
+ id = TMPXItemId(1,1);
+
+ // id getting leaves
+ CMPXMedia::mValueTObjectLeaves = true;
+ id = mTestObject->addNewAlbum(name);
+ QVERIFY(id == TMPXItemId::InvalidId());
+ CMPXMedia::mValueTObjectLeaves = false;
+ id = TMPXItemId(1,1);
- QCOMPARE(mTestObject->addNewCollection(name, thumb, ids), -1);
+ // succeed
+ CMPXMedia::mIdFromValueTObject = id;
+ id = TMPXItemId::InvalidId();
+ id = mTestObject->addNewAlbum(name);
+ QVERIFY(id == CMPXMedia::mIdFromValueTObject);
+}
+
+
+// -----------------------------------------------------------------------------
+// testAddItemsInAlbum
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionClient::testAddItemsInAlbum()
+{
+ TMPXItemId albumId = TMPXItemId(1,2);
+ QList<TMPXItemId> mediaIds;
- mTestObject->initialize();
+ // no collectionutility
+ QVERIFY(mTestObject->addItemsInAlbum(albumId, mediaIds) < 0);
- QCOMPARE(mTestObject->addNewCollection(name, thumb, ids), 0);
+ albumId = TMPXItemId::InvalidId();
+ mTestObject->initialize(mSignalReceiver);
+ // invalid album id
+ QVERIFY(mTestObject->addItemsInAlbum(albumId, mediaIds) < 0);
+
+ albumId = TMPXItemId(1,0);
+ // media type not album
+ QVERIFY(mTestObject->addItemsInAlbum(albumId, mediaIds) < 0);
- // TODO needs proper verification after the method has been fully implemented.
+ // command leaves
+ albumId = TMPXItemId(1,2);
+ MMPXCollection::setCommandLLeave(true);
+ QVERIFY(mTestObject->addItemsInAlbum(albumId, mediaIds) < 0);
+ MMPXCollection::setCommandLLeave(false);
+
+ // empty list
+ QVERIFY(mTestObject->addItemsInAlbum(albumId, mediaIds) == 0);
+
+ mediaIds.append(TMPXItemId(1,0));
+ mediaIds.append(TMPXItemId(2,0));
+ // list contains items
+ QVERIFY(mTestObject->addItemsInAlbum(albumId, mediaIds) == 0);
+
}
// -----------------------------------------------------------------------------
@@ -554,14 +509,14 @@
// not initialized
QVERIFY(mTestObject->back() == -1);
- QVERIFY(mTestObject->initialize() == 0);
- mTestObject->mCollectionPathLevel = VideoCollectionClient::ELevelVideos;
+ QVERIFY(mTestObject->initialize(mSignalReceiver) == 0);
+ mTestObject->mCollectionPathLevel = VideoCollectionCommon::ELevelVideos;
MMPXCollection::setBackLLeave(true);
QVERIFY(mTestObject->back()< 0);
MMPXCollection::setBackLLeave(false);
QVERIFY(mTestObject->back() == 0);
- mTestObject->mCollectionPathLevel = VideoCollectionClient::ELevelCategory;
+ mTestObject->mCollectionPathLevel = VideoCollectionCommon::ELevelCategory;
QVERIFY(mTestObject->back() == 0);
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionclient/stub/inc/mpxmedia.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,105 @@
+/*
+* 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 CMPXMedia for unit testing CVideocollectionClient
+*
+*/
+
+#ifndef CMPXMEDIA_H
+#define CMPXMEDIA_H
+
+// INCLUDES
+#include <s32strm.h>
+#include <mpxcmn.h>
+#include <mpxattribute.h>
+
+class CMPXMedia : public CBase
+{
+public:
+
+ /**
+ * Returns new object
+ */
+ static CMPXMedia* NewL() {return new CMPXMedia();};
+
+ /**
+ * Constructor.
+ */
+ CMPXMedia() {};
+
+ /**
+ * Destructor.
+ */
+ ~CMPXMedia() {};
+
+ public:
+
+ /**
+ * NOP
+ */
+ template<typename T>
+ inline void SetTObjectValueL(const TMPXAttribute& /*aAttribute*/, T /*aValue*/)
+ {
+ // NOP
+ }
+
+ /**
+ * NOP
+ */
+ template<typename C>
+ inline void SetCObjectValueL(const TMPXAttribute& /*aAttribute*/,C* /*aValue*/)
+ {
+ // NOP
+ }
+
+ /**
+ * NOP
+ */
+ template<typename T>
+ inline T ValueTObjectL(const TMPXAttribute& /*aAttribute*/) const
+ {
+ if(mValueTObjectLeaves)
+ {
+ User::Leave(KErrGeneral);
+ }
+ return mIdFromValueTObject;
+ }
+
+ /**
+ * NOP
+ */
+ inline void SetTextValueL(const TMPXAttribute& /*aAttribute*/,
+ const TDesC& /*aValue*/)
+ {
+ // NOP
+ }
+
+ /**
+ * NOP
+ */
+ inline bool IsSupported(const TMPXAttribute& /*aAttribute*/)
+ {
+ // NOP
+ return mIsSupported;
+ }
+
+ static bool mIsSupported;
+
+ static bool mValueTObjectLeaves;
+
+ static TMPXItemId mIdFromValueTObject;
+
+};
+
+
+#endif // CMPXMEDIA_H
--- a/videocollection/videocollectionwrapper/tsrc/testvideocollectionclient/stub/inc/stubcollectionsignalclasses.h Thu Apr 01 23:13:36 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,373 +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 classes for testing CVideoCollectionClient
-*
-*/
-
-#ifndef __STUBCOLLECTIONSIGNALRECEIVER_H
-#define __STUBCOLLECTIONSIGNALRECEIVER_H
-
-#include <QObject>
-// INCLUDES
-#include "videodatasignalreceiver.h"
-#include "stub/inc/videocollectionlistener.h"
-#include "videocollectionclient.h"
-
-/**
- * implementation class for slots to be connected
- */
-class StubSignalReceiver : public VideoDataSignalReceiver
-{
-
- Q_OBJECT
-
- Q_DISABLE_COPY(StubSignalReceiver)
-
-public:
-
- /**
- * contructor
- */
- StubSignalReceiver();
-
- /**
- * destructor
- */
- virtual ~StubSignalReceiver();
-
-public slots:
-
- /**
- * No implementation needed for these tests
- */
- void newVideoListSlot(CMPXMediaArray *array);
-
- /**
- * No implementation needed for these tests
- */
- void appendVideoListSlot( CMPXMediaArray* videoList );
-
- /**
- * No implementation needed for these tests
- */
- void newVideoAvailableSlot(CMPXMedia *media);
-
- /**
- * No implementation needed for these tests
- */
- void videoDeletedSlot(TMPXItemId id);
-
- /**
- * No implementation needed for these tests
- */
- void videoDeleteCompletedSlot(int, QList<TMPXItemId> *failedIds);
-
- /**
- * No implementation needed for these tests
- */
- void videoDetailsCompletedSlot(TMPXItemId id);
-
-};
-
-/**
- * Class for testing signal connections, all signals exists
- */
-class StubListenerAllSignals : public VideoCollectionListener
-{
- Q_OBJECT
-
-public:
- /**
- * contructor
- */
- StubListenerAllSignals(VideoCollectionClient &collectionClient);
-signals:
-
- /**
- * stub signal definition, not used
- */
- void newVideoList(CMPXMediaArray*);
-
- /**
- * stub signal definition, not used
- */
- void videoListAppended(CMPXMediaArray*);
-
- /**
- * stub signal definition, not used
- */
- void newVideoAvailable(CMPXMedia*);
-
- /**
- * stub signal definition, not used
- */
- void videoDeleted(TMPXItemId videoId);
-
- /**
- * stub signal definition, not used
- */
- void videoDeleteCompleted(int, QList<TMPXItemId>*);
-
- /**
- * stub signal definition, not used
- */
- void videoDetailsCompleted(TMPXItemId videoId);
-};
-
-
-/**
- * Class for testing signal connections, no expected newVideoList -signal
- */
-class StubListenerNoNewVideoList : public VideoCollectionListener
-{
- Q_OBJECT
-
-public:
- /**
- * contructor
- */
- StubListenerNoNewVideoList(VideoCollectionClient &collectionClient);
-signals:
-
- /**
- * stub signal definition, not used
- */
- void videoListAppended(CMPXMediaArray*);
-
- /**
- * stub signal definition, not used
- */
- void newVideoAvailable(CMPXMedia*);
-
- /**
- * stub signal definition, not used
- */
- void videoDeleted(TMPXItemId videoId);
-
- /**
- * stub signal definition, not used
- */
- void videoDeleteCompleted(int, QList<TMPXItemId>*);
-
- /**
- * stub signal definition, not used
- */
- void videoDetailsCompleted(TMPXItemId videoId);
-};
-
-/**
- * Class for testing signal connections, no expected videoListAppended -signal
- */
-class StubListenerNoVideoListAppended : public VideoCollectionListener
-{
- Q_OBJECT
-
-public:
- /**
- * contructor
- */
- StubListenerNoVideoListAppended(VideoCollectionClient &collectionClient);
-signals:
-
- /**
- * stub signal definition, not used
- */
- void newVideoList(CMPXMediaArray*);
-
- /**
- * stub signal definition, not used
- */
- void newVideoAvailable(CMPXMedia*);
-
- /**
- * stub signal definition, not used
- */
- void videoDeleted(TMPXItemId videoId);
-
- /**
- * stub signal definition, not used
- */
- void videoDeleteCompleted(int, QList<TMPXItemId>*);
-
- /**
- * stub signal definition, not used
- */
- void videoDetailsCompleted(TMPXItemId videoId);
-};
-
-
-
-/**
- * Class for testing signal connections, no expected newVideoAvailable -signal
- */
-class StubListenerNoNewVideoAvailable : public VideoCollectionListener
-{
- Q_OBJECT
-
-public:
- /**
- * contructor
- */
- StubListenerNoNewVideoAvailable(VideoCollectionClient &collectionClient);
-signals:
-
- /**
- * stub signal definition, not used
- */
- void newVideoList(CMPXMediaArray*);
-
- /**
- * stub signal definition, not used
- */
- void videoListAppended(CMPXMediaArray*);
-
- /**
- * stub signal definition, not used
- */
- void videoDeleted(TMPXItemId videoId);
-
- /**
- * stub signal definition, not used
- */
- void videoDeleteCompleted(int, QList<TMPXItemId>*);
-
- /**
- * stub signal definition, not used
- */
- void videoDetailsCompleted(TMPXItemId videoId);
-};
-
-/**
- * Class for testing signal connections, no expected videoDeleted -signal
- */
-class StubListenerNoVideoDeleted : public VideoCollectionListener
-{
- Q_OBJECT
-
-public:
- /**
- * contructor
- */
- StubListenerNoVideoDeleted(VideoCollectionClient &collectionClient);
-signals:
-
- /**
- * stub signal definition, not used
- */
- void newVideoList(CMPXMediaArray*);
-
- /**
- * stub signal definition, not used
- */
- void videoListAppended(CMPXMediaArray*);
-
- /**
- * stub signal definition, not used
- */
- void newVideoAvailable(CMPXMedia*);
-
- /**
- * stub signal definition, not used
- */
- void videoDeleteCompleted(int, QList<TMPXItemId>*);
-
- /**
- * stub signal definition, not used
- */
- void videoDetailsCompleted(TMPXItemId videoId);
-};
-
-/**
- * Class for testing signal connections, no expected videoDeleteCompleted -signal
- */
-class StubListenerNoVideoDeleteCompleted : public VideoCollectionListener
-{
- Q_OBJECT
-
-public:
- /**
- * contructor
- */
- StubListenerNoVideoDeleteCompleted(VideoCollectionClient &collectionClient);
-signals:
-
- /**
- * stub signal definition, not used
- */
- void newVideoList(CMPXMediaArray*);
-
- /**
- * stub signal definition, not used
- */
- void videoListAppended(CMPXMediaArray*);
-
- /**
- * stub signal definition, not used
- */
- void newVideoAvailable(CMPXMedia*);
-
- /**
- * stub signal definition, not used
- */
- void videoDeleted(TMPXItemId videoId);
-
- /**
- * stub signal definition, not used
- */
- void videoDetailsCompleted(TMPXItemId videoId);
-};
-
-/**
- * Class for testing signal connections, no expected videoDetailsCompleted -signal
- */
-class StubListenerNoVideoDetailsCompleted : public VideoCollectionListener
-{
- Q_OBJECT
-
-public:
- /**
- * contructor
- */
- StubListenerNoVideoDetailsCompleted(VideoCollectionClient &collectionClient);
-
-signals:
-
- /**
- * stub signal definition, not used
- */
- void newVideoList(CMPXMediaArray*);
-
- /**
- * stub signal definition, not used
- */
- void videoListAppended(CMPXMediaArray*);
-
- /**
- * stub signal definition, not used
- */
- void newVideoAvailable(CMPXMedia*);
-
- /**
- * stub signal definition, not used
- */
- void videoDeleted(TMPXItemId videoId);
-
- /**
- * stub signal definition, not used
- */
- void videoDeleteCompleted(int, QList<TMPXItemId>*);
-
-};
-
-#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionclient/stub/inc/stubcollectionsignalreceiver.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,126 @@
+/**
+* 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 classes for testing CVideoCollectionClient
+*
+*/
+
+#ifndef __STUBCOLLECTIONSIGNALRECEIVER_H
+#define __STUBCOLLECTIONSIGNALRECEIVER_H
+
+#include <QObject>
+// INCLUDES
+#include "videodatasignalreceiver.h"
+
+/**
+ * implementation class for slots to be connected
+ */
+class StubSignalReceiver : public VideoDataSignalReceiver
+{
+
+ Q_OBJECT
+
+ Q_DISABLE_COPY(StubSignalReceiver)
+
+public:
+
+ /**
+ * contructor
+ */
+ StubSignalReceiver(){};
+
+ /**
+ * destructor
+ */
+ virtual ~StubSignalReceiver(){};
+
+public slots:
+
+ /**
+ * No implementation needed for these tests
+ */
+ void newVideoListSlot(CMPXMediaArray *array)
+ {
+ Q_UNUSED(array);
+ }
+
+ /**
+ * No implementation needed for these tests
+ */
+ void appendVideoListSlot( CMPXMediaArray* array )
+ {
+ Q_UNUSED(array);
+ }
+
+ /**
+ * No implementation needed for these tests
+ */
+ void newVideoAvailableSlot(CMPXMedia *media)
+ {
+ Q_UNUSED(media);
+ }
+
+ /**
+ * No implementation needed for these tests
+ */
+ void itemDeletedSlot(TMPXItemId id)
+ {
+ Q_UNUSED(id);
+ }
+
+ /**
+ * No implementation needed for these tests
+ */
+ void albumRemoveFailureSlot(QList<TMPXItemId> *items)
+ {
+ Q_UNUSED(items);
+ }
+
+ /**
+ * No implementation needed for these tests
+ */
+ void videoDeletedSlot(TMPXItemId id)
+ {
+ Q_UNUSED(id);
+ }
+
+ /**
+ * No implementation needed for these tests
+ */
+ void videoDeleteCompletedSlot(int count, QList<TMPXItemId> *failedIds)
+ {
+ Q_UNUSED(count);
+ Q_UNUSED(failedIds);
+ }
+
+ /**
+ * No implementation needed for these tests
+ */
+ void videoDetailsCompletedSlot(TMPXItemId id)
+ {
+ Q_UNUSED(id);
+ }
+
+ /**
+ * No implementation needed for these tests
+ */
+ void albumListAvailableSlot(TMPXItemId albumId, CMPXMediaArray *albumItems)
+ {
+ Q_UNUSED(albumId);
+ Q_UNUSED(albumItems);
+ }
+
+};
+
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionclient/stub/inc/videocollectionlistener.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,101 @@
+/**
+* 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 videocollectionListener for testing CVideoCollectionClient
+*
+*/
+
+#ifndef __VIDEOCOLLECTIONLISTENER_H
+#define __VIDEOCOLLECTIONLISTENER_H
+
+// INCLUDES
+#include <QObject>
+#include <mpxcollectionobserver.h>
+#include <mpxmessage2.h>
+
+
+// FORWARD DECLARATIONS
+class VideoCollectionClient;
+class VideoDataSignalReceiver;
+
+// CLASS DECLARATION
+class VideoCollectionListener : public QObject, public MMPXCollectionObserver
+{
+ /**
+ * define to be able to use signals and slots
+ */
+ Q_OBJECT
+
+ /**
+ * disable copy-constructor and assignment operator
+ */
+ Q_DISABLE_COPY(VideoCollectionListener)
+
+public:
+
+ /**
+ * Constructor
+ */
+ VideoCollectionListener(VideoCollectionClient &collectionClient, VideoDataSignalReceiver &signalReceiver);
+
+ /**
+ * Destructor.
+ */
+ virtual ~VideoCollectionListener();
+
+ /**
+ *
+ */
+ void setRequestNewMediaArray(bool /*request*/)
+ {
+ // NOP at the moment
+ }
+
+ /**
+ * NOP.
+ */
+ void HandleCollectionMediaL(const CMPXMedia& /*aMedia*/,
+ TInt /*aError*/){};
+
+ /**
+ * NOP.
+ */
+ void HandleCollectionMessageL(const CMPXMessage& /*aMsg*/) {};
+
+ /**
+ * NOP.
+ */
+ void HandleCollectionMessage(CMPXMessage* /*aMsg*/, TInt /*aErr*/) {};
+
+ /**
+ * NOP.
+ */
+ void HandleOpenL(const CMPXMedia& /*aEntries*/,
+ TInt /*aIndex*/,TBool /*aComplete*/,TInt /*aError*/){};
+
+ /**
+ * NOP.
+ */
+ void HandleOpenL(const CMPXCollectionPlaylist& /*aPlaylist*/ ,TInt /*aError*/) {};
+
+ /**
+ * NOP.
+ */
+ void HandleCommandComplete(CMPXCommand* /*aCommandResult*/,
+ TInt /*aError*/) {};
+
+
+
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionclient/stub/src/mpxcollectionutility.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,278 @@
+/*
+* 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:
+*
+*/
+
+#include "stub/inc/mpxcollectionutility.h"
+#include "stub/inc/mpxcollectionpath.h"
+
+/**
+ * if true MMPXCollectionUtility::NewL leaves
+ */
+bool gLeaveNewL = false;
+
+/**
+ * if true, MMPXCollection::PathL leaves
+ */
+bool gLeavePathL = false;
+
+/**
+ * if true, MMPXCollection::OpenL(CMPXCollectionPath&) leaves
+ */
+bool gLeaveOpenPath = false;
+
+/**
+ * if true, MMPXCollection::OpenL(CMPXMedia&) leaves
+ */
+bool gLeaveOpenMedia = false;
+
+/**
+ * if true, MMPXCollection::OpenL() leaves
+ */
+bool gLeaveOpen = false;
+
+/**
+ * if true MPXCOllection::CommandL leaves
+ */
+bool gLeaveCommand = false;
+
+/**
+ * if true, MMPXCollection::BackL() leaves
+ */
+bool gLeaveBack = false;
+
+int gUtilCloseCounter = 0;
+
+// -----------------------------------------------------------------------------
+// setNewLLeave
+// -----------------------------------------------------------------------------
+//
+void MMPXCollectionUtility::setNewLLeave(bool leave)
+{
+ gLeaveNewL = leave;
+}
+
+// -----------------------------------------------------------------------------
+// resetCloseCounter
+// -----------------------------------------------------------------------------
+//
+void MMPXCollectionUtility::resetCloseCounter()
+{
+ gUtilCloseCounter = 0;
+}
+
+// -----------------------------------------------------------------------------
+// getCloseCounter
+// -----------------------------------------------------------------------------
+//
+int MMPXCollectionUtility::getCloseCounter()
+{
+ return gUtilCloseCounter;
+}
+
+// -----------------------------------------------------------------------------
+// setPathLLeave
+// -----------------------------------------------------------------------------
+//
+void MMPXCollection::setPathLLeave(bool leave)
+{
+ gLeavePathL = leave;
+}
+
+// -----------------------------------------------------------------------------
+// setOpenLPathLeave
+// -----------------------------------------------------------------------------
+//
+void MMPXCollection::setOpenLPathLeave(bool leave)
+{
+ gLeaveOpenPath = leave;
+}
+
+// -----------------------------------------------------------------------------
+// setOpenLMediaLeave
+// -----------------------------------------------------------------------------
+//
+void MMPXCollection::setOpenLMediaLeave(bool leave)
+{
+ gLeaveOpenMedia = leave;
+}
+
+// -----------------------------------------------------------------------------
+// setOpenLLeave
+// -----------------------------------------------------------------------------
+//
+void MMPXCollection::setOpenLLeave(bool leave)
+{
+ gLeaveOpen = leave;
+}
+
+// -----------------------------------------------------------------------------
+// setBackLLeave
+// -----------------------------------------------------------------------------
+//
+void MMPXCollection::setBackLLeave(bool leave)
+{
+ gLeaveBack = leave;
+}
+
+// -----------------------------------------------------------------------------
+// setCommandLLeave
+// -----------------------------------------------------------------------------
+//
+void MMPXCollection::setCommandLLeave(bool leave)
+{
+ gLeaveCommand = leave;
+}
+
+// -----------------------------------------------------------------------------
+// NewL
+// -----------------------------------------------------------------------------
+//
+MMPXCollectionUtility* MMPXCollectionUtility::NewL(MMPXCollectionObserver* /*aObs*/,
+ const TUid& /*aModeId*/ )
+{
+ if(gLeaveNewL)
+ {
+ User::Leave(KErrGeneral);
+ }
+ static MMPXCollectionUtility collectionUtilility;
+ return &collectionUtilility;
+
+}
+
+// -----------------------------------------------------------------------------
+// MMPXCollectionUtility
+// -----------------------------------------------------------------------------
+//
+MMPXCollectionUtility::MMPXCollectionUtility()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// ~MMPXCollectionUtility
+// -----------------------------------------------------------------------------
+//
+MMPXCollectionUtility::~MMPXCollectionUtility()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// Collection
+// -----------------------------------------------------------------------------
+//
+MMPXCollection& MMPXCollectionUtility::Collection()
+{
+ return mCollection;
+}
+
+// -----------------------------------------------------------------------------
+// Close
+// -----------------------------------------------------------------------------
+//
+void MMPXCollectionUtility::Close()
+{
+ gUtilCloseCounter++;
+}
+
+// -----------------------------------------------------------------------------
+// PathL
+// -----------------------------------------------------------------------------
+//
+CMPXCollectionPath* MMPXCollection::PathL()
+{
+ if(gLeavePathL)
+ {
+ User::Leave(KErrGeneral);
+ }
+
+ return new CMPXCollectionPath();
+}
+
+// -----------------------------------------------------------------------------
+// OpenL
+// -----------------------------------------------------------------------------
+//
+void MMPXCollection::OpenL(CMPXCollectionPath& /*path*/)
+{
+ if(gLeaveOpenPath)
+ {
+ User::Leave(KErrGeneral);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// OpenL
+// -----------------------------------------------------------------------------
+//
+void MMPXCollection::OpenL(CMPXMedia& /*media*/)
+{
+ if(gLeaveOpenMedia)
+ {
+ User::Leave(KErrGeneral);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// OpenL
+// -----------------------------------------------------------------------------
+//
+void MMPXCollection::OpenL(TInt /*aIndex*/)
+{
+ if(gLeaveOpenMedia)
+ {
+ User::Leave(KErrGeneral);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// OpenL
+// -----------------------------------------------------------------------------
+//
+void MMPXCollection::OpenL()
+{
+ if(gLeaveOpen)
+ {
+ User::Leave(KErrGeneral);
+ }
+}
+
+
+// -----------------------------------------------------------------------------
+// BackL
+// -----------------------------------------------------------------------------
+//
+void MMPXCollection::BackL()
+{
+ if(gLeaveBack)
+ {
+ User::Leave(KErrGeneral);
+ }
+}
+
+
+// -----------------------------------------------------------------------------
+// CommandL
+// -----------------------------------------------------------------------------
+//
+void MMPXCollection::CommandL(CMPXCommand& /*cmd*/)
+{
+ if(gLeaveCommand)
+ {
+ User::Leave(KErrGeneral);
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionclient/stub/src/mpxmedia.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,24 @@
+/*
+* 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 CMPXMedia for unit testing CVideocollectionClient
+*
+*/
+
+#include "mpxmedia.h"
+
+bool CMPXMedia::mIsSupported = true;
+
+bool CMPXMedia::mValueTObjectLeaves = false;
+
+TMPXItemId CMPXMedia::mIdFromValueTObject = TMPXItemId::InvalidId();
--- a/videocollection/videocollectionwrapper/tsrc/testvideocollectionclient/stub/src/stubcollectionsignalclasses.cpp Thu Apr 01 23:13:36 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,163 +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 classes for testing VideoCollectionClient
-*
-*/
-
-#include <QList>
-#include <mpxmediaarray.h>
-
-#include "stubcollectionsignalclasses.h"
-
-// -----------------------------------------------------------------------------
-// StubSignalReceiver
-// -----------------------------------------------------------------------------
-//
-StubSignalReceiver::StubSignalReceiver()
-{
-}
-
-// -----------------------------------------------------------------------------
-// ~CStubSignalReceiver
-// -----------------------------------------------------------------------------
-//
-StubSignalReceiver::~StubSignalReceiver()
-{
-
-}
-
-// -----------------------------------------------------------------------------
-// newVideoListSlot
-// -----------------------------------------------------------------------------
-//
-void StubSignalReceiver::newVideoListSlot(CMPXMediaArray */*array*/)
-{
-
-}
-
-// -----------------------------------------------------------------------------
-// appendVideoListSlot
-// -----------------------------------------------------------------------------
-//
-void StubSignalReceiver::appendVideoListSlot( CMPXMediaArray* /*videoList*/ )
-{
-
-}
-
-// -----------------------------------------------------------------------------
-// newVideoAvailableSlot
-// -----------------------------------------------------------------------------
-//
-void StubSignalReceiver::newVideoAvailableSlot(CMPXMedia */*media*/)
-{
-
-}
-
-// -----------------------------------------------------------------------------
-// videoDeletedSlot
-// -----------------------------------------------------------------------------
-//
-void StubSignalReceiver::videoDeletedSlot(TMPXItemId /*id*/)
-{
-
-}
-
-// -----------------------------------------------------------------------------
-// videoDeleteCompletedSlot
-// -----------------------------------------------------------------------------
-//
-void StubSignalReceiver::videoDeleteCompletedSlot(int /*overallCount*/, QList<TMPXItemId>* /*failedIds*/)
-{
-
-}
-
-// -----------------------------------------------------------------------------
-// videoDetailsCompletedSlot
-// -----------------------------------------------------------------------------
-//
-void StubSignalReceiver::videoDetailsCompletedSlot(TMPXItemId )
-{
-
-}
-
-// -----------------------------------------------------------------------------
-// StubListenerAllSignals
-// -----------------------------------------------------------------------------
-//
-StubListenerAllSignals:: StubListenerAllSignals(VideoCollectionClient &collectionClient) :
-VideoCollectionListener(collectionClient)
-{
-
-}
-
-// -----------------------------------------------------------------------------
-// StubListenerNoNewVideoList
-// -----------------------------------------------------------------------------
-//
-StubListenerNoNewVideoList::StubListenerNoNewVideoList(VideoCollectionClient &collectionClient) :
-VideoCollectionListener(collectionClient)
-{
-
-}
-// -----------------------------------------------------------------------------
-// StubListenerNoVideoListAppended
-// -----------------------------------------------------------------------------
-//
-StubListenerNoVideoListAppended::StubListenerNoVideoListAppended(VideoCollectionClient &collectionClient) :
-VideoCollectionListener(collectionClient)
-{
-
-}
-
-// -----------------------------------------------------------------------------
-// StubListenerNoNewVideoAvailable
-// -----------------------------------------------------------------------------
-//
-StubListenerNoNewVideoAvailable::StubListenerNoNewVideoAvailable(VideoCollectionClient &collectionClient) :
-VideoCollectionListener(collectionClient)
-{
-
-}
-
-// -----------------------------------------------------------------------------
-// StubListenerNoVideoDeleted
-// -----------------------------------------------------------------------------
-//
-StubListenerNoVideoDeleted::StubListenerNoVideoDeleted(VideoCollectionClient &collectionClient) :
-VideoCollectionListener(collectionClient)
-{
-
-}
-
-// -----------------------------------------------------------------------------
-// StubListenerNoVideoDeleteCompleted
-// -----------------------------------------------------------------------------
-//
-StubListenerNoVideoDeleteCompleted::StubListenerNoVideoDeleteCompleted(VideoCollectionClient &collectionClient) :
-VideoCollectionListener(collectionClient)
-{
-
-}
-
-// -----------------------------------------------------------------------------
-// StubListenerNoVideoDetailsCompleted
-// -----------------------------------------------------------------------------
-//
-StubListenerNoVideoDetailsCompleted::StubListenerNoVideoDetailsCompleted(VideoCollectionClient &collectionClient) :
-VideoCollectionListener(collectionClient)
-{
-
-}
-
-
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionclient/stub/src/videocollectionlistener.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,32 @@
+/*
+* 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:
+*
+*/
+
+
+#include "videodatasignalreceiver.h"
+#include "videocollectionlistener.h"
+#include "videocollectionclient.h"
+
+VideoCollectionListener::VideoCollectionListener(VideoCollectionClient &collectionClient, VideoDataSignalReceiver &signalReceiver)
+{
+ Q_UNUSED(collectionClient);
+ Q_UNUSED(signalReceiver);
+}
+
+VideoCollectionListener::~VideoCollectionListener()
+{
+
+}
--- a/videocollection/videocollectionwrapper/tsrc/testvideocollectionclient/testvideocollectionclient.pro Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionclient/testvideocollectionclient.pro Thu Apr 01 23:22:15 2010 +0300
@@ -43,14 +43,14 @@
stub/inc/mpxmedia.h \
stub/inc/mpxmediaarray.h \
stub/inc/mpxattribute.h \
- stub/inc/stubcollectionsignalclasses.h \
+ stub/inc/stubcollectionsignalreceiver.h \
stub/inc/videocollectionlistener.h \
../../inc/videodatasignalreceiver.h \
../../inc/videocollectionclient.h
SOURCES += src/testvideocollectionclient.cpp \
stub/src/mpxcollectionutility.cpp \
+ stub/src/mpxmedia.cpp \
stub/src/mpxcollectionpath.cpp \
- stub/src/stubcollectionsignalclasses.cpp \
stub/src/videocollectionlistener.cpp \
../../src/videocollectionclient.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionlistener/inc/testvideocollectionlistener.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,178 @@
+
+/**
+* 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 CVideoCollectionListener
+*
+*/
+
+#ifndef __TESTVIDEOCOLLECTIONLISTENER_H__
+#define __TESTVIDEOCOLLECTIONLISTENER_H__
+
+
+// INCLUDES
+#include <QtTest/QtTest>
+#include "stub/inc/videocollectionclient.h"
+
+class StubSignalReceiver;
+class StubCollection;
+class VideoCollectionListener;
+class VideoCollectionClient;
+class MediaObjectFactory;
+
+class TestVideoCollectionListener : public QObject
+{
+ Q_OBJECT
+
+ // test functions for the test framework
+private slots:
+
+
+ /**
+ * called before anything else when test starts
+ */
+ void initTestCase();
+
+ /**
+ * will be called before each testfunction is executed.
+ *
+ */
+ void init();
+
+ /**
+ * will be called after every testfunction.
+ *
+ */
+ void cleanup();
+
+ /**
+ * will be called after testing ends
+ *
+ */
+ void cleanupTestCase();
+
+ /**
+ * verifies HandleCollectionMediaL
+ */
+ void testHandleCollectionMediaLFunc();
+
+ /**
+ * verifies HandleOpenL with param
+ * - const CMPXMedia&
+ * - TInt
+ * - TBool
+ * - TInt
+ */
+ void testHandleOpenLMediaFunc();
+
+ /**
+ * verifies HandleOpenL with param
+ * - const CMPXCollectionPlaylist&
+ * - TInt
+ */
+ void testHandleOpenLPlaylistFunc();
+
+ /**
+ * verifies HandleCommandComplete
+ */
+ void testHandleCommandComplete();
+
+ /**
+ * verifies HandleCollectionMessage
+ * error case, empty message
+ */
+ void testCollectionMessageError();
+
+ /**
+ * verifies HandleCollectionMessage during
+ * collection openening phase
+ */
+ void testCollectionMessageNotOpened();
+
+ /**
+ * verifies HandleCollectionMessage when
+ * collection has opened and
+ * receiving message id == KVcxCommandIdMyVideos
+ */
+ void testCollectionMessageMyVidCommandId();
+
+ /**
+ * verifies handleMyVideosMessageArray method
+ * collection has opened and
+ * receiving message id == KVcxCommandIdMyVideos and
+ * KVcxMediaMyVideosCommandId == KVcxMessageMyVideosMessageArray
+ */
+ void testHandleMyVideosMessageArray();
+
+ /**
+ * verifies handleMyVideosMPXMessage method
+ * collection has opened and
+ * receiving message id == KVcxCommandIdMyVideos and
+ * KVcxMediaMyVideosCommandId != KVcxMessageMyVideosMessageArray
+ */
+ void testHandleMyVideosMPXMessage();
+
+ /**
+ * verifies handleMyVideosMPXMessage method
+ * collection has opened and
+ * receiving message id == KVcxCommandIdMyVideos and
+ * KVcxMediaMyVideosCommandId == KVcxMessageMyVideosDeleteResp
+ */
+ void testMyVideosDeleteMsgArray();
+
+ /**
+ * verifies handleMPXMessage method
+ * collection has opened and
+ * receiving message id != KVcxCommandIdMyVideos
+ */
+ void testHandleMPXMessage();
+
+private:
+
+ /**
+ * testobject
+ */
+ VideoCollectionListener *mTestObject;
+
+ /**
+ * stub collection client
+ */
+ VideoCollectionClient *mStubCollectionClient;
+
+ /**
+ * stub collection
+ */
+ StubCollection *mStubCollection;
+
+ /**
+ * media object factory
+ */
+ MediaObjectFactory *mMediaFactory;
+
+ /**
+ * stubbed signal receiver
+ */
+ StubSignalReceiver *mSignalReceiver;
+
+
+};
+
+
+
+
+#endif // __TESTVIDEOCOLLECTIONWRAPPER_H__
+
+// End of file
+
+
+
--- a/videocollection/videocollectionwrapper/tsrc/testvideocollectionlistener/src/testvideocollectionlistener.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionlistener/src/testvideocollectionlistener.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -29,8 +29,9 @@
#include <vcxmyvideosuids.h>
#include "testvideocollectionlistener.h"
#include "mediaobjectfactory.h"
-#include "stub/inc/stubsignalreceiver.h"
-#include "stub/inc/stubcollection.h"
+#include "videocollectioncommon.h"
+#include "stubsignalreceiver.h"
+#include "stubcollection.h"
#include "videocollectionutils.h"
@@ -46,13 +47,20 @@
int main(int argc, char *argv[])
{
TestVideoCollectionListener tv;
-
- char *pass[3];
- pass[0] = argv[0];
- pass[1] = "-o";
- pass[2] = "c:\\data\\testvideocollectionlistener.txt";
- int res = QTest::qExec(&tv, 3, pass);
+ 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\\testvideocollectionlistener.txt";
+ res = QTest::qExec(&tv, 3, pass);
+ }
return res;
}
@@ -74,26 +82,19 @@
{
mStubCollectionClient = new VideoCollectionClient();
- mTestObject = new VideoCollectionListener(*mStubCollectionClient);
+ mSignalReceiver = new StubSignalReceiver();
+
+ mTestObject = new VideoCollectionListener(*mStubCollectionClient, *mSignalReceiver);
mStubCollection = new StubCollection(*mTestObject);
qRegisterMetaType<CMPXMediaArray*>("CMPXMediaArray*");
- mSpyNewVideoList = new QSignalSpy(mTestObject, SIGNAL(newVideoList(CMPXMediaArray*)));
-
- mSpyVideoListAppended = new QSignalSpy(mTestObject, SIGNAL(videoListAppended(CMPXMediaArray*)));
-
+
qRegisterMetaType<CMPXMedia*>("CMPXMedia*");
- mSpyNewVideoAvailable = new QSignalSpy(mTestObject, SIGNAL(newVideoAvailable(CMPXMedia*)));
-
+
qRegisterMetaType<TMPXItemId>("TMPXItemId");
-
- mSpyVideoDeleted = new QSignalSpy(mTestObject, SIGNAL(videoDeleted(TMPXItemId)));
qRegisterMetaType<QList<TMPXItemId>*>("QList<TMPXItemId>*");
- mSpyVideoDeleteCompleted = new QSignalSpy(mTestObject, SIGNAL(videoDeleteCompleted(int, QList<TMPXItemId>*)));
-
- mSpyVideoDetailsCompleted = new QSignalSpy(mTestObject, SIGNAL(videoDetailsCompleted(TMPXItemId)));
}
// -----------------------------------------------------------------------------
@@ -105,29 +106,15 @@
delete mTestObject;
mTestObject = 0;
+ delete mSignalReceiver;
+ mSignalReceiver = 0;
+
delete mStubCollectionClient;
mStubCollectionClient = 0;
delete mStubCollection;
mStubCollection = 0;
- delete mSpyNewVideoList;
- mSpyNewVideoList = 0;
-
- delete mSpyVideoListAppended;
- mSpyVideoListAppended = 0;
-
- delete mSpyNewVideoAvailable;
- mSpyNewVideoAvailable = 0;
-
- delete mSpyVideoDeleted;
- mSpyVideoDeleted = 0;
-
- delete mSpyVideoDeleteCompleted;
- mSpyVideoDeleteCompleted = 0;
-
- delete mSpyVideoDetailsCompleted;
- mSpyVideoDetailsCompleted = 0;
}
// -----------------------------------------------------------------------------
@@ -145,8 +132,6 @@
//
void TestVideoCollectionListener::testHandleCollectionMediaLFunc()
{
- StubSignalReceiver receiver;
- QVERIFY(connectSignals(&receiver));
// nothing to test here, because
// currently HandleCollectionMediaL is empty implementation required
// by the inheritance of MMPXCollectionObserver.
@@ -156,10 +141,9 @@
TRAP_IGNORE(media = CMPXMedia::NewL());
mStubCollection->callHandleCollectionMediaLFunc(*media, 0);
delete media;
-
- QVERIFY(!hasSignalsEmitted());
- QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
- QVERIFY(receiver.getLatestPointerAddr() == 0);
+
+ QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
+ QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
int remHeap = User::Heap().__DbgMarkEnd(0);
QVERIFY(remHeap == 0);
@@ -171,76 +155,79 @@
//
void TestVideoCollectionListener::testHandleOpenLMediaFunc()
{
- StubSignalReceiver receiver;
- QVERIFY(connectSignals(&receiver));
-
- User::Heap().__DbgMarkStart();
- mStubCollectionClient->setCollectionLevel(VideoCollectionClient::ELevelVideos);
+ mStubCollectionClient->setCollectionLevel(VideoCollectionCommon::ELevelVideos);
CMPXMedia *media = mMediaFactory->newMedia(0);
// error != KErrNone
mStubCollection->callHandleOpenLFunc(*media, 0, true, -2 );
- QVERIFY(receiver.getLatestPointerAddr() == 0);
- QVERIFY(mSpyNewVideoList->count() == 0);
- QVERIFY(mSpyVideoListAppended->count() == 0);
+ QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
// collectionLevel != LevelVideos
mStubCollectionClient->setCollectionLevel(-100);
mStubCollection->callHandleOpenLFunc(*media, 0, true, 0 );
- QVERIFY(receiver.getLatestPointerAddr() == 0);
- QVERIFY(mSpyNewVideoList->count() == 0);
- QVERIFY(mSpyVideoListAppended->count() == 0);
- mStubCollectionClient->setCollectionLevel(VideoCollectionClient::ELevelVideos);
+ QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
+ mStubCollectionClient->setCollectionLevel(VideoCollectionCommon::ELevelVideos);
// empty media (== media does not contain array)
mStubCollection->callHandleOpenLFunc(*media, 0, true, 0 );
- QVERIFY(receiver.getLatestPointerAddr() == 0);
- QVERIFY(mSpyNewVideoList->count() == 0);
- QVERIFY(mSpyVideoListAppended->count() == 0);
+ QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
// signal emitting: correct media-array passed
CMPXMediaArray *array = mMediaFactory->newMediaArray();
+ CMPXMediaArray *arrayToTest = 0;
+
+ QWARN("test for other paths than all videos are missing");
+ CMPXCollectionPath* collectionPath = 0;
+ TRAP_IGNORE(
+ collectionPath = CMPXCollectionPath::NewL();
+ collectionPath->AppendL( KVcxUidMyVideosMpxCollection );
+ collectionPath->AppendL( KVcxMvcCategoryIdAll););
+
// empty array
mMediaFactory->putValuePtr<CMPXMediaArray>(media, KMPXMediaArrayContents, array);
- mStubCollection->callHandleOpenLFunc(*media, 0, true, 0 );
- QVERIFY(receiver.getLatestPointerAddr() != 0);
- QVERIFY(mSpyNewVideoList->count() == 1);
- QVERIFY(mSpyVideoListAppended->count() == 0);
+ mMediaFactory->putValuePtr<CMPXCollectionPath>(media, KMPXMediaGeneralContainerPath, collectionPath);
+ mStubCollection->callHandleOpenLFunc(*media, 0, true, 0 );
+ arrayToTest = static_cast<CMPXMediaArray*>(mSignalReceiver->getLatestPointerAddr());
+ QVERIFY(arrayToTest != 0);
+ QVERIFY(arrayToTest->Count() == array->Count());
+
+ // array of items from different levels, everything is reported
+ mStubCollectionClient->setCollectionLevel(VideoCollectionCommon::ELevelCategory);
+ mMediaFactory->putArrayContent(array, mMediaFactory->newMedia(1, 2));
+ mMediaFactory->putValuePtr<CMPXCollectionPath>(media, KMPXMediaGeneralContainerPath, collectionPath);
- // item for invalid level, no new signals emitted
- mStubCollectionClient->setCollectionLevel(VideoCollectionClient::ELevelCategory);
- mMediaFactory->putArrayContent(array, mMediaFactory->newMedia(1, 2));
mStubCollection->callHandleOpenLFunc(*media, 0, true, 0 );
- QVERIFY(receiver.getLatestPointerAddr() != 0);
- QVERIFY(mSpyNewVideoList->count() == 1);
- QVERIFY(mSpyVideoListAppended->count() == 0);
+ arrayToTest = static_cast<CMPXMediaArray*>(mSignalReceiver->getLatestPointerAddr());
+ QVERIFY(arrayToTest != 0);
+ QVERIFY(arrayToTest->Count() == array->Count());
+
- mStubCollectionClient->setCollectionLevel(VideoCollectionClient::ELevelVideos);
+ mStubCollectionClient->setCollectionLevel(VideoCollectionCommon::ELevelVideos);
delete array;
array = mMediaFactory->newMediaArray();
mMediaFactory->putArrayContent(array, mMediaFactory->newMedia(1));
mMediaFactory->putArrayContent(array, mMediaFactory->newMedia(2));
mMediaFactory->putArrayContent(array, mMediaFactory->newMedia(3));
- mMediaFactory->putValuePtr<CMPXMediaArray>(media, KMPXMediaArrayContents, array);
- mTestObject->setRequestNewMediaArray(true);
+ mMediaFactory->putValuePtr<CMPXMediaArray>(media, KMPXMediaArrayContents, array);
+ mMediaFactory->putValuePtr<CMPXCollectionPath>(media, KMPXMediaGeneralContainerPath, collectionPath);
mStubCollection->callHandleOpenLFunc(*media, 0, true, 0 );
- QVERIFY(receiver.getLatestPointerAddr() != 0);
- QVERIFY(mSpyNewVideoList->count() == 2);
- QVERIFY(mSpyVideoListAppended->count() == 0);
+ arrayToTest = static_cast<CMPXMediaArray*>(mSignalReceiver->getLatestPointerAddr());
+ QVERIFY(arrayToTest != 0);
+ QVERIFY(arrayToTest->Count() == array->Count());
mStubCollection->callHandleOpenLFunc(*media, 0, true, 0 );
- QVERIFY(receiver.getLatestPointerAddr() != 0);
- QVERIFY(mSpyNewVideoList->count() == 2);
- QVERIFY(mSpyVideoListAppended->count() == 1);
+ arrayToTest = static_cast<CMPXMediaArray*>(mSignalReceiver->getLatestPointerAddr());
+ QVERIFY(arrayToTest != 0);
+ QVERIFY(arrayToTest->Count() == array->Count());
- CMPXMediaArray *gottenArray = static_cast<CMPXMediaArray*>(receiver.getLatestPointerAddr());
+ CMPXMediaArray *gottenArray = static_cast<CMPXMediaArray*>(mSignalReceiver->getLatestPointerAddr());
QVERIFY(gottenArray->Count() == 3);
TMPXItemId mediaId = TMPXItemId::InvalidId();
@@ -251,15 +238,45 @@
VideoCollectionUtils::instance().mediaValue<TMPXItemId>((*gottenArray)[2], KMPXMediaGeneralId, mediaId );
QVERIFY(mediaId.iId1 == 3);
+ collectionPath->Reset();
+ delete collectionPath;
+ TMPXItemId albumId(100,2);
+ TRAP_IGNORE(
+ collectionPath = CMPXCollectionPath::NewL();
+ collectionPath->AppendL( KVcxUidMyVideosMpxCollection );
+ collectionPath->AppendL( albumId ););
+ // level == album
+ mStubCollectionClient->setCollectionLevel(VideoCollectionCommon::ELevelAlbum);
+ mSignalReceiver->resetLatestItems();
+ delete array;
+ array = mMediaFactory->newMediaArray();
+ mMediaFactory->putArrayContent(array, mMediaFactory->newMedia(1));
+ mMediaFactory->putArrayContent(array, mMediaFactory->newMedia(2));
+ mMediaFactory->putArrayContent(array, mMediaFactory->newMedia(3));
+ // call open item to update latest item id in stub collection client
+ mStubCollectionClient->openItem(albumId);
+ mMediaFactory->putValuePtr<CMPXMediaArray>(media, KMPXMediaArrayContents, array);
+ mMediaFactory->putValuePtr<CMPXCollectionPath>(media, KMPXMediaGeneralContainerPath, collectionPath);
+ mStubCollection->callHandleOpenLFunc(*media, 0, true, 0 );
+
+ gottenArray = static_cast<CMPXMediaArray*>(mSignalReceiver->getLatestPointerAddr());
+ QVERIFY(gottenArray->Count() == 3);
+
+ mediaId = TMPXItemId::InvalidId();
+ VideoCollectionUtils::instance().mediaValue<TMPXItemId>((*gottenArray)[0], KMPXMediaGeneralId, mediaId );
+ QVERIFY(mediaId.iId1 == 1);
+ VideoCollectionUtils::instance().mediaValue<TMPXItemId>((*gottenArray)[1], KMPXMediaGeneralId, mediaId );
+ QVERIFY(mediaId.iId1 == 2);
+ VideoCollectionUtils::instance().mediaValue<TMPXItemId>((*gottenArray)[2], KMPXMediaGeneralId, mediaId );
+ QVERIFY(mediaId.iId1 == 3);
+ mediaId = mSignalReceiver->getLatestItemId();
+ QVERIFY(mediaId == albumId);
+
delete array;
delete media;
- mSpyNewVideoList->clear();
- mSpyVideoListAppended->clear();
- QVERIFY(!hasSignalsEmitted());
- QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
-
- int remHeap = User::Heap().__DbgMarkEnd(0);
- QVERIFY(remHeap == 0);
+ collectionPath->Reset();
+ delete collectionPath;
+ mSignalReceiver->resetLatestItems();
}
// -----------------------------------------------------------------------------
@@ -268,8 +285,6 @@
//
void TestVideoCollectionListener::testHandleOpenLPlaylistFunc()
{
- StubSignalReceiver receiver;
- QVERIFY(connectSignals(&receiver));
// nothing to test here, because
// currently HandleCollectionMediaL is empty implementation required
@@ -279,9 +294,8 @@
mStubCollection->callHandleOpenLFunc(*plList, 0);
- QVERIFY(!hasSignalsEmitted());
- QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
- QVERIFY(receiver.getLatestPointerAddr() == 0);
+ QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
+ QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
int remHeap = User::Heap().__DbgMarkEnd(0);
QVERIFY(remHeap == 0);
@@ -293,8 +307,6 @@
//
void TestVideoCollectionListener::testHandleCommandComplete()
{
- StubSignalReceiver receiver;
- QVERIFY(connectSignals(&receiver));
User::Heap().__DbgMarkStart();
@@ -302,46 +314,39 @@
// error != KErrNone
mStubCollection->callHandleCommandComplete(pCommand, -2);
- QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
- QVERIFY(mSpyVideoDetailsCompleted->count() == 0);
+ QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
// command == NULL
mStubCollection->callHandleCommandComplete(0, 0);
- QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
- QVERIFY(mSpyVideoDetailsCompleted->count() == 0);
+ QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
// null command + error != KErrNone
mStubCollection->callHandleCommandComplete(0, -2);
- QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
- QVERIFY(mSpyVideoDetailsCompleted->count() == 0);
-
+ QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
+
// command without id
delete pCommand;
pCommand = mMediaFactory->newMedia();
mStubCollection->callHandleCommandComplete(pCommand, 0);
- QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
- QVERIFY(mSpyVideoDetailsCompleted->count() == 0);
+ QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
// no command attribute
delete pCommand;
pCommand = mMediaFactory->newMedia(0);
mStubCollection->callHandleCommandComplete(pCommand, 0);
- QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
- QVERIFY(mSpyVideoDetailsCompleted->count() == 0);
+ QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
// invalid KVcxMediaMyVideosCommandId
int value = (KVcxCommandMyVideosGetMediaFullDetailsByMpxId + 10);
mMediaFactory->putTValue<int>(pCommand, KVcxMediaMyVideosCommandId, value );
mStubCollection->callHandleCommandComplete(pCommand, 0);
- QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
- QVERIFY(mSpyVideoDetailsCompleted->count() == 0);
+ QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
// no media object in command
value = KVcxCommandMyVideosGetMediaFullDetailsByMpxId;
mMediaFactory->putTValue<int>(pCommand, KVcxMediaMyVideosCommandId, value );
mStubCollection->callHandleCommandComplete(pCommand, 0);
- QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
- QVERIFY(mSpyVideoDetailsCompleted->count() == 0);
+ QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
// NOTE! we cannot test with item without KMPXMediaGeneralId, because after creation CMPXMedia
// always contain default value
@@ -350,14 +355,12 @@
CMPXMedia *subMedia = mMediaFactory->newMedia(10);
mMediaFactory->putValuePtr<CMPXMedia>(pCommand, KMPXCommandColAddMedia, subMedia);
mStubCollection->callHandleCommandComplete(pCommand, 0);
- QVERIFY(receiver.getLatestItemId().iId1 == 10);
- QVERIFY(mSpyVideoDetailsCompleted->count() == 1);
+ QVERIFY(mSignalReceiver->getLatestItemId().iId1 == 10);
+
delete subMedia;
delete pCommand;
- mSpyVideoDetailsCompleted->clear();
- QVERIFY(!hasSignalsEmitted());
- QVERIFY(receiver.getLatestPointerAddr() == 0);
+ QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
int remHeap = User::Heap().__DbgMarkEnd(0);
QVERIFY(remHeap == 0);
@@ -369,9 +372,8 @@
//
void TestVideoCollectionListener::testCollectionMessageError()
{
- StubSignalReceiver receiver;
- QVERIFY(connectSignals(&receiver));
+ mSignalReceiver->resetLatestItems();
User::Heap().__DbgMarkStart();
CMPXMessage *message = mMediaFactory->newMedia(0);
@@ -390,11 +392,10 @@
mStubCollection->callHandleCollectionMessage(0, 0);
QVERIFY(mStubCollectionClient->getOpenStatus() == -1);
- // none of above calls should not cause any signal emitting
- QVERIFY(!hasSignalsEmitted());
- QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
- QVERIFY(receiver.getLatestPointerAddr() == 0);
- QVERIFY(receiver.getLatestIntegerData() == -1);
+ // none of above calls should not cause any callbacks
+ QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
+ QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
+ QVERIFY(mSignalReceiver->getLatestIntegerData() == -1);
int remHeap = User::Heap().__DbgMarkEnd(0);
QVERIFY(remHeap == 0);
@@ -406,9 +407,8 @@
//
void TestVideoCollectionListener::testCollectionMessageNotOpened()
{
- StubSignalReceiver receiver;
- QVERIFY(connectSignals(&receiver));
-
+ mSignalReceiver->resetLatestItems();
+
User::Heap().__DbgMarkStart();
mStubCollectionClient->setOpenStatus( VideoCollectionClient::ECollectionOpening);
@@ -485,11 +485,10 @@
mStubCollection->callHandleCollectionMessage(message, 0);
QVERIFY(mStubCollectionClient->getOpenStatus() == VideoCollectionClient::ECollectionOpened);
- // none of above calls should not cause any signal emitting
- QVERIFY(!hasSignalsEmitted());
- QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
- QVERIFY(receiver.getLatestPointerAddr() == 0);
- QVERIFY(receiver.getLatestIntegerData() == -1);
+ // none of above calls should not cause any callbacks
+ QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
+ QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
+ QVERIFY(mSignalReceiver->getLatestIntegerData() == -1);
delete message;
@@ -503,9 +502,8 @@
//
void TestVideoCollectionListener::testCollectionMessageMyVidCommandId()
{
- StubSignalReceiver receiver;
- QVERIFY(connectSignals(&receiver));
-
+ mSignalReceiver->resetLatestItems();
+
User::Heap().__DbgMarkStart();
mStubCollectionClient->setOpenStatus(VideoCollectionClient::ECollectionOpened);
@@ -538,11 +536,10 @@
mStubCollection->callHandleCollectionMessage(message, 0);
delete message;
- // none of above calls should not cause any signal emitting
- QVERIFY(!hasSignalsEmitted());
- QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
- QVERIFY(receiver.getLatestPointerAddr() == 0);
- QVERIFY(receiver.getLatestIntegerData() == -1);
+ // none of above calls should not cause any callbacks
+ QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
+ QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
+ QVERIFY(mSignalReceiver->getLatestIntegerData() == -1);
int remHeap = User::Heap().__DbgMarkEnd(0);
QVERIFY(remHeap == 0);
@@ -555,9 +552,8 @@
//
void TestVideoCollectionListener::testHandleMyVideosMessageArray()
{
- StubSignalReceiver receiver;
- QVERIFY(connectSignals(&receiver));
+ mSignalReceiver->resetLatestItems();
User::Heap().__DbgMarkStart();
mStubCollectionClient->setOpenStatus(VideoCollectionClient::ECollectionOpened);
@@ -661,11 +657,10 @@
mStubCollection->callHandleCollectionMessage(message, 0);
delete array;
delete message;
- // none of above calls should cause any signal emitting
- QVERIFY(!hasSignalsEmitted());
- QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
- QVERIFY(receiver.getLatestPointerAddr() == 0);
- QVERIFY(receiver.getLatestIntegerData() == -1);
+ // none of above calls should cause any callbacks
+ QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
+ QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
+ QVERIFY(mSignalReceiver->getLatestIntegerData() == -1);
int remHeap = User::Heap().__DbgMarkEnd(0);
QVERIFY(remHeap == 0);
@@ -680,8 +675,7 @@
// tests all other my videos msg ids than KVcxMessageMyVideosDeleteResp.
// it is tested in testMyVideosDeleteMsgArray
- StubSignalReceiver receiver;
- QVERIFY(connectSignals(&receiver));
+ mSignalReceiver->resetLatestItems();
User::Heap().__DbgMarkStart();
@@ -730,39 +724,34 @@
// no contents
mStubCollection->callHandleCollectionMessage(message, 0);
- QVERIFY(mSpyNewVideoAvailable->count() == 0);
- QVERIFY(receiver.getLatestPointerAddr() == 0);
- QVERIFY(receiver.getLatestIntegerData() == -1);
+ QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
+ QVERIFY(mSignalReceiver->getLatestIntegerData() == -1);
CMPXMediaArray *array = mMediaFactory->newMediaArray();
mMediaFactory->putValuePtr<CMPXMediaArray>( message, KMPXMediaArrayContents, array);
// empty array
mStubCollection->callHandleCollectionMessage(message, 0);
- QVERIFY(mSpyNewVideoAvailable->count() == 0);
- QVERIFY(receiver.getLatestPointerAddr() == 0);
- QVERIFY(receiver.getLatestIntegerData() == -1);
+ QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
+ QVERIFY(mSignalReceiver->getLatestIntegerData() == -1);
mMediaFactory->putArrayContent( array, mMediaFactory->newMedia(10));
mMediaFactory->putArrayContent( array, mMediaFactory->newMedia(11));
// item(s) exists
mStubCollection->callHandleCollectionMessage(message, 0);
- QVERIFY(mSpyNewVideoAvailable->count() == 1);
- QVERIFY(receiver.getLatestPointerAddr() != 0);
- CMPXMedia *fetched = static_cast<CMPXMedia*>(receiver.getLatestPointerAddr());
+ CMPXMedia *fetched = static_cast<CMPXMedia*>(mSignalReceiver->getLatestPointerAddr());
int fetchedId = -1;
VideoCollectionUtils::instance().mediaValue<int>(fetched, KMPXMediaGeneralId, fetchedId );
QVERIFY(fetchedId == 10);
-
- mSpyNewVideoAvailable->clear();
+
+ QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
+ QVERIFY(mSignalReceiver->getLatestPointerAddr() != 0);
+ QVERIFY(mSignalReceiver->getLatestIntegerData() == -1);
+
+ mSignalReceiver->resetLatestItems();
delete array;
delete message;
- QVERIFY(!hasSignalsEmitted());
- QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
- QVERIFY(receiver.getLatestPointerAddr() != 0);
- QVERIFY(receiver.getLatestIntegerData() == -1);
-
int remHeap = User::Heap().__DbgMarkEnd(0);
QVERIFY(remHeap == 0);
}
@@ -773,8 +762,7 @@
//
void TestVideoCollectionListener::testMyVideosDeleteMsgArray()
{
- StubSignalReceiver receiver;
- QVERIFY(connectSignals(&receiver));
+ mSignalReceiver->resetLatestItems();
User::Heap().__DbgMarkStart();
@@ -788,21 +776,19 @@
int value = KVcxMessageMyVideosDeleteResp;
mMediaFactory->putTValue<int>( message, KVcxMediaMyVideosCommandId, value);
- // null array mSpyVideoDeleteCompleted->count()
+ // null array
mStubCollection->callHandleCollectionMessage(message, 0);
- QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
- QVERIFY(receiver.getLatestPointerAddr() == 0);
- QVERIFY(receiver.getLatestIntegerData() == -1);
- QVERIFY(mSpyVideoDeleteCompleted->count() == 0);
+ QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
+ QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
+ QVERIFY(mSignalReceiver->getLatestIntegerData() == -1);
// empty array
CMPXMediaArray *array = mMediaFactory->newMediaArray();
mMediaFactory->putValuePtr<CMPXMediaArray>( message, KMPXMediaArrayContents, array);
mStubCollection->callHandleCollectionMessage(message, 0);
- QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
- QVERIFY(receiver.getLatestPointerAddr() == 0);
- QVERIFY(receiver.getLatestIntegerData() == -1);
- QVERIFY(mSpyVideoDeleteCompleted->count() == 0);
+ QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
+ QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
+ QVERIFY(mSignalReceiver->getLatestIntegerData() == -1);
// item(s) does not contain KVcxMediaMyVideosInt32Value
mMediaFactory->putArrayContent( array, mMediaFactory->newMedia(1));
@@ -811,12 +797,10 @@
mMediaFactory->putArrayContent( array, mMediaFactory->newMedia(4));
mMediaFactory->putValuePtr<CMPXMediaArray>( message, KMPXMessageArrayContents, array);
mStubCollection->callHandleCollectionMessage(message, 0);
- QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
- QVERIFY(receiver.getLatestPointerAddr() != 0);
- QVERIFY(receiver.getLatestIntegerData() == 4);
- QVERIFY(receiver.getLatestListData().count() == 0);
- QVERIFY(mSpyVideoDeleteCompleted->count() == 1);
- mSpyVideoDeleteCompleted->clear();
+ QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
+ QVERIFY(mSignalReceiver->getLatestPointerAddr() != 0);
+ QVERIFY(mSignalReceiver->getLatestIntegerData() == 4);
+ QVERIFY(mSignalReceiver->getLatestListData().count() == 0);
delete array;
array = mMediaFactory->newMediaArray();
@@ -848,22 +832,18 @@
mMediaFactory->putArrayContent( array, mMediaFactory->newMedia(6));
mStubCollection->callHandleCollectionMessage(message, 0);
- QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
- QVERIFY(receiver.getLatestIntegerData() == 6);
- QVERIFY(receiver.getLatestPointerAddr() != 0);
- QVERIFY(receiver.getLatestListData().count() == 3);
- QVERIFY(receiver.getLatestListData().value(0).iId1 == 2);
- QVERIFY(receiver.getLatestListData().value(1).iId1 == 3);
- QVERIFY(receiver.getLatestListData().value(2).iId1 == 5);
- QVERIFY(mSpyVideoDeleteCompleted->count() == 1);
-
- receiver.resetLatestItems();
- mSpyVideoDeleteCompleted->clear();
+ QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
+ QVERIFY(mSignalReceiver->getLatestIntegerData() == 6);
+ QVERIFY(mSignalReceiver->getLatestPointerAddr() != 0);
+ QVERIFY(mSignalReceiver->getLatestListData().count() == 3);
+ QVERIFY(mSignalReceiver->getLatestListData().value(0).iId1 == 2);
+ QVERIFY(mSignalReceiver->getLatestListData().value(1).iId1 == 3);
+ QVERIFY(mSignalReceiver->getLatestListData().value(2).iId1 == 5);
+ mSignalReceiver->resetLatestItems();
+
delete array;
delete message;
- QVERIFY(!hasSignalsEmitted());
-
int remHeap = User::Heap().__DbgMarkEnd(0);
QVERIFY(remHeap == 0);
}
@@ -874,8 +854,7 @@
//
void TestVideoCollectionListener::testHandleMPXMessage()
{
- StubSignalReceiver receiver;
- QVERIFY(connectSignals(&receiver));
+ mSignalReceiver->resetLatestItems();
User::Heap().__DbgMarkStart();
@@ -889,196 +868,115 @@
// NOTE:
// - we're testing only for KMPXMessageGeneral only once, because handleGeneralMPXMessage is already verified
mStubCollection->callHandleCollectionMessage(message, 0);
- QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
- QVERIFY(receiver.getLatestPointerAddr() == 0);
- QVERIFY(!hasSignalsEmitted());
-
+ QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
+ QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
// invalid
msgId = KMPXMessageIdItemChanged + 1;
mStubCollection->callHandleCollectionMessage(message, 0);
- QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
- QVERIFY(receiver.getLatestPointerAddr() == 0);
- QVERIFY(!hasSignalsEmitted());
+ QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
+ QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
// KMPXMessageIdItemChanged with no content
- mStubCollectionClient->setCollectionLevel(VideoCollectionClient::ELevelVideos);
+ mStubCollectionClient->setCollectionLevel(VideoCollectionCommon::ELevelVideos);
msgId = KMPXMessageIdItemChanged;
mMediaFactory->putTValue<TMPXMessageId>(message, KMPXMessageGeneralId, msgId);
mStubCollection->callHandleCollectionMessage(message, 0);
- QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
- QVERIFY(receiver.getLatestPointerAddr() == 0);
- QVERIFY(!hasSignalsEmitted());
+ QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
+ QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
// KMPXMessageIdItemChanged with level != CVideoCollectionClient::ELevelVideos
- mStubCollectionClient->setCollectionLevel(VideoCollectionClient::ELevelVideos - 1);
+ mStubCollectionClient->setCollectionLevel(VideoCollectionCommon::ELevelVideos - 1);
mStubCollection->callHandleCollectionMessage(message, 0);
- QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
- QVERIFY(receiver.getLatestPointerAddr() == 0);
- QVERIFY(!hasSignalsEmitted());
+ QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
+ QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
- // KMPXMessageIdItemChanged with existing, not handled event type with missing KMPXMessageMediaGeneralId
- mStubCollectionClient->setCollectionLevel(VideoCollectionClient::ELevelVideos);
+ // KMPXMessageIdItemChanged with EMPXItemModified event type, no id
+ mStubCollectionClient->setCollectionLevel(VideoCollectionCommon::ELevelVideos);
TMPXChangeEventType eventType = EMPXItemModified;
- mMediaFactory->putTValue<TMPXChangeEventType>(message, KMPXMessageChangeEventType, eventType);
+ mMediaFactory->putTValue<TMPXChangeEventType>(message, KMPXMessageChangeEventType, eventType);
mStubCollection->callHandleCollectionMessage(message, 0);
- QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
- QVERIFY(receiver.getLatestPointerAddr() == 0);
- QVERIFY(!hasSignalsEmitted());
+ QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
+ QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
- // KMPXMessageIdItemChanged with existing, not handled event type
+ // KMPXMessageIdItemChanged with existing with EMPXItemModified event type, iId2 != album
TMPXItemId eventId;
- eventId.iId1 = 10;
+ eventId.iId1 = 1;
+ eventId.iId2 = 0;
mMediaFactory->putTValue<TMPXItemId>(message, KMPXMessageMediaGeneralId, eventId);
mStubCollection->callHandleCollectionMessage(message, 0);
- QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
- QVERIFY(receiver.getLatestPointerAddr() == 0);
- QVERIFY(!hasSignalsEmitted());
+ QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
+ QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
+
+ // KMPXMessageIdItemChanged with existing with EMPXItemModified event type iId2 == album, not same as opened
+ eventId.iId1 = 1;
+ eventId.iId2 = 2;
+ mMediaFactory->putTValue<TMPXItemId>(message, KMPXMessageMediaGeneralId, eventId);
+ mStubCollection->callHandleCollectionMessage(message, 0);
+ QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
+ QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
+
+ // KMPXMessageIdItemChanged with existing with EMPXItemModified event type iId2 == album, same as opened
+ eventId.iId1 = 1;
+ eventId.iId2 = 2;
+ int callCount = mStubCollectionClient->mOpenItemCallCount;
+ mStubCollectionClient->openItem(eventId);
+ QVERIFY(mStubCollectionClient->mOpenItemCallCount == callCount + 1);
+ mMediaFactory->putTValue<TMPXItemId>(message, KMPXMessageMediaGeneralId, eventId);
+ mStubCollection->callHandleCollectionMessage(message, 0);
+ QVERIFY(mStubCollectionClient->mOpenItemCallCount == callCount + 2);
+ mSignalReceiver->resetLatestItems();
// KMPXMessageIdItemChanged with EMPXItemDeleted event type
eventType = EMPXItemDeleted;
+ eventId.iId1 = 10;
+ eventId.iId2 = 0;
mMediaFactory->putTValue<TMPXChangeEventType>(message, KMPXMessageChangeEventType, eventType);
+ mMediaFactory->putTValue<TMPXItemId>(message, KMPXMessageMediaGeneralId, eventId);
mStubCollection->callHandleCollectionMessage(message, 0);
- QVERIFY(receiver.getLatestItemId().iId1 == 10);
- QVERIFY(receiver.getLatestPointerAddr() == 0);
- QVERIFY(mSpyVideoDeleted->count() == 1);
- mSpyVideoDeleted->clear();
- QVERIFY(!hasSignalsEmitted());
+ QVERIFY(mSignalReceiver->getLatestItemId().iId1 == 10);
+ QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
- receiver.resetLatestItems();
- // KMPXMessageIdItemChanged with EMPXItemInserted event type with no correct id2
+ mSignalReceiver->resetLatestItems();
+
+ // KMPXMessageIdItemChanged with EMPXItemInserted event type with id2 differrent than videos
eventType = EMPXItemInserted;
eventId.iId2 = 2;
mMediaFactory->putTValue<TMPXItemId>(message, KMPXMessageMediaGeneralId, eventId);
mMediaFactory->putTValue<TMPXChangeEventType>(message, KMPXMessageChangeEventType, eventType);
mStubCollection->callHandleCollectionMessage(message, 0);
- QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
- QVERIFY(receiver.getLatestPointerAddr() == 0);
+ QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
+ QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
// mpx id should have not changed into 10
- QVERIFY(mStubCollectionClient->getLatestMPXId() == 0);
- QVERIFY(!hasSignalsEmitted());
+ QVERIFY(mStubCollectionClient->getLatestMPXId() == eventId);
// KMPXMessageIdItemChanged with EMPXItemInserted event type with correct id2 no media object
eventId.iId2 = 1;
mMediaFactory->putTValue<TMPXItemId>(message, KMPXMessageMediaGeneralId, eventId);
mStubCollection->callHandleCollectionMessage(message, 0);
- QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
- QVERIFY(receiver.getLatestPointerAddr() == 0);
+ QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
+ QVERIFY(mSignalReceiver->getLatestPointerAddr() == 0);
QVERIFY(mStubCollectionClient->getLatestMPXId() == eventId);
- QVERIFY(!hasSignalsEmitted());
- // TODO: need to check album support
+
// KMPXMessageIdItemChanged with EMPXItemInserted event type with correct id2 with media object
CMPXMedia *media = mMediaFactory->newMedia(11);
mMediaFactory->putValuePtr<CMPXMedia>(message, KMPXCommandColAddMedia, media);
mStubCollection->callHandleCollectionMessage(message, 0);
- QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
- QVERIFY(receiver.getLatestPointerAddr() != 0);
- QVERIFY(mSpyNewVideoAvailable->count() == 1);
- CMPXMedia *gotten = static_cast<CMPXMedia*>(receiver.getLatestPointerAddr());
+ QVERIFY(mSignalReceiver->getLatestItemId() == TMPXItemId::InvalidId());
+ QVERIFY(mSignalReceiver->getLatestPointerAddr() != 0);
+ CMPXMedia *gotten = static_cast<CMPXMedia*>(mSignalReceiver->getLatestPointerAddr());
int fetchedId = -1;
VideoCollectionUtils::instance().mediaValue<int>(gotten, KMPXMediaGeneralId, fetchedId );
QVERIFY(fetchedId == 11);
- mSpyNewVideoAvailable->clear();
- QVERIFY(!hasSignalsEmitted());
delete media;
delete message;
+ mSignalReceiver->resetLatestItems();
int remHeap = User::Heap().__DbgMarkEnd(0);
QVERIFY(remHeap == 0);
}
-// -----------------------------------------------------------------------------
-// connectSignals
-// -----------------------------------------------------------------------------
-//
-bool TestVideoCollectionListener::connectSignals(StubSignalReceiver *receiver)
-{
- if(!QObject::connect(mTestObject, SIGNAL(newVideoList(CMPXMediaArray*)),
- receiver, SLOT(newVideoListSlot(CMPXMediaArray*)),
- Qt::DirectConnection))
- {
- return false;
- }
-
- if(!QObject::connect(mTestObject, SIGNAL(videoListAppended(CMPXMediaArray*)),
- receiver, SLOT(videoListAppendedSlot(CMPXMediaArray*)),
- Qt::DirectConnection))
- {
- return false;
- }
-
- if(!QObject::connect(mTestObject, SIGNAL(newVideoAvailable(CMPXMedia*)),
- receiver, SLOT(newVideoAvailableSlot(CMPXMedia*)),
- Qt::DirectConnection))
- {
- return false;
- }
-
- if(!QObject::connect(mTestObject, SIGNAL( videoListAppended(CMPXMediaArray*)),
- receiver, SLOT(videoListAppendedSlot(CMPXMediaArray*)),
- Qt::DirectConnection))
- {
- return false;
- }
-
- if(!QObject::connect(mTestObject, SIGNAL(videoDeleted(TMPXItemId)),
- receiver, SLOT(videoDeletedSlot(TMPXItemId)),
- Qt::DirectConnection))
- {
- return false;
- }
-
- if(!QObject::connect(mTestObject, SIGNAL(videoDeleteCompleted(int, QList<TMPXItemId>*)),
- receiver, SLOT(videoDeleteCompletedSlot(int, QList<TMPXItemId>*)),
- Qt::DirectConnection))
- {
- return false;
- }
-
- if(!QObject::connect(mTestObject, SIGNAL(videoDetailsCompleted(TMPXItemId)),
- receiver, SLOT(videoDetailsCompletedSlot(TMPXItemId)),
- Qt::DirectConnection))
- {
- return false;
- }
- return true;
-}
-
-// -----------------------------------------------------------------------------
-// hasSignalsEmitted
-// -----------------------------------------------------------------------------
-//
-bool TestVideoCollectionListener::hasSignalsEmitted()
-{
- if(mSpyNewVideoList->count() > 0)
- {
- return true;
- }
- if(mSpyVideoListAppended->count() > 0)
- {
- return true;
- }
- if(mSpyNewVideoAvailable->count() > 0)
- {
- return true;
- }
- if(mSpyVideoDeleted->count() > 0)
- {
- return true;
- }
- if(mSpyVideoDeleteCompleted->count() > 0)
- {
- return true;
- }
- if(mSpyVideoDetailsCompleted->count() > 0)
- {
- return true;
- }
- return false;
-}
-
-
// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionlistener/stub/inc/stubcollection.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,77 @@
+
+/**
+* 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 for testing VideoCollectionListener
+*
+*/
+
+#ifndef __CSTUBVIDECOLLECTION_H__
+#define __CSTUBVIDECOLLECTION_H__
+
+#include <mpxcollectionobserver.h>
+#include <mpxcollectionmessagedefs.h>
+#include <mpxitemid.h>
+#include <mpxmediaarray.h>
+#include <mpxmedia.h>
+
+
+class StubCollection
+{
+public:
+
+ /**
+ * contructor
+ */
+ StubCollection(MMPXCollectionObserver &observer);
+
+ /**
+ * destructor
+ */
+ virtual ~StubCollection();
+
+ /**
+ * calls MMPXCollectionMediaObserver::HandleCollectionMediaL
+ */
+ void callHandleCollectionMediaLFunc(const CMPXMedia& aMedia, TInt aError);
+
+ /**
+ * calls MMPXCollectionMediaObserver::HandleOpenL
+ */
+ void callHandleOpenLFunc(const CMPXMedia& aEntries, TInt aIndex, TBool aComplete, TInt aError);
+
+ /**
+ * calls MMPXCollectionMediaObserver::HandleOpenL
+ */
+ void callHandleOpenLFunc(const CMPXCollectionPlaylist& aPlaylist, TInt aError);
+
+ /**
+ * calls MMPXCollectionMediaObserver::HandleCommandComplete
+ */
+ void callHandleCommandComplete(CMPXCommand* aCommandResult, TInt aError);
+
+ /**
+ * calls MMPXCollectionMediaObserver::HandleCollectionMessage
+ */
+ void callHandleCollectionMessage(CMPXMessage* aMessage, TInt aError);
+
+private:
+
+ /**
+ * observer
+ */
+ MMPXCollectionObserver &mObserver;
+
+};
+
+#endif
--- a/videocollection/videocollectionwrapper/tsrc/testvideocollectionlistener/stub/inc/stubsignalreceiver.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionlistener/stub/inc/stubsignalreceiver.h Thu Apr 01 23:22:15 2010 +0300
@@ -24,11 +24,13 @@
#include <mpxmediaarray.h>
#include <mpxmedia.h>
#include <Qlist>
-
+#include "videodatasignalreceiver.h"
-class StubSignalReceiver : public QObject
+class StubSignalReceiver : public VideoDataSignalReceiver
{
Q_OBJECT
+
+ Q_DISABLE_COPY(StubSignalReceiver)
public:
@@ -75,6 +77,11 @@
void newVideoListSlot(CMPXMediaArray* aVideoList);
/**
+ * Saves provided address to mLatestPtr
+ */
+ void appendVideoListSlot( CMPXMediaArray* videoList );
+
+ /**
* Saves provided address to mLatestPtr
*/
void videoListAppendedSlot(CMPXMediaArray* aVideoList);
@@ -95,10 +102,27 @@
void videoDeleteCompletedSlot(int count, QList<TMPXItemId> *failedMediaIds);
/**
- * Saves provided integer to mLatestInt
+ * Saves provided integer to mLatestItemId
*/
void videoDetailsCompletedSlot(TMPXItemId videoId);
+ /**
+ * Saves provided integer to mLatestItemId and provided pointer to
+ * mLatestPtr
+ */
+ void albumListAvailableSlot(TMPXItemId albumId,
+ CMPXMediaArray *albumItems);
+
+ /**
+ * copies provided list data to mLatesListData
+ */
+ void albumRemoveFailureSlot(QList<TMPXItemId> *items);
+
+ /**
+ * saves provided item id into mLatestItemId
+ */
+ void itemDeletedSlot(TMPXItemId id);
+
private:
/**
* Contains address of latest pointer passed to object
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionlistener/stub/inc/videocollectionclient.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,124 @@
+
+/**
+* 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 for testing VideoCollectionListener
+*
+*/
+
+#ifndef __VIDEOCOLLECTIONCLIENT_H
+#define __VIDEOCOLLECTIONCLIENT_H
+
+#include <mpxcollectionmessagedefs.h>
+#include <mpxitemid.h>
+
+
+
+class VideoCollectionClient
+{
+public:
+
+
+ enum TCollectionOpenStatus
+ {
+ ECollectionInvalid,
+ ECollectionOpening,
+ ECollectionOpened
+ };
+ /**
+ * constructor
+ */
+ VideoCollectionClient();
+
+ /**
+ * destructor
+ */
+ virtual ~VideoCollectionClient();
+
+ /**
+ * sets mLevel
+ */
+ void setCollectionLevel(int level);
+
+ /**
+ * return mLevel
+ */
+ int getCollectionLevel();
+
+ /**
+ * return mOpenStatus
+ */
+ int getOpenStatus();
+
+ /**
+ * return id and type
+ */
+ void getCategoryId(TMPXItemId &id);
+
+
+ /**
+ * sets mOpenStatus
+ */
+ void setOpenStatus(int status);
+
+ /**
+ * sets mLatestItemId
+ */
+ void fetchMpxMediaByMpxId(TMPXItemId &eventData);
+
+ /**
+ * gets mLatestItemId
+ */
+ TMPXItemId getLatestMPXId();
+
+ /**
+ * startOpenCurrentState
+ */
+ int startOpenCurrentState();
+
+ /**
+ * sets mLatestItemId
+ */
+ void openItem(TMPXItemId id);
+
+ /**
+ * count of openItemcalls
+ */
+ int mOpenItemCallCount;
+
+private:
+
+ /**
+ * value returned from collectionLevel
+ */
+ int mLevel;
+
+ /**
+ * value simulating open status
+ */
+ int mOpenStatus;
+
+ /**
+ * value fecthed from fetchMpxMediaByMpxId or
+ * setted in openItem
+ */
+ TMPXItemId mLatestItemId;
+
+public:
+ static int mStartOpenCurrentStateCallCount;
+
+};
+
+#endif
+
+
--- a/videocollection/videocollectionwrapper/tsrc/testvideocollectionlistener/stub/src/stubsignalreceiver.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionlistener/stub/src/stubsignalreceiver.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -96,6 +96,15 @@
}
// -----------------------------------------------------------------------------
+// appendVideoListSlot
+// -----------------------------------------------------------------------------
+//
+void StubSignalReceiver::appendVideoListSlot( CMPXMediaArray* videoList )
+{
+ mLatestPtr = videoList;
+}
+
+// -----------------------------------------------------------------------------
// videoListAppendedSlot
// -----------------------------------------------------------------------------
//
@@ -152,3 +161,44 @@
{
mLatestItemId = videoId;
}
+
+// -----------------------------------------------------------------------------
+// albumListAvailableSlot
+// -----------------------------------------------------------------------------
+//
+void StubSignalReceiver::albumListAvailableSlot(TMPXItemId albumId,
+ CMPXMediaArray *albumItems)
+{
+ mLatestItemId = albumId;
+ mLatestPtr = albumItems;
+}
+
+// -----------------------------------------------------------------------------
+// itemDeletedSlot
+// -----------------------------------------------------------------------------
+//
+void StubSignalReceiver::itemDeletedSlot(TMPXItemId id)
+{
+ mLatestItemId = id;
+}
+
+// -----------------------------------------------------------------------------
+// albumRemoveFailureSlot
+// -----------------------------------------------------------------------------
+//
+void StubSignalReceiver::albumRemoveFailureSlot(QList<TMPXItemId> *items)
+{
+ mLatestPtr = items;
+
+ if(!items)
+ {
+ return;
+ }
+ mLatesListData.clear();
+ TMPXItemId data = 0;
+ foreach(data, (*items))
+ {
+ mLatesListData.append(data);
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionlistener/stub/src/videocollectionclient.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,126 @@
+/**
+* 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 for testing VideoCollectionListener
+*
+*/
+
+#include "stub/inc/videocollectionclient.h"
+
+int VideoCollectionClient::mStartOpenCurrentStateCallCount = 0;
+
+// -----------------------------------------------------------------------------
+// VideoCollectionClient
+// -----------------------------------------------------------------------------
+//
+VideoCollectionClient::VideoCollectionClient():
+mLevel(0),
+mOpenStatus(-1),
+mLatestItemId(0),
+mOpenItemCallCount(0)
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// ~VideoCollectionClient
+// -----------------------------------------------------------------------------
+//
+VideoCollectionClient::~VideoCollectionClient()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// setCollectionLevel
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionClient::setCollectionLevel(int level)
+{
+ mLevel = level;
+}
+
+// -----------------------------------------------------------------------------
+// getCategoryIds
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionClient::getCategoryId(TMPXItemId &id)
+{
+ id = mLatestItemId;
+}
+
+// -----------------------------------------------------------------------------
+// getCollectionLevel
+// -----------------------------------------------------------------------------
+//
+int VideoCollectionClient::getCollectionLevel()
+{
+ return mLevel;
+}
+
+// -----------------------------------------------------------------------------
+// getOpenStatus
+// -----------------------------------------------------------------------------
+//
+int VideoCollectionClient::getOpenStatus()
+{
+ return mOpenStatus;
+}
+
+// -----------------------------------------------------------------------------
+// setOpenStatus
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionClient::setOpenStatus(int status)
+{
+ mOpenStatus = status;
+}
+
+// -----------------------------------------------------------------------------
+// fetchMpxMediaByMpxId
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionClient::fetchMpxMediaByMpxId(TMPXItemId &eventData)
+{
+ mLatestItemId = eventData;
+}
+
+// -----------------------------------------------------------------------------
+// getLatestMPXId
+// -----------------------------------------------------------------------------
+//
+TMPXItemId VideoCollectionClient::getLatestMPXId()
+{
+ return mLatestItemId;
+}
+
+// -----------------------------------------------------------------------------
+// startOpenCurrentState
+// -----------------------------------------------------------------------------
+//
+int VideoCollectionClient::startOpenCurrentState()
+{
+ mStartOpenCurrentStateCallCount++;
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// openItem
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionClient::openItem(TMPXItemId id)
+{
+ mOpenItemCallCount++;
+ mLatestItemId = id;
+}
+
--- a/videocollection/videocollectionwrapper/tsrc/testvideocollectionlistener/testvideocollectionlistener.pro Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionlistener/testvideocollectionlistener.pro Thu Apr 01 23:22:15 2010 +0300
@@ -36,7 +36,9 @@
stub/inc/stubcollection.h \
stub/inc/videocollectionclient.h \
stub/inc/stubsignalreceiver.h \
+ stub/inc/stubsignalreceiver.h \
../../inc/videocollectionutils.h \
+ ../../inc/videodatasignalreceiver.h \
../../inc/videocollectionlistener.h
SOURCES += src/testvideocollectionlistener.cpp \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/inc/testvideocollectionwrapper_p.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,88 @@
+
+/**
+* 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 VideoCollectionWrapperPrivate
+*
+*/
+
+#ifndef __TESTVIDEOCOLLECTIONWRAPPER_H__
+#define __TESTVIDEOCOLLECTIONWRAPPER_H__
+
+
+// INCLUDES
+#include <QtTest/QtTest>
+
+
+class VideoCollectionWrapperPrivate;
+
+class TestVideCollectionWrapper_p : public QObject
+{
+ Q_OBJECT
+
+
+signals:
+
+ /**
+ * common test signal
+ */
+ void testSignal();
+
+private slots:
+
+
+ /**
+ * will be called before each testfunction is executed.
+ *
+ */
+ void init();
+
+ /**
+ * will be called after every testfunction.
+ *
+ */
+ void cleanup();
+
+ /**
+ * initialization of model fails test
+ */
+ void testGetModelInitFail();
+
+ /**
+ * succeeded getModel test
+ */
+ void testGetModelSucceed();
+
+ /**
+ * verifies aboutToQuitSlot
+ */
+ void testAboutToQuitSlot();
+
+private:
+
+ /**
+ * testobject
+ */
+ VideoCollectionWrapperPrivate* mTestObject;
+
+};
+
+
+
+
+#endif // __TESTVIDEOCOLLECTIONWRAPPER_H__
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/src/testvideocollectionwrapper_p.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,223 @@
+
+/**
+* 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 VideoCollectionWrapperPrivate
+*
+*/
+
+
+// INCLUDES
+#include <qabstractitemmodel.h>
+#include <hbapplication.h>
+#include "testvideocollectionwrapper_p.h"
+#include "videocollectionwrapper.h"
+#include "videocollectioncommon.h"
+#include "videolistdatamodel.h"
+#include "videosortfilterproxymodel.h"
+#include "videocollectionclient.h"
+#include "vcxmyvideosdefs.h"
+
+#define private public
+#include "videocollectionwrapper_p.h"
+#undef private
+
+// -----------------------------------------------------------------------------
+// main
+// -----------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ TestVideCollectionWrapper_p tv;
+ HbApplication app(argc, argv);
+ 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\\testvideocollectionwrapper_p.txt";
+ res = QTest::qExec(&tv, 3, pass);
+ }
+
+ return res;
+}
+
+
+// -----------------------------------------------------------------------------
+// init
+// -----------------------------------------------------------------------------
+//
+void TestVideCollectionWrapper_p::init()
+{
+ mTestObject = new VideoCollectionWrapperPrivate();
+ QVERIFY(mTestObject);
+}
+
+// -----------------------------------------------------------------------------
+// cleanup
+// -----------------------------------------------------------------------------
+//
+void TestVideCollectionWrapper_p::cleanup()
+{
+ delete mTestObject;
+ mTestObject = 0;
+}
+
+// -----------------------------------------------------------------------------
+// testGetModelInitFail
+// -----------------------------------------------------------------------------
+//
+void TestVideCollectionWrapper_p::testGetModelInitFail()
+{
+ QVERIFY(mTestObject);
+
+ VideoSortFilterProxyModel *proxyGotten = 0;
+ int type = -1;
+
+ // source model init fails
+ VideoListDataModel::mInitFails = true;
+ type = VideoCollectionWrapper::EAllVideos;
+ proxyGotten = mTestObject->getModel(type);
+ QVERIFY(!proxyGotten);
+
+ VideoListDataModel::mInitFails = false;
+ VideoSortFilterProxyModel::setInitFailure(true);
+
+ // VideoCollectionWrapper::EAllvideos -> init fails
+ type = VideoCollectionWrapper::EAllVideos;
+ proxyGotten = mTestObject->getModel(type);
+ QVERIFY(!proxyGotten);
+
+ // VideoCollectionWrapper::ECollections -> init fails
+ type = VideoCollectionWrapper::ECollections;
+ proxyGotten = mTestObject->getModel(type);
+ QVERIFY(!proxyGotten);
+
+ // VideoCollectionWrapper::EGeneric -> init fails
+ type = VideoCollectionWrapper::EGeneric;
+ proxyGotten = mTestObject->getModel(type);
+ QVERIFY(!proxyGotten);
+
+ type = VideoCollectionWrapper::ECollectionContent;
+ proxyGotten = mTestObject->getModel(type);
+ QVERIFY(!proxyGotten);
+
+ // called with invalid type param
+ type = -1;
+ VideoListDataModel::mInitFails = false;
+ proxyGotten = mTestObject->getModel(type);
+ QVERIFY(!proxyGotten);
+
+}
+
+
+// -----------------------------------------------------------------------------
+// testGetModelSucceed
+// -----------------------------------------------------------------------------
+//
+void TestVideCollectionWrapper_p::testGetModelSucceed()
+{
+ QVERIFY(mTestObject);
+
+ VideoSortFilterProxyModel *proxyGotten = 0;
+ int type = -1;
+ VideoSortFilterProxyModel::setInitFailure(false);
+ // VideoCollectionWrapper::EAllvideos
+ type = VideoCollectionWrapper::EAllVideos;
+ proxyGotten = mTestObject->getModel(type);
+ QVERIFY(proxyGotten);
+ QVERIFY(proxyGotten->mType == type);
+ proxyGotten = mTestObject->getModel(type);
+ QVERIFY(proxyGotten);
+ QVERIFY(proxyGotten->mType == type);
+ delete proxyGotten;
+ proxyGotten = 0;
+
+ // VideoCollectionWrapper::ECollections
+ type = VideoCollectionWrapper::ECollections;
+ proxyGotten = mTestObject->getModel(type);
+ QVERIFY(proxyGotten);
+ QVERIFY(proxyGotten->mType == type);
+ proxyGotten = mTestObject->getModel(type);
+ QVERIFY(proxyGotten);
+ QVERIFY(proxyGotten->mType == type);
+ delete proxyGotten;
+ proxyGotten = 0;
+
+ // VideoCollectionWrapper::EGeneric
+ type = VideoCollectionWrapper::EGeneric;
+ proxyGotten = mTestObject->getModel(type);
+ QVERIFY(proxyGotten);
+ QVERIFY(proxyGotten->mType == type);
+ proxyGotten = mTestObject->getModel(type);
+ QVERIFY(proxyGotten);
+ QVERIFY(proxyGotten->mType == type);
+ delete proxyGotten;
+ proxyGotten = 0;
+
+ // VideoCollectionWrapper::ECollectionContent
+ type = VideoCollectionWrapper::ECollectionContent;
+ proxyGotten = mTestObject->getModel(type);
+ QVERIFY(proxyGotten);
+ QVERIFY(proxyGotten->mType == type);
+ proxyGotten = mTestObject->getModel(type);
+ QVERIFY(proxyGotten);
+ QVERIFY(proxyGotten->mType == type);
+ delete proxyGotten;
+ proxyGotten = 0;
+
+ // called with invalid type param
+ type = -1;
+ VideoListDataModel::mInitFails = false;
+ proxyGotten = mTestObject->getModel(type);
+ QVERIFY(!proxyGotten);
+
+}
+
+// -----------------------------------------------------------------------------
+// testAboutToQuitSlot
+// -----------------------------------------------------------------------------
+//
+void TestVideCollectionWrapper_p::testAboutToQuitSlot()
+{
+ QVERIFY(mTestObject);
+ connect(this, SIGNAL(testSignal()), mTestObject, SLOT(aboutToQuitSlot()));
+
+ VideoSortFilterProxyModel *proxyGotten = 0;
+ int type = -1;
+
+ VideoSortFilterProxyModel::setInitFailure(false);
+ type = VideoCollectionWrapper::EAllVideos;
+ proxyGotten = mTestObject->getModel(type);
+ QVERIFY(proxyGotten);
+ QVERIFY(!mTestObject->mSourceModel.isNull());
+ emit testSignal();
+ QVERIFY(mTestObject->mSourceModel.isNull());
+
+ emit testSignal();
+ QVERIFY(mTestObject->mSourceModel.isNull());
+
+
+ disconnect(this, SIGNAL(testSignal()), mTestObject, SLOT(aboutToQuitSlot()));
+}
+
+
+// End of file
+
+
+
--- a/videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/stub/inc/videocollectionclient.h Thu Apr 01 23:13:36 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,139 +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 videocollectionclient class for CVideoCollectionWrapperPrivate unit tests
-*
-*/
-
-#ifndef __VIDEOCOLLECTIONCLIENT_H
-#define __VIDEOCOLLECTIONCLIENT_H
-
-//#include <mpxmedia.h>
-#include <vcxmyvideosdefs.h>
-
-// FORWARD DECLARATIONS
-class VideoCollectionUtils;
-
-
-class VideoCollectionClient
-{
-
- public: // Constructors and destructor
-
- /**
- * constructor
- *
- */
- VideoCollectionClient();
-
- /**
- * destructor
- *
- */
- virtual ~VideoCollectionClient();
-
- public:
-
- /**
- *
- * if gFailInit is true returns -1
- * if gFailInit is false returns 0
- *
- * @return int
- */
- int initialize();
-
- /**
- *
- * if gFailStartOpen is true returns -1
- * if gFailStartOpen is false returns 0
- *
- * @return int
- */
- int startOpenCollection(int level);
-
-
- /**
- *
- * if gFailMediaPlayback is true returns -1
- * if gFailMediaPlayback is false returns 0
- *
- * @return int
- */
- int openVideo(int mpxId1);
-
-
- /**
- *
- * if gFailMediaDetails is true returns -1
- * if gFailMediaDetails is false returns 0
- *
- * @return int
- */
- int getVideoDetails(int mpxId1);
-
- /**
- * sets gFailInit
- *
- * @param bool
- */
- static void setInitFailure(bool fails);
-
- /**
- * sets gFailStartOpen
- *
- * @param bool
- */
- static void setStartopenFailure(bool fails);
-
-
- /**
- * sets gFailMediaPlayback
- *
- * @param bool
- */
- static void setOpenMediaplaybackFailure(bool fails);
-
- /**
- * sets gFailMediaDetails
- *
- * @param bool
- */
- static void setOpenMediaDetailsFailure(bool fails);
-
- /**
- * sets gFailSetSort
- *
- * @param bool
- */
- static void setSortMediasFailure(bool fails);
-
- /**
- * returns gSettedSortOrder
- *
- * @return TVcxMyVideosSortingOrder
- */
- static TVcxMyVideosSortingOrder getSettedSortOrder();
-
- private:
-
- /**
- * tatic instance from this class
- */
- static VideoCollectionClient *testInstance;
-
-
-};
-
-#endif // __VIDEOCOLLECTIONCLIENT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/stub/inc/videocollectionwrapper.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,35 @@
+
+/**
+* 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 videocollectionwrapper class for CVideoCollectionWrapperPrivate unit tests
+*
+*/
+
+#ifndef __VIDEOCOLLECTIONWRAPPER_H__
+#define __VIDEOCOLLECTIONWRAPPER_H__
+
+class VideoCollectionWrapper
+{
+
+public: // Constructor
+
+ enum TModelType
+ {
+ EAllVideos,
+ ECollections,
+ EGeneric,
+ ECollectionContent
+ };
+};
+#endif // __VIDEOCOLLECTIONWRAPPER_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/stub/inc/videolistdatamodel.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,120 @@
+
+/**
+* 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 VideoListDataModel class for VideoCollectionWrapperPrivate unit tests
+*
+*/
+
+#ifndef __STUB_VIDEOLISTDATAMODEL_H
+#define __STUB_VIDEOLISTDATAMODEL_H
+
+#include <QObject>
+#include <qabstractitemmodel.h>
+
+
+// FORWARD DECLARATIONS
+class VideoCollectionClient;
+
+
+class VideoListDataModel : public QAbstractItemModel
+{
+
+ Q_OBJECT
+
+public: // Constructors and destructor
+
+ /**
+ * constructor
+ *
+ */
+ VideoListDataModel(QObject *parent = 0);
+
+ /**
+ * destructor
+ */
+ virtual ~VideoListDataModel();
+
+public:
+
+ /**
+ * if gInitFails is true, return -1
+ * if gInitFails is false, return 0
+ *
+ * @param not used
+ *
+ * @return int
+ */
+ int initialize();
+
+ /**
+ * if gFetchMediaIDFails is true, return -1
+ * if gFetchMediaIDFails is false, return 0
+ *
+ * @param not used
+ *
+ * @return int
+ */
+ int mediaIdAtIndex(int index) const;
+
+signals:
+
+ /**
+ * not used ion stub, but needed to make sure testable object is linked correctly
+ */
+ void fullVideoDetailsReady(int index);
+
+public: // from QAbstractItemModel
+
+ /**
+ * not used ion stub, but needed to make sure testable object is linked correctly
+ */
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+
+ /**
+ * not used ion stub, but needed to make sure testable object is linked correctly
+ */
+ QMap<int, QVariant> itemData(const QModelIndex &index) const;
+
+ /**
+ * not used ion stub, but needed to make sure testable object is linked correctly
+ */
+ QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
+
+ /**
+ * not used ion stub, but needed to make sure testable object is linked correctly
+ */
+ int columnCount(const QModelIndex & parent = QModelIndex()) const;
+
+ /**
+ * not used ion stub, but needed to make sure testable object is linked correctly
+ */
+ QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const;
+
+ /**
+ * not used ion stub, but needed to make sure testable object is linked correctly
+ */
+ QModelIndex parent(const QModelIndex & index) const;
+
+ /*
+ * returns gFailDeleteFile
+ */
+ bool removeRows( QModelIndexList list);
+
+ /**
+ * if true, initialize returns -1
+ */
+ static bool mInitFails;
+};
+
+#endif // __STUB_VIDEOLISTDATAMODEL_H
--- a/videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/stub/inc/videosortfilterproxymodel.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/stub/inc/videosortfilterproxymodel.h Thu Apr 01 23:22:15 2010 +0300
@@ -36,7 +36,7 @@
* @param parent parent of this widget
* @param client Collection client pointer to use.
*/
- VideoSortFilterProxyModel(QObject *parent=0);
+ VideoSortFilterProxyModel( int type, QObject *parent=0);
/**
* Destructor.
@@ -56,49 +56,7 @@
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(int level);
-
- /**
- * Starts sorting using idle timer: starts timer with zero
- * interval. When system has time to run timer sort() -method
- * is called.
- *
- */
- void doSorting(int role, Qt::SortOrder order, bool async = true);
-
- /**
- * 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 index index of the item to be opened
- * @return int 0 succeeds, <0 if opening does not succeed.
- */
- int openItem(const QModelIndex &index);
-
- /**
- * 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);
+
/**
* sets gInitFails
@@ -106,24 +64,7 @@
* @param bool
*/
static void setInitFailure(bool fails);
-
-signals:
- /**
- * Signal to be emitted if detail fetching started ok
- *
- * @param index, index of the item
- */
- void shortDetailsReady(int index);
-
- /**
- * Signal to be emitted after all details are being fetched.
- *
- * @param index, index of the item
- */
- void fullDetailsReady(int index);
-
-private:
/**
* Pointer to the actual model.
@@ -132,20 +73,10 @@
VideoListDataModel *mModel;
/**
- * Currently open level.
- */
- int mLevel;
-
- /**
- * sort role
+ * type
*/
- int mWantedSortRole;
-
- /**
- * sort order
- */
- Qt::SortOrder mWantedSortOrder;
-
+ int mType;
+
};
--- a/videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/stub/src/videocollectionclient.cpp Thu Apr 01 23:13:36 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,154 +0,0 @@
-/*
-* Copyright (c) 2008 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 VideoCollectionClient class for VideoCollectionWrapperPrivate unit tests
-*/
-
-
-
-// INCLUDE FILES
-#include <mpxmediaarray.h>
-#include "stub/inc/videocollectionclient.h"
-
-
-VideoCollectionClient* VideoCollectionClient::testInstance = 0;
-
-bool gFailInit = false;
-bool gFailStartOpen = false;
-bool gFailMediaPlayback = false;
-bool gFailMediaDetails = false;
-bool gFailSetSort = false;
-
-
-TVcxMyVideosSortingOrder gSettedSortOrder = EVcxMyVideosSortingNone;
-
-
-// -----------------------------------------------------------------------------
-// setInitFailure
-// -----------------------------------------------------------------------------
-//
-void VideoCollectionClient::setInitFailure(bool fails)
-{
- gFailInit = fails;
-}
-
-// -----------------------------------------------------------------------------
-// setStartopenFailure
-// -----------------------------------------------------------------------------
-//
-void VideoCollectionClient::setStartopenFailure(bool fails)
-{
- gFailStartOpen = fails;
-}
-
-// -----------------------------------------------------------------------------
-// setOpenMediaplaybackFailure
-// -----------------------------------------------------------------------------
-//
-void VideoCollectionClient::setOpenMediaplaybackFailure(bool fails)
-{
- gFailMediaPlayback = fails;
-}
-
-// -----------------------------------------------------------------------------
-// setOpenMediaDetailsFailure
-// -----------------------------------------------------------------------------
-//
-void VideoCollectionClient::setOpenMediaDetailsFailure(bool fails)
-{
- gFailMediaDetails = fails;
-}
-
-// -----------------------------------------------------------------------------
-// setSortMediasFailure
-// -----------------------------------------------------------------------------
-//
-void VideoCollectionClient::setSortMediasFailure(bool fails)
-{
- gFailSetSort = fails;
-}
-
-// -----------------------------------------------------------------------------
-// getSettedSortOrder
-// -----------------------------------------------------------------------------
-//
-TVcxMyVideosSortingOrder VideoCollectionClient::getSettedSortOrder()
-{
- return gSettedSortOrder;
-}
-
-// -----------------------------------------------------------------------------
-// VideoCollectionClient
-// -----------------------------------------------------------------------------
-//
-VideoCollectionClient::VideoCollectionClient()
-{
- testInstance = this;
-}
-
-// -----------------------------------------------------------------------------
-// ~VideoCollectionClient
-// -----------------------------------------------------------------------------
-//
-VideoCollectionClient::~VideoCollectionClient()
-{
-}
-
-// -----------------------------------------------------------------------------
-// initialize
-// -----------------------------------------------------------------------------
-//
-int VideoCollectionClient::initialize()
-{
- if(gFailInit)
- {
- return -1;
- }
- return 0;
-}
-
-
-int VideoCollectionClient::startOpenCollection(int level)
-{
- if(gFailStartOpen)
- {
- return -1;
- }
- return 0;
-}
-
-// -----------------------------------------------------------------------------
-// openVideo
-// -----------------------------------------------------------------------------
-//
-int VideoCollectionClient::openVideo(int /*mpxId1*/)
-{
- if(gFailMediaPlayback)
- {
- return -1;
- }
- return 0;
-}
-
-// -----------------------------------------------------------------------------
-// deleteFile
-// -----------------------------------------------------------------------------
-//
-int VideoCollectionClient::getVideoDetails(int /*mpxId1*/)
-{
- if(gFailMediaDetails)
- {
- return -1;
- }
- return 0;
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/stub/src/videolistdatamodel.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,128 @@
+/*
+* Copyright (c) 2008 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 VideoListDataModel class for VideoCollectionWrapperPrivate unit tests
+*/
+
+
+#include "videolistdatamodel.h"
+
+bool VideoListDataModel::mInitFails = false;
+
+// -----------------------------------------------------------------------------
+// VideoListDataModel
+// -----------------------------------------------------------------------------
+//
+VideoListDataModel::VideoListDataModel(QObject *parent)
+ : QAbstractItemModel(parent)
+{
+}
+
+// -----------------------------------------------------------------------------
+// ~VideoListDataModel
+// -----------------------------------------------------------------------------
+//
+VideoListDataModel::~VideoListDataModel()
+{
+}
+
+// -----------------------------------------------------------------------------
+// initialize
+// -----------------------------------------------------------------------------
+//
+int VideoListDataModel::initialize()
+{
+ if(mInitFails)
+ {
+ return -1;
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// mediaIdAtIndex
+// -----------------------------------------------------------------------------
+//
+int VideoListDataModel::mediaIdAtIndex(int /*index*/) const
+{
+ return 1;
+}
+
+// -----------------------------------------------------------------------------
+// rowCount
+// -----------------------------------------------------------------------------
+//
+int VideoListDataModel::rowCount(const QModelIndex &/*parent*/) const
+{
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// itemData
+// -----------------------------------------------------------------------------
+//
+QMap<int, QVariant> VideoListDataModel::itemData(const QModelIndex &/*index*/) const
+{
+ QMap<int, QVariant> itemData;
+
+ return itemData;
+}
+
+// -----------------------------------------------------------------------------
+// data
+// -----------------------------------------------------------------------------
+//
+QVariant VideoListDataModel::data(const QModelIndex & /*index*/, int /*role*/) const
+{
+ QVariant returnValue = QVariant();
+ return returnValue;
+}
+
+// -----------------------------------------------------------------------------
+// columnCount
+// -----------------------------------------------------------------------------
+//
+int VideoListDataModel::columnCount(const QModelIndex & /*parent*/) const
+{
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// index
+// -----------------------------------------------------------------------------
+//
+QModelIndex VideoListDataModel::index(int /*row*/, int /*column*/, const QModelIndex & /*parent*/) const
+{
+ return QModelIndex();
+}
+
+// -----------------------------------------------------------------------------
+// parent
+// -----------------------------------------------------------------------------
+//
+QModelIndex VideoListDataModel::parent(const QModelIndex & /*index*/) const
+{
+ return QModelIndex();
+}
+
+// -----------------------------------------------------------------------------
+// removeRows
+// -----------------------------------------------------------------------------
+//
+bool VideoListDataModel::removeRows( QModelIndexList /*list*/)
+{
+ return true;
+}
+//end of file
+
+
--- a/videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/stub/src/videosortfilterproxymodel.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/stub/src/videosortfilterproxymodel.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -43,11 +43,10 @@
// VideoSortFilterProxyModel::VideoSortFilterProxyModel
// -----------------------------------------------------------------------------
//
-VideoSortFilterProxyModel::VideoSortFilterProxyModel(QObject *parent) :
+VideoSortFilterProxyModel::VideoSortFilterProxyModel(int type, QObject *parent) :
QObject(parent),
mModel(0),
- mLevel(-1),
- mWantedSortRole(VideoCollectionCommon::KeyDateTime)
+ mType(type)
{
}
@@ -68,53 +67,4 @@
mModel = sourceModel;
return gInitFails ? -1 : 0;
}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::open
-// -----------------------------------------------------------------------------
-//
-int VideoSortFilterProxyModel::open(int level)
-{
- mLevel = level;
- return 0;
-}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::doSorting
-// -----------------------------------------------------------------------------
-//
-void VideoSortFilterProxyModel::doSorting(int role, Qt::SortOrder order, bool async)
-{
- Q_UNUSED(async);
- mWantedSortRole = role;
- mWantedSortOrder = order;
-}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::deleteItems
-// -----------------------------------------------------------------------------
-//
-int VideoSortFilterProxyModel::deleteItems(const QModelIndexList &indexList)
-{
- return -1;
-}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::openItem
-// -----------------------------------------------------------------------------
-//
-int VideoSortFilterProxyModel::openItem(const QModelIndex &index)
-{
- return -1;
-}
-
-// -----------------------------------------------------------------------------
-// VideoSortFilterProxyModel::fetchItemDetails
-// -----------------------------------------------------------------------------
-//
-int VideoSortFilterProxyModel::fetchItemDetails(const QModelIndex &index)
-{
- return -1;
-}
-
// end of file
--- a/videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/testvideocollectionwrapper_p.pro Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/testvideocollectionwrapper_p.pro Thu Apr 01 23:22:15 2010 +0300
@@ -25,13 +25,12 @@
# Input
HEADERS += inc/testvideocollectionwrapper_p.h \
- stub/inc/videocollectionclient.h \
stub/inc/videosortfilterproxymodel.h \
stub/inc/videolistdatamodel.h \
+ stub/inc/videocollectionwrapper.h \
../../inc/videocollectionwrapper_p.h
SOURCES += src/testvideocollectionwrapper_p.cpp \
- stub/src/videocollectionclient.cpp \
stub/src/videosortfilterproxymodel.cpp \
stub/src/videolistdatamodel.cpp \
../../src/videocollectionwrapper_p.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideodatacontainer/inc/testvideodatacontainer.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,136 @@
+/*
+* 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:
+*
+*/
+
+
+
+#ifndef __TESTVIDEOLISTDATA_H__
+#define __TESTVIDEOLISTDATA_H__
+
+
+// INCLUDES
+#include <QtTest/QtTest>
+
+class MediaObjectFactory;
+class VideoDataContainer;
+
+
+class TestVideoDataContainer : public QObject
+{
+ Q_OBJECT
+
+
+ // test functions for the test framework
+private slots:
+ /**
+ * called before anything else when test starts
+ */
+ void initTestCase();
+
+ /**
+ * will be called before each testfunction is executed.
+ *
+ */
+ void init();
+
+ /**
+ * will be called after every testfunction.
+ *
+ */
+ void cleanup();
+
+ /**
+ * will be called after testing ends
+ *
+ */
+ void cleanupTestCase();
+
+ /**
+ * Verifies clear
+ */
+ void testClear();
+
+ /**
+ * Verifies remove
+ */
+ void testRemove();
+
+ /**
+ * Verifies append
+ */
+ void testAppend();
+
+ /**
+ * Verifies fromIndex
+ */
+ void testFromIndex();
+
+ /**
+ * Verifies indexOfId
+ */
+ void testIndexOfId();
+
+ /**
+ * Verifies idFromIndex
+ */
+ void testIdFromIndex();
+
+ /**
+ * Verifies count
+ */
+ void testCount();
+
+ /**
+ * verifies markItemRemoved
+ */
+ void testMarkItemRemoved();
+
+ /**
+ * verifies clearRemoved
+ */
+ void testClearRemoved();
+
+ /**
+ * verifies restoreRemovedItems
+ */
+ void testRestoreRemovedItems();
+
+ /**
+ * verifies getRemovedMedia
+ */
+ void testGetRemovedMedia();
+
+private:
+
+ /**
+ * object under test
+ */
+ VideoDataContainer *mTestObject;
+
+ /**
+ * CMPXMedia -object factory.
+ */
+ MediaObjectFactory *mMediaFactory;
+
+};
+
+
+#endif // __TESTVIDEOLISTDATA_H__
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideodatacontainer/src/testvideodatacontainer.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,594 @@
+/*
+* 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:
+*
+*/
+
+// INCLUDES
+
+#include "testvideodatacontainer.h"
+#include "mediaobjectfactory.h"
+#include "videocollectionutils.h"
+#include <mpxmedia.h>
+#include <mpxmediageneraldefs.h>
+#include <qhash.h>
+
+
+#define private public
+#include "videodatacontainer.h"
+#undef private
+
+const int MEDIA_COUNT = 10;
+
+/**
+ * global qHash function required fo creating hash values for TMPXItemId -keys
+ */
+inline uint qHash(TMPXItemId key)
+{
+ QPair<uint, uint> keyPair(key.iId1, key.iId2);
+
+ return qHash(keyPair);
+}
+
+// -----------------------------------------------------------------------------
+// main
+// -----------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ Q_UNUSED(argc);
+
+ TestVideoDataContainer 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\\testvideodatacontainer.txt";
+ res = QTest::qExec(&tv, 3, pass);
+ }
+
+ return res;
+}
+
+// -----------------------------------------------------------------------------
+// initTestCase
+// -----------------------------------------------------------------------------
+//
+void TestVideoDataContainer::initTestCase()
+{
+ mTestObject = 0;
+ mMediaFactory = new MediaObjectFactory();
+}
+
+// -----------------------------------------------------------------------------
+// cleanupTestCase
+// -----------------------------------------------------------------------------
+//
+void TestVideoDataContainer::cleanupTestCase()
+{
+ delete mMediaFactory;
+}
+
+// -----------------------------------------------------------------------------
+// init
+// -----------------------------------------------------------------------------
+//
+void TestVideoDataContainer::init()
+{
+ mTestObject = new VideoDataContainer();
+}
+
+// -----------------------------------------------------------------------------
+// cleanup
+// -----------------------------------------------------------------------------
+//
+void TestVideoDataContainer::cleanup()
+{
+ delete mTestObject;
+}
+
+// -----------------------------------------------------------------------------
+// testClear
+// -----------------------------------------------------------------------------
+//
+void TestVideoDataContainer::testClear()
+{
+ User::Heap().__DbgMarkStart();
+ QVERIFY(mTestObject->count() == 0);
+ // add few items to container
+ for(int i = 0; i < MEDIA_COUNT; ++i)
+ {
+ mTestObject->append(mMediaFactory->getMedia(i));
+ }
+ QVERIFY(mTestObject->count() == MEDIA_COUNT);
+
+ mTestObject->clear();
+ QVERIFY(mTestObject->count() == 0);
+ int remHeap = User::Heap().__DbgMarkEnd(0);
+ QVERIFY(remHeap == 0);
+
+ User::Heap().__DbgMarkStart();
+ mTestObject->clear();
+ remHeap = User::Heap().__DbgMarkEnd(0);
+ QVERIFY(remHeap == 0);
+
+}
+
+// -----------------------------------------------------------------------------
+// testRemove
+// -----------------------------------------------------------------------------
+//
+void TestVideoDataContainer::testRemove()
+{
+ // add few items to container (id = i, index = i)
+ int i;
+ for(i = 0; i < MEDIA_COUNT; ++i)
+ {
+ mTestObject->append(mMediaFactory->getMedia(i));
+ }
+ QVERIFY(mTestObject->count() == MEDIA_COUNT);
+
+ // invalid indexes
+ mTestObject->remove(-1);
+ QVERIFY(mTestObject->count() == MEDIA_COUNT);
+ mTestObject->remove(MEDIA_COUNT);
+ QVERIFY(mTestObject->count() == MEDIA_COUNT);
+
+ QHash<TMPXItemId, QPair<int, CMPXMedia*> >::const_iterator iter;
+ // at this point, indexes and ids are in sync
+ for(i = 0; i < mTestObject->count(); ++i)
+ {
+ iter = mTestObject->mMediaData.find(mTestObject->mMediaIds[i]);
+ QVERIFY(iter != mTestObject->mMediaData.constEnd());
+ QVERIFY(iter.key().iId1 == i);
+ QVERIFY(iter->first == i);
+ }
+
+ // remove first item
+ TMPXItemId id(0,0);
+ mTestObject->remove(id);
+ QVERIFY(mTestObject->count() == MEDIA_COUNT - 1);
+ // at this point, indexes after recently removed first
+ // item have decreased by one (whereas ids increase by one)
+ for(i = 0; i < mTestObject->count(); ++i)
+ {
+ iter = mTestObject->mMediaData.find(mTestObject->mMediaIds[i]);
+ QVERIFY(iter != mTestObject->mMediaData.constEnd());
+ QVERIFY(iter.key().iId1 == i + 1);
+ QVERIFY(iter->first == i );
+
+ }
+
+ // reset
+ mTestObject->clear();
+ // (id = i, index = i)
+ for(int i = 0; i < MEDIA_COUNT; ++i)
+ {
+ mTestObject->append(mMediaFactory->getMedia(i));
+ }
+
+ // remove from the middle
+ id.iId1 = MEDIA_COUNT / 2;
+ mTestObject->remove(id);
+ QVERIFY(mTestObject->count() == MEDIA_COUNT - 1);
+
+ // at this point, indexes after recently removed middle
+ // item have decreased by one (whereas ids increase by one)
+ for(i = 0; i < mTestObject->count(); ++i)
+ {
+ iter = mTestObject->mMediaData.find(mTestObject->mMediaIds[i]);
+ QVERIFY(iter != mTestObject->mMediaData.constEnd());
+ if( i < MEDIA_COUNT / 2)
+ {
+ QVERIFY(iter.key().iId1 == i);
+ QVERIFY(iter->first == i);
+ }
+ else
+ {
+ QVERIFY(iter.key().iId1 == i + 1);
+ QVERIFY(iter->first == i);
+ }
+ }
+
+
+ // reset
+ mTestObject->clear();
+ // (id = i, index = i)
+ for(int i = 0; i < MEDIA_COUNT; ++i)
+ {
+ mTestObject->append(mMediaFactory->getMedia(i));
+ }
+
+ // remove from the end
+ id.iId1 = MEDIA_COUNT - 1;
+ mTestObject->remove(id);
+ QVERIFY(mTestObject->count() == MEDIA_COUNT - 1);
+ TMPXItemId checkId;
+ for(i = 0; i < mTestObject->count(); ++i)
+ {
+ checkId.iId1 = i;
+ checkId.iId2 = 0;
+ iter = mTestObject->mMediaData.find(checkId);
+ QVERIFY(iter != mTestObject->mMediaData.constEnd());
+ QVERIFY(iter.key().iId1 == i);
+ QVERIFY(iter->first == i);
+ }
+ mTestObject->clear();
+
+}
+
+// -----------------------------------------------------------------------------
+// testAppend
+// -----------------------------------------------------------------------------
+//
+void TestVideoDataContainer::testAppend()
+{
+ // append null object
+ mTestObject->append(0);
+ QVERIFY(mTestObject->count() == 0);
+
+ // new item
+ mTestObject->append(mMediaFactory->getMedia(1));
+ QVERIFY(mTestObject->count() == 1);
+ QString name;
+ VideoCollectionUtils::instance().mediaValue<QString>(mTestObject->fromIndex(0), KMPXMediaGeneralTitle, name );
+ QVERIFY(name == "MEDIATESTNAME_1");
+
+ // existing item without data (except id)-> does not overwrite existing
+ name = "";
+ mTestObject->append(mMediaFactory->getMedia(1, MediaDataId));
+ QVERIFY(mTestObject->count() == 1);
+ VideoCollectionUtils::instance().mediaValue<QString>(mTestObject->fromIndex(0), KMPXMediaGeneralTitle, name );
+ QVERIFY(name == "MEDIATESTNAME_1");
+
+ // new unexistent item
+ mTestObject->append(mMediaFactory->getMedia(2));
+ QVERIFY(mTestObject->count() == 2);
+ VideoCollectionUtils::instance().mediaValue<QString>(mTestObject->fromIndex(1), KMPXMediaGeneralTitle, name );
+ QVERIFY(name == "MEDIATESTNAME_2");
+
+ // item exists in removed -list
+ mTestObject->append(mMediaFactory->getMedia(3));
+ QVERIFY(mTestObject->count() == 3);
+ mTestObject->markItemRemoved(2);
+ mTestObject->append(mMediaFactory->getMedia(3));
+ QVERIFY(mTestObject->count() == 2);
+
+ mTestObject->clear();
+}
+
+// -----------------------------------------------------------------------------
+// testFromIndex
+// -----------------------------------------------------------------------------
+//
+void TestVideoDataContainer::testFromIndex()
+{
+ QVERIFY(mTestObject->fromIndex(-1) == 0);
+ QVERIFY(mTestObject->fromIndex(0) == 0);
+ QVERIFY(mTestObject->fromIndex(1) == 0);
+
+ // add few items to container (id = i, index = i)
+ for(int i = 0; i < MEDIA_COUNT; ++i)
+ {
+ mTestObject->append(mMediaFactory->getMedia(i));
+ }
+ int id = -1;
+ QVERIFY(mTestObject->count() == MEDIA_COUNT);
+ QVERIFY(mTestObject->fromIndex(-1) == 0);
+
+ QVERIFY(mTestObject->fromIndex(0) != 0);
+ VideoCollectionUtils::instance().mediaValue<int>(mTestObject->fromIndex(0), KMPXMediaGeneralId, id );
+ QVERIFY(id == 0);
+
+ QVERIFY(mTestObject->fromIndex(1) != 0);
+ VideoCollectionUtils::instance().mediaValue<int>(mTestObject->fromIndex(1), KMPXMediaGeneralId, id );
+ QVERIFY(id == 1);
+
+ QVERIFY(mTestObject->fromIndex(MEDIA_COUNT-1) != 0);
+ VideoCollectionUtils::instance().mediaValue<int>(mTestObject->fromIndex(MEDIA_COUNT-1), KMPXMediaGeneralId, id );
+ QVERIFY(id == MEDIA_COUNT-1);
+
+ QVERIFY(mTestObject->fromIndex(MEDIA_COUNT) == 0);
+ mTestObject->clear();
+}
+
+// -----------------------------------------------------------------------------
+// testIndexOfId
+// -----------------------------------------------------------------------------
+//
+void TestVideoDataContainer::testIndexOfId()
+{
+
+ QVERIFY(mTestObject->indexOfId(TMPXItemId::InvalidId()) == -1);
+ QVERIFY(mTestObject->indexOfId(TMPXItemId(0,0)) == -1);
+ QVERIFY(mTestObject->indexOfId(TMPXItemId(1,0)) == -1);
+
+ // add few items to container (id = i, index = i)
+ for(int i = 0; i < MEDIA_COUNT; ++i)
+ {
+ mTestObject->append(mMediaFactory->getMedia(i));
+ }
+ QVERIFY(mTestObject->indexOfId(TMPXItemId::InvalidId()) == -1);
+ QVERIFY(mTestObject->indexOfId(TMPXItemId(0,0)) == 0);
+ QVERIFY(mTestObject->indexOfId(TMPXItemId(1,0)) == 1);
+ QVERIFY(mTestObject->indexOfId(TMPXItemId(MEDIA_COUNT - 1, 0)) == MEDIA_COUNT - 1);
+ QVERIFY(mTestObject->indexOfId(TMPXItemId(MEDIA_COUNT, 0)) == -1);
+
+ // remove one item at the middle of the list (id is same than index at this point)
+ mTestObject->remove(TMPXItemId(MEDIA_COUNT / 2, 0));
+ QVERIFY(mTestObject->indexOfId(TMPXItemId(0,0)) == 0);
+ QVERIFY(mTestObject->indexOfId(TMPXItemId(1,0)) == 1);
+ QVERIFY(mTestObject->indexOfId(TMPXItemId(MEDIA_COUNT - 1, 0)) == MEDIA_COUNT - 2);
+ QVERIFY(mTestObject->indexOfId(TMPXItemId(MEDIA_COUNT - 2, 0)) == MEDIA_COUNT - 3);
+ QVERIFY(mTestObject->indexOfId(TMPXItemId(MEDIA_COUNT, 0)) == -1);
+ mTestObject->clear();
+}
+
+// -----------------------------------------------------------------------------
+// testIdFromIndex
+// -----------------------------------------------------------------------------
+//
+void TestVideoDataContainer::testIdFromIndex()
+{
+ QVERIFY(mTestObject->idFromIndex(-1) == TMPXItemId::InvalidId());
+ QVERIFY(mTestObject->idFromIndex(0) == TMPXItemId::InvalidId());
+ QVERIFY(mTestObject->idFromIndex(1) == TMPXItemId::InvalidId());
+ // add few items to container (id = i, index = i)
+ for(int i = 0; i < MEDIA_COUNT; ++i)
+ {
+ mTestObject->append(mMediaFactory->getMedia(i));
+ }
+ QVERIFY(mTestObject->idFromIndex(-1) == TMPXItemId::InvalidId());
+ QVERIFY(mTestObject->idFromIndex(0).iId1 == 0);
+ QVERIFY(mTestObject->idFromIndex(1).iId1 == 1);
+ QVERIFY(mTestObject->idFromIndex(MEDIA_COUNT - 1).iId1 == MEDIA_COUNT - 1);
+ QVERIFY(mTestObject->idFromIndex(MEDIA_COUNT) == TMPXItemId::InvalidId());
+
+ // remove one item at the middle of the list (id is same than index at this point)
+ mTestObject->remove(TMPXItemId(MEDIA_COUNT / 2,0));
+ QVERIFY(mTestObject->idFromIndex(0).iId1 == 0);
+ QVERIFY(mTestObject->idFromIndex(1).iId1 == 1);
+ QVERIFY(mTestObject->idFromIndex(MEDIA_COUNT - 1) == TMPXItemId::InvalidId());
+ QVERIFY(mTestObject->idFromIndex(MEDIA_COUNT - 2).iId1 == MEDIA_COUNT - 1);
+ QVERIFY(mTestObject->idFromIndex(MEDIA_COUNT) == TMPXItemId::InvalidId());
+ mTestObject->clear();
+
+}
+
+// -----------------------------------------------------------------------------
+// testCount
+// -----------------------------------------------------------------------------
+//
+void TestVideoDataContainer::testCount()
+{
+ // this is mostly tested in other parts of tests,
+ // but let's just add few trivial cases
+ QVERIFY(mTestObject->count() == 0);
+
+ mTestObject->append(mMediaFactory->getMedia(0));
+ QVERIFY(mTestObject->count() == 1);
+
+ for(int i = 1; i < MEDIA_COUNT; ++i)
+ {
+ mTestObject->append(mMediaFactory->getMedia(i));
+ }
+ QVERIFY(mTestObject->count() == MEDIA_COUNT);
+ mTestObject->remove(TMPXItemId(MEDIA_COUNT / 2, 0));
+ QVERIFY(mTestObject->count() == MEDIA_COUNT - 1);
+ mTestObject->clear();
+}
+
+void TestVideoDataContainer::testMarkItemRemoved()
+{
+ int i;
+ for(i = 0; i < MEDIA_COUNT; ++i)
+ {
+ mTestObject->append(mMediaFactory->getMedia(i));
+ }
+ QVERIFY(mTestObject->count() == MEDIA_COUNT);
+
+ // invalid item at index
+ QVERIFY(mTestObject->markItemRemoved(MEDIA_COUNT) == TMPXItemId::InvalidId());
+
+ // item not in removed -list
+ QVERIFY(mTestObject->count() == MEDIA_COUNT);
+ TMPXItemId id = mTestObject->idFromIndex(0);
+ QVERIFY(mTestObject->markItemRemoved(0) == id);
+ QVERIFY(mTestObject->count() == MEDIA_COUNT - 1);
+
+ // at this point, indexes after recently marked first
+ // item have decreased by one (whereas ids increase by one)
+ QHash<TMPXItemId, QPair<int, CMPXMedia*> >::const_iterator iter;
+ for(i = 0; i < mTestObject->count(); ++i)
+ {
+ iter = mTestObject->mMediaData.find(mTestObject->mMediaIds[i]);
+ QVERIFY(iter != mTestObject->mMediaData.constEnd());
+ QVERIFY(iter.key().iId1 == i + 1);
+ QVERIFY(iter->first == i );
+
+ }
+ CMPXMedia *media = 0;
+ id = mTestObject->idFromIndex(0);
+ // item already at removed -list
+ mTestObject->mRemovedMedia[id] = media;
+ QVERIFY(mTestObject->markItemRemoved(0) == id);
+ QVERIFY(mTestObject->count() == MEDIA_COUNT - 2);
+
+}
+
+void TestVideoDataContainer::testClearRemoved()
+{
+ int i;
+ for(i = 0; i < MEDIA_COUNT; ++i)
+ {
+ mTestObject->append(mMediaFactory->getMedia(i));
+ }
+ QVERIFY(mTestObject->count() == MEDIA_COUNT);
+ for(i = MEDIA_COUNT; i >= 0; --i)
+ {
+ mTestObject->markItemRemoved(i);
+ }
+ QVERIFY(mTestObject->count() == 0);
+ QVERIFY(mTestObject->mRemovedMedia.count() == MEDIA_COUNT);
+
+ // null idlist provided
+ QVERIFY(mTestObject->clearRemoved(0) == MEDIA_COUNT);
+ QVERIFY(mTestObject->count() == 0);
+ QVERIFY(mTestObject->mRemovedMedia.count() == 0);
+
+ for(i = 0; i < MEDIA_COUNT; ++i)
+ {
+ mTestObject->append(mMediaFactory->getMedia(i));
+ }
+ QVERIFY(mTestObject->count() == MEDIA_COUNT);
+ for(i = MEDIA_COUNT; i >= 0; --i)
+ {
+ mTestObject->markItemRemoved(i);
+ }
+ QVERIFY(mTestObject->count() == 0);
+ QVERIFY(mTestObject->mRemovedMedia.count() == MEDIA_COUNT);
+
+ // empty id list
+ QList<TMPXItemId> idList;
+ QVERIFY(mTestObject->clearRemoved(&idList) == 0);
+ QVERIFY(mTestObject->count() == 0);
+ QVERIFY(mTestObject->mRemovedMedia.count() == MEDIA_COUNT);
+
+ // id list containing some ids
+ idList.append(TMPXItemId(0,0));
+ idList.append(TMPXItemId(MEDIA_COUNT/2,0));
+ idList.append(TMPXItemId(MEDIA_COUNT - 1,0));
+ idList.append(TMPXItemId(MEDIA_COUNT,0));
+ QVERIFY(mTestObject->clearRemoved(&idList) == 3);
+ QVERIFY(mTestObject->count() == 0);
+ QVERIFY(mTestObject->mRemovedMedia.count() == MEDIA_COUNT - 3);
+
+}
+
+void TestVideoDataContainer::testRestoreRemovedItems()
+{
+ int i;
+ for(i = 0; i < MEDIA_COUNT; ++i)
+ {
+ mTestObject->append(mMediaFactory->getMedia(i));
+ }
+ QVERIFY(mTestObject->count() == MEDIA_COUNT);
+ for(i = MEDIA_COUNT; i >= 0; --i)
+ {
+ mTestObject->markItemRemoved(i);
+ }
+ QVERIFY(mTestObject->count() == 0);
+ QVERIFY(mTestObject->mRemovedMedia.count() == MEDIA_COUNT);
+
+ // null id list, restores all
+ QVERIFY(mTestObject->restoreRemovedItems(0) == MEDIA_COUNT);
+ QVERIFY(mTestObject->count() == MEDIA_COUNT);
+ QVERIFY(mTestObject->mRemovedMedia.count() == 0);
+
+ for(i = 0; i < MEDIA_COUNT; ++i)
+ {
+ mTestObject->append(mMediaFactory->getMedia(i));
+ }
+ QVERIFY(mTestObject->count() == MEDIA_COUNT);
+ for(i = MEDIA_COUNT; i >= 0; --i)
+ {
+ mTestObject->markItemRemoved(i);
+ }
+ QVERIFY(mTestObject->count() == 0);
+ QVERIFY(mTestObject->mRemovedMedia.count() == MEDIA_COUNT);
+
+ // second null id list, restores all
+ QVERIFY(mTestObject->restoreRemovedItems(0) == MEDIA_COUNT);
+ QVERIFY(mTestObject->count() == MEDIA_COUNT);
+ QVERIFY(mTestObject->mRemovedMedia.count() == 0);
+
+ mTestObject->clear();
+ for(i = 0; i < MEDIA_COUNT; ++i)
+ {
+ mTestObject->append(mMediaFactory->getMedia(i));
+ }
+ QVERIFY(mTestObject->count() == MEDIA_COUNT);
+ for(i = MEDIA_COUNT; i >= 0; --i)
+ {
+ mTestObject->markItemRemoved(i);
+ }
+ QVERIFY(mTestObject->count() == 0);
+ QVERIFY(mTestObject->mRemovedMedia.count() == MEDIA_COUNT);
+
+ QList<TMPXItemId> idList;
+ // empty list
+ QVERIFY(mTestObject->restoreRemovedItems(&idList) == 0);
+ QVERIFY(mTestObject->count() == 0);
+ QVERIFY(mTestObject->mRemovedMedia.count() == MEDIA_COUNT);
+
+ // some items with collection doesn't match
+ idList.append(TMPXItemId(0,0));
+ idList.append(TMPXItemId(MEDIA_COUNT/2,0));
+ idList.append(TMPXItemId(MEDIA_COUNT - 1,0));
+ idList.append(TMPXItemId(MEDIA_COUNT,0));
+ QVERIFY(mTestObject->restoreRemovedItems(&idList) == 3);
+ QVERIFY(mTestObject->count() == 3);
+ QVERIFY(mTestObject->mRemovedMedia.count() == MEDIA_COUNT - 3);
+ mTestObject->clearRemoved(0);
+ mTestObject->clear();
+ for(i = 0; i < MEDIA_COUNT; ++i)
+ {
+ mTestObject->append(mMediaFactory->getMedia(i));
+ }
+ QVERIFY(mTestObject->count() == MEDIA_COUNT);
+ for(i = MEDIA_COUNT; i >= 0; --i)
+ {
+ mTestObject->markItemRemoved(i);
+ }
+ QVERIFY(mTestObject->count() == 0);
+ QVERIFY(mTestObject->mRemovedMedia.count() == MEDIA_COUNT);
+
+ // some items with collection matching
+ QVERIFY(mTestObject->restoreRemovedItems(&idList) == 3);
+ QVERIFY(mTestObject->count() == 3);
+ QVERIFY(mTestObject->mRemovedMedia.count() == MEDIA_COUNT - 3);
+}
+
+void TestVideoDataContainer::testGetRemovedMedia()
+{
+ int i;
+ for(i = 0; i < MEDIA_COUNT; ++i)
+ {
+ mTestObject->append(mMediaFactory->getMedia(i));
+ }
+ QVERIFY(mTestObject->count() == MEDIA_COUNT);
+ mTestObject->markItemRemoved(MEDIA_COUNT - 1);
+ mTestObject->markItemRemoved(MEDIA_COUNT / 2);
+ mTestObject->markItemRemoved(0);
+ QVERIFY(mTestObject->count() == MEDIA_COUNT - 3);
+ QVERIFY(mTestObject->mRemovedMedia.count() == 3);
+
+ CMPXMedia *media = 0;
+ media = mTestObject->getRemovedMedia(TMPXItemId(1,0));
+ QVERIFY(!media);
+ media = mTestObject->getRemovedMedia(TMPXItemId(0,0));
+ QVERIFY(media);
+ media = 0;
+ media = mTestObject->getRemovedMedia(TMPXItemId(MEDIA_COUNT - 1,0));
+ QVERIFY(media);
+}
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideodeleteworker/inc/testvideodeleteworker.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,107 @@
+/*
+* 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:
+*
+*/
+
+
+
+#ifndef __TESTVIDEODELETEWORKER_H__
+#define __TESTVIDEODELETEWORKER_H__
+
+
+// INCLUDES
+#include <QtTest/QtTest>
+
+class VideoCollectionClient;
+class VideoDeleteWorker;
+
+
+class TestVideoDeleteWorker : public QObject
+{
+ Q_OBJECT
+
+
+ // test functions for the test framework
+private slots:
+ /**
+ * called before anything else when test starts
+ */
+ void initTestCase();
+
+ /**
+ * will be called before each testfunction is executed.
+ *
+ */
+ void init();
+
+ /**
+ * will be called after every testfunction.
+ *
+ */
+ void cleanup();
+
+ /**
+ * will be called after testing ends
+ *
+ */
+ void cleanupTestCase();
+
+ /**
+ * verifies requestDelete
+ */
+ void testRequestDelete();
+
+ /**
+ * verifies removeFromRequest
+ */
+ void testRemoveFromRequest();
+
+ /**
+ * verifies isDeleting
+ */
+ void testIsDeleting();
+
+ /**
+ * verifies updateStatus, clearStatus
+ * and getLastStatus
+ */
+ void testUpdateStatus();
+
+ /**
+ * verifies continueSlot
+ */
+ void testContinueSlot();
+
+private:
+
+ /**
+ * object under test
+ */
+ VideoDeleteWorker *mTestObject;
+
+ /**
+ * dummy collectionclient.
+ */
+ VideoCollectionClient *mDummyCollection;
+
+};
+
+
+#endif // __TESTVIDEODELETEWORKER_H__
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideodeleteworker/src/testvideodeleteworker.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,302 @@
+/*
+* 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:
+*
+*/
+
+// INCLUDES
+
+#include "testvideodeleteworker.h"
+#include "videocollectionclient.h"
+#include "videocollectioncommon.h"
+#include <QList>
+#include <hbapplication.h>
+
+#define private public
+#include "videodeleteworker.h"
+#undef private
+
+// -----------------------------------------------------------------------------
+// main
+// -----------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ Q_UNUSED(argc);
+ HbApplication app(argc, argv);
+ TestVideoDeleteWorker 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\\testvideodeleteworker.txt";
+ res = QTest::qExec(&tv, 3, pass);
+ }
+
+ return res;
+}
+
+// -----------------------------------------------------------------------------
+// initTestCase
+// -----------------------------------------------------------------------------
+//
+void TestVideoDeleteWorker::initTestCase()
+{
+ qRegisterMetaType<QList<TMPXItemId> >("QList<TMPXItemId>");
+ mTestObject = 0;
+ mDummyCollection = new VideoCollectionClient();
+}
+
+// -----------------------------------------------------------------------------
+// cleanupTestCase
+// -----------------------------------------------------------------------------
+//
+void TestVideoDeleteWorker::cleanupTestCase()
+{
+ delete mTestObject;
+ delete mDummyCollection;
+}
+
+// -----------------------------------------------------------------------------
+// init
+// -----------------------------------------------------------------------------
+//
+void TestVideoDeleteWorker::init()
+{
+ mTestObject = new VideoDeleteWorker(*mDummyCollection);
+}
+
+// -----------------------------------------------------------------------------
+// cleanup
+// -----------------------------------------------------------------------------
+//
+void TestVideoDeleteWorker::cleanup()
+{
+ delete mTestObject;
+ mTestObject = 0;
+}
+
+// -----------------------------------------------------------------------------
+// testRequestDelete
+// -----------------------------------------------------------------------------
+//
+void TestVideoDeleteWorker::testRequestDelete()
+{
+ mDummyCollection->mDeleteFails = false;
+ QList<TMPXItemId> itemIds;
+ // empty list
+ mTestObject->requestDelete(itemIds);
+ QVERIFY(mTestObject->mRemoveBuffer.count() == 0);
+
+ itemIds.append(TMPXItemId(0,0));
+ itemIds.append(TMPXItemId(1,0));
+ itemIds.append(TMPXItemId(2,0));
+ // list contains something
+ mTestObject->requestDelete(itemIds);
+ QVERIFY(mTestObject->mRemoveBuffer.count() == 3);
+
+ itemIds.append(TMPXItemId(2,0));
+ itemIds.append(TMPXItemId(3,0));
+ itemIds.append(TMPXItemId(4,0));
+
+ // second list, make sure data is united
+ mTestObject->requestDelete(itemIds);
+ QVERIFY(mTestObject->mRemoveBuffer.count() == 5);
+
+ QCoreApplication::processEvents();
+ QVERIFY(mTestObject->mRemoveBuffer.count() == 2);
+
+ // delete -call fails
+ QSignalSpy spysignal(mTestObject, SIGNAL( deleteStartupFailed(QList<TMPXItemId>)));
+ mDummyCollection->mDeleteFails = true;
+ itemIds.clear();
+ itemIds.append(TMPXItemId(0,0));
+ mTestObject->requestDelete(itemIds);
+ QVERIFY(mTestObject->mRemoveBuffer.count() == 3);
+
+ QCoreApplication::processEvents();
+ QVERIFY(mTestObject->mRemoveBuffer.count() == 0);
+ QVERIFY(spysignal.count() == 1);
+
+}
+
+// -----------------------------------------------------------------------------
+// testRemoveFromRequest
+// -----------------------------------------------------------------------------
+//
+void TestVideoDeleteWorker::testRemoveFromRequest()
+{
+ QList<TMPXItemId> itemIds;
+ QVERIFY(mTestObject->mRemoveBuffer.count() == 0);
+
+ itemIds.append(TMPXItemId(0,0));
+ itemIds.append(TMPXItemId(1,0));
+ mTestObject->requestDelete(itemIds);
+ TMPXItemId id = TMPXItemId(3,0);
+ QVERIFY(mTestObject->removeFromRequest(id) == 2);
+ id = TMPXItemId(1,0);
+ QVERIFY(mTestObject->removeFromRequest(id) == 1);
+ id = TMPXItemId(2,0);
+ QVERIFY(mTestObject->removeFromRequest(id) == 1);
+ id = TMPXItemId(0,0);
+ QVERIFY(mTestObject->removeFromRequest(id) == 0);
+
+}
+
+// -----------------------------------------------------------------------------
+// testIsDeleting
+// -----------------------------------------------------------------------------
+//
+void TestVideoDeleteWorker::testIsDeleting()
+{
+ QList<TMPXItemId> itemIds;
+
+ itemIds.append(TMPXItemId(0,0));
+ itemIds.append(TMPXItemId(1,0));
+ itemIds.append(TMPXItemId(2,0));
+ itemIds.append(TMPXItemId(3,0));
+ // list contains something
+ mTestObject->requestDelete(itemIds);
+ QVERIFY(mTestObject->mRemoveBuffer.count() == 4);
+ QVERIFY(mTestObject->isDeleting());
+ QCoreApplication::processEvents();
+ QVERIFY(mTestObject->mRemoveBuffer.count() == 1);
+ QVERIFY(mTestObject->isDeleting());
+ itemIds.clear();
+ mTestObject->requestDelete(itemIds);
+ QCoreApplication::processEvents();
+ QVERIFY(mTestObject->mRemoveBuffer.count() == 0);
+ QVERIFY(!mTestObject->isDeleting());
+}
+
+// -----------------------------------------------------------------------------
+// testUpdateStatus
+// -----------------------------------------------------------------------------
+//
+void TestVideoDeleteWorker::testUpdateStatus()
+{
+ int status = 50;
+ QVariant statusData = QVariant();
+ // invalid status is not setted
+ mTestObject->updateStatus(50, statusData);
+ status = mTestObject->getLastStatus(statusData);
+ QVERIFY(status == 0);
+ QVERIFY(!statusData.isValid());
+
+ // if status is not setted and provided as succeed -> setted as succeed
+ status = VideoCollectionCommon::statusDeleteSucceed;
+ mTestObject->updateStatus(status, statusData);
+ status = mTestObject->getLastStatus(statusData);
+ QVERIFY(status == VideoCollectionCommon::statusDeleteSucceed);
+ QVERIFY(!statusData.isValid());
+
+ // if status is not setted or succeed provided as statusSingleDeleteFail -> setted as statusSingleDeleteFail
+ status = VideoCollectionCommon::statusSingleDeleteFail;
+ mTestObject->updateStatus(status, statusData);
+ status = mTestObject->getLastStatus(statusData);
+ QVERIFY(status == VideoCollectionCommon::statusSingleDeleteFail);
+ QVERIFY(!statusData.isValid());
+
+ // if there is failed -status and provided status is succeed, no update
+ status = VideoCollectionCommon::statusDeleteSucceed;
+ mTestObject->updateStatus(status, statusData);
+ status = mTestObject->getLastStatus(statusData);
+ QVERIFY(status == VideoCollectionCommon::statusSingleDeleteFail);
+ QVERIFY(!statusData.isValid());
+
+ // current status single failed, provided multiple, count should be increased
+ status = VideoCollectionCommon::statusMultipleDeleteFail;
+ statusData = 2;
+ mTestObject->updateStatus(status, statusData);
+ status = mTestObject->getLastStatus(statusData);
+ QVERIFY(status == VideoCollectionCommon::statusMultipleDeleteFail);
+ QVERIFY(statusData.toInt() == 3);
+
+ // current status single failed, provided is single failed, status changes into
+ // multiple failed and count becomes 2
+ mTestObject->mLastStatus = VideoCollectionCommon::statusSingleDeleteFail;
+ status = VideoCollectionCommon::statusSingleDeleteFail;
+ mTestObject->updateStatus(status, statusData);
+ status = mTestObject->getLastStatus(statusData);
+ QVERIFY(status == VideoCollectionCommon::statusMultipleDeleteFail);
+ QVERIFY(statusData.toInt() == 2);
+
+ // is status is multiplefailed and provided is either single or multiple,
+ // status is updated into multiple
+ status = VideoCollectionCommon::statusSingleDeleteFail;
+ statusData = QVariant();
+ mTestObject->updateStatus(status, statusData);
+ status = mTestObject->getLastStatus(statusData);
+ QVERIFY(status == VideoCollectionCommon::statusMultipleDeleteFail);
+ QVERIFY(statusData.toInt() == 3);
+
+ status = VideoCollectionCommon::statusMultipleDeleteFail;
+ statusData = 2;
+ mTestObject->updateStatus(status, statusData);
+ status = mTestObject->getLastStatus(statusData);
+ QVERIFY(status == VideoCollectionCommon::statusMultipleDeleteFail);
+ QVERIFY(statusData.toInt() == 5);
+
+ mTestObject->clearStatus();
+ status = mTestObject->getLastStatus(statusData);
+ QVERIFY(status == 0);
+ QVERIFY(!statusData.isValid());
+
+}
+
+// -----------------------------------------------------------------------------
+// testContinueSlot
+// -----------------------------------------------------------------------------
+//
+void TestVideoDeleteWorker::testContinueSlot()
+{
+ QList<TMPXItemId> itemIds;
+ mTestObject->requestDelete(itemIds);
+ QCoreApplication::processEvents();
+
+ // no timer
+ QTimer *tmp = mTestObject->mRequestWaitTimer;
+ mTestObject->mRequestWaitTimer = 0;
+ mTestObject->continueSlot();
+ // nothing to really check here
+ QVERIFY(mTestObject->mRemoveBuffer.count() == 0);
+ mTestObject->mRequestWaitTimer = tmp;
+
+ // buffer empty
+ mTestObject->continueSlot();
+ QVERIFY(!mTestObject->mRequestWaitTimer->isActive());
+
+ itemIds.append(TMPXItemId(0,0));
+ itemIds.append(TMPXItemId(1,0));
+ itemIds.append(TMPXItemId(2,0));
+ itemIds.append(TMPXItemId(3,0));
+ mTestObject->requestDelete(itemIds);
+ mTestObject->mRequestWaitTimer->stop();
+ // buffer not empty
+ mTestObject->continueSlot();
+ QVERIFY(mTestObject->mRequestWaitTimer->isActive());
+
+ // timer is active
+ mTestObject->continueSlot();
+ QVERIFY(mTestObject->mRequestWaitTimer->isActive());
+}
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideodeleteworker/stub/inc/videocollectionclient.h Thu Apr 01 23:22:15 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: stub VideoCollectionClient class definition*
+*/
+
+#ifndef __VIDEOCOLLECTIONCLIENT_H
+#define __VIDEOCOLLECTIONCLIENT_H
+
+#include <vcxmyvideosdefs.h>
+#include <QList>
+
+
+// CLASS DECLARATION
+
+
+class VideoCollectionClient
+{
+
+public:
+
+ /**
+ * Constructor
+ */
+ VideoCollectionClient():mDeleteFails(false) {};
+
+ /**
+ * Destructor.
+ */
+ virtual ~VideoCollectionClient(){};
+
+ /**
+ * returns 0 if mDeleteFails is false
+ */
+ int deleteVideos(QList<TMPXItemId> *mediaIds)
+ {
+ Q_UNUSED(mediaIds);
+ if(mDeleteFails)
+ {
+ return -1;
+ }
+ return 0;
+ }
+
+ /**
+ * if true, deletevideos -call fails
+ */
+ bool mDeleteFails;
+
+ };
+
+#endif // __VIDEOCOLLECTIONCLIENT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideodeleteworker/testvideodeleteworker.pro Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,35 @@
+######################################################################
+# Automatically generated by qmake (2.01a) Tue 5. May 13:25:42 2009
+######################################################################
+
+TEMPLATE = app
+TARGET =
+DEPENDPATH += . inc src
+
+INCLUDEPATH += . \
+ ../../../inc \
+ /epoc32/include/domain \
+ /epoc32/include/domain/middleware \
+ /epoc32/include/domain/applications \
+ /epoc32/include/osextensions \
+ /epoc32/include/middleware \
+ /epoc32/include/osextensions/stdapis/stlport \
+ /VideoApp_Domain/video/videofeeds/inc
+
+
+CONFIG += qtestlib \
+ Hb \
+ symbian_test
+
+LIBS += -lmpxcommon.dll -lflogger.dll -lestor.dll \
+ -lfbscli.dll -lbitgdi.dll -lgdi.dll
+
+# Input
+HEADERS += stub/inc/videocollectionclient.h \
+ inc/testvideodeleteworker.h \
+ ../../inc/videodeleteworker.h
+
+
+SOURCES += src/testvideodeleteworker.cpp \
+ ../../src/videodeleteworker.cpp
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel/inc/mediaobjectfactory.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,103 @@
+/*
+* 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 for creating mediaobjects for testing VideoListDataModel class methods*
+*/
+
+
+#ifndef __TESTVIDEOLISTMEDIAFACTORY_H__
+#define __TESTVIDEOLISTMEDIAFACTORY_H__
+
+
+class CMPXMediaArray;
+class CMPXMedia;
+
+/**
+ * flag values for selecting wich details are created for items
+ */
+enum MediaDetailSelection
+{
+ MediaDetailNone = 0x00,
+ MediaDetailRatingFlag = 0x01,
+ MediaDetailDateFlag = 0x02,
+ MediaDetailSizeFlag = 0x04,
+ MediaDetailDurationFlag = 0x08,
+ MediaDetailFilePathFlag = 0x10,
+ MediaDetailAll = 0xff
+};
+
+// const used for media creation
+_LIT( KMediaTestNamePrefix, "MEDIATESTFILEPATH_%d" );
+const QString gQTMediaNamePrefix = "MEDIATESTFILEPATH_";
+
+_LIT( KMediaTestFilePathPrefix, "MEDIATESTFILEPATH_%d" );
+const QString gQTMediaFilePathPrefix = "MEDIATESTFILEPATH_";
+
+class MediaObjectFactory
+{
+
+public:
+ /**
+ * constructor.
+ */
+ MediaObjectFactory();
+
+ /**
+ * destructor
+ */
+ ~MediaObjectFactory();
+
+ /**
+ * returns pointer to media-array
+ */
+ CMPXMediaArray* mediaArray();
+
+ /**
+ * creates wanted amount of items with sekected details
+ *
+ * @param counr
+ * @param MediaDetailSelection flags
+ */
+ void createMediaItems(int count, int mediaType = 0, MediaDetailSelection flags = MediaDetailAll);
+
+ /**
+ * deletes media-array
+ */
+ void removeArray();
+
+private:
+
+ /**
+ * fills data for single media-item
+ *
+ * @param media
+ * @index
+ * @MediaDetailSelection
+ *
+ * @return bool true: succeed
+ */
+ bool fillMediaDatas(CMPXMedia* media, int index, int mediaType, MediaDetailSelection detailSelectionFlag);
+
+ /**
+ * array of medias
+ */
+ CMPXMediaArray *mArray;
+};
+
+
+#endif // __TESTVIDEOLISTMEDIAFACTORY_H__
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel/inc/testvideolistdatamodel.h Thu Apr 01 23:22:15 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: Testclas for testing VideoListDataModel class methods*
+*/
+
+
+#ifndef __TESTVIDEOLISTDATAMODEL_H__
+#define __TESTVIDEOLISTDATAMODEL_H__
+
+
+// INCLUDES
+#include <QtTest/QtTest>
+
+
+class VideoCollectionClient;
+class VideoListDataModel;
+class MediaObjectFactory;
+
+class TestVideoListDataModel : public QObject
+{
+ Q_OBJECT
+
+
+signals:
+ /**
+ * when testing dataChanged -signal emitting and
+ * videoDataChangedSlot -slot
+ */
+ void testVideoDataChangedSignal(int);
+
+
+ // test functions for the test framework
+private slots:
+
+ /**
+ * called before anything else when test starts
+ */
+ void initTestCase();
+
+ /**
+ * will be called before each testfunction is executed.
+ *
+ */
+ void init();
+
+ /**
+ * will be called after every testfunction.
+ *
+ */
+ void cleanup();
+
+ /**
+ * will be called after testing ends
+ *
+ */
+ void cleanupTestCase();
+
+ /**
+ * Tests for the c++ constructor. Mainly to check that the parent is set
+ * correctly.
+ */
+ void testConstructor();
+
+ /**
+ * Tests for possible failure initializations
+ */
+ void testInitializeFails();
+
+ /**
+ * Tests for possible succesfully initiliazation
+ *
+ */
+ void testInitialize();
+
+ /**
+ * Tests to make sure model returns correct row count
+ * in all cases
+ *
+ */
+ void testRowCount();
+
+ /**
+ * tests if correct media id will be returned at certain positions
+ *
+ */
+ void testMediaIdAtIndex();
+
+ /**
+ * tests if correct file path for media will be returned at certain positions
+ *
+ */
+ void testMediaFilePathForId();
+
+ /**
+ * Tests to make sure model returns correct data from itemData -method
+ *
+ */
+ void testItemData();
+
+
+ /**
+ * Tests to make sure model returns correct data from Data -method
+ *
+ */
+ void testData();
+
+ /**
+ * Tests to make sure model returns correct data from ColumnCount
+ *
+ */
+ void testColumnCount();
+
+ /**
+ * Tests to make sure model returns correct data from index
+ *
+ */
+ void testIndex();
+
+ /**
+ * Tests to make sure model returns correct data from parent
+ *
+ */
+ void testParent();
+
+ /**
+ * Tests to make sure detail rows are created ok in all cases
+ *
+ */
+ void testPrepareDetails();
+
+ /**
+ * Tests to make sure size strings are created ok in all cases
+ *
+ */
+ void testPrepareSizeString();
+
+ /**
+ * Tests to make sure length strings are created ok in all cases
+ *
+ */
+ void testPrepareLengthString();
+
+ /**
+ * Tests to make removeorws behaves correctly in all posiible cases
+ *
+ */
+ void testRemoveRows();
+
+ /**
+ * tests deleteStartingFailsSlot
+ */
+ void testDeleteStartingFailsSlot();
+
+ /**
+ * verifies belongsToAlbum
+ */
+ void testBelongsToAlbum();
+
+ /**
+ * verifies setAlbumInUse
+ */
+ void testSetAlbumInUse();
+
+ /**
+ * tests reportAsyncStatus
+ */
+ void testreportAsyncStatus();
+
+
+private:
+
+ /**
+ * creates all objects used in tests,
+ * returns false if some creation fails.
+ *
+ * @return bool
+ *
+ */
+ bool initializeTestObjects();
+
+ /**
+ * cleanups class data
+ */
+ void cleanupTestObjects();
+
+ /**
+ * videocollection client stub -object
+ */
+ VideoCollectionClient *mCollectionStub;
+
+ /**
+ * Test object for wich intialize is not called in
+ * init -method
+ */
+ VideoListDataModel *mTestObjectInitialized;
+
+ /**
+ * Test object for wich intialize is called in
+ * init -method
+ */
+ VideoListDataModel *mTestObjectNotInitialized;
+
+ /**
+ * CMPXMedia -object factory.
+ */
+ MediaObjectFactory *mMediaFactory;
+};
+
+
+
+#endif // __TESTVIDEOLISTDATAMODEL_H__
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel/src/mediaobjectfactory.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,208 @@
+
+/*
+* 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 for creating mediaobjects for testing VideoListDataModel class methods*
+*/
+
+// INCLUDES
+
+#include <mpxmediageneraldefs.h>
+#include <mpxmediaarray.h>
+#include <mpxmedia.h>
+#include <qdatetime.h>
+#include "vcxmyvideosdefs.h"
+#include "mediaobjectfactory.h"
+
+// -----------------------------------------------------------------------------
+// MediaObjectFactory
+// -----------------------------------------------------------------------------
+//
+MediaObjectFactory::MediaObjectFactory() :
+ mArray(0)
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// ~MediaObjectFactory
+// -----------------------------------------------------------------------------
+//
+MediaObjectFactory::~MediaObjectFactory()
+{
+ removeArray();
+}
+
+// -----------------------------------------------------------------------------
+// mediaArray
+// -----------------------------------------------------------------------------
+//
+CMPXMediaArray* MediaObjectFactory::mediaArray()
+{
+ return mArray;
+}
+
+// -----------------------------------------------------------------------------
+// createMediaItems
+// -----------------------------------------------------------------------------
+//
+void MediaObjectFactory::createMediaItems(int count, int mediaType, MediaDetailSelection flags)
+{
+ if(!mArray)
+ {
+ TRAPD(error, mArray = CMPXMediaArray::NewL() )
+ if(!mArray)
+ {
+ return;
+ }
+ }
+ int nextPossibleIndex = mArray->Count();
+
+ // - create 10 media objects and add them into array
+ CMPXMedia *media;
+
+
+ for(int i = 0; i < count; ++i)
+ {
+ media = NULL;
+ TRAPD(error, media = CMPXMedia::NewL());
+ if(!media)
+ {
+ delete mArray;
+ mArray = 0;
+ return;
+ }
+
+ if(!fillMediaDatas(media, i, mediaType, flags))
+ {
+ delete media;
+ delete mArray;
+ mArray = 0;
+ return;
+ }
+
+ TRAP(error, mArray->AppendL(media));
+ if(error != KErrNone)
+ {
+ delete mArray;
+ mArray = 0;
+ return;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+// fillMediaDatas
+// -----------------------------------------------------------------------------
+//
+bool MediaObjectFactory::fillMediaDatas(CMPXMedia* media, int index, int mediaType, MediaDetailSelection detailSelectionFlag)
+{
+ if(!media)
+ {
+ return false;
+ }
+ TBuf<65> videoname;
+ TMPXItemId itemId;
+ // set media id
+ itemId.iId1 = index;
+ itemId.iId2 = mediaType;
+ TRAPD(error, media->SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, itemId));
+ if(error != KErrNone)
+ {
+ return false;
+ }
+
+ // set media name
+ videoname.Format(KMediaTestNamePrefix, index);
+ TRAP(error, media->SetTextValueL( KMPXMediaGeneralTitle, videoname));
+ if(error != KErrNone)
+ {
+ return false;
+ }
+
+ // set media rating
+ if(detailSelectionFlag & MediaDetailRatingFlag)
+ {
+ int rating = (index%5) +1;
+ TRAPD(error, media->SetTObjectValueL<TInt>(KVcxMediaMyVideosRating, rating));
+ if(error != KErrNone)
+ {
+ return false;
+ }
+ }
+
+ // set media date
+ if(detailSelectionFlag & MediaDetailDateFlag)
+ {
+ TDateTime dateTime;
+ dateTime.Set(2009, TMonth(index), index, index+1, index+1, index+1, index+1);
+ TTime ttimeDate(dateTime);
+ TInt64 temp= ttimeDate.Int64();
+ TRAPD(error, media->SetTObjectValueL<TInt64>(KMPXMediaGeneralDate, ttimeDate.Int64()));
+ if(error != KErrNone)
+ {
+ return false;
+ }
+ }
+
+ // set duration
+ if(detailSelectionFlag & MediaDetailDurationFlag)
+ {
+ float duration = 1.0 * index;
+ TRAPD(error, media->SetTObjectValueL<float>(KMPXMediaGeneralDuration, duration));
+ if(error != KErrNone)
+ {
+ return false;
+ }
+ }
+
+ // set size
+ if(detailSelectionFlag & MediaDetailSizeFlag)
+ {
+ quint32 size = 1.0 + index;
+ TRAPD(error, media->SetTObjectValueL<quint32>(KMPXMediaGeneralSize, size));
+ if(error != KErrNone)
+ {
+ return false;
+ }
+ }
+
+ // set file path
+ if(detailSelectionFlag & MediaDetailFilePathFlag)
+ {
+ videoname.Format(KMediaTestFilePathPrefix, index);
+ TRAP(error, media->SetTextValueL( KMPXMediaGeneralUri, videoname));
+ if(error != KErrNone)
+ {
+ return false;
+ }
+ }
+
+ return true;
+
+}
+
+// -----------------------------------------------------------------------------
+// removeArray
+// -----------------------------------------------------------------------------
+//
+void MediaObjectFactory::removeArray()
+{
+ delete mArray;
+ mArray = 0;
+}
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel/src/testvideolistdatamodel.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,917 @@
+
+/*
+* 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: Testclas for testing VideoListDataModel class methods*
+*/
+
+
+#include <QObject>
+#include <qabstractitemmodel.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmediaarray.h>
+#include <mpxmedia.h>
+#include "videocollectioncommon.h"
+#include "videodeleteworker.h"
+#include "videocollectionclient.h"
+#include "videolistdatamodel_p.h"
+#include "videocollectionwrapper.h"
+
+
+#include "testvideolistdatamodel.h"
+#include "mediaobjectfactory.h"
+#include "videocollectioncommon.h"
+
+#define private public
+#include "videolistdatamodel.h"
+#undef private
+
+const int MEDIA_COUNT = 10;
+
+
+
+// -----------------------------------------------------------------------------
+// main
+// -----------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ Q_UNUSED(argc);
+
+ TestVideoListDataModel 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\\testvideomodel.txt";
+ res = QTest::qExec(&tv, 3, pass);
+ }
+
+ return res;
+}
+
+// -----------------------------------------------------------------------------
+// initTestCase
+// -----------------------------------------------------------------------------
+//
+void TestVideoListDataModel::initTestCase()
+{
+ mMediaFactory = new MediaObjectFactory();
+}
+
+// -----------------------------------------------------------------------------
+// init
+// -----------------------------------------------------------------------------
+//
+void TestVideoListDataModel::init()
+{
+ QVERIFY2(initializeTestObjects(), "making sure if testable object creation ok");
+}
+
+// -----------------------------------------------------------------------------
+// cleanup
+// -----------------------------------------------------------------------------
+//
+void TestVideoListDataModel::cleanup()
+{
+ cleanupTestObjects();
+}
+
+// -----------------------------------------------------------------------------
+// cleanupTestCase
+// -----------------------------------------------------------------------------
+//
+void TestVideoListDataModel::cleanupTestCase()
+{
+ delete mMediaFactory;
+}
+
+// -----------------------------------------------------------------------------
+// testInitializeFails
+// -----------------------------------------------------------------------------
+//
+void TestVideoListDataModel::testConstructor()
+{
+ QObject *parent = new QObject();
+ delete mTestObjectNotInitialized;
+ mTestObjectNotInitialized = new VideoListDataModel(parent);
+ QVERIFY( mTestObjectNotInitialized->QObject::parent() == parent );
+ QVERIFY( mTestObjectNotInitialized->mCollectionClient == 0);
+ QVERIFY( mTestObjectNotInitialized->d_ptr != 0);
+
+ delete parent; // also deletes the test object;
+ mTestObjectNotInitialized = 0;
+}
+
+// -----------------------------------------------------------------------------
+// testInitializeFails
+// -----------------------------------------------------------------------------
+//
+void TestVideoListDataModel::testInitializeFails()
+{
+ // Test all possible failures in the initialisation -call
+ // NOTE: signal connecting or new operator failures cannot be tested
+
+ // - collection client init fails
+ VideoCollectionClient::mFailInitialize = true;
+ QVERIFY(mTestObjectNotInitialized->initialize() == -1 );
+ VideoCollectionClient::mFailInitialize = false;
+
+ // - private impl init fails
+ VideoListDataModelPrivate::mFailInit = true;
+ QVERIFY( mTestObjectNotInitialized->initialize() == -1 );
+
+}
+
+// -----------------------------------------------------------------------------
+// testInitialize
+// -----------------------------------------------------------------------------
+//
+void TestVideoListDataModel::testInitialize()
+{
+ VideoListDataModelPrivate::mFailInit = false;
+ VideoCollectionClient::mFailInitialize = false;
+ VideoCollectionClient::mFailConnectSignals = false;
+ VideoCollectionClient::mInitializeCount = 0;
+ VideoDeleteWorker::mCreateCount = 0;
+
+ QVERIFY(mTestObjectNotInitialized->initialize() == 0);
+ // secon call should succeed right away
+ QVERIFY(mTestObjectNotInitialized->initialize() == 0);
+ QVERIFY(mTestObjectNotInitialized->getCollectionClient() != 0);
+
+ // for the coverity, cannot be verified, because cannot get count from
+ // connected signals runtime
+ mTestObjectNotInitialized->d_ptr->callModelDisconnect();
+
+ QVERIFY(VideoCollectionClient::mInitializeCount == 1);
+ QVERIFY(VideoDeleteWorker::mCreateCount == 1);
+
+}
+
+// -----------------------------------------------------------------------------
+// testRowCount
+// -----------------------------------------------------------------------------
+//
+void TestVideoListDataModel::testRowCount()
+{
+ // Test to make sure model queries correct amount of items
+ // - at beginning row count should be 0
+ // - create defined amount of items
+ // - call rowCount to get matching count
+
+ mMediaFactory->removeArray();
+
+ // row count with invalid parent and zero -array should be 0
+ QVERIFY(mTestObjectInitialized->rowCount() == 0);
+
+ mMediaFactory->createMediaItems(MEDIA_COUNT);
+
+ mTestObjectInitialized->d_ptr->newVideoListSlot(mMediaFactory->mediaArray());
+
+ // check row count is ok
+ QVERIFY( mTestObjectInitialized->rowCount() == MEDIA_COUNT);
+
+ // with valid parent: according to Qt documentation if parent is valid rowCount should return 0
+ QModelIndex validIndex = mTestObjectInitialized->index(0,0);
+ QVERIFY( mTestObjectInitialized->rowCount(validIndex) == 0);
+
+ mMediaFactory->removeArray();
+
+}
+
+// -----------------------------------------------------------------------------
+// testMediaIdAtIndex
+// -----------------------------------------------------------------------------
+//
+void TestVideoListDataModel::testMediaIdAtIndex()
+{
+ mMediaFactory->removeArray();
+
+ mMediaFactory->createMediaItems(MEDIA_COUNT);
+
+ // ownership of media-array transferred
+ mTestObjectInitialized->d_ptr->newVideoListSlot(mMediaFactory->mediaArray());
+
+ // invalid index: below bounds
+ QVERIFY(mTestObjectInitialized->mediaIdAtIndex(-1) == TMPXItemId::InvalidId());
+
+ //invalid index: above bounds
+ QVERIFY(mTestObjectInitialized->mediaIdAtIndex(MEDIA_COUNT) == TMPXItemId::InvalidId());
+
+ // first
+ QVERIFY(mTestObjectInitialized->mediaIdAtIndex(0).iId1 == 0);
+
+ // middle
+ QVERIFY(mTestObjectInitialized->mediaIdAtIndex(MEDIA_COUNT / 2).iId1 == (MEDIA_COUNT / 2));
+
+ // last
+ QVERIFY(mTestObjectInitialized->mediaIdAtIndex(MEDIA_COUNT - 1).iId1 == (MEDIA_COUNT - 1));
+
+ // no items
+ mMediaFactory->removeArray();
+ mTestObjectInitialized->d_ptr->newVideoListSlot(0);
+ QVERIFY( mTestObjectInitialized->mediaIdAtIndex(MEDIA_COUNT / 2) == TMPXItemId::InvalidId());
+}
+
+// -----------------------------------------------------------------------------
+// testMediaFilePathForId
+// -----------------------------------------------------------------------------
+//
+void TestVideoListDataModel::testMediaFilePathForId()
+{
+ mMediaFactory->removeArray();
+
+ mMediaFactory->createMediaItems(MEDIA_COUNT);
+
+ // ownership of media-array transferred
+ mTestObjectInitialized->d_ptr->newVideoListSlot(mMediaFactory->mediaArray());
+
+ TMPXItemId id;
+
+ // invalid id
+ QVERIFY(mTestObjectInitialized->mediaFilePathForId( TMPXItemId::InvalidId()) == "");
+
+ // first
+ id.iId1 = 0;
+ id.iId2 = 0;
+ QVERIFY(mTestObjectInitialized->mediaFilePathForId(id) ==
+ QString(gQTMediaNamePrefix + QString::number(id.iId1)));
+
+ // middle
+ id.iId1 = MEDIA_COUNT / 2;
+ id.iId2 = 0;
+ QVERIFY(mTestObjectInitialized->mediaFilePathForId(id) ==
+ QString(gQTMediaNamePrefix + QString::number(id.iId1)));
+
+ // last
+ id.iId1 = MEDIA_COUNT - 1;
+ id.iId2 = 0;
+ QVERIFY(mTestObjectInitialized->mediaFilePathForId(id) ==
+ QString(gQTMediaNamePrefix + QString::number(id.iId1)));
+
+ // no items
+ mMediaFactory->removeArray();
+ id.iId1 = MEDIA_COUNT / 2;
+ id.iId2 = 0;
+ mTestObjectInitialized->d_ptr->newVideoListSlot(0);
+ QVERIFY( mTestObjectInitialized->mediaFilePathForId(id) == "" );
+}
+
+// -----------------------------------------------------------------------------
+// testItemData
+// -----------------------------------------------------------------------------
+//
+void TestVideoListDataModel::testItemData()
+{
+ // Test to make sure item data is passed ok throught model
+ // - create defined amount of items
+ // - setup their data as predefined values
+ // - call item data to make sure data is passed ok from the model
+ // Qt::DisplayRole
+ // Qt::DecorationRole
+ // Qt::BackgroundRole
+
+ QModelIndex index;
+ QMap<int, QVariant> mapData;
+
+ VideoListDataModelPrivate::mFailInit = false;
+
+ mMediaFactory->removeArray();
+
+ mTestObjectInitialized->d_ptr->newVideoListSlot(0);
+
+ // no items
+ index = mTestObjectInitialized->index(0, 0, QModelIndex());
+ mapData = mTestObjectInitialized->itemData(index);
+ QVERIFY(mapData.count() == 0);
+
+ mMediaFactory->createMediaItems(MEDIA_COUNT);
+ mTestObjectInitialized->d_ptr->newVideoListSlot(mMediaFactory->mediaArray());
+
+ // below index bounds, should not even get correct index
+ index = mTestObjectInitialized->index(-1, 0, QModelIndex());
+ QVERIFY(!index.isValid());
+ mapData = mTestObjectInitialized->itemData(index);
+ QVERIFY(mapData.count() == 0);
+
+ // above index bounds, should not even get correct index
+ index = mTestObjectInitialized->index(MEDIA_COUNT, 0, QModelIndex());
+ QVERIFY(!index.isValid());
+ mapData = mTestObjectInitialized->itemData(index);
+ QVERIFY(mapData.count() == 0);
+
+ // first
+ index = mTestObjectInitialized->index(0, 0, QModelIndex());
+ QVERIFY(index.isValid());
+ mapData = mTestObjectInitialized->itemData(index);
+ QVERIFY(mapData.count() == 3);
+
+ // middle
+ index = mTestObjectInitialized->index(MEDIA_COUNT / 2, 0, QModelIndex());
+ QVERIFY(index.isValid());
+ mapData = mTestObjectInitialized->itemData(index);
+ QVERIFY(mapData.count() == 3);
+
+ // last
+ index = mTestObjectInitialized->index(MEDIA_COUNT - 1, 0, QModelIndex());
+ QVERIFY(index.isValid());
+ mapData = mTestObjectInitialized->itemData(index);
+ QVERIFY(mapData.count() == 3);
+
+}
+
+// -----------------------------------------------------------------------------
+// testData
+// -----------------------------------------------------------------------------
+//
+void TestVideoListDataModel::testData()
+{
+ VideoListDataModelPrivate::mFailInit = false;
+ mMediaFactory->removeArray();
+
+ const int TEST_INDEX = 3;
+
+
+ mMediaFactory->createMediaItems(TEST_INDEX + 1);
+ mTestObjectInitialized->d_ptr->newVideoListSlot(mMediaFactory->mediaArray());
+ QModelIndex index = QModelIndex();
+ QVariant data;
+
+ // test with invalid QModelIndex
+ data = mTestObjectInitialized->data(index, Qt::DisplayRole);
+ QVERIFY(data.toStringList().count() == 0);
+
+ // test with correct data
+ index = mTestObjectInitialized->index(TEST_INDEX,0, QModelIndex());
+
+ data = mTestObjectInitialized->data(index, Qt::DisplayRole);
+ QVERIFY(data.toStringList().count() == 2);
+ QVERIFY(data.toStringList().at(0) == QString(gQTMediaNamePrefix + QString::number(TEST_INDEX)));
+
+ data.clear();
+ data = mTestObjectInitialized->data(index, Qt::DecorationRole);
+ QVERIFY(data.isValid());
+
+ data.clear();
+ data = mTestObjectInitialized->data(index, Qt::BackgroundRole);
+ // at the moment we do not have background role -data, when it becomes available,
+ // this will fail and needs to be changed
+ QVERIFY(!data.isValid());
+
+ data.clear();
+ QDate date = QDate(2009, TEST_INDEX+1, TEST_INDEX+1);
+ data = mTestObjectInitialized->data(index, VideoCollectionCommon::KeyDateTime);
+ QCOMPARE(data.toDate(), date);
+
+ data.clear();
+ data = mTestObjectInitialized->data(index, VideoCollectionCommon::KeySizeValue);
+ QVERIFY(data.toUInt() == (1+TEST_INDEX));
+
+ data.clear();
+ data = mTestObjectInitialized->data(index, VideoCollectionCommon::KeyStatus);
+ QVERIFY(data.toInt() == VideoCollectionCommon::StatusNone);
+
+ data.clear();
+ data = mTestObjectInitialized->data(index, VideoCollectionCommon::KeyMetaData);
+ QMap<QString, QVariant> map = data.toMap();
+ QVERIFY(map.contains("metadata"));
+ QCOMPARE(map["metadata"].toString(), QString("metadata"));
+
+ data.clear();
+ data = mTestObjectInitialized->data(index, VideoCollectionCommon::KeyFilePath);
+ QCOMPARE(data.toString(), gQTMediaFilePathPrefix + QString::number(TEST_INDEX));
+
+ // invalid role
+ data.clear();
+ data = mTestObjectInitialized->data(index, VideoCollectionCommon::KeyLast);
+ QVERIFY(!data.isValid());
+
+ // test with incorrect (== missing details) data
+ mMediaFactory->removeArray();
+ mMediaFactory->createMediaItems(TEST_INDEX + 1, 0, MediaDetailNone);
+ mTestObjectInitialized->d_ptr->newVideoListSlot(mMediaFactory->mediaArray());
+ data.clear();
+ data = mTestObjectInitialized->data(index, VideoCollectionCommon::KeyDateTime);
+ QVERIFY(!data.toDateTime().isValid());
+
+ data.clear();
+ data = mTestObjectInitialized->data(index, VideoCollectionCommon::KeyFilePath);
+ QVERIFY(!data.toString().length());
+
+}
+
+// -----------------------------------------------------------------------------
+// testColumnCount
+// -----------------------------------------------------------------------------
+//
+void TestVideoListDataModel::testColumnCount()
+{
+ mMediaFactory->removeArray();
+ const int TEST_INDEX = 3;
+
+ // test with correct data
+ mMediaFactory->createMediaItems(1);
+
+ QModelIndex index = QModelIndex();
+ // test with invalid "parent" index
+ QVERIFY(mTestObjectInitialized->columnCount(index) == 1);
+
+ mTestObjectInitialized->d_ptr->newVideoListSlot(mMediaFactory->mediaArray());
+ index = mTestObjectInitialized->index(0,0);
+ // test with valid "parent index
+ QVERIFY(mTestObjectInitialized->columnCount(index) == 0);
+}
+
+// -----------------------------------------------------------------------------
+// testIndex
+// -----------------------------------------------------------------------------
+//
+void TestVideoListDataModel::testIndex()
+{
+ QModelIndex indexToGet;
+ mMediaFactory->removeArray();
+ mTestObjectInitialized->d_ptr->newVideoListSlot(0);
+
+
+ mMediaFactory->createMediaItems(MEDIA_COUNT);
+ mTestObjectInitialized->d_ptr->newVideoListSlot(mMediaFactory->mediaArray());
+
+ // index below bounds
+ indexToGet = mTestObjectInitialized->index(-1, 0);
+ QVERIFY(!indexToGet.isValid());
+
+ // index above bounds
+ indexToGet = mTestObjectInitialized->index(MEDIA_COUNT, 0);
+ QVERIFY(!indexToGet.isValid());
+
+ // first
+ indexToGet = mTestObjectInitialized->index(0, 0);
+ QVERIFY(indexToGet.isValid());
+ QVERIFY(indexToGet.row() == 0);
+
+ // middle
+ indexToGet = mTestObjectInitialized->index(MEDIA_COUNT / 2, 0);
+ QVERIFY(indexToGet.isValid());
+ QVERIFY(indexToGet.row() == (MEDIA_COUNT / 2));
+
+ // last
+ indexToGet = mTestObjectInitialized->index(MEDIA_COUNT - 1, 0);
+ QVERIFY(indexToGet.isValid());
+ QVERIFY(indexToGet.row() == (MEDIA_COUNT -1));
+}
+
+// -----------------------------------------------------------------------------
+// testParent
+// -----------------------------------------------------------------------------
+//
+void TestVideoListDataModel::testParent()
+{
+ mMediaFactory->createMediaItems(MEDIA_COUNT);
+ mTestObjectInitialized->d_ptr->newVideoListSlot(mMediaFactory->mediaArray());
+
+ QModelIndex index = mTestObjectInitialized->index(0,0);
+ QVERIFY(index.isValid());
+ QModelIndex parentIndex = mTestObjectInitialized->parent(index);
+ QVERIFY(!parentIndex.isValid());
+}
+
+// -----------------------------------------------------------------------------
+// testPrepareDetails
+// -----------------------------------------------------------------------------
+//
+void TestVideoListDataModel::testPrepareDetails()
+{
+ // cannot call preparedetails directly, need to call indirectly using
+ // public data -method.
+
+ QString details("");
+ QModelIndex modelIndex;
+ QVariant result;
+ mMediaFactory->removeArray();
+
+ mMediaFactory->createMediaItems(MEDIA_COUNT);
+ mTestObjectInitialized->d_ptr->newVideoListSlot(mMediaFactory->mediaArray());
+
+ // missing size
+ mMediaFactory->removeArray();
+ mMediaFactory->createMediaItems(MEDIA_COUNT, 0, MediaDetailDurationFlag);
+ mTestObjectInitialized->d_ptr->newVideoListSlot(mMediaFactory->mediaArray());
+ details.clear();
+ modelIndex = mTestObjectInitialized->index(MEDIA_COUNT / 2, 0);
+
+ result = mTestObjectInitialized->data(modelIndex, Qt::DisplayRole);
+ QVERIFY (result.toStringList().count() == 2 );
+ QVERIFY(!result.toStringList().at(1).contains(","));
+
+ // missing duration
+ mMediaFactory->removeArray();
+ mMediaFactory->createMediaItems(MEDIA_COUNT, 0, MediaDetailSizeFlag);
+ mTestObjectInitialized->d_ptr->newVideoListSlot(mMediaFactory->mediaArray());
+ details.clear();
+ modelIndex = mTestObjectInitialized->index(MEDIA_COUNT / 2, 0);
+ result = mTestObjectInitialized->data(modelIndex, Qt::DisplayRole);
+ QVERIFY (result.toStringList().count() == 2 );
+
+
+ // missing both
+ mMediaFactory->removeArray();
+ mMediaFactory->createMediaItems(MEDIA_COUNT, 0, MediaDetailNone);
+ mTestObjectInitialized->d_ptr->newVideoListSlot(mMediaFactory->mediaArray());
+ details.clear();
+ modelIndex = mTestObjectInitialized->index(MEDIA_COUNT / 2, 0);
+ result = mTestObjectInitialized->data(modelIndex, Qt::DisplayRole);
+ QVERIFY (result.toStringList().count() == 2 );
+
+ // album typed data
+ mMediaFactory->removeArray();
+ mMediaFactory->createMediaItems(5, 2, MediaDetailNone);
+ mTestObjectInitialized->d_ptr->newVideoListSlot(mMediaFactory->mediaArray());
+ modelIndex = mTestObjectInitialized->index(3, 0);
+ result = mTestObjectInitialized->data(modelIndex, Qt::DisplayRole);
+ QVERIFY (result.toStringList().count() == 2 );
+
+}
+
+// -----------------------------------------------------------------------------
+// testPrepareSizeString
+// -----------------------------------------------------------------------------
+//
+void TestVideoListDataModel::testPrepareSizeString()
+{
+ // This tests the CVideoCollectionUtils::prepareSizeString at the same time
+ // as we do not have separate tests for that.
+
+ // cannot call prepareSizeStrings directly, need to call indirectly using
+ // public data -method. That means:
+ // - we cannot test without videolistdata -object -case because tested throught data -call and
+ // existence is tested there already
+ // cannot chck the actual string due localization
+ QString details("");
+ QModelIndex modelIndex;
+ QVariant result;
+
+ mMediaFactory->removeArray();
+
+ mMediaFactory->createMediaItems(MEDIA_COUNT);
+ mTestObjectInitialized->d_ptr->newVideoListSlot(mMediaFactory->mediaArray());
+
+ modelIndex = mTestObjectInitialized->index(MEDIA_COUNT / 2, 0);
+
+ // zero size
+ VideoListDataModelPrivate::mOverrideSize = true;
+ VideoListDataModelPrivate::mSize = 0;
+ result = mTestObjectInitialized->data(modelIndex, Qt::DisplayRole);
+ QVERIFY(!result.toStringList().at(1).contains(","));
+ result = QVariant();
+ // 1 byte
+ VideoListDataModelPrivate::mSize = 1;
+ result = mTestObjectInitialized->data(modelIndex, Qt::DisplayRole);
+ QVERIFY(result.toStringList().at(1).length() > 0);
+ result = QVariant();
+
+ // under kB
+ VideoListDataModelPrivate::mSize = 1023;
+ result = mTestObjectInitialized->data(modelIndex, Qt::DisplayRole);
+ QVERIFY(result.toStringList().at(1).length() > 0);
+ result = QVariant();
+ // exactly on kB
+ VideoListDataModelPrivate::mSize = 1024;
+ result = mTestObjectInitialized->data(modelIndex, Qt::DisplayRole);
+ QVERIFY(result.toStringList().at(1).length() > 0);
+ result = QVariant();
+ // over kB but under under MB
+ VideoListDataModelPrivate::mSize = 0xFFFFF;
+ result = mTestObjectInitialized->data(modelIndex, Qt::DisplayRole);
+ QVERIFY(result.toStringList().at(1).length() > 0);
+ result = QVariant();
+ // MB
+ VideoListDataModelPrivate::mSize = 0x100000;
+ result = mTestObjectInitialized->data(modelIndex, Qt::DisplayRole);
+ QVERIFY(result.toStringList().at(1).length() > 0);
+ result = QVariant();
+ // larger than MB but smaller than GB
+ VideoListDataModelPrivate::mSize = 0x3FFFFFFF;
+ result = mTestObjectInitialized->data(modelIndex, Qt::DisplayRole);
+ QVERIFY(result.toStringList().at(1).length() > 0);
+ result = QVariant();
+ // 1 GB
+ VideoListDataModelPrivate::mSize = 0x40000000;
+ result = mTestObjectInitialized->data(modelIndex, Qt::DisplayRole);
+ QVERIFY(result.toStringList().at(1).length() > 0);
+ result = QVariant();
+
+ // larger than 1 GB
+ VideoListDataModelPrivate::mSize = 0x90000000;
+ result = mTestObjectInitialized->data(modelIndex, Qt::DisplayRole);
+ QVERIFY(result.toStringList().at(1).length() > 0);
+ result = QVariant();
+
+ VideoListDataModelPrivate::mOverrideSize = false;
+}
+
+// -----------------------------------------------------------------------------
+// testPrepareLengthString
+// -----------------------------------------------------------------------------
+//
+void TestVideoListDataModel::testPrepareLengthString()
+{
+ // This tests the CVideoCollectionUtils::prepareSizeString at the same time
+ // as we do not have separate tests for that.
+ //
+ // cannot check the actual strin due localisation
+ //
+ // cannot call prepareLengthStrings directly, need to call indirectly using
+ // public data -method. That means:
+ // - we cannot test without videolistdata -object -case because tested throught data -call and
+ // existence is tested there already
+
+ QString details("");
+ QModelIndex modelIndex;
+ QVariant result;
+
+ mMediaFactory->removeArray();
+
+ mMediaFactory->createMediaItems(MEDIA_COUNT);
+ mTestObjectInitialized->d_ptr->newVideoListSlot(mMediaFactory->mediaArray());
+ modelIndex = mTestObjectInitialized->index(MEDIA_COUNT / 2, 0);
+
+ // override size to zero, so prepareDetailRow doesn't include size in the detail row text.
+ VideoListDataModelPrivate::mOverrideSize = true;
+ VideoListDataModelPrivate::mSize = 0;
+ VideoListDataModelPrivate::mOverrideDuration = true;
+ VideoListDataModelPrivate::mDuration = 0;
+
+ // zero
+ VideoListDataModelPrivate::mDuration = 0;
+ result = mTestObjectInitialized->data(modelIndex, Qt::DisplayRole);
+ result = QVariant();
+
+ // second
+ VideoListDataModelPrivate::mDuration = 1;
+ result = mTestObjectInitialized->data(modelIndex, Qt::DisplayRole);
+ QVERIFY(result.toStringList().at(1).length() > 0);
+ result = QVariant();
+
+ // over 1 second, under minute
+ VideoListDataModelPrivate::mDuration = 59;
+ result = mTestObjectInitialized->data(modelIndex, Qt::DisplayRole);
+ QVERIFY(result.toStringList().at(1).length() > 0);
+ result = QVariant();
+
+ // one minute
+ VideoListDataModelPrivate::mDuration = 60;
+ result = mTestObjectInitialized->data(modelIndex, Qt::DisplayRole);
+ QVERIFY(result.toStringList().at(1).length() > 0);
+ result = QVariant();
+
+ // one minute one second
+ VideoListDataModelPrivate::mDuration = 61;
+ result = mTestObjectInitialized->data(modelIndex, Qt::DisplayRole);
+ QVERIFY(result.toStringList().at(1).length() > 0);
+ result = QVariant();
+
+ // more than one minute and one second
+ VideoListDataModelPrivate::mDuration = 3599;
+ result = mTestObjectInitialized->data(modelIndex, Qt::DisplayRole);
+ QVERIFY(result.toStringList().at(1).length() > 0);
+ result = QVariant();
+
+ // one hour
+ VideoListDataModelPrivate::mDuration = 3600;
+ result = mTestObjectInitialized->data(modelIndex, Qt::DisplayRole);
+ QVERIFY(result.toStringList().at(1).length() > 0);
+ result = QVariant();
+
+ // one hour, one minute
+ VideoListDataModelPrivate::mDuration = 3660;
+ result = mTestObjectInitialized->data(modelIndex, Qt::DisplayRole);
+ QVERIFY(result.toStringList().at(1).length() > 0);
+ result = QVariant();
+
+ // over hour
+ VideoListDataModelPrivate::mDuration = 8654;
+ result = mTestObjectInitialized->data(modelIndex, Qt::DisplayRole);
+ QVERIFY(result.toStringList().at(1).length() > 0);
+ result = QVariant();
+
+ VideoListDataModelPrivate::mOverrideSize = false;
+ VideoListDataModelPrivate::mOverrideDuration = true;
+ VideoListDataModelPrivate::mDuration = 0;
+}
+
+// -----------------------------------------------------------------------------
+// testRemoveRows
+// -----------------------------------------------------------------------------
+//
+void TestVideoListDataModel::testRemoveRows()
+{
+ QSignalSpy spysignal(mTestObjectInitialized, SIGNAL(modelChanged()));
+ QModelIndexList indexList;
+ mMediaFactory->removeArray();
+
+ // no collection neither deleteworker
+ QVERIFY(!mTestObjectNotInitialized->removeRows(indexList));
+
+ // empty list provided
+ QVERIFY(!mTestObjectInitialized->removeRows(indexList));
+ QVERIFY(spysignal.count() == 1);
+ QVERIFY(mTestObjectInitialized->mDeleteWorker->mRequestList.count() == 0);
+ spysignal.clear();
+
+ mMediaFactory->createMediaItems(MEDIA_COUNT);
+ mTestObjectInitialized->d_ptr->newVideoListSlot(mMediaFactory->mediaArray());
+ indexList.append(mTestObjectInitialized->index(0,0));
+ indexList.append(mTestObjectInitialized->index(1,0));
+
+ // invalid id from mark -call (for coverity's sake
+ VideoListDataModelPrivate::mReturnInvalidMarked = true;
+ QVERIFY(!mTestObjectInitialized->removeRows(indexList));
+ QVERIFY(spysignal.count() == 1);
+ QVERIFY(mTestObjectInitialized->mDeleteWorker->mRequestList.count() == 0);
+ spysignal.clear();
+
+ VideoListDataModelPrivate::mReturnInvalidMarked = false;
+ // no invalid ids
+ QVERIFY(mTestObjectInitialized->removeRows(indexList));
+ QVERIFY(spysignal.count() == 1);
+ QVERIFY(mTestObjectInitialized->mDeleteWorker->mRequestList.count() == 2);
+ QVERIFY(mTestObjectInitialized->mDeleteWorker->mRequestList.at(0) != TMPXItemId::InvalidId());
+ QVERIFY(mTestObjectInitialized->mDeleteWorker->mRequestList.at(1) != TMPXItemId::InvalidId());
+
+}
+
+void TestVideoListDataModel::testDeleteStartingFailsSlot()
+{
+ QSignalSpy spysignal(mTestObjectInitialized, SIGNAL(modelChanged()));
+ mTestObjectInitialized->mDeleteWorker->mIsDeleting = false;
+ VideoCollectionWrapper::mLatestStatusCode = -1;
+ VideoCollectionWrapper::mLatestAdditional = QVariant();
+
+ QList<TMPXItemId> idList;
+ // empty list
+ emit mTestObjectInitialized->mDeleteWorker->deleteStartupFailed(idList);
+ QVERIFY(VideoCollectionWrapper::mLatestStatusCode == -1);
+ QVERIFY(!VideoCollectionWrapper::mLatestAdditional.isValid());
+ QVERIFY(spysignal.count() == 1);
+ spysignal.clear();
+
+
+ idList.append(TMPXItemId(0,0));
+ // list containing something
+ emit mTestObjectInitialized->mDeleteWorker->deleteStartupFailed(idList);
+ QVERIFY(VideoCollectionWrapper::mLatestStatusCode == VideoCollectionCommon::statusMultipleDeleteFail);
+ QVERIFY(VideoCollectionWrapper::mLatestAdditional.isValid());
+ QVERIFY(VideoCollectionWrapper::mLatestAdditional.toInt() == 1);
+ QVERIFY(spysignal.count() == 1);
+ spysignal.clear();
+
+}
+
+// -----------------------------------------------------------------------------
+// testBelongsToAlbum
+// -----------------------------------------------------------------------------
+//
+void TestVideoListDataModel::testBelongsToAlbum()
+{
+ VideoListDataModelPrivate::mBelongsToAlbum = true;
+ TMPXItemId dummyId(1,1);
+ TMPXItemId dummyVideoId(1,0);
+ QVERIFY(mTestObjectInitialized->belongsToAlbum(dummyVideoId, dummyId));
+}
+
+// -----------------------------------------------------------------------------
+// testSetAlbumInUse
+// -----------------------------------------------------------------------------
+//
+void TestVideoListDataModel::testSetAlbumInUse()
+{
+ TMPXItemId dummyId(1,1);
+ mTestObjectInitialized->setAlbumInUse(dummyId);
+ QVERIFY(mTestObjectInitialized->d_ptr->mCurrentAlbum == dummyId);
+}
+
+// -----------------------------------------------------------------------------
+// testreportAsyncStatus
+// -----------------------------------------------------------------------------
+//
+void TestVideoListDataModel::testreportAsyncStatus()
+{
+ mTestObjectInitialized->mDeleteWorker->mIsDeleting = false;
+ VideoCollectionWrapper::mLatestStatusCode = -1;
+ VideoCollectionWrapper::mLatestAdditional = QVariant();
+
+ QVariant data = QString("test");
+ // no deleteworker
+ VideoDeleteWorker *tmp = mTestObjectInitialized->mDeleteWorker;
+ mTestObjectInitialized->mDeleteWorker = 0;
+ mTestObjectInitialized->d_ptr->callModelAsyncReport(VideoCollectionCommon::statusMultipleDeleteFail, data);
+ QVERIFY(VideoCollectionWrapper::mLatestStatusCode == -1);
+ QVERIFY(!VideoCollectionWrapper::mLatestAdditional.isValid());
+ mTestObjectInitialized->mDeleteWorker = tmp;
+
+ // code == VideoCollectionCommon::statusSingleDeleteFail
+ mTestObjectInitialized->mDeleteWorker->mIsDeleting = true;
+ mTestObjectInitialized->d_ptr->callModelAsyncReport(VideoCollectionCommon::statusSingleDeleteFail, data);
+ QVERIFY(VideoCollectionWrapper::mLatestStatusCode == -1);
+ QVERIFY(!VideoCollectionWrapper::mLatestAdditional.isValid());
+ mTestObjectInitialized->mDeleteWorker->mIsDeleting = false;
+ mTestObjectInitialized->d_ptr->callModelAsyncReport(VideoCollectionCommon::statusSingleDeleteFail, data);
+ QVERIFY(VideoCollectionWrapper::mLatestStatusCode == VideoCollectionCommon::statusSingleDeleteFail);
+ QVERIFY(VideoCollectionWrapper::mLatestAdditional.isValid());
+ QVERIFY(VideoCollectionWrapper::mLatestAdditional.toString() == data.toString());
+ VideoCollectionWrapper::mLatestStatusCode = -1;
+ VideoCollectionWrapper::mLatestAdditional = QVariant();
+
+ // code == VideoCollectionCommon::statusMultipleDeleteFail
+ mTestObjectInitialized->mDeleteWorker->mIsDeleting = true;
+ mTestObjectInitialized->d_ptr->callModelAsyncReport(VideoCollectionCommon::statusMultipleDeleteFail, data);
+ QVERIFY(VideoCollectionWrapper::mLatestStatusCode == -1);
+ QVERIFY(!VideoCollectionWrapper::mLatestAdditional.isValid());
+ mTestObjectInitialized->mDeleteWorker->mIsDeleting = false;
+ mTestObjectInitialized->d_ptr->callModelAsyncReport(VideoCollectionCommon::statusMultipleDeleteFail, data);
+ QVERIFY(VideoCollectionWrapper::mLatestStatusCode == VideoCollectionCommon::statusMultipleDeleteFail);
+ QVERIFY(VideoCollectionWrapper::mLatestAdditional.isValid());
+ QVERIFY(VideoCollectionWrapper::mLatestAdditional.toString() == data.toString());
+
+ // code is neither above
+ mTestObjectInitialized->d_ptr->callModelAsyncReport(-2, data);
+ QVERIFY(VideoCollectionWrapper::mLatestStatusCode == -2);
+ QVERIFY(VideoCollectionWrapper::mLatestAdditional.isValid());
+ QVERIFY(VideoCollectionWrapper::mLatestAdditional.toString() == data.toString());
+}
+
+// -----------------------------------------------------------------------------
+// initializeTestObjects
+// -----------------------------------------------------------------------------
+//
+bool TestVideoListDataModel::initializeTestObjects()
+{
+
+ mCollectionStub = NULL;
+ mTestObjectInitialized = NULL;
+ mTestObjectNotInitialized = NULL;
+
+
+ mCollectionStub = new VideoCollectionClient();
+ if(!mCollectionStub)
+ {
+ return false;
+ }
+
+ mTestObjectInitialized = new VideoListDataModel();
+ if(!mTestObjectInitialized)
+ {
+ return false;
+ }
+ VideoCollectionClient::mFailConnectSignals = false;
+ VideoCollectionClient::mFailInitialize = false;
+ VideoListDataModelPrivate::mFailInit = false;
+ if( mTestObjectInitialized->initialize() == -1)
+ {
+ return false;
+ }
+
+ mTestObjectNotInitialized = new VideoListDataModel();
+ if(!mTestObjectNotInitialized)
+ {
+ return false;
+ }
+
+ return true;
+
+}
+
+// -----------------------------------------------------------------------------
+// cleanupTestObjects
+// -----------------------------------------------------------------------------
+//
+void TestVideoListDataModel::cleanupTestObjects()
+{
+ delete mCollectionStub;
+ delete mTestObjectInitialized;
+ delete mTestObjectNotInitialized;
+}
+
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel/stub/inc/videocollectionclient.h Thu Apr 01 23:22:15 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: stubclass of videocollection for testing VideoListDataModel class methods*
+*/
+
+#ifndef __VIDEOCOLLECTIONCLIENT_H
+#define __VIDEOCOLLECTIONCLIENT_H
+
+#include <mpxmedia.h>
+#include <QList>
+
+
+class VideoDataSignalReceiver;
+
+
+class VideoCollectionClient
+{
+
+public: // Constructors and destructor
+
+ /**
+ * constructor.
+ */
+ VideoCollectionClient();
+
+ /**
+ * Destructor.
+ */
+ virtual ~VideoCollectionClient();
+
+ /**
+ * dummy impl
+ */
+ int initialize( VideoDataSignalReceiver* signalReceiver);
+
+ /**
+ * return 0 always, increases global counter by one
+ *
+ * @param TMPXItemId not used
+ *
+ * @return 0
+ */
+ int deleteVideos( QList<TMPXItemId> *ids );
+
+ /**
+ * if true, initializate fails
+ */
+ static bool mFailInitialize;
+
+ /**
+ * if true, connectCollectionSignalReceiver fails
+ */
+ static bool mFailConnectSignals ;
+
+ /**
+ * count of initialize -calls
+ */
+ static int mInitializeCount;
+
+
+};
+
+#endif // __VIDEOCOLLECTIONCLIENT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel/stub/inc/videocollectionutils.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,164 @@
+/*
+* 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: CVideoCollectionUtils class definition*
+*/
+
+#ifndef __VIDEOCOLLECTIONUTILS_H__
+#define __VIDEOCOLLECTIONUTILS_H__
+
+
+// INCLUDES
+#include <QObject>
+#include <QString>
+#include <QStringList>
+#include <mpxmedia.h>
+
+class VideoCollectionUtils
+{
+
+ /**
+ * disable copy-constructor and assignment operator
+ */
+ Q_DISABLE_COPY(VideoCollectionUtils)
+
+public:
+
+
+ /**
+ * Returns singleton instance for this class.
+ *
+ * @return The singleton instance.
+ */
+ static VideoCollectionUtils& instance();
+
+ /**
+ * Gets QString value from provided media -object based on attribute provided
+ *
+ * @param CMPXMedia* pointer to media object from where to get data
+ * @param TMPXAttributeData& attribute to look for
+ * @param QString& wanted value
+ *
+ * @return bool true data value gotten ok
+ */
+ template<class T>
+ bool mediaValue(const CMPXMedia *media, const TMPXAttributeData& attribute, QString& result)
+ {
+ bool status = false;
+ if( media && media->IsSupported(attribute))
+ {
+ HBufC* valueText = NULL;
+ valueText = media->ValueText( attribute ).Alloc();
+ if (valueText && valueText->Length() > 0)
+ {
+ // temp QString needed to make sure string is initialized correctly (Error #424)
+ QString text((QChar*)valueText->Des().Ptr(),valueText->Length());
+ result = text;
+ status = true;
+ }
+ delete valueText;
+ }
+ return status;
+ }
+
+ /**
+ * Gets typed value from provided media -object based on attribute provided
+ *
+ * @param CMPXMedia* pointer to media object from where to get data
+ * @param TMPXAttributeData& attribute to look for
+ * @param T& wanted value
+ *
+ * @return bool true data value gotten ok
+ */
+ template<class T>
+ bool mediaValue(const CMPXMedia *media, const TMPXAttributeData& attribute, T& result)
+ {
+ bool status = false;
+ if(media && media->IsSupported(attribute))
+ {
+ T *pointer = 0;
+ pointer = media->Value<T>(attribute);
+ if(pointer)
+ {
+ result = *pointer;
+ status = true;
+ }
+ }
+ return status;
+ }
+
+ /**
+ * Gets typed pointer from provided media -object based on attribute provided
+ *
+ * @param CMPXMedia* pointer to media object from where to get data
+ * @param TMPXAttributeData& attribute to look for
+ *
+ * @return T* pointer to wanted data (NULL if does not succeed)
+ */
+ template<class T>
+ T* mediaValuePtr(const CMPXMedia *media, const TMPXAttributeData& attribute)
+ {
+ T *pointer = 0;
+ if(media && media->IsSupported(attribute))
+ {
+ pointer = media->Value<T>(attribute);
+ }
+ return pointer;
+ }
+
+ /**
+ * Prepares length string from given value.
+ *
+ * @param length Length value in seconds.
+ * @return Length as string (for example "1min 45sec").
+ */
+ QString prepareLengthString(quint32 length);
+
+ /**
+ * prepares length string
+ */
+ const QStringList prepareLengthStrings(quint32 total);
+
+ /**
+ * Prepares size string from the given value.
+ *
+ * @param size Size value in bytes
+ * @return Size as string (for example "450 kB").
+ */
+ QString prepareSizeString(quint32 size);
+
+public:
+ static QString mPrepareLengthStringReturnValue;
+ static QString mPrepareSizeStringReturnValue;
+
+private:
+
+ /**
+ * Default constructor
+ */
+ VideoCollectionUtils();
+
+ /**
+ * Destructor
+ */
+ ~VideoCollectionUtils();
+
+
+
+};
+#endif // __VIDEOCOLLECTIONUTILS_H__
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel/stub/inc/videocollectionwrapper.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,74 @@
+/*
+* 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 CVideoCollectionWrapper class for unitesting CVideoListData
+*
+*/
+
+#ifndef __VIDEOCOLLECTIONWRAPPER_H__
+#define __VIDEOCOLLECTIONWRAPPER_H__
+
+#include <qvariant.h>
+
+class VideoCollectionWrapper
+{
+
+public: // Constructor
+
+ /**
+ * Returns singleton instance for this class.
+ *
+ * WARNING! Not safe to call this from destructor of another function scope static object!
+ *
+ * @return The singleton instance.
+ */
+ static VideoCollectionWrapper &instance();
+
+
+ /**
+ * stub method for testing, saves mLatestStatusCode and
+ * mLatesAdditional
+ */
+ void sendAsyncStatus(int statusCode, QVariant &additional);
+
+ /**
+ * lates error code gotten from senderror
+ */
+ static int mLatestStatusCode;
+
+ /**
+ * latest additional data saved from senderror
+ */
+ static QVariant mLatestAdditional;
+
+private:
+
+
+ /**
+ * Private contructor.
+ */
+ VideoCollectionWrapper();
+
+ /**
+ * Private destructor.
+ *
+ */
+ virtual ~VideoCollectionWrapper();
+
+};
+
+#endif // __VIDEOCOLLECTIONWRAPPER_H__
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel/stub/inc/videodeleteworker.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,137 @@
+
+
+/*
+* 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: stubclass of videodeleteworker for testing VideoListDataModel class methods*
+*/
+
+#ifndef __VIDEODELETEWORKER_H__
+#define __VIDEODELETEWORKER_H__
+
+#include <QObject>
+#include <QList>
+#include <QVariant>
+#include <mpxitemid.h>
+#include "testvideolistdatamodel.h"
+
+class VideoCollectionClient;
+
+class VideoDeleteWorker : public QObject
+{
+ /**
+ * define to be able to use signals and slots
+ */
+ Q_OBJECT
+
+ /**
+ * disable copy-constructor and assignment operator
+ */
+ Q_DISABLE_COPY(VideoDeleteWorker)
+
+ /**
+ * test class as frient for it to be able all members
+ */
+ friend class TestVideoListDataModel;
+
+public:
+
+ /**
+ * Default constructor
+ */
+ VideoDeleteWorker(VideoCollectionClient &collection, QObject *parent = 0);
+
+ /**
+ * Destructor
+ */
+ ~VideoDeleteWorker();
+
+ /**
+ * Appneds privided list into mRequestList
+ *
+ * @param itemList
+ */
+ void requestDelete(const QList<TMPXItemId> &itemList);
+
+ /**
+ * returns true in case there are items at the delete buffer
+ *
+ * @return bool
+ */
+ bool isDeleting();
+
+ /**
+ * Updates error status
+ *
+ * @param status value to update
+ * @data data to update
+ */
+ void updateStatus(int status, QVariant data);
+
+ /**
+ * returns latest status and data
+ *
+ * @param data to return
+ *
+ * @return status code
+ */
+ int getLastStatus(QVariant &data);
+
+ /**
+ * invalidates status and status data
+ */
+ void clearStatus();
+
+signals:
+
+ /**
+ * dummy signal
+ */
+ void deleteStartupFailed(QList<TMPXItemId>);
+
+
+public slots:
+ /**
+ * dummy slot
+ */
+ void continueSlot(){};
+
+public:
+ /**
+ * list items to be appended
+ */
+ QList<TMPXItemId> mRequestList;
+
+ /**
+ * returned from isDeleting
+ */
+ bool mIsDeleting;
+
+ /**
+ * setted by updateStatus
+ */
+ int mStatus;
+
+ /**
+ * setted by updateStatus
+ */
+ QVariant mStatusData;
+
+ /**
+ * count of constructor calls
+ */
+ static int mCreateCount;
+
+};
+
+#endif // __VIDEODELETEWORKER_H__
--- a/videocollection/videocollectionwrapper/tsrc/testvideomodel/stub/inc/videolistdatamodel_p.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel/stub/inc/videolistdatamodel_p.h Thu Apr 01 23:22:15 2010 +0300
@@ -35,6 +35,10 @@
class VideoListDataModel;
class CMPXMediaArray;
+class DummyData;
+
+
+
class VideoListDataModelPrivate : public VideoDataSignalReceiver
{
@@ -47,7 +51,9 @@
* disable copy-constructor and assignment operator
*/
Q_DISABLE_COPY(VideoListDataModelPrivate)
-
+
+ friend class DummyData;
+
public:
/**
@@ -61,40 +67,6 @@
~VideoListDataModelPrivate();
/**
- * Set global init failure flag value
- */
- static void setInitFailureStatus(bool fail);
-
- /**
- * if override is true returns given size when
- * getvideosizeFromIndex is called
- *
- * @param override if true value is overridden
- * @value value to override
- */
- static void overrideSizeValue(bool override, quint32 value);
-
- /**
- * if override is true returns given size when
- * getvideoDurationFromIndex is called
- *
- * @param override if true value is overridden
- * @param value value to override
- */
- static void overrideDurationValue(bool override, float value);
-
- /**
- * Set counter which is decreased after every getVideoCount -call
- * When counter reaches zero, getVideoCount -call returns 0
- *
- * @param override if true value is overridden
- * @param value value to override
- */
- static void setGetVideoCountFailAfterNCall(int counter);
-
-
-
- /**
* returns 0 or -1 based on global init failure flag
* if flag is true, return 0
*
@@ -102,7 +74,16 @@
*/
int initialize();
-
+ /**
+ * calls model's sidconnect -method (implemented for coverity's sake)
+ */
+ void callModelDisconnect();
+
+ /**
+ * calls model object's reportAsyncStatus
+ */
+ void callModelAsyncReport(int status, QVariant data);
+
signals:
/**
@@ -115,7 +96,7 @@
* Not emitted from here but had to be defined in order to
* get stub into use to testable object
*/
- void videoDetailsReady(int index);
+ void videoDetailsReady(TMPXItemId index);
public: // services
@@ -133,7 +114,7 @@
* @param index
* @return int
*/
- int getMediaIdFromIndex(int index) const;
+ TMPXItemId getMediaIdFromIndex(int index) const;
/**
* return video path of the item with given media id
@@ -210,20 +191,21 @@
int getVideoStatusFromIndex(int index) const;
/**
- * marks video to be removed: it's id and index are saved to
- * mItemsUnderDeletion
+ * marks videos to be removed: it's id and index are saved to
+ * remove buffer in data container
*
- * @param indexes: indexes of videos to be removes
+ * @param itemIndex: index of item to be removed
+ * @return TMPXItemId: id of the item marked
*
*/
- QList<TMPXItemId> markVideosRemoved(const QModelIndexList &indexes);
+ TMPXItemId markVideoRemoved(const QModelIndex &itemIndex);
/**
* Removes provided ids from the remove -list
*
* @param itemIds ids of the items to be removed
*/
- void unMarkVideosRemoved(QList<TMPXItemId> &itemIds);
+ void restoreRemoved(QList<TMPXItemId> *idList);
/**
* Returns the file path of the video.
@@ -231,7 +213,17 @@
* @param index: item position where client wants the file path from.
*/
const QString getFilePathFromIndex(int index) const;
-
+
+ /**
+ * returns mBelongsToAlbum;
+ */
+ bool belongsToAlbum(TMPXItemId itemId, TMPXItemId albumId);
+
+ /**
+ * returns mBelongsToAlbum;
+ */
+ void setAlbumInUse(TMPXItemId albumId);
+
private: // private methods
/**
@@ -298,8 +290,23 @@
*
*/
void videoDetailsCompletedSlot(TMPXItemId videoId);
-
-private:
+
+ /**
+ * not used in stub
+ */
+ void albumListAvailableSlot(TMPXItemId albumId, CMPXMediaArray *albumItems);
+
+ /**
+ * not used in stub
+ */
+ void albumRemoveFailureSlot(QList<TMPXItemId> *items);
+
+ /**
+ * not used in stub
+ */
+ void itemDeletedSlot(TMPXItemId id);
+
+public:
/**
* Pointer to the public class
@@ -308,6 +315,11 @@
VideoListDataModel *q_ptr;
/**
+ * dummy media data wrapper
+ */
+ DummyData &mMediaData;
+
+ /**
* pointer to shared-array of medias
*/
CMPXMediaArray *mMediaArray;
@@ -320,9 +332,82 @@
/**
* marked as removed -map
*/
- QSet<TMPXItemId> mItemsUnderDeletion;
+ QList<TMPXItemId> mItemsUnderDeletion;
+
+ /**
+ * setted in setAlbumInUse
+ */
+ TMPXItemId mCurrentAlbum;
+
+ /**
+ * if true, markVideoRemoved returns invalid id
+ */
+ static bool mReturnInvalidMarked;
+
+ /**
+ * if true, initialize fails
+ */
+ static bool mFailInit;
+
+ /**
+ * if true, size returned is mSize
+ */
+ static bool mOverrideSize;
+
+ /**
+ * overrided size value
+ */
+ static quint32 mSize;
+
+ /**
+ * if true, dureation returned is mDuration
+ */
+ static bool mOverrideDuration;
+
+ /**
+ * overrided duration
+ */
+ static quint32 mDuration;
+
+ /**
+ * value from videocount to be returned
+ */
+ static int mGetVideoCountFail;
+
+ /**
+ * value from belongsToAlbum to be returned
+ */
+ static bool mBelongsToAlbum;
};
+
+/**
+ * dummy data wrapper class
+ */
+class DummyData
+{
+public:
+
+ int indexOfId(TMPXItemId id)
+ {
+ if(!mObj->mMediaArray)
+ {
+ return -1;
+ }
+
+ for(int i = 0; i < mObj->getVideoCount(); ++i)
+ {
+ if(id == mObj->getMediaIdFromIndex(i))
+ {
+ return i;
+ }
+ }
+ return -1;
+ }
+
+ VideoListDataModelPrivate *mObj;
+};
+
#endif // __VIDEOLISTDATA_H__
// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel/stub/src/videocollectionclient.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,64 @@
+/*
+* 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: stubclass of videocollection for testing VideoListDataModel class methods*
+*/
+
+
+
+// INCLUDE FILES
+#include "videocollectionclient.h"
+#include "videodatasignalreceiver.h"
+
+bool VideoCollectionClient::mFailInitialize = false;
+
+bool VideoCollectionClient::mFailConnectSignals = false;
+
+int VideoCollectionClient::mInitializeCount = 0;
+
+
+
+// -----------------------------------------------------------------------------
+// VideoCollectionClient
+// -----------------------------------------------------------------------------
+//
+VideoCollectionClient::VideoCollectionClient()
+{
+}
+
+
+// -----------------------------------------------------------------------------
+// ~VideoCollectionClient
+// -----------------------------------------------------------------------------
+//
+VideoCollectionClient::~VideoCollectionClient()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// initialize
+// -----------------------------------------------------------------------------
+//
+int VideoCollectionClient::initialize( VideoDataSignalReceiver* /*signalReceiver*/)
+{
+ mInitializeCount++;
+ if(mFailInitialize)
+ {
+ return -1;
+ }
+ return 0;
+}
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel/stub/src/videocollectionutils.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,209 @@
+/*
+* 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: CVideoCollectionUtils class implementation
+*
+*/
+
+// INCLUDE FILES
+
+
+#include <qobject.h>
+#include "videocollectionutils.h"
+
+QString VideoCollectionUtils::mPrepareLengthStringReturnValue = "test duration";
+QString VideoCollectionUtils::mPrepareSizeStringReturnValue = "test size";
+
+// -----------------------------------------------------------------------------
+// instance
+// -----------------------------------------------------------------------------
+//
+VideoCollectionUtils& VideoCollectionUtils::instance()
+{
+ static VideoCollectionUtils _collectionUtilsInstance;
+ return _collectionUtilsInstance;
+}
+
+// -----------------------------------------------------------------------------
+// CVideoCollectionUtils
+// -----------------------------------------------------------------------------
+//
+VideoCollectionUtils::VideoCollectionUtils()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// ~CVideoCollectionUtils
+// -----------------------------------------------------------------------------
+//
+VideoCollectionUtils::~VideoCollectionUtils()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// prepareLengthString
+// -----------------------------------------------------------------------------
+//
+QString VideoCollectionUtils::prepareLengthString(quint32 length)
+{
+ const int secondsInMinute( 60 );
+ const int secondsInHour( 3600 );
+ QString lengthStr("");
+
+ if ( length > 0 )
+ {
+ quint32 hours = length / secondsInHour;
+ quint32 minutes = length / secondsInMinute % secondsInMinute;
+ quint32 seconds = length % secondsInMinute;
+
+ if ( hours > 0 )
+ {
+ if(hours == 1)
+ {
+ lengthStr = QObject::tr("%1 hour ").arg(QString::number(hours));
+ }
+ else
+ {
+ lengthStr += QObject::tr("%1 hours ").arg(QString::number(hours));
+ }
+ }
+
+ if ( minutes > 0 )
+ {
+ if(minutes == 1)
+ {
+ lengthStr += QObject::tr("%1 minute ").arg(QString::number(minutes));
+ }
+ else
+ {
+ lengthStr += QObject::tr("%1 minutes ").arg(QString::number(minutes));
+ }
+ }
+ if (seconds > 0 && hours == 0)
+ {
+ if(seconds == 1)
+ {
+ lengthStr += QObject::tr("%1 second").arg(QString::number(seconds));
+ }
+ else
+ {
+ lengthStr += QObject::tr("%1 seconds").arg(QString::number(seconds));
+ }
+ }
+ } else {
+ lengthStr += QObject::tr("0 seconds");
+ }
+
+ return lengthStr;
+}
+
+// -----------------------------------------------------------------------------
+// VideoCollectionUtils::prepareLengthStrings()
+// -----------------------------------------------------------------------------
+//
+const QStringList VideoCollectionUtils::prepareLengthStrings(quint32 total)
+{
+ const int secondsInMinute( 60 );
+
+ quint32 minutes(0);
+ quint32 seconds(0);
+
+ if ( total > 0 )
+ {
+ minutes = (total / secondsInMinute);
+ seconds = (total % secondsInMinute);
+ }
+
+ QString mins("");
+ QString secs("");
+
+ if (minutes < 10)
+ {
+ mins = "0" + QString::number(minutes);
+
+ }
+ else
+ {
+ mins = QString::number(minutes);
+ }
+
+ QString secondsStr("");
+
+ if (seconds < 10)
+ {
+ secs = "0" + QString::number(seconds);
+
+ }
+ else
+ {
+ secs = QString::number(seconds);
+ }
+
+ QStringList retVal;
+
+ retVal.append(mins);
+ retVal.append(secs);
+
+ return retVal;
+}
+
+
+// -----------------------------------------------------------------------------
+// prepareSizeString
+// -----------------------------------------------------------------------------
+//
+QString VideoCollectionUtils::prepareSizeString(quint32 size)
+{
+ const int videoSizeGB( 0x40000000 );
+ const int videoSizeHalfGB( 0x20000000 );
+ const int videoSizeMB( 0x100000 );
+ const int videoSizeHalfMB( 0x80000 );
+ const int videoSizeKB( 0x400 );
+ const int videoSizeHalfKB( 0x200 );
+
+ QString sizeStr("");
+
+ if ( size > 0 )
+ {
+ quint32 dispSize = 0;
+
+ if ( size >= videoSizeGB )
+ {
+ dispSize = size + videoSizeHalfGB;
+ dispSize /= videoSizeGB;
+ sizeStr = QString(QObject::tr("%1 GB").arg(QString::number(dispSize)));
+ }
+ else if ( size >= videoSizeMB )
+ {
+ dispSize = size + videoSizeHalfMB;
+ dispSize /= videoSizeMB;
+ sizeStr = QString(QObject::tr("%1 MB").arg(QString::number(dispSize)));
+ }
+ else if (size >= videoSizeKB)
+ {
+ dispSize = size + videoSizeHalfKB;
+ dispSize /= videoSizeKB;
+ sizeStr = QString(QObject::tr("%1 kB").arg(QString::number(dispSize)));
+ }
+ else
+ {
+ sizeStr = QString(QObject::tr("%1B").arg(QString::number(size)));
+ }
+ }
+
+ return sizeStr;
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel/stub/src/videocollectionwrapper.cpp Thu Apr 01 23:22:15 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 CVideoCollectionWrapper class for unitesting CVideoListData
+*
+*/
+
+// INCLUDE FILES
+
+#include "videocollectionwrapper.h"
+
+int VideoCollectionWrapper::mLatestStatusCode = -1;
+
+QVariant VideoCollectionWrapper::mLatestAdditional = QVariant();
+
+
+
+// -----------------------------------------------------------------------------
+// CVideoCollectionWrapper::CVideoCollectionWrapper()
+// -----------------------------------------------------------------------------
+//
+VideoCollectionWrapper &VideoCollectionWrapper::instance()
+{
+ static VideoCollectionWrapper __staticInstance;
+ return __staticInstance;
+}
+
+// -----------------------------------------------------------------------------
+// CVideoCollectionWrapper::CVideoCollectionWrapper()
+// -----------------------------------------------------------------------------
+//
+VideoCollectionWrapper::VideoCollectionWrapper()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// CVideoCollectionWrapper::~CVideoCollectionWrapper()
+// -----------------------------------------------------------------------------
+//
+VideoCollectionWrapper::~VideoCollectionWrapper()
+{
+
+}
+
+
+// -----------------------------------------------------------------------------
+// CVideoCollectionWrapper::sendError()
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionWrapper::sendAsyncStatus(int statusCode, QVariant &additional)
+{
+ mLatestStatusCode = statusCode;
+ mLatestAdditional = additional;
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel/stub/src/videodeleteworker.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,97 @@
+/*
+* 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: stubclass of videodeleteworker for testing VideoListDataModel class methods*
+*/
+
+
+
+// INCLUDE FILES
+#include "videodeleteworker.h"
+
+int VideoDeleteWorker::mCreateCount = 0;
+
+// -----------------------------------------------------------------------------
+// VideoDeleteWorker
+// -----------------------------------------------------------------------------
+//
+VideoDeleteWorker::VideoDeleteWorker(VideoCollectionClient &collection, QObject *parent) :
+mIsDeleting(false),
+mStatus(-1),
+mStatusData(QVariant())
+{
+ Q_UNUSED(collection);
+ Q_UNUSED(parent);
+ mCreateCount++;
+}
+
+
+// -----------------------------------------------------------------------------
+// ~VideoDeleteWorker
+// -----------------------------------------------------------------------------
+//
+VideoDeleteWorker::~VideoDeleteWorker()
+{
+ mRequestList.clear();
+}
+
+// -----------------------------------------------------------------------------
+// requestDelete
+// -----------------------------------------------------------------------------
+//
+void VideoDeleteWorker::requestDelete(const QList<TMPXItemId> &itemList)
+{
+ mRequestList.append(itemList);
+}
+
+// -----------------------------------------------------------------------------
+// isDeleting
+// -----------------------------------------------------------------------------
+//
+bool VideoDeleteWorker::isDeleting()
+{
+ return mIsDeleting;
+}
+
+// -----------------------------------------------------------------------------
+// updateStatus
+// -----------------------------------------------------------------------------
+//
+void VideoDeleteWorker::updateStatus(int status, QVariant data)
+{
+ mStatus = status;
+ mStatusData = data;
+}
+
+// -----------------------------------------------------------------------------
+// clearStatus
+// -----------------------------------------------------------------------------
+//
+void VideoDeleteWorker::clearStatus()
+{
+ mStatus = -1;
+ mStatusData = QVariant();
+}
+
+// -----------------------------------------------------------------------------
+// getLastStatus
+// -----------------------------------------------------------------------------
+//
+int VideoDeleteWorker::getLastStatus(QVariant &data)
+{
+ data = mStatusData;
+ return mStatus;
+}
+
+
+
--- a/videocollection/videocollectionwrapper/tsrc/testvideomodel/stub/src/videolistdatamodel_p.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel/stub/src/videolistdatamodel_p.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -56,69 +56,24 @@
return status;
}
+bool VideoListDataModelPrivate::mReturnInvalidMarked = false;
+
/**
* init failure flag
*/
-bool gFailInit = false;
+bool VideoListDataModelPrivate::mFailInit = false;
-/**
- * override size flag and value
- */
-bool gOverrideSize = false;
-quint32 gSize = 0;
-/**
- * override duration flag and value
- */
-bool gOverrideDuration = false;
-quint32 gDuration = 0;
-
-/**
- * getVideoCount failure counter. if under 0, never fails
- *
- */
-int gGetVideoCountFail = -1;
+bool VideoListDataModelPrivate::mOverrideSize = false;
+quint32 VideoListDataModelPrivate::mSize = 0;
-/////
-// static helpers
-// -----------------------------------------------------------------------------
-// overrideSizeValue
-// -----------------------------------------------------------------------------
-//
-void VideoListDataModelPrivate::overrideSizeValue(bool override, quint32 value)
-{
- gOverrideSize = override;
- gSize = value;
-}
+bool VideoListDataModelPrivate::mOverrideDuration = false;
+quint32 VideoListDataModelPrivate::mDuration = 0;
-// -----------------------------------------------------------------------------
-// overrideDurationValue
-// -----------------------------------------------------------------------------
-//
-void VideoListDataModelPrivate::overrideDurationValue(bool override, float value)
-{
- gOverrideDuration = override;
- gDuration = value;
-}
+int VideoListDataModelPrivate::mGetVideoCountFail = -1;
-// -----------------------------------------------------------------------------
-// setInitFailureStatus
-// -----------------------------------------------------------------------------
-//
-void VideoListDataModelPrivate::setInitFailureStatus(bool fail)
-{
- gFailInit = fail;
-}
-
-// -----------------------------------------------------------------------------
-// setGetVideoCountFailAfterNCall
-// -----------------------------------------------------------------------------
-//
-void VideoListDataModelPrivate::setGetVideoCountFailAfterNCall(int counter)
-{
- gGetVideoCountFail = counter;
-}
+bool VideoListDataModelPrivate::mBelongsToAlbum = false;
// -----------------------------------------------------------------------------
// CVideoListData
@@ -126,8 +81,10 @@
//
VideoListDataModelPrivate::VideoListDataModelPrivate(VideoListDataModel *model) :
q_ptr(model),
+mMediaData(*(new DummyData)),
mMediaArray(0)
{
+ mMediaData.mObj = this;
mIcon = QIcon(":/icons/default_thumbnail.svg");
}
@@ -137,6 +94,7 @@
//
VideoListDataModelPrivate::~VideoListDataModelPrivate()
{
+ delete &mMediaData;
}
// -----------------------------------------------------------------------------
@@ -145,7 +103,7 @@
//
int VideoListDataModelPrivate::initialize()
{
- if(gFailInit)
+ if(mFailInit)
{
return -1;
}
@@ -154,6 +112,24 @@
}
// -----------------------------------------------------------------------------
+// callModelDisconnect
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModelPrivate::callModelDisconnect()
+{
+ q_ptr->disconnectSignals();
+}
+
+// -----------------------------------------------------------------------------
+// callModelAsyncReport
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModelPrivate::callModelAsyncReport(int status, QVariant data)
+{
+ q_ptr->reportAsyncStatus(status, data);
+}
+
+// -----------------------------------------------------------------------------
// getVideoCount
// -----------------------------------------------------------------------------
//
@@ -164,8 +140,8 @@
{
count = mMediaArray->Count();
}
- gGetVideoCountFail--;
- if(gGetVideoCountFail == 0)
+ mGetVideoCountFail--;
+ if(mGetVideoCountFail == 0)
{
return 0;
}
@@ -202,9 +178,9 @@
//
quint32 VideoListDataModelPrivate::getVideoSizeFromIndex( int index ) const
{
- if(gOverrideSize)
+ if(mOverrideSize)
{
- return gSize;
+ return mSize;
}
quint32 size(0);
CMPXMedia *media = getMediaFromIndex(index);
@@ -221,9 +197,9 @@
//
quint32 VideoListDataModelPrivate::getVideodurationFromIndex( int index ) const
{
- if(gOverrideDuration)
+ if(mOverrideDuration)
{
- return gDuration;
+ return mDuration;
}
quint32 returnDuration(0);
float duration(0);
@@ -275,7 +251,7 @@
// getMediaIdFromIndex
// -----------------------------------------------------------------------------
//
-int VideoListDataModelPrivate::getMediaIdFromIndex( int index ) const
+TMPXItemId VideoListDataModelPrivate::getMediaIdFromIndex( int index ) const
{
return getMediaId( getMediaFromIndex(index) );
}
@@ -290,6 +266,27 @@
}
// -----------------------------------------------------------------------------
+// getFilePathForId
+// -----------------------------------------------------------------------------
+//
+bool VideoListDataModelPrivate::belongsToAlbum(TMPXItemId itemId, TMPXItemId albumId)
+{
+ Q_UNUSED(itemId);
+ Q_UNUSED(albumId);
+ return mBelongsToAlbum;
+}
+
+// -----------------------------------------------------------------------------
+// setAlbumInUse
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModelPrivate::setAlbumInUse(TMPXItemId albumId)
+{
+ mCurrentAlbum = albumId;
+}
+
+
+// -----------------------------------------------------------------------------
// getVideoStatusFromIndex
// -----------------------------------------------------------------------------
//
@@ -308,39 +305,31 @@
// markVideoRemoved
// -----------------------------------------------------------------------------
//
-QList<TMPXItemId> VideoListDataModelPrivate::markVideosRemoved(const QModelIndexList &indexes)
+TMPXItemId VideoListDataModelPrivate::markVideoRemoved(const QModelIndex &itemIndex)
{
- mItemsUnderDeletion.clear();
- QList<TMPXItemId> idList;
- if(!mMediaArray)
+ TMPXItemId id = TMPXItemId::InvalidId();
+ if(!mReturnInvalidMarked)
{
- return idList;
+ if(!itemIndex.isValid() || itemIndex.row() >= mMediaArray->Count())
+ {
+ return id;
+ }
+ id = getMediaIdFromIndex(itemIndex.row());
+ mItemsUnderDeletion.append(id);
}
-
- TMPXItemId id;
- QModelIndex index;
- foreach(index, indexes)
- {
- id = getMediaIdFromIndex(index.row());
- if(id != TMPXItemId::InvalidId())
- {
- mItemsUnderDeletion.insert(id);
- idList.append(id);
- }
- }
- return idList;
+ return id;
}
// -----------------------------------------------------------------------------
-// unMarkVideosRemoved
+// restoreRemoved
// -----------------------------------------------------------------------------
//
-void VideoListDataModelPrivate::unMarkVideosRemoved(QList<TMPXItemId> &itemIds)
+void VideoListDataModelPrivate::restoreRemoved(QList<TMPXItemId> *idList)
{
TMPXItemId id;
- foreach(id, itemIds)
+ foreach(id, *idList)
{
- mItemsUnderDeletion.remove(id);
+ mItemsUnderDeletion.removeAll(id);
}
}
@@ -428,35 +417,37 @@
// appendVideoListSlot
// -----------------------------------------------------------------------------
//
-void VideoListDataModelPrivate::appendVideoListSlot(CMPXMediaArray* /*aVideo*/)
+void VideoListDataModelPrivate::appendVideoListSlot(CMPXMediaArray* aVideo)
{
- // NOP
+ Q_UNUSED(aVideo);
}
// -----------------------------------------------------------------------------
// newVideoAvailable
// -----------------------------------------------------------------------------
//
-void VideoListDataModelPrivate::newVideoAvailableSlot(CMPXMedia* /*aVideo*/)
+void VideoListDataModelPrivate::newVideoAvailableSlot(CMPXMedia* aVideo)
{
- // NOP
+ Q_UNUSED(aVideo);
}
// -----------------------------------------------------------------------------
// videoDeleted
// -----------------------------------------------------------------------------
//
-void VideoListDataModelPrivate::videoDeletedSlot(TMPXItemId /*videoId*/)
+void VideoListDataModelPrivate::videoDeletedSlot(TMPXItemId videoId)
{
- // NOP
+ Q_UNUSED(videoId);
}
// -----------------------------------------------------------------------------
// videoDeleteCompleted
// -----------------------------------------------------------------------------
//
-void VideoListDataModelPrivate::videoDeleteCompletedSlot(int overallCount, QList<TMPXItemId> */*failedMediaIds*/)
+void VideoListDataModelPrivate::videoDeleteCompletedSlot(int overallCount, QList<TMPXItemId> *failedMediaIds)
{
+ Q_UNUSED(overallCount);
+ Q_UNUSED(failedMediaIds);
mItemsUnderDeletion.clear();
}
@@ -464,9 +455,38 @@
// videoDetailsCompleted
// -----------------------------------------------------------------------------
//
-void VideoListDataModelPrivate::videoDetailsCompletedSlot(TMPXItemId /*videoId*/)
+void VideoListDataModelPrivate::videoDetailsCompletedSlot(TMPXItemId videoId)
+{
+ Q_UNUSED(videoId);
+}
+
+// -----------------------------------------------------------------------------
+// albumListAvailableSlot
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModelPrivate::albumListAvailableSlot(TMPXItemId albumId,
+ CMPXMediaArray *albumItems)
{
- // NOP
+ Q_UNUSED(albumId);
+ Q_UNUSED(albumItems);
+}
+
+// -----------------------------------------------------------------------------
+// albumRemoveFailureSlot
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModelPrivate::albumRemoveFailureSlot(QList<TMPXItemId> *items)
+{
+ Q_UNUSED(items);
+}
+
+// -----------------------------------------------------------------------------
+// itemDeletedSlot
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModelPrivate::itemDeletedSlot(TMPXItemId id)
+{
+ Q_UNUSED(id);
}
// End of file
--- a/videocollection/videocollectionwrapper/tsrc/testvideomodel/testvideomodel.pro Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel/testvideomodel.pro Thu Apr 01 23:22:15 2010 +0300
@@ -28,20 +28,25 @@
# Input
HEADERS += ../../inc/videolistdatamodel.h \
../../inc/videodatasignalreceiver.h \
- ../../inc/videocollectionutils.h \
+ ../../../inc/videocollectioncommon.h \
inc/testvideolistdatamodel.h \
inc/mediaobjectfactory.h \
+ stub/inc/videocollectionutils.h \
stub/inc/videolistdatamodel_p.h \
stub/inc/videocollectionclient.h \
+ stub/inc/videodeleteworker.h \
+ stub/inc/videocollectionwrapper.h
-SOURCES += ../../src/videolistdatamodel.cpp \
- ../../src/videocollectionutils.cpp \
+SOURCES += ../../src/videolistdatamodel.cpp \
src/testvideolistdatamodel.cpp \
src/mediaobjectfactory.cpp \
+ stub/src/videocollectionutils.cpp \
stub/src/videolistdatamodel_p.cpp \
stub/src/videocollectionclient.cpp \
+ stub/src/videodeleteworker.cpp \
+ stub/src/videocollectionwrapper.cpp
RESOURCES += data/testvideolistdatamodel.qrc
--- a/videocollection/videocollectionwrapper/tsrc/testvideomodel_p/inc/testvideomodel_p.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel_p/inc/testvideomodel_p.h Thu Apr 01 23:22:15 2010 +0300
@@ -24,7 +24,6 @@
// INCLUDES
#include <QtTest/QtTest>
#include <QList>
-#include "videocollectionwrapper.h"
#include <e32const.h>
#include <mpxitemid.h>
@@ -154,6 +153,11 @@
void testGetMetaDataFromIndex();
/**
+ * verifies markVideoRemoved and restoreRemoved
+ */
+ void testVideoMarkAndRestoreDeleted();
+
+ /**
* verifies getFilePathFromIndex
*/
void testGetFilePathFromIndex();
@@ -162,12 +166,7 @@
* verifies getFilePathForId
*/
void testGetFilePathForId();
-
- /**
- * verifies markVideoRemoved and getVideoStatusFromIndex
- */
- void testVideoStatus();
-
+
/**
* verifies thumbnailsFetchedSlot
*/
@@ -206,7 +205,7 @@
/**
* verifies getVideoCount when fetching collections
*/
- void testCollectionItemCount();
+ void testCollectionItemCount();
/**
* verifies getMediaIdFromIndex when fetching collections
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel_p/src/mediaobjectfactory.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,418 @@
+
+/*
+* 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 for creating mediaobjects for testing CVideoListDataModel class methods*
+*/
+
+// INCLUDES
+
+#include <mpxmediageneraldefs.h>
+#include <mpxmediaarray.h>
+#include <mpxmedia.h>
+#include <qdatetime.h>
+#include "vcxmyvideosdefs.h"
+#include "mediaobjectfactory.h"
+
+// -----------------------------------------------------------------------------
+// MediaObjectFactory
+// -----------------------------------------------------------------------------
+//
+MediaObjectFactory::MediaObjectFactory() :
+ mArray(0)
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// ~MediaObjectFactory
+// -----------------------------------------------------------------------------
+//
+MediaObjectFactory::~MediaObjectFactory()
+{
+ removeArray();
+}
+
+// -----------------------------------------------------------------------------
+// mediaArray
+// -----------------------------------------------------------------------------
+//
+CMPXMediaArray* MediaObjectFactory::mediaArray()
+{
+ return mArray;
+}
+
+// -----------------------------------------------------------------------------
+// copyOfMediaArray
+// -----------------------------------------------------------------------------
+//
+CMPXMediaArray* MediaObjectFactory::copyOfMediaArray()
+{
+ CMPXMediaArray *copyArray = 0;
+ if(mArray)
+ {
+ TRAP_IGNORE(copyArray = CMPXMediaArray::NewL(*mArray));
+ }
+ return copyArray;
+}
+
+// -----------------------------------------------------------------------------
+// createMediaItems
+// -----------------------------------------------------------------------------
+//
+void MediaObjectFactory::createMediaItems(int count, int flags)
+{
+ if(!mArray)
+ {
+ TRAPD(error, mArray = CMPXMediaArray::NewL() )
+ if(!mArray)
+ {
+ return;
+ }
+ }
+ int nextPossibleIndex = mArray->Count();
+
+ CMPXMedia *media;
+
+ for(int i = 0; i < count; ++i)
+ {
+ media = getMedia(i, flags);
+ if(!media)
+ {
+ delete mArray;
+ mArray = 0;
+ return;
+ }
+
+
+ TRAPD(error, mArray->AppendL(media));
+ if(error != KErrNone)
+ {
+ delete mArray;
+ mArray = 0;
+ return;
+ }
+ }
+}
+
+
+// -----------------------------------------------------------------------------
+// createCollectionItems
+// -----------------------------------------------------------------------------
+//
+void MediaObjectFactory::createCollectionItems()
+{
+ if(!mArray)
+ {
+ TRAPD(error, mArray = CMPXMediaArray::NewL() )
+ if(!mArray)
+ {
+ return;
+ }
+ }
+ int nextPossibleIndex = mArray->Count();
+
+ for(int i = KVcxMvcCategoryIdDownloads; i <= KVcxMvcCategoryIdOther; ++i)
+ {
+ CMPXMedia *media = NULL;
+ TRAP_IGNORE(media = CMPXMedia::NewL());
+ if(!media)
+ {
+ return;
+ }
+ TMPXItemId itemId;
+
+ // set media id
+ itemId.iId1 = i;
+ itemId.iId2 = 1;
+ TRAPD(error, media->SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, itemId));
+ if(error != KErrNone)
+ {
+ delete media;
+ return;
+ }
+ TBuf<65> videoname;
+ videoname.Format(KMediaTestNamePrefix, index);
+ TRAP(error, media->SetTextValueL( KMPXMediaGeneralTitle, videoname));
+ if(error != KErrNone)
+ {
+ delete mArray;
+ mArray = 0;
+ return;
+ }
+ if(!media)
+ {
+ delete mArray;
+ mArray = 0;
+ return;
+ }
+
+ TRAP(error, mArray->AppendL(media));
+ if(error != KErrNone)
+ {
+ delete mArray;
+ mArray = 0;
+ return;
+ }
+ }
+}
+
+CMPXMedia* MediaObjectFactory::getMediaWithWantedIds(int id1, int id2)
+{
+ CMPXMedia *media = NULL;
+ TRAP_IGNORE(media = CMPXMedia::NewL());
+ TMPXItemId itemId;
+ if(!media)
+ {
+ return 0;
+ }
+ itemId.iId1 = id1;//category all
+ itemId.iId2 = id2;//iId2 = 1 for category item
+
+ TRAPD(error, media->SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, itemId));
+ if(error != KErrNone)
+ {
+ delete media;
+ return 0;
+ }
+ return media;
+}
+
+// -----------------------------------------------------------------------------
+// getMedia
+// -----------------------------------------------------------------------------
+//
+CMPXMedia* MediaObjectFactory::getMedia(int index, int dataSelectionFlags)
+{
+ CMPXMedia *media = NULL;
+ TRAP_IGNORE(media = CMPXMedia::NewL());
+ if(!media)
+ {
+ return 0;
+ }
+
+ TMPXItemId itemId = TMPXItemId::InvalidId();
+
+ // set media id
+ if(dataSelectionFlags & MediaDataId)
+ {
+ itemId.iId1 = index;//category all
+ itemId.iId2 = 0;//iId2 = 1 for category item
+ }
+ TRAPD(error, media->SetTObjectValueL<TMPXItemId>(KMPXMediaGeneralId, itemId));
+ if(error != KErrNone)
+ {
+ delete media;
+ return 0;
+ }
+ if(!fillData(media, index, dataSelectionFlags))
+ {
+ return 0;
+ }
+ return media;
+}
+// -----------------------------------------------------------------------------
+// fillData
+// -----------------------------------------------------------------------------
+//
+bool MediaObjectFactory::fillData(CMPXMedia *media, int index, int dataSelectionFlags)
+{
+ TBuf<65> videoname;
+ // set media name
+ if(dataSelectionFlags & MediaDataName)
+ {
+ videoname.Format(KMediaTestNamePrefix, index);
+ TRAPD(error, media->SetTextValueL( KMPXMediaGeneralTitle, videoname));
+ if(error != KErrNone)
+ {
+ delete media;
+ return false;
+ }
+ }
+
+ // set media rating
+ if(dataSelectionFlags & MediaDataRatingFlag)
+ {
+ // index: 0 1 2 3 4 5 6 7 8 9 ...
+ // value: 1 2 3 4 5 1 2 3 ...
+ int rating = (index%5) + 1;
+ TRAPD(error, media->SetTObjectValueL<TInt>(KVcxMediaMyVideosRating, rating));
+ if(error != KErrNone)
+ {
+ delete media;
+ return false;
+ }
+ }
+
+ // set media date
+ if(dataSelectionFlags & MediaDataDateFlag)
+ {
+ TDateTime dateTime;
+ dateTime.Set(2009, TMonth(index), index, index+1, index+1, index+1, index+1);
+ TTime ttimeDate(dateTime);
+ TInt64 temp= ttimeDate.Int64();
+ TRAPD(error, media->SetTObjectValueL<TInt64>(KMPXMediaGeneralDate, ttimeDate.Int64()));
+ if(error != KErrNone)
+ {
+ delete media;
+ return false;
+ }
+ }
+
+ // set duration
+ if(dataSelectionFlags & MediaDataDurationFlag)
+ {
+ float duration = 1.0 + index;
+ TRAPD(error, media->SetTObjectValueL<float>(KVcxMediaMyVideosDuration, duration));
+ if(error != KErrNone)
+ {
+ delete media;
+ return false;
+ }
+ }
+
+ // set size
+ if(dataSelectionFlags & MediaDataSizeFlag)
+ {
+ quint32 size = 1.0 + index;
+ TRAPD(error, media->SetTObjectValueL<quint32>(KMPXMediaGeneralSize, size));
+ if(error != KErrNone)
+ {
+ delete media;
+ return false;
+ }
+ }
+
+ // set age profile
+ if(dataSelectionFlags & MediaDataAgeProfile)
+ {
+ // index: 0 1 2 3 4 5 6 7 8 9 ...
+ // value: 1 2 3 4 5 1 2 3 ...
+ quint32 profile = (index%5) + 1;
+ TRAPD(error, media->SetTObjectValueL<quint32>(KVcxMediaMyVideosAgeProfile, profile));
+ if(error != KErrNone)
+ {
+ delete media;
+ return false;
+ }
+ }
+
+ // set "filepath"
+ if(dataSelectionFlags & MediaDataFilePath)
+ {
+ videoname.Format(KMediaTestPathPrefix, index);
+ TRAPD(error, media->SetTextValueL( KMPXMediaGeneralUri, videoname));
+ if(error != KErrNone)
+ {
+ delete media;
+ return false;
+ }
+ }
+
+ // set description
+ if(dataSelectionFlags & MediaDataDesc)
+ {
+ videoname.Format(KMediaTestDescPrefix, index);
+ TRAPD(error, media->SetTextValueL( KMPXMediaGeneralComment, videoname));
+ if(error != KErrNone)
+ {
+ delete media;
+ return false;
+ }
+ }
+
+ // set author
+ if(dataSelectionFlags & MediaDataAuthor)
+ {
+ videoname.Format(KMediaTestAuthorPrefix, index);
+ TRAPD(error, media->SetTextValueL( KVcxMediaMyVideosAuthor, videoname));
+ if(error != KErrNone)
+ {
+ delete media;
+ return false;
+ }
+ }
+
+ // set copyright
+ if(dataSelectionFlags & MediaDataCopyright)
+ {
+ videoname.Format(KMediaTestCopyrightPrefix, index);
+ TRAPD(error, media->SetTextValueL( KMPXMediaGeneralCopyright, videoname));
+ if(error != KErrNone)
+ {
+ delete media;
+ return false;
+ }
+ }
+
+ // set language
+ if(dataSelectionFlags & MediaDataLanguage)
+ {
+ videoname.Format(KMediaTestLanguagePrefix, index);
+ TRAPD(error, media->SetTextValueL( KVcxMediaMyVideosAudioLanguage, videoname));
+ if(error != KErrNone)
+ {
+ delete media;
+ return false;
+ }
+ }
+
+ // set format
+ if(dataSelectionFlags & MediaDataFormat)
+ {
+ videoname.Format(KMediaTestFormatPrefix, index);
+ TRAPD(error, media->SetTextValueL( KMPXMediaGeneralMimeType, videoname));
+ if(error != KErrNone)
+ {
+ delete media;
+ return false;
+ }
+ }
+
+ // set media modified date
+ if(dataSelectionFlags & MediaDataModified)
+ {
+ QDateTime date = QDateTime::currentDateTime();
+ date = date.addDays((index+1)*2);
+
+ TDateTime dateTime;
+
+ dateTime.Set(date.date().year(), TMonth(date.date().month() - 1), date.date().day(),
+ date.time().hour(), date.time().minute(),
+ date.time().second(), date.time().msec());
+ TTime ttimeDate(dateTime);
+ TInt64 temp= ttimeDate.Int64();
+ TRAPD(error, media->SetTObjectValueL<TInt64>(KVcxMediaMyVideosModifiedDate, ttimeDate.Int64()));
+ if(error != KErrNone)
+ {
+ delete media;
+ return false;
+ }
+ }
+ return true;
+}
+
+// -----------------------------------------------------------------------------
+// removeArray
+// -----------------------------------------------------------------------------
+//
+void MediaObjectFactory::removeArray()
+{
+ delete mArray;
+ mArray = 0;
+}
+
+// End of file
+
+
+
--- a/videocollection/videocollectionwrapper/tsrc/testvideomodel_p/src/testvideomodel_p.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel_p/src/testvideomodel_p.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -21,10 +21,12 @@
#include <mpxmedia.h>
#include <vcxmyvideosdefs.h>
#include <qabstractitemmodel.h>
+#include "testvideomodel_p.h"
+
#include "videocollectionutils.h"
#include "videothumbnaildata.h"
#include "videolistdatamodel.h"
-#include "testvideomodel_p.h"
+
#include "mediaobjectfactory.h"
#include "videocollectioncommon.h"
#include "videocollectionutils.h"
@@ -49,12 +51,19 @@
TestVideoModel_p tv;
- char *pass[3];
- pass[0] = argv[0];
- pass[1] = "-o";
- pass[2] = "c:\\data\\testvideomodel_p.txt";
-
- int res = QTest::qExec(&tv, 3, pass);
+ 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\\testvideomodel_p.txt";
+ res = QTest::qExec(&tv, 3, pass);
+ }
return res;
}
@@ -63,8 +72,10 @@
// initTestCase
// -----------------------------------------------------------------------------
//
+
void TestVideoModel_p::initTestCase()
{
+ qRegisterMetaType<TMPXItemId>("TMPXItemId");
mTestObject = 0;
mMediaFactory = new MediaObjectFactory();
@@ -81,7 +92,7 @@
mTestObject = new VideoListDataModelPrivate(mStubModel);
QVERIFY(mTestObject);
VideoCollectionUtils::mPrepareLengthStringReturnValue = "test duration";
- VideoCollectionUtils::mPrepareSizeStringReturnValue = "test size";
+ VideoCollectionUtils::mPrepareSizeStringReturnValue = "test size";
}
// -----------------------------------------------------------------------------
@@ -111,6 +122,7 @@
// testInitTNFails
// -----------------------------------------------------------------------------
//
+
void TestVideoModel_p::testInitialize()
{
// Succeeds.
@@ -162,6 +174,7 @@
QVERIFY(mTestObject->getMediaIdFromIndex(MEDIA_COUNT - 1) == MEDIA_COUNT - 1);
// no data
+ mTestObject->mMediaData.clear();
mMediaFactory->removeArray();
mMediaFactory->createMediaItems(MEDIA_COUNT, MediaDataNone);
emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
@@ -206,6 +219,7 @@
// no data
expectedName = "";
+ mTestObject->mMediaData.clear();
mMediaFactory->removeArray();
mMediaFactory->createMediaItems(MEDIA_COUNT, MediaDataId);
emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
@@ -274,6 +288,7 @@
QVERIFY(mTestObject->getVideoSizeFromIndex(MEDIA_COUNT - 1) == MEDIA_COUNT);
// data does not exist
+ mTestObject->mMediaData.clear();
mMediaFactory->removeArray();
mMediaFactory->createMediaItems(MEDIA_COUNT, MediaDataId);
emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
@@ -315,6 +330,7 @@
QVERIFY(mTestObject->getVideoAgeProfileFromIndex(MEDIA_COUNT - 1) == excepted);
// data does not exist
+ mTestObject->mMediaData.clear();
mMediaFactory->removeArray();
mMediaFactory->createMediaItems(MEDIA_COUNT, MediaDataId);
emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
@@ -353,6 +369,7 @@
QVERIFY(mTestObject->getVideodurationFromIndex(MEDIA_COUNT - 1) == MEDIA_COUNT );
// data does not exist
+ mTestObject->mMediaData.clear();
mMediaFactory->removeArray();
mMediaFactory->createMediaItems(MEDIA_COUNT, MediaDataId);
emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
@@ -397,6 +414,7 @@
QCOMPARE(mTestObject->getVideoDateFromIndex(MEDIA_COUNT - 1), excepted);
// data does not exist
+ mTestObject->mMediaData.clear();
mMediaFactory->removeArray();
mMediaFactory->createMediaItems(MEDIA_COUNT, MediaDataId);
emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
@@ -466,6 +484,7 @@
QCOMPARE(map[MetaKeyFormat].toString(), gQTMediaFormatPrefix + "0");
// data does not exist
+ mTestObject->mMediaData.clear();
mMediaFactory->removeArray();
mMediaFactory->createMediaItems(MEDIA_COUNT, MediaDataId);
emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
@@ -488,9 +507,75 @@
}
// -----------------------------------------------------------------------------
+// testVideoMarkAndRestoreDeleted
+// -----------------------------------------------------------------------------
+//
+void TestVideoModel_p::testVideoMarkAndRestoreDeleted()
+{
+
+ QVERIFY(connect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*))));
+ mMediaFactory->removeArray();
+ mMediaFactory->createMediaItems(MEDIA_COUNT);
+ emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
+
+ VideoListDataModel::mFirstInserted = -1;
+ VideoListDataModel::mLastInserted = -1;
+ QList<TMPXItemId> idsToRestore;
+ // mark few items to be removed then restore them
+ // NOTE: since item marking decreases item count by one,
+ // we need to mark items starting from biggest index,
+ // otherwise we might end up to mark invalid items
+ QModelIndex index = mStubModel->index(MEDIA_COUNT-1, 0, QModelIndex());
+ idsToRestore.append(mTestObject->markVideoRemoved(index));
+ index = mStubModel->index(MEDIA_COUNT / 2, 0, QModelIndex());
+ idsToRestore.append(mTestObject->markVideoRemoved(index));
+ index = mStubModel->index(0, 0, QModelIndex());
+ idsToRestore.append(mTestObject->markVideoRemoved(index));
+
+ QVERIFY(mTestObject->getVideoCount() == (MEDIA_COUNT - 3) );
+
+ mTestObject->restoreRemoved(&idsToRestore);
+ QVERIFY(VideoListDataModel::mFirstInserted == MEDIA_COUNT - 3);
+ QVERIFY(VideoListDataModel::mLastInserted == MEDIA_COUNT - 1);
+ QVERIFY(mTestObject->getVideoCount() == MEDIA_COUNT);
+
+ idsToRestore.clear();
+ mMediaFactory->removeArray();
+ mMediaFactory->createMediaItems(MEDIA_COUNT);
+ emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
+ VideoListDataModel::mFirstInserted = -1;
+ VideoListDataModel::mLastInserted = -1;
+
+ // mark few items to be removed then restore them
+ index = mStubModel->index(MEDIA_COUNT-1, 0, QModelIndex());
+ idsToRestore.append(mTestObject->markVideoRemoved(index));
+ index = mStubModel->index(MEDIA_COUNT / 2, 0, QModelIndex());
+ idsToRestore.append(mTestObject->markVideoRemoved(index));
+ index = mStubModel->index(0, 0, QModelIndex());
+ idsToRestore.append(mTestObject->markVideoRemoved(index));
+
+ QVERIFY(mTestObject->getVideoCount() == (MEDIA_COUNT - 3) );
+ mTestObject->restoreRemoved(&idsToRestore);
+ QVERIFY(VideoListDataModel::mFirstInserted == MEDIA_COUNT - 3);
+ QVERIFY(VideoListDataModel::mLastInserted == MEDIA_COUNT - 1);
+
+ VideoListDataModel::mFirstInserted = -1;
+ VideoListDataModel::mLastInserted = -1;
+ idsToRestore.clear();
+ index = mStubModel->index(MEDIA_COUNT, 0, QModelIndex());
+ idsToRestore.append(mTestObject->markVideoRemoved(index));
+ mTestObject->restoreRemoved(&idsToRestore);
+ QVERIFY(VideoListDataModel::mFirstInserted == -1);
+ QVERIFY(VideoListDataModel::mLastInserted == -1);
+
+ disconnect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*)));
+}
+
+// -----------------------------------------------------------------------------
// testGetFilePathFromIndex
// -----------------------------------------------------------------------------
//
+
void TestVideoModel_p::testGetFilePathFromIndex()
{
QString path = mTestObject->getFilePathFromIndex(0);
@@ -510,6 +595,7 @@
QCOMPARE(path, gQTMediaPathPrefix + "0");
// data does not exist
+ mTestObject->mMediaData.clear();
mMediaFactory->removeArray();
mMediaFactory->createMediaItems(MEDIA_COUNT, MediaDataId);
emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
@@ -543,6 +629,7 @@
QCOMPARE(path, gQTMediaPathPrefix + "0");
// data does not exist
+ mTestObject->mMediaData.clear();
mMediaFactory->removeArray();
mMediaFactory->createMediaItems(MEDIA_COUNT, MediaDataId);
emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
@@ -552,80 +639,6 @@
disconnect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*)));
}
-// -----------------------------------------------------------------------------
-// testVideoStatus
-// -----------------------------------------------------------------------------
-//
-void TestVideoModel_p::testVideoStatus()
-{
- QModelIndexList indexList;
-
- indexList.append(mStubModel->index(0,0));
- // no videos
- mTestObject->markVideosRemoved(indexList);
- QVERIFY(mTestObject->getVideoStatusFromIndex(0) == 0);
- QVERIFY(mTestObject->getVideoStatusFromIndex(-1) == 0);
-
- mMediaFactory->removeArray();
- indexList.clear();
- QVERIFY(connect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*))));
- mMediaFactory->createMediaItems(MEDIA_COUNT);
- emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
-
- // videos, invalid + correct indexes
- QList<TMPXItemId> markedIds;
- indexList.append(mStubModel->index(-1,0));
- indexList.append(mStubModel->index(0,0));
- indexList.append(mStubModel->index(MEDIA_COUNT/2,10));
- indexList.append(mStubModel->index(MEDIA_COUNT,0));
- markedIds = mTestObject->markVideosRemoved(indexList);
- QVERIFY(markedIds.count() == 2);
- QVERIFY(mTestObject->getVideoStatusFromIndex(-1) == 0);
- QVERIFY(mTestObject->getVideoStatusFromIndex(MEDIA_COUNT) == 0);
- QVERIFY(mTestObject->getVideoStatusFromIndex(0) == VideoCollectionCommon::StatusDeleted);
- QVERIFY(mTestObject->getVideoStatusFromIndex(MEDIA_COUNT/2) == VideoCollectionCommon::StatusDeleted);
- QVERIFY(mTestObject->getVideoStatusFromIndex(MEDIA_COUNT-1) == 0);
-
- // clear list (and items as well
- indexList.clear();
- QVERIFY(connect(this, SIGNAL(signalDeleteVideo(TMPXItemId)), mTestObject, SLOT(videoDeletedSlot(TMPXItemId))));
- emit signalDeleteVideo(TMPXItemId(0, 0));
- emit signalDeleteVideo(TMPXItemId(MEDIA_COUNT/2, 0));
- emit signalDeleteVideo(TMPXItemId(MEDIA_COUNT-1, 0));
- emit signalDeleteVideo(TMPXItemId(MEDIA_COUNT, 0));
- QVERIFY(mTestObject->getVideoCount() == (MEDIA_COUNT - 3));
-
- // videos, invalid media ids
- indexList.append(mStubModel->index(-1,0));
- indexList.append(mStubModel->index(MEDIA_COUNT+1,0));
- mTestObject->markVideosRemoved(indexList);
- for(int i = 0; i < (MEDIA_COUNT - 2); ++i)
- {
- QVERIFY(mTestObject->getVideoStatusFromIndex(i) == 0);
- }
- QVERIFY(mTestObject->getVideoStatusFromIndex(-1) == 0);
- QVERIFY(mTestObject->getVideoStatusFromIndex(MEDIA_COUNT) == 0);
-
- // correct case after removal
- indexList.append(mStubModel->index(1,0));
- mTestObject->markVideosRemoved(indexList);
- QVERIFY(mTestObject->getVideoStatusFromIndex(1) == VideoCollectionCommon::StatusDeleted);
-
- // correct case, unmarked
- indexList.clear();
- indexList.append(mStubModel->index(1,0));
- indexList.append(mStubModel->index(2,0));
- indexList.append(mStubModel->index(3,0));
- markedIds = mTestObject->markVideosRemoved(indexList);
- QVERIFY(markedIds.count() == 3);
- mTestObject->unMarkVideosRemoved(markedIds);
- QVERIFY(mTestObject->getVideoStatusFromIndex(1) == 0);
- QVERIFY(mTestObject->getVideoStatusFromIndex(2) == 0);
- QVERIFY(mTestObject->getVideoStatusFromIndex(3) == 0);
-
- disconnect(this, SIGNAL(signalDeleteVideo(TMPXItemId)), mTestObject, SLOT(videoDeletedSlot(TMPXItemId)));
- disconnect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*)));
-}
// -----------------------------------------------------------------------------
// testThumbnailsFetchedSlot
@@ -696,10 +709,11 @@
QVERIFY(connect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*))));
- QSignalSpy spyRowsAboutToInsert(mStubModel, SIGNAL(rowsAboutToBeInserted (const QModelIndex& , int, int)));
- QSignalSpy spyRowsInserted(mStubModel, SIGNAL(rowsInserted (const QModelIndex& , int, int)));
- QSignalSpy spyRowsAboutToRemove(mStubModel, SIGNAL(rowsAboutToBeRemoved (const QModelIndex& , int, int)));
- QSignalSpy spyRowsRemoved(mStubModel, SIGNAL(rowsRemoved (const QModelIndex& , int, int)));
+ VideoListDataModel::mFirstInserted = -1;
+ VideoListDataModel::mLastInserted = -1;
+ VideoListDataModel::mFirstRemoved = -1;
+ VideoListDataModel::mLastRemoved = -1;
+
QSignalSpy spyModelReady(mStubModel, SIGNAL(modelReady()));
mMediaFactory->removeArray();
@@ -707,65 +721,61 @@
// media-array does not exist
emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
- QVERIFY(spyRowsAboutToInsert.count() == 1);
- QVERIFY(spyRowsInserted.count() == 1);
- QVERIFY(spyRowsAboutToRemove.count() == 0);
- QVERIFY(spyRowsRemoved.count() == 0);
- QVERIFY(spyRowsInserted.at(0).at(1).toInt() == 0);
- QVERIFY(spyRowsInserted.at(0).at(2).toInt() == MEDIA_COUNT - 1);
+ QVERIFY(VideoListDataModel::mFirstInserted == 0);
+ QVERIFY(VideoListDataModel::mLastInserted == MEDIA_COUNT - 1);
+ QVERIFY(VideoListDataModel::mFirstRemoved == -1);
+ QVERIFY(VideoListDataModel::mLastRemoved == -1);
QCOMPARE(spyModelReady.count(), 1);
- spyRowsAboutToInsert.clear();
- spyRowsInserted.clear();
- spyRowsAboutToRemove.clear();
- spyRowsRemoved.clear();
spyModelReady.clear();
+ VideoListDataModel::mFirstInserted = -1;
+ VideoListDataModel::mLastInserted = -1;
+ VideoListDataModel::mFirstRemoved = -1;
+ VideoListDataModel::mLastRemoved = -1;
QVERIFY(mTestObject->initialize() == 0);
// providing null videolist
emit signalNewVideoList(0);
- QVERIFY(spyRowsAboutToInsert.count() == 0);
- QVERIFY(spyRowsInserted.count() == 0);
- QVERIFY(spyRowsAboutToRemove.count() == 0);
- QVERIFY(spyRowsRemoved.count() == 0);
+ QVERIFY(VideoListDataModel::mFirstInserted == -1);
+ QVERIFY(VideoListDataModel::mLastInserted == -1);
+ QVERIFY(VideoListDataModel::mFirstRemoved == -1);
+ QVERIFY(VideoListDataModel::mLastRemoved == -1);
QCOMPARE(spyModelReady.count(), 0);
-
+ VideoListDataModel::mFirstInserted = -1;
+ VideoListDataModel::mLastInserted = -1;
+ VideoListDataModel::mFirstRemoved = -1;
+ VideoListDataModel::mLastRemoved = -1;
// empty media-array
mMediaFactory->removeArray();
mMediaFactory->createMediaItems(0);
emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
- QVERIFY(spyRowsAboutToInsert.count() == 1);
- QVERIFY(spyRowsInserted.count() == 1);
- QVERIFY(spyRowsAboutToRemove.count() == 1);
- QVERIFY(spyRowsRemoved.count() == 1);
- QVERIFY(spyRowsInserted.at(0).at(1).toInt() == 0);
- QVERIFY(spyRowsInserted.at(0).at(2).toInt() == 0);
- QVERIFY(spyRowsRemoved.at(0).at(1).toInt() == 0);
- QVERIFY(spyRowsRemoved.at(0).at(2).toInt() == MEDIA_COUNT - 1);
+
+ QVERIFY(VideoListDataModel::mFirstInserted == -1);
+ QVERIFY(VideoListDataModel::mLastInserted == -1);
+ QVERIFY(VideoListDataModel::mFirstRemoved == -1);
+ QVERIFY(VideoListDataModel::mLastRemoved == -1);
QCOMPARE(spyModelReady.count(), 1);
- spyRowsAboutToInsert.clear();
- spyRowsInserted.clear();
- spyRowsAboutToRemove.clear();
- spyRowsRemoved.clear();
spyModelReady.clear();
+ VideoListDataModel::mFirstInserted = -1;
+ VideoListDataModel::mLastInserted = -1;
+ VideoListDataModel::mFirstRemoved = -1;
+ VideoListDataModel::mLastRemoved = -1;
// media-array exits
mMediaFactory->removeArray();
mMediaFactory->createMediaItems(MEDIA_COUNT);
emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
- QVERIFY(spyRowsAboutToInsert.count() == 1);
- QVERIFY(spyRowsInserted.count() == 1);
- QVERIFY(spyRowsAboutToRemove.count() == 0);
- QVERIFY(spyRowsRemoved.count() == 0);
- QVERIFY(spyRowsInserted.at(0).at(1).toInt() == 0);
- QVERIFY(spyRowsInserted.at(0).at(2).toInt() == MEDIA_COUNT - 1);
+ QVERIFY(VideoListDataModel::mFirstInserted == -1);
+ QVERIFY(VideoListDataModel::mLastInserted == -1);
+ QVERIFY(VideoListDataModel::mFirstRemoved == -1);
+ QVERIFY(VideoListDataModel::mLastRemoved == -1);
QCOMPARE(spyModelReady.count(), 1);
- spyRowsAboutToInsert.clear();
- spyRowsInserted.clear();
- spyRowsAboutToRemove.clear();
- spyRowsRemoved.clear();
spyModelReady.clear();
+ VideoListDataModel::mFirstInserted = -1;
+ VideoListDataModel::mLastInserted = -1;
+ VideoListDataModel::mFirstRemoved = -1;
+ VideoListDataModel::mLastRemoved = -1;
disconnect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*)));
}
@@ -781,50 +791,55 @@
QVERIFY(connect(this, SIGNAL(signalAppendVideoList(CMPXMediaArray*)), mTestObject, SLOT(appendVideoListSlot(CMPXMediaArray*))));
QVERIFY(connect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*))));
- QSignalSpy spyRowsAboutToInsert(mStubModel, SIGNAL(rowsAboutToBeInserted (const QModelIndex& , int, int)));
- QSignalSpy spyRowsInserted(mStubModel, SIGNAL(rowsInserted (const QModelIndex& , int, int)));
+ QSignalSpy spyModelChanged(mStubModel, SIGNAL(modelChanged()));
+
+ VideoListDataModel::mFirstInserted = -1;
+ VideoListDataModel::mLastInserted = -1;
// append null
- emit signalAppendVideoList(0);
- QVERIFY(spyRowsAboutToInsert.count() == 0);
- QVERIFY(spyRowsInserted.count() == 0);
+ emit signalAppendVideoList(0);
+ QVERIFY(VideoListDataModel::mFirstInserted == -1);
+ QVERIFY(VideoListDataModel::mLastInserted == -1);
QVERIFY(mTestObject->getVideoCount() == 0);
+ QVERIFY(spyModelChanged.count() == 0);
// append empty videolist
mMediaFactory->removeArray();
mMediaFactory->createMediaItems(0);
emit signalAppendVideoList(mMediaFactory->copyOfMediaArray());
- QVERIFY(spyRowsAboutToInsert.count() == 0);
- QVERIFY(spyRowsInserted.count() == 0);
+ QVERIFY(VideoListDataModel::mFirstInserted == -1);
+ QVERIFY(VideoListDataModel::mLastInserted == -1);
QVERIFY(mTestObject->getVideoCount() == 0);
+ QVERIFY(spyModelChanged.count() == 0);
// send 10 videos
mMediaFactory->createMediaItems(10);
emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
- spyRowsAboutToInsert.clear();
- spyRowsInserted.clear();
+ VideoListDataModel::mFirstInserted = -1;
+ VideoListDataModel::mLastInserted = -1;
// append videolist containing less than existing
mMediaFactory->removeArray();
mMediaFactory->createMediaItems(3);
emit signalAppendVideoList(mMediaFactory->copyOfMediaArray());
- QVERIFY(spyRowsAboutToInsert.count() == 0);
- QVERIFY(spyRowsInserted.count() == 0);
+ QVERIFY(VideoListDataModel::mFirstInserted == -1);
+ QVERIFY(VideoListDataModel::mLastInserted == -1);
QVERIFY(mTestObject->getVideoCount() == 10);
+ QVERIFY(spyModelChanged.count() == 0);
// reset data
mTestObject->mMediaData.clear();
// append items with invalid ids:
- // signals emitted, but items are really not appended
+ // signals emitted (begin inserting is called), but items are really not appended
mMediaFactory->removeArray();
mMediaFactory->createMediaItems(3, MediaDataNone);
- emit signalAppendVideoList(mMediaFactory->copyOfMediaArray());
- QVERIFY(spyRowsAboutToInsert.count() == 1);
- QVERIFY(spyRowsInserted.count() == 1);
+ emit signalAppendVideoList(mMediaFactory->copyOfMediaArray());
+ QVERIFY(VideoListDataModel::mFirstInserted == 0);
+ QVERIFY(VideoListDataModel::mLastInserted == 2);
QVERIFY(mTestObject->getVideoCount() == 0);
- spyRowsAboutToInsert.clear();
- spyRowsInserted.clear();
+ QVERIFY(spyModelChanged.count() == 1);
+ spyModelChanged.clear();
// append items with iId2 == 1 && iId1 != KVcxMvcCategoryIdDownloads (==1) && iId1 != KVcxMvcCategoryIdCaptured (== 3)
mMediaFactory->removeArray();
@@ -832,37 +847,35 @@
TRAP_IGNORE(mMediaFactory->mediaArray()->AppendL(mMediaFactory->getMediaWithWantedIds(4, 1)));
TRAP_IGNORE(mMediaFactory->mediaArray()->AppendL(mMediaFactory->getMediaWithWantedIds(5, 1)));
emit signalAppendVideoList(mMediaFactory->copyOfMediaArray());
- QVERIFY(spyRowsAboutToInsert.count() == 1);
- QVERIFY(spyRowsInserted.count() == 1);
- QVERIFY(spyRowsInserted.at(0).at(1).toInt() == 0);
- QVERIFY(spyRowsInserted.at(0).at(2).toInt() == 1);
+
+ QVERIFY(VideoListDataModel::mFirstInserted == 0);
+ QVERIFY(VideoListDataModel::mLastInserted == 1);
QVERIFY(mTestObject->getVideoCount() == 0);
- spyRowsAboutToInsert.clear();
- spyRowsInserted.clear();
+ QVERIFY(spyModelChanged.count() == 1);
+ spyModelChanged.clear();
// append correct items
mMediaFactory->removeArray();
mMediaFactory->createMediaItems(3);
emit signalAppendVideoList(mMediaFactory->copyOfMediaArray());
- QVERIFY(spyRowsAboutToInsert.count() == 1);
- QVERIFY(spyRowsInserted.count() == 1);
- QVERIFY(spyRowsInserted.at(0).at(1).toInt() == 0);
- QVERIFY(spyRowsInserted.at(0).at(2).toInt() == 2);
+ QVERIFY(VideoListDataModel::mFirstInserted == 0);
+ QVERIFY(VideoListDataModel::mLastInserted == 2);
QVERIFY(mTestObject->getVideoCount() == 3);
- spyRowsAboutToInsert.clear();
- spyRowsInserted.clear();
+ QVERIFY(spyModelChanged.count() == 1);
+ spyModelChanged.clear();
// append more to existing
mMediaFactory->removeArray();
mMediaFactory->createMediaItems(10);
emit signalAppendVideoList(mMediaFactory->copyOfMediaArray());
- QVERIFY(spyRowsAboutToInsert.count() == 1);
- QVERIFY(spyRowsInserted.count() == 1);
- QVERIFY(spyRowsInserted.at(0).at(1).toInt() == 3);
- QVERIFY(spyRowsInserted.at(0).at(2).toInt() == 9);
+
+ QVERIFY(VideoListDataModel::mFirstInserted == 3);
+ QVERIFY(VideoListDataModel::mLastInserted == 9);
+
QVERIFY(mTestObject->getVideoCount() == 10);
- spyRowsAboutToInsert.clear();
- spyRowsInserted.clear();
+ QVERIFY(spyModelChanged.count() == 1);
+ spyModelChanged.clear();
+
disconnect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*)));
disconnect(this, SIGNAL(signalAppendVideoList(CMPXMediaArray*)), mTestObject, SLOT(appendVideoListSlot(CMPXMediaArray*)));
@@ -876,40 +889,57 @@
{
QVERIFY(mTestObject->initialize() == 0);
- QSignalSpy spyRowsAboutToInsert(mStubModel, SIGNAL(rowsAboutToBeInserted (const QModelIndex& , int, int)));
- QSignalSpy spyRowsInserted(mStubModel, SIGNAL(rowsInserted (const QModelIndex& , int, int)));
+ connect(this, SIGNAL(signalNewVideoAvailable(CMPXMedia*)), mTestObject, SLOT(newVideoAvailableSlot(CMPXMedia*)));
+ connect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*)));
- QVERIFY(connect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*))));
- QVERIFY(connect(this, SIGNAL(signalNewVideoAvailable(CMPXMedia*)), mTestObject, SLOT(newVideoAvailableSlot(CMPXMedia*))));
+ QSignalSpy spyModelChanged(mStubModel, SIGNAL(modelChanged()));
+ VideoListDataModel::mFirstInserted = -1;
+ VideoListDataModel::mLastInserted = -1;
+
CMPXMedia *media = mMediaFactory->getMedia(MEDIA_COUNT + 100);
- // no media array
+ // succeed insert
emit signalNewVideoAvailable(media);
- QVERIFY(spyRowsAboutToInsert.count() == 1);
- QVERIFY(spyRowsInserted.count() == 1);
- QVERIFY(spyRowsAboutToInsert.at(0).at(1).toInt() == 0);
- QVERIFY(spyRowsAboutToInsert.at(0).at(2).toInt() == 0);
+ QVERIFY(VideoListDataModel::mFirstInserted == 0);
+ QVERIFY(VideoListDataModel::mLastInserted == 0);
+ QVERIFY(spyModelChanged.count() == 1);
QVERIFY(mTestObject->getVideoCount() == 1);
delete media;
media = 0;
- spyRowsAboutToInsert.clear();
- spyRowsInserted.clear();
+ VideoListDataModel::mFirstInserted = -1;
+ VideoListDataModel::mLastInserted = -1;
+ spyModelChanged.clear();
// null pointer provided
emit signalNewVideoAvailable(media);
- QVERIFY(spyRowsAboutToInsert.count() == 0);
- QVERIFY(spyRowsInserted.count() == 0);
+ QVERIFY(spyModelChanged.count() == 0);
+ QVERIFY(VideoListDataModel::mFirstInserted == -1);
+ QVERIFY(VideoListDataModel::mLastInserted == -1);
QVERIFY(mTestObject->getVideoCount() == 1);
+ spyModelChanged.clear();
// invalid item
media = mMediaFactory->getMedia(MEDIA_COUNT + 100, MediaDataNone);
emit signalNewVideoAvailable(media);
- QVERIFY(spyRowsAboutToInsert.count() == 0);
- QVERIFY(spyRowsInserted.count() == 0);
+ QVERIFY(VideoListDataModel::mFirstInserted == -1);
+ QVERIFY(VideoListDataModel::mLastInserted == -1);
QVERIFY(mTestObject->getVideoCount() == 1);
+ QVERIFY(spyModelChanged.count() == 0);
delete media;
media = 0;
+ spyModelChanged.clear();
+
+ // item without name
+ media = mMediaFactory->getMedia(MEDIA_COUNT + 100, MediaDataId);
+ emit signalNewVideoAvailable(media);
+ QVERIFY(VideoListDataModel::mFirstInserted == -1);
+ QVERIFY(VideoListDataModel::mLastInserted == -1);
+ QVERIFY(mTestObject->getVideoCount() == 1);
+ QVERIFY(spyModelChanged.count() == 0);
+ delete media;
+ media = 0;
+ spyModelChanged.clear();
delete mTestObject;
mTestObject = new VideoListDataModelPrivate(mStubModel);
@@ -920,16 +950,16 @@
mMediaFactory->removeArray();
mMediaFactory->createMediaItems(MEDIA_COUNT);
emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
- spyRowsAboutToInsert.clear();
- spyRowsInserted.clear();
+ VideoListDataModel::mFirstInserted = -1;
+ VideoListDataModel::mLastInserted = -1;
+ spyModelChanged.clear();
// succeed case
CMPXMedia *media3 = mMediaFactory->getMedia(MEDIA_COUNT + 103 );
emit signalNewVideoAvailable(media3);
- QVERIFY(spyRowsAboutToInsert.count() == 1);
- QVERIFY(spyRowsInserted.count() == 1);
- QVERIFY(spyRowsAboutToInsert.at(0).at(1).toInt() == mTestObject->getVideoCount() - 1);
- QVERIFY(spyRowsAboutToInsert.at(0).at(2).toInt() == mTestObject->getVideoCount() - 1);
+ QVERIFY(VideoListDataModel::mFirstInserted == mTestObject->getVideoCount() - 1);
+ QVERIFY(VideoListDataModel::mLastInserted == mTestObject->getVideoCount() - 1);
+ QVERIFY(spyModelChanged.count() == 1);
QVERIFY(mTestObject->getVideoCount() == MEDIA_COUNT + 1);
disconnect(this, SIGNAL(signalNewVideoAvailable(CMPXMedia*)), mTestObject, SLOT(newVideoAvailableSlot(CMPXMedia*)));
@@ -942,245 +972,144 @@
//
void TestVideoModel_p::testVideoDeletedSlot()
{
+ mTestObject->initialize();
mMediaFactory->removeArray();
+ VideoListDataModel::mFirstRemoved = -1;
+ VideoListDataModel::mLastRemoved = -1;
+ QSignalSpy spyModelChanged(mStubModel, SIGNAL(modelChanged()));
QVERIFY(connect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*))));
- QVERIFY(connect(this, SIGNAL(signalDeleteVideo(TMPXItemId)), mTestObject, SLOT(videoDeletedSlot(TMPXItemId))));
- QSignalSpy spyRowsAboutToRemove(mStubModel, SIGNAL(rowsAboutToBeRemoved (const QModelIndex& , int, int)));
- QSignalSpy spyRowsRemoved(mStubModel, SIGNAL(rowsRemoved (const QModelIndex& , int, int)));
-
+ QVERIFY(connect(this, SIGNAL(signalDeleteVideo(TMPXItemId)), mTestObject, SLOT(itemDeletedSlot(TMPXItemId))));
+
// no videos
emit signalDeleteVideo(TMPXItemId(0,0));
- QVERIFY(spyRowsAboutToRemove.count() == 0);
- QVERIFY(spyRowsRemoved.count() == 0);
-
- QVERIFY(mTestObject->initialize() == 0);
- emit signalDeleteVideo(TMPXItemId(0,0));
- QVERIFY(spyRowsAboutToRemove.count() == 0);
- QVERIFY(spyRowsRemoved.count() == 0);
-
- mMediaFactory->createMediaItems(MEDIA_COUNT);
- emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
-
- spyRowsAboutToRemove.clear();
- spyRowsRemoved.clear();
-
- // external delete - item not in delete -list
- emit signalDeleteVideo(TMPXItemId::InvalidId());
- QVERIFY(spyRowsAboutToRemove.count() == 0);
- QVERIFY(spyRowsRemoved.count() == 0);
- QVERIFY(mTestObject->getVideoCount() == MEDIA_COUNT);
-
+ QVERIFY(VideoListDataModel::mFirstRemoved == -1);
+ QVERIFY(VideoListDataModel::mFirstRemoved == -1);
+ QVERIFY(spyModelChanged.count() == 0);
- VideoThumbnailData::resetRemoveCount();
- emit signalDeleteVideo(TMPXItemId(0,0));
- QVERIFY(spyRowsAboutToRemove.count() == 1);
- QVERIFY(spyRowsRemoved.count() == 1);
- QVERIFY(spyRowsRemoved.at(0).at(1).toInt() == 0);
- QVERIFY(spyRowsRemoved.at(0).at(2).toInt() == 0);
-
- QVERIFY(VideoThumbnailData::getRemoveCount() == 1);
- QVERIFY(mTestObject->getVideoCount() == MEDIA_COUNT -1);
-
- spyRowsAboutToRemove.clear();
- spyRowsRemoved.clear();
+ // invalid id
+ emit signalDeleteVideo(TMPXItemId::InvalidId());
+ QVERIFY(VideoListDataModel::mFirstRemoved == -1);
+ QVERIFY(VideoListDataModel::mFirstRemoved == -1);
+ QVERIFY(spyModelChanged.count() == 0);
- emit signalDeleteVideo(TMPXItemId(MEDIA_COUNT-1, 0));
- QVERIFY(spyRowsAboutToRemove.count() == 1);
- QVERIFY(spyRowsRemoved.count() == 1);
- QVERIFY(spyRowsRemoved.at(0).at(1).toInt() == MEDIA_COUNT-2);
- QVERIFY(spyRowsRemoved.at(0).at(2).toInt() == MEDIA_COUNT-2);
-
- QVERIFY(VideoThumbnailData::getRemoveCount() == 2);
- QVERIFY(mTestObject->getVideoCount() == MEDIA_COUNT -2);
- spyRowsAboutToRemove.clear();
- spyRowsRemoved.clear();
-
- // reset medias
- VideoThumbnailData::resetRemoveCount();
mMediaFactory->removeArray();
mMediaFactory->createMediaItems(MEDIA_COUNT);
emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
- spyRowsAboutToRemove.clear();
- spyRowsRemoved.clear();
+ VideoListDataModel::mFirstRemoved = -1;
+ VideoListDataModel::mLastRemoved = -1;
+ spyModelChanged.clear();
+
+ // not marked as removed
+ emit signalDeleteVideo(TMPXItemId(MEDIA_COUNT / 2,0));
+ QVERIFY(VideoListDataModel::mFirstRemoved == MEDIA_COUNT / 2);
+ QVERIFY(VideoListDataModel::mFirstRemoved == MEDIA_COUNT / 2);
+ QVERIFY(spyModelChanged.count() == 1);
+
+ VideoListDataModel::mFirstRemoved = -1;
+ VideoListDataModel::mLastRemoved = -1;
+ spyModelChanged.clear();
+
+ QModelIndex index = mStubModel->index(MEDIA_COUNT / 2, 0, QModelIndex());
+ TMPXItemId id = mTestObject->markVideoRemoved(index);
- QModelIndexList indexList;
- // internal delete - item in delete -list
- indexList.append(mStubModel->index(-1,0));
- mTestObject->markVideosRemoved(indexList);
- emit signalDeleteVideo(TMPXItemId::InvalidId());
- QVERIFY(spyRowsRemoved.count() == 0);
- QVERIFY(spyRowsRemoved.count() == 0);
- QVERIFY(mTestObject->getVideoCount() == MEDIA_COUNT);
-
- indexList.append(mStubModel->index(MEDIA_COUNT,0));
- mTestObject->markVideosRemoved(indexList);
- emit signalDeleteVideo(TMPXItemId::InvalidId());
- QVERIFY(spyRowsRemoved.count() == 0);
- QVERIFY(spyRowsRemoved.count() == 0);
- QVERIFY(mTestObject->getVideoCount() == MEDIA_COUNT);
-
- indexList.append(mStubModel->index(0,0));
- mTestObject->markVideosRemoved(indexList);
- emit signalDeleteVideo(TMPXItemId(0,0));
- QVERIFY(spyRowsRemoved.count() == 1);
- QVERIFY(spyRowsRemoved.count() == 1);
- QVERIFY(spyRowsRemoved.at(0).at(1).toInt() == 0);
- QVERIFY(spyRowsRemoved.at(0).at(2).toInt() == 0);
- QVERIFY(VideoThumbnailData::getRemoveCount() == 1);
- QVERIFY(mTestObject->getVideoCount() == MEDIA_COUNT -1);
- spyRowsAboutToRemove.clear();
- spyRowsRemoved.clear();
-
- indexList.append(mStubModel->index(MEDIA_COUNT-1,0));
- mTestObject->markVideosRemoved(indexList);
- emit signalDeleteVideo(TMPXItemId(MEDIA_COUNT-1, 0));
- QVERIFY(spyRowsRemoved.count() == 1);
- QVERIFY(spyRowsRemoved.count() == 1);
- QVERIFY(spyRowsRemoved.at(0).at(1).toInt() == MEDIA_COUNT-2);
- QVERIFY(spyRowsRemoved.at(0).at(2).toInt() == MEDIA_COUNT-2);
- QVERIFY(VideoThumbnailData::getRemoveCount() == 2);
- QVERIFY(mTestObject->getVideoCount() == MEDIA_COUNT -2);
- spyRowsAboutToRemove.clear();
- spyRowsRemoved.clear();
+ // marked as removed
+ emit signalDeleteVideo(id);
+ // item already removed from container, no notifications
+ QVERIFY(VideoListDataModel::mFirstRemoved == -1);
+ QVERIFY(VideoListDataModel::mFirstRemoved == -1);
+ QVERIFY(spyModelChanged.count() == 0);
+
+ // no thumbnail data (tested for coverity)
+ VideoThumbnailData *tmp = mTestObject->mVideoThumbnailData;
+ mTestObject->mVideoThumbnailData = 0;
- // reset medias
- VideoThumbnailData::resetRemoveCount();
- mMediaFactory->removeArray();
- mMediaFactory->createMediaItems(MEDIA_COUNT);
- emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
-
- spyRowsAboutToRemove.clear();
- spyRowsRemoved.clear();
-
- // gotten index same as video count ( only possible in internal delete )
- mTestObject->mItemsUnderDeletion.insert(TMPXItemId(MEDIA_COUNT,0));
-
- emit signalDeleteVideo(TMPXItemId(MEDIA_COUNT, 0));
- QVERIFY(spyRowsRemoved.count() == 0);
- QVERIFY(spyRowsRemoved.count() == 0);
- QVERIFY(mTestObject->getVideoCount() == MEDIA_COUNT);
+ index = mStubModel->index(mTestObject->getVideoCount() - 1, 0, QModelIndex());
+ id = mTestObject->markVideoRemoved(index);
+ emit signalDeleteVideo(id);
+ // item already removed from container, no notifications
+ QVERIFY(VideoListDataModel::mFirstRemoved == -1);
+ QVERIFY(VideoListDataModel::mFirstRemoved == -1);
+ QVERIFY(spyModelChanged.count() == 0);
- // gotten index larger than video count ( only possible in internal delete )
- mTestObject->mItemsUnderDeletion.insert(TMPXItemId(MEDIA_COUNT + 1, 0));
-
- emit signalDeleteVideo(TMPXItemId(MEDIA_COUNT + 1,0));
- QVERIFY(spyRowsRemoved.count() == 0);
- QVERIFY(spyRowsRemoved.count() == 0);
- QVERIFY(mTestObject->getVideoCount() == MEDIA_COUNT);
-
-
- emit signalDeleteVideo(TMPXItemId(1,0));
- QVERIFY(spyRowsRemoved.count() == 1);
- QVERIFY(spyRowsRemoved.count() == 1);
- QVERIFY(spyRowsRemoved.at(0).at(1).toInt() == 1);
- QVERIFY(spyRowsRemoved.at(0).at(2).toInt() == 1);
- QVERIFY(VideoThumbnailData::getRemoveCount() == 1);
- QVERIFY(mTestObject->getVideoCount() == MEDIA_COUNT - 1);
- spyRowsAboutToRemove.clear();
- spyRowsRemoved.clear();
-
- disconnect(this, SIGNAL(signalDeleteVideo(TMPXItemId)), mTestObject, SLOT(videoDeletedSlot(TMPXItemId)));
+ mTestObject->mVideoThumbnailData = tmp;
+
+ disconnect(this, SIGNAL(signalDeleteVideo(TMPXItemId)), mTestObject, SLOT(itemDeletedSlot(TMPXItemId)));
disconnect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*)));
+
}
// -----------------------------------------------------------------------------
// testVideoDeleteCompletedSlot
// -----------------------------------------------------------------------------
//
+
void TestVideoModel_p::testVideoDeleteCompletedSlot()
{
- mMediaFactory->removeArray();
-
QVERIFY(connect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*))));
QVERIFY(connect(this, SIGNAL(signalDeleteCompleted(int, QList<TMPXItemId>*)), mTestObject, SLOT(videoDeleteCompletedSlot(int, QList<TMPXItemId>*))));
- QSignalSpy spysignal(mTestObject, SIGNAL(dataChanged(const QModelIndex &, const QModelIndex &)));
-
- // null list provided
- emit signalDeleteCompleted(0, 0);
- QVERIFY(spysignal.count() == 0);
-
+
+ mMediaFactory->removeArray();
mMediaFactory->createMediaItems(MEDIA_COUNT);
emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
- QModelIndexList indexList;
- indexList.append(mStubModel->index(0,0));
- indexList.append(mStubModel->index(MEDIA_COUNT/2,0));
- indexList.append(mStubModel->index(MEDIA_COUNT-1,0));
- mTestObject->markVideosRemoved(indexList);
+ QSignalSpy spysignal(mStubModel, SIGNAL(modelChanged()));
+ VideoListDataModel::mStatus = -1;
+ VideoListDataModel::mStatusData = QVariant();
+
+ QList<TMPXItemId> idList;
+
+ // null list
emit signalDeleteCompleted(0, 0);
QVERIFY(spysignal.count() == 0);
- QVERIFY(VideoCollectionWrapper::mLatestStatusCode == -1);
- QVERIFY(!VideoCollectionWrapper::mLatestAdditional.isValid());
+ QVERIFY(VideoListDataModel::mStatus == -1);
+ QVERIFY(!VideoListDataModel::mStatusData.isValid());
-
- // provided list contains nothing and we have none deleted
- QList<TMPXItemId> testIds;
- emit signalDeleteCompleted(0, &testIds);
- QVERIFY(spysignal.count() == 0);
- QVERIFY(VideoCollectionWrapper::mLatestStatusCode == -1);
- QVERIFY(!VideoCollectionWrapper::mLatestAdditional.isValid());
-
- // provided list contains nothing and all provided count is more than one
- // (No status code sent from completely succeed delete)
- emit signalDeleteCompleted(5, &testIds);
- QVERIFY(spysignal.count() == 0);
- QVERIFY(VideoCollectionWrapper::mLatestStatusCode == -1);
- QVERIFY(!VideoCollectionWrapper::mLatestAdditional.isValid());
-
- VideoCollectionWrapper::mLatestStatusCode = -1;
- VideoCollectionWrapper::mLatestAdditional = QVariant();
+ // empty list
+ emit signalDeleteCompleted(0, &idList);
+ int count =spysignal.count();
+ QVERIFY(spysignal.count() == 1);
+ QVERIFY(VideoListDataModel::mStatus == VideoCollectionCommon::statusDeleteSucceed);
+ QVERIFY(!VideoListDataModel::mStatusData.isValid());
+ VideoListDataModel::mStatus = -1;
+ VideoListDataModel::mStatusData = QVariant();
+ spysignal.clear();
- // provided list does not contain ids that are marked
- // (No status code sent from completely succeed delete)
- testIds.append(TMPXItemId(1, 0));
- testIds.append(TMPXItemId(MEDIA_COUNT - 2,0));
- emit signalDeleteCompleted(2, &testIds);
- QVERIFY(spysignal.count() == 0);
- QVERIFY(VideoCollectionWrapper::mLatestStatusCode == -1);
- QVERIFY(!VideoCollectionWrapper::mLatestAdditional.isValid());
-
- VideoCollectionWrapper::mLatestStatusCode = -1;
- VideoCollectionWrapper::mLatestAdditional = QVariant();
-
- // provided list contains partly items that are marked
- testIds.append(TMPXItemId(MEDIA_COUNT/2, 0));
- emit signalDeleteCompleted(3, &testIds);
+ // one failed (no item)
+ idList.append(TMPXItemId(0,0));
+ emit signalDeleteCompleted(0, &idList);
QVERIFY(spysignal.count() == 1);
+ QVERIFY(VideoListDataModel::mStatus == VideoCollectionCommon::statusSingleDeleteFail);
+ QVERIFY(VideoListDataModel::mStatusData.isValid());
+
+ VideoListDataModel::mStatus = -1;
+ VideoListDataModel::mStatusData = QVariant();
spysignal.clear();
- QVERIFY(VideoCollectionWrapper::mLatestStatusCode == VideoCollectionCommon::statusSingleDeleteFail);
- QVERIFY(VideoCollectionWrapper::mLatestAdditional.isValid());
- QVERIFY(VideoCollectionWrapper::mLatestAdditional.toString().count() > 0);
-
- VideoCollectionWrapper::mLatestStatusCode = -1;
- VideoCollectionWrapper::mLatestAdditional = QVariant();
-
- // provided list contains all marked items
- testIds.clear();
- testIds.append(TMPXItemId(0,0));
- testIds.append(TMPXItemId(MEDIA_COUNT - 1, 0));
- emit signalDeleteCompleted(MEDIA_COUNT, &testIds);
- QVERIFY(spysignal.count() == 2);
- QVERIFY(VideoCollectionWrapper::mLatestStatusCode == VideoCollectionCommon::statusMultipleDeleteFail);
- QVERIFY(VideoCollectionWrapper::mLatestAdditional.isValid());
- QVERIFY(VideoCollectionWrapper::mLatestAdditional.toInt() == testIds.count());
-
+
+ idList.append(TMPXItemId(1,0));
+ // multiple failed
+ emit signalDeleteCompleted(0, &idList);
+ QVERIFY(spysignal.count() == 1);
+ QVERIFY(VideoListDataModel::mStatus == VideoCollectionCommon::statusMultipleDeleteFail);
+ QVERIFY(VideoListDataModel::mStatusData.isValid());
disconnect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*)));
disconnect(this, SIGNAL(signalDeleteCompleted(int, QList<TMPXItemId>*)), mTestObject, SLOT(videoDeleteCompletedSlot(int, QList<TMPXItemId>*)));
+
}
// -----------------------------------------------------------------------------
// testVideoDetailsCompletedSlot
// -----------------------------------------------------------------------------
//
+
void TestVideoModel_p::testVideoDetailsCompletedSlot()
{
mMediaFactory->removeArray();
QVERIFY(connect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*))));
QVERIFY(connect(this, SIGNAL(signalVideoDetailsCompleted(TMPXItemId)), mTestObject, SLOT(videoDetailsCompletedSlot(TMPXItemId))));
- QSignalSpy spysignal(mTestObject, SIGNAL(videoDetailsReady(int)));
+ QSignalSpy spysignal(mTestObject, SIGNAL(videoDetailsReady(TMPXItemId)));
// no videos
emit signalVideoDetailsCompleted(TMPXItemId(0,0));
@@ -1192,7 +1121,7 @@
// invalid id
emit signalVideoDetailsCompleted(TMPXItemId::InvalidId());
QVERIFY(spysignal.count() == 0);
- emit signalVideoDetailsCompleted(MEDIA_COUNT);
+ emit signalVideoDetailsCompleted(TMPXItemId(MEDIA_COUNT,0));
QVERIFY(spysignal.count() == 0);
// correct ids
@@ -1202,7 +1131,6 @@
spysignal.clear();
emit signalVideoDetailsCompleted(TMPXItemId(MEDIA_COUNT - 1,0));
QVERIFY(spysignal.count() == 1);
- QVERIFY(spysignal.value(0).at(0).toInt() == MEDIA_COUNT - 1);
disconnect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*)));
disconnect(this, SIGNAL(signalVideoDetailsCompleted(TMPXItemId)), mTestObject, SLOT(videoDetailsCompletedSlot(TMPXItemId)));
@@ -1221,7 +1149,7 @@
mMediaFactory->removeArray();
mMediaFactory->createCollectionItems();
emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
-
+ int count = mTestObject->getVideoCount();
QVERIFY( mTestObject->getVideoCount() == 2);
disconnect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*)));
@@ -1240,11 +1168,11 @@
QVERIFY(connect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*))));
mMediaFactory->createCollectionItems();
emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
-
+ QVERIFY( mTestObject->getVideoCount() == 2);
QVERIFY(mTestObject->getMediaIdFromIndex(-1) == TMPXItemId::InvalidId());
-
+ TMPXItemId id = mTestObject->getMediaIdFromIndex(0);
QVERIFY(mTestObject->getMediaIdFromIndex(0) == TMPXItemId(KVcxMvcCategoryIdDownloads, 1));
-
+ id = mTestObject->getMediaIdFromIndex(1);
QVERIFY(mTestObject->getMediaIdFromIndex(1) == TMPXItemId(KVcxMvcCategoryIdCaptured, 1));
disconnect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*)));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel_p/stub/inc/videocollectionclient.h Thu Apr 01 23:22:15 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: stub VideoCollectionClient class definition*
+*/
+
+#ifndef __VIDEOCOLLECTIONCLIENT_H
+#define __VIDEOCOLLECTIONCLIENT_H
+
+#include <vcxmyvideosdefs.h>
+#include <QList>
+
+// FORWARD DECLARATIONS
+
+class MMPXCollectionUtility;
+class VideoDataSignalReceiver;
+class VideoCollectionListener;
+
+
+// CLASS DECLARATION
+
+/**
+ * Client class for My Videos MPX Collection.
+ *
+ * @lib videocollectionwrapper.dll
+ */
+class VideoCollectionClient
+{
+
+public:
+
+ /**
+ * Constructor
+ */
+ VideoCollectionClient() {};
+
+ /**
+ * Destructor.
+ */
+ virtual ~VideoCollectionClient(){};
+
+
+
+public:
+
+ /**
+ * Collection level app browsed to
+ */
+ enum TCollectionLevels
+ {
+ ELevelInvalid = -1,
+ ELevelCategory = 2,
+ ELevelVideos = 3,
+ ELevelAlbum = 4
+ };
+
+ /**
+ * Returns the current level of collection.
+ *
+ * @return some type of TCollectionLevels or -1 in case of error
+ */
+ int getCollectionLevel(){ return mCollectionPathLevel; };
+
+
+ /**
+ * Variable for storing My Videos collection path level.
+ */
+ static int mCollectionPathLevel;
+ };
+
+#endif // __VIDEOCOLLECTIONCLIENT_H
--- a/videocollection/videocollectionwrapper/tsrc/testvideomodel_p/stub/inc/videodatacontainer.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel_p/stub/inc/videodatacontainer.h Thu Apr 01 23:22:15 2010 +0300
@@ -22,6 +22,8 @@
#include <qlist.h>
#include <qpair.h>
#include <mpxitemid.h>
+#include <qabstractitemmodel.h>
+
// FORWARD DECLARATIONS
class CMPXMedia;
@@ -98,8 +100,48 @@
* @return int
*/
int count() const;
+
+ /**
+ * Method removes item from data container at provided index and
+ * appends it into removed buffer
+ *
+ * @param inteIndex index of item
+ * @return TMPXItemId id of the item marked as removed
+ */
+ TMPXItemId markItemRemoved(const int &itemIndex);
+
+ /**
+ * Method removes provided items from mRemovedMedia
+ *
+ * @param itemIds ids of items to be removed. If null, removes all
+ * @return int count of items actually removed
+ */
+ int clearRemoved(QList<TMPXItemId> *itemIds = 0);
+
+ /**
+ * Method removed provided items from mRemovedMedia and returns them
+ * int actual container
+ *
+ * @param itemIds ids of items to be restored. If null, restores all
+ *
+ * @return int count of items actually restored
+ */
+ int restoreRemovedItems(QList<TMPXItemId> *itemIds = 0);
+
+ /**
+ * Returns item from removed buffer
+ *
+ * @param itemId id of item to be returned
+ */
+ CMPXMedia* getRemovedMedia(TMPXItemId itemId);
+
+ /**
+ * decrements indexes of items after provided index by one.
+ */
+ void decHashIndexesAfter(int fromIndex);
+
-private: // data
+public: // data
/**
* list of media ids used to fetch item thought index.
@@ -114,6 +156,12 @@
* value: pair, where first is item index and second is item data
*/
QMultiHash<TMPXItemId, QPair<int, CMPXMedia*> > mMediaData;
+
+ /**
+ * lookup hash for media items that are deleted, but not yet completely
+ * removed from the filesystem.
+ */
+ QHash<TMPXItemId, CMPXMedia*> mRemovedMedia;
};
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel_p/stub/inc/videodeleteworker.h Thu Apr 01 23:22:15 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: stubclass of videodeleteworker for testing VideoListDataModel_p class methods*
+*/
+
+#ifndef __VIDEODELETEWORKER_H__
+#define __VIDEODELETEWORKER_H__
+
+#include <QObject>
+#include <QList>
+#include <QVariant>
+#include <mpxitemid.h>
+
+
+class VideoDeleteWorker : public QObject
+{
+ /**
+ * define to be able to use signals and slots
+ */
+ Q_OBJECT
+
+ /**
+ * disable copy-constructor and assignment operator
+ */
+ Q_DISABLE_COPY(VideoDeleteWorker)
+
+
+public:
+
+ /**
+ * Default constructor
+ */
+ VideoDeleteWorker(){};
+
+ /**
+ * Destructor
+ */
+ ~VideoDeleteWorker(){};
+
+ /**
+ * dummy impl
+ */
+ void removeFromRequest(TMPXItemId ){};
+
+
+
+};
+
+#endif // __VIDEODELETEWORKER_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel_p/stub/inc/videolistdatamodel.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,187 @@
+/*
+* 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: contains stub model for unit testing videolistdatamodel_p*
+*/
+
+#ifndef __VIDEOLISTDATAMODEL_H__
+#define __VIDEOLISTDATAMODEL_H__
+
+#include <qabstractitemmodel.h>
+#include "videodeleteworker.h"
+#include "videocollectionclient.h"
+
+class VideoListDataModel : public QAbstractItemModel
+{
+ Q_OBJECT
+
+ /**
+ * disable copy-constructor and assignment operator
+ */
+ Q_DISABLE_COPY(VideoListDataModel)
+
+ friend class VideoListDataModelPrivate;
+
+public:
+
+ /**
+ * Default constructor
+ */
+ VideoListDataModel(){};
+
+ /**
+ * Destructor
+ */
+ ~VideoListDataModel(){};
+
+signals:
+
+ /**
+ * dummy signal
+ */
+ void modelReady();
+
+ /**
+ * dummy signal
+ */
+ void modelChanged();
+
+ /**
+ * dummy signal
+ */
+ void albumChanged();
+
+public: // from QAbstractItemModel
+
+ /**
+ * return 0 always
+ */
+ int rowCount(const QModelIndex &parent = QModelIndex()) const
+ {
+ Q_UNUSED(parent);
+ return 0;
+ }
+
+
+ QMap<int, QVariant> itemData(const QModelIndex &index) const
+ {
+ Q_UNUSED(index);
+ return QMap<int, QVariant>();
+ }
+
+ /**
+ * return empty qvariant
+ */
+ QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const
+ {
+ Q_UNUSED(index);
+ Q_UNUSED(role);
+ return QVariant();
+ }
+
+ /**
+ * columnCount
+ */
+ int columnCount(const QModelIndex & parent = QModelIndex()) const
+ {
+ Q_UNUSED(parent);
+ return 0;
+ }
+
+ /**
+ * index
+ */
+ QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const
+ {
+ Q_UNUSED(parent);
+ return createIndex(row, column);
+ }
+
+ /**
+ * Parent
+ */
+ QModelIndex parent(const QModelIndex & index) const
+ {
+ Q_UNUSED(index);
+ return QModelIndex();
+ }
+
+ void beginInsertRows(const QModelIndex &parent, int first, int last)
+ {
+ Q_UNUSED(parent);
+ mFirstInserted = first;
+ mLastInserted = last;
+ }
+
+ void endInsertRows(){}
+
+ void beginRemoveRows(const QModelIndex &parent, int first, int last)
+ {
+ Q_UNUSED(parent);
+ mFirstRemoved = first;
+ mLastRemoved = last;
+ }
+
+ void endRemoveRows(){}
+
+ void reportAsyncStatus(int status, QVariant data)
+ {
+ mStatus = status;
+ mStatusData = data;
+ }
+ /**
+ * dummy collectionclient
+ */
+ VideoCollectionClient *mCollectionClient;
+
+ /**
+ * dummy delete worker
+ */
+ VideoDeleteWorker *mDeleteWorker;
+
+ /**
+ * setted in beginInsertRows
+ */
+ static int mFirstInserted;
+
+ /**
+ * setted in beginInsertRows;
+ */
+ static int mLastInserted;
+
+ /**
+ * setted in beginRemoveRows
+ */
+ static int mFirstRemoved;
+
+ /**
+ * setted in beginRemoveRows;
+ */
+ static int mLastRemoved;
+
+ /**
+ * setted in reportAsyncStatus
+ */
+ static int mStatus;
+
+ /**
+ * setted in reportAsyncStatus
+ */
+ static QVariant mStatusData;
+};
+#endif // __STUBTESTMODEL_H__
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel_p/stub/src/videocollectionclient.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,20 @@
+/*
+* 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 VideoCollectionClient class implementation*
+*/
+
+
+#include "videocollectionclient.h"
+
+int VideoCollectionClient::mCollectionPathLevel = -1;
--- a/videocollection/videocollectionwrapper/tsrc/testvideomodel_p/stub/src/videodatacontainer.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel_p/stub/src/videodatacontainer.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -46,6 +46,7 @@
VideoDataContainer::~VideoDataContainer()
{
clear();
+ clearRemoved();
}
// -----------------------------------------------------------------------------
@@ -70,27 +71,35 @@
//
void VideoDataContainer::remove(const TMPXItemId &id)
{
- QMultiHash<TMPXItemId, QPair<int, CMPXMedia*> >::iterator removeIter = mMediaData.find(id);
- if(removeIter == mMediaData.end())
+ QMultiHash<TMPXItemId, QPair<int, CMPXMedia*> >::iterator removeIter = mMediaData.constFind(id);
+ if(removeIter == mMediaData.constEnd())
{
return;
}
- QMultiHash<TMPXItemId, QPair<int, CMPXMedia*> >::iterator hashIter;
+
mMediaIds.removeAt(removeIter->first);
+
// sync item indexes whose ids exist in id- list after
// recently removoved.
+ decHashIndexesAfter(removeIter->first);
+
+ delete removeIter->second;
+ mMediaData.erase(removeIter);
+}
+
+void VideoDataContainer::decHashIndexesAfter(int fromIndex)
+{
int count = mMediaIds.count();
- for(int i = removeIter->first; i < count; ++i)
+ QMultiHash<TMPXItemId, QPair<int, CMPXMedia*> >::iterator hashIter;
+ for(int i = fromIndex; i < count; ++i)
{
hashIter = mMediaData.find(mMediaIds[i]);
if(hashIter != mMediaData.end())
{
hashIter->first--;
}
- }
- delete removeIter->second;
- mMediaData.erase(removeIter);
-}
+ }
+}
// -----------------------------------------------------------------------------
// append
@@ -106,7 +115,11 @@
// could not get id or id does not match ==> NOP
return;
}
- // just append item even there are duplicates
+ // do not append duplicates
+ if(mMediaIds.contains(mediaId))
+ {
+ return;
+ }
mMediaIds.append(mediaId);
mMediaData.insert(mediaId, qMakePair( mMediaIds.count() - 1, media));
}
@@ -163,4 +176,123 @@
return mMediaData.count();
}
-// end of gile
+// -----------------------------------------------------------------------------
+// markItemsRemoved
+// -----------------------------------------------------------------------------
+//
+TMPXItemId VideoDataContainer::markItemRemoved(const int &itemIndex)
+{
+ // for all provided indexes:
+ // - get item address from mMediaData
+ // - get item index from mMediaData
+ // - remove item from mMediaData, do not deallocate object
+ // - remove item's id from mMediaIds -list
+ // - append item into mRemovedMedia
+ // - append item's id into returned id -list
+ TMPXItemId id = TMPXItemId::InvalidId();
+ CMPXMedia *media = 0;
+ id = idFromIndex(itemIndex);
+ media = fromIndex(itemIndex);
+ if(id == TMPXItemId::InvalidId() || !media)
+ {
+ return id;
+ }
+ if(!mRemovedMedia.contains(id))
+ {
+ mRemovedMedia[id] = media;
+
+ }
+ mMediaData.remove(id);
+ mMediaIds.removeAt(itemIndex);
+ // sync item indexes after this
+ decHashIndexesAfter(itemIndex);
+ return id;
+}
+
+// -----------------------------------------------------------------------------
+// clearRemoved
+// -----------------------------------------------------------------------------
+//
+int VideoDataContainer::clearRemoved(QList<TMPXItemId> *itemIds)
+{
+ int count = 0;
+ QList<TMPXItemId> ids;
+
+ QList<TMPXItemId>::const_iterator iterEnd;
+ if(!itemIds)
+ {
+ ids = mRemovedMedia.keys();
+ }
+ else
+ {
+ ids = *itemIds;
+ }
+ QList<TMPXItemId>::const_iterator idIter = ids.constBegin();
+ QHash<TMPXItemId, CMPXMedia*>::iterator iter;
+ while(idIter != ids.constEnd())
+ {
+ iter = mRemovedMedia.find((*idIter));
+ if(iter != mRemovedMedia.end())
+ {
+ delete (*iter);
+ mRemovedMedia.remove((*idIter));
+ count++;
+ }
+ ++idIter;
+ }
+ return count;
+}
+
+// -----------------------------------------------------------------------------
+// restoreRemovedItems
+// -----------------------------------------------------------------------------
+//
+int VideoDataContainer::restoreRemovedItems(QList<TMPXItemId> *itemIds)
+{
+
+ int count = 0;
+ QList<TMPXItemId> ids;
+
+ QList<TMPXItemId>::const_iterator iterEnd;
+ if(!itemIds)
+ {
+ ids = mRemovedMedia.keys();
+ }
+ else
+ {
+ ids = *itemIds;
+ }
+
+ QList<TMPXItemId>::const_iterator idIter = ids.constBegin();
+ QHash<TMPXItemId, CMPXMedia*>::iterator iter;
+ while(idIter != ids.constEnd())
+ {
+ iter = mRemovedMedia.find((*idIter));
+ if(iter != mRemovedMedia.constEnd() && !mMediaData.contains(iter.key()))
+ {
+ mMediaIds.append(iter.key());
+ mMediaData.insert(iter.key(), qMakePair(mMediaIds.count() - 1, iter.value()));
+ mRemovedMedia.remove((*idIter));
+ count++;
+ }
+ ++idIter;
+ }
+ return count;
+}
+
+// -----------------------------------------------------------------------------
+// getRemovedMedia
+// -----------------------------------------------------------------------------
+//
+CMPXMedia* VideoDataContainer::getRemovedMedia(TMPXItemId itemId)
+{
+ QHash<TMPXItemId, CMPXMedia*>::const_iterator itemIter =
+ mRemovedMedia.constFind(itemId);
+ if(itemIter != mRemovedMedia.constEnd())
+ {
+ return itemIter.value();
+ }
+ return 0;
+}
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel_p/stub/src/videolistdatamodel.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,36 @@
+/*
+* 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: CVideoCollectionUtils class implementation
+*
+*/
+
+// INCLUDE FILES
+
+
+#include <qobject.h>
+#include "videolistdatamodel.h"
+
+int VideoListDataModel::mStatus = -1;
+
+QVariant VideoListDataModel::mStatusData = QVariant();
+
+int VideoListDataModel::mFirstInserted = -1;
+
+int VideoListDataModel::mLastInserted = -1;
+
+int VideoListDataModel::mFirstRemoved = -1;
+
+int VideoListDataModel::mLastRemoved = -1;
+
+// End of file
--- a/videocollection/videocollectionwrapper/tsrc/testvideomodel_p/testvideomodel_p.pro Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel_p/testvideomodel_p.pro Thu Apr 01 23:22:15 2010 +0300
@@ -29,6 +29,7 @@
stub/inc/videocollectionwrapper.h \
stub/inc/videocollectionutils.h \
stub/inc/videodatacontainer.h \
+ stub/inc/videocollectionclient.h \
../../inc/videodatasignalreceiver.h \
../../inc/videolistdatamodel_p.h \
inc/testvideomodel_p.h \
@@ -38,6 +39,8 @@
SOURCES += stub/src/videocollectionwrapper.cpp \
stub/src/videocollectionutils.cpp \
stub/src/videodatacontainer.cpp \
+ stub/src/videocollectionclient.cpp \
+ stub/src/videolistdatamodel.cpp \
../../src/videolistdatamodel_p.cpp \
src/testvideomodel_p.cpp \
src/mediaobjectfactory.cpp \
--- a/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/inc/testvideosortfilterproxymodel.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/inc/testvideosortfilterproxymodel.h Thu Apr 01 23:22:15 2010 +0300
@@ -25,6 +25,7 @@
class VideoListDataModel;
class FilterProxyTester;
class VideoCollectionClient;
+class VideoSortFilterProxyModel;
class TestVideoSortFilterProxyModel : public QObject
{
@@ -55,16 +56,6 @@
* Test initialize with null model causing connect to fail.
*/
void testInitializeSignalConnectFail();
-
- /**
- * Test when model init fails.
- */
- void testInitializeDataModelInitFail();
-
- /**
- * Test when collection init fails.
- */
- void testInitializeCollectionInitFail();
/**
* Test second call to initialize with valid data.
@@ -72,11 +63,6 @@
void testSecondInitialize();
/**
- * Test second call to initialize when model init fails.
- */
- void testSecondInitializeModelInitFail();
-
- /**
* Test open.
*/
void testOpen();
@@ -97,24 +83,24 @@
void testDeleteItemsRemoveRowsFail();
/**
- * Test openItem with valid data.
- */
- void testOpenItem();
-
- /**
* Test openItem when getMediaId fails.
*/
- void testOpenItemGetMediaIdFail();
+ void testOpenItemInvalidId();
/**
- * Test openItem when model is NULL.
+ * Test openItem when collection is NULL.
*/
- void testOpenItemModelNull();
+ void testOpenItemCollectionNull();
/**
* Test openItem when openVideo fails.
*/
void testOpenItemOpenVideoFails();
+
+ /**
+ * Test openItem with valid data.
+ */
+ void testOpenItem();
/**
* Test back with valid data.
@@ -142,9 +128,9 @@
void testFetchItemDetailsGetVideoDetailsFails();
/**
- * Test lessThan when initialize has not been called.
+ * Test lessThan when there's no mModel.
*/
- void testLessThanProxyModelNotInitialized();
+ void testLessThanNoModel();
/**
* Calls sure lessThan with Qt::DisplayRole setted on
@@ -178,11 +164,6 @@
void testDoSorting();
/**
- * Test filterAcceptsRow when initialize has not been called.
- */
- void testFilterAcceptsRowProxyModelNotInitialized();
-
- /**
* Calls filterAcceptsRow.
* Tests that return values are correct with items with varying statuses.
*
@@ -205,13 +186,39 @@
void testAddNewCollectionSucceed();
/**
- * Tests calling addNewCollection where collection client returns -1.
+ * tests resolveAlbumName
+ */
+ void testResolveAlbumName();
+
+ /**
+ * tests addItemsInAlbum
*/
- void testAddNewCollectionFail();
+ void testAddItemsInAlbum();
+
+ /**
+ * tests getOpenItem
+ */
+ void testGetOpenItem();
-public slots:
-
- int testShortDetailsReadySlot(int index);
+ /**
+ * tests removeAlbums
+ */
+ void testRemoveAlbums();
+
+ /**
+ * tests albumChangedSlot
+ */
+ void testAlbumChangedSlot();
+
+ /**
+ * tests indexOfId
+ */
+ void testIndexOfId();
+
+ /**
+ * tests setGenericIdFilter
+ */
+ void testSetGenericIdFilter();
private:
@@ -230,6 +237,11 @@
* implemented to be able to call protected objects
*/
FilterProxyTester *mTestObject;
+
+ /**
+ * dummy collections content proxy
+ */
+ VideoSortFilterProxyModel *mCollectionModel;
};
--- a/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/src/testvideosortfilterproxymodel.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/src/testvideosortfilterproxymodel.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -19,6 +19,7 @@
#include <QModelIndexList>
#include <hbapplication.h>
+#include "videocollectionwrapper.h"
#include "videocollectioncommon.h"
#include "testvideosortfilterproxymodel.h"
#include "filterproxytester.h"
@@ -37,12 +38,19 @@
TestVideoSortFilterProxyModel tv;
- char *pass[3];
- pass[0] = argv[0];
- pass[1] = "-o";
- pass[2] = "c:\\data\\testvideosortfilterproxymodel.txt";
-
- int res = QTest::qExec(&tv, 3, pass);
+ 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\\testvideosortfilterproxymodel.txt";
+ res = QTest::qExec(&tv, 3, pass);
+ }
return res;
}
@@ -54,6 +62,8 @@
//
void TestVideoSortFilterProxyModel::init()
{
+ qRegisterMetaType<TMPXItemId>("TMPXItemId");
+
VideoListDataModel::mInitFails = false;
VideoListDataModel::mRemoveRowsFails = false;
VideoListDataModel::mGetMediaIdAtIndexFails = false;
@@ -67,7 +77,7 @@
VideoCollectionClient::mAddNewCollectionIds = QList<TMPXItemId>();
VideoThumbnailData::mStartBackgroundFetchingCallCount = 0;
- mTestObject = new FilterProxyTester();
+ mTestObject = new FilterProxyTester(VideoCollectionWrapper::EGeneric);
QVERIFY(mTestObject);
mStubModel = new VideoListDataModel();
@@ -75,6 +85,8 @@
mCollectionClient = new VideoCollectionClient();
QVERIFY(mCollectionClient);
+
+ mCollectionModel = new VideoSortFilterProxyModel(VideoCollectionWrapper::ECollections);
}
// ---------------------------------------------------------------------------
@@ -91,6 +103,9 @@
delete mTestObject;
mTestObject = 0;
+
+ delete mCollectionModel;
+ mCollectionModel = 0;
}
// ---------------------------------------------------------------------------
@@ -112,28 +127,6 @@
}
// ---------------------------------------------------------------------------
-// testInitializeDataModelInitFail
-// ---------------------------------------------------------------------------
-//
-void TestVideoSortFilterProxyModel::testInitializeDataModelInitFail()
-{
- VideoListDataModel::mInitFails = true;
-
- QVERIFY(mTestObject->initialize(mStubModel) == -1);
-}
-
-// ---------------------------------------------------------------------------
-// testInitializeCollectionInitFail
-// ---------------------------------------------------------------------------
-//
-void TestVideoSortFilterProxyModel::testInitializeCollectionInitFail()
-{
- VideoCollectionClient::mFailInit = true;
-
- QVERIFY(mTestObject->initialize(mStubModel) == -1);
-}
-
-// ---------------------------------------------------------------------------
// testSecondInitialize
// ---------------------------------------------------------------------------
//
@@ -144,22 +137,16 @@
}
// ---------------------------------------------------------------------------
-// testSecondInitializeModelInitFail
-// ---------------------------------------------------------------------------
-//
-void TestVideoSortFilterProxyModel::testSecondInitializeModelInitFail()
-{
- QVERIFY(mTestObject->initialize(mStubModel) == 0);
- VideoListDataModel::mInitFails = true;
- QVERIFY(mTestObject->initialize(mStubModel) == -1);
-}
-
-// ---------------------------------------------------------------------------
// testOpen
// ---------------------------------------------------------------------------
//
void TestVideoSortFilterProxyModel::testOpen()
{
+ // no mCollectionClient
+ QVERIFY(mTestObject->open(1) == -1);
+
+ mTestObject->initialize(mStubModel);
+
// First open.
QVERIFY(mTestObject->open(1) == 0);
// Open again with same level.
@@ -175,20 +162,20 @@
//
void TestVideoSortFilterProxyModel::testDeleteItems()
{
+ VideoCollectionClient::mFailStartOpen = false;
+ QVERIFY(mTestObject->initialize(mStubModel) == 0);
+ QVERIFY(mTestObject->open(VideoCollectionCommon::ELevelVideos) == 0);
QString name1 = "cc";
QString name2 = "bb";
QString name3 = "aa";
QString name4 = "11";
QString name5 = "12";
- mStubModel->appendData(name1); // to source model index 0, proxy index after sort 4
+
+ mStubModel->appendData(name1); // to source model index 0, proxy index after sort 4
mStubModel->appendData(name2); // to source model index 1, proxy index after sort 3
mStubModel->appendData(name3); // to source model index 2, proxy index after sort 2
- mStubModel->appendData(name4); // to source model index 3, proxy index after sort 0
+ mStubModel->appendData(name4); // to source model index 3, proxy index after sort 0
mStubModel->appendData(name5); // to source model index 4, proxy index after sort 1
-
- QVERIFY(mTestObject->initialize(mStubModel) == 0);
-
- mStubModel->setUsedRowCount(5);
// sort to make sure that list order is different compared to source model
mTestObject->doSorting(Qt::DisplayRole, Qt::AscendingOrder);
@@ -196,7 +183,8 @@
// processing time.
QTest::qWait(500);
QVERIFY(mTestObject->sortRole() == Qt::DisplayRole);
-
+
+ int count = mTestObject->rowCount();
QModelIndexList list;
QModelIndex index;
for(int i = 0; i < 5; ++i)
@@ -205,14 +193,11 @@
list.append(index);
}
QModelIndexList emptyList;
- User::Heap().__DbgMarkStart();
VideoThumbnailData::mStartBackgroundFetchingCallCount = 0;
QVERIFY(mTestObject->deleteItems(emptyList) == 0);
QVERIFY(mTestObject->deleteItems(list) == 0);
QVERIFY(mStubModel->mLastDeletedIndexRow == 0);
QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 2);
- int remHeap = User::Heap().__DbgMarkEnd(0);
- QVERIFY(remHeap == 0);
}
// ---------------------------------------------------------------------------
@@ -222,19 +207,14 @@
void TestVideoSortFilterProxyModel::testDeleteItemsModelNull()
{
mStubModel->appendData("Test");
- mStubModel->setUsedRowCount(1);
QVERIFY(mTestObject->initialize(NULL) == -1);
QModelIndex index = mStubModel->index(0, 0);
QModelIndexList list;
list.append(index);
-
- User::Heap().__DbgMarkStart();
QVERIFY(mTestObject->deleteItems(list) == -1);
- int remHeap = User::Heap().__DbgMarkEnd(0);
- QVERIFY(remHeap == 0);
}
// ---------------------------------------------------------------------------
@@ -244,81 +224,54 @@
void TestVideoSortFilterProxyModel::testDeleteItemsRemoveRowsFail()
{
VideoListDataModel::mRemoveRowsFails = true;
-
+ VideoCollectionClient::mFailStartOpen = false;
+ QVERIFY(mTestObject->initialize(mStubModel) == 0);
+ QVERIFY(mTestObject->open(VideoCollectionCommon::ELevelVideos) == 0);
+
mStubModel->appendData("Test");
- mStubModel->setUsedRowCount(1);
+
QVERIFY(mTestObject->initialize(mStubModel) == 0);
QModelIndex index = mTestObject->index(0, 0);
QModelIndexList list;
list.append(index);
-
- User::Heap().__DbgMarkStart();
QVERIFY(mTestObject->deleteItems(list) == -1);
-
- int remHeap = User::Heap().__DbgMarkEnd(0);
- QVERIFY(remHeap == 0);
-}
-
-// ---------------------------------------------------------------------------
-// testOpenItem
-// ---------------------------------------------------------------------------
-//
-void TestVideoSortFilterProxyModel::testOpenItem()
-{
- mStubModel->appendData("Test");
- mStubModel->setUsedRowCount(1);
- QVERIFY(mTestObject->initialize(mStubModel) == 0);
- QModelIndex index = mTestObject->index(0, 0);
-
- User::Heap().__DbgMarkStart();
-
- QVERIFY(mTestObject->openItem(index) == 0);
-
- int remHeap = User::Heap().__DbgMarkEnd(0);
- QVERIFY(remHeap == 0);
}
// ---------------------------------------------------------------------------
-// testOpenItemGetMediaIdFail
+// testOpenItemInvalidId
// ---------------------------------------------------------------------------
//
-void TestVideoSortFilterProxyModel::testOpenItemGetMediaIdFail()
+void TestVideoSortFilterProxyModel::testOpenItemInvalidId()
{
VideoListDataModel::mGetMediaIdAtIndexFails = true;
-
+ VideoCollectionClient::mFailStartOpen = false;
+ QVERIFY(mTestObject->initialize(mStubModel) == 0);
+ QVERIFY(mTestObject->open(VideoCollectionCommon::ELevelVideos) == 0);
+
mStubModel->appendData("Test");
- mStubModel->setUsedRowCount(1);
+
QVERIFY(mTestObject->initialize(mStubModel) == 0);
QModelIndex index = mTestObject->index(0, 0);
-
- User::Heap().__DbgMarkStart();
+ TMPXItemId itemId = TMPXItemId::InvalidId();
- QVERIFY(mTestObject->openItem(index) == -1);
-
- int remHeap = User::Heap().__DbgMarkEnd(0);
- QVERIFY(remHeap == 0);
+ QVERIFY(mTestObject->openItem(itemId) == -1);
}
// ---------------------------------------------------------------------------
-// testOpenItemModelNull
+// testOpenItemCollectionNull
// ---------------------------------------------------------------------------
//
-void TestVideoSortFilterProxyModel::testOpenItemModelNull()
+void TestVideoSortFilterProxyModel::testOpenItemCollectionNull()
{
mStubModel->appendData("Test");
- mStubModel->setUsedRowCount(1);
- QVERIFY(mTestObject->initialize(NULL) == -1);
- QModelIndex index = mTestObject->index(0, 0);
- User::Heap().__DbgMarkStart();
-
- QVERIFY(mTestObject->openItem(index) == -1);
-
- int remHeap = User::Heap().__DbgMarkEnd(0);
- QVERIFY(remHeap == 0);
+ TMPXItemId itemId(1,0);
+
+ QVERIFY(mTestObject->openItem(itemId) == -1);
}
+
// ---------------------------------------------------------------------------
// testOpenItemOpenVideoFails
// ---------------------------------------------------------------------------
@@ -328,16 +281,31 @@
VideoCollectionClient::mFailMediaPlayback = true;
mStubModel->appendData("Test");
- mStubModel->setUsedRowCount(1);
QVERIFY(mTestObject->initialize(mStubModel) == 0);
+ TMPXItemId itemId(1,0);
+
+ QVERIFY(mTestObject->openItem(itemId) == -1);
- QModelIndex index = mTestObject->index(0, 0);
- User::Heap().__DbgMarkStart();
-
- QVERIFY(mTestObject->openItem(index) == -1);
-
- int remHeap = User::Heap().__DbgMarkEnd(0);
- QVERIFY(remHeap == 0);
+ VideoCollectionClient::mFailMediaPlayback = false;
+}
+
+// ---------------------------------------------------------------------------
+// testOpenItem
+// ---------------------------------------------------------------------------
+//
+void TestVideoSortFilterProxyModel::testOpenItem()
+{
+ mStubModel->appendData("Test");
+ QVERIFY(mTestObject->initialize(mStubModel) == 0);
+ TMPXItemId itemId(1,0);
+
+ // open video
+ QVERIFY(mTestObject->openItem(itemId) == 0);
+
+ // open category or album
+ itemId = TMPXItemId(1,2);
+ QVERIFY(mTestObject->openItem(itemId) == 0);
+
}
// ---------------------------------------------------------------------------
@@ -346,17 +314,14 @@
//
void TestVideoSortFilterProxyModel::testBack()
{
- //mStubModel->appendData("Test");
- //mStubModel->setUsedRowCount(1);
+
QVERIFY(mTestObject->initialize(mStubModel) == 0);
- //QModelIndex index = mTestObject->index(0, 0);
-
- User::Heap().__DbgMarkStart();
QVERIFY(mTestObject->back() == 0);
- int remHeap = User::Heap().__DbgMarkEnd(0);
- QVERIFY(remHeap == 0);
+ mTestObject->open(VideoCollectionCommon::ELevelAlbum);
+ QVERIFY(mTestObject->back() == 0);
+
}
// ---------------------------------------------------------------------------
@@ -365,19 +330,12 @@
//
void TestVideoSortFilterProxyModel::testBackClientNull()
{
- //mStubModel->appendData("Test");
- //mStubModel->setUsedRowCount(1);
+
QVERIFY(mTestObject->initialize(mStubModel) == 0);
- //QModelIndex index = mTestObject->index(0, 0);
VideoCollectionClient *tmpCollectionClient = mTestObject->getClient();
mTestObject->setClient(0);
-
- User::Heap().__DbgMarkStart();
QVERIFY(mTestObject->back() == -1);
-
- int remHeap = User::Heap().__DbgMarkEnd(0);
- QVERIFY(remHeap == 0);
mTestObject->setClient(tmpCollectionClient);
}
@@ -388,17 +346,15 @@
//
void TestVideoSortFilterProxyModel::testFetchItemDetails()
{
+ VideoCollectionClient::mFailStartOpen = false;
mStubModel->appendData("Test");
- mStubModel->setUsedRowCount(1);
QVERIFY(mTestObject->initialize(mStubModel) == 0);
-
- QSignalSpy fetchSpy(mTestObject, SIGNAL(shortDetailsReady(int)));
+ mTestObject->open(3);
+ QSignalSpy fetchSpy(mTestObject, SIGNAL(shortDetailsReady(TMPXItemId)));
QModelIndex index = mTestObject->index(0, 0);
QList<QVariant> arguments;
-
- User::Heap().__DbgMarkStart();
QVERIFY(mTestObject->fetchItemDetails(index) == 0);
QVERIFY(fetchSpy.count() == 1);
@@ -406,9 +362,6 @@
QVERIFY(arguments.at(0).toInt() == 0);
arguments.clear();
fetchSpy.clear();
-
- int remHeap = User::Heap().__DbgMarkEnd(0);
- QVERIFY(remHeap == 0);
}
// ---------------------------------------------------------------------------
@@ -420,21 +373,16 @@
VideoListDataModel::mGetMediaIdAtIndexFails = true;
mStubModel->appendData("Test");
- mStubModel->setUsedRowCount(1);
+
QVERIFY(mTestObject->initialize(mStubModel) == 0);
- QSignalSpy fetchSpy(mTestObject, SIGNAL(shortDetailsReady(int)));
+ QSignalSpy fetchSpy(mTestObject, SIGNAL(shortDetailsReady(TMPXItemId)));
QModelIndex index = mTestObject->index(0, 0);
- User::Heap().__DbgMarkStart();
-
QVERIFY(mTestObject->fetchItemDetails(index) == -1);
QVERIFY(fetchSpy.count() == 0);
-
- int remHeap = User::Heap().__DbgMarkEnd(0);
- QVERIFY(remHeap == 0);
}
// ---------------------------------------------------------------------------
@@ -446,29 +394,52 @@
VideoCollectionClient::mFailMediaDetails = true;
mStubModel->appendData("Test");
- mStubModel->setUsedRowCount(1);
+
QVERIFY(mTestObject->initialize(mStubModel) == 0);
- QSignalSpy fetchSpy(mTestObject, SIGNAL(shortDetailsReady(int)));
+ QSignalSpy fetchSpy(mTestObject, SIGNAL(shortDetailsReady(TMPXItemId)));
QModelIndex index = mTestObject->index(0, 0);
-
- User::Heap().__DbgMarkStart();
-
+
QVERIFY(mTestObject->fetchItemDetails(index) == -1);
QVERIFY(fetchSpy.count() == 0);
-
- int remHeap = User::Heap().__DbgMarkEnd(0);
- QVERIFY(remHeap == 0);
}
// ---------------------------------------------------------------------------
// testLessThanProxyModelNotInitialized
// ---------------------------------------------------------------------------
//
-void TestVideoSortFilterProxyModel::testLessThanProxyModelNotInitialized()
+void TestVideoSortFilterProxyModel::testLessThanNoModel()
{
- QVERIFY(mTestObject->initialize(mStubModel) == 0);
+ // "normal" comparisation
+ QString name1 = "cc";
+ QString name2 = "bb";
+ QString name3 = "aa";
+ QString name4 = "11";
+ QString name5 = "11";
+
+ mStubModel->appendData(name1); // to index 0, position 4
+ mStubModel->appendData(name2); // to index 1, position 3
+ mStubModel->appendData(name3); // to index 2, position 2
+ mStubModel->appendData(name4); // to index 3, position 0 or 1
+ mStubModel->appendData(name5); // to index 4, position 0 or 1
+
+ mTestObject->setSortRole(Qt::DisplayRole);
+
+ QModelIndex left = mStubModel->index(0,0);
+ QModelIndex right = mStubModel->index(1,0);
+
+ QVERIFY(!mTestObject->callLessThan(left, right));
+}
+// ---------------------------------------------------------------------------
+// testLessThanName
+// ---------------------------------------------------------------------------
+//
+void TestVideoSortFilterProxyModel::testLessThanName()
+{
+ VideoCollectionClient::mFailStartOpen = false;
+ QVERIFY(mTestObject->initialize(mStubModel) == 0);
+ QVERIFY(mTestObject->open(VideoCollectionCommon::ELevelVideos) == 0);
// "normal" comparisation
QString name1 = "cc";
@@ -482,45 +453,8 @@
mStubModel->appendData(name3); // to index 2, position 2
mStubModel->appendData(name4); // to index 3, position 0 or 1
mStubModel->appendData(name5); // to index 4, position 0 or 1
- mStubModel->setUsedRowCount(5);
mTestObject->setSortRole(Qt::DisplayRole);
-
- User::Heap().__DbgMarkStart();
-
- QModelIndex left = mStubModel->index(0,0);
- QModelIndex right = mStubModel->index(1,0);
-
- QVERIFY(!mTestObject->callLessThan(left, right));
-
- int remHeap = User::Heap().__DbgMarkEnd(0);
- QVERIFY(remHeap == 0);
-}
-// ---------------------------------------------------------------------------
-// testLessThanName
-// ---------------------------------------------------------------------------
-//
-void TestVideoSortFilterProxyModel::testLessThanName()
-{
- QVERIFY(mTestObject->initialize(mStubModel) == 0);
-
- // "normal" comparisation
- QString name1 = "cc";
- QString name2 = "bb";
- QString name3 = "aa";
- QString name4 = "11";
- QString name5 = "11";
-
- mStubModel->appendData(name1); // to index 0, position 4
- mStubModel->appendData(name2); // to index 1, position 3
- mStubModel->appendData(name3); // to index 2, position 2
- mStubModel->appendData(name4); // to index 3, position 0 or 1
- mStubModel->appendData(name5); // to index 4, position 0 or 1
- mStubModel->setUsedRowCount(5);
-
- mTestObject->setSortRole(Qt::DisplayRole);
-
- User::Heap().__DbgMarkStart();
QModelIndex left = mStubModel->index(0,0);
QModelIndex right = mStubModel->index(1,0);
@@ -545,17 +479,10 @@
right = mStubModel->index(0,0);
QVERIFY(mTestObject->callLessThan(left, right));
-
- int remHeap = User::Heap().__DbgMarkEnd(0);
- QVERIFY(remHeap == 0);
+
// reset model
- delete mStubModel;
- mStubModel = 0;
-
- mStubModel = new VideoListDataModel();
- QVERIFY(mStubModel);
- QVERIFY(mTestObject->initialize(mStubModel) == 0);
-
+ mStubModel->removeAll();;
+
// case sensitive check
name1 = "cc";
name2 = "CC";
@@ -565,7 +492,7 @@
QString name6 = "2Aa";
QString name7 = "1Aa";
QString name8 = "1cc";
-
+ mStubModel->removeAll();
mStubModel->appendData(name1); // to index 0, position can be 5, 6 or 7
mStubModel->appendData(name2); // to index 1, position can be 5, 6 or 7
mStubModel->appendData(name3); // to index 2, position can be 5, 6 or 7
@@ -575,11 +502,9 @@
mStubModel->appendData(name7); // to index 6, position is 0
mStubModel->appendData(name8); // to index 7, position is 1
- mStubModel->setUsedRowCount(8);
mTestObject->setSortRole(Qt::DisplayRole);
-
- User::Heap().__DbgMarkStart();
+
left = mStubModel->index(0,0); // "cc"
right = mStubModel->index(1,0); // "CC"
@@ -625,10 +550,6 @@
left = mStubModel->index(7,0); // "1cc"
right = mStubModel->index(0,0); // "cc"
QVERIFY(mTestObject->callLessThan(left, right));
-
- remHeap = User::Heap().__DbgMarkEnd(0);
- QVERIFY(remHeap == 0);
-
}
// ---------------------------------------------------------------------------
@@ -637,7 +558,9 @@
//
void TestVideoSortFilterProxyModel::testLessThanSize()
{
+ VideoCollectionClient::mFailStartOpen = false;
QVERIFY(mTestObject->initialize(mStubModel) == 0);
+ QVERIFY(mTestObject->open(VideoCollectionCommon::ELevelVideos) == 0);
quint32 size1 = 300;
quint32 size2 = 200;
@@ -650,11 +573,8 @@
mStubModel->appendData(size3); // to index 2
mStubModel->appendData(size4); // to index 3
mStubModel->appendData(size5); // to index 4
- mStubModel->setUsedRowCount(5);
-
+
mTestObject->setSortRole(VideoCollectionCommon::KeySizeValue);
-
- User::Heap().__DbgMarkStart();
QModelIndex left = mStubModel->index(0,0);
QModelIndex right = mStubModel->index(1,0);
@@ -680,9 +600,6 @@
right = mStubModel->index(0,0);
QVERIFY(mTestObject->callLessThan(left, right));
-
- int remHeap = User::Heap().__DbgMarkEnd(0);
- QVERIFY(remHeap == 0);
}
// ---------------------------------------------------------------------------
@@ -691,7 +608,9 @@
//
void TestVideoSortFilterProxyModel::testLessThanDateTime()
{
- QVERIFY(mTestObject->initialize(mStubModel) == 0);
+ VideoCollectionClient::mFailStartOpen = false;
+ QVERIFY(mTestObject->initialize(mStubModel) == 0);
+ QVERIFY(mTestObject->open(VideoCollectionCommon::ELevelVideos) == 0);
QDateTime date1(QDate(2010, 11, 5), QTime(0,0));
QDateTime date2(QDate(2009, 9, 5), QTime(0,0));
@@ -704,11 +623,8 @@
mStubModel->appendData(date3); // to index 2
mStubModel->appendData(date4); // to index 3
mStubModel->appendData(date5); // to index 4
- mStubModel->setUsedRowCount(5);
mTestObject->setSortRole(VideoCollectionCommon::KeyDateTime);
-
- User::Heap().__DbgMarkStart();
QModelIndex left = mStubModel->index(0,0);
QModelIndex right = mStubModel->index(1,0);
@@ -734,9 +650,6 @@
right = mStubModel->index(0,0);
QVERIFY(!mTestObject->callLessThan(left, right));
-
- int remHeap = User::Heap().__DbgMarkEnd(0);
- QVERIFY(remHeap == 0);
}
// ---------------------------------------------------------------------------
@@ -745,21 +658,18 @@
//
void TestVideoSortFilterProxyModel::testLessThanInvalid()
{
- QVERIFY(mTestObject->initialize(mStubModel) == 0);
+ VideoCollectionClient::mFailStartOpen = false;
+ QVERIFY(mTestObject->initialize(mStubModel) == 0);
+ QVERIFY(mTestObject->open(VideoCollectionCommon::ELevelVideos) == 0);
// invalid role
mTestObject->setSortRole(10000);
- User::Heap().__DbgMarkStart();
-
QModelIndex left = mStubModel->index(0,0);
QModelIndex right = mStubModel->index(0,0);
QVERIFY(!mTestObject->callLessThan(left, right));
- int remHeap = User::Heap().__DbgMarkEnd(0);
- QVERIFY(remHeap == 0);
-
// invalid role but valid data.
QString name1 = "cc";
@@ -770,38 +680,26 @@
mStubModel->appendData(name1); // to index 0, position 4
mStubModel->appendData(name2); // to index 1, position 3
mStubModel->appendData(name3); // to index 2, position 2
- mStubModel->setUsedRowCount(3);
mTestObject->setSortRole(INVALID_ROLE_FOR_SORTING);
left = mStubModel->index(0,0);
right = mStubModel->index(1,0);
- User::Heap().__DbgMarkStart();
QVERIFY(!mTestObject->callLessThan(left, right));
-
- remHeap = User::Heap().__DbgMarkEnd(0);
- QVERIFY(remHeap == 0);
// reset model
- delete mStubModel;
- mStubModel = 0;
-
- mStubModel = new VideoListDataModel();
- QVERIFY(mStubModel);
- QVERIFY(mTestObject->initialize(mStubModel) == 0);
-
+ mStubModel->removeAll();
+
// invalid left index
mTestObject->setSortRole(Qt::DisplayRole);
- User::Heap().__DbgMarkStart();
+
left = QModelIndex();
right = mStubModel->index(0,0);
QVERIFY(!mTestObject->callLessThan(left, right));
- remHeap = User::Heap().__DbgMarkEnd(0);
- QVERIFY(remHeap == 0);
-
+
// invalid right index
mTestObject->setSortRole(Qt::DisplayRole);
User::Heap().__DbgMarkStart();
@@ -809,8 +707,6 @@
right = QModelIndex();
QVERIFY(!mTestObject->callLessThan(left, right));
- remHeap = User::Heap().__DbgMarkEnd(0);
- QVERIFY(remHeap == 0);
// both invalid
mTestObject->setSortRole(Qt::DisplayRole);
@@ -819,9 +715,7 @@
right = QModelIndex();
QVERIFY(!mTestObject->callLessThan(left, right));
- remHeap = User::Heap().__DbgMarkEnd(0);
- QVERIFY(remHeap == 0);
-
+
// both same index, use size
quint32 size1 = 99;
@@ -829,15 +723,12 @@
mTestObject->setSortRole(VideoCollectionCommon::KeySizeValue);
mTestObject->setSortRole(Qt::DisplayRole);
-
- User::Heap().__DbgMarkStart();
+
left = mStubModel->index(0,0);
right = mStubModel->index(0,0);
QVERIFY(!mTestObject->callLessThan(left, right));
- remHeap = User::Heap().__DbgMarkEnd(0);
- QVERIFY(remHeap == 0);
-
+
}
// ---------------------------------------------------------------------------
@@ -846,9 +737,9 @@
//
void TestVideoSortFilterProxyModel::testDoSorting()
{
- QWARN("Waiting for resolving of potential memory leak in QSortFilterProxy before adding heap allocation checks here");
-
+ VideoCollectionClient::mFailStartOpen = false;
QVERIFY(mTestObject->initialize(mStubModel) == 0);
+ QVERIFY(mTestObject->open(VideoCollectionCommon::ELevelVideos) == 0);
// these signals are emitted during sorting procedure from the fw
QSignalSpy spyAboutToChange(mTestObject, SIGNAL(layoutAboutToBeChanged()));
@@ -888,9 +779,8 @@
mStubModel->appendData(size4); // to index 3
mStubModel->appendData(size5); // to index 4
- mStubModel->setUsedRowCount(5);
-
- // User::Heap().__DbgMarkStart();
+ int sortingRole;
+ Qt::SortOrder sortingOrder;
// first sort call, includes timer creation and setup
VideoThumbnailData::mStartBackgroundFetchingCallCount = 0;
@@ -903,7 +793,10 @@
QCOMPARE(mTestObject->sortRole(), (int)Qt::DisplayRole);
QCOMPARE(mTestObject->sortOrder(), Qt::AscendingOrder);
QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 1);
-
+ mTestObject->getSorting(sortingRole, sortingOrder);
+ QCOMPARE(sortingRole, (int)Qt::DisplayRole);
+ QCOMPARE(sortingOrder, Qt::AscendingOrder);
+
// reset spys
spyAboutToChange.clear();
spyChanged.clear();
@@ -917,6 +810,9 @@
QCOMPARE(mTestObject->sortRole(), (int)Qt::DisplayRole);
QCOMPARE(mTestObject->sortOrder(), Qt::DescendingOrder);
QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 1);
+ mTestObject->getSorting(sortingRole, sortingOrder);
+ QCOMPARE(sortingRole, (int)Qt::DisplayRole);
+ QCOMPARE(sortingOrder, Qt::DescendingOrder);
// reset spys
spyAboutToChange.clear();
@@ -932,6 +828,9 @@
QCOMPARE(mTestObject->sortRole(), (int)Qt::DisplayRole);
QCOMPARE(mTestObject->sortOrder(), Qt::AscendingOrder);
QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 1);
+ mTestObject->getSorting(sortingRole, sortingOrder);
+ QCOMPARE(sortingRole, (int)Qt::DisplayRole);
+ QCOMPARE(sortingOrder, Qt::AscendingOrder);
spyAboutToChange.clear();
spyChanged.clear();
@@ -944,6 +843,9 @@
QCOMPARE(mTestObject->sortRole(), (int)Qt::DisplayRole);
QCOMPARE(mTestObject->sortOrder(), Qt::DescendingOrder);
QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 1);
+ mTestObject->getSorting(sortingRole, sortingOrder);
+ QCOMPARE(sortingRole, (int)Qt::DisplayRole);
+ QCOMPARE(sortingOrder, Qt::DescendingOrder);
spyAboutToChange.clear();
spyChanged.clear();
@@ -955,6 +857,9 @@
QCOMPARE(mTestObject->sortRole(), (int)Qt::DisplayRole);
QCOMPARE(mTestObject->sortOrder(), Qt::AscendingOrder);
QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 1);
+ mTestObject->getSorting(sortingRole, sortingOrder);
+ QCOMPARE(sortingRole, (int)Qt::DisplayRole);
+ QCOMPARE(sortingOrder, Qt::AscendingOrder);
spyAboutToChange.clear();
spyChanged.clear();
@@ -967,6 +872,9 @@
QCOMPARE(mTestObject->sortRole(), (int)Qt::DisplayRole);
QCOMPARE(mTestObject->sortOrder(), Qt::AscendingOrder);
QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 0);
+ mTestObject->getSorting(sortingRole, sortingOrder);
+ QCOMPARE(sortingRole, (int)Qt::DisplayRole);
+ QCOMPARE(sortingOrder, Qt::AscendingOrder);
spyAboutToChange.clear();
spyChanged.clear();
@@ -980,6 +888,9 @@
QCOMPARE(spyChanged.count(), 1);
QCOMPARE(mTestObject->sortRole(), (int)VideoCollectionCommon::KeyDateTime);
QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 1);
+ mTestObject->getSorting(sortingRole, sortingOrder);
+ QCOMPARE(sortingRole, (int)VideoCollectionCommon::KeyDateTime);
+ QCOMPARE(sortingOrder, Qt::AscendingOrder);
spyAboutToChange.clear();
spyChanged.clear();
@@ -992,6 +903,10 @@
QCOMPARE(spyChanged.count(), 1);
QCOMPARE(mTestObject->sortRole(), (int)VideoCollectionCommon::KeySizeValue);
QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 1);
+ mTestObject->getSorting(sortingRole, sortingOrder);
+ QCOMPARE(sortingRole, (int)VideoCollectionCommon::KeySizeValue);
+ QCOMPARE(sortingOrder, Qt::AscendingOrder);
+
spyAboutToChange.clear();
spyChanged.clear();
@@ -1006,20 +921,6 @@
spyAboutToChange.clear();
spyChanged.clear();
QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 1);
-
- // cleanup();
- // int remHeap = User::Heap().__DbgMarkEnd(0);
- // QVERIFY(remHeap == 0);
-}
-
-// ---------------------------------------------------------------------------
-// testFilterAcceptsRow
-// ---------------------------------------------------------------------------
-//
-void TestVideoSortFilterProxyModel::testFilterAcceptsRowProxyModelNotInitialized()
-{
- QModelIndex index = QModelIndex(); // index can be anything, test model doesn't use it.
- QVERIFY(mTestObject->callFilterAcceptsRow(0, index) == false);
}
// ---------------------------------------------------------------------------
@@ -1028,40 +929,26 @@
//
void TestVideoSortFilterProxyModel::testFilterAcceptsRow()
{
+ QWARN("tests for different model types are still missing");
+
QModelIndex index = QModelIndex(); // index can be anything, test model doesn't use it.
- // Not initialized.
+ // Not initialized: no rouce model
QVERIFY(mTestObject->callFilterAcceptsRow(0, index) == false);
QVERIFY(mTestObject->initialize(mStubModel) == 0);
+ mTestObject->open(3);
- // Test invalid row.
+ // Test invalid row: below 0
QVERIFY(mTestObject->callFilterAcceptsRow(-1, index) == false);
- // Model data has no status role.
+ // invalid row: larger than count
mStubModel->appendData("test");
- mStubModel->setUsedRowCount(1);
+ QVERIFY(mTestObject->callFilterAcceptsRow(2, index) == false);
+
+ // correct row
QVERIFY(mTestObject->callFilterAcceptsRow(0, index) == true);
- // reset model
- delete mStubModel;
- mStubModel = 0;
-
- mStubModel = new VideoListDataModel();
- QVERIFY(mStubModel);
- QVERIFY(mTestObject->initialize(mStubModel) == 0);
-
- // add data with status roles.
- mStubModel->appendStatus(VideoCollectionCommon::StatusNone);
- mStubModel->appendStatus(VideoCollectionCommon::StatusDeleted);
- mStubModel->setUsedRowCount(2);
-
- // Test when status is not deleted.
- QVERIFY(mTestObject->callFilterAcceptsRow(0, index) == true);
-
- // Test when status is deleted.
- index = mStubModel->index(0,0);
- QVERIFY(mTestObject->callFilterAcceptsRow(1, index) == false);
}
// ---------------------------------------------------------------------------
@@ -1087,10 +974,8 @@
void TestVideoSortFilterProxyModel::testAddNewCollectionNoCollectionClient()
{
QString name("testname");
- QString thumb("testthumb");
- QList<TMPXItemId> ids;
-
- QCOMPARE(mTestObject->addNewCollection(name, thumb, ids), -1);
+ VideoCollectionClient::mNewAlbumId = TMPXItemId(1,1);
+ QVERIFY(mTestObject->addNewAlbum(name) == TMPXItemId::InvalidId());
QVERIFY(VideoCollectionClient::mAddNewCollectionName != name);
}
@@ -1101,50 +986,239 @@
void TestVideoSortFilterProxyModel::testAddNewCollectionSucceed()
{
QString name("testname");
- QString thumb("testthumb");
- QList<TMPXItemId> ids;
- ids.append(TMPXItemId(5, 0));
- ids.append(TMPXItemId(9, 0));
+
+ mTestObject->initialize(mStubModel);
+ VideoCollectionClient::mNewAlbumId = TMPXItemId(1,1);
+ QVERIFY(mTestObject->addNewAlbum(name) == TMPXItemId(1,1));
+ QCOMPARE(VideoCollectionClient::mAddNewCollectionName, name);
+}
+
+// ---------------------------------------------------------------------------
+// testResolveAlbumName
+// ---------------------------------------------------------------------------
+//
+void TestVideoSortFilterProxyModel::testResolveAlbumName()
+{
+ QString name("test");
+ QString resolved("");
+ // no model, same name can be used
+ resolved = mTestObject->resolveAlbumName(name);
+ QVERIFY(resolved.length());
+ QVERIFY(resolved == name);
mTestObject->initialize(mStubModel);
- QCOMPARE(mTestObject->addNewCollection(name, thumb, ids), 0);
- QCOMPARE(VideoCollectionClient::mAddNewCollectionName, name);
- QCOMPARE(VideoCollectionClient::mAddNewCollectionThumb, thumb);
- QCOMPARE(VideoCollectionClient::mAddNewCollectionIds, ids);
+ // no collections proxy model, same name
+ resolved = mTestObject->resolveAlbumName(name);
+ QVERIFY(resolved.length());
+ QVERIFY(resolved == name);
+
+
+ mCollectionModel->initialize(mStubModel);
+ VideoCollectionWrapper::instance().mProxyModel = mCollectionModel;
+
+ mStubModel->appendData(name);
+
+ // invalid data from model, same name can be used
+ VideoListDataModel::mReturnInvalid = true;
+ resolved = mTestObject->resolveAlbumName(name);
+ QVERIFY(resolved.length());
+ QVERIFY(resolved == name);
+ VideoListDataModel::mReturnInvalid = false;
+
+ // same name, name to be different
+ resolved = mTestObject->resolveAlbumName(name);
+ QVERIFY(resolved.length());
+ QVERIFY(resolved != name);
+ QVERIFY(resolved.contains("1"));
+
+ // different name, no changes
+ name = "Another";
+ resolved = mTestObject->resolveAlbumName(name);
+ QVERIFY(resolved == name);
+
+}
+
+// ---------------------------------------------------------------------------
+// testResolveAlbumName
+// ---------------------------------------------------------------------------
+//
+void TestVideoSortFilterProxyModel::testAddItemsInAlbum()
+{
+ TMPXItemId albumId(1,2);
+ QList<TMPXItemId> items;
+ items.append(TMPXItemId(1,0));
+ // no collection client
+ QVERIFY(mTestObject->addItemsInAlbum(albumId, items) == -1);
+
+ mTestObject->initialize(mStubModel);
+
+ QVERIFY(mTestObject->addItemsInAlbum(albumId, items) == 0);
+}
+
+// ---------------------------------------------------------------------------
+// testGetOpenItem
+// ---------------------------------------------------------------------------
+//
+void TestVideoSortFilterProxyModel::testGetOpenItem()
+{
+ // no collection client
+ QVERIFY(mTestObject->getOpenItem() == TMPXItemId::InvalidId());
+
+ mTestObject->initialize(mStubModel);
+
+ // type neither EAllVideos or ECollectionContent
+ QVERIFY(mTestObject->getOpenItem() == TMPXItemId::InvalidId());
+
+ TMPXItemId id;
+ // type EAllVideos
+ delete mTestObject;
+ mTestObject = new FilterProxyTester(VideoCollectionWrapper::EAllVideos);
+ mTestObject->initialize(mStubModel);
+ id = mTestObject->getOpenItem();
+ QVERIFY(id != TMPXItemId::InvalidId());
+ QVERIFY(id.iId1 == KVcxMvcCategoryIdAll);
+ QVERIFY(id.iId2 == KVcxMvcMediaTypeCategory);
+
+ // type ECollectionContent
+ delete mTestObject;
+ mTestObject = new FilterProxyTester(VideoCollectionWrapper::ECollectionContent);
+ mTestObject->initialize(mStubModel);
+ id.iId1 = 1;
+ id.iId2 = KVcxMvcMediaTypeAlbum;
+ mTestObject->openItem(id);
+ id = TMPXItemId::InvalidId();
+ id = mTestObject->getOpenItem();
+ QVERIFY(id != TMPXItemId::InvalidId());
+ QVERIFY(id.iId1 == 1);
+ QVERIFY(id.iId2 == KVcxMvcMediaTypeAlbum);
+
}
// ---------------------------------------------------------------------------
-// testAddNewCollectionFail
+// testRemoveAlbums
// ---------------------------------------------------------------------------
//
-void TestVideoSortFilterProxyModel::testAddNewCollectionFail()
+void TestVideoSortFilterProxyModel::testRemoveAlbums()
{
- QString name("testname");
- QString thumb("testthumb");
- QList<TMPXItemId> ids;
- ids.append(TMPXItemId(5,0));
- ids.append(TMPXItemId(9,0));
+ QModelIndexList indexList;
+ // no collection
+ QVERIFY(mTestObject->removeAlbums(indexList) == -1);
mTestObject->initialize(mStubModel);
+ QVERIFY(mTestObject->open(VideoCollectionCommon::ELevelVideos) == 0);
- VideoCollectionClient::mFailAddNewCollection = true;
+ // empty list provided
+ QVERIFY(mTestObject->removeAlbums(indexList) == -1);
+
+ mStubModel->appendData(TMPXItemId(1,0));
+ mStubModel->appendData(TMPXItemId(2,0));
+ mStubModel->appendData(TMPXItemId(3,0));
- QCOMPARE(mTestObject->addNewCollection(name, thumb, ids), -1);
+ indexList.append(mTestObject->index(0,0));
+ indexList.append(mTestObject->index(1,0));
+ indexList.append(mTestObject->index(2,0));
+
+ // no albums in model
+ QVERIFY(mTestObject->removeAlbums(indexList) == -1);
- // this makes sure that the collection client has been called.
- QCOMPARE(VideoCollectionClient::mAddNewCollectionName, name);
- QCOMPARE(VideoCollectionClient::mAddNewCollectionThumb, thumb);
- QCOMPARE(VideoCollectionClient::mAddNewCollectionIds, ids);
+ mStubModel->removeAll();
+ delete mTestObject;
+ mTestObject = new FilterProxyTester(VideoCollectionWrapper::ECollections);
+ QVERIFY(mTestObject);
+ QVERIFY(mTestObject->initialize(mStubModel) == 0);
+ QVERIFY(mTestObject->open(VideoCollectionCommon::ELevelCategory) == 0);
+ mStubModel->appendData(TMPXItemId(1,2));
+ mStubModel->appendData(TMPXItemId(2,2));
+ mStubModel->appendData(TMPXItemId(3,2));
+ indexList.append(mTestObject->index(0,2));
+ indexList.append(mTestObject->index(1,2));
+ indexList.append(mTestObject->index(2,2));
+
+ // succeed
+ QVERIFY(mTestObject->removeAlbums(indexList) == 0);
+}
+
+// ---------------------------------------------------------------------------
+// testAlbumChangedSlot
+// ---------------------------------------------------------------------------
+//
+void TestVideoSortFilterProxyModel::testAlbumChangedSlot()
+{
+ // cannot test anything here, just for the coverage
+ // level incorrect
+ mTestObject->initialize(mStubModel);
+ mStubModel->emitAlbumChanged();
+ delete mTestObject;
+ mTestObject = 0;
+ mTestObject = new FilterProxyTester(VideoCollectionWrapper::ECollectionContent);
+ QVERIFY(mTestObject);
+ mTestObject->initialize(mStubModel);
+ mStubModel->emitAlbumChanged();
}
// ---------------------------------------------------------------------------
-// testShortDetailsReadySlot
+// testIndexOfId
// ---------------------------------------------------------------------------
//
-int TestVideoSortFilterProxyModel::testShortDetailsReadySlot(int index)
+void TestVideoSortFilterProxyModel::testIndexOfId()
{
- return 1;
+ QModelIndex index;
+ // no model
+ TMPXItemId id(1,0);
+ index = mTestObject->indexOfId(id);
+ QVERIFY(!index.isValid());
+
+ mTestObject->initialize(mStubModel);
+ mTestObject->open(VideoCollectionCommon::ELevelVideos);
+
+ // fetching invalid
+ id = TMPXItemId::InvalidId();
+ index = mTestObject->indexOfId(id);
+ QVERIFY(!index.isValid());
+
+ mStubModel->appendData(TMPXItemId(1,0));
+ mStubModel->appendData(TMPXItemId(2,0));
+ mStubModel->appendData(TMPXItemId(3,0));
+
+ id = TMPXItemId(2,0);
+ index = mTestObject->indexOfId(id);
+ QVERIFY(index.isValid());
+ QVERIFY(index.row() == 1);
+}
+
+// ---------------------------------------------------------------------------
+// testSetGenericIdFilter
+// ---------------------------------------------------------------------------
+//
+void TestVideoSortFilterProxyModel::testSetGenericIdFilter()
+{
+ // type VideoCollectionWrapper::EGeneric
+ mTestObject->initialize(mStubModel);
+ mTestObject->open(VideoCollectionCommon::ELevelVideos);
+ mTestObject->setGenericIdFilter(TMPXItemId(0,1), true);
+
+ mStubModel->appendData(TMPXItemId(1,0));
+ mStubModel->appendData(TMPXItemId(2,0));
+ mStubModel->appendData(TMPXItemId(3,0));
+ mTestObject->invalidate();
+ QModelIndex index;
+ index = mTestObject->indexOfId(TMPXItemId(1,0));
+ QVERIFY(index.isValid());
+ QVERIFY(index.row() == 0);
+
+ // other type
+ delete mTestObject;
+ mTestObject = new FilterProxyTester(VideoCollectionWrapper::EAllVideos);
+ mTestObject->initialize(mStubModel);
+ mTestObject->open(VideoCollectionCommon::ELevelVideos);
+
+ mTestObject->setGenericIdFilter(TMPXItemId(1,1), true);
+ mTestObject->invalidate();
+ index = mTestObject->indexOfId(TMPXItemId(1,0));
+ QVERIFY(index.isValid());
+ QVERIFY(index.row() == 0);
+
}
--- a/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/stub/inc/filterproxytester.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/stub/inc/filterproxytester.h Thu Apr 01 23:22:15 2010 +0300
@@ -23,6 +23,7 @@
#include "videosortfilterproxymodel.h"
+class VideoListDataModel;
class FilterProxyTester : public VideoSortFilterProxyModel
{
@@ -35,7 +36,7 @@
* Constructor
*
*/
- FilterProxyTester(QObject *parent=0);
+ FilterProxyTester(int type, QObject *parent=0);
/**
* destructor
--- a/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/stub/inc/videocollectionclient.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/stub/inc/videocollectionclient.h Thu Apr 01 23:22:15 2010 +0300
@@ -49,8 +49,8 @@
/**
*
- * if gFailInit is true returns -1
- * if gFailInit is false returns 0
+ * if mFailInit is true returns -1
+ * if mFailInit is false returns 0
*
* @return int
*/
@@ -58,8 +58,8 @@
/**
*
- * if gFailStartOpen is true returns -1
- * if gFailStartOpen is false returns 0
+ * if mFailStartOpen is true returns -1
+ * if mFailStartOpen is false returns 0
*
* @return int
*/
@@ -67,69 +67,41 @@
/**
*
- * if gFailMediaPlayback is true returns -1
- * if gFailMediaPlayback is false returns 0
+ * if mFailMediaPlayback is true returns -1
+ * if mFailMediaPlayback is false returns 0
*
* @return int
*/
- int openVideo(int mpxId1);
-
+ int openItem(int mpxId1);
+
/**
*
- * if gFailMediaDetails is true returns -1
- * if gFailMediaDetails is false returns 0
+ * if mFailMediaDetails is true returns -1
+ * if mFailMediaDetails is false returns 0
*
* @return int
*/
int getVideoDetails(int mpxId1);
/**
- * @return int
- */
- int addNewCollection(QString name, QString thumbnail, QList<TMPXItemId> mediaIds);
-
- /**
- * sets gFailInit
- *
- * @param bool
+ * @return mNewAlbumId
*/
- static void setInitFailure(bool fails);
-
- /**
- * sets gFailStartOpen
- *
- * @param bool
- */
- static void setStartopenFailure(bool fails);
-
-
+ TMPXItemId addNewAlbum(QString name);
+
/**
- * sets gFailMediaPlayback
- *
- * @param bool
+ * no funtionality needed here for unit tests
*/
- static void setOpenMediaplaybackFailure(bool fails);
-
+ int addItemsInAlbum(TMPXItemId albumId, QList<TMPXItemId> items);
+
/**
- * sets gFailMediaDetails
- *
- * @param bool
+ * no funtionality needed here for unit tests
*/
- static void setOpenMediaDetailsFailure(bool fails);
-
+ int removeAlbums(const QList<TMPXItemId> &items);
+
/**
- * sets gFailSetSort
- *
- * @param bool
+ * saves contant id (1,2) into provided id
*/
- static void setSortMediasFailure(bool fails);
-
- /**
- * returns gSettedSortOrder
- *
- * @return TVcxMyVideosSortingOrder
- */
- static TVcxMyVideosSortingOrder getSettedSortOrder();
+ void getCategoryId(TMPXItemId &id);
/**
* calls collection to go back to collection level
@@ -144,6 +116,7 @@
static bool mFailMediaDetails;
static bool mFailSetSort;
static bool mFailAddNewCollection;
+ static TMPXItemId mNewAlbumId;
static TVcxMyVideosSortingOrder mSettedSortOrder;
static int mSortOrderSetCount;
static QString mAddNewCollectionName;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/stub/inc/videocollectionwrapper.h Thu Apr 01 23:22:15 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: Stub videocollectionwrapper class for videosortfilterproxymodel unit tests
+*
+*/
+
+#ifndef __VIDEOCOLLECTIONWRAPPER_H__
+#define __VIDEOCOLLECTIONWRAPPER_H__
+
+#include "videosortfilterproxymodel.h"
+
+
+class VideoCollectionWrapper
+{
+
+public:
+
+ enum TModelType
+ {
+ EAllVideos,
+ ECollections,
+ ECollectionContent,
+ EGeneric
+ };
+
+ static VideoCollectionWrapper &instance()
+ {
+ static VideoCollectionWrapper _staticWrapper;
+ return _staticWrapper;
+ }
+
+ /**
+ * constructor
+ */
+ VideoCollectionWrapper() :
+ mProxyModel(0)
+ {
+ }
+
+ /**
+ * returns mProxyModel
+ */
+ VideoSortFilterProxyModel* getModel(int type)
+ {
+ return mProxyModel;
+ }
+
+ VideoSortFilterProxyModel* mProxyModel;
+};
+#endif // __VIDEOCOLLECTIONWRAPPER_H__
--- a/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/stub/inc/videolistdatamodel.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/stub/inc/videolistdatamodel.h Thu Apr 01 23:22:15 2010 +0300
@@ -24,6 +24,7 @@
#include <QString>
#include <qabstractitemmodel.h>
#include <qdatetime.h>
+#include <mpxitemid.h>
#include "videocollectioncommon.h"
// CVideoListDataModel::Data returns valid variant when used this and name exists for the row.
@@ -61,16 +62,16 @@
*
* @return int: 0 if everything ok
*/
- int initialize( VideoCollectionClient* collection);
+ int initialize();
/**
* Method calls video list data to check if there are valid media object
* at the given index. If there is, item id is returned.
*
* @param index index of the item to be opened
- * @return int item id ( > 0), < 0 if no valid item.
+ * @return TMPXItemId item id ( > 0), < 0 if no valid item.
*/
- int mediaIdAtIndex(int index) const;
+ TMPXItemId mediaIdAtIndex(int index) const;
/**
* Method calls video list data to check if there are valid media object
@@ -91,6 +92,31 @@
* @return bool true if removal startup succeeds
*/
bool removeRows(const QModelIndexList &indexList);
+
+ /**
+ * sets mAlbumInUse
+ */
+ void setAlbumInUse(TMPXItemId itemId);
+
+ /**
+ * returns mAlbumInUse
+ */
+ TMPXItemId albumInUse();
+
+ /**
+ * returns mBelongsToAlbum
+ */
+ bool belongsToAlbum(TMPXItemId itemId, TMPXItemId albumId = TMPXItemId::InvalidId());
+
+ /**
+ * returns index of first occurence of provided id
+ */
+ QModelIndex indexOfId(TMPXItemId id);
+
+ /**
+ * returns collection client
+ */
+ VideoCollectionClient* getCollectionClient();
public: // from QAbstractItemModel
@@ -154,37 +180,46 @@
public: // helper methods for test
+
+ /**
+ * emit album changed signal
+ */
+ void emitAlbumChanged();
/**
- * sets given value tomRowCount
- *
- * @param count - value to set
+ * clears mData
*/
- void setUsedRowCount(int count);
+ void removeAll();
+
/**
- * appends given string to mNames
+ * adds provided id to mData
+ */
+ void appendData(TMPXItemId data);
+
+ /**
+ * appends given string to mData
*
* @param data - value to append to list
*/
void appendData(QString data);
/**
- * appends given uint to mSizes
+ * appends given uint to mData
*
* @param data - value to append to list
*/
void appendData(uint data);
/**
- * appends given QDate to mDates
+ * appends given QDate to mData
*
* @param data - value to append to list
*/
void appendData(QDateTime data);
/**
- * Appends given status to mStatuses.
+ * Appends given status to mData.
*
* @param status - value to append to list.
*/
@@ -196,52 +231,72 @@
* This signal is connected to video list's details ready
* -signal indicating that video details data is fetched ok
*
- * @param index index of the video item
+ * @param id of the item
*/
- void fullVideoDetailsReady(int index);
+ void fullVideoDetailsReady(TMPXItemId);
/**
* Signals that the model is ready, ie. loaded all data from
* myvideocollection.
*/
void modelReady();
+
+ /**
+ * signals when model's internal data has changed
+ */
+ void modelChanged();
+
+ /**
+ * signals when album data has changed
+ */
+ void albumChanged();
public:
static bool mInitFails;
+
static bool mRemoveRowsFails;
- static bool mGetMediaIdAtIndexFails;
+
+ static bool mGetMediaIdAtIndexFails;
+
+ static bool mBelongsToAlbum;
+
+ static bool mReturnInvalid;
+
static QString mMediaFilePathReturnValue;
static int mLastDeletedIndexRow;
+ TMPXItemId mAlbumInUse;
+
private:
-
- /**
- * Setted count of rows. Not necessary match the actual count.
- */
- int mRowCount;
+
+ class DummyData
+ {
+ public:
+ DummyData() :
+ mId(TMPXItemId::InvalidId()),
+ mName(""),
+ mSize(666),
+ mDate(QDateTime()),
+ mStatus(-1)
+ {}
+ TMPXItemId mId;
+ QString mName;
+ uint mSize;
+ QDateTime mDate;
+ int mStatus;
+ };
/**
* List of strings when fetching Qt::DisplayRole
*/
- QList<QString> mNames;
-
- /**
- * List of uints when fetching VideoCollectionCommon::KeySizeValue
- */
- QList<uint> mSizes;
-
+ QList<DummyData*> mData;
+
/**
- * List of QDates when fetching VideoCollectionCommon::KeyDate
- */
- QList<QDateTime> mDates;
-
- /**
- * List of statuses when fetching VideoCollectionCommon::KeyStatus
- */
- QList<int> mStatuses;
-
+ * colleciton client object, owned
+ */
+ VideoCollectionClient *mCollectionClient;
};
#endif // __STUB_VIDEOLISTDATAMODELFORPROXY_H
--- a/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/stub/inc/videothumbnaildata.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/stub/inc/videothumbnaildata.h Thu Apr 01 23:22:15 2010 +0300
@@ -18,13 +18,14 @@
#define __VIDEOTHUMBNAILDATA_H__
// INCLUDES
-#include <QObject>
-#include <QHash>
-#include <QPair>
-#include <QIcon>
-#include <QSet>
+#include <qobject.h>
+#include <qhash.h>
+#include <qpair.h>
+#include <qicon.h>
+#include <qset.h>
// FORWARD DECLARATIONS
+class VideoSortFilterProxyModel;
class VideoThumbnailData : public QObject
{
@@ -60,27 +61,12 @@
static VideoThumbnailData &instance();
/**
- * Starts fetching thumbnails for medias in the model defined by the indexes parameter.
- * Priority for the thumbnails is ascending starting from the defined priority. Uses method
- * startFetchingThumbnail for the actual fetching.
- *
- * Clears all other thumbnail fetches.
- *
- * param @indexes indexes of the medias in the model
- * param @priority starting priority for the thumbnails
- * param @setFetchIndex whether index for background thumbnail fetcing is set
- *
- * @return int count of fetches started or -1 in case of error.
- */
- int startFetchingThumbnails(const QList<int> &indexes, VideoThumbnailPriority priority, bool setFetchIndex = true);
-
- /**
* Starts background thumbnail fetching.
*
* @param fetchIndex index where to start the background thumbnail fetching.
*
*/
- void startBackgroundFetching(int fetchIndex);
+ void startBackgroundFetching(VideoSortFilterProxyModel *model, int fetchIndex);
/**
* Enables or disables thumbnail background fetching. Default is enabled.
--- a/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/stub/src/filterproxytester.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/stub/src/filterproxytester.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -17,18 +17,22 @@
*/
// INCLUDES
+
+
+
#define private public
#include "videosortfilterproxymodel.h"
#undef private
#include "filterproxytester.h"
+#include "videolistdatamodel.h"
// ---------------------------------------------------------------------------
// FilterProxyTester
// ---------------------------------------------------------------------------
//
-FilterProxyTester::FilterProxyTester(QObject *parent) :
-VideoSortFilterProxyModel(parent)
+FilterProxyTester::FilterProxyTester(int type, QObject *parent) :
+VideoSortFilterProxyModel(type, parent)
{
// NOP
}
--- a/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/stub/src/videocollectionclient.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/stub/src/videocollectionclient.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -28,6 +28,7 @@
bool VideoCollectionClient::mFailMediaDetails = false;
bool VideoCollectionClient::mFailSetSort = false;
bool VideoCollectionClient::mFailAddNewCollection = false;
+TMPXItemId VideoCollectionClient::mNewAlbumId = TMPXItemId::InvalidId();
TVcxMyVideosSortingOrder VideoCollectionClient::mSettedSortOrder = EVcxMyVideosSortingNone;
int VideoCollectionClient::mSortOrderSetCount = 0;
QString VideoCollectionClient::mAddNewCollectionName = QString();
@@ -70,6 +71,7 @@
//
int VideoCollectionClient::startOpenCollection(int level)
{
+ Q_UNUSED(level);
if(mFailStartOpen)
{
return -1;
@@ -78,10 +80,10 @@
}
// -----------------------------------------------------------------------------
-// openVideo
+// openItem
// -----------------------------------------------------------------------------
//
-int VideoCollectionClient::openVideo(int /*mpxId1*/)
+int VideoCollectionClient::openItem(int /*mpxId1*/)
{
if(mFailMediaPlayback)
{
@@ -91,6 +93,37 @@
}
// -----------------------------------------------------------------------------
+// addNewAlbum
+// -----------------------------------------------------------------------------
+//
+TMPXItemId VideoCollectionClient::addNewAlbum(QString title)
+{
+ mAddNewCollectionName = title;
+ return mNewAlbumId;
+}
+
+// -----------------------------------------------------------------------------
+// addItemsInAlbum
+// -----------------------------------------------------------------------------
+//
+int VideoCollectionClient::addItemsInAlbum(TMPXItemId albumId, QList<TMPXItemId> items)
+{
+ Q_UNUSED(albumId);
+ Q_UNUSED(items);
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// revoveAlbums
+// -----------------------------------------------------------------------------
+//
+int VideoCollectionClient::removeAlbums(const QList<TMPXItemId> &items)
+{
+ Q_UNUSED(items);
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
// deleteFile
// -----------------------------------------------------------------------------
//
@@ -104,20 +137,14 @@
}
// -----------------------------------------------------------------------------
-// addNewCollection
+// getCategoryId
// -----------------------------------------------------------------------------
//
-int VideoCollectionClient::addNewCollection(QString name, QString thumbnail, QList<TMPXItemId> mediaIds)
+void VideoCollectionClient::getCategoryId(TMPXItemId &id)
{
- mAddNewCollectionName = name;
- mAddNewCollectionThumb = thumbnail;
- mAddNewCollectionIds = mediaIds;
- if(mFailAddNewCollection) {
- return -1;
- }
- return 0;
+ id.iId1 = 1;
+ id.iId2 = 2;
}
-
// -----------------------------------------------------------------------------
// back
// -----------------------------------------------------------------------------
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/stub/src/videolistdatamodel.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,465 @@
+/**
+* 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 videocollectionsortfilterproxy
+*
+*/
+
+
+// INCLUDES
+#include "videocollectionclient.h"
+#include "videolistdatamodel.h"
+
+bool VideoListDataModel::mInitFails = false;
+bool VideoListDataModel::mRemoveRowsFails = false;
+bool VideoListDataModel::mGetMediaIdAtIndexFails = false;
+bool VideoListDataModel::mBelongsToAlbum = false;
+bool VideoListDataModel::mReturnInvalid = false;
+int VideoListDataModel::mLastDeletedIndexRow = -1;
+QString VideoListDataModel::mMediaFilePathReturnValue = "";
+
+// ---------------------------------------------------------------------------
+// VideoListDataModel
+// ---------------------------------------------------------------------------
+//
+VideoListDataModel::VideoListDataModel(QObject *parent) :
+QAbstractItemModel(parent),
+ mCollectionClient(0)
+{
+
+}
+
+// ---------------------------------------------------------------------------
+// ~VideoListDataModel
+// ---------------------------------------------------------------------------
+//
+VideoListDataModel::~VideoListDataModel()
+{
+ removeAll();
+
+ delete mCollectionClient;
+}
+
+// -----------------------------------------------------------------------------
+// initialize
+// -----------------------------------------------------------------------------
+//
+int VideoListDataModel::initialize()
+{
+ if(mInitFails)
+ {
+ return -1;
+ }
+ return 0;
+}
+
+// ---------------------------------------------------------------------------
+// mediaIdAtIndex
+// ---------------------------------------------------------------------------
+//
+TMPXItemId VideoListDataModel::mediaIdAtIndex(int index) const
+{
+ TMPXItemId id = TMPXItemId::InvalidId();
+ if( mGetMediaIdAtIndexFails || index < 0 || index >= mData.count())
+ {
+ return id;
+ }
+
+ id = mData.at(index)->mId;
+
+ return id;
+}
+
+// ---------------------------------------------------------------------------
+// mediaFilePathForId
+// ---------------------------------------------------------------------------
+//
+QString VideoListDataModel::mediaFilePathForId(int mediaId) const
+{
+ Q_UNUSED(mediaId);
+ return mMediaFilePathReturnValue;
+}
+
+// ---------------------------------------------------------------------------
+// removeRows
+// ---------------------------------------------------------------------------
+//
+bool VideoListDataModel::removeRows(const QModelIndexList &indexList)
+{
+ mLastDeletedIndexRow = -1;
+ if( mRemoveRowsFails )
+ return false;
+ else
+ {
+ if(indexList.count() > 0)
+ {
+ mLastDeletedIndexRow = indexList.at(indexList.count() - 1).row();
+ }
+ QModelIndexList sortable(indexList);
+ qSort(sortable);
+ QModelIndexList::const_iterator iter = sortable.constEnd();
+ QModelIndex index;
+ while(iter != sortable.constBegin())
+ {
+ iter--;
+ index = (*iter);
+ beginRemoveRows(QModelIndex(), index.row(), index.row());
+
+ delete mData.at(index.row());
+ mData.removeAt(index.row());
+
+ endRemoveRows();
+ }
+
+ return true;
+ }
+}
+
+// ---------------------------------------------------------------------------
+// getCollectionClient
+// ---------------------------------------------------------------------------
+//
+VideoCollectionClient* VideoListDataModel::getCollectionClient()
+{
+ if(!this->mCollectionClient)
+ {
+ mCollectionClient = new VideoCollectionClient();
+ }
+ return mCollectionClient;
+}
+
+// ---------------------------------------------------------------------------
+// rowCount
+// ---------------------------------------------------------------------------
+//
+int VideoListDataModel::rowCount(const QModelIndex &parent) const
+{
+ if (parent.isValid())
+ {
+ return 0;
+ }
+ return mData.count();
+}
+
+// ---------------------------------------------------------------------------
+// itemData
+// ---------------------------------------------------------------------------
+//
+QMap<int, QVariant> VideoListDataModel::itemData(const QModelIndex &index) const
+{
+ Q_UNUSED(index);
+ QMap<int, QVariant> itemData;
+
+ return itemData;
+}
+
+// ---------------------------------------------------------------------------
+// data
+// ---------------------------------------------------------------------------
+//
+QVariant VideoListDataModel::data(const QModelIndex & index, int role) const
+{
+ QVariant returnValue = QVariant();
+ if(!index.isValid())
+ {
+ return returnValue;
+ }
+ if(mReturnInvalid)
+ {
+ return returnValue;
+ }
+ int row = index.row();
+ if(role == Qt::DisplayRole)
+ {
+ if(row >= 0 && row < mData.count())
+ {
+ returnValue = mData.at(row)->mName;
+ }
+ }
+ else if(role == VideoCollectionCommon::KeySizeValue)
+ {
+ if(row >= 0 && row < mData.count())
+ {
+ returnValue = mData.at(row)->mSize;
+ }
+ }
+ else if(role == VideoCollectionCommon::KeyDateTime)
+ {
+ if(row >= 0 && row < mData.count())
+ {
+ returnValue = mData.at(row)->mDate;
+ }
+ }
+ else if(role == VideoCollectionCommon::KeyStatus)
+ {
+ if(row >= 0 && row < mData.count())
+ {
+ returnValue = mData.at(row)->mStatus;
+ }
+ }
+ else if(role == INVALID_ROLE_FOR_SORTING)
+ {
+ if(row >= 0 && row < mData.count())
+ {
+ returnValue = mData.at(row)->mName;
+ }
+ }
+ return returnValue;
+}
+
+// ---------------------------------------------------------------------------
+// columnCount
+// ---------------------------------------------------------------------------
+//
+int VideoListDataModel::columnCount(const QModelIndex & parent) const
+{
+ if (parent.isValid())
+ {
+ return 0;
+ }
+ else
+ {
+ return 1;
+ }
+}
+
+// ---------------------------------------------------------------------------
+// index
+// ---------------------------------------------------------------------------
+//
+QModelIndex VideoListDataModel::index(int row, int column, const QModelIndex & parent) const
+{
+ Q_UNUSED(parent);
+ if(row >= 0 && row < mData.count())
+ {
+ return createIndex(row, column);
+ }
+ return QModelIndex();
+}
+
+// ---------------------------------------------------------------------------
+// parent
+// ---------------------------------------------------------------------------
+//
+QModelIndex VideoListDataModel::parent(const QModelIndex & index) const
+{
+ Q_UNUSED(index);
+ return QModelIndex();
+}
+
+void VideoListDataModel::removeAll()
+{
+ beginRemoveRows(QModelIndex(), 0,0);
+ QList<DummyData*>::iterator iter = mData.begin();
+ while(iter != mData.end())
+ {
+ delete *iter;
+ ++iter;
+ }
+ mData.clear();
+ endRemoveRows();
+}
+
+
+// ---------------------------------------------------------------------------
+// emitAlbumChanged
+// ---------------------------------------------------------------------------
+//
+void VideoListDataModel::emitAlbumChanged()
+{
+ emit albumChanged();
+}
+
+// ---------------------------------------------------------------------------
+// appendData
+// ---------------------------------------------------------------------------
+//
+void VideoListDataModel::appendData(TMPXItemId data)
+{
+ DummyData* obj;
+ for(int i = 0; i < mData.count(); ++i)
+ {
+ obj = mData.at(i);
+ if(obj->mId == TMPXItemId::InvalidId() || obj->mId.iId1 == data.iId1)
+ {
+ obj->mId = data;
+ QModelIndex change = index(i,0);
+ emit dataChanged(change, change);
+ return;
+ }
+ }
+ beginInsertRows(QModelIndex(), mData.count(), mData.count());
+ obj = new DummyData;
+ obj->mId = data;
+ mData.append(obj);
+ endInsertRows();
+}
+
+
+// ---------------------------------------------------------------------------
+// appendData
+// ---------------------------------------------------------------------------
+//
+void VideoListDataModel::appendData(QString data)
+{
+ DummyData* obj;
+ for(int i = 0; i < mData.count(); ++i)
+ {
+ obj = mData.at(i);
+ if(!obj->mName.length())
+ {
+ obj->mName = data;
+ QModelIndex change = index(i,0);
+ emit dataChanged(change, change);
+ return;
+ }
+ }
+ beginInsertRows(QModelIndex(), mData.count(), mData.count());
+ obj = new DummyData;
+ obj->mId = TMPXItemId( mData.count(), 0);
+ obj->mName = data;
+ mData.append(obj);
+ endInsertRows();
+}
+
+// ---------------------------------------------------------------------------
+// appendData
+// ---------------------------------------------------------------------------
+//
+void VideoListDataModel::appendData(uint data)
+{
+ DummyData* obj;
+ for(int i = 0; i < mData.count(); ++i)
+ {
+ obj = mData.at(i);
+ if(obj->mSize == 666)
+ {
+ obj->mSize = data;
+ QModelIndex change = index(i,0);
+ emit dataChanged(change, change);
+ return;
+ }
+ }
+ beginInsertRows(QModelIndex(), mData.count(), mData.count());
+ obj = new DummyData;
+ obj->mId = TMPXItemId( mData.count(), 0);
+ obj->mSize = data;
+ mData.append(obj);
+ endInsertRows();
+}
+
+// ---------------------------------------------------------------------------
+// appendData
+// ---------------------------------------------------------------------------
+//
+void VideoListDataModel::appendData(QDateTime data)
+{
+ DummyData* obj;
+ for(int i = 0; i < mData.count(); ++i)
+ {
+ obj = mData.at(i);
+ if(!obj->mDate.isValid())
+ {
+ obj->mDate = data;
+ QModelIndex change = index(i,0);
+ emit dataChanged(change, change);
+ return;
+ }
+ }
+ beginInsertRows(QModelIndex(), mData.count(), mData.count());
+ obj = new DummyData;
+ obj->mId = TMPXItemId( mData.count(), 0);
+ obj->mDate = data;
+ mData.append(obj);
+ endInsertRows();
+}
+
+// ---------------------------------------------------------------------------
+// appendStatus
+// ---------------------------------------------------------------------------
+//
+void VideoListDataModel::appendStatus(int status)
+{
+ DummyData* obj;
+ for(int i = 0; i < mData.count(); ++i)
+ {
+ obj = mData.at(i);
+ if(obj->mStatus == -1)
+ {
+ obj->mStatus = status;
+ QModelIndex change = index(i,0);
+ emit dataChanged(change, change);
+ return;
+ }
+ }
+ beginInsertRows(QModelIndex(), mData.count(), mData.count());
+ obj = new DummyData;
+ obj->mId = TMPXItemId( mData.count(), 0);
+ obj->mStatus = status;
+ mData.append(obj);
+ endInsertRows();
+}
+
+// ---------------------------------------------------------------------------
+// setAlbumInUse
+// ---------------------------------------------------------------------------
+//
+void VideoListDataModel::setAlbumInUse(TMPXItemId itemId)
+{
+ mAlbumInUse = itemId;
+}
+
+// ---------------------------------------------------------------------------
+// albumInUse
+// ---------------------------------------------------------------------------
+//
+TMPXItemId VideoListDataModel::albumInUse()
+{
+ return mAlbumInUse;
+}
+
+// ---------------------------------------------------------------------------
+// belongsToAlbum
+// ---------------------------------------------------------------------------
+//
+bool VideoListDataModel::belongsToAlbum(TMPXItemId itemId, TMPXItemId albumId )
+{
+ Q_UNUSED(itemId);
+ Q_UNUSED(albumId);
+ return mBelongsToAlbum;
+}
+
+// ---------------------------------------------------------------------------
+// indexOfId
+// ---------------------------------------------------------------------------
+//
+QModelIndex VideoListDataModel::indexOfId(TMPXItemId id)
+{
+ QModelIndex itemIndex;
+ DummyData* obj;
+ for(int i = 0; i < mData.count(); ++i)
+ {
+ obj = mData.at(i);
+ if(obj->mId == id)
+ {
+ itemIndex = index(i,0,QModelIndex());
+ break;
+ }
+ }
+ return itemIndex;
+}
+
+// End of file
+
+
+
--- a/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/stub/src/videothumbnaildata.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/stub/src/videothumbnaildata.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -16,9 +16,9 @@
*/
// INCLUDE FILES
-#include <QDebug>
-#include <QPixmap>
-#include <QTimer>
+#include <qdebug.h>
+#include <qpixmap.h>
+#include <qtimer.h>
#include <mpxmediageneraldefs.h>
#include <thumbnailmanager_qt.h>
@@ -61,22 +61,13 @@
}
// -----------------------------------------------------------------------------
-// VideoThumbnailData::startFetchingThumbnails()
-// -----------------------------------------------------------------------------
-//
-int VideoThumbnailData::startFetchingThumbnails(const QList<int> &indexes, VideoThumbnailPriority /* priority */, bool /*setFetchIndex*/)
-{
- mStartFetchingThumbnailsCallCount++;
- mStartFetchingThumbnailsThumbnailCount += indexes.count();
- return 0;
-}
-
-// -----------------------------------------------------------------------------
// VideoThumbnailData::startBackgroundFetching()
// -----------------------------------------------------------------------------
//
-void VideoThumbnailData::startBackgroundFetching(int fetchIndex)
+void VideoThumbnailData::startBackgroundFetching(VideoSortFilterProxyModel *model, int fetchIndex)
{
+ Q_UNUSED(model);
+ Q_UNUSED(fetchIndex);
mStartBackgroundFetchingCallCount++;
}
--- a/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/testvideosortfilterproxymodel.pro Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/testvideosortfilterproxymodel.pro Thu Apr 01 23:22:15 2010 +0300
@@ -31,6 +31,7 @@
stub/inc/videolistdatamodel.h \
stub/inc/videocollectionclient.h \
stub/inc/videothumbnaildata.h \
+ stub/inc/videocollectionwrapper.h \
../../inc/videosortfilterproxymodel.h \
../../../inc/videocollectionexport.h
--- a/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata/inc/testvideothumbnaildata.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata/inc/testvideothumbnaildata.h Thu Apr 01 23:22:15 2010 +0300
@@ -36,12 +36,12 @@
// test functions for the test framework
private slots:
void testInstance();
- void testStartFetchingThumbnail();
void testRemoveThumbnail();
void testGetThumbnail();
void testEnableBackgroundFetching();
void testFreeThumbnailData();
void testStartBackgroundFetching();
+ void testEnableThumbnailCreation();
signals:
--- a/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata/src/testvideothumbnaildata.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata/src/testvideothumbnaildata.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -47,12 +47,19 @@
TestVideoThumbnailData tv;
- char *pass[3];
- pass[0] = argv[0];
- pass[1] = "-o";
- pass[2] = "c:\\data\\TestVideoThumbnailData.txt";
-
- int res = QTest::qExec(&tv, 3, pass);
+ 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\\TestVideoThumbnailData.txt";
+ res = QTest::qExec(&tv, 3, pass);
+ }
return res;
}
@@ -82,19 +89,6 @@
QCOMPARE(VideoThumbnailDataPrivate::mConstructCallCount, 1);
}
-
-// ---------------------------------------------------------------------------
-// testStartFetchingThumbnail
-// ---------------------------------------------------------------------------
-//
-void TestVideoThumbnailData::testStartFetchingThumbnail()
-{
- VideoThumbnailData &instance = VideoThumbnailData::instance();
- QCOMPARE(VideoThumbnailDataPrivate::mConstructCallCount, 1);
- QVERIFY(instance.startFetchingThumbnail(0, 0) == 0);
- QCOMPARE(VideoThumbnailDataPrivate::mStartFetchingThumbnailCallCount, 1);
-}
-
// ---------------------------------------------------------------------------
// testRemoveThumbnail
// ---------------------------------------------------------------------------
@@ -153,8 +147,20 @@
{
VideoThumbnailData &instance = VideoThumbnailData::instance();
QCOMPARE(VideoThumbnailDataPrivate::mConstructCallCount, 1);
- instance.startBackgroundFetching(0);
+ instance.startBackgroundFetching(0, 0);
QCOMPARE(VideoThumbnailDataPrivate::mStartBackgroundFetchingCallCount, 1);
}
+// ---------------------------------------------------------------------------
+// testEnableThumbnailCreation
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailData::testEnableThumbnailCreation()
+{
+ VideoThumbnailData &instance = VideoThumbnailData::instance();
+ QCOMPARE(VideoThumbnailDataPrivate::mConstructCallCount, 1);
+ instance.enableThumbnailCreation(true);
+ QCOMPARE(VideoThumbnailDataPrivate::mEnableThumbnailCreationCallCount, 1);
+}
+
// End of file
--- a/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata/stub/inc/videothumbnaildata_p.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata/stub/inc/videothumbnaildata_p.h Thu Apr 01 23:22:15 2010 +0300
@@ -28,6 +28,11 @@
#include <mpxitemid.h>
// FORWARD DECLARATIONS
+class VideoSortFilterProxyModel
+{
+public:
+ int ooo;
+};
class VideoThumbnailDataPrivate : public QObject
{
@@ -121,9 +126,15 @@
/**
* Starts background thumbnail fetching from the given fetch index.
*
+ * @param model
* @param fetchIndex index where to start the background thumbnail fetching.
*/
- void startBackgroundFetching(int fetchIndex);
+ void startBackgroundFetching(VideoSortFilterProxyModel *model, int fetchIndex);
+
+ /**
+ * Enables thumbnail creation.
+ */
+ void enableThumbnailCreation(bool enable);
signals:
@@ -146,6 +157,7 @@
static int mFreeThumbnailDataCallCount;
static int mBackgroundThumbnailFetchingEnabled;
static int mStartBackgroundFetchingCallCount;
+ static int mEnableThumbnailCreationCallCount;
};
#endif // __VIDEOTHUMBNAILDATAPRIVATE_H__
--- a/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata/stub/src/videothumbnaildata_p.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata/stub/src/videothumbnaildata_p.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -32,6 +32,7 @@
int VideoThumbnailDataPrivate::mBackgroundThumbnailFetchingEnabled = true;
int VideoThumbnailDataPrivate::mFreeThumbnailDataCallCount = 0;
int VideoThumbnailDataPrivate::mStartBackgroundFetchingCallCount = 0;
+int VideoThumbnailDataPrivate::mEnableThumbnailCreationCallCount = 0;
// ================= MEMBER FUNCTIONS =======================
//
@@ -116,9 +117,17 @@
// VideoThumbnailData::startBackgroundFetching()
// -----------------------------------------------------------------------------
//
-void VideoThumbnailDataPrivate::startBackgroundFetching(int fetchIndex)
+void VideoThumbnailDataPrivate::startBackgroundFetching(VideoSortFilterProxyModel *model, int fetchIndex)
{
mStartBackgroundFetchingCallCount++;
}
+// -----------------------------------------------------------------------------
+// VideoThumbnailData::enableThumbnailCreation()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailDataPrivate::enableThumbnailCreation(bool enable)
+{
+ mEnableThumbnailCreationCallCount++;
+}
// End of file
--- a/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/inc/testvideothumbnaildata_p.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/inc/testvideothumbnaildata_p.h Thu Apr 01 23:22:15 2010 +0300
@@ -49,12 +49,13 @@
void testThumbnailReadySlot();
void testDefaultThumbnail();
void testRemoveThumbnail();
- void testLayoutChangedSlot();
- void testRowsInsertedSlot();
- void testRemoveFromFetchList();
+ void testModelChangedSlot();
void testStartBackgroundFetching();
void testEnableBackgroundFetching();
void testFreeThumbnailData();
+ void testAllThumbnailsFetchedSlot();
+ void testEnableThumbnailCreation();
+ void testAboutToQuitSlot();
signals:
void testSignal();
--- a/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/inc/videothumbnaildatatester.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/inc/videothumbnaildatatester.h Thu Apr 01 23:22:15 2010 +0300
@@ -19,9 +19,11 @@
#define _VIDEOTHUMBNAILDATATESTER_H_
// INCLUDES
-#include <QObject>
+#include <qobject.h>
#include "videothumbnaildata_p.h"
+class VideoSortFilterProxyModel;
+
class VideoThumbnailDataTester : public VideoThumbnailDataPrivate
{
Q_OBJECT
@@ -53,29 +55,18 @@
void emitReportThumbnailsReady();
/**
- * Emits layoutChanged signal to itself.
+ * Emits modelChanged signal to itself.
*/
- void emitLayoutChanged();
+ void emitModelChanged();
/**
- * Emits rowsInserted signal to itself.
- *
- * @param parent parent
- * @param start start index
- * @param end end index
+ * Emits aboutToQuit signal to itself.
*/
- void emitRowsInserted(const QModelIndex & parent, int start, int end);
+ void emitAboutToQuit();
//
// Test methods for VideoThumbnailData's methods.
//
-
- /**
- * Calls CVideoThumbnailDataPrivate::removeFromFetchList
- *
- * @param tnId id of thumbnail to be removed.
- */
- void removeFromFetchList(int tnId);
/**
* Calls CVideoThumbnailDataPrivate::initialize
@@ -101,17 +92,22 @@
* Calls CVideoThumbnailDataPrivate::defaultThumbnail
*/
const QIcon* defaultThumbnail(TMPXItemId mediaId);
-
- /**
- * Calls CVideoThumbnailDataPrivate::startBackgroundFetching
- */
- void startBackgroundFetching(int fetchIndex);
-
+
/**
* Calls CVideoThumbnailDataPrivate::continueBackgroundFetch
*/
void continueBackgroundFetch();
+ /**
+ * Calls CVideoThumbnailDataPrivate::startFetchingThumbnails
+ */
+ int startFetchingThumbnails(const QList<QModelIndex> &indexes, int priority);
+
+ /**
+ * Calls CVideoThumbnailDataPrivate::startFetchingThumbnail
+ */
+ int startFetchingThumbnail(TMPXItemId mediaId, int priority);
+
signals:
/**
@@ -122,17 +118,17 @@
/**
* Signal.
*/
- void layoutChangedSignal();
+ void modelChangedSignal();
/**
* Signal.
*/
- void rowsInsertedSignal(const QModelIndex & parent, int start, int end);
+ void reportThumbnailsReadySignal();
/**
* Signal.
*/
- void reportThumbnailsReadySignal();
+ void aboutToQuitSignal();
private:
--- a/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/src/testvideothumbnaildata_p.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/src/testvideothumbnaildata_p.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -26,7 +26,7 @@
#include "qmetatype.h"
#include "testvideothumbnaildata_p.h"
-#include "thumbnailmanager_qt.h"
+#include "videothumbnailfetcher.h"
#include "videosortfilterproxymodel.h"
#include "videocollectionwrapper.h"
@@ -47,8 +47,11 @@
const int THUMBNAIL_CACHE_SIZE = 60;
// Maximum of thumbnail fetches done at one background fetch round.
const int THUMBNAIL_BACKGROUND_FETCH_AMOUNT = 20;
-// Maximum simulatenous thumbnail fetches.
-const int THUMBNAIL_MAX_SIMULTANEOUS_FETCHES = THUMBNAIL_BACKGROUND_FETCH_AMOUNT * 10;
+// Milliseconds for the background fetch timer.
+const int THUMBNAIL_BACKGROUND_TIMEOUT = 100;
+// Milliseconds while thumbnail ready events are gathered before they
+// are signaled.
+const int THUMBNAIL_READY_SIGNAL_TIMEOUT = 50;
// Priority for background thumbnail fetches.
const int BACKGROUND_FETCH_PRIORITY = 3000;
@@ -75,12 +78,19 @@
TestVideoThumbnailData_p tv;
- char *pass[3];
- pass[0] = argv[0];
- pass[1] = "-o";
- pass[2] = "c:\\data\\TestVideoThumbnailData_p.txt";
-
- int res = QTest::qExec(&tv, 3, pass);
+ 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\\TestVideoThumbnailData_p.txt";
+ res = QTest::qExec(&tv, 3, pass);
+ }
return res;
}
@@ -92,14 +102,24 @@
void TestVideoThumbnailData_p::init()
{
VideoCollectionWrapper::mReferenceCount = 0;
+
+ VideoThumbnailFetcher::mConstructorCallCount = 0;
+ VideoThumbnailFetcher::mDestructorCallCount = 0;
+ VideoThumbnailFetcher::mAddFetchCallCount = 0;
+ VideoThumbnailFetcher::mCancelFetchesCallCount = 0;
+ VideoThumbnailFetcher::mFetchCountCallCount = 0;
+ VideoThumbnailFetcher::mPauseFetchingCallCount = 0;
+ VideoThumbnailFetcher::mContinueFetchingCallCount = 0;
+ VideoThumbnailFetcher::mEnableThumbnailCreationCallCount = 0;
+ VideoThumbnailFetcher::mAddFetchFails = false;
+ VideoThumbnailFetcher::mThumbnailReadyError = 0;
- if(!mWrapper)
- mWrapper = VideoCollectionWrapper::instance();
mModel = new VideoSortFilterProxyModel();
- mWrapper->setModel(mModel);
+ VideoCollectionWrapper::instance().setModel(mModel);
mTestObject = new VideoThumbnailDataTester();
mTestObject->initialize();
- ThumbnailManager::mGetThumbFails = false;
+ mTestObject->mCurrentModel = mModel;
+
VideoSortFilterProxyModel::mReturnInvalidIndexes = false;
VideoSortFilterProxyModel::mRowCountCallCount = 0;
qRegisterMetaType<QList<TMPXItemId> >("QList<TMPXItemId>");
@@ -112,14 +132,6 @@
void TestVideoThumbnailData_p::cleanup()
{
delete mTestObject; mTestObject = 0;
- delete mModel; mModel = 0;
- ThumbnailManager::mRequests.clear();
- if(mWrapper)
- {
- mWrapper->decreaseReferenceCount();
- mWrapper = 0;
- }
- QCOMPARE(mWrapper->mReferenceCount, 0);
}
// ---------------------------------------------------------------------------
@@ -151,35 +163,10 @@
{
mWrapper = 0;
- //User::Heap().__DbgMarkStart();
mTestObject = new VideoThumbnailDataTester();
delete mTestObject; mTestObject = 0;
- ulong heapCellPtr = User::Heap().__DbgMarkEnd(0);
- //QCOMPARE( heapCellPtr, (ulong)0 );
-
- //User::Heap().__DbgMarkStart();
- init();
- cleanup(); // should not crash...
- heapCellPtr = User::Heap().__DbgMarkEnd(0);
- //QCOMPARE( heapCellPtr, (ulong)0 );
-
- //User::Heap().__DbgMarkStart();
- init();
- QPointer<ThumbnailManager> tnMgrPtr(mTestObject->mThumbnailManager);
- ThumbnailManager::mRequests[0] = ThumbnailManager::TnRequest("first", 0, 0, false);
- ThumbnailManager::mRequests[1] = ThumbnailManager::TnRequest("second", 0, 0, false);
- mTestObject->mFetchList.insert(0);
- mTestObject->mFetchList.insert(1);
- mTestObject->mThumbnailData.insert(TMPXItemId(2, 0), new QIcon());
- mTestObject->mThumbnailData.insert(TMPXItemId(3, 0), new QIcon());
- cleanup(); // should not crash...
- QVERIFY( tnMgrPtr == 0 );
- ThumbnailManager::TnRequest req;
- foreach(req, ThumbnailManager::mRequests) {
- QVERIFY( req.cancelled );
- }
- heapCellPtr = User::Heap().__DbgMarkEnd(0);
- //QCOMPARE( heapCellPtr, (ulong)0 );
+
+ //TODO
}
// ---------------------------------------------------------------------------
@@ -188,15 +175,11 @@
//
void TestVideoThumbnailData_p::testInitialize()
{
- // Wrapper return null model
- if(!mWrapper)
- mWrapper = VideoCollectionWrapper::instance();
- mWrapper->setModel(0);
+ VideoCollectionWrapper::instance().setModel(0);
mTestObject = new VideoThumbnailDataTester();
- QVERIFY(mTestObject->mThumbnailManager == 0);
- QVERIFY(mTestObject->mModel == 0);
- QVERIFY(mTestObject->mModel == 0);
+ QVERIFY(mTestObject->mThumbnailFetcher == 0);
+ QVERIFY(mTestObject->mCurrentModel == 0);
QVERIFY(mTestObject->mBgFetchTimer == 0);
cleanup();
@@ -204,24 +187,23 @@
mTestObject->disconnectSignals();
delete mTestObject->mBgFetchTimer;
mTestObject->mBgFetchTimer = 0;
- delete mTestObject->mThumbnailManager;
- mTestObject->mThumbnailManager = 0;
- mTestObject->mModel = 0;
- __UHEAP_FAILNEXT(3);
+ delete mTestObject->mThumbnailFetcher;
+ mTestObject->mThumbnailFetcher = 0;
+ mTestObject->mCurrentModel = 0;
+
mTestObject->initialize();
- QVERIFY(mTestObject->mThumbnailManager == 0);
- QVERIFY(mTestObject->mModel == 0);
+ QVERIFY(mTestObject->mThumbnailFetcher == 0);
+ QVERIFY(mTestObject->mCurrentModel == 0);
QVERIFY(mTestObject->mBgFetchTimer == 0);
cleanup();
init();
mTestObject->initialize();
mTestObject->initialize();
- QVERIFY(mTestObject->mThumbnailManager != 0);
- QVERIFY(mTestObject->mModel != 0);
+ QVERIFY(mTestObject->mThumbnailFetcher != 0);
+ QVERIFY(mTestObject->mCurrentModel != 0);
QVERIFY(mTestObject->mBgFetchTimer != 0);
- QCOMPARE( mTestObject->mThumbnailManager->mThumbSize, ThumbnailManager::ThumbnailMedium );
- QCOMPARE( mTestObject->mThumbnailManager->mQuality, ThumbnailManager::OptimizeForPerformance );
+ QCOMPARE( mTestObject->mThumbnailFetcher->mConstructorCallCount, 1);
cleanup();
}
@@ -252,43 +234,29 @@
void TestVideoThumbnailData_p::testStartFetchingThumbnail()
{
QSignalSpy* spy = 0;
- ThumbnailManager::TnRequest req;
// Tests when mModel is null.
init();
- VideoSortFilterProxyModel* backupProxyModel = mTestObject->mModel;
- mTestObject->mModel = NULL;
+ VideoSortFilterProxyModel* backupProxyModel = mTestObject->mCurrentModel;
+ mTestObject->mCurrentModel = NULL;
spy = new QSignalSpy(mTestObject, SIGNAL(thumbnailsFetched(QList<TMPXItemId>)));
QCOMPARE(mTestObject->startFetchingThumbnail(TMPXItemId(0, 0), TB_PRIORITY), -1);
QVERIFY(checkThumbnailReadyCount(spy, 0));
delete spy;
- QCOMPARE(mTestObject->mFetchList.count(), 0);
- mTestObject->mModel = backupProxyModel;
+ QCOMPARE(VideoThumbnailFetcher::mRequests.count(), 0);
+ mTestObject->mCurrentModel = backupProxyModel;
cleanup();
- // Tests when mThumbnailManager is null.
+ // Tests when thumbnail fetcher is null.
init();
- ThumbnailManager* backupTnMgr = mTestObject->mThumbnailManager;
- mTestObject->mThumbnailManager = NULL;
+ VideoThumbnailFetcher* backup = mTestObject->mThumbnailFetcher;
+ mTestObject->mThumbnailFetcher = NULL;
spy = new QSignalSpy(mTestObject, SIGNAL(thumbnailsFetched(QList<TMPXItemId>)));
QCOMPARE(mTestObject->startFetchingThumbnail(TMPXItemId(0, 0), TB_PRIORITY), -1);
QVERIFY(checkThumbnailReadyCount(spy, 0));
delete spy;
- QCOMPARE(mTestObject->mFetchList.count(), 0);
- mTestObject->mThumbnailManager = backupTnMgr;
- cleanup();
-
- // Tests when there's max fetches ongoing.
- init();
- for(int i = 0; i < THUMBNAIL_MAX_SIMULTANEOUS_FETCHES+10; i++)
- {
- mTestObject->mFetchList.insert(i);
- }
- spy = new QSignalSpy(mTestObject, SIGNAL(thumbnailsFetched(QList<TMPXItemId>)));
- QCOMPARE(mTestObject->startFetchingThumbnail(TMPXItemId(0, 0), TB_PRIORITY), -1);
- QVERIFY(checkThumbnailReadyCount(spy, 0));
- QCOMPARE(mTestObject->mFetchList.count(), THUMBNAIL_MAX_SIMULTANEOUS_FETCHES+10);
- delete spy;
+ QCOMPARE(VideoThumbnailFetcher::mRequests.count(), 0);
+ mTestObject->mThumbnailFetcher = backup;
cleanup();
// Thumbnail has been already fetched.
@@ -297,52 +265,52 @@
mTestObject->mThumbnailData.insert(TMPXItemId(10, 0), 0);
QCOMPARE(mTestObject->startFetchingThumbnail(TMPXItemId(10, 0), TB_PRIORITY), 0);
QVERIFY(checkThumbnailReadyCount(spy, 0));
- QCOMPARE(mTestObject->mFetchList.count(), 0);
+ QCOMPARE(VideoThumbnailFetcher::mRequests.count(), 0);
delete spy;
cleanup();
- // Thumbnail fetch request to tn manager fails.
+ // Thumbnail fetch request to tn fetcher fails.
init();
- ThumbnailManager::mGetThumbFails = true;
- mTestObject->mModel->appendData("testfile");
+ VideoThumbnailFetcher::mAddFetchFails = true;
+ mTestObject->mCurrentModel->appendData("testfile");
spy = new QSignalSpy(mTestObject, SIGNAL(thumbnailsFetched(QList<TMPXItemId>)));
- QCOMPARE(mTestObject->startFetchingThumbnail(TMPXItemId(0, 0), TB_PRIORITY), -1);
+ QCOMPARE(mTestObject->startFetchingThumbnail(TMPXItemId(0, 0), TB_PRIORITY), 0);
QVERIFY(checkThumbnailReadyCount(spy, 0));
- QCOMPARE(mTestObject->mFetchList.count(), 0);
+ QCOMPARE(VideoThumbnailFetcher::mRequests.count(), 0);
delete spy;
cleanup();
// Filename is empty.
init();
- ThumbnailManager::mGetThumbFails = true;
- mTestObject->mModel->appendData("");
+ mTestObject->mCurrentModel->appendData("");
spy = new QSignalSpy(mTestObject, SIGNAL(thumbnailsFetched(QList<TMPXItemId>)));
- QCOMPARE(mTestObject->startFetchingThumbnail(TMPXItemId(0, 0), TB_PRIORITY), -1);
+ QCOMPARE(mTestObject->startFetchingThumbnail(TMPXItemId(0, 0), TB_PRIORITY), 0);
QVERIFY(checkThumbnailReadyCount(spy, 0));
- QCOMPARE(mTestObject->mFetchList.count(), 0);
+ QCOMPARE(VideoThumbnailFetcher::mRequests.count(), 0);
delete spy;
cleanup();
// Filename is null.
init();
- ThumbnailManager::mGetThumbFails = true;
- mTestObject->mModel->appendData(QString());
+ mTestObject->mCurrentModel->appendData(QString());
spy = new QSignalSpy(mTestObject, SIGNAL(thumbnailsFetched(QList<TMPXItemId>)));
- QCOMPARE(mTestObject->startFetchingThumbnail(TMPXItemId(0, 0), TB_PRIORITY), -1);
+ QCOMPARE(mTestObject->startFetchingThumbnail(TMPXItemId(0, 0), TB_PRIORITY), 0);
QVERIFY(checkThumbnailReadyCount(spy, 0));
- QCOMPARE(mTestObject->mFetchList.count(), 0);
+ QCOMPARE(VideoThumbnailFetcher::mRequests.count(), 0);
delete spy;
cleanup();
+ VideoThumbnailFetcher::TnRequest req;
+
// Good case.
init();
QString fileName("video.mp4");
- mTestObject->mModel->appendData(fileName);
+ mTestObject->mCurrentModel->appendData(fileName);
spy = new QSignalSpy(mTestObject, SIGNAL(thumbnailsFetched(QList<TMPXItemId>)));
QCOMPARE(mTestObject->startFetchingThumbnail(TMPXItemId(0, 0), TB_PRIORITY), 0);
QVERIFY(checkThumbnailReadyCount(spy, 0));
- QCOMPARE(mTestObject->mFetchList.count(), 1);
- req = ThumbnailManager::mRequests[0];
+ QCOMPARE(VideoThumbnailFetcher::mRequests.count(), 1);
+ req = VideoThumbnailFetcher::mRequests[0];
QVERIFY(req.name == fileName);
QCOMPARE(req.priority, TB_PRIORITY);
delete spy;
@@ -350,13 +318,13 @@
// Already fetching same thumbnail.
init();
- mTestObject->mModel->appendData(fileName);
- ThumbnailManager::mRequests[1] = ThumbnailManager::TnRequest("test1", 0, -1, false);
+ mTestObject->mCurrentModel->appendData(fileName);
+ VideoThumbnailFetcher::mRequests.insert(1, VideoThumbnailFetcher::TnRequest("test1", 0, -1, false));
spy = new QSignalSpy(mTestObject, SIGNAL(thumbnailsFetched(QList<TMPXItemId>)));
- QCOMPARE(mTestObject->startFetchingThumbnail(TMPXItemId(0, 0), TB_PRIORITY), 1);
+ QCOMPARE(mTestObject->startFetchingThumbnail(TMPXItemId(0, 0), TB_PRIORITY), 0);
QVERIFY(checkThumbnailReadyCount(spy, 0));
- QCOMPARE(mTestObject->mFetchList.count(), 1);
- req = ThumbnailManager::mRequests[1];
+ QCOMPARE(VideoThumbnailFetcher::mRequests.count(), 1);
+ req = VideoThumbnailFetcher::mRequests[1];
QVERIFY(req.name == fileName);
QCOMPARE(req.priority, TB_PRIORITY);
delete spy;
@@ -369,44 +337,44 @@
//
void TestVideoThumbnailData_p::testStartFetchingThumbnails()
{
- ThumbnailManager::TnRequest req;
+ VideoThumbnailFetcher::TnRequest req;
QList<QModelIndex> indexes;
QSignalSpy* spy = 0;
// Tests when mModel is null.
init();
indexes.clear();
- indexes.append(mTestObject->mModel->index(0, 0, QModelIndex()));
- indexes.append(mTestObject->mModel->index(10, 0, QModelIndex()));
- indexes.append(mTestObject->mModel->index(20, 0, QModelIndex()));
- VideoSortFilterProxyModel* backupProxyModel = mTestObject->mModel;
- mTestObject->mModel = NULL;
+ indexes.append(mTestObject->mCurrentModel->index(0, 0, QModelIndex()));
+ indexes.append(mTestObject->mCurrentModel->index(10, 0, QModelIndex()));
+ indexes.append(mTestObject->mCurrentModel->index(20, 0, QModelIndex()));
+ VideoSortFilterProxyModel* backupProxyModel = mTestObject->mCurrentModel;
+ mTestObject->mCurrentModel = NULL;
spy = new QSignalSpy(mTestObject, SIGNAL(thumbnailsFetched(QList<TMPXItemId>)));
QCOMPARE(mTestObject->startFetchingThumbnails(indexes,
BACKGROUND_FETCH_PRIORITY), -1);
QVERIFY(checkThumbnailReadyCount(spy, 0));
delete spy;
- QCOMPARE(mTestObject->mFetchList.count(), 0);
- mTestObject->mModel = backupProxyModel;
+ QCOMPARE(VideoThumbnailFetcher::mRequests.count(), 0);
+ mTestObject->mCurrentModel = backupProxyModel;
QVERIFY(mTestObject->mCurrentFetchIndex == 0);
cleanup();
- // Tests when mThumbnailManager is null.
+ // Tests when mThumbnailFetcher is null.
init();
indexes.clear();
- ThumbnailManager* backupTnMgr = mTestObject->mThumbnailManager;
- mTestObject->mThumbnailManager = NULL;
- indexes.append(mTestObject->mModel->index(0, 0, QModelIndex()));
- indexes.append(mTestObject->mModel->index(10, 0, QModelIndex()));
- indexes.append(mTestObject->mModel->index(20, 0, QModelIndex()));
+ VideoThumbnailFetcher* backup = mTestObject->mThumbnailFetcher;
+ mTestObject->mThumbnailFetcher = NULL;
+ indexes.append(mTestObject->mCurrentModel->index(0, 0, QModelIndex()));
+ indexes.append(mTestObject->mCurrentModel->index(10, 0, QModelIndex()));
+ indexes.append(mTestObject->mCurrentModel->index(20, 0, QModelIndex()));
spy = new QSignalSpy(mTestObject, SIGNAL(thumbnailsFetched(QList<TMPXItemId>)));
QCOMPARE(mTestObject->startFetchingThumbnails(indexes,
BACKGROUND_FETCH_PRIORITY), -1);
QVERIFY(checkThumbnailReadyCount(spy, 0));
delete spy;
- QCOMPARE(mTestObject->mFetchList.count(), 0);
- mTestObject->mThumbnailManager = backupTnMgr;
+ QCOMPARE(VideoThumbnailFetcher::mRequests.count(), 0);
+ mTestObject->mThumbnailFetcher = backup;
QVERIFY(mTestObject->mCurrentFetchIndex == 0);
cleanup();
@@ -418,79 +386,76 @@
BACKGROUND_FETCH_PRIORITY), 0);
QVERIFY(checkThumbnailReadyCount(spy, 0));
delete spy;
- QCOMPARE(mTestObject->mFetchList.count(), 0);
+ QCOMPARE(VideoThumbnailFetcher::mRequests.count(), 0);
QVERIFY(mTestObject->mCurrentFetchIndex == 0);
cleanup();
// Already fetching some thumbnails.
init();
QString fileName("video.mp4");
- mTestObject->mModel->appendData(fileName);
+ mTestObject->mCurrentModel->appendData(fileName);
indexes.clear();
- ThumbnailManager::mRequests[50] = ThumbnailManager::TnRequest("test1", 0, -1, false);
- ThumbnailManager::mRequests[40] = ThumbnailManager::TnRequest("test2", 0, -1, false);
- ThumbnailManager::mRequests[30] = ThumbnailManager::TnRequest("test3", 0, -1, false);
- mTestObject->mFetchList.insert(50);
- mTestObject->mFetchList.insert(40);
- mTestObject->mFetchList.insert(30);
- indexes.append(mTestObject->mModel->index(0, 0, QModelIndex()));
+ VideoThumbnailFetcher::mRequests[50] = VideoThumbnailFetcher::TnRequest("test1", 0, -1, false);
+ VideoThumbnailFetcher::mRequests[40] = VideoThumbnailFetcher::TnRequest("test2", 0, -1, false);
+ VideoThumbnailFetcher::mRequests[30] = VideoThumbnailFetcher::TnRequest("test3", 0, -1, false);
+ indexes.append(mTestObject->mCurrentModel->index(0, 0, QModelIndex()));
spy = new QSignalSpy(mTestObject, SIGNAL(thumbnailsFetched(QList<TMPXItemId>)));
QCOMPARE(mTestObject->startFetchingThumbnails(indexes,
BACKGROUND_FETCH_PRIORITY), 1);
QVERIFY(checkThumbnailReadyCount(spy, 0));
delete spy;
- QCOMPARE(mTestObject->mFetchList.count(), 4);
+ QCOMPARE(VideoThumbnailFetcher::mRequests.count(), 4);
- req = ThumbnailManager::mRequests[50];
+ req = VideoThumbnailFetcher::mRequests[50];
QVERIFY(req.name == "test1");
QCOMPARE(req.priority, -1);
- req = ThumbnailManager::mRequests[40];
+ req = VideoThumbnailFetcher::mRequests[40];
QVERIFY(req.name == "test2");
QCOMPARE(req.priority, -1);
- req = ThumbnailManager::mRequests[30];
+ req = VideoThumbnailFetcher::mRequests[30];
QVERIFY(req.name == "test3");
QCOMPARE(req.priority, -1);
- req = ThumbnailManager::mRequests[3];
+ req = VideoThumbnailFetcher::mRequests[3];
QVERIFY(req.name == fileName);
- QCOMPARE(req.priority, static_cast<int>(BACKGROUND_FETCH_PRIORITY) + 4);
+ QCOMPARE(req.priority, static_cast<int>(BACKGROUND_FETCH_PRIORITY));
- ThumbnailManager::mRequests.clear();
+ VideoThumbnailFetcher::mRequests.clear();
QVERIFY(mTestObject->mCurrentFetchIndex == 0);
cleanup();
// Ok case
init();
- mTestObject->mModel->appendData("file1");
- mTestObject->mModel->appendData("file2");
- mTestObject->mModel->appendData("file3");
- mTestObject->mModel->appendData("file4");
- mTestObject->mModel->appendData("file5");
- mTestObject->mModel->appendData("file6");
+ mTestObject->mCurrentModel->appendData("file1");
+ mTestObject->mCurrentModel->appendData("file2");
+ mTestObject->mCurrentModel->appendData("file3");
+ mTestObject->mCurrentModel->appendData("file4");
+ mTestObject->mCurrentModel->appendData("file5");
+ mTestObject->mCurrentModel->appendData("file6");
indexes.clear();
- indexes.append(mTestObject->mModel->index(2, 0, QModelIndex()));
- indexes.append(mTestObject->mModel->index(3, 0, QModelIndex()));
- indexes.append(mTestObject->mModel->index(4, 0, QModelIndex()));
+ indexes.append(mTestObject->mCurrentModel->index(2, 0, QModelIndex()));
+ indexes.append(mTestObject->mCurrentModel->index(3, 0, QModelIndex()));
+ indexes.append(mTestObject->mCurrentModel->index(4, 0, QModelIndex()));
spy = new QSignalSpy(mTestObject, SIGNAL(thumbnailsFetched(QList<TMPXItemId>)));
QCOMPARE(mTestObject->startFetchingThumbnails(indexes,
BACKGROUND_FETCH_PRIORITY), 3);
QVERIFY(checkThumbnailReadyCount(spy, 0));
delete spy;
- QCOMPARE(mTestObject->mFetchList.count(), 3);
+ QCOMPARE(VideoThumbnailFetcher::mRequests.count(), 3);
- req = ThumbnailManager::mRequests[0];
+ req = VideoThumbnailFetcher::mRequests[0];
QVERIFY(req.name == "file3");
- QCOMPARE(req.priority, static_cast<int>(BACKGROUND_FETCH_PRIORITY) + 3);
+ QCOMPARE(req.priority, static_cast<int>(BACKGROUND_FETCH_PRIORITY));
- req = ThumbnailManager::mRequests[1];
+ req = VideoThumbnailFetcher::mRequests[1];
QVERIFY(req.name == "file4");
- QCOMPARE(req.priority, static_cast<int>(BACKGROUND_FETCH_PRIORITY) + 3 - 1);
+ QCOMPARE(req.priority, static_cast<int>(BACKGROUND_FETCH_PRIORITY) - 1);
- req = ThumbnailManager::mRequests[2];
+ req = VideoThumbnailFetcher::mRequests[2];
QVERIFY(req.name == "file5");
- QCOMPARE(req.priority, static_cast<int>(BACKGROUND_FETCH_PRIORITY) + 3 - 2);
+ QCOMPARE(req.priority, static_cast<int>(BACKGROUND_FETCH_PRIORITY) - 2);
cleanup();
}
@@ -500,51 +465,50 @@
//
void TestVideoThumbnailData_p::testDoBackgroundFetching()
{
- ThumbnailManager::TnRequest req;
+ VideoThumbnailFetcher::TnRequest req;
QSignalSpy* spy = 0;
// Tests when mModel is null.
init();
- VideoSortFilterProxyModel* backupProxyModel = mTestObject->mModel;
- mTestObject->mModel = NULL;
+ VideoSortFilterProxyModel* backupProxyModel = mTestObject->mCurrentModel;
+ mTestObject->mCurrentModel = NULL;
spy = new QSignalSpy(mTestObject, SIGNAL(thumbnailsFetched(QList<TMPXItemId>)));
mTestObject->emitDoBackgroundFetching();
QVERIFY(checkThumbnailReadyCount(spy, 0));
delete spy;
- QCOMPARE(mTestObject->mFetchList.count(), 0);
- mTestObject->mModel = backupProxyModel;
+ QCOMPARE(VideoThumbnailFetcher::mRequests.count(), 0);
+ mTestObject->mCurrentModel = backupProxyModel;
QVERIFY(mTestObject->mCurrentFetchIndex == 0);
QCOMPARE(VideoSortFilterProxyModel::mRowCountCallCount, 0);
cleanup();
- // Tests when mThumbnailManager is null.
+ // Tests when mThumbnailFetcher is null.
init();
- ThumbnailManager* backupTnMgr = mTestObject->mThumbnailManager;
- mTestObject->mThumbnailManager = NULL;
+ VideoThumbnailFetcher* backup = mTestObject->mThumbnailFetcher;
+ mTestObject->mThumbnailFetcher = NULL;
spy = new QSignalSpy(mTestObject, SIGNAL(thumbnailsFetched(QList<TMPXItemId>)));
mTestObject->emitDoBackgroundFetching();
QVERIFY(checkThumbnailReadyCount(spy, 0));
delete spy;
- QCOMPARE(mTestObject->mFetchList.count(), 0);
- mTestObject->mThumbnailManager = backupTnMgr;
+ QCOMPARE(VideoThumbnailFetcher::mRequests.count(), 0);
+ mTestObject->mThumbnailFetcher = backup;
QVERIFY(mTestObject->mCurrentFetchIndex == 0);
- QCOMPARE(VideoSortFilterProxyModel::mRowCountCallCount, 1);
cleanup();
// THUMBNAIL_BACKGROUND_FETCH_AMOUNT items in model and fetch index at 0
init();
for(int i = 0; i < THUMBNAIL_BACKGROUND_FETCH_AMOUNT; i++)
{
- mTestObject->mModel->appendData(QString("file") + QString::number(i));
+ mTestObject->mCurrentModel->appendData(QString("file") + QString::number(i));
}
spy = new QSignalSpy(mTestObject, SIGNAL(thumbnailsFetched(QList<TMPXItemId>)));
mTestObject->emitDoBackgroundFetching();
QVERIFY(checkThumbnailReadyCount(spy, 0));
- QCOMPARE(mTestObject->mFetchList.count(), THUMBNAIL_BACKGROUND_FETCH_AMOUNT/2);
+ QCOMPARE(VideoThumbnailFetcher::mRequests.count(), THUMBNAIL_BACKGROUND_FETCH_AMOUNT/2);
int previousPriority = -1;
for(int i = 0; i < THUMBNAIL_BACKGROUND_FETCH_AMOUNT/2; i++)
{
- req = ThumbnailManager::mRequests[i];
+ req = VideoThumbnailFetcher::mRequests[i];
QVERIFY(req.name == "file" + QString::number(i));
if(previousPriority != -1)
{
@@ -562,13 +526,13 @@
mTestObject->emitDoBackgroundFetching();
QVERIFY(checkThumbnailReadyCount(spy, 0));
// Now all thumbnails are being fetched.
- QCOMPARE(mTestObject->mFetchList.count(), THUMBNAIL_BACKGROUND_FETCH_AMOUNT);
+ QCOMPARE(VideoThumbnailFetcher::mRequests.count(), THUMBNAIL_BACKGROUND_FETCH_AMOUNT);
for(int i = 0; i < THUMBNAIL_BACKGROUND_FETCH_AMOUNT/2; i++)
{
- req = ThumbnailManager::mRequests[i];
+ req = VideoThumbnailFetcher::mRequests[i];
QVERIFY(req.name == "file" + QString::number(i));
- req = ThumbnailManager::mRequests[i+5];
+ req = VideoThumbnailFetcher::mRequests[i+5];
QVERIFY(req.name == "file" + QString::number(i+5));
}
@@ -583,14 +547,14 @@
init();
for(int i = 0; i < THUMBNAIL_BACKGROUND_FETCH_AMOUNT; i++)
{
- mTestObject->mModel->appendData(QString("file") + QString::number(i));
+ mTestObject->mCurrentModel->appendData(QString("file") + QString::number(i));
}
spy = new QSignalSpy(mTestObject, SIGNAL(thumbnailsFetched(QList<TMPXItemId>)));
mTestObject->mCurrentFetchIndex = THUMBNAIL_BACKGROUND_FETCH_AMOUNT/2*-1;
mTestObject->emitDoBackgroundFetching();
QVERIFY(checkThumbnailReadyCount(spy, 0));
delete spy;
- QCOMPARE(mTestObject->mFetchList.count(), 0);
+ QCOMPARE(VideoThumbnailFetcher::mRequests.count(), 0);
QVERIFY(mTestObject->mCurrentFetchIndex == THUMBNAIL_BACKGROUND_FETCH_AMOUNT/2*-1);
QVERIFY(mTestObject->mBgFetchTimer->isActive() == true);
cleanup();
@@ -599,14 +563,14 @@
init();
for(int i = 0; i < THUMBNAIL_BACKGROUND_FETCH_AMOUNT*2; i++)
{
- mTestObject->mModel->appendData(QString("file") + QString::number(i));
+ mTestObject->mCurrentModel->appendData(QString("file") + QString::number(i));
}
spy = new QSignalSpy(mTestObject, SIGNAL(thumbnailsFetched(QList<TMPXItemId>)));
mTestObject->mCurrentFetchIndex = THUMBNAIL_BACKGROUND_FETCH_AMOUNT*2;
mTestObject->emitDoBackgroundFetching();
QVERIFY(checkThumbnailReadyCount(spy, 0));
delete spy;
- QCOMPARE(mTestObject->mFetchList.count(), THUMBNAIL_BACKGROUND_FETCH_AMOUNT/2);
+ QCOMPARE(VideoThumbnailFetcher::mRequests.count(), THUMBNAIL_BACKGROUND_FETCH_AMOUNT/2);
QVERIFY(mTestObject->mCurrentFetchIndex == THUMBNAIL_BACKGROUND_FETCH_AMOUNT*2);
QVERIFY(mTestObject->mBgFetchTimer->isActive() == false);
cleanup();
@@ -615,14 +579,14 @@
init();
for(int i = 0; i < THUMBNAIL_BACKGROUND_FETCH_AMOUNT; i++)
{
- mTestObject->mModel->appendData(QString("file") + QString::number(i));
+ mTestObject->mCurrentModel->appendData(QString("file") + QString::number(i));
}
spy = new QSignalSpy(mTestObject, SIGNAL(thumbnailsFetched(QList<TMPXItemId>)));
mTestObject->mCurrentFetchIndex = THUMBNAIL_BACKGROUND_FETCH_AMOUNT + THUMBNAIL_BACKGROUND_FETCH_AMOUNT/2;
mTestObject->emitDoBackgroundFetching();
QVERIFY(checkThumbnailReadyCount(spy, 0));
delete spy;
- QCOMPARE(mTestObject->mFetchList.count(), 0);
+ QCOMPARE(VideoThumbnailFetcher::mRequests.count(), 0);
QVERIFY(mTestObject->mCurrentFetchIndex == THUMBNAIL_BACKGROUND_FETCH_AMOUNT + THUMBNAIL_BACKGROUND_FETCH_AMOUNT/2);
QVERIFY(mTestObject->mBgFetchTimer->isActive() == true);
cleanup();
@@ -634,7 +598,7 @@
mTestObject->emitDoBackgroundFetching();
QVERIFY(checkThumbnailReadyCount(spy, 0));
delete spy;
- QCOMPARE(mTestObject->mFetchList.count(), 0);
+ QCOMPARE(VideoThumbnailFetcher::mRequests.count(), 0);
QVERIFY(mTestObject->mCurrentFetchIndex == -5);
QVERIFY(mTestObject->mBgFetchTimer->isActive() == false);
cleanup();
@@ -643,40 +607,17 @@
init();
for(int i = 0; i < THUMBNAIL_BACKGROUND_FETCH_AMOUNT; i++)
{
- mTestObject->mModel->appendData(QString("file") + QString::number(i));
+ mTestObject->mCurrentModel->appendData(QString("file") + QString::number(i));
}
spy = new QSignalSpy(mTestObject, SIGNAL(thumbnailsFetched(QList<TMPXItemId>)));
VideoSortFilterProxyModel::mReturnInvalidIndexes = true;
mTestObject->mCurrentFetchIndex = THUMBNAIL_BACKGROUND_FETCH_AMOUNT/2;
mTestObject->emitDoBackgroundFetching();
QVERIFY(checkThumbnailReadyCount(spy, 0));
- QCOMPARE(mTestObject->mFetchList.count(), 0);
+ QCOMPARE(VideoThumbnailFetcher::mRequests.count(), 0);
QVERIFY(mTestObject->mCurrentFetchIndex == THUMBNAIL_BACKGROUND_FETCH_AMOUNT/2);
QVERIFY(mTestObject->mCurrentBackgroundFetchCount == THUMBNAIL_BACKGROUND_FETCH_AMOUNT);
QVERIFY(mTestObject->mBgFetchTimer->isActive() == true);
-
- // More than maximum background fetched items in model, do bg fetch until max amount of thumbnails.
- init();
- int itemAmount = THUMBNAIL_MAX_SIMULTANEOUS_FETCHES*2;
- for(int i = 0; i < itemAmount; i++)
- {
- mTestObject->mModel->appendData(QString("file") + QString::number(i));
- }
- spy = new QSignalSpy(mTestObject, SIGNAL(thumbnailsFetched(QList<TMPXItemId>)));
- mTestObject->mCurrentFetchIndex = itemAmount/2;
-
- int fetchTimes = THUMBNAIL_MAX_SIMULTANEOUS_FETCHES/THUMBNAIL_BACKGROUND_FETCH_AMOUNT+2;
- for(int i = 0; i < fetchTimes; i++)
- {
- mTestObject->mBgFetchTimer->stop();
- QVERIFY(mTestObject->mBgFetchTimer->isActive() == false);
- mTestObject->emitDoBackgroundFetching();
- }
- QVERIFY(checkThumbnailReadyCount(spy, 0));
- QCOMPARE(mTestObject->mFetchList.count(), THUMBNAIL_CACHE_SIZE);
- QCOMPARE(mTestObject->mCurrentBackgroundFetchCount, THUMBNAIL_CACHE_SIZE);
- QVERIFY(mTestObject->mBgFetchTimer->isActive() == false);
- cleanup();
}
// ---------------------------------------------------------------------------
@@ -685,81 +626,68 @@
//
void TestVideoThumbnailData_p::testThumbnailReadySlot()
{
- QString fileName("filename");
- QString fileName2("filename2");
- QSignalSpy* spy = 0;
- User::Heap().__DbgMarkStart();
-
- int mediaId1 = 1;
- int mediaId2 = 2;
-
init();
- mTestObject->mModel->appendData("notusedfile0");
- mTestObject->mModel->appendData(fileName); // id 1
- mTestObject->mModel->appendData(fileName2); // id 2
- mTestObject->mModel->appendData("notusedfile1");
- mTestObject->mModel->appendData("notusedfile2");
- spy = new QSignalSpy(mTestObject, SIGNAL(thumbnailsFetched(QList<TMPXItemId>)));
- int tnId1 = mTestObject->startFetchingThumbnail(TMPXItemId(mediaId1, 0), TB_PRIORITY);
- int tnId2 = mTestObject->startFetchingThumbnail(TMPXItemId(mediaId2, 0), TB_PRIORITY);
- QVERIFY( mTestObject->mThumbnailData.contains(TMPXItemId(mediaId1, 0)) == false );
- QVERIFY( mTestObject->mThumbnailData.contains(TMPXItemId(mediaId2, 0)) == false );
- QVERIFY(checkThumbnailReadyCount(spy, 0));
- QCOMPARE(mTestObject->mFetchList.count(), 2);
-
- spy->clear();
- mTestObject->mThumbnailManager->emitThumbnailReady(10);
- QVERIFY( mTestObject->mThumbnailData.contains(TMPXItemId(mediaId1, 0)) == false );
- QVERIFY( mTestObject->mThumbnailData.contains(TMPXItemId(mediaId2, 0)) == false );
- QVERIFY( mTestObject->mFetchList.contains(tnId1) );
- QVERIFY( mTestObject->mFetchList.contains(tnId2) );
- QVERIFY(checkThumbnailReadyCount(spy, 0));
-
- spy->clear();
- mTestObject->mThumbnailManager->mThumbnailReadyError = -1;
- mTestObject->mThumbnailManager->emitThumbnailReady(tnId1);
- QVERIFY( mTestObject->mThumbnailData.contains(TMPXItemId(mediaId1, 0)) == false );
- QVERIFY( mTestObject->mThumbnailData.contains(TMPXItemId(mediaId2, 0)) == false );
- QVERIFY( mTestObject->mFetchList.contains(tnId1) == false );
- QVERIFY( mTestObject->mFetchList.contains(tnId2) );
- QVERIFY(checkThumbnailReadyCount(spy, 0));
-
- spy->clear();
- mTestObject->mThumbnailManager->mThumbnailReadyError = 0;
- mTestObject->mThumbnailManager->emitThumbnailReady(tnId2);
- QVERIFY( mTestObject->mThumbnailData.contains(TMPXItemId(mediaId1, 0)) == false );
- QVERIFY( mTestObject->mThumbnailData.contains(TMPXItemId(mediaId2, 0)) );
- QVERIFY( mTestObject->mFetchList.contains(tnId1) == false );
- QVERIFY( mTestObject->mFetchList.contains(tnId2) == false );
- QVERIFY(checkThumbnailReadyCount(spy, 1));
- delete spy;
+
+ int error = 0;
+ void *internal = 0;
+ QPixmap nullpmap;
+ QIcon icon(":/icons/default_thumbnail.svg");
+ QPixmap pmap = icon.pixmap(500, 500);
+
+ // Internal is null and error.
+ mTestObject->mThumbnailFetcher->emitThumbnailReady(pmap, internal, error);
+ QCOMPARE(mTestObject->mThumbnailData.count(), 0);
+ QCOMPARE(mTestObject->mReadyThumbnailMediaIds.count(), 0);
+ QVERIFY(!mTestObject->mTbnReportTimer->isActive());
+
+ // Internal is not null but there's error.
+ internal = (void *)new TMPXItemId(5, 5);
+ error = -5;
+ mTestObject->mThumbnailFetcher->emitThumbnailReady(pmap, internal, error);
+ QCOMPARE(mTestObject->mThumbnailData.count(), 0);
+ QCOMPARE(mTestObject->mReadyThumbnailMediaIds.count(), 0);
+ QVERIFY(!mTestObject->mTbnReportTimer->isActive());
+
+ // Pixmap is null.
+ internal = (void *)new TMPXItemId(5, 5);
+ error = 0;
+ mTestObject->mThumbnailFetcher->emitThumbnailReady(nullpmap, internal, error);
+ QCOMPARE(mTestObject->mThumbnailData.count(), 0);
+ QCOMPARE(mTestObject->mReadyThumbnailMediaIds.count(), 0);
+ QVERIFY(!mTestObject->mTbnReportTimer->isActive());
cleanup();
-
- ThumbnailManager::mRequests.clear();
- ulong heapCellPtr = User::Heap().__DbgMarkEnd(0);
- //QCOMPARE( heapCellPtr, (ulong)0 );
- // Test null thumbnail data.
+ // Good case.
+ init();
+ internal = (void *)new TMPXItemId(5, 5);
+ error = 0;
+ mTestObject->mThumbnailFetcher->emitThumbnailReady(pmap, internal, error);
+ QCOMPARE(mTestObject->mThumbnailData.count(), 1);
+ QCOMPARE(mTestObject->mReadyThumbnailMediaIds.count(), 1);
+ QVERIFY(mTestObject->mTbnReportTimer->isActive());
+ cleanup();
+ // Good case, thumbnail report timer already running.
init();
- mTestObject->mModel->appendData("notusedfile0");
- mTestObject->mModel->appendData(fileName); // id 1
- mTestObject->mModel->appendData(fileName2); // id 2
- mTestObject->mModel->appendData("notusedfile1");
- mTestObject->mModel->appendData("notusedfile2");
- spy = new QSignalSpy(mTestObject, SIGNAL(thumbnailsFetched(QList<TMPXItemId>)));
- tnId1 = mTestObject->startFetchingThumbnail(TMPXItemId(mediaId1, 0), TB_PRIORITY);
- tnId2 = mTestObject->startFetchingThumbnail(TMPXItemId(mediaId2, 0), TB_PRIORITY);
- QVERIFY(checkThumbnailReadyCount(spy, 0));
- QCOMPARE(mTestObject->mFetchList.count(), 2);
-
- spy->clear();
- mTestObject->mThumbnailManager->emitThumbnailReady(tnId1, true);
- QVERIFY( mTestObject->mThumbnailData.contains(TMPXItemId(mediaId1, 0)) == false );
- QVERIFY( mTestObject->mThumbnailData.contains(TMPXItemId(mediaId2, 0)) == false );
- QVERIFY( mTestObject->mFetchList.contains(tnId1) == false);
- QVERIFY( mTestObject->mFetchList.contains(tnId2) );
- QVERIFY(checkThumbnailReadyCount(spy, 0));
+ internal = (void *)new TMPXItemId(5, 5);
+ error = 0;
+ mTestObject->mTbnReportTimer->start(1000000);
+ mTestObject->mThumbnailFetcher->emitThumbnailReady(pmap, internal, error);
+ QCOMPARE(mTestObject->mThumbnailData.count(), 1);
+ QCOMPARE(mTestObject->mReadyThumbnailMediaIds.count(), 1);
+ QVERIFY(mTestObject->mTbnReportTimer->isActive());
+ cleanup();
+
+ // Thumbnail report timer is null.
+ init();
+ internal = (void *)new TMPXItemId(5, 5);
+ error = 0;
+ QTimer *backup = mTestObject->mTbnReportTimer;
+ mTestObject->mTbnReportTimer = 0;
+ mTestObject->mThumbnailFetcher->emitThumbnailReady(pmap, internal, error);
+ QCOMPARE(mTestObject->mThumbnailData.count(), 1);
+ QCOMPARE(mTestObject->mReadyThumbnailMediaIds.count(), 1);
+ mTestObject->mTbnReportTimer = backup;
cleanup();
}
@@ -779,12 +707,16 @@
QVERIFY( tn != 0 );
QVERIFY( tn->isNull() == false );
QCOMPARE( tn->cacheKey(), mTestObject->mDefaultTnVideo->cacheKey() );
+ // Second call when tn has been loaded already.
+ QVERIFY(tn == mTestObject->defaultThumbnail(TMPXItemId(1, 0)));
// Tn for category
const QIcon* tn2 = mTestObject->defaultThumbnail(TMPXItemId(0, 1));
QVERIFY( tn2 != 0 );
QVERIFY( tn2->isNull() == false );
QCOMPARE( tn2->cacheKey(), mTestObject->mDefaultTnCategory->cacheKey() );
+ // Second call when tn has been loaded already.
+ QVERIFY(tn2 == mTestObject->defaultThumbnail(TMPXItemId(0, 1)));
QVERIFY(tn2->cacheKey() != tn->cacheKey());
@@ -819,16 +751,16 @@
}
// ---------------------------------------------------------------------------
-// testLayoutChangedSlot
+// testModelChangedSlot
// ---------------------------------------------------------------------------
//
-void TestVideoThumbnailData_p::testLayoutChangedSlot()
+void TestVideoThumbnailData_p::testModelChangedSlot()
{
// Empty list.
init();
- mTestObject->emitLayoutChanged();
+ mTestObject->emitModelChanged();
QVERIFY(mTestObject->mCurrentFetchIndex == 0);
- QCOMPARE(mTestObject->mFetchList.count(), 0);
+ QCOMPARE(VideoThumbnailFetcher::mRequests.count(), 0);
QVERIFY(mTestObject->mCurrentBackgroundFetchCount == 0);
QVERIFY(mTestObject->mBgFetchTimer->isActive() == false);
cleanup();
@@ -837,84 +769,17 @@
init();
for(int i = 0; i < THUMBNAIL_BACKGROUND_FETCH_AMOUNT; i++)
{
- mTestObject->mModel->appendData(QString("file") + QString::number(i));
+ mTestObject->mCurrentModel->appendData(QString("file") + QString::number(i));
}
- mTestObject->emitLayoutChanged();
+ mTestObject->emitModelChanged();
QVERIFY(mTestObject->mCurrentFetchIndex == 0);
- QCOMPARE(mTestObject->mFetchList.count(), THUMBNAIL_BACKGROUND_FETCH_AMOUNT/2);
+ QCOMPARE(VideoThumbnailFetcher::mRequests.count(), THUMBNAIL_BACKGROUND_FETCH_AMOUNT/2);
QVERIFY(mTestObject->mCurrentBackgroundFetchCount == THUMBNAIL_BACKGROUND_FETCH_AMOUNT);
QVERIFY(mTestObject->mBgFetchTimer->isActive() == false);
cleanup();
}
// ---------------------------------------------------------------------------
-// testRowsInsertedSlot
-// ---------------------------------------------------------------------------
-//
-void TestVideoThumbnailData_p::testRowsInsertedSlot()
-{
- init();
-
- // Empty list.
- mTestObject->emitRowsInserted(QModelIndex(), 0, 0);
- QVERIFY(mTestObject->mCurrentFetchIndex == 0);
- QCOMPARE(mTestObject->mFetchList.count(), 0);
- QVERIFY(mTestObject->mCurrentBackgroundFetchCount == 0);
- QVERIFY(mTestObject->mBgFetchTimer->isActive() == false);
- cleanup();
-
- init();
- // With data.
- // THUMBNAIL_BACKGROUND_FETCH_AMOUNT items in model and fetch index at 0
- init();
- for(int i = 0; i < THUMBNAIL_BACKGROUND_FETCH_AMOUNT; i++)
- {
- mTestObject->mModel->appendData(QString("file") + QString::number(i));
- }
- mTestObject->emitRowsInserted(QModelIndex(), 0, 0);
- QVERIFY(mTestObject->mCurrentFetchIndex == 0);
- QCOMPARE(mTestObject->mFetchList.count(), THUMBNAIL_BACKGROUND_FETCH_AMOUNT/2);
- QVERIFY(mTestObject->mCurrentBackgroundFetchCount == THUMBNAIL_BACKGROUND_FETCH_AMOUNT);
- QVERIFY(mTestObject->mBgFetchTimer->isActive() == false);
-
- cleanup();
-}
-
-// ---------------------------------------------------------------------------
-// testRemoveFromFetchList
-// ---------------------------------------------------------------------------
-//
-void TestVideoThumbnailData_p::testRemoveFromFetchList()
-{
- init();
-
- // Empty list.
- mTestObject->removeFromFetchList(0);
- QVERIFY(mTestObject->mBgFetchTimer->isActive() == false);
-
- // Invalid index.
- mTestObject->removeFromFetchList(-5);
- QVERIFY(mTestObject->mBgFetchTimer->isActive() == false);
-
- // With data.
- mTestObject->mFetchList.insert(0);
- mTestObject->removeFromFetchList(0);
- QVERIFY(mTestObject->mBgFetchTimer->isActive() == true);
- cleanup();
-
- init();
-
- // With more data.
- mTestObject->mFetchList.insert(0);
- mTestObject->mFetchList.insert(1);
- mTestObject->mFetchList.insert(2);
- mTestObject->removeFromFetchList(0);
- QVERIFY(mTestObject->mBgFetchTimer->isActive() == false);
-
- cleanup();
-}
-
-// ---------------------------------------------------------------------------
// testStartBackgroundFetching
// ---------------------------------------------------------------------------
//
@@ -925,15 +790,24 @@
// Bg fetch enabled
mTestObject->mBackgroundFetchingEnabled = true;
mTestObject->mCurrentFetchIndex = -5;
- mTestObject->startBackgroundFetching(10);
+ mTestObject->startBackgroundFetching(0, 10);
QVERIFY(mTestObject->mCurrentFetchIndex == 10);
// Bg fetch disabled
mTestObject->mBackgroundFetchingEnabled = false;
mTestObject->mCurrentFetchIndex = -5;
- mTestObject->startBackgroundFetching(10);
+ mTestObject->startBackgroundFetching(0, 10);
QVERIFY(mTestObject->mCurrentFetchIndex == -5);
+ // Set new model.
+ mTestObject->mBackgroundFetchingEnabled = true;
+ VideoSortFilterProxyModel *model = mTestObject->mCurrentModel;
+ mTestObject->mCurrentModel = 0;
+ mTestObject->mCurrentFetchIndex = -5;
+ mTestObject->startBackgroundFetching(model, 10);
+ QVERIFY(mTestObject->mCurrentFetchIndex == 10);
+ QVERIFY(mTestObject->mCurrentModel != 0);
+
cleanup();
}
@@ -986,7 +860,7 @@
QVERIFY(!mTestObject->mBgFetchTimer->isActive());
QVERIFY(!mTestObject->mTbnReportTimer->isActive());
- QCOMPARE(mTestObject->mFetchList.count(), 0);
+ QCOMPARE(VideoThumbnailFetcher::mRequests.count(), 0);
QCOMPARE(mTestObject->mReadyThumbnailMediaIds.count(), 0);
QCOMPARE(mTestObject->mThumbnailData.count(), 0);
@@ -998,4 +872,61 @@
cleanup();
}
+
+// ---------------------------------------------------------------------------
+// testAllThumbnailsFetchedSlot
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailData_p::testAllThumbnailsFetchedSlot()
+{
+ init();
+
+ QVERIFY(!mTestObject->mBgFetchTimer->isActive());
+ mTestObject->mThumbnailFetcher->emitAllThumbnailsFetched();
+ QVERIFY(mTestObject->mBgFetchTimer->isActive());
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testEnableThumbnailCreation
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailData_p::testEnableThumbnailCreation()
+{
+ init();
+
+ QCOMPARE(VideoThumbnailFetcher::mEnableThumbnailCreationCallCount, 0);
+ mTestObject->enableThumbnailCreation(false);
+ QCOMPARE(VideoThumbnailFetcher::mEnableThumbnailCreationCallCount, 1);
+ mTestObject->enableThumbnailCreation(true);
+ QCOMPARE(VideoThumbnailFetcher::mEnableThumbnailCreationCallCount, 2);
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testAboutToQuitSlot
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailData_p::testAboutToQuitSlot()
+{
+ init();
+
+ QVERIFY(mTestObject->mThumbnailFetcher != 0);
+ QVERIFY(mTestObject->mTbnReportTimer != 0);
+ QVERIFY(mTestObject->mBgFetchTimer != 0);
+ mTestObject->mReadyThumbnailMediaIds.append(TMPXItemId(0, 0));
+ mTestObject->mThumbnailData.insert(TMPXItemId(0, 0), 0);
+
+ mTestObject->emitAboutToQuit();
+
+ QVERIFY(mTestObject->mThumbnailFetcher == 0);
+ QVERIFY(mTestObject->mTbnReportTimer == 0);
+ QVERIFY(mTestObject->mBgFetchTimer == 0);
+ QVERIFY(mTestObject->mReadyThumbnailMediaIds.count() == 0);
+ QVERIFY(mTestObject->mThumbnailData.count() == 0);
+
+ cleanup();
+}
// End of file
--- a/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/src/videothumbnaildatatester.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/src/videothumbnaildatatester.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -29,9 +29,9 @@
VideoThumbnailDataTester::VideoThumbnailDataTester()
{
connect(this, SIGNAL(doBackgroundFetchingSignal()), this, SLOT(doBackgroundFetching()));
- connect(this, SIGNAL(layoutChangedSignal()), this, SLOT(layoutChangedSlot()));
- connect(this, SIGNAL(rowsInsertedSignal(const QModelIndex &, int, int)), this, SLOT(rowsInsertedSlot(const QModelIndex &, int, int)));
+ connect(this, SIGNAL(modelChangedSignal()), this, SLOT(modelChangedSlot()));
connect(this, SIGNAL(reportThumbnailsReadySignal()), this, SLOT(reportThumbnailsReadySlot()));
+ connect(this, SIGNAL(aboutToQuitSignal()), this, SLOT(aboutToQuitSlot()));
}
// -----------------------------------------------------------------------------
@@ -41,9 +41,9 @@
VideoThumbnailDataTester::~VideoThumbnailDataTester()
{
disconnect(this, SIGNAL(doBackgroundFetchingSignal()), this, SLOT(doBackgroundFetching()));
- disconnect(this, SIGNAL(layoutChangedSignal()), this, SLOT(layoutChangedSlot()));
- disconnect(this, SIGNAL(rowsInsertedSignal(const QModelIndex &, int, int)), this, SLOT(rowsInsertedSlot(const QModelIndex &, int, int)));
+ disconnect(this, SIGNAL(modelChangedSignal()), this, SLOT(modelChangedSlot()));
disconnect(this, SIGNAL(reportThumbnailsReadySignal()), this, SLOT(reportThumbnailsReadySlot()));
+ disconnect(this, SIGNAL(aboutToQuitSignal()), this, SLOT(aboutToQuitSlot()));
}
// -----------------------------------------------------------------------------
@@ -65,30 +65,21 @@
}
// -----------------------------------------------------------------------------
-// VideoThumbnailDataTester::emitLayoutChanged()
+// VideoThumbnailDataTester::emitModelChanged()
// -----------------------------------------------------------------------------
//
-void VideoThumbnailDataTester::emitLayoutChanged()
+void VideoThumbnailDataTester::emitModelChanged()
{
- emit layoutChangedSignal();
+ emit modelChangedSignal();
}
// -----------------------------------------------------------------------------
-// VideoThumbnailDataTester::emitRowsInserted()
+// VideoThumbnailDataTester::emitAboutToQuit()
// -----------------------------------------------------------------------------
//
-void VideoThumbnailDataTester::emitRowsInserted(const QModelIndex & parent, int start, int end)
+void VideoThumbnailDataTester::emitAboutToQuit()
{
- emit rowsInsertedSignal(parent, start, end);
-}
-
-// -----------------------------------------------------------------------------
-// VideoThumbnailDataTester::removeFromFetchList()
-// -----------------------------------------------------------------------------
-//
-void VideoThumbnailDataTester::removeFromFetchList(int tnId)
-{
- VideoThumbnailDataPrivate::removeFromFetchList(tnId);
+ emit aboutToQuitSignal();
}
// -----------------------------------------------------------------------------
@@ -137,15 +128,6 @@
}
// -----------------------------------------------------------------------------
-// VideoThumbnailDataTester::startBackgroundFetching()
-// -----------------------------------------------------------------------------
-//
-void VideoThumbnailDataTester::startBackgroundFetching(int fetchIndex)
-{
- VideoThumbnailDataPrivate::startBackgroundFetching(fetchIndex);
-}
-
-// -----------------------------------------------------------------------------
// VideoThumbnailDataTester::continueBackgroundFetch()
// -----------------------------------------------------------------------------
//
@@ -154,5 +136,24 @@
VideoThumbnailDataPrivate::continueBackgroundFetch();
}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataTester::startFetchingThumbnails()
+// -----------------------------------------------------------------------------
+//
+int VideoThumbnailDataTester::startFetchingThumbnails(const QList<QModelIndex> &indexes, int priority)
+{
+ return VideoThumbnailDataPrivate::startFetchingThumbnails(indexes, priority);
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataTester::continueBackgroundFetch()
+// -----------------------------------------------------------------------------
+//
+int VideoThumbnailDataTester::startFetchingThumbnail(TMPXItemId mediaId, int priority)
+{
+ return VideoThumbnailDataPrivate::startFetchingThumbnail(mediaId, priority);
+}
+
// End of file
--- a/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/stub/inc/thumbnailmanager_qt.h Thu Apr 01 23:13:36 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,377 +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:
-*
-*/
-
-#ifndef STUB_THUMBNAILMANAGER_QT_H
-#define STUB_THUMBNAILMANAGER_QT_H
-
-#include <QObject>
-#include <QPixmap.h>
-#include <QMap>
-
-class QString;
-class QSize;
-
-/** default priority value */
-const int tnmWrapperPriorityIdle = -100;
-
-class ThumbnailManager : public QObject
- {
- Q_OBJECT
-
-public:
- /** Thumbnail size. */
- enum ThumbnailSize
- {
- /**
- * Small thumbnail
- */
- ThumbnailSmall = 0,
- /**
- * Medium thumbnail
- */
- ThumbnailMedium,
- /**
- * Large thumbnail
- */
- ThumbnailLarge
- };
-
- /** Mode of thumbnail creation. */
- enum ThumbnailMode
- {
- /**
- * Default mode. This means that:
- * - Thumbnail must be as large as requested (unless the actual object is smaller).
- * - Smaller thumbnails may be up scaled to desired resolution.
- * - Aspect ratio is maintained and thumbnails are not cropped. The
- * resulting thumbnail may smaller in either width or height if
- * the aspect ratio of the object does not match the aspect ratio
- * of the requested size.
- */
- Default = 0,
-
- /**
- * Allow thumbnails which are smaller than requested are. Thumbnail
- * bitmaps are never up scaled if this flag is set.
- */
- AllowAnySize = 1,
-
- /**
- * New thumbnail images are not created if this flag is set. Only
- * existing thumbnails may be returned. If a requested thumbnail does
- * not exist null pixmap will be returned.
- */
- DoNotCreate = 2,
-
- /**
- * Thumbnail images are cropped to match requested aspect ratio. If
- * this mode is set, the size of the resulting thumbnail always
- * matches the requested size.
- */
- CropToAspectRatio = 4
- };
-
- /** Quality versus speed preference setting */
- enum QualityPreference
- {
- /**
- * Prefer thumbnails in the highest quality possible disregarding
- * any negative impact on performance.
- */
- OptimizeForQuality,
-
- /**
- * Get thumbnails as fast as possible, even if
- * it means lower quality.
- */
- OptimizeForPerformance
- };
-
- /** Display modes. */
- enum DisplayMode
- {
- /** No display mode */
- None,
-
- /** Monochrome display mode (1 bpp) */
- Gray2,
-
- /** Four grayscales display mode (2 bpp) */
- Gray4,
-
- /** 16 grayscales display mode (4 bpp) */
- Gray16,
-
- /** 256 grayscales display mode (8 bpp) */
- Gray256,
-
- /** Low colour GA 16 colour display mode (4 bpp) */
- Color16,
-
- /** 256 colour display mode (8 bpp) */
- Color256,
-
- /** 64,000 colour display mode (16 bpp) */
- Color64K,
-
- /** True colour display mode (24 bpp) */
- Color16M,
-
- /** (Not an actual display mode used for moving buffers containing bitmaps) */
- Rgb,
-
- /** 4096 colour display (12 bpp). */
- Color4K,
-
- /** True colour display mode (32 bpp, but top byte is unused and unspecified) */
- Color16MU,
-
- /** Display mode with alpha (24bpp colour plus 8bpp alpha) */
- Color16MA,
-
- /** Pre-multiplied Alpha display mode
- * (24bpp color multiplied with the alpha channel value, plus 8bpp alpha) */
- Color16MAP
- };
-
-public:
-
-
- /**
- * Constructor
- *
- * @param parentPtr parent
- */
- ThumbnailManager( QObject* parentPtr = NULL );
-
- /**
- * Destructor
- */
- virtual ~ThumbnailManager();
-
- /**
- * Get quality versus performance preference.
- *
- * @return quality versus performance preference
- */
- QualityPreference qualityPreference() const;
-
- /**
- * Set quality versus performance preference.
- *
- * @param qualityPreference New quality versus performance preference
- * value.
- * @return true on success
- */
- bool setQualityPreference( QualityPreference qualityPreference );
-
- /**
- * Get the current display mode for thumbnail bitmaps.
- *
- * @return current display mode for thumbnail bitmaps
- */
- DisplayMode displayMode() const;
-
- /**
- * Set new display mode for thumbnail bitmaps.
- *
- * @param displayMode new display mode for thumbnail bitmaps.
- * @return true on success
- */
- bool setDisplayMode( DisplayMode displayMode );
-
- /**
- * Get the current desired size for thumbnail bitmaps.
- *
- * @return Current desired size for thumbnail bitmaps (in pixels).
- */
- QSize thumbnailSize() const;
-
- /**
- * Set desired size for thumbnail bitmaps.
- *
- * @param thumbnailSize New desired thumbnail size.
- * @return true on success
- */
- bool setThumbnailSize( const QSize& thumbnailSize );
-
- /**
- * Set desired size for thumbnail bitmaps.
- *
- * @param thumbnailSize New desired thumbnail size.
- * @return true on success
- */
- bool setThumbnailSize( ThumbnailSize thumbnailSize );
-
- /**
- * Get current mode for thumbnail generation.
- *
- * @return Current mode.
- */
- ThumbnailMode mode() const;
-
- /**
- * Set mode for thumbnail generation.
- *
- * @param mode New flags.
- * @return true on success
- */
- bool setMode( ThumbnailMode mode );
-
- /**
- * Get a thumbnail for an object file. If a thumbnail already exists, it
- * is loaded and if a thumbnail does not exist, it is created
- * transparently. If thumbnail loadinf fails thumbnailReady signal is emited
- * with null pixmap and error code.
- *
- * @param fileName Source object or file
- * @param clientData Pointer to arbitrary client data.
- * This pointer is not used by the API for
- * anything other than returning it in the
- * ThumbnailReady signal.
- * @param priority Priority for this operation
- * @return Thumbnail request ID or -1 if request failed. This can be used to
- * cancel the request or change priority.
- * The ID is specific to this tnm
- * instance and may not be shared with other
- * instances.
- */
- int getThumbnail( const QString& fileName, void * clientData = NULL,
- int priority = tnmWrapperPriorityIdle );
-
- /**
- * Get a persistent thumbnail for an object file. If a thumbnail already
- * exists, it is loaded and if a thumbnail does not exist, it is created
- * transparently. If thumbnail loading fails thumbnailReady signal is emited
- * with null pixmap and error code.
- *
- * @param thumbnailId Thumbnail ID
- * @param clientData Pointer to arbitrary client data.
- * This pointer is not used by the API for
- * anything other than returning it in the
- * ThumbnailReady signal.
- * @param priority Priority for this operation
- * @return Thumbnail request ID or -1 if request failed. This can be used to
- * cancel the request or change priority.
- * The ID is specific to this tnm
- * instance and may not be shared with other
- * instances.
- */
- int getThumbnail( unsigned long int thumbnailId, void * clientData = NULL,
- int priority = tnmWrapperPriorityIdle );
-
- /**
- * Set a thumbnail for an object file generated from pixmap delivered.
- * thumbnailReady() signal will be emited when the operation is complete.
- *
- * @param source Pixmap from which the thumbnail will be created
- * @param fileName file name
- * @param clientData Pointer to arbitrary client data.
- * This pointer is not used by the API for
- * anything other than returning it in the
- * ThumbnailReady callback.
- * @param priority Priority for this operation
- * @return Thumbnail request ID or -1 if request failed. This can be used to
- * cancel the request or change priority.
- *
- */
- int setThumbnail( const QPixmap& source, const QString& fileName,
- void * clientData = NULL, int priority = tnmWrapperPriorityIdle );
-
- /**
- * Delete all thumbnails for a given object. This is an asynchronous
- * operation, which always returns immediately.
- *
- * @param fileName Source file
- */
- void deleteThumbnails( const QString& fileName );
-
- /**
- * Delete all thumbnails for a given object. This is an asynchronous
- * operation, which always returns immediately.
- *
- * @param thumbnailId thumbnail id
- */
- void deleteThumbnails( unsigned long int thumbnailId );
-
- /**
- * Cancel a thumbnail operation.
- *
- * @param id Request ID for the operation to be cancelled.
- * @return true if cancelling was successful.
- */
- bool cancelRequest( int id );
-
- /**
- * Change the priority of a queued thumbnail operation.
- *
- * @param id Request ID for the request which to assign a new
- * priority.
- * @param newPriority New priority value
- * @return true if change was successful.
- */
- bool changePriority( int id, int newPriority );
-
-signals:
- /**
- * Final thumbnail bitmap generation or loading is complete.
- *
- * @param pixmap An object representing the resulting thumbnail.
- * @param clientData Client data
- * @param id Request ID for the operation
- * @param errorCode error code
- */
- void thumbnailReady( QPixmap , void * , int , int );
-
-public: // Test methods.
-
- void emitThumbnailReady(int tnId, bool emitNullThumb = false);
-
-public: // Test data.
-
- ThumbnailSize mThumbSize;
- QualityPreference mQuality;
-
- struct TnRequest
- {
- QString name;
- void *id;
- int priority;
- bool cancelled;
-
- TnRequest(QString name, void *id, int priority, bool cancelled) {
- this->name = name;
- this->id = id;
- this->priority = priority;
- this->cancelled = cancelled;
- }
-
- TnRequest() {
- name = QString("");
- id = 0;
- priority = tnmWrapperPriorityIdle;
- cancelled = false;
- }
- };
-
- static QMap<int, TnRequest> mRequests;
-
- static bool mGetThumbFails;
- static int mThumbnailReadyError;
-};
-
-#endif // STUB_THUMBNAILMANAGER_QT
--- a/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/stub/inc/videocollectionwrapper.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/stub/inc/videocollectionwrapper.h Thu Apr 01 23:22:15 2010 +0300
@@ -35,6 +35,14 @@
Q_OBJECT
public: // Constructor
+
+ enum TModelType
+ {
+ EAllVideos,
+ ECollections,
+ ECollectionContent,
+ EGeneric
+ };
/**
* Returns singleton instance for this class.
@@ -43,20 +51,14 @@
*
* @return The singleton instance.
*/
- static VideoCollectionWrapper *instance();
-
- /**
- * Decreases the reference count, when count reaches zero cleanup is done.
- *
- */
- void decreaseReferenceCount();
+ static VideoCollectionWrapper &instance();
/**
* Returns pointer to model
*
* @return address to model or NULL if fails.
*/
- VideoSortFilterProxyModel* getModel();
+ VideoSortFilterProxyModel* getModel(TModelType type);
/* Additional functions needed for testing purposes */
--- a/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/stub/inc/videosortfilterproxymodel.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/stub/inc/videosortfilterproxymodel.h Thu Apr 01 23:22:15 2010 +0300
@@ -67,6 +67,12 @@
*
*/
void back();
+
+ /**
+ * Return source model.
+ *
+ */
+ VideoSortFilterProxyModel* sourceModel();
public: // Simplified data access.
/**
@@ -87,6 +93,21 @@
*/
QModelIndex mapToSource(const QModelIndex &proxyIndex) const;
+signals:
+
+ /**
+ * 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();
+
public: // Test helper methods.
static void reset();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/stub/inc/videothumbnailfetcher.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,186 @@
+/*
+* 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: VideoThumbnailFetcher class definition
+*
+*/
+
+#ifndef __VIDEOTHUMBNAILDATAFETCHER_H__
+#define __VIDEOTHUMBNAILDATAFETCHER_H__
+
+// INCLUDES
+#include <qobject.h>
+#include <qicon.h>
+#include <qlist.h>
+#include <qhash.h>
+#include <qmap.h>
+#include <qpixmap.h>
+
+// FORWARD DECLARATIONS
+
+
+class ThumbnailFetchData
+{
+ public:
+ QString mFileName;
+ int mPriority;
+ void *mInternal;
+};
+
+class VideoThumbnailFetcher : public QObject
+{
+ /**
+ * defined to be able to use signals and slots
+ */
+ Q_OBJECT
+
+public:
+
+ /**
+ * Default constructor
+ */
+ VideoThumbnailFetcher();
+
+ /**
+ * Desctructor
+ */
+ ~VideoThumbnailFetcher();
+
+ /**
+ * Adds thumbnail fetch to the fetch list. pauseFetching should be called
+ * before adding fetches for performance reasons. After all fetches have
+ * been added, call continueFetching to start the fetch process which passes
+ * the internal data to thumbnail manager. Signal thumbnailReady is emitted
+ * when fetch is complete.
+ *
+ * @param fileName path to the media.
+ * @param internal data identifying the media.
+ * @param priority priority for the fetch.
+ *
+ */
+ void addFetch(const QString fileName, void *internal, int priority);
+
+ /**
+ * Empties fetch list. This does not cancel the possible ongoing fetch on
+ * thumbnail manager side.
+ *
+ */
+ void cancelFetches();
+
+ /**
+ * Returns count of the fetches.
+ *
+ */
+ int fetchCount();
+
+ /**
+ * Pauses thumbnail fetching process. This does not pause the possible
+ * ongoing fetch on thumbnail manager side.
+ *
+ */
+ void pauseFetching();
+
+ /**
+ * Continues the fetching process. All fetches added with addFetch are
+ * started without create thumbnail flag. If there's not any of those,
+ * starts creating thumbnails for fetches that have no thumbnail yet.
+ * Signal allThumbnailsFetched is emitted if there's nothing to do.
+ *
+ */
+ void continueFetching();
+
+ /**
+ * Enables or disables the thumbnail creation for videos that do
+ * not have thumbnail already in the database.
+ *
+ * @param enable true enables thumbnail creation, false disables.
+ *
+ */
+ void enableThumbnailCreation(bool enable);
+
+// Test helper methods
+public:
+
+ void emitThumbnailReady(QPixmap pixmap, void *internal, int error);
+
+ void emitAllThumbnailsFetched();
+
+signals:
+
+ /**
+ * Signaled after signal from thumbnail manager has been processed and
+ * thumbnail fetch process is complete.
+ *
+ * @param tnData thumbnail
+ * @param internal internal data to identify the request
+ * @param error possible error code from thumbnail manager ( 0 == ok )
+ *
+ */
+ void thumbnailReady(QPixmap tnData, void *internal, int error);
+
+ /**
+ * Signaled when all the fetches have been done.
+ *
+ */
+ void allThumbnailsFetched();
+
+public:
+
+ struct TnRequest
+ {
+ QString name;
+ void *id;
+ int priority;
+ bool cancelled;
+
+ TnRequest(QString name, void *id, int priority, bool cancelled) {
+ this->name = name;
+ this->id = id;
+ this->priority = priority;
+ this->cancelled = cancelled;
+ }
+
+ TnRequest() {
+ name = QString("");
+ id = 0;
+ priority = -1;
+ cancelled = false;
+ }
+ };
+
+ static QMap<int, TnRequest> mRequests;
+
+public: // Data
+
+ static int mConstructorCallCount;
+ static int mDestructorCallCount;
+ static int mAddFetchCallCount;
+ static int mCancelFetchesCallCount;
+ static int mFetchCountCallCount;
+ static int mPauseFetchingCallCount;
+ static int mContinueFetchingCallCount;
+ static int mEnableThumbnailCreationCallCount;
+
+ static bool mAddFetchFails;
+ static int mThumbnailReadyError;
+
+ /*
+ static int mxxxCallCount;
+ static int mxxxCallCount;
+ static int mxxxCallCount;
+ static int mxxxCallCount;
+ static int mxxxCallCount;
+ static int mxxxCallCount;*/
+};
+
+#endif // __VIDEOTHUMBNAILDATAFETCHER_H__
--- a/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/stub/src/thumbnailmanager_qt.cpp Thu Apr 01 23:13:36 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,165 +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:
-*
-*/
-
-#include <qsize.h>
-#include "thumbnailmanager_qt.h"
-#include <QMap>
-
-QMap<int, ThumbnailManager::TnRequest> ThumbnailManager::mRequests = QMap<int, ThumbnailManager::TnRequest>();
-
-bool ThumbnailManager::mGetThumbFails = false;
-int ThumbnailManager::mThumbnailReadyError = 0;
-
-ThumbnailManager::ThumbnailManager( QObject* parentPtr ) :
-QObject( parentPtr )
-{
-
-}
-
-ThumbnailManager::~ThumbnailManager()
-{
-
-}
-
-ThumbnailManager::QualityPreference ThumbnailManager::qualityPreference() const
-{
- return mQuality;
-}
-
-bool ThumbnailManager::setQualityPreference( QualityPreference
- qualityPreference )
-{
- mQuality = qualityPreference;
- return true;
-}
-
-ThumbnailManager::DisplayMode ThumbnailManager::displayMode() const
-{
- return Color16MAP;
-}
-
-bool ThumbnailManager::setDisplayMode( ThumbnailManager::DisplayMode displayMode )
-{
- Q_UNUSED(displayMode);
- return true;
-}
-
-QSize ThumbnailManager::thumbnailSize() const
-{
- return QSize(128, 128); // ThumbnailMedium?
-}
-
-bool ThumbnailManager::setThumbnailSize( const QSize& thumbnailSize )
-{
- Q_UNUSED(thumbnailSize);
- return true;
-}
-
-bool ThumbnailManager::setThumbnailSize( ThumbnailSize thumbnailSize )
-{
- mThumbSize = thumbnailSize;
- return true;
-}
-
-ThumbnailManager::ThumbnailMode ThumbnailManager::mode() const
-{
- return Default;
-}
-
-bool ThumbnailManager::setMode( ThumbnailMode mode )
-{
- Q_UNUSED(mode);
- return true;
-}
-
-int ThumbnailManager::getThumbnail( const QString& fileName, void * clientData,
- int priority )
-{
- if(mGetThumbFails) return -1;
-
- int id = mRequests.count();
- mRequests[id] = TnRequest(fileName, clientData, priority, false);
- return id;
-}
-
-int ThumbnailManager::getThumbnail( unsigned long int thumbnailId, void * clientData,
- int priority )
-{
- Q_UNUSED(thumbnailId);
- Q_UNUSED(clientData);
- Q_UNUSED(priority);
- return 0;
-}
-
-int ThumbnailManager::setThumbnail( const QPixmap& source, const QString& filename,
- void * clientData , int priority )
-{
- Q_UNUSED(source);
- Q_UNUSED(filename);
- Q_UNUSED(clientData);
- Q_UNUSED(priority);
- return 0;
-}
-
-void ThumbnailManager::deleteThumbnails( const QString& fileName )
-{
- Q_UNUSED(fileName);
-}
-
-void ThumbnailManager::deleteThumbnails( unsigned long int thumbnailId )
-{
- Q_UNUSED(thumbnailId);
-}
-
-bool ThumbnailManager::cancelRequest( int id )
-{
- if(mRequests.contains(id)) {
- mRequests[id].cancelled = true;
- }
- return true;
-}
-
-bool ThumbnailManager::changePriority( int id, int newPriority )
-{
- if(mRequests.contains(id)) {
- mRequests[id].priority = newPriority;
- }
- return true;
-}
-
-void ThumbnailManager::emitThumbnailReady(int tnId, bool emitNullThumb)
-{
- if(emitNullThumb)
- {
- QPixmap pixmap;
- int* internal = new int(0);
- emit thumbnailReady(pixmap, internal, tnId, mThumbnailReadyError);
- }
- else
- {
- QPixmap pixmap(100,100);
- pixmap.fill(Qt::white);
- void* internal = 0;
-
- if(mRequests.contains(tnId)) {
- internal = mRequests[tnId].id;
- mRequests.remove(tnId);
- }
- emit thumbnailReady(pixmap, internal, tnId, mThumbnailReadyError);
- }
-}
-
--- a/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/stub/src/videocollectionwrapper.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/stub/src/videocollectionwrapper.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -28,30 +28,10 @@
// VideoCollectionWrapper::instance()
// -----------------------------------------------------------------------------
//
-VideoCollectionWrapper *VideoCollectionWrapper::instance()
+VideoCollectionWrapper &VideoCollectionWrapper::instance()
{
- if(!mInstance)
- {
- mInstance = new VideoCollectionWrapper();
- }
- mInstance->mReferenceCount++;
- return mInstance;
-}
-
-// -----------------------------------------------------------------------------
-// VideoCollectionWrapper::decreaseReferenceCount()
-// -----------------------------------------------------------------------------
-//
-void VideoCollectionWrapper::decreaseReferenceCount()
-{
- if(mInstance)
- {
- if(--mInstance->mReferenceCount == 0)
- {
- delete mInstance;
- mInstance = NULL;
- }
- }
+ static VideoCollectionWrapper _staticWrapper;
+ return _staticWrapper;
}
// -----------------------------------------------------------------------------
@@ -75,7 +55,7 @@
// VideoCollectionWrapper::open()
// -----------------------------------------------------------------------------
//
-VideoSortFilterProxyModel* VideoCollectionWrapper::getModel()
+VideoSortFilterProxyModel* VideoCollectionWrapper::getModel(TModelType type)
{
return mModel;
}
--- a/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/stub/src/videosortfilterproxymodel.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/stub/src/videosortfilterproxymodel.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -131,5 +131,10 @@
return QModelIndex(proxyIndex);
}
+VideoSortFilterProxyModel* VideoSortFilterProxyModel::sourceModel()
+{
+ return this;
+}
+
// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/stub/src/videothumbnailfetcher.cpp Thu Apr 01 23:22:15 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: VideoThumbnailFetcher class implementation
+*
+*/
+
+// INCLUDE FILES
+
+#include <qpixmap.h>
+#include <qlist.h>
+
+#include "videothumbnailfetcher.h"
+
+int VideoThumbnailFetcher::mConstructorCallCount = 0;
+int VideoThumbnailFetcher::mDestructorCallCount = 0;
+int VideoThumbnailFetcher::mAddFetchCallCount = 0;
+int VideoThumbnailFetcher::mCancelFetchesCallCount = 0;
+int VideoThumbnailFetcher::mFetchCountCallCount = 0;
+int VideoThumbnailFetcher::mPauseFetchingCallCount = 0;
+int VideoThumbnailFetcher::mContinueFetchingCallCount = 0;
+int VideoThumbnailFetcher::mEnableThumbnailCreationCallCount = 0;
+
+bool VideoThumbnailFetcher::mAddFetchFails = false;
+int VideoThumbnailFetcher::mThumbnailReadyError = 0;
+
+QMap<int, VideoThumbnailFetcher::TnRequest> VideoThumbnailFetcher::mRequests =
+ QMap<int, VideoThumbnailFetcher::TnRequest>();
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailFetcher::VideoThumbnailFetcher()
+// -----------------------------------------------------------------------------
+//
+VideoThumbnailFetcher::VideoThumbnailFetcher()
+{
+ mConstructorCallCount++;
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailFetcher::~VideoThumbnailFetcher()
+// -----------------------------------------------------------------------------
+//
+VideoThumbnailFetcher::~VideoThumbnailFetcher()
+{
+ mConstructorCallCount++;
+ cancelFetches();
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailFetcher::addFetch()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailFetcher::addFetch(const QString fileName, void *internal, int priority)
+{
+ mAddFetchCallCount++;
+ if(mAddFetchFails)
+ return;
+
+ int id = mRequests.count();
+ mRequests[id] = TnRequest(fileName, internal, priority, false);
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailFetcher::continueFetching()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailFetcher::continueFetching()
+{
+ mContinueFetchingCallCount++;
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailFetcher::pauseFetching()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailFetcher::pauseFetching()
+{
+ mPauseFetchingCallCount++;
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailFetcher::cancelFetches()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailFetcher::cancelFetches()
+{
+ mCancelFetchesCallCount++;
+ mRequests.clear();
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailFetcher::fetchCount()
+// -----------------------------------------------------------------------------
+//
+int VideoThumbnailFetcher::fetchCount()
+{
+ mFetchCountCallCount++;
+ return mRequests.count();
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailFetcher::enableThumbnailCreation()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailFetcher::enableThumbnailCreation(bool enable)
+{
+ mEnableThumbnailCreationCallCount++;
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailFetcher::emitThumbnailReady()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailFetcher::emitThumbnailReady(QPixmap pixmap, void *internal, int error)
+{
+ emit thumbnailReady(pixmap, internal, error);
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailFetcher::emitAllThumbnailsFetched()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailFetcher::emitAllThumbnailsFetched()
+{
+ emit allThumbnailsFetched();
+}
+
+// End of file.
--- a/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/testvideothumbnaildata_p.pro Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/testvideothumbnaildata_p.pro Thu Apr 01 23:22:15 2010 +0300
@@ -19,9 +19,12 @@
DEFINES += BUILD_VIDEOCOLLECTION_DLL
DEPENDPATH += . \
inc \
- src
+ src \
+ stub/src \
+ stub/inc
-INCLUDEPATH = stub/inc \
+INCLUDEPATH = . \
+ stub/inc \
/epoc32/include \
/epoc32/include/osextensions/stdapis \
/epoc32/include/osextensions/stdapis/sys \
@@ -50,7 +53,7 @@
# Input
HEADERS += inc/testvideothumbnaildata_p.h \
inc/videothumbnaildatatester.h \
- stub/inc/thumbnailmanager_qt.h \
+ stub/inc/videothumbnailfetcher.h \
stub/inc/videocollectionwrapper.h \
stub/inc/videosortfilterproxymodel.h \
../../inc/videothumbnaildata_p.h \
@@ -58,7 +61,7 @@
SOURCES += src/testvideothumbnaildata_p.cpp \
src/videothumbnaildatatester.cpp \
- stub/src/thumbnailmanager_qt.cpp \
+ stub/src/videothumbnailfetcher.cpp \
stub/src/videocollectionwrapper.cpp \
stub/src/videosortfilterproxymodel.cpp \
../../src/videothumbnaildata_p.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnailfetcher/inc/testvideothumbnailfetcher.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,56 @@
+/**
+* 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: Unit test for methods in VideoThumbnailFetcher
+*
+*/
+
+#ifndef __TESTVIDEOTHUMBNAILFETCHER_H__
+#define __TESTVIDEOTHUMBNAILFETCHER_H__
+
+// INCLUDES
+#include <QtTest/QtTest>
+
+// FORWARD DECLARATIONS
+class VideoThumbnailFetcherTester;
+
+class TestVideoThumbnailFetcher : public QObject
+{
+ Q_OBJECT
+
+ void init();
+
+ void cleanup();
+
+ // test functions for the test framework
+private slots:
+
+ void testConstructDestruct();
+ void testAddFetch();
+ void testCancelFetches();
+ void testFetchCount();
+ void testPauseFetching();
+ void testContinueFetching();
+ void testEnableThumbnailCreation();
+ void testStartThumbnailFetches();
+ void testStartThumbnailCreation();
+ void testThumbnailReadySlot();
+
+private:
+ VideoThumbnailFetcherTester *mTestObject;
+
+};
+
+#endif // __TESTVIDEOTHUMBNAILFETCHER_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnailfetcher/inc/videothumbnailfetchertester.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,56 @@
+/**
+* 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 VideoThumbnailFetcher
+*
+*/
+
+#ifndef _VIDEOTHUMBNAILFETCHERTESTER_H_
+#define _VIDEOTHUMBNAILFETCHERTESTER_H_
+
+// INCLUDES
+#include <QObject>
+#include "videothumbnailfetcher.h"
+
+class VideoThumbnailFetcherTester : public VideoThumbnailFetcher
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * Default constructor
+ */
+ VideoThumbnailFetcherTester();
+
+ /**
+ * Destructor
+ */
+ virtual ~VideoThumbnailFetcherTester();
+
+ //
+ // Test methods for VideoThumbnailFetcher's methods.
+ //
+
+ void startThumbnailFetches();
+
+ void startThumbnailCreation();
+
+private:
+
+};
+
+#endif // _VIDEOTHUMBNAILFETCHERTESTER_H_
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnailfetcher/src/testvideothumbnailfetcher.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,465 @@
+/**
+* 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: Unit test for methods in VideoThumbnailFetcher
+*
+*/
+
+// INCLUDES
+#include <hbapplication.h>
+#include <hbinstance.h>
+#include <qlist.h>
+#include <qhash.h>
+
+#include "testvideothumbnailfetcher.h"
+
+#include "e32std.h"
+
+#define private public
+#define protected public
+#include "videothumbnailfetchertester.h"
+#undef private
+#undef protected
+
+#include "videothumbnailfetcher.h"
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ HbApplication app(argc, argv);
+ HbMainWindow window;
+
+ TestVideoThumbnailFetcher 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\\TestVideoThumbnailFetcher.txt";
+ res = QTest::qExec(&tv, 3, pass);
+ }
+
+ return res;
+}
+
+// ---------------------------------------------------------------------------
+// init
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailFetcher::init()
+{
+ mTestObject = new VideoThumbnailFetcherTester();
+
+ ThumbnailManager::mGetThumbFails = false;
+ ThumbnailManager::mThumbnailReadyError = 0;
+}
+
+// ---------------------------------------------------------------------------
+// cleanup
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailFetcher::cleanup()
+{
+ delete mTestObject;
+ mTestObject = 0;
+
+ ThumbnailManager::mRequests.clear();
+}
+
+// ---------------------------------------------------------------------------
+// testConstructDestruct
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailFetcher::testConstructDestruct()
+{
+ mTestObject = new VideoThumbnailFetcherTester();
+ QVERIFY(mTestObject->mThumbnailManager != 0);
+ delete mTestObject;
+ mTestObject = 0;
+}
+
+// ---------------------------------------------------------------------------
+// testAddFetch
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailFetcher::testAddFetch()
+{
+ init();
+
+ mTestObject->addFetch(QString(), 0, 0);
+ QCOMPARE(mTestObject->mFetchList.count(), 1);
+
+ mTestObject->addFetch("test", 0, 0);
+ QCOMPARE(mTestObject->mFetchList.count(), 2);
+
+ int *internal = new int;
+ mTestObject->addFetch("test", internal, 0);
+ QCOMPARE(mTestObject->mFetchList.count(), 3);
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testCancelFetches
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailFetcher::testCancelFetches()
+{
+ init();
+
+ mTestObject->addFetch(QString(), 0, 0);
+ mTestObject->cancelFetches();
+ QCOMPARE(mTestObject->mFetchList.count(), 0);
+ QCOMPARE(mTestObject->mStartedFetchList.count(), 0);
+ QCOMPARE(mTestObject->mCreationList.count(), 0);
+
+ mTestObject->addFetch("test", 0, 0);
+ mTestObject->cancelFetches();
+ QCOMPARE(mTestObject->mFetchList.count(), 0);
+ QCOMPARE(mTestObject->mStartedFetchList.count(), 0);
+ QCOMPARE(mTestObject->mCreationList.count(), 0);
+
+ int *internal = new int;
+ mTestObject->addFetch("test", internal, 0);
+ mTestObject->cancelFetches();
+ QCOMPARE(mTestObject->mFetchList.count(), 0);
+ QCOMPARE(mTestObject->mStartedFetchList.count(), 0);
+ QCOMPARE(mTestObject->mCreationList.count(), 0);
+
+ for(int i = 0; i < 10; i ++)
+ mTestObject->addFetch(QString(), 0, i);
+ mTestObject->cancelFetches();
+ QCOMPARE(mTestObject->mFetchList.count(), 0);
+ QCOMPARE(mTestObject->mStartedFetchList.count(), 0);
+ QCOMPARE(mTestObject->mCreationList.count(), 0);
+
+ mTestObject->mStartedFetchList.insert(0, new VideoThumbnailFetcher::ThumbnailFetchData());
+ mTestObject->cancelFetches();
+ QCOMPARE(mTestObject->mFetchList.count(), 0);
+ QCOMPARE(mTestObject->mStartedFetchList.count(), 0);
+ QCOMPARE(mTestObject->mCreationList.count(), 0);
+
+ mTestObject->mCreationList.append(new VideoThumbnailFetcher::ThumbnailFetchData());
+ mTestObject->cancelFetches();
+ QCOMPARE(mTestObject->mFetchList.count(), 0);
+ QCOMPARE(mTestObject->mStartedFetchList.count(), 0);
+ QCOMPARE(mTestObject->mCreationList.count(), 0);
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testFetchCount
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailFetcher::testFetchCount()
+{
+ init();
+
+ mTestObject->mFetchList.append(new VideoThumbnailFetcher::ThumbnailFetchData());
+ QCOMPARE(mTestObject->fetchCount(), 1);
+
+ mTestObject->mStartedFetchList.insert(0, new VideoThumbnailFetcher::ThumbnailFetchData());
+ QCOMPARE(mTestObject->fetchCount(), 2);
+
+ mTestObject->mCreationList.append(new VideoThumbnailFetcher::ThumbnailFetchData());
+ QCOMPARE(mTestObject->fetchCount(), 3);
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testPauseFetching
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailFetcher::testPauseFetching()
+{
+ init();
+
+ QVERIFY(!mTestObject->mPaused);
+ mTestObject->pauseFetching();
+ QVERIFY(mTestObject->mPaused);
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testContinueFetching
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailFetcher::testContinueFetching()
+{
+ init();
+ mTestObject->mFetchList.append(new VideoThumbnailFetcher::ThumbnailFetchData());
+ mTestObject->continueFetching();
+ QCOMPARE(mTestObject->fetchCount(), 1);
+ cleanup();
+
+ init();
+ mTestObject->mCreationList.insert(0, new VideoThumbnailFetcher::ThumbnailFetchData());
+ mTestObject->continueFetching();
+ QCOMPARE(mTestObject->fetchCount(), 0);
+ cleanup();
+
+ // Test when there's nothing to fetch
+ init();
+ QSignalSpy* spy = new QSignalSpy(mTestObject, SIGNAL(allThumbnailsFetched()));
+ mTestObject->continueFetching();
+ QCOMPARE(spy->count(), 1);
+ delete spy;
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testEnableThumbnailCreation
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailFetcher::testEnableThumbnailCreation()
+{
+ init();
+
+ mTestObject->enableThumbnailCreation(false);
+ QVERIFY(!mTestObject->mTbnCreationEnabled);
+
+ mTestObject->enableThumbnailCreation(true);
+ QVERIFY(mTestObject->mTbnCreationEnabled);
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testStartThumbnailFetches
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailFetcher::testStartThumbnailFetches()
+{
+ // Test when thumbnail manager is null.
+ init();
+ mTestObject->mFetchList.append(new VideoThumbnailFetcher::ThumbnailFetchData());
+ delete mTestObject->mThumbnailManager;
+ mTestObject->mThumbnailManager = 0;
+ mTestObject->startThumbnailFetches();
+ QCOMPARE(mTestObject->mFetchList.count(), 1);
+ cleanup();
+
+ // Test when nothing to fetch.
+ init();
+ mTestObject->startThumbnailFetches();
+ QVERIFY(mTestObject->mThumbnailManager->mode() == ThumbnailManager::DoNotCreate);
+ QCOMPARE(mTestObject->fetchCount(), 0);
+ cleanup();
+
+ // Test when there's something to fetch.
+ init();
+ for(int i = 0; i < 10; i++)
+ {
+ int *internal = new int(i);
+ mTestObject->addFetch("test", internal, i);
+ }
+ QCOMPARE(mTestObject->mFetchList.count(), 10);
+ mTestObject->startThumbnailFetches();
+ QCOMPARE(mTestObject->mFetchList.count(), 0);
+ QCOMPARE(mTestObject->mStartedFetchList.count(), 10);
+ QCOMPARE(mTestObject->mThumbnailManager->mRequests.count(), 10);
+ cleanup();
+
+ // Test when request to thumbnail manager fails.
+ init();
+ ThumbnailManager::mGetThumbFails = true;
+ int *internal = new int(0);
+ mTestObject->addFetch("test", internal, 0);
+ QCOMPARE(mTestObject->mFetchList.count(), 1);
+ mTestObject->startThumbnailFetches();
+ QCOMPARE(mTestObject->mFetchList.count(), 0);
+ QCOMPARE(mTestObject->mStartedFetchList.count(), 0);
+ QCOMPARE(mTestObject->mThumbnailManager->mRequests.count(), 0);
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testStartThumbnailCreation
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailFetcher::testStartThumbnailCreation()
+{
+ init();
+
+ // Test when thumbnail manager is null.
+ init();
+ mTestObject->mCreationList.insert(0, new VideoThumbnailFetcher::ThumbnailFetchData());
+ delete mTestObject->mThumbnailManager;
+ mTestObject->mThumbnailManager = 0;
+ mTestObject->startThumbnailCreation();
+ QCOMPARE(mTestObject->mCreationList.count(), 1);
+ cleanup();
+
+ // Test when thumbnail creation is disabled.
+ init();
+ mTestObject->mCreationList.insert(0, new VideoThumbnailFetcher::ThumbnailFetchData());
+ mTestObject->mTbnCreationEnabled = false;
+ mTestObject->startThumbnailCreation();
+ QCOMPARE(mTestObject->mCreationList.count(), 1);
+ cleanup();
+
+ // Test when nothing to fetch.
+ init();
+ mTestObject->startThumbnailCreation();
+ QVERIFY(mTestObject->mThumbnailManager->mode() == ThumbnailManager::CropToAspectRatio);
+ QCOMPARE(mTestObject->fetchCount(), 0);
+ cleanup();
+
+ // Test when there's something to fetch.
+ init();
+ for(int i = 0; i < 10; i++)
+ {
+ VideoThumbnailFetcher::ThumbnailFetchData *fetch = new VideoThumbnailFetcher::ThumbnailFetchData();
+ fetch->mFileName = "test";
+ fetch->mInternal = 0;
+ mTestObject->mCreationList.insert(0, fetch);
+ }
+ QCOMPARE(mTestObject->mCreationList.count(), 10);
+ mTestObject->startThumbnailCreation();
+ QCOMPARE(mTestObject->mCreationList.count(), 9);
+ QCOMPARE(mTestObject->mStartedFetchList.count(), 0);
+ QCOMPARE(mTestObject->mThumbnailManager->mRequests.count(), 1);
+ cleanup();
+
+ // Test when request to thumbnail manager fails.
+ init();
+ ThumbnailManager::mGetThumbFails = true;
+ mTestObject->mCreationList.insert(0, new VideoThumbnailFetcher::ThumbnailFetchData());
+ mTestObject->startThumbnailCreation();
+ QCOMPARE(mTestObject->mCreationList.count(), 0);
+ QCOMPARE(mTestObject->mFetchList.count(), 0);
+ QCOMPARE(mTestObject->mStartedFetchList.count(), 0);
+ QCOMPARE(mTestObject->mThumbnailManager->mRequests.count(), 0);
+ cleanup();
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testThumbnailReadySlot
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailFetcher::testThumbnailReadySlot()
+{
+ QPixmap pmap;
+ int requestId = 5;
+ int *internal = 0;
+ int error = 0;
+ QSignalSpy* spy = 0;
+
+ // Internal parameter is null, started fetches do not contain the fetch.
+ init();
+ spy = new QSignalSpy(mTestObject, SIGNAL( thumbnailReady(QPixmap, void*, int) ));
+ mTestObject->mThumbnailManager->emitThumbnailReady(pmap, internal, requestId, error);
+ QCOMPARE(spy->count(), 1);
+ delete spy; spy = 0;
+ cleanup();
+
+ // Internal parameter is null, started fetches contains the fetch.
+ init();
+ spy = new QSignalSpy(mTestObject, SIGNAL( thumbnailReady(QPixmap, void*, int) ));
+ mTestObject->mStartedFetchList.insert(requestId, new VideoThumbnailFetcher::ThumbnailFetchData());
+ mTestObject->mThumbnailManager->emitThumbnailReady(pmap, internal, requestId, error);
+ QCOMPARE(spy->count(), 1);
+ delete spy; spy = 0;
+ cleanup();
+
+ // Test error handling.
+ init();
+ spy = new QSignalSpy(mTestObject, SIGNAL( thumbnailReady(QPixmap, void*, int) ));
+ error = -5;
+ mTestObject->mStartedFetchList.insert(requestId, new VideoThumbnailFetcher::ThumbnailFetchData());
+ mTestObject->mThumbnailManager->emitThumbnailReady(pmap, internal, requestId, error);
+ QCOMPARE(spy->count(), 1);
+ delete spy; spy = 0;
+ cleanup();
+
+ // Fetch fails because thumbnail was not created yet, fetch list contains the request.
+ init();
+ spy = new QSignalSpy(mTestObject, SIGNAL( thumbnailReady(QPixmap, void*, int) ));
+ error = -1;
+ requestId = 5;
+ internal = new int(5);
+ mTestObject->mStartedFetchList.insert(requestId, new VideoThumbnailFetcher::ThumbnailFetchData());
+ mTestObject->mStartedFetchList.insert(requestId+1, new VideoThumbnailFetcher::ThumbnailFetchData());
+ mTestObject->mThumbnailManager->emitThumbnailReady(pmap, internal, requestId, error);
+ QCOMPARE(spy->count(), 0);
+ QCOMPARE(mTestObject->mStartedFetchList.count(), 1);
+ QCOMPARE(mTestObject->mCreationList.count(), 1);
+ delete spy; spy = 0;
+ delete internal; internal = 0;
+ cleanup();
+
+ // Fetch fails because thumbnail was not created yet, fetch list does not contain the request.
+ init();
+ spy = new QSignalSpy(mTestObject, SIGNAL( thumbnailReady(QPixmap, void*, int) ));
+ error = -1;
+ requestId = 5;
+ internal = new int(5);
+ mTestObject->mThumbnailManager->emitThumbnailReady(pmap, internal, requestId, error);
+ QCOMPARE(spy->count(), 0);
+ QCOMPARE(mTestObject->mStartedFetchList.count(), 0);
+ QCOMPARE(mTestObject->mCreationList.count(), 0);
+ delete spy; spy = 0;
+ internal = 0; // this was deleted on fetcher side.
+ cleanup();
+
+ // Fetching is not paused, mStartedFetchList is not empty.
+ init();
+ internal = 0;
+ requestId = 5;
+ mTestObject->mPaused = false;
+ mTestObject->mStartedFetchList.insert(requestId+10, new VideoThumbnailFetcher::ThumbnailFetchData());
+ mTestObject->mFetchList.append(new VideoThumbnailFetcher::ThumbnailFetchData());
+ mTestObject->mThumbnailManager->emitThumbnailReady(pmap, internal, requestId, error);
+ QCOMPARE(mTestObject->mStartedFetchList.count(), 1);
+ QCOMPARE(mTestObject->mFetchList.count(), 1);
+ cleanup();
+
+ // Fetching is not paused, mStartedFetchList is empty.
+ init();
+ internal = 0;
+ requestId = 5;
+ mTestObject->mPaused = false;
+ mTestObject->mFetchList.append(new VideoThumbnailFetcher::ThumbnailFetchData());
+ mTestObject->mThumbnailManager->emitThumbnailReady(pmap, internal, requestId, error);
+ QCOMPARE(mTestObject->mStartedFetchList.count(), 1);
+ QCOMPARE(mTestObject->mFetchList.count(), 0);
+ cleanup();
+
+ // Fetch set to paused, mStartedFetchList is empty.
+ init();
+ internal = 0;
+ requestId = 5;
+ mTestObject->mPaused = true;
+ mTestObject->mFetchList.append(new VideoThumbnailFetcher::ThumbnailFetchData());
+ mTestObject->mThumbnailManager->emitThumbnailReady(pmap, internal, requestId, error);
+ QCOMPARE(mTestObject->mStartedFetchList.count(), 0);
+ QCOMPARE(mTestObject->mFetchList.count(), 1);
+ cleanup();
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnailfetcher/src/videothumbnailfetchertester.cpp Thu Apr 01 23:22:15 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 VideoThumbnailFetcher
+*
+*/
+
+// INCLUDES
+#define private public
+#include "videothumbnailfetcher.h"
+#undef private
+
+#include "videothumbnailfetchertester.h"
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailFetcherTester::VideoThumbnailFetcherTester()
+// -----------------------------------------------------------------------------
+//
+VideoThumbnailFetcherTester::VideoThumbnailFetcherTester()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailFetcherTester::~VideoThumbnailFetcherTester()
+// -----------------------------------------------------------------------------
+//
+VideoThumbnailFetcherTester::~VideoThumbnailFetcherTester()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailFetcherTester::startThumbnailFetches()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailFetcherTester::startThumbnailFetches()
+{
+ VideoThumbnailFetcher::startThumbnailFetches();
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailFetcherTester::startThumbnailCreation()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailFetcherTester::startThumbnailCreation()
+{
+ VideoThumbnailFetcher::startThumbnailCreation();
+}
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnailfetcher/stub/inc/thumbnailmanager_qt.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,388 @@
+/*
+* 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:
+*
+*/
+
+#ifndef STUB_THUMBNAILMANAGER_QT_H
+#define STUB_THUMBNAILMANAGER_QT_H
+
+#include <QObject>
+#include <QPixmap.h>
+#include <QMap>
+
+class QString;
+class QSize;
+
+/** default priority value */
+const int tnmWrapperPriorityIdle = -100;
+
+class ThumbnailManager : public QObject
+ {
+ Q_OBJECT
+
+public:
+ /** Thumbnail size. */
+ enum ThumbnailSize
+ {
+ /**
+ * Small thumbnail
+ */
+ ThumbnailSmall = 0,
+ /**
+ * Medium thumbnail
+ */
+ ThumbnailMedium,
+ /**
+ * Large thumbnail
+ */
+ ThumbnailLarge
+ };
+
+ /** Mode of thumbnail creation. */
+ enum ThumbnailMode
+ {
+ /**
+ * Default mode. This means that:
+ * - Thumbnail must be as large as requested (unless the actual object is smaller).
+ * - Smaller thumbnails may be up scaled to desired resolution.
+ * - Aspect ratio is maintained and thumbnails are not cropped. The
+ * resulting thumbnail may smaller in either width or height if
+ * the aspect ratio of the object does not match the aspect ratio
+ * of the requested size.
+ */
+ Default = 0,
+
+ /**
+ * Allow thumbnails which are smaller than requested are. Thumbnail
+ * bitmaps are never up scaled if this flag is set.
+ */
+ AllowAnySize = 1,
+
+ /**
+ * New thumbnail images are not created if this flag is set. Only
+ * existing thumbnails may be returned. If a requested thumbnail does
+ * not exist null pixmap will be returned.
+ */
+ DoNotCreate = 2,
+
+ /**
+ * Thumbnail images are cropped to match requested aspect ratio. If
+ * this mode is set, the size of the resulting thumbnail always
+ * matches the requested size.
+ */
+ CropToAspectRatio = 4
+ };
+
+ /** Quality versus speed preference setting */
+ enum QualityPreference
+ {
+ /**
+ * Prefer thumbnails in the highest quality possible disregarding
+ * any negative impact on performance.
+ */
+ OptimizeForQuality,
+
+ /**
+ * Get thumbnails as fast as possible, even if
+ * it means lower quality.
+ */
+ OptimizeForPerformance
+ };
+
+ /** Display modes. */
+ enum DisplayMode
+ {
+ /** No display mode */
+ None,
+
+ /** Monochrome display mode (1 bpp) */
+ Gray2,
+
+ /** Four grayscales display mode (2 bpp) */
+ Gray4,
+
+ /** 16 grayscales display mode (4 bpp) */
+ Gray16,
+
+ /** 256 grayscales display mode (8 bpp) */
+ Gray256,
+
+ /** Low colour GA 16 colour display mode (4 bpp) */
+ Color16,
+
+ /** 256 colour display mode (8 bpp) */
+ Color256,
+
+ /** 64,000 colour display mode (16 bpp) */
+ Color64K,
+
+ /** True colour display mode (24 bpp) */
+ Color16M,
+
+ /** (Not an actual display mode used for moving buffers containing bitmaps) */
+ Rgb,
+
+ /** 4096 colour display (12 bpp). */
+ Color4K,
+
+ /** True colour display mode (32 bpp, but top byte is unused and unspecified) */
+ Color16MU,
+
+ /** Display mode with alpha (24bpp colour plus 8bpp alpha) */
+ Color16MA,
+
+ /** Pre-multiplied Alpha display mode
+ * (24bpp color multiplied with the alpha channel value, plus 8bpp alpha) */
+ Color16MAP
+ };
+
+public:
+
+
+ /**
+ * Constructor
+ *
+ * @param parentPtr parent
+ */
+ ThumbnailManager( QObject* parentPtr = NULL );
+
+ /**
+ * Destructor
+ */
+ virtual ~ThumbnailManager();
+
+ /**
+ * Get quality versus performance preference.
+ *
+ * @return quality versus performance preference
+ */
+ QualityPreference qualityPreference() const;
+
+ /**
+ * Set quality versus performance preference.
+ *
+ * @param qualityPreference New quality versus performance preference
+ * value.
+ * @return true on success
+ */
+ bool setQualityPreference( QualityPreference qualityPreference );
+
+ /**
+ * Get the current display mode for thumbnail bitmaps.
+ *
+ * @return current display mode for thumbnail bitmaps
+ */
+ DisplayMode displayMode() const;
+
+ /**
+ * Set new display mode for thumbnail bitmaps.
+ *
+ * @param displayMode new display mode for thumbnail bitmaps.
+ * @return true on success
+ */
+ bool setDisplayMode( DisplayMode displayMode );
+
+ /**
+ * Get the current desired size for thumbnail bitmaps.
+ *
+ * @return Current desired size for thumbnail bitmaps (in pixels).
+ */
+ QSize thumbnailSize() const;
+
+ /**
+ * Set desired size for thumbnail bitmaps.
+ *
+ * @param thumbnailSize New desired thumbnail size.
+ * @return true on success
+ */
+ bool setThumbnailSize( const QSize& thumbnailSize );
+
+ /**
+ * Set desired size for thumbnail bitmaps.
+ *
+ * @param thumbnailSize New desired thumbnail size.
+ * @return true on success
+ */
+ bool setThumbnailSize( ThumbnailSize thumbnailSize );
+
+ /**
+ * Get current mode for thumbnail generation.
+ *
+ * @return Current mode.
+ */
+ ThumbnailMode mode() const;
+
+ /**
+ * Set mode for thumbnail generation.
+ *
+ * @param mode New flags.
+ * @return true on success
+ */
+ bool setMode( ThumbnailMode mode );
+
+ /**
+ * Get a thumbnail for an object file. If a thumbnail already exists, it
+ * is loaded and if a thumbnail does not exist, it is created
+ * transparently. If thumbnail loadinf fails thumbnailReady signal is emited
+ * with null pixmap and error code.
+ *
+ * @param fileName Source object or file
+ * @param clientData Pointer to arbitrary client data.
+ * This pointer is not used by the API for
+ * anything other than returning it in the
+ * ThumbnailReady signal.
+ * @param priority Priority for this operation
+ * @return Thumbnail request ID or -1 if request failed. This can be used to
+ * cancel the request or change priority.
+ * The ID is specific to this tnm
+ * instance and may not be shared with other
+ * instances.
+ */
+ int getThumbnail( const QString& fileName, void * clientData = NULL,
+ int priority = tnmWrapperPriorityIdle );
+
+ /**
+ * Get a persistent thumbnail for an object file. If a thumbnail already
+ * exists, it is loaded and if a thumbnail does not exist, it is created
+ * transparently. If thumbnail loading fails thumbnailReady signal is emited
+ * with null pixmap and error code.
+ *
+ * @param thumbnailId Thumbnail ID
+ * @param clientData Pointer to arbitrary client data.
+ * This pointer is not used by the API for
+ * anything other than returning it in the
+ * ThumbnailReady signal.
+ * @param priority Priority for this operation
+ * @return Thumbnail request ID or -1 if request failed. This can be used to
+ * cancel the request or change priority.
+ * The ID is specific to this tnm
+ * instance and may not be shared with other
+ * instances.
+ */
+ int getThumbnail( unsigned long int thumbnailId, void * clientData = NULL,
+ int priority = tnmWrapperPriorityIdle );
+
+ /**
+ * Set a thumbnail for an object file generated from pixmap delivered.
+ * thumbnailReady() signal will be emited when the operation is complete.
+ *
+ * @param source Pixmap from which the thumbnail will be created
+ * @param fileName file name
+ * @param clientData Pointer to arbitrary client data.
+ * This pointer is not used by the API for
+ * anything other than returning it in the
+ * ThumbnailReady callback.
+ * @param priority Priority for this operation
+ * @return Thumbnail request ID or -1 if request failed. This can be used to
+ * cancel the request or change priority.
+ *
+ */
+ int setThumbnail( const QPixmap& source, const QString& fileName,
+ void * clientData = NULL, int priority = tnmWrapperPriorityIdle );
+
+ /**
+ * Delete all thumbnails for a given object. This is an asynchronous
+ * operation, which always returns immediately.
+ *
+ * @param fileName Source file
+ */
+ void deleteThumbnails( const QString& fileName );
+
+ /**
+ * Delete all thumbnails for a given object. This is an asynchronous
+ * operation, which always returns immediately.
+ *
+ * @param thumbnailId thumbnail id
+ */
+ void deleteThumbnails( unsigned long int thumbnailId );
+
+ /**
+ * Cancel a thumbnail operation.
+ *
+ * @param id Request ID for the operation to be cancelled.
+ * @return true if cancelling was successful.
+ */
+ bool cancelRequest( int id );
+
+ /**
+ * Change the priority of a queued thumbnail operation.
+ *
+ * @param id Request ID for the request which to assign a new
+ * priority.
+ * @param newPriority New priority value
+ * @return true if change was successful.
+ */
+ bool changePriority( int id, int newPriority );
+
+signals:
+ /**
+ * Final thumbnail bitmap generation or loading is complete.
+ *
+ * @param pixmap An object representing the resulting thumbnail.
+ * @param clientData Client data
+ * @param id Request ID for the operation
+ * @param errorCode error code
+ */
+ void thumbnailReady( QPixmap , void * , int , int );
+
+public: // Test methods.
+
+ void emitThumbnailReady(int tnId, bool emitNullThumb = false);
+
+ /**
+ * Emits thumbnailReady signal.
+ *
+ * @param pixmap An object representing the resulting thumbnail.
+ * @param clientData Client data
+ * @param id Request ID for the operation
+ * @param errorCode error code
+ */
+ void emitThumbnailReady(QPixmap pixmap, void *internal, int id, int errorCode);
+
+public: // Test data.
+
+ ThumbnailSize mThumbSize;
+ QualityPreference mQuality;
+ ThumbnailMode mMode;
+
+ struct TnRequest
+ {
+ QString name;
+ void *id;
+ int priority;
+ bool cancelled;
+
+ TnRequest(QString name, void *id, int priority, bool cancelled) {
+ this->name = name;
+ this->id = id;
+ this->priority = priority;
+ this->cancelled = cancelled;
+ }
+
+ TnRequest() {
+ name = QString("");
+ id = 0;
+ priority = tnmWrapperPriorityIdle;
+ cancelled = false;
+ }
+ };
+
+ static QMap<int, TnRequest> mRequests;
+
+ static bool mGetThumbFails;
+ static int mThumbnailReadyError;
+};
+
+#endif // STUB_THUMBNAILMANAGER_QT
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnailfetcher/stub/src/thumbnailmanager_qt.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,170 @@
+/*
+* 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:
+*
+*/
+
+#include <qsize.h>
+#include "thumbnailmanager_qt.h"
+#include <QMap>
+
+QMap<int, ThumbnailManager::TnRequest> ThumbnailManager::mRequests = QMap<int, ThumbnailManager::TnRequest>();
+
+bool ThumbnailManager::mGetThumbFails = false;
+int ThumbnailManager::mThumbnailReadyError = 0;
+
+ThumbnailManager::ThumbnailManager( QObject* parentPtr ) :
+QObject( parentPtr )
+{
+ mMode = Default;
+}
+
+ThumbnailManager::~ThumbnailManager()
+{
+
+}
+
+ThumbnailManager::QualityPreference ThumbnailManager::qualityPreference() const
+{
+ return mQuality;
+}
+
+bool ThumbnailManager::setQualityPreference( QualityPreference
+ qualityPreference )
+{
+ mQuality = qualityPreference;
+ return true;
+}
+
+ThumbnailManager::DisplayMode ThumbnailManager::displayMode() const
+{
+ return Color16MAP;
+}
+
+bool ThumbnailManager::setDisplayMode( ThumbnailManager::DisplayMode displayMode )
+{
+ Q_UNUSED(displayMode);
+ return true;
+}
+
+QSize ThumbnailManager::thumbnailSize() const
+{
+ return QSize(128, 128); // ThumbnailMedium?
+}
+
+bool ThumbnailManager::setThumbnailSize( const QSize& thumbnailSize )
+{
+ Q_UNUSED(thumbnailSize);
+ return true;
+}
+
+bool ThumbnailManager::setThumbnailSize( ThumbnailSize thumbnailSize )
+{
+ mThumbSize = thumbnailSize;
+ return true;
+}
+
+ThumbnailManager::ThumbnailMode ThumbnailManager::mode() const
+{
+ return mMode;
+}
+
+bool ThumbnailManager::setMode( ThumbnailMode mode )
+{
+ mMode = mode;
+ return true;
+}
+
+int ThumbnailManager::getThumbnail( const QString& fileName, void * clientData,
+ int priority )
+{
+ if(mGetThumbFails) return -1;
+
+ int id = mRequests.count();
+ mRequests[id] = TnRequest(fileName, clientData, priority, false);
+ return id;
+}
+
+int ThumbnailManager::getThumbnail( unsigned long int thumbnailId, void * clientData,
+ int priority )
+{
+ Q_UNUSED(thumbnailId);
+ Q_UNUSED(clientData);
+ Q_UNUSED(priority);
+ return 0;
+}
+
+int ThumbnailManager::setThumbnail( const QPixmap& source, const QString& filename,
+ void * clientData , int priority )
+{
+ Q_UNUSED(source);
+ Q_UNUSED(filename);
+ Q_UNUSED(clientData);
+ Q_UNUSED(priority);
+ return 0;
+}
+
+void ThumbnailManager::deleteThumbnails( const QString& fileName )
+{
+ Q_UNUSED(fileName);
+}
+
+void ThumbnailManager::deleteThumbnails( unsigned long int thumbnailId )
+{
+ Q_UNUSED(thumbnailId);
+}
+
+bool ThumbnailManager::cancelRequest( int id )
+{
+ if(mRequests.contains(id)) {
+ mRequests[id].cancelled = true;
+ }
+ return true;
+}
+
+bool ThumbnailManager::changePriority( int id, int newPriority )
+{
+ if(mRequests.contains(id)) {
+ mRequests[id].priority = newPriority;
+ }
+ return true;
+}
+
+void ThumbnailManager::emitThumbnailReady(int tnId, bool emitNullThumb)
+{
+ if(emitNullThumb)
+ {
+ QPixmap pixmap;
+ int* internal = new int(0);
+ emit thumbnailReady(pixmap, internal, tnId, mThumbnailReadyError);
+ }
+ else
+ {
+ QPixmap pixmap(100,100);
+ pixmap.fill(Qt::white);
+ void* internal = 0;
+
+ if(mRequests.contains(tnId)) {
+ internal = mRequests[tnId].id;
+ mRequests.remove(tnId);
+ }
+ emit thumbnailReady(pixmap, internal, tnId, mThumbnailReadyError);
+ }
+}
+
+void ThumbnailManager::emitThumbnailReady(QPixmap pixmap, void *internal, int id, int errorCode)
+{
+ emit thumbnailReady(pixmap, internal, id, errorCode);
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnailfetcher/testvideothumbnailfetcher.pro Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,58 @@
+#
+# 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:
+#
+
+TEMPLATE = app
+TARGET =
+DEFINES += BUILD_VIDEOCOLLECTION_DLL
+DEPENDPATH += . \
+ inc \
+ src
+
+INCLUDEPATH = stub/inc \
+ /epoc32/include \
+ /epoc32/include/osextensions/stdapis \
+ /epoc32/include/osextensions/stdapis/sys \
+ /epoc32/include/stdapis \
+ /epoc32/include/stdapis/sys \
+ . \
+ /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/testvideothumbnailfetcher.h \
+ inc/videothumbnailfetchertester.h \
+ stub/inc/thumbnailmanager_qt.h \
+ ../../inc/videothumbnailfetcher.h \
+ ../../../inc/videocollectionexport.h
+
+SOURCES += src/testvideothumbnailfetcher.cpp \
+ src/videothumbnailfetchertester.cpp \
+ stub/src/thumbnailmanager_qt.cpp \
+ ../../src/videothumbnailfetcher.cpp
--- a/videocollection/videocollectionwrapper/videocollectionwrapper.pro Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videocollectionwrapper/videocollectionwrapper.pro Thu Apr 01 23:22:15 2010 +0300
@@ -48,9 +48,11 @@
inc/videolistdatamodel_p.h \
inc/videothumbnaildata.h \
inc/videothumbnaildata_p.h \
+ inc/videothumbnailfetcher.h \
inc/videocollectionutils.h \
inc/videosortfilterproxymodel.h \
inc/videodatacontainer.h \
+ inc/videodeleteworker.h \
../inc/videocollectionexport.h
SOURCES += src/videocollectionclient.cpp \
@@ -61,8 +63,10 @@
src/videolistdatamodel_p.cpp \
src/videothumbnaildata.cpp \
src/videothumbnaildata_p.cpp \
+ src/videothumbnailfetcher.cpp \
src/videocollectionutils.cpp \
src/videosortfilterproxymodel.cpp \
+ src/videodeleteworker.cpp \
src/videodatacontainer.cpp
LIBS += -lmpxcommon.dll \
--- a/videocollection/videofiledetailsview/data/videofiledetails.xml Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videofiledetailsview/data/videofiledetails.xml Thu Apr 01 23:22:15 2010 +0300
@@ -1,378 +1,142 @@
<?xml version="1.0" encoding="UTF-8"?>
<hbdocument version="0.9">
<object name="mOptionsDelete" type="HbAction">
- <string name="iconText" value="Delete"/>
- <string name="text" value="Delete"/>
- <string name="toolTip" value="Delete"/>
- </object>
- <object name="mOptionsShare" type="HbAction">
- <string name="iconText" value="Share"/>
- <string name="text" value="Share"/>
- <string name="toolTip" value="Share"/>
+ <string locid="txt_common_opt_delete" name="text" value="Delete"/>
</object>
<widget name="videofiledetailsview" type="HbView">
<widget name="mOptionsMenu" role="HbView:menu" type="HbMenu">
<ref object="mOptionsDelete" role="HbMenu:addAction"/>
- <ref object="mOptionsShare" role="HbMenu:addAction"/>
</widget>
<widget name="mContent" role="HbView:widget" type="HbWidget">
- <widget name="mDetailScrollArea" type="HbScrollArea">
- <widget name="mLayoutVideoInfo" role="HbScrollArea:contents" type="HbWidget">
- <widget name="mLblDetail1" type="HbLabel">
- <real name="z" value="0.0019"/>
- <sizehint height="30" type="PREFERRED" width="300"/>
- <sizehint height="25" type="MINIMUM" width="24"/>
- </widget>
- <widget name="mLblDetail2" type="HbLabel">
- <real name="z" value="0.002"/>
- <sizehint height="30" type="PREFERRED" width="300"/>
- <sizehint height="25" type="MINIMUM" width="24"/>
- </widget>
- <widget name="mLblDetail3" type="HbLabel">
- <real name="z" value="0.0021"/>
- <sizehint height="30" type="PREFERRED" width="300"/>
- <sizehint height="25" type="MINIMUM" width="24"/>
- </widget>
- <widget name="mLblDetail4" type="HbLabel">
- <real name="z" value="0.0068"/>
- <sizehint height="30" type="PREFERRED" width="300"/>
- <sizehint height="25" type="MINIMUM" width="24"/>
- </widget>
- <widget name="mLblDetail5" type="HbLabel">
- <real name="z" value="0.0069"/>
- <sizehint height="30" type="PREFERRED" width="300"/>
- <sizehint height="25" type="MINIMUM" width="24"/>
- </widget>
- <widget name="mLblDetail6" type="HbLabel">
- <real name="z" value="0.007"/>
- <sizehint height="30" type="PREFERRED" width="300"/>
- <sizehint height="25" type="MINIMUM" width="24"/>
- </widget>
- <widget name="mLblDetail7" type="HbLabel">
- <real name="z" value="0.007"/>
- <sizehint height="30" type="PREFERRED" width="300"/>
- <sizehint height="25" type="MINIMUM" width="24"/>
- </widget>
- <widget name="mLblDetail8" type="HbLabel">
- <real name="z" value="0.007"/>
- <sizehint height="30" type="PREFERRED" width="300"/>
- <sizehint height="25" type="MINIMUM" width="24"/>
- </widget>
- <widget name="mLblDetail9" type="HbLabel">
- <real name="z" value="0.007"/>
- <sizehint height="30" type="PREFERRED" width="300"/>
- <sizehint height="25" type="MINIMUM" width="24"/>
- </widget>
- <widget name="mLblDetail10" type="HbLabel">
- <real name="z" value="0.007"/>
- <sizehint height="30" type="PREFERRED" width="300"/>
- <sizehint height="25" type="MINIMUM" width="24"/>
- </widget>
- <widget name="mLblDetail11" type="HbLabel">
- <real name="z" value="0.007"/>
- <sizehint height="30" type="PREFERRED" width="300"/>
- <sizehint height="25" type="MINIMUM" width="24"/>
- </widget>
- <widget name="mLblDetail12" type="HbLabel">
- <real name="z" value="0.007"/>
- <sizehint height="30" type="PREFERRED" width="300"/>
- <sizehint height="25" type="MINIMUM" width="24"/>
- </widget>
- <widget name="mLblDetail13" type="HbLabel">
- <real name="z" value="0.007"/>
- <sizehint height="30" type="PREFERRED" width="300"/>
- <sizehint height="25" type="MINIMUM" width="24"/>
- </widget>
- <widget name="mLblDetail14" type="HbLabel">
- <real name="z" value="0.007"/>
- <sizehint height="30" type="PREFERRED" width="300"/>
- <sizehint height="25" type="MINIMUM" width="24"/>
- </widget>
- <widget name="mLblDetail15" type="HbLabel">
- <real name="z" value="0.007"/>
- <sizehint height="30" type="PREFERRED" width="300"/>
- <sizehint height="25" type="MINIMUM" width="24"/>
- </widget>
- <widget name="mLblDetail16" type="HbLabel">
- <real name="z" value="0.007"/>
- <sizehint height="30" type="PREFERRED" width="300"/>
- <sizehint height="25" type="MINIMUM" width="24"/>
- </widget>
- <real name="z" value="0"/>
- <layout orientation="Vertical" type="linear">
- <linearitem itemname="mLblDetail1"/>
- <linearitem itemname="mLblDetail2"/>
- <linearitem itemname="mLblDetail3"/>
- <linearitem itemname="mLblDetail4"/>
- <linearitem itemname="mLblDetail5"/>
- <linearitem itemname="mLblDetail6"/>
- <linearitem itemname="mLblDetail7"/>
- <linearitem itemname="mLblDetail8"/>
- <linearitem itemname="mLblDetail9"/>
- <linearitem itemname="mLblDetail10"/>
- <linearitem itemname="mLblDetail11"/>
- <linearitem itemname="mLblDetail12"/>
- <linearitem itemname="mLblDetail13"/>
- <linearitem itemname="mLblDetail14"/>
- <linearitem itemname="mLblDetail15"/>
- <linearitem itemname="mLblDetail16"/>
- </layout>
- </widget>
- <real name="z" value="0.0071"/>
- <sizehint height="288" type="PREFERRED" width="320"/>
- <sizehint height="235" type="MINIMUM" width="320"/>
- </widget>
<widget name="mLblTitle" type="HbStackedWidget">
<real name="z" value="0.0079"/>
- <sizehint height="30" type="PREFERRED" width="320"/>
+ <sizehint height="4.47761un" type="PREFERRED" width="47.7612un"/>
+ </widget>
+ <widget name="mDetailsContainer" type="HbWidget">
+ <widget name="mDetailsList" type="HbListWidget"/>
+ <real name="z" value="2"/>
+ <sizehint height="23.8806un" type="PREFERRED" width="11.9403un"/>
+ <layout orientation="Vertical" type="linear">
+ <linearitem itemname="mDetailsList"/>
+ </layout>
</widget>
<widget name="mThumbRating" type="HbWidget">
- <widget name="mRatingSlider" type="HbRatingSlider">
- <real name="z" value="1"/>
- <sizehint height="50" type="PREFERRED" width="291"/>
- <sizehint height="50" type="MINIMUM" width="291"/>
- <contentsmargins bottom="5" left="5" right="5" top="5"/>
- <bool name="readOnly" value="TRUE"/>
- </widget>
- <widget name="mBtnPlay" type="HbPushButton">
+ <widget name="mDetailsLabel" type="HbStackedWidget">
<real name="z" value="2"/>
- <sizehint height="199" type="PREFERRED" width="320"/>
+ <sizehint height="34.47761un" type="PREFERRED" width="47.91045un"/>
+ <bool name="visible" value="TRUE"/>
+ <string name="state" value="normal"/>
</widget>
<real name="z" value="1"/>
- <sizehint height="250" type="PREFERRED" width="320"/>
- <layout orientation="Vertical" type="linear">
- <linearitem itemname="mBtnPlay"/>
- <linearitem itemname="mRatingSlider"/>
+ <sizehint height="37.31343un" type="PREFERRED" width="47.7612un"/>
+ <layout type="anchor">
+ <anchoritem dst="mDetailsLabel" dstEdge="LEFT" spacing="1.34328un" src="" srcEdge="LEFT"/>
+ <anchoritem dst="mDetailsLabel" dstEdge="TOP" spacing="1.34328un" src="" srcEdge="TOP"/>
</layout>
</widget>
</widget>
- <string name="title" value="File details"/>
</widget>
<section name="portrait">
- <widget name="mDetailScrollArea" type="HbScrollArea">
- <widget name="mLayoutVideoInfo" role="HbScrollArea:contents" type="HbWidget">
- <widget name="mLblDetail1" type="HbLabel"/>
- <widget name="mLblDetail2" type="HbLabel"/>
- <widget name="mLblDetail3" type="HbLabel"/>
- <widget name="mLblDetail4" type="HbLabel"/>
- <widget name="mLblDetail5" type="HbLabel"/>
- <widget name="mLblDetail6" type="HbLabel"/>
- <widget name="mLblDetail7" type="HbLabel"/>
- <widget name="mLblDetail8" type="HbLabel"/>
- <widget name="mLblDetail9" type="HbLabel"/>
- <widget name="mLblDetail10" type="HbLabel"/>
- <widget name="mLblDetail11" type="HbLabel"/>
- <widget name="mLblDetail12" type="HbLabel"/>
- <widget name="mLblDetail13" type="HbLabel"/>
- <widget name="mLblDetail14" type="HbLabel"/>
- <widget name="mLblDetail15" type="HbLabel"/>
- <widget name="mLblDetail16" type="HbLabel"/>
- <sizehint height="908" type="PREFERRED" width="323"/>
- <layout orientation="Vertical" type="linear">
- <linearitem itemname="mLblDetail1"/>
- <linearitem itemname="mLblDetail2"/>
- <linearitem itemname="mLblDetail3"/>
- <linearitem itemname="mLblDetail4"/>
- <linearitem itemname="mLblDetail5"/>
- <linearitem itemname="mLblDetail6"/>
- <linearitem itemname="mLblDetail7"/>
- <linearitem itemname="mLblDetail8"/>
- <linearitem itemname="mLblDetail9"/>
- <linearitem itemname="mLblDetail10"/>
- <linearitem itemname="mLblDetail11"/>
- <linearitem itemname="mLblDetail12"/>
- <linearitem itemname="mLblDetail13"/>
- <linearitem itemname="mLblDetail14"/>
- <linearitem itemname="mLblDetail15"/>
- <linearitem itemname="mLblDetail16"/>
- </layout>
+ <widget name="mDetailsContainer" type="HbWidget">
+ <widget name="mButton" type="HbPushButton">
+ <sizepolicy horizontalPolicy="Preferred" horizontalStretch="0" verticalPolicy="Preferred" verticalStretch="0"/>
+ <sizehint height="7.46269un" type="PREFERRED" width="14.92537un"/>
+ <sizehint height="7.46269un" type="MINIMUM" width="7.46269un"/>
+ <sizehint height="7.46269un" type="MAXIMUM" width="74.62687un"/>
+ <string name="state" value="normal"/>
</widget>
- </widget>
- <widget name="mThumbRating" type="HbWidget">
- <widget name="container" type="HbWidget">
- <widget name="mRatingSlider" type="HbRatingSlider">
- <sizepolicy horizontalPolicy="Preferred" horizontalStretch="0" verticalPolicy="Preferred" verticalStretch="0"/>
- <sizehint height="50" type="PREFERRED" width="100"/>
- <sizehint height="50" type="MINIMUM" width="50"/>
- <sizehint height="50" type="MAXIMUM" width="500"/>
- </widget>
- <real name="z" value="0"/>
- <sizehint height="50" type="PREFERRED" width="320"/>
- <layout orientation="Horizontal" type="linear">
- <contentsmargins bottom="0px" left="20px" right="9px" top="0px"/>
- <linearitem itemname="mRatingSlider"/>
- </layout>
- </widget>
+ <sizehint height="49.55224un" type="PREFERRED" width="50.74626un"/>
<layout orientation="Vertical" type="linear">
- <linearitem itemname="mBtnPlay"/>
- <linearitem itemname="container"/>
+ <linearitem itemname="mDetailsList"/>
+ <linearitem itemname="mButton"/>
</layout>
</widget>
<widget name="mContent" role="HbView:widget" type="HbWidget">
+ <widget name="mThumbRating" type="HbWidget">
+ <widget name="mDetailsLabel" type="HbStackedWidget">
+ <real name="z" value="2"/>
+ <sizehint height="28.54477688un" type="FIXED" width="50.74627un"/>
+ <string name="state" value=""/>
+ </widget>
+ <real name="z" value="1"/>
+ <sizehint height="28.69402688un" type="PREFERRED" width="50.74626un"/>
+ <layout type="anchor">
+ <anchoritem dst="mDetailsLabel" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
+ <anchoritem dst="mDetailsLabel" dstEdge="TOP" spacing="0un" src="" srcEdge="TOP"/>
+ <anchoritem dst="mDetailsLabel" dstEdge="RIGHT" spacing="0un" src="" srcEdge="RIGHT"/>
+ <anchoritem dst="mDetailsLabel" dstEdge="BOTTOM" spacing="0un" src="" srcEdge="BOTTOM"/>
+ </layout>
+ </widget>
<layout type="anchor">
- <anchoritem dst="mDetailScrollArea" dstEdge="TOP" spacing="303" src="" srcEdge="TOP"/>
- <anchoritem dst="mLblTitle" dstEdge="TOP" spacing="7" src="" srcEdge="TOP"/>
- <anchoritem dst="mThumbRating" dstEdge="LEFT" spacing="20" src="" srcEdge="LEFT"/>
- <anchoritem dst="mThumbRating" dstEdge="TOP" spacing="45" src="" srcEdge="TOP"/>
- <anchoritem dst="mLblTitle" dstEdge="LEFT" spacing="20" src="" srcEdge="LEFT"/>
- <anchoritem dst="mDetailScrollArea" dstEdge="LEFT" spacing="20" src="" srcEdge="LEFT"/>
+ <anchoritem dst="mLblTitle" dstEdge="TOP" spacing="1.04478un" src="" srcEdge="TOP"/>
+ <anchoritem dst="mLblTitle" dstEdge="LEFT" spacing="1.49254un" src="" srcEdge="LEFT"/>
+ <anchoritem dst="mLblTitle" dstEdge="RIGHT" spacing="-1.49254un" src="" srcEdge="RIGHT"/>
+ <anchoritem dst="mDetailsContainer" dstEdge="LEFT" spacing="1.49254un" src="" srcEdge="LEFT"/>
+ <anchoritem dst="mDetailsContainer" dstEdge="RIGHT" spacing="-1.49254un" src="" srcEdge="RIGHT"/>
+ <anchoritem dst="mDetailsContainer" dstEdge="BOTTOM" spacing="-1.49254un" src="" srcEdge="BOTTOM"/>
+ <anchoritem dst="mThumbRating" dstEdge="TOP" spacing="6.71642un" src="" srcEdge="TOP"/>
+ <anchoritem dst="mThumbRating" dstEdge="LEFT" spacing="1.49254un" src="" srcEdge="LEFT"/>
+ <anchoritem dst="mThumbRating" dstEdge="RIGHT" spacing="-1.49254un" src="" srcEdge="RIGHT"/>
</layout>
</widget>
</section>
<section name="landscape">
<widget name="mContent" role="HbView:widget" type="HbWidget">
- <layout type="anchor">
- <anchoritem dst="mThumbRating" dstEdge="LEFT" spacing="10" src="" srcEdge="LEFT"/>
- <anchoritem dst="mThumbRating" dstEdge="TOP" spacing="45" src="" srcEdge="TOP"/>
- <anchoritem dst="mLblTitle" dstEdge="LEFT" spacing="10" src="" srcEdge="LEFT"/>
- <anchoritem dst="mLblTitle" dstEdge="TOP" spacing="7" src="" srcEdge="TOP"/>
- <anchoritem dst="mLblTitle" dstEdge="RIGHT" spacing="10" src="" srcEdge="RIGHT"/>
- <anchoritem dst="mDetailScrollArea" dstEdge="LEFT" spacing="320" src="" srcEdge="LEFT"/>
- <anchoritem dst="mDetailScrollArea" dstEdge="TOP" spacing="45" src="" srcEdge="TOP"/>
- </layout>
- </widget>
- </section>
- <section name="portrait_fetch">
- <widget name="mDetailScrollArea" type="HbScrollArea">
- <widget name="mLayoutVideoInfo" role="HbScrollArea:contents" type="HbWidget">
- <widget name="mLblDetail1" type="HbLabel"/>
- <widget name="mLblDetail2" type="HbLabel"/>
- <widget name="mLblDetail3" type="HbLabel"/>
- <widget name="mLblDetail4" type="HbLabel"/>
- <widget name="mLblDetail5" type="HbLabel"/>
- <widget name="mLblDetail6" type="HbLabel"/>
- <widget name="mLblDetail7" type="HbLabel"/>
- <widget name="mLblDetail8" type="HbLabel"/>
- <widget name="mLblDetail9" type="HbLabel"/>
- <widget name="mLblDetail10" type="HbLabel"/>
- <widget name="mLblDetail11" type="HbLabel"/>
- <widget name="mLblDetail12" type="HbLabel"/>
- <widget name="mLblDetail13" type="HbLabel"/>
- <widget name="mLblDetail14" type="HbLabel"/>
- <widget name="mLblDetail15" type="HbLabel"/>
- <widget name="mLblDetail16" type="HbLabel"/>
- <sizehint height="908" type="PREFERRED" width="323"/>
- <layout orientation="Vertical" type="linear">
- <linearitem itemname="mLblDetail1"/>
- <linearitem itemname="mLblDetail2"/>
- <linearitem itemname="mLblDetail3"/>
- <linearitem itemname="mLblDetail4"/>
- <linearitem itemname="mLblDetail5"/>
- <linearitem itemname="mLblDetail6"/>
- <linearitem itemname="mLblDetail7"/>
- <linearitem itemname="mLblDetail8"/>
- <linearitem itemname="mLblDetail9"/>
- <linearitem itemname="mLblDetail10"/>
- <linearitem itemname="mLblDetail11"/>
- <linearitem itemname="mLblDetail12"/>
- <linearitem itemname="mLblDetail13"/>
- <linearitem itemname="mLblDetail14"/>
- <linearitem itemname="mLblDetail15"/>
- <linearitem itemname="mLblDetail16"/>
+ <widget name="mDetailsContainer" type="HbWidget">
+ <widget name="mDetailsList" type="HbListWidget">
+ <sizehint height="26.71642un" type="PREFERRED" width="42.83582un"/>
+ </widget>
+ <real name="z" value="2"/>
+ <sizehint height="37.01493un" type="PREFERRED" width="45.52239un"/>
+ <layout type="anchor">
+ <anchoritem dst="mDetailsList" dstEdge="LEFT" spacing="1.34328un" src="" srcEdge="LEFT"/>
+ <anchoritem dst="mDetailsList" dstEdge="TOP" spacing="0un" src="" srcEdge="TOP"/>
+ <anchoritem dst="mDetailsList" dstEdge="BOTTOM" spacing="0un" src="" srcEdge="BOTTOM"/>
</layout>
</widget>
- </widget>
- <widget name="mThumbRating" type="HbWidget">
- <widget name="container" type="HbWidget">
- <widget name="mRatingSlider" type="HbRatingSlider">
+ <widget name="mThumbRating" type="HbWidget">
+ <widget name="mDetailsLabel" type="HbStackedWidget">
+ <real name="z" value="2"/>
+ <sizepolicy horizontalPolicy="Preferred" horizontalStretch="0" verticalPolicy="Preferred" verticalStretch="0"/>
+ <sizehint height="26.865675un" type="FIXED" width="47.7612un"/>
+ <string name="state" value=""/>
+ </widget>
+ <widget name="mButton" type="HbPushButton">
+ <real name="z" value="3"/>
<sizepolicy horizontalPolicy="Preferred" horizontalStretch="0" verticalPolicy="Preferred" verticalStretch="0"/>
- <sizehint height="50" type="PREFERRED" width="100"/>
- <sizehint height="50" type="MINIMUM" width="50"/>
- <sizehint height="50" type="MAXIMUM" width="500"/>
+ <sizehint height="7.46269un" type="PREFERRED" width="45.07463un"/>
+ <sizehint height="7.46269un" type="MINIMUM" width="7.46269un"/>
+ <sizehint height="7.46269un" type="MAXIMUM" width="74.62687un"/>
+ <string name="state" value=""/>
</widget>
- <real name="z" value="0"/>
- <sizehint height="50" type="PREFERRED" width="320"/>
- <layout orientation="Horizontal" type="linear">
- <contentsmargins bottom="0px" left="20px" right="9px" top="0px"/>
- <linearitem itemname="mRatingSlider"/>
+ <real name="z" value="1"/>
+ <sizehint height="37.31343un" type="PREFERRED" width="47.7612un"/>
+ <layout type="anchor">
+ <anchoritem dst="mButton" dstEdge="LEFT" spacing="1.34328un" src="" srcEdge="LEFT"/>
+ <anchoritem dst="mButton" dstEdge="TOP" spacing="28.50746un" src="" srcEdge="TOP"/>
+ <anchoritem dst="mDetailsLabel" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
+ <anchoritem dst="mDetailsLabel" dstEdge="RIGHT" spacing="0un" src="" srcEdge="RIGHT"/>
+ <anchoritem dst="mDetailsLabel" dstEdge="TOP" spacing="0un" src="" srcEdge="TOP"/>
</layout>
</widget>
- <layout orientation="Vertical" type="linear">
- <linearitem itemname="mBtnPlay"/>
- <linearitem itemname="container"/>
+ <layout type="anchor">
+ <anchoritem dst="mLblTitle" dstEdge="LEFT" spacing="1.49254un" src="" srcEdge="LEFT"/>
+ <anchoritem dst="mLblTitle" dstEdge="TOP" spacing="1.04478un" src="" srcEdge="TOP"/>
+ <anchoritem dst="mLblTitle" dstEdge="RIGHT" spacing="1.49254un" src="" srcEdge="RIGHT"/>
+ <anchoritem dst="mDetailsContainer" dstEdge="TOP" spacing="6.71642un" src="" srcEdge="TOP"/>
+ <anchoritem dst="mDetailsContainer" dstEdge="LEFT" spacing="49.40299un" src="" srcEdge="LEFT"/>
+ <anchoritem dst="mThumbRating" dstEdge="LEFT" spacing="1.49254un" src="" srcEdge="LEFT"/>
+ <anchoritem dst="mThumbRating" dstEdge="TOP" spacing="6.71642un" src="" srcEdge="TOP"/>
+ <anchoritem dst="mDetailsContainer" dstEdge="LEFT" spacing="0.14925un" src="mThumbRating" srcEdge="RIGHT"/>
</layout>
</widget>
- <widget name="mContent" role="HbView:widget" type="HbWidget">
- <widget name="mBtnAttach" type="HbPushButton">
- <real name="z" value="2"/>
- <sizehint height="47.52147" type="PREFERRED" width="317"/>
- <string name="text" value="Attach"/>
- </widget>
- <layout type="anchor">
- <anchoritem dst="mDetailScrollArea" dstEdge="TOP" spacing="303" src="" srcEdge="TOP"/>
- <anchoritem dst="mLblTitle" dstEdge="TOP" spacing="7" src="" srcEdge="TOP"/>
- <anchoritem dst="mThumbRating" dstEdge="LEFT" spacing="20" src="" srcEdge="LEFT"/>
- <anchoritem dst="mThumbRating" dstEdge="TOP" spacing="45" src="" srcEdge="TOP"/>
- <anchoritem dst="mLblTitle" dstEdge="LEFT" spacing="20" src="" srcEdge="LEFT"/>
- <anchoritem dst="mDetailScrollArea" dstEdge="LEFT" spacing="20" src="" srcEdge="LEFT"/>
- <anchoritem dst="mBtnAttach" dstEdge="LEFT" spacing="19" src="" srcEdge="LEFT"/>
- <anchoritem dst="mBtnAttach" dstEdge="BOTTOM" spacing="1.65" src="" srcEdge="BOTTOM"/>
- </layout>
+ <widget name="mLayoutVideoInfo" role="HbScrollArea:contents" type="HbWidget">
+ <layout orientation="Vertical" type="linear"/>
</widget>
</section>
- <section name="landscape_fetch">
- <widget name="mLayoutVideoInfo" role="HbScrollArea:contents" type="HbWidget">
- <widget name="container" type="HbWidget">
- <widget name="mRatingSlider" type="HbRatingSlider">
- <sizepolicy horizontalPolicy="Preferred" horizontalStretch="0" verticalPolicy="Preferred" verticalStretch="0"/>
- <sizehint height="50" type="PREFERRED" width="100"/>
- <sizehint height="50" type="MINIMUM" width="50"/>
- <sizehint height="50" type="MAXIMUM" width="500"/>
- </widget>
- <real name="z" value="0"/>
- <sizehint height="50" type="PREFERRED" width="320"/>
- <layout orientation="Horizontal" type="linear">
- <contentsmargins bottom="0px" left="20px" right="9px" top="0px"/>
- <linearitem itemname="mRatingSlider"/>
- </layout>
- </widget>
- <layout orientation="Vertical" type="linear">
- <linearitem itemname="container"/>
- <linearitem itemname="mLblDetail1"/>
- <linearitem itemname="mLblDetail2"/>
- <linearitem itemname="mLblDetail3"/>
- <linearitem itemname="mLblDetail4"/>
- <linearitem itemname="mLblDetail5"/>
- <linearitem itemname="mLblDetail6"/>
- <linearitem itemname="mLblDetail7"/>
- <linearitem itemname="mLblDetail8"/>
- <linearitem itemname="mLblDetail9"/>
- <linearitem itemname="mLblDetail10"/>
- <linearitem itemname="mLblDetail11"/>
- <linearitem itemname="mLblDetail12"/>
- <linearitem itemname="mLblDetail13"/>
- <linearitem itemname="mLblDetail14"/>
- <linearitem itemname="mLblDetail15"/>
- <linearitem itemname="mLblDetail16"/>
- </layout>
- </widget>
- <widget name="mThumbRating" type="HbWidget">
- <widget name="mBtnAttach" type="HbPushButton">
- <rect height="47.52147" name="geometry" width="302" x="9" y="193.47853"/>
- <string name="text" value="Attach"/>
- </widget>
- <layout orientation="Vertical" type="linear">
- <linearitem itemname="mBtnPlay"/>
- <linearitem itemname="mBtnAttach"/>
- </layout>
- </widget>
- <widget name="mContent" role="HbView:widget" type="HbWidget">
- <layout type="anchor">
- <anchoritem dst="mThumbRating" dstEdge="LEFT" spacing="10" src="" srcEdge="LEFT"/>
- <anchoritem dst="mThumbRating" dstEdge="TOP" spacing="45" src="" srcEdge="TOP"/>
- <anchoritem dst="mLblTitle" dstEdge="LEFT" spacing="10" src="" srcEdge="LEFT"/>
- <anchoritem dst="mLblTitle" dstEdge="TOP" spacing="7" src="" srcEdge="TOP"/>
- <anchoritem dst="mLblTitle" dstEdge="RIGHT" spacing="10" src="" srcEdge="RIGHT"/>
- <anchoritem dst="mDetailScrollArea" dstEdge="LEFT" spacing="320" src="" srcEdge="LEFT"/>
- <anchoritem dst="mDetailScrollArea" dstEdge="TOP" spacing="45" src="" srcEdge="TOP"/>
- </layout>
- </widget>
- </section>
- <metadata activeUIState="portrait" display="QHD portrait" unit="px">
+ <metadata activeUIState="portrait" display="NHD portrait" unit="un">
<uistate name="Common ui state" sections="#common"/>
<uistate name="portrait" sections="#common portrait"/>
<uistate name="landscape" sections="#common landscape"/>
- <uistate name="portrait_fetch" sections="#common portrait_fetch"/>
- <uistate name="landscape_fetch" sections="#common landscape_fetch"/>
</metadata>
</hbdocument>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videofiledetailsview/inc/videodetailslabel.h Thu Apr 01 23:22:15 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: VideoDetailsLabel class definition
+*
+*/
+
+#ifndef _VIDEODETAILSLABEL_H
+#define _VIDEODETAILSLABEL_H
+
+// SYSTEM INCLUDES
+#include <hblabel.h>
+
+// FORWORD DECLARATIONS
+class QGraphicsSceneMouseEvent;
+
+/**
+ * This class is a custom layout widget for Contact Card layout.
+ */
+class VideoDetailsLabel : public HbLabel
+{
+Q_OBJECT
+
+public:
+
+ /**
+ * Constructor
+ */
+ explicit VideoDetailsLabel(QGraphicsItem *parent = 0);
+
+ /**
+ * Destructor
+ */
+ virtual ~VideoDetailsLabel();
+
+public:
+
+ void mousePressEvent ( QGraphicsSceneMouseEvent *event );
+
+ void click();
+
+signals:
+
+ /**
+ * Signal emitted when widget is clicked.
+ */
+ void clicked(bool);
+
+private:
+
+ /**
+ * Initialization function.
+ */
+ void init();
+};
+
+// EOF
+#endif
--- a/videocollection/videofiledetailsview/inc/videofiledetailsviewplugin.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videofiledetailsview/inc/videofiledetailsviewplugin.h Thu Apr 01 23:22:15 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* 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"
@@ -12,7 +12,7 @@
* Contributors:
*
* Description: VideoFileDetailsViewPlugin class definition
-*
+*
*/
#ifndef VIDEOFILEDETAILSPLUGIN_H
@@ -20,10 +20,11 @@
// INCLUDES
-#include <qobject>
+#include <qobject.h>
#include <mpxviewpluginqt.h>
#include <hbdocumentloader.h>
#include <qpixmap.h>
+#include <mpxitemid.h>
class VideoSortFilterProxyModel;
class QModelIndex;
@@ -32,10 +33,11 @@
class ThumbnailManager;
class VideoServices;
class VideoCollectionWrapper;
+class VideoDetailsLabel;
class VideoFileDetailsViewPlugin : public MpxViewPlugin
{
-
+
Q_OBJECT
public: // Constructor / destructor
@@ -43,40 +45,40 @@
/**
* Contructor.
*
- */
+ */
VideoFileDetailsViewPlugin();
-
+
/**
* Destructor.
*
- */
+ */
virtual ~VideoFileDetailsViewPlugin();
public: // from QViewPlugin
-
+
/**
* Initializes view creation.
*
*/
void createView();
-
+
/**
* Deallocates view and it's objects.
*/
void destroyView();
-
+
/**
* Activates view
*
*/
void activateView();
-
+
/**
* Deactivates view
*
*/
void deactivateView();
-
+
/**
* Returns a pointer to the view read from the XML
*
@@ -109,9 +111,9 @@
* @param orientation new orientation
*/
void orientationChange( Qt::Orientation orientation );
-
+
/**
- * Plugin user can notify oback button changes by connecting into this slot
+ * Plugin user can notify back button changes by connecting into this slot
*
*/
void back();
@@ -128,55 +130,55 @@
/**
* Signaled when short details are ready.
- *
- * @param index Index of the clip, needed when getting the data from model.
+ *
+ * @param id Mpx id of the clip, needed when getting the data from model.
*/
- void shortDetailsReadySlot(int index);
-
+ void shortDetailsReadySlot(TMPXItemId id);
+
/**
* Signaled when full details are ready.
- *
- * @param index Index of the clip, needed when getting the data from model.
+ *
+ * @param id Mpx id of the clip, needed when getting the data from model.
*/
- void fullDetailsReadySlot(int index);
-
+ void fullDetailsReadySlot(TMPXItemId id);
+
/**
* Slot that receives signal from play button to start playback.
*/
void startPlaybackSlot();
-
+
/**
* Slot that receives signal from send button
*/
void sendVideoSlot();
-
+
/**
* Slot that receives signal from delete button
*/
void deleteVideoSlot();
-
+
/**
- * Slot that receives signal when video(s) removed.
+ * Slot that receives signal when video(s) removed.
* If video to be removed is the one whose details
- * are visible, this view is deactivated and collection
+ * are visible, this view is deactivated and collection
* list view is put back on.
- *
+ *
* @param parent parent item index (not used at the moment)
* @param first first item to remove
* @param last last item to remove
*/
void rowsRemovedSlot(const QModelIndex &parent, int first, int last);
-
+
/**
* Slot is connected into videocollection wrapper's asyncStatus -signal
*
* Handles possible collection error; usually by just showing error msg
*
* @param errorCode error code
- * @param additional additional data gotten from the error
+ * @param additional additional data gotten from the error
*/
void handleErrorSlot(int errorCode, QVariant &additional);
-
+
/**
* Slot that is connected to thumbnailReady signal in tnwrapper, which
* signals when thumbnail loading has been completed.
@@ -195,9 +197,9 @@
*
*/
void preCreateView();
-
+
/**
- * Allocates view and rest of it's objects to be ready to
+ * Allocates view and rest of it's objects to be ready to
* be activated.
*
*/
@@ -208,7 +210,7 @@
*
*/
void deleteItem(QModelIndex index);
-
+
/**
* Starts fetching the large thumbnail with tnwrapper.
*/
@@ -217,18 +219,18 @@
/**
* Finds and return the widget from document loader with the given name. Casts
* to templated type.
- *
+ *
* @param name Name of the widget
* @return The widget.
*/
- template<class T>
+ template<class T>
T* findWidget(QString name);
-
+
template<class T>
T* findObject(QString name);
private:
-
+
/**
* Details view create status
*/
@@ -243,7 +245,7 @@
* Document loader that holds the view object
*/
HbDocumentLoader mView;
-
+
/**
* Pointer to the model that holds video details. Not owned.
*/
@@ -272,32 +274,42 @@
* if EFinalized, view creation has been finalised
*/
TViewStatus mCreated;
+
+ /**
+ * Mpx id of the video clip.
+ */
+ TMPXItemId mVideoId;
/**
- * Index of the video clip in the model.
+ * Index of the clip to be deleted in the proxy model.
*/
- int mVideoIndex;
-
- /**
- * Defined action to be set to top right button, when view is activated
+ int mDeletedIndex;
+
+ /**
+ * Navigation softkey action object for back.
*/
- HbAction *mSecSkAction;
-
+ HbAction *mNavKeyBackAction;
+
/**
* Title animation widget
*/
HbMarqueeItem *mTitleAnim;
-
+
+ /**
+ * Thumbnail label
+ */
+ VideoDetailsLabel *mThumbLabel;
+
/**
* Thumbnail manager.
*/
ThumbnailManager* mThumbnailManager;
-
+
/**
* Collection wrapper.
*/
- VideoCollectionWrapper *mCollectionWrapper;
-
+ VideoCollectionWrapper &mCollectionWrapper;
+
};
#endif // VIDEOFILEDETAILSPLUGIN_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videofiledetailsview/src/videodetailslabel.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* 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: VideoDetailsLabel class implementation
+*
+*/
+
+#include "videodetailslabel.h"
+
+// SYSTEM INCLUDES
+#include <HbLabel>
+#include <QGraphicsSceneMouseEvent>
+
+//---------------------------------------------------------------
+// VideoDetailsLabel::VideoDetailsLabel
+// @see header
+//---------------------------------------------------------------
+VideoDetailsLabel::VideoDetailsLabel(QGraphicsItem *parent) :
+ HbLabel(parent)
+{
+}
+
+//---------------------------------------------------------------
+// VideoDetailsLabel::~VideoDetailsLabel
+// @see header
+//---------------------------------------------------------------
+VideoDetailsLabel::~VideoDetailsLabel()
+{
+}
+
+//---------------------------------------------------------------
+// VideoDetailsLabel::click
+// @see header
+//---------------------------------------------------------------
+void VideoDetailsLabel::click()
+{
+ emit clicked(true);
+}
+
+//---------------------------------------------------------------
+// VideoDetailsLabel::init
+// @see header
+//---------------------------------------------------------------
+void VideoDetailsLabel::mousePressEvent(QGraphicsSceneMouseEvent *event)
+{
+ Q_UNUSED(event);
+ emit clicked(true);
+}
+
+// EOF
--- a/videocollection/videofiledetailsview/src/videofiledetailsviewplugin.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videofiledetailsview/src/videofiledetailsviewplugin.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* 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"
@@ -12,26 +12,26 @@
* Contributors:
*
* Description: VideoCollectionViewPlugin class implementation
-*
+*
*/
// INCLUDE FILES
+#include <qcoreapplication.h>
#include <xqserviceutil.h>
#include <xqplugin.h>
#include <hbview.h>
#include <hbinstance.h>
-#include <hblabel.h>
#include <hbstackedwidget.h>
#include <hbmarqueeitem.h>
#include <hbpushbutton.h>
#include <hbaction.h>
-#include <hbratingslider.h>
-#include <hbscrollarea.h>
#include <qabstractitemmodel.h>
#include <qdebug.h>
#include <hbmessagebox.h>
+#include <hblistwidget.h>
+#include <hblistwidgetitem.h>
+#include <hblistviewitem.h>
#include <cmath>
-#include <hbframedrawer.h>
#include <thumbnailmanager_qt.h>
#include "videocollectionclient.h"
#include "videofiledetailsviewplugin.h"
@@ -40,24 +40,19 @@
#include "videocollectionwrapper.h"
#include "videosortfilterproxymodel.h"
#include "videoservices.h"
+#include "videodetailslabel.h"
const char* const VIDEO_DETAILS_DOCML = ":/xml/videofiledetails.docml";
const char* const VIDEO_DETAILS_GFX_PLAY = ":/gfx/play.png";
const char* const VIDEO_DETAILS_GFX_DEFAULT = ":/gfx/pri_large_video.svg";
const char* const VIDEO_DETAILS_VIEW = "videofiledetailsview";
const char* const VIDEO_DETAILS_TITLE = "mLblTitle";
-const char* const VIDEO_DETAILS_RATING = "mRatingSlider";
-const char* const VIDEO_DETAILS_LAYOUT_VIDEO_INFO = "mLayoutVideoInfo";
-const char* const VIDEO_DETAILS_DETAIL_SCROLL_AREA = "mDetailScrollArea";
-const char* const VIDEO_DETAILS_ITEM = "mLblDetail";
-const char* const VIDEO_DETAILS_BUTTON_PLAY = "mBtnPlay";
-const char* const VIDEO_DETAILS_BUTTON_ATTACH = "mBtnAttach";
+const char* const VIDEO_DETAILS_THUMBNAIL = "mDetailsLabel";
+const char* const VIDEO_DETAILS_BUTTON = "mButton";
const char* const VIDEO_DETAILS_MENUACTION_DELETE = "mOptionsDelete";
-const char* const VIDEO_DETAILS_MENUACTION_SHARE = "mOptionsShare";
+const char* const VIDEO_DETAILS_LISTWIDGET ="mDetailsList";
-const int VIDEO_DETAILS_DETAIL_AMOUNT = 6;
-
-// Just for testing, remove this
+// Just for testing, remove this
void _DebugNotImplementedYet()
{
HbMessageBox::information(QObject::tr("Not implemented yet"));
@@ -73,12 +68,15 @@
mActivated(false),
mIsService(false),
mCreated(VideoFileDetailsViewPlugin::ENotCreated),
- mVideoIndex(-1),
- mSecSkAction(0),
+ mVideoId(TMPXItemId::InvalidId()),
+ mDeletedIndex(-1),
+ mNavKeyBackAction(0),
mTitleAnim(0),
- mThumbnailManager(0)
+ mThumbLabel(0),
+ mThumbnailManager(0),
+ mCollectionWrapper(VideoCollectionWrapper::instance())
{
- mCollectionWrapper = VideoCollectionWrapper::instance();
+
}
// ---------------------------------------------------------------------------
@@ -87,7 +85,7 @@
//
VideoFileDetailsViewPlugin::~VideoFileDetailsViewPlugin()
{
- destroyView();
+ destroyView();
}
// ---------------------------------------------------------------------------
@@ -114,7 +112,7 @@
{
mActivated = false;
mCreated = VideoFileDetailsViewPlugin::EPreCreated;
-
+
if (!mThumbnailManager)
{
mThumbnailManager = new ThumbnailManager();
@@ -132,10 +130,7 @@
bool ok = false;
mView.load(VIDEO_DETAILS_DOCML, &ok);
- if(mCollectionWrapper)
- {
- mModel = mCollectionWrapper->getModel();
- }
+ mModel = mCollectionWrapper.getModel(VideoCollectionWrapper::EAllVideos);
if (!mModel)
{
@@ -149,47 +144,53 @@
// no deallocation needed for this since
// stackedwidget takes ownership
mTitleAnim = new HbMarqueeItem;
- mTitleAnim->setLoopCount(-1);
+ HbFontSpec spec = mTitleAnim->fontSpec();
+ spec.setRole( HbFontSpec::Primary );
+ mTitleAnim->setFontSpec( spec );
+ mTitleAnim->setLoopCount(-1);
+
+ connect(mModel->sourceModel(),
+ SIGNAL(shortDetailsReady(TMPXItemId)),
+ this, SLOT(shortDetailsReadySlot(TMPXItemId)));
connect(mModel,
- SIGNAL(shortDetailsReady(int)),
- this, SLOT(shortDetailsReadySlot(int)));
-
- connect(mModel,
- SIGNAL(fullDetailsReady(int)),
- this, SLOT(fullDetailsReadySlot(int)));
+ SIGNAL(fullDetailsReady(TMPXItemId)),
+ this, SLOT(fullDetailsReadySlot(TMPXItemId)));
connect(mModel,
SIGNAL(rowsRemoved(const QModelIndex&, int, int)),
this, SLOT(rowsRemovedSlot(const QModelIndex&, int, int)));
- HbPushButton* playBtn = findWidget<HbPushButton>(VIDEO_DETAILS_BUTTON_PLAY);
+ HbStackedWidget* thumbWidget = findWidget<HbStackedWidget>(VIDEO_DETAILS_THUMBNAIL);
+
+ // no deallocation needed for this since
+ // stackedwidget takes ownership
+ mThumbLabel = new VideoDetailsLabel;
+
+ mThumbLabel->setAlignment(Qt::AlignCenter);
+
+ connect(mThumbLabel, SIGNAL(clicked(bool)), this, SLOT(startPlaybackSlot()));
+
+ thumbWidget->addWidget(mThumbLabel);
+
HbStackedWidget* title = findObject<HbStackedWidget>(VIDEO_DETAILS_TITLE);
-
title->addWidget(mTitleAnim);
- HbFrameDrawer* drawer = new HbFrameDrawer("VideoDetailsFrameGraphic", HbFrameDrawer::OnePiece);
- drawer->setFillWholeRect(true);
- playBtn->setFrameBackground(drawer);
-
- connect(playBtn, SIGNAL(clicked(bool)), this, SLOT(startPlaybackSlot()));
-
HbAction* deleteAction = findObject<HbAction>(VIDEO_DETAILS_MENUACTION_DELETE);
- HbAction* shareAction = findObject<HbAction>(VIDEO_DETAILS_MENUACTION_SHARE);
if (mIsService)
{
deleteAction->setVisible(false);
- shareAction->setVisible(false);
}
else
{
connect(deleteAction, SIGNAL(triggered(bool)), this, SLOT(deleteVideoSlot()));
- connect(shareAction, SIGNAL(triggered(bool)), this, SLOT(sendVideoSlot()));
}
- mSecSkAction = new HbAction( Hb::BackAction );
- connect(mThumbnailManager, SIGNAL(thumbnailReady(QPixmap,void*,int,int)),
+ // Create navigation keys.
+ mNavKeyBackAction = new HbAction(Hb::BackNaviAction);
+
+ connect(mThumbnailManager, SIGNAL(thumbnailReady(QPixmap,void*,int,int)),
this, SLOT(thumbnailReadySlot(QPixmap,void*,int,int)));
}
@@ -210,13 +211,7 @@
mVideoServices = 0;
}
- if(mCollectionWrapper)
- {
- mCollectionWrapper->decreaseReferenceCount();
- mCollectionWrapper = 0;
- }
-
- delete mSecSkAction; mSecSkAction = 0;
+ delete mNavKeyBackAction; mNavKeyBackAction = 0;
delete mThumbnailManager; mThumbnailManager = 0;
disconnect();
mView.reset();
@@ -228,34 +223,35 @@
//
void VideoFileDetailsViewPlugin::activateView()
{
-
if ( !mActivated && (VideoFileDetailsViewPlugin::EFinalized == mCreated))
{
HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
- mainWnd->addSoftKeyAction( Hb::SecondarySoftKey, mSecSkAction );
+ HbView *currentView = mainWnd->currentView();
+ if(currentView && mNavKeyBackAction)
+ {
+ if (connect(mNavKeyBackAction, SIGNAL(triggered()), this, SLOT(back())))
+ {
+ currentView->setNavigationAction(mNavKeyBackAction);
+ }
+ else
+ {
+ return;
+ }
+ }
+
+ mainWnd->setOrientation(Qt::Vertical, false);
+
+ // following if is for the future implementations where we should support
+ // also landscape configuration.
Qt::Orientation orientation = mainWnd->orientation();
if ( orientation == Qt::Vertical )
{
- if (mIsService)
- {
- mView.load(VIDEO_DETAILS_DOCML, "portrait_fetch");
- }
- else
- {
- mView.load(VIDEO_DETAILS_DOCML, "portrait");
- }
+ mView.load(VIDEO_DETAILS_DOCML, "portrait");
}
else if ( orientation == Qt::Horizontal )
{
- if (mIsService)
- {
- mView.load(VIDEO_DETAILS_DOCML, "landscape_fetch");
- }
- else
- {
- mView.load(VIDEO_DETAILS_DOCML, "landscape");
- }
+ mView.load(VIDEO_DETAILS_DOCML, "landscape");
}
if (mIsService && !mVideoServices)
@@ -266,30 +262,38 @@
{
return;
}
- else
- {
- HbPushButton* attachBtn = findWidget<HbPushButton>(VIDEO_DETAILS_BUTTON_ATTACH);
- connect(attachBtn, SIGNAL(clicked(bool)), this, SLOT(getFileUri()));
- connect(this, SIGNAL(fileUri(const QString&)), mVideoServices, SLOT(itemSelected(const QString&)));
- }
+ }
+ if (mIsService && mVideoServices)
+ {
+ HbPushButton* attachBtn = findWidget<HbPushButton>(VIDEO_DETAILS_BUTTON);
+ attachBtn->setText(tr("Attach")); //TODO: Localisation
+
+ connect(attachBtn, SIGNAL(clicked(bool)), this, SLOT(getFileUri()));
+ connect(this, SIGNAL(fileUri(const QString&)), mVideoServices, SLOT(itemSelected(const QString&)));
+
+ HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
+
+ mainWnd->currentView()->setTitle(mVideoServices->contextTitle());
+ }
+ else if(!mIsService)
+ {
+ HbPushButton* shareBtn = findWidget<HbPushButton>(VIDEO_DETAILS_BUTTON);
+ connect(shareBtn, SIGNAL(triggered(bool)), this, SLOT(sendVideoSlot()));
+ shareBtn->setText(hbTrId("txt_videos_opt_share"));
}
- connect(mainWnd->softKeyAction(Hb::SecondarySoftKey),
- SIGNAL(triggered()), this, SLOT(back()));
connect(mainWnd,
SIGNAL(orientationChanged(Qt::Orientation)),
this, SLOT(orientationChange(Qt::Orientation)));
- connect(mCollectionWrapper,
- SIGNAL(asyncStatus(int, QVariant&)),
+
+ connect(&mCollectionWrapper,
+ SIGNAL(asyncStatus(int, QVariant&)),
this, SLOT(handleErrorSlot(int, QVariant&)));
- // scroll the scrollarea back to top.
- findWidget<HbScrollArea>(VIDEO_DETAILS_DETAIL_SCROLL_AREA)->scrollContentsTo(QPointF(0, 0));
-
// setup title size in order for animation to be enabled if needed
- mTitleAnim->setPreferredSize(findObject<HbStackedWidget>(VIDEO_DETAILS_TITLE)->preferredSize());
+ mTitleAnim->setMinimumWidth(hbInstance->allMainWindows().value(0)->width()-50);
mTitleAnim->adjustSize();
-
+
mActivated = true;
}
}
@@ -302,35 +306,47 @@
{
if ( mActivated )
{
- mVideoIndex = -1; // set video index as invalid.
-
+ mVideoId = TMPXItemId::InvalidId();
+
+ mDeletedIndex = -1; // set index as invalid.
+
HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
-
- disconnect(mainWnd->softKeyAction(Hb::SecondarySoftKey),
- SIGNAL(triggered()), this, SLOT(back()));
+
+ mainWnd->unsetOrientation();
+
+ HbView *currentView = mainWnd->currentView();
+ if(currentView)
+ {
+ currentView->setNavigationAction(0);
+ }
+
+ disconnect(mNavKeyBackAction, SIGNAL(triggered()), this, SLOT(back()));
disconnect(mainWnd, SIGNAL( orientationChanged( Qt::Orientation ) ),
this, SLOT( orientationChange( Qt::Orientation ) ));
- disconnect(mCollectionWrapper,
- SIGNAL(asyncStatus(int, QVariant&)),
+ disconnect(&mCollectionWrapper,
+ SIGNAL(asyncStatus(int, QVariant&)),
this, SLOT(handleErrorSlot(int, QVariant&)));
- mainWnd->removeSoftKeyAction(Hb::SecondarySoftKey, mSecSkAction);
-
mTitleAnim->stopAnimation();
mTitleAnim->setText("");
-
+
mActivated = false;
- findWidget<HbPushButton>(VIDEO_DETAILS_BUTTON_PLAY)->setIcon(QIcon());
+ mThumbLabel->setIcon(HbIcon());
+
+ HbPushButton* button = findWidget<HbPushButton>(VIDEO_DETAILS_BUTTON);
if (mIsService)
{
- HbPushButton* attachBtn = findWidget<HbPushButton>(VIDEO_DETAILS_BUTTON_ATTACH);
- disconnect(attachBtn, SIGNAL(clicked(bool)), this, SLOT(getFileUri()));
+ disconnect(button, SIGNAL(clicked(bool)), this, SLOT(getFileUri()));
disconnect(this, SIGNAL(fileUri(const QString&)), mVideoServices, SLOT(itemSelected(const QString&)));
}
+ else
+ {
+ disconnect(button, SIGNAL(triggered(bool)), this, SLOT(sendVideoSlot()));
+ }
}
}
@@ -349,29 +365,15 @@
// ---------------------------------------------------------------------------
//
void VideoFileDetailsViewPlugin::orientationChange( Qt::Orientation orientation )
-{
- if ( orientation == Qt::Vertical )
+{
+ if ( orientation == Qt::Vertical )
{
- if (mIsService)
- {
- mView.load(VIDEO_DETAILS_DOCML, "portrait_fetch");
- }
- else
- {
- mView.load(VIDEO_DETAILS_DOCML, "portrait");
- }
+ mView.load(VIDEO_DETAILS_DOCML, "portrait");
}
-
- else if ( orientation == Qt::Horizontal )
+
+ else if ( orientation == Qt::Horizontal )
{
- if (mIsService)
- {
- mView.load(VIDEO_DETAILS_DOCML, "landscape_fetch");
- }
- else
- {
- mView.load(VIDEO_DETAILS_DOCML, "landscape");
- }
+ mView.load(VIDEO_DETAILS_DOCML, "landscape");
}
mTitleAnim->adjustSize();
mTitleAnim->startAnimation();
@@ -393,27 +395,21 @@
// Slot: shortDetailsReadySlot
// ---------------------------------------------------------------------------
//
-void VideoFileDetailsViewPlugin::shortDetailsReadySlot(int index)
+void VideoFileDetailsViewPlugin::shortDetailsReadySlot(TMPXItemId id)
{
// first clear all details, so that the view doesn't display the old data.
- int detailCount = sizeof(VideoCollectionCommon::VideoDetailLabelKeys) / sizeof(int);
- for(int i = 0; i<detailCount; i++) {
- HbLabel* detail = findWidget<HbLabel>(VIDEO_DETAILS_ITEM +
- QString::number(i+1));
- detail->setPlainText(QString());
- }
+ findWidget<HbListWidget>(VIDEO_DETAILS_LISTWIDGET)->clear();
- QModelIndex modelIndex = mModel->index(index, 0);
+ QModelIndex modelIndex = mModel->indexOfId(id);
+
+ mVideoId = id;
- mVideoIndex = index;
-
- // index assumed to come from source model, so data will be fetched from there
- QVariant variant = mModel->sourceModel()->data(modelIndex, Qt::DisplayRole);
+ QVariant variant = mModel->data(modelIndex, Qt::DisplayRole);
- if (variant.isValid() && mTitleAnim)
+ if (variant.isValid() && mTitleAnim)
{
- mTitleAnim->setText(variant.toStringList().first());
- }
+ mTitleAnim->setText(variant.toStringList().first());
+ }
startFetchingThumbnail();
}
@@ -421,50 +417,41 @@
// Slot: fullDetailsReadySlot
// ---------------------------------------------------------------------------
//
-void VideoFileDetailsViewPlugin::fullDetailsReadySlot(int index)
+void VideoFileDetailsViewPlugin::fullDetailsReadySlot(TMPXItemId id)
{
using namespace VideoCollectionCommon;
-
+
int detailCount = sizeof(VideoDetailLabelKeys) / sizeof(int);
- QModelIndex modelIndex = mModel->index(index, 0);
- int detailAmount = 1;
- int heightOfVisibleItems = 0;
-
- // index received comes from source model so we need to fetch data
- // directly from there
- QVariant variant = mModel->sourceModel()->data(modelIndex, KeyMetaData);
+ QModelIndex modelIndex = mModel->indexOfId(id);
+
+ QVariant variant = mModel->data(modelIndex, KeyMetaData);
+
QMap<QString, QVariant> metadata = variant.toMap();
-
+
+ HbListWidget* list = findWidget<HbListWidget>(VIDEO_DETAILS_LISTWIDGET);
+
+ if(list->count())
+ {
+ list->clear();
+ }
+
+ //TODO: define maximum line count once >3 supported
+ HbListViewItem *prototype = list->listItemPrototype();
+ prototype->setSecondaryTextRowCount(1, 3);
+
for(int i = 0; i< detailCount; i++) {
- if (metadata.contains(VideoDetailLabelKeys[i])) {
- HbLabel* detail = findWidget<HbLabel>(VIDEO_DETAILS_ITEM +
- QString::number(detailAmount));
- detail->setTextWrapping(Hb::TextWordWrap);
- detail->setElideMode(Qt::ElideNone);
- detail->setPlainText(tr(VideoDetailLabels[i]).arg(
- metadata[VideoDetailLabelKeys[i]].toString()));
+ if (metadata.contains(VideoDetailLabelKeys[i]))
+ {
+ HbListWidgetItem* listWidgetItem = new HbListWidgetItem();
+ listWidgetItem->setEnabled(false);
- detailAmount++;
- heightOfVisibleItems += detail->preferredHeight();
+ listWidgetItem->setText( hbTrId(VideoDetailLabels[i]) );
+ listWidgetItem->setSecondaryText( metadata[VideoDetailLabelKeys[i]].toString() );
+ list->addItem( listWidgetItem );
}
}
- for(; detailAmount <= VIDEO_DETAILS_DETAIL_AMOUNT; detailAmount++) {
- HbLabel* detail = findWidget<HbLabel>(VIDEO_DETAILS_ITEM +
- QString::number(detailAmount));
- detail->hide();
- }
-
- findWidget<HbWidget>(VIDEO_DETAILS_LAYOUT_VIDEO_INFO)->setPreferredHeight(heightOfVisibleItems);
- findWidget<HbWidget>(VIDEO_DETAILS_LAYOUT_VIDEO_INFO)->adjustSize();
-
- int rating = 0;
- if (metadata.contains(MetaKeyStarRating)) {
- rating = metadata[MetaKeyStarRating].toInt();
- }
- findWidget<HbRatingSlider>(VIDEO_DETAILS_RATING)->setCurrentRating(rating);
-
// start title animation
mTitleAnim->startAnimation();
}
@@ -475,9 +462,10 @@
//
void VideoFileDetailsViewPlugin::getFileUri()
{
- if (mVideoIndex >= 0)
+ if (mVideoId != TMPXItemId::InvalidId())
{
- QVariant variant = mModel->data(mModel->index(mVideoIndex, 0), VideoCollectionCommon::KeyFilePath);
+ QModelIndex modelIndex = mModel->indexOfId(mVideoId);
+ QVariant variant = mModel->data(modelIndex, VideoCollectionCommon::KeyFilePath);
if ( variant.isValid() )
{
QString itemPath = variant.value<QString>();
@@ -492,9 +480,10 @@
//
void VideoFileDetailsViewPlugin::startPlaybackSlot()
{
- if (mVideoIndex >= 0) {
- mModel->openItem(mModel->index(mVideoIndex, 0));
- }
+ if (mVideoId != TMPXItemId::InvalidId())
+ {
+ mModel->openItem(mVideoId);
+ }
}
// ---------------------------------------------------------------------------
@@ -512,15 +501,17 @@
//
void VideoFileDetailsViewPlugin::deleteVideoSlot()
{
- if (mVideoIndex > -1)
+ if (mVideoId != TMPXItemId::InvalidId())
{
- QModelIndex modelIndex = mModel->index(mVideoIndex, 0);
- QVariant variant = mModel->data(modelIndex, Qt::DisplayRole);
+ QModelIndex modelIndex = mModel->indexOfId(mVideoId);
+ QVariant variant = mModel->data(modelIndex, Qt::DisplayRole);
- if (variant.isValid()) {
- QString text = tr("Do you want to delete \"%1\"?").arg(variant.toStringList().first());
+ if (variant.isValid())
+ {
+ QString text = tr("Do you want to delete \"%1\"?").arg(variant.toStringList().first()); //TODO: Localisation: txt_common_menu_delete
- if (HbMessageBox::question(text)){
+ if (HbMessageBox::question(text))
+ {
deleteItem(modelIndex);
}
}
@@ -533,6 +524,8 @@
//
void VideoFileDetailsViewPlugin::deleteItem(QModelIndex index)
{
+ mDeletedIndex = index.row();
+
QModelIndexList list;
list.append(index);
mModel->deleteItems(list);
@@ -543,11 +536,13 @@
// Slot: rowsRemovedSlot
// ---------------------------------------------------------------------------
//
-void VideoFileDetailsViewPlugin::rowsRemovedSlot(const QModelIndex& /*parent*/,
+void VideoFileDetailsViewPlugin::rowsRemovedSlot(const QModelIndex& parent,
int first, int last)
{
- if(mActivated && mVideoIndex > -1 &&
- (mVideoIndex >= first && mVideoIndex <= last))
+ Q_UNUSED(parent);
+
+ if(mActivated && mDeletedIndex > -1 &&
+ (mDeletedIndex >= first && mDeletedIndex <= last))
{
// item is withing the group of removed items, deactivate view
emit command(MpxHbVideoCommon::ActivateCollectionView);
@@ -564,7 +559,7 @@
QString msg("");
if(errorCode == VideoCollectionCommon::statusSingleDeleteFail)
{
- QString format = tr("Unable to delete item %1. It is currently open.");
+ QString format = tr("Unable to delete item %1. It is currently open."); //TODO: Localisation
if(additional.isValid())
{
msg = format.arg(additional.toString());
@@ -574,56 +569,74 @@
{
// show msg box if there's something to show
HbMessageBox::warning(msg);
- }
+ }
}
// ---------------------------------------------------------------------------
// Slot: thumbnailReadySlot
// ---------------------------------------------------------------------------
//
-void VideoFileDetailsViewPlugin::thumbnailReadySlot(QPixmap pixmap,
+void VideoFileDetailsViewPlugin::thumbnailReadySlot(QPixmap pixmap,
void * clientData, int id, int errorCode)
{
Q_UNUSED(clientData);
Q_UNUSED(id);
- HbPushButton* playBtn = findWidget<HbPushButton>(VIDEO_DETAILS_BUTTON_PLAY);
- QSize size(playBtn->size().toSize());
+ QSize size(mThumbLabel->size().toSize());
QImage play(VIDEO_DETAILS_GFX_PLAY);
- if (!errorCode) {
-
+ if (!errorCode)
+ {
QImage sourceImage = pixmap.toImage();
- if ((sourceImage.size().height() > size.height()) || (sourceImage.size().width() > size.width()))
+ if ((sourceImage.size().height() != size.height()) || (sourceImage.size().width() != size.width()))
{
// 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 (sourceImage.size().width() > (4*size.width()) || sourceImage.size().height() > (4*size.height()))
{
QSize intermediate_size = QSize( size.width() * 2, size.height() * 2 );
- sourceImage = sourceImage.scaled(intermediate_size, Qt::KeepAspectRatio, Qt::FastTransformation );
+ sourceImage = sourceImage.scaled(intermediate_size, Qt::KeepAspectRatioByExpanding, Qt::FastTransformation );
}
- sourceImage = sourceImage.scaled(size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+ sourceImage = sourceImage.scaled(size, Qt::KeepAspectRatioByExpanding, Qt::SmoothTransformation);
}
+ int difference(0);
+ QRect rect = mThumbLabel->rect().toRect();
+
+ if(sourceImage.width() > size.width())
+ {
+ difference = sourceImage.width() - size.width();
+ difference = (difference/2)+1;
+ rect.moveLeft(rect.left()+difference);
+ }
+ else if(sourceImage.height() > size.height())
+ {
+ difference = sourceImage.height() - size.height();
+ difference = (difference/2)+1;
+ rect.moveBottom(rect.bottom()+difference);
+ }
+
+ sourceImage = sourceImage.copy(rect);
QImage resultImage = QImage(sourceImage.size(), QImage::Format_ARGB32_Premultiplied);
+
QPainter painter(&resultImage);
painter.setCompositionMode(QPainter::CompositionMode_Source);
painter.fillRect(resultImage.rect(), Qt::transparent);
painter.setCompositionMode(QPainter::CompositionMode_SourceOver);
- painter.drawImage( (int)(sourceImage.width() - play.width())/2,
- (int)(sourceImage.height() - play.height())/2,
+ painter.drawImage( (int)(sourceImage.width() - play.width())/2,
+ (int)(sourceImage.height() - play.height())/2,
play );
painter.setCompositionMode(QPainter::CompositionMode_Screen);
painter.drawImage(0, 0, sourceImage);
painter.end();
HbIcon compsedIcon(QPixmap::fromImage(resultImage));
- playBtn->setIcon(compsedIcon);
+ mThumbLabel->setIcon(compsedIcon);
}
- else {
- playBtn->setIcon(HbIcon(VIDEO_DETAILS_GFX_DEFAULT));
+ else
+ {
+ mThumbLabel->setIcon(HbIcon(VIDEO_DETAILS_GFX_DEFAULT));
}
}
@@ -634,19 +647,25 @@
void VideoFileDetailsViewPlugin::startFetchingThumbnail()
{
int tnId = -1;
-
- if(mModel && mThumbnailManager) {
- QVariant variant = mModel->data(mModel->index(mVideoIndex, 0), VideoCollectionCommon::KeyFilePath);
- if(variant.isValid()) {
+
+ if(mModel && mThumbnailManager)
+ {
+ QModelIndex modelIndex = mModel->indexOfId(mVideoId);
+ QVariant variant = mModel->data(modelIndex, VideoCollectionCommon::KeyFilePath);
+ if(variant.isValid())
+ {
mThumbnailManager->setThumbnailSize(ThumbnailManager::ThumbnailLarge);
tnId = mThumbnailManager->getThumbnail(variant.toString(), 0, 5000);
}
- } else {
+ }
+ else
+ {
qWarning() << "Tried to start fetching thumbnail when either mModel or mThumbnailManager is NULL!";
}
-
- if(tnId == -1) {
- // TODO set default thumbnail here
+
+ if(tnId == -1)
+ {
+ mThumbLabel->setIcon(HbIcon(VIDEO_DETAILS_GFX_DEFAULT));
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videofiledetailsview/tsrc/testplugin/inc/testvideofiledetails.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,236 @@
+/*
+* 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: TestVideoFileDetails class definition
+*
+*/
+
+#ifndef TESTVIDEOFILEDETAILS_H
+#define TESTVIDEOFILEDETAILS_H
+
+
+// INCLUDES
+#include <qobject>
+#include <qabstractitemmodel.h>
+#include <mpxitemid.h>
+
+class VideoFileDetailsViewPlugin;
+class VideoSortFilterProxyModel;
+class VideoCollectionWrapper;
+
+class TestVideoFileDetails : public QObject
+ {
+
+ Q_OBJECT
+
+public:
+
+ /**
+ * Used in testfunctions to init
+ */
+ void init();
+
+ /**
+ * used in testfunctions to cleanup
+ */
+ void cleanup();
+
+ /**
+ * common view activation call
+ */
+ void activateView();
+
+ /**
+ * creates some metadata to be "shown" in tests
+ */
+ QMap<QString, QVariant> createDummyMetadata();
+
+ /**
+ * runned when checking view activation related things
+ */
+ void activateViewTestRound();
+
+signals: // test signals to emit
+
+ /**
+ * short details test signal
+ */
+ void shortDetailsReady(TMPXItemId index);
+
+ /**
+ * full details test signal
+ */
+ void fullDetailsReady(TMPXItemId index);
+
+ /**
+ * data changed test signal
+ */
+ void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
+
+ /**
+ * Row removal test signal
+ */
+ void rowsRemoved(const QModelIndex &parent, int first, int last);
+
+ /**
+ * generic test signal
+ */
+ void testSignal();
+
+ /**
+ * for testing error signal slots
+ */
+ void testErrorSignal(int, QVariant&);
+
+public slots:
+
+ void handleCommand(int);
+
+private slots:
+
+ /**
+ * called at the very beginning of the test
+ */
+ void initTestCase();
+
+ /**
+ * called at the very end of the test
+ */
+ void cleanupTestCase();
+
+ /**
+ * verifies createView -method
+ */
+ void testCreateView();
+
+ /**
+ * verifies destroyView -method
+ */
+ void testDestroyView();
+
+ /**
+ * verifies activate in portrait mode
+ */
+ void testActivateViewPortrait();
+
+ /**
+ * verifies activate in landscape
+ */
+ void testActivateViewLandscape();
+
+ /**
+ * verifies deactivateView
+ */
+ void testDeactivateView();
+
+ /**
+ * verifies orientation changed datas
+ */
+ void testOrientationChange_data();
+
+ /**
+ * veries orienation changed method
+ */
+ void testOrientationChange();
+
+ /**
+ * verifies back -method
+ */
+ void testBack();
+
+ /**
+ * verifies shortdetails ready
+ */
+ void testShortDetailsReadySlot();
+
+ /**
+ * verifies fulldetailsready
+ */
+ void testFullDetailsReadySlot();
+
+ /**
+ * verifies startPlayback
+ */
+ void testStartPlaybackSlot();
+
+ /**
+ * verifies sendvideo -method
+ */
+ void testSendVideoSlot();
+
+ /**
+ * verifies delete video
+ */
+ void testDeleteVideoSlot();
+
+ /**
+ * verifies rowsRemoved
+ */
+ void testRowsRemovedSlot();
+
+ /**
+ * verifies error handling
+ */
+ void testHandleErrorSlot();
+
+ /**
+ * verifies thumbnail ready.
+ */
+ void testThumbnailReadySlot();
+
+private:
+
+ /**
+ * widget finder used when reading objetc from XML
+ */
+ template <class T>
+ T* findWidget(QString name);
+
+ /**
+ * Qobject finder used when reading objetc from XML
+ */
+ template<class T>
+ T* findObject(QString name);
+
+private:
+
+ /**
+ * stub model
+ */
+ VideoSortFilterProxyModel* mDummyModel;
+
+ /**
+ * Testable object
+ */
+ VideoFileDetailsViewPlugin* mPlugin;
+
+ /**
+ * indicate client has emitted signle received
+ * in handleCommand
+ */
+ bool mCommandReceived;
+
+ /**
+ * id of command recently received
+ */
+ int mReceivedCommand;
+
+public:
+
+ VideoCollectionWrapper *mWrapper;
+
+ };
+
+#endif // TESTVIDEOFILEDETAILS_H
+
+// End of File
--- a/videocollection/videofiledetailsview/tsrc/testplugin/src/testvideofiledetails.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videofiledetailsview/tsrc/testplugin/src/testvideofiledetails.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -22,13 +22,16 @@
#include <qdebug.h>
#include <hbinstance.h>
#include <hbwidget.h>
+#include <hblistwidget.h>
+#include <hblistwidgetitem.h>
#include <hbpushbutton.h>
#include <hblabel.h>
#include <hbaction.h>
#include <hbapplication.h>
-#include <hbscrollarea.h>
#include <hbmarqueeitem.h>
+#include <hbstackedwidget.h>
+#include "videodetailslabel.h"
#include "hbmessagebox.h"
#include "thumbnailmanager_qt.h"
#include "videocollectioncommon.h"
@@ -44,28 +47,23 @@
const char *TEST_VIDEO_DETAILS_VIEW = "videofiledetailsview";
const char *TEST_VIDEO_DETAILS_WIDGET = "mContent";
-
const char *TEST_VIDEO_DETAILS_TITLE = "mLblTitle";
-const char *TEST_VIDEO_DETAILS_ITEM = "mLblDetail";
-const char *TEST_VIDEO_DETAILS_BUTTON_PLAY = "mBtnPlay";
-const char* const VIDEO_DETAILS_BUTTON_ATTACH = "mBtnAttach";
-const char *TEST_VIDEO_DETAILS_MENUACTION_SHARE = "mOptionsShare";
+const char *TEST_VIDEO_DETAILS_LISTWIDGET ="mDetailsList";
+const char* const VIDEO_DETAILS_THUMBNAIL = "mDetailsLabel";
+const char* const VIDEO_DETAILS_BUTTON = "mButton";
const char *TEST_VIDEO_DETAILS_MENUACTION_DELETE = "mOptionsDelete";
-const char *TEST_VIDEO_DETAILS_SCROLLAREA = "mDetailScrollArea";
-
// ---------------------------------------------------------------------------
// initTestCase
// ---------------------------------------------------------------------------
//
void TestVideoFileDetails::initTestCase()
{
- mWrapper = VideoCollectionWrapper::instance();
mDummyModel = 0;
mDummyModel = new VideoSortFilterProxyModel();
- connect(this, SIGNAL(shortDetailsReady(int)), mDummyModel, SIGNAL(shortDetailsReady(int)));
- connect(this, SIGNAL(fullDetailsReady(int)), mDummyModel, SIGNAL(fullDetailsReady(int)));
+ connect(this, SIGNAL(shortDetailsReady(TMPXItemId)), mDummyModel, SIGNAL(shortDetailsReady(TMPXItemId)));
+ connect(this, SIGNAL(fullDetailsReady(TMPXItemId)), mDummyModel, SIGNAL(fullDetailsReady(TMPXItemId)));
connect(this, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)),
mDummyModel, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)));
@@ -73,7 +71,7 @@
connect(this, SIGNAL(rowsRemoved(const QModelIndex&, int, int)),
mDummyModel, SIGNAL(rowsRemoved(const QModelIndex&, int, int)));
- mWrapper->setModel(mDummyModel);
+ VideoCollectionWrapper::instance().setModel(mDummyModel);
}
// ---------------------------------------------------------------------------
@@ -90,8 +88,6 @@
mDummyModel, SIGNAL(rowsRemoved(const QModelIndex&, int, int)));
delete mDummyModel; mDummyModel = 0;
delete mPlugin; mPlugin = 0;
- mWrapper->decreaseReferenceCount();
- QCOMPARE(mWrapper->mReferenceCount, 0);
}
// ---------------------------------------------------------------------------
@@ -140,7 +136,7 @@
// Helper function that populates a qmap with dummy data.
// ---------------------------------------------------------------------------
//
-QMap<QString, QVariant> TestVideoFileDetails::createDummyMetadata(int ratingStartCount)
+QMap<QString, QVariant> TestVideoFileDetails::createDummyMetadata()
{
using namespace VideoCollectionCommon;
@@ -160,10 +156,6 @@
map[VideoDetailLabelKeys[i]] = txt;
}
}
- if(ratingStartCount > -1)
- {
- map[MetaKeyStarRating] = ratingStartCount;
- }
return map;
}
@@ -175,76 +167,37 @@
{
init();
- HbScrollArea* area = findWidget<HbScrollArea>(TEST_VIDEO_DETAILS_SCROLLAREA);
-
- // won't scroll without these
- area->contentWidget()->adjustSize();
- area->setHorizontalScrollBarPolicy(HbScrollArea::ScrollBarAutoHide);
-
- area->scrollContentsTo(QPointF(0, 200));
-
- QSignalSpy spy(area, SIGNAL(scrollPositionChanged(const QPointF)));
-
activateView();
QVERIFY( mPlugin->getView() != 0 );
QVERIFY( mPlugin->viewPlugin() == mPlugin );
- QCOMPARE( mPlugin->mVideoIndex, -1 );
-
- verifyOrientation();
+ QCOMPARE( mPlugin->mVideoId, TMPXItemId::InvalidId() );
// verify that actions are currently disabled.
- HbPushButton* playBtn = findWidget<HbPushButton>(TEST_VIDEO_DETAILS_BUTTON_PLAY);
- HbAction* shareAction = findObject<HbAction>(TEST_VIDEO_DETAILS_MENUACTION_SHARE);
+ HbStackedWidget* thumbWidget = findWidget<HbStackedWidget>(VIDEO_DETAILS_THUMBNAIL);
+ VideoDetailsLabel* thumbLabel = (VideoDetailsLabel*)thumbWidget->widgetAt(0);
HbAction* deleteAction = findObject<HbAction>(TEST_VIDEO_DETAILS_MENUACTION_DELETE);
- QVERIFY( playBtn != 0 );
- QVERIFY( shareAction != 0 );
+ HbPushButton* button = findWidget<HbPushButton>(VIDEO_DETAILS_BUTTON);
+
+ QVERIFY( button != 0 );
+ QVERIFY( thumbLabel != 0 );
QVERIFY( deleteAction != 0 );
- QVERIFY( playBtn->isEnabled() );
- QVERIFY( shareAction->isEnabled() );
QVERIFY( deleteAction->isEnabled() );
- // verify that the scroll area has been scrolled to the top.
- QCOMPARE( spy.count(), 1 );
- QPointF scrollPoint = spy.takeFirst().at(0).toPointF();
- QCOMPARE( scrollPoint, QPointF(0, 0) );
-
QVERIFY(mPlugin->mActivated);
// second activation should not affect
activateView();
QVERIFY(mPlugin->mActivated);
- QVERIFY( playBtn != 0 );
- QVERIFY( shareAction != 0 );
+ QVERIFY( button != 0 );
+ QVERIFY( thumbLabel != 0 );
QVERIFY( deleteAction != 0 );
- QVERIFY( playBtn->isEnabled() );
- QVERIFY( shareAction->isEnabled() );
QVERIFY( deleteAction->isEnabled() );
-
cleanup();
}
// ---------------------------------------------------------------------------
-// Verifies that correct orientation is loaded from xml
-// ---------------------------------------------------------------------------
-//
-inline void TestVideoFileDetails::verifyOrientation()
-{
- HbWidget* info = findWidget<HbWidget>(TEST_VIDEO_DETAILS_SCROLLAREA);
-
- // this verifies that we have correct orientation loaded from the xml.
- if (hbInstance->allMainWindows().at(0)->orientation() == Qt::Vertical)
- {
- QVERIFY( info->pos().x() < 300 );
- QVERIFY( info->pos().x() > 0 );
- } else {
- QVERIFY( info->pos().x() > 300 );
- QVERIFY( info->pos().x() < 640 );
- }
-}
-
-// ---------------------------------------------------------------------------
// Slot: create view
// ---------------------------------------------------------------------------
//
@@ -267,7 +220,7 @@
QVERIFY( mPlugin->mVideoServices == 0);
// testing the special case where the model is null.
cleanup();
- mWrapper->setModel(0);
+ VideoCollectionWrapper::instance().setModel(0);
init();
QVERIFY( mPlugin->mModel == 0 );
QVERIFY( mPlugin->mIsService == false);
@@ -276,7 +229,7 @@
// then it needs to be added here.
// restoring the proper model.
- mWrapper->setModel(mDummyModel);
+ VideoCollectionWrapper::instance().setModel(mDummyModel);
cleanup();
}
@@ -327,10 +280,10 @@
activateView();
mPlugin->deactivateView();
QVERIFY( mPlugin->mActivated == false );
- QCOMPARE( mPlugin->mVideoIndex, -1 );
+ QCOMPARE( mPlugin->mVideoId, TMPXItemId::InvalidId() );
mPlugin->deactivateView();
QVERIFY( mPlugin->mActivated == false );
- QCOMPARE( mPlugin->mVideoIndex, -1 );
+ QCOMPARE( mPlugin->mVideoId, TMPXItemId::InvalidId() );
cleanup();
}
@@ -371,8 +324,6 @@
// give fw some time to update content
QTest::qWait(100);
- verifyOrientation();
-
cleanup();
}
@@ -431,7 +382,7 @@
//
void TestVideoFileDetails::testShortDetailsReadySlot()
{
- const int testIndex = 5;
+ TMPXItemId testIndex(5,0);
QStringList display;
display.append("first row");
display.append("second row");
@@ -445,10 +396,9 @@
// no data
emit shortDetailsReady(testIndex);
- QCOMPARE( mPlugin->mVideoIndex, testIndex );
+ QCOMPARE( mPlugin->mVideoId, testIndex );
QVERIFY( mPlugin->mTitleAnim->text().isEmpty() );
QCOMPARE( mPlugin->mThumbnailManager->mRequests.count(), 0 );
- QVERIFY( findWidget<HbPushButton>(TEST_VIDEO_DETAILS_BUTTON_PLAY)->primitive(HbStyle::P_PushButton_background)->isVisible() == false );
mDummyModel->setData(Qt::DisplayRole, display);
mDummyModel->setData(VideoCollectionCommon::KeyFilePath, filepath);
@@ -457,39 +407,36 @@
ThumbnailManager *tmpTnManager = mPlugin->mThumbnailManager;
mPlugin->mThumbnailManager = 0;
emit shortDetailsReady(testIndex);
- QCOMPARE( mPlugin->mVideoIndex, testIndex );
+ QCOMPARE( mPlugin->mVideoId, testIndex );
QCOMPARE( mPlugin->mTitleAnim->text(), display.at(0) );
- QVERIFY( findWidget<HbPushButton>(TEST_VIDEO_DETAILS_BUTTON_PLAY)->primitive(HbStyle::P_PushButton_background)->isVisible() == false );
mPlugin->mThumbnailManager = tmpTnManager;
// data exists
emit shortDetailsReady(testIndex);
- QCOMPARE( mDummyModel->lastIndex().row(), testIndex );
+ QCOMPARE( mPlugin->mVideoId, testIndex );
+ QCOMPARE( mDummyModel->lastId(), testIndex );
QCOMPARE( mPlugin->mTitleAnim->text(), display.at(0) );
QVERIFY( ThumbnailManager::mRequests.contains(0) );
ThumbnailManager::TnRequest request = ThumbnailManager::mRequests[0];
QCOMPARE( request.name, filepath );
// 20 == priorityHight in this case
QCOMPARE( request.priority, 5000 );
- QVERIFY( findWidget<HbPushButton>(TEST_VIDEO_DETAILS_BUTTON_PLAY)->primitive(HbStyle::P_PushButton_background)->isVisible() == false );
mDummyModel->setData(VideoCollectionCommon::KeyMetaData, createDummyMetadata() );
emit fullDetailsReady(testIndex);
emit shortDetailsReady(testIndex);
- QVERIFY( findWidget<HbPushButton>(TEST_VIDEO_DETAILS_BUTTON_PLAY)->primitive(HbStyle::P_PushButton_background)->isVisible() == false );
int detailCount = sizeof(VideoCollectionCommon::VideoDetailLabelKeys) / sizeof(int);
- for(int i = 1; i<=detailCount; i++) {
- HbLabel* detail = findWidget<HbLabel>(TEST_VIDEO_DETAILS_ITEM + QString::number(i));
- QVERIFY( detail->text().isEmpty() );
- }
+
+ HbListWidget* list = findWidget<HbListWidget>(TEST_VIDEO_DETAILS_LISTWIDGET);
- QVERIFY( findWidget<HbPushButton>(TEST_VIDEO_DETAILS_BUTTON_PLAY)->icon().isNull() );
-
- cleanup();
+ QVERIFY(list);
+ QVERIFY(list->count() == 0);
+
+ cleanup();
}
// ---------------------------------------------------------------------------
@@ -498,62 +445,59 @@
//
void TestVideoFileDetails::testFullDetailsReadySlot()
{
- const int testIndex = 6;
+ TMPXItemId testIndex(6,0);
init();
activateView();
int detailCount = sizeof(VideoCollectionCommon::VideoDetailLabelKeys) / sizeof(int);
- for(int i = 1; i<=detailCount; i++) {
- HbLabel* detail = findWidget<HbLabel>(TEST_VIDEO_DETAILS_ITEM + QString::number(i));
- if(detail == 0)
- {
- QFAIL(QString("Found a null label at %1, check that the xml is "
- "correct, and that the resource files have been regenerated (by running abld "
- "reallyclean before build)").arg(TEST_VIDEO_DETAILS_ITEM + QString::number(i)).
- toStdString().data());
- }
- }
+
+ HbListWidget* list = findWidget<HbListWidget>(TEST_VIDEO_DETAILS_LISTWIDGET);
+ QVERIFY(list);
+ QVERIFY(list->count() == 0);
mDummyModel->setData(VideoCollectionCommon::KeyMetaData, createDummyMetadata() );
emit fullDetailsReady(testIndex);
// verify that actions are currently enabled.
- HbPushButton* playBtn = findWidget<HbPushButton>(TEST_VIDEO_DETAILS_BUTTON_PLAY);
- HbAction* shareAction = findObject<HbAction>(TEST_VIDEO_DETAILS_MENUACTION_SHARE);
+ HbStackedWidget* thumbWidget = findWidget<HbStackedWidget>(VIDEO_DETAILS_THUMBNAIL);
+ VideoDetailsLabel* thumbLabel = (VideoDetailsLabel*)thumbWidget->widgetAt(0);
HbAction* deleteAction = findObject<HbAction>(TEST_VIDEO_DETAILS_MENUACTION_DELETE);
- QVERIFY( playBtn != 0 );
- QVERIFY( shareAction != 0 );
+ QVERIFY( thumbLabel != 0 );
QVERIFY( deleteAction != 0 );
- QVERIFY( playBtn->isEnabled() );
- QVERIFY( shareAction->isEnabled() );
QVERIFY( deleteAction->isEnabled() );
- for(int i = 0; i<detailCount; i++) {
+ QVERIFY(list->count() == detailCount);
+
+ for(int i = 0; i<detailCount; i++)
+ {
QString expected = tr(VideoCollectionCommon::VideoDetailLabels[i]).arg(
VideoCollectionCommon::VideoDetailLabelKeys[i]);
- HbLabel* detail = findWidget<HbLabel>(TEST_VIDEO_DETAILS_ITEM + QString::number(i+1));
+ HbListWidgetItem* detail = list->item(i);
QVERIFY( detail != 0 );
QVERIFY( detail->text().contains(expected) );
}
// for coverity sake, retest without star-rating
mDummyModel->reset();
- mDummyModel->setData(VideoCollectionCommon::KeyMetaData, createDummyMetadata(1) );
+ mDummyModel->setData(VideoCollectionCommon::KeyMetaData, createDummyMetadata() );
emit fullDetailsReady(testIndex);
+
+ int ii = 0;
for(int i = 0; i<detailCount; i++)
- {
+ {
if(VideoCollectionCommon::VideoDetailLabelKeys[i] != VideoCollectionCommon::MetaKeyStarRating)
{
QString expected = tr(VideoCollectionCommon::VideoDetailLabels[i]).arg(
VideoCollectionCommon::VideoDetailLabelKeys[i]);
- HbLabel* detail = findWidget<HbLabel>(TEST_VIDEO_DETAILS_ITEM + QString::number(i+1));
+ HbListWidgetItem* detail = list->item(ii);
QVERIFY( detail != 0 );
QVERIFY( detail->text().contains(expected) );
}
+ ++ii;
}
-
+
cleanup();
}
@@ -563,7 +507,7 @@
//
void TestVideoFileDetails::testStartPlaybackSlot()
{
- const int testIndex = 6;
+ TMPXItemId testIndex(6,0);
mDummyModel->reset();
init();
activateView();
@@ -571,22 +515,23 @@
// Note that if the details view has not received signal in it's
// fullDetailsReadySlot, the button is disabled and should not do anything.
- HbPushButton* playBtn = findWidget<HbPushButton>(TEST_VIDEO_DETAILS_BUTTON_PLAY);
- QVERIFY( playBtn != 0 );
- playBtn->click();
+ HbStackedWidget* thumbWidget = findWidget<HbStackedWidget>(VIDEO_DETAILS_THUMBNAIL);
+ VideoDetailsLabel* thumbLabel = (VideoDetailsLabel*)thumbWidget->widgetAt(0);
+ QVERIFY( thumbLabel != 0 );
+ thumbLabel->click();
- QCOMPARE( mDummyModel->startPlaybackIndex(), -1 );
+ QCOMPARE( mDummyModel->startPlaybackIndex(), TMPXItemId::InvalidId() );
emit fullDetailsReady(testIndex);
- mPlugin->mVideoIndex = testIndex;
+ mPlugin->mVideoId = testIndex;
- playBtn->click();
+ thumbLabel->click();
QCOMPARE( mDummyModel->startPlaybackIndex(), testIndex );
// invalid index
- mPlugin->mVideoIndex = -1;
- playBtn->click();
+ mPlugin->mVideoId = TMPXItemId::InvalidId();
+ thumbLabel->click();
// startplayback index has not changed since previous
QCOMPARE( mDummyModel->startPlaybackIndex(), testIndex );
@@ -616,8 +561,8 @@
QVERIFY( deleteAction != 0 );
deleteAction->trigger();
QCOMPARE( mDummyModel->dataAccessCount(), 0 );
- mPlugin->mVideoIndex = 0;
-
+ mPlugin->mVideoId = (0,0);
+
mDummyModel->setDataReturnInvalid(true);
QModelIndex expected = mDummyModel->index(0, 0);
deleteAction->trigger();
@@ -626,7 +571,7 @@
QCOMPARE( mDummyModel->deleteFileIndex(), -1 ); // verify that no file was deleted.
mDummyModel->setDataReturnInvalid(false);
- mPlugin->mVideoIndex = 0;
+ mPlugin->mVideoId = (0,0);
expected = mDummyModel->index(0, 0);
deleteAction->trigger();
QCOMPARE( mDummyModel->dataAccessCount(), 2 );
@@ -674,6 +619,7 @@
void TestVideoFileDetails::testRowsRemovedSlot()
{
const int testIndex = 9;
+ TMPXItemId testID(9,0);
init();
connect(mPlugin, SIGNAL(command(int)), this, SLOT(handleCommand(int)));
@@ -687,8 +633,9 @@
QCOMPARE( mCommandReceived, false );
QCOMPARE( mReceivedCommand, -1 );
- emit fullDetailsReady(testIndex);
- mPlugin->mVideoIndex = testIndex;
+ emit fullDetailsReady(testID);
+ mPlugin->mVideoId = testID;
+ mPlugin->mDeletedIndex = testIndex;
emit rowsRemoved(QModelIndex(), testIndex+1, testIndex-1);
QCOMPARE( mCommandReceived, false );
@@ -754,7 +701,7 @@
//
void TestVideoFileDetails::testThumbnailReadySlot()
{
- int testIndex = 9;
+ TMPXItemId testIndex(9,0);
QStringList display;
display.append("first row");
display.append("second row");
@@ -771,13 +718,15 @@
mPlugin->mThumbnailManager->mThumbnailReadyError = -1;
mPlugin->mThumbnailManager->emitThumbnailReady(0);
- QVERIFY( findWidget<HbPushButton>(TEST_VIDEO_DETAILS_BUTTON_PLAY)->icon().qicon().isNull() == false );
-
+ HbStackedWidget* thumbWidget = findWidget<HbStackedWidget>(VIDEO_DETAILS_THUMBNAIL);
+ VideoDetailsLabel* thumbLabel = (VideoDetailsLabel*)thumbWidget->widgetAt(0);
+ QVERIFY( thumbLabel->icon().qicon().isNull() == false );
+
mPlugin->mThumbnailManager->mThumbnailReadyError = 0;
emit shortDetailsReady(testIndex);
mPlugin->mThumbnailManager->emitThumbnailReady(0);
- QVERIFY( findWidget<HbPushButton>(TEST_VIDEO_DETAILS_BUTTON_PLAY)->icon().qicon().isNull() == false );
+ QVERIFY( thumbLabel->icon().qicon().isNull() == false );
cleanup();
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videofiledetailsview/tsrc/testplugin/stub/inc/videocollectionwrapper.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,113 @@
+/*
+* 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: VideoCollectionWrapper dummy class definition
+*
+*/
+
+#ifndef __VIDEOCOLLECTIONWRAPPER_H__
+#define __VIDEOCOLLECTIONWRAPPER_H__
+
+
+// INCLUDES
+#include <QObject>
+
+
+// FORWARD DECLARATIONS
+class QAbstractItemModel;
+
+class VideoSortFilterProxyModel;
+
+
+class VideoCollectionWrapper : public QObject
+{
+ Q_OBJECT
+
+public: // Constructor
+
+
+ enum TModelType
+ {
+ EAllVideos,
+ ECollections,
+ ECollectionContent,
+ EGeneric
+ };
+
+ /**
+ * Returns singleton instance for this class.
+ *
+ * WARNING! Not safe to call this from destructor of another function scope static object!
+ *
+ * @return The singleton instance.
+ */
+ static VideoCollectionWrapper &instance();
+
+ /**
+ * Decreases the reference count, when count reaches zero cleanup is done.
+ *
+ */
+ void decreaseReferenceCount();
+
+ /**
+ * return mModel
+ */
+ VideoSortFilterProxyModel* getModel(int type);
+
+ /**
+ * NOP at the moment
+ */
+ void reset();
+
+ /**
+ * sete mModel
+ */
+ void setModel(VideoSortFilterProxyModel* model);
+
+signals:
+
+ void error(int errorCode, QVariant &additional);
+
+private:
+
+ /**
+ * Private contructor.
+ */
+ VideoCollectionWrapper();
+
+ /**
+ * Private destructor.
+ *
+ */
+ virtual ~VideoCollectionWrapper();
+
+
+private:
+ /**
+ * model to be used when testing videofiledetailsviewplugin
+ */
+ VideoSortFilterProxyModel* mModel;
+
+public:
+
+ static VideoCollectionWrapper *mInstance;
+
+ static int mReferenceCount;
+
+};
+
+#endif // __VIDEOCOLLECTIONWRAPPER_H__
+// End of file
+
+
+
--- a/videocollection/videofiledetailsview/tsrc/testplugin/stub/inc/videoservices.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videofiledetailsview/tsrc/testplugin/stub/inc/videoservices.h Thu Apr 01 23:22:15 2010 +0300
@@ -59,6 +59,11 @@
*
*/
VideoServices::TVideoService currentService();
+
+ /**
+ * Returns context title.
+ */
+ QString contextTitle() { return QString(""); }
private:
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videofiledetailsview/tsrc/testplugin/stub/inc/videosortfilterproxymodel.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,202 @@
+/*
+* 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: Dummy videolistsortfilterproxymodel class definition*
+*/
+
+#ifndef VIDEOSORTFILTERPROXYMODEL_H
+#define VIDEOSORTFILTERPROXYMODEL_H
+
+// INCLUDES
+#include <QObject>
+#include <qabstractitemmodel.h>
+#include <mpxitemid.h>
+
+// FORWARD DECLARATIONS
+
+
+class VideoSortFilterProxyModel : public QAbstractItemModel
+{
+ /**
+ * define to be able to use signals and slots
+ */
+ Q_OBJECT
+
+ /**
+ * disable copy-constructor and assignment operator
+ */
+ Q_DISABLE_COPY(VideoSortFilterProxyModel)
+
+public:
+
+ /**
+ * Default constructor
+ */
+ VideoSortFilterProxyModel();
+
+ /**
+ * Destructor
+ */
+ ~VideoSortFilterProxyModel();
+
+ /**
+ * sets index.row() to mStartPlaybackIndex
+ */
+ int openItem(const TMPXItemId &index);
+
+ /**
+ * sets first index.row() to mDeleteFileIndex
+ */
+ int deleteItems(const QModelIndexList &indexList);
+
+ /**
+ * returns qmodelindex of item id provided.
+ *
+ * @param item id
+ * @return QModelIndex;
+ */
+ QModelIndex indexOfId(TMPXItemId id);
+
+
+ TMPXItemId getMediaIdAtIndex(const QModelIndex &index);
+
+signals:
+
+ void shortDetailsReady(TMPXItemId index);
+
+ void fullDetailsReady(TMPXItemId index);
+
+public: // from QAbstractItemModel
+
+ VideoSortFilterProxyModel* sourceModel();
+
+ /**
+ * Returns video item count
+ */
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+
+ /**
+ * Returns video item data from index pointed by.
+ */
+ QMap<int, QVariant> itemData(const QModelIndex &index) const;
+
+ /**
+ * data
+ */
+ QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
+
+ /**
+ * columnCount
+ */
+ int columnCount(const QModelIndex & parent = QModelIndex()) const;
+
+ /**
+ * index
+ */
+ QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const;
+
+ /**
+ * Parent
+ */
+ QModelIndex parent(const QModelIndex & index) const;
+
+public: // dummy model helper methods
+ /**
+ * sets mDatareturnsInvalid
+ */
+ void setDataReturnInvalid(bool setInvalid);
+
+ /**
+ * returns mLastIndex
+ */
+ QModelIndex lastIndex();
+
+ TMPXItemId lastId();
+
+ /**
+ * returns mDataAccessCount
+ */
+ int dataAccessCount();
+
+ /**
+ * clear everything
+ */
+ void reset();
+
+ /**
+ * sets role based value to mDatao
+ */
+ void setData(int role, QVariant data);
+
+ /**
+ * sets mRowCount
+ */
+ void setRowCount(int count);
+
+ /**
+ * returns mStartPlaybackIndex
+ */
+ TMPXItemId startPlaybackIndex();
+
+ /**
+ * returns mDeleteFileIndex
+ */
+ int deleteFileIndex();
+
+private:
+
+ /**
+ * map item to return from data();
+ */
+ QMap<int, QVariant> mData;
+
+ /**
+ * latest used index
+ */
+ mutable QModelIndex mLastIndex;
+
+ /**
+ * total data -access count throught data() -method
+ */
+ mutable int mDataAccessCount;
+
+
+ mutable TMPXItemId mLastId;
+
+ /**
+ * setted "row count"
+ */
+ int mRowCount;
+
+ /**
+ * lates passed index of openItem
+ */
+ TMPXItemId mStartPlaybackIndex;
+
+ /**
+ * latest passed for delete
+ */
+ int mDeleteFileIndex;
+
+ /**
+ * if true, data() -method returns invalid QVartiant
+ */
+ bool mDatareturnsInvalid;
+
+};
+#endif // VIDEOSORTFILTERPROXYMODEL_H
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videofiledetailsview/tsrc/testplugin/stub/src/videocollectionwrapper.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,89 @@
+/*
+* 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: VideoCollectionWrapper dummy class implementation
+*
+*/
+
+// INCLUDE FILES
+#include <qabstractitemmodel.h>
+#include <QDebug>
+#include "videosortfilterproxymodel.h"
+#include "videocollectionwrapper.h"
+
+int VideoCollectionWrapper::mReferenceCount = 0;
+VideoCollectionWrapper *VideoCollectionWrapper::mInstance = 0;
+
+// -----------------------------------------------------------------------------
+// VideoCollectionWrapper::VideoCollectionWrapper()
+// -----------------------------------------------------------------------------
+//
+VideoCollectionWrapper &VideoCollectionWrapper::instance()
+{
+ static VideoCollectionWrapper _staticWrapper;
+
+ return _staticWrapper;
+}
+
+// -----------------------------------------------------------------------------
+// VideoCollectionWrapper::cleanup()
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionWrapper::decreaseReferenceCount()
+{
+ if(mInstance)
+ {
+ qDebug() << "VideoCollectionWrapper::instance()-- = " << (mInstance->mReferenceCount-1);
+ if(--mInstance->mReferenceCount == 0)
+ {
+ delete mInstance;
+ mInstance = NULL;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+// VideoCollectionWrapper()
+// -----------------------------------------------------------------------------
+//
+VideoCollectionWrapper::VideoCollectionWrapper() :
+mModel(0)
+{
+}
+
+// -----------------------------------------------------------------------------
+// ~VideoCollectionWrapper()
+// -----------------------------------------------------------------------------
+//
+VideoCollectionWrapper::~VideoCollectionWrapper()
+{
+}
+// -----------------------------------------------------------------------------
+// getModel()
+// -----------------------------------------------------------------------------
+//
+VideoSortFilterProxyModel* VideoCollectionWrapper::getModel(int type)
+{
+ return mModel;
+}
+
+// -----------------------------------------------------------------------------
+// setModel()
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionWrapper::setModel(VideoSortFilterProxyModel* model)
+{
+ mModel = model;
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videofiledetailsview/tsrc/testplugin/stub/src/videosortfilterproxymodel.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,289 @@
+/*
+* 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: Dummy VideoSortFilterProxyModel class implementation
+*
+*/
+// INCLUDE FILES
+#include "videosortfilterproxymodel.h"
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel()
+// -----------------------------------------------------------------------------
+//
+VideoSortFilterProxyModel::VideoSortFilterProxyModel() :
+mStartPlaybackIndex(TMPXItemId::InvalidId()),
+mDeleteFileIndex(-1)
+{
+ reset();
+}
+
+// -----------------------------------------------------------------------------
+// ~VideoSortFilterProxyModel()
+// -----------------------------------------------------------------------------
+//
+VideoSortFilterProxyModel::~VideoSortFilterProxyModel()
+{
+ reset();
+}
+
+// -----------------------------------------------------------------------------
+// lastIndex()
+// -----------------------------------------------------------------------------
+//
+QModelIndex VideoSortFilterProxyModel::lastIndex()
+{
+ return mLastIndex;
+}
+
+// -----------------------------------------------------------------------------
+// lastIndex()
+// -----------------------------------------------------------------------------
+//
+TMPXItemId VideoSortFilterProxyModel::lastId()
+{
+ return mLastId;
+}
+
+// -----------------------------------------------------------------------------
+// dataAccessCount()
+// -----------------------------------------------------------------------------
+//
+int VideoSortFilterProxyModel::dataAccessCount()
+{
+ return mDataAccessCount;
+}
+
+// -----------------------------------------------------------------------------
+// reset()
+// -----------------------------------------------------------------------------
+//
+void VideoSortFilterProxyModel::reset()
+{
+ mLastIndex = QModelIndex();
+ mLastId = TMPXItemId::InvalidId();
+ mDataAccessCount = 0;
+ mRowCount = 0;
+ mData.clear();
+ mStartPlaybackIndex = TMPXItemId::InvalidId();
+ mDeleteFileIndex = -1;
+ mDatareturnsInvalid = false;
+}
+
+// -----------------------------------------------------------------------------
+// setDataReturnInvalid()
+// -----------------------------------------------------------------------------
+//
+void VideoSortFilterProxyModel::setDataReturnInvalid(bool setInvalid)
+{
+ mDatareturnsInvalid = setInvalid;
+}
+
+// -----------------------------------------------------------------------------
+// setData()
+// -----------------------------------------------------------------------------
+//
+void VideoSortFilterProxyModel::setData(int role, QVariant data)
+{
+ mData.insert(role, data);
+}
+
+// -----------------------------------------------------------------------------
+// setRowCount()
+// -----------------------------------------------------------------------------
+//
+void VideoSortFilterProxyModel::setRowCount(int count)
+{
+ if ( count == mRowCount ) return;
+
+ if ( count > mRowCount ) {
+ beginInsertRows(QModelIndex(), mRowCount, count);
+ mRowCount = count;
+ endInsertRows();
+ } else {
+ beginRemoveRows(QModelIndex(), count, mRowCount);
+ mRowCount = count;
+ endRemoveRows();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// rowCount()
+// -----------------------------------------------------------------------------
+//
+int VideoSortFilterProxyModel::rowCount(const QModelIndex &parent ) const
+{
+ // according to Qt documentation if parent is valid this should return 0 if
+ // implementing a table based implementation like this.
+ if (parent.isValid())
+ {
+ return 0;
+ }
+
+ return mRowCount;
+}
+
+// -----------------------------------------------------------------------------
+// itemData()
+// -----------------------------------------------------------------------------
+//
+QMap<int, QVariant> VideoSortFilterProxyModel::itemData(const QModelIndex &index) const
+{
+ QMap<int, QVariant> itemData;
+ if (index.isValid())
+ {
+ // returns only basic data of the item
+ itemData.insert(Qt::DisplayRole, data(index, Qt::DisplayRole));
+ itemData.insert(Qt::DecorationRole, data(index, Qt::DecorationRole));
+ itemData.insert(Qt::BackgroundRole, data(index, Qt::BackgroundRole));
+ }
+ return itemData;
+
+}
+// -----------------------------------------------------------------------------
+// data()
+// -----------------------------------------------------------------------------
+//
+QVariant VideoSortFilterProxyModel::data(const QModelIndex & index, int role) const
+{
+ QVariant returnValue = QVariant();
+ mLastIndex = index;
+ mDataAccessCount++;
+ if (index.isValid() && !mDatareturnsInvalid)
+ {
+ returnValue = mData.value(role);
+ }
+
+ return returnValue;
+}
+
+// -----------------------------------------------------------------------------
+// columnCount()
+// -----------------------------------------------------------------------------
+//
+int VideoSortFilterProxyModel::columnCount(const QModelIndex & parent) const
+{
+ // according to Qt documentation if parent is valid this should return 0 if
+ // implementing a table based implementation like this.
+ if (parent.isValid())
+ {
+ return 0;
+ }
+ else
+ {
+ return 1;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// index()
+// -----------------------------------------------------------------------------
+//
+QModelIndex VideoSortFilterProxyModel::index(int row, int column, const QModelIndex & /*parent*/) const
+{
+ return createIndex(row, column);
+}
+
+// -----------------------------------------------------------------------------
+// parent()
+// -----------------------------------------------------------------------------
+//
+QModelIndex VideoSortFilterProxyModel::parent(const QModelIndex & /*index*/) const
+{
+ return QModelIndex();
+}
+
+// -----------------------------------------------------------------------------
+// openItem()
+// -----------------------------------------------------------------------------
+//
+int VideoSortFilterProxyModel::openItem(const TMPXItemId &index)
+{
+ mStartPlaybackIndex = index;
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// deleteItems()
+// -----------------------------------------------------------------------------
+//
+int VideoSortFilterProxyModel::deleteItems(const QModelIndexList &indexList)
+{
+ if(indexList.count() > 0)
+ {
+ mDeleteFileIndex = indexList.at(0).row();
+ return 0;
+ }
+ else
+ {
+ mDeleteFileIndex = -1;
+ return -1;
+ }
+
+}
+
+// -----------------------------------------------------------------------------
+// startPlaybackIndex()
+// -----------------------------------------------------------------------------
+//
+TMPXItemId VideoSortFilterProxyModel::startPlaybackIndex()
+{
+ return mStartPlaybackIndex;
+}
+
+// -----------------------------------------------------------------------------
+// deleteFileIndex()
+// -----------------------------------------------------------------------------
+//
+int VideoSortFilterProxyModel::deleteFileIndex()
+{
+ return mDeleteFileIndex;
+}
+
+// -----------------------------------------------------------------------------
+// sourceModel()
+// -----------------------------------------------------------------------------
+//
+VideoSortFilterProxyModel* VideoSortFilterProxyModel::sourceModel()
+{
+ return this;
+}
+
+// -----------------------------------------------------------------------------
+// getMediaIdAtIndex()
+// -----------------------------------------------------------------------------
+//
+TMPXItemId VideoSortFilterProxyModel::getMediaIdAtIndex(const QModelIndex &index)
+{
+ TMPXItemId id = TMPXItemId::InvalidId();
+ id.iId1 = mLastIndex.row();
+ id.iId2 = 0;
+ return id;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::indexOfId()
+// -----------------------------------------------------------------------------
+//
+QModelIndex VideoSortFilterProxyModel::indexOfId(TMPXItemId id)
+{
+ mLastId = id;
+ mLastIndex = createIndex(id.iId1, 0);
+ return mLastIndex; //rikki! createIndex(row, column)
+}
+
+
+// End of file
--- a/videocollection/videofiledetailsview/tsrc/testplugin/testvideofiledetailsviewplugin.pro Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videofiledetailsview/tsrc/testplugin/testvideofiledetailsviewplugin.pro Thu Apr 01 23:22:15 2010 +0300
@@ -59,7 +59,8 @@
stub/inc/thumbnailmanager_qt.h \
stub/inc/videoservices.h \
stub/inc/videoserviceurifetch.h \
- ../../inc/videofiledetailsviewplugin.h
+ ../../inc/videofiledetailsviewplugin.h \
+ ../../inc/videodetailslabel.h
SOURCES += src/testvideofiledetails.cpp \
stub/src/videocollectionwrapper.cpp \
@@ -68,7 +69,8 @@
stub/src/thumbnailmanager_qt.cpp \
stub/src/videoservices.cpp \
stub/src/videoserviceurifetch.cpp \
- ../../src/videofiledetailsviewplugin.cpp
+ ../../src/videofiledetailsviewplugin.cpp \
+ ../../src/videodetailslabel.cpp
RESOURCES += ../../data/videofiledetails.qrc
TARGET.CAPABILITY = All \
--- a/videocollection/videofiledetailsview/videofiledetailsview.pro Thu Apr 01 23:13:36 2010 +0300
+++ b/videocollection/videofiledetailsview/videofiledetailsview.pro Thu Apr 01 23:22:15 2010 +0300
@@ -56,8 +56,10 @@
# Input
HEADERS += inc/videofiledetailsviewplugin.h \
-
-SOURCES += src/videofiledetailsviewplugin.cpp
+ inc/videodetailslabel.h
+
+SOURCES += src/videofiledetailsviewplugin.cpp \
+ src/videodetailslabel.cpp
LIBS += -lmpxviewframeworkqt.dll \
-lvideocollectionwrapper.dll \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/controlinc/mpxvideoplaybackbuttonbar.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,82 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackButtonBar
+*
+*/
+
+// Version : %version: da1mmcf#8 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKBUTTONBAR_H_
+#define MPXVIDEOPLAYBACKBUTTONBAR_H_
+
+#include <hbwidget.h>
+#include <MMFScalingCustomCommandConstants.h>
+#include <mpxplaybackframeworkdefs.h>
+
+
+class HbFrameItem;
+class HbPushButton;
+class QActionGroup;
+class QMPXVideoPlaybackViewFileDetails;
+class QMPXVideoPlaybackControlsController;
+
+// DATA TYPES
+enum TMPXButton
+{
+ EMPXButtonRW,
+ EMPXButtonPlay,
+ EMPXButtonPause,
+ EMPXButtonFF,
+ EMPXButtonNatural,
+ EMPXButtonStretch,
+ EMPXButtonZoom,
+ EMPXButtonDetails,
+ EMPXButtonCount // Should always be the last value
+};
+
+
+class QMPXVideoPlaybackButtonBar : public HbWidget
+{
+ Q_OBJECT
+
+ public:
+ QMPXVideoPlaybackButtonBar( QMPXVideoPlaybackControlsController* controller );
+ virtual ~QMPXVideoPlaybackButtonBar();
+ void updateState( TMPXPlaybackState state );
+ void aspectRatioChanged( int aspectRatio );
+ void initialize();
+ void updateWithFileDetails( QMPXVideoPlaybackViewFileDetails* details );
+
+ private slots:
+ void play();
+ void pause();
+ void changeAspectRatio();
+ void handleButtonPressed();
+ void startFFSeeking();
+ void startRWSeeking();
+ void endSeeking();
+ void openDetailsView();
+
+ private:
+ QMPXVideoPlaybackControlsController *mController;
+
+ QList<HbPushButton*> mButtons;
+ bool mInitialized;
+
+ HbFrameItem *mFrameItem;
+};
+
+#endif /*MPXVIDEOPLAYBACKBUTTONBAR_H_*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/controlinc/mpxvideoplaybackcontrolconfiguration.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,92 @@
+/*
+* 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: Implementation of CMPXVideoPlaybackControlConfiguration
+*
+*/
+
+// Version : %version: da1mmcf#6 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKCONTROLCONFIGURATION_H_
+#define MPXVIDEOPLAYBACKCONTROLCONFIGURATION_H_
+
+// INCLUDES
+#include <QObject>
+
+#include "mpxvideoplaybackcontrol.hrh"
+#include "mpxhelixplaybackplugindefs.h"
+
+// FORWARD DECLARATIONS
+class QMPXVideoPlaybackControlsController;
+
+// DATA TYPES
+
+// CLASS DECLARATION
+class QMPXVideoPlaybackControlConfiguration : public QObject
+{
+ Q_OBJECT
+
+ public:
+
+ /**
+ * constructor.
+ */
+ QMPXVideoPlaybackControlConfiguration( QMPXVideoPlaybackControlsController* controller );
+
+ /**
+ * Destructor.
+ */
+ virtual ~QMPXVideoPlaybackControlConfiguration();
+
+ public:
+ /**
+ * Update control list
+ */
+ void updateControlList( TMPXVideoPlaybackControlCommandIds event );
+
+ /**
+ * Return control list
+ */
+ QList<TMPXVideoPlaybackControls>& controlList();
+
+ void updateControlsWithFileDetails();
+
+ private:
+ /**
+ * Create control list
+ */
+ void createControlList();
+
+ /**
+ * Delete controls from list
+ */
+ void deleteControlFromList( TMPXVideoPlaybackControls control );
+
+ /**
+ * Add controls to list
+ */
+ void addControlToList( TMPXVideoPlaybackControls control );
+
+ signals:
+ void controlListUpdated();
+
+ private:
+ QMPXVideoPlaybackControlsController *mControlsController;
+ QList<TMPXVideoPlaybackControls> mControlsList;
+};
+
+#endif /*MPXVIDEOPLAYBACKCONTROLCONFIGURATION_H_*/
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/controlinc/mpxvideoplaybackcontrolpolicy.h Thu Apr 01 23:22:15 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: Implementation of MPXVideoPlaybackControlPolicy
+*
+*/
+
+// Version : %version: da1mmcf#5 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKCONTROLPOLICY_H_
+#define MPXVIDEOPLAYBACKCONTROLPOLICY_H_
+
+// INCLUDES
+#include <QObject>
+
+#include "mpxvideoplaybackcontrol.hrh"
+#include "mpxvideoplaybackcontrolscontroller.h"
+
+// FORWARD DECLARATIONS
+class QMPXVideoPlaybackViewFileDetails;
+
+// DATA TYPES
+
+// CLASS DECLARATION
+class QMPXVideoPlaybackControlPolicy : public QObject
+{
+ Q_OBJECT
+
+ public:
+
+ /**
+ * Two-phased constructor.
+ */
+ QMPXVideoPlaybackControlPolicy();
+
+ /**
+ * Destructor.
+ */
+ virtual ~QMPXVideoPlaybackControlPolicy();
+
+ public:
+ /**
+ * Sets the control properties per policy
+ */
+ void setControlProperties( TMPXVideoPlaybackControls controlIndex,
+ TUint& properties,
+ QMPXVideoPlaybackViewFileDetails *details,
+ TPlaybackViewMode viewMode );
+};
+
+#endif /*MPXVIDEOPLAYBACKCONTROLPOLICY_H_*/
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/controlinc/mpxvideoplaybackdetailsplaybackwindow.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackDetailsPlaybackWindow
+*
+*/
+
+// Version : %version: 4 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKDETAILSPLAYBACKWINDOW_H_
+#define MPXVIDEOPLAYBACKDETAILSPLAYBACKWINDOW_H_
+
+#include <hbwidget.h>
+#include <mpxplaybackframeworkdefs.h>
+
+class HbPushButton;
+class QMPXVideoPlaybackControlsController;
+
+class QMPXVideoPlaybackDetailsPlaybackWindow : public HbWidget
+{
+ Q_OBJECT
+
+ public:
+ QMPXVideoPlaybackDetailsPlaybackWindow( QMPXVideoPlaybackControlsController* controller );
+ virtual ~QMPXVideoPlaybackDetailsPlaybackWindow();
+ void initialize();
+ void updateState( TMPXPlaybackState state );
+ void mousePressEvent( QGraphicsSceneMouseEvent *event );
+ void mouseReleaseEvent( QGraphicsSceneMouseEvent *event );
+
+ private slots:
+ void playPause();
+
+ private:
+ QMPXVideoPlaybackControlsController *mController;
+ HbPushButton *mPlayButton;
+
+ bool mInitialized;
+};
+
+#endif /*MPXVIDEOPLAYBACKDETAILSPLAYBACKWINDOW_H_*/
+
--- a/videoplayback/hbvideoplaybackview/controlinc/mpxvideoplaybackfiledetailswidget.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/hbvideoplaybackview/controlinc/mpxvideoplaybackfiledetailswidget.h Thu Apr 01 23:22:15 2010 +0300
@@ -15,15 +15,16 @@
*
*/
-// Version : %version: 5 %
+// Version : %version: 8 %
#ifndef MPXVIDEOPLAYBACKFILEDETAILSWIDGET_H_
#define MPXVIDEOPLAYBACKFILEDETAILSWIDGET_H_
+#include <QObject>
+
#include <hbwidget.h>
-#include <hbstyleloader.h>
class QMPXVideoPlaybackViewFileDetails;
class QMPXVideoPlaybackControlsController;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/controlinc/mpxvideoplaybackfullscreencontrol.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,113 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackFullScreenControl
+*
+*/
+
+// Version : %version: da1mmcf#7 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKFULLSCREENCONTROL_H_
+#define MPXVIDEOPLAYBACKFULLSCREENCONTROL_H_
+
+#include <QObject>
+
+#include <mpxvideoplaybackcontrol.hrh>
+#include <mpxplaybackframeworkdefs.h>
+
+class HbWidget;
+class QMPXVideoPlaybackViewFileDetails;
+class QMPXVideoPlaybackControlsController;
+
+class QMPXVideoPlaybackFullScreenControl : public QObject
+{
+ Q_OBJECT
+
+ public:
+ QMPXVideoPlaybackFullScreenControl( QMPXVideoPlaybackControlsController* controller,
+ TMPXVideoPlaybackControls index,
+ HbWidget* widget,
+ TUint controlproperties );
+
+ virtual ~QMPXVideoPlaybackFullScreenControl();
+
+ public:
+
+ /**
+ * Set visibility of each control
+ */
+ virtual void setVisibility( TMPXPlaybackState aState );
+
+ /**
+ * return control index
+ */
+ TMPXVideoPlaybackControls controlIndex();
+
+ /**
+ * set changed volume
+ */
+ bool volumeChanged( int aVolume );
+
+ /**
+ * set changed duration
+ */
+ bool durationChanged( int duration );
+
+ /**
+ * set changed volume
+ */
+ bool positionChanged( int position );
+
+ /**
+ * Set changed position
+ */
+ bool aspectRatioChanged( int aspectRatio );
+
+ /**
+ * set changed volume
+ */
+ bool setDownloadSize( int size );
+
+ /**
+ * set changed state
+ */
+ void updateState( TMPXPlaybackState state );
+
+ /*
+ * UpdateDownloadPosition
+ * updates the download ratio on the progress bar
+ */
+ bool updateDownloadPosition( int size );
+
+ /*
+ * Update the controls with the file details
+ */
+ virtual void updateControlsWithFileDetails( QMPXVideoPlaybackViewFileDetails *details );
+
+ virtual void setVisible( bool visible );
+
+ virtual bool isVisible();
+
+ virtual void updateControlProperties( TUint properties );
+
+ protected:
+ QMPXVideoPlaybackControlsController* mController;
+ HbWidget *mControl;
+ TMPXVideoPlaybackControls mControlIndex;
+ TUint mProperties;
+};
+
+#endif /*MPXVIDEOPLAYBACKFULLSCREENCONTROL_H_*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/controlinc/mpxvideoplaybacknontouchvolumebar.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackNonTouchVolumeBar
+*
+*/
+
+// Version : %version: 4 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKNONTOUCHVOLUMEBAR_H_
+#define MPXVIDEOPLAYBACKNONTOUCHVOLUMEBAR_H_
+
+
+#include <hbvolumesliderpopup.h>
+
+class QTimer;
+class QGraphicsSceneMouseEvent;
+
+class QMPXVideoPlaybackNonTouchVolumeBar : public HbVolumeSliderPopup
+{
+ Q_OBJECT
+
+ public:
+ QMPXVideoPlaybackNonTouchVolumeBar();
+
+ virtual ~QMPXVideoPlaybackNonTouchVolumeBar();
+
+ public:
+ void setVisible( bool visible );
+ virtual void mousePressEvent( QGraphicsSceneMouseEvent *event );
+ virtual void mouseReleaseEvent( QGraphicsSceneMouseEvent *event );
+
+ private slots:
+ void hideVolumeControl();
+
+ private:
+ QTimer *mVolumeTimer;
+};
+
+#endif /*MPXVIDEOPLAYBACKNONTOUCHVOLUMEBAR_H_*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/controlinc/mpxvideoplaybackprogressbar.h Thu Apr 01 23:22:15 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: Implementation of QMPXVideoPlaybackProgressBar
+*
+*/
+
+// Version : %version: da1mmcf#8 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKPROGRESSBAR_H_
+#define MPXVIDEOPLAYBACKPROGRESSBAR_H_
+
+#include <hbwidget.h>
+#include <mpxplaybackframeworkdefs.h>
+
+class HbLabel;
+class HbFrameItem;
+class HbProgressBar;
+class QMPXVideoPlaybackViewFileDetails;
+class QMPXVideoPlaybackControlsController;
+
+class QMPXVideoPlaybackProgressBar : public HbWidget
+{
+ Q_OBJECT
+
+ public:
+ QMPXVideoPlaybackProgressBar( QMPXVideoPlaybackControlsController* controller );
+ virtual ~QMPXVideoPlaybackProgressBar();
+ void mousePressEvent( QGraphicsSceneMouseEvent *event );
+ void mouseReleaseEvent( QGraphicsSceneMouseEvent *event );
+ void mouseMoveEvent( QGraphicsSceneMouseEvent *event );
+ void initialize();
+ void updateWithFileDetails( QMPXVideoPlaybackViewFileDetails* details );
+ void updateState( TMPXPlaybackState state );
+
+ public:
+ void durationChanged( int duration );
+ void positionChanged( int position );
+
+ private:
+ QString valueToReadableFormat( int value );
+ void updatePostion( int position );
+
+ private:
+ QMPXVideoPlaybackControlsController *mController;
+ HbProgressBar *mProgressSlider;
+ HbLabel *mDurationLabel;
+ HbLabel *mPositionLabel;
+
+ int mDuration;
+ bool mNeedToResumeAfterSetPosition;
+ bool mInitialized;
+ bool mDragging;
+
+ HbFrameItem *mFrameItem;
+};
+
+#endif /*MPXVIDEOPLAYBACKPROGRESSBAR_H_*/
+
--- a/videoplayback/hbvideoplaybackview/controlinc/mpxvideoplaybackstatuspanecontrol.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/hbvideoplaybackview/controlinc/mpxvideoplaybackstatuspanecontrol.h Thu Apr 01 23:22:15 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 8 %
+// Version : %version: 9 %
@@ -28,6 +28,7 @@
class HbLabel;
class HbAction;
+class HbFrameItem;
class QMPXVideoPlaybackViewFileDetails;
class QMPXVideoPlaybackControlsController;
@@ -72,6 +73,7 @@
bool mVisible;
HbAction *mActionBack;
HbLabel *mTitleLabel;
+ HbFrameItem *mFrameItem;
};
#endif /*MPXVIDEOPLAYBACKSTATUSPANECONTROL_H_*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackbuttonbar.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,433 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackButtonBar
+*
+*/
+
+// Version : %version: da1mmcf#20 %
+
+
+
+#include <hbframeitem.h>
+#include <hbpushbutton.h>
+#include <hbframedrawer.h>
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackbuttonbar.h"
+#include "mpxvideoplaybackviewfiledetails.h"
+#include "mpxcommonvideoplaybackview.hrh"
+#include "mpxvideoplaybackdocumentloader.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackButtonBar::QMPXVideoPlaybackButtonBar()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackButtonBar::QMPXVideoPlaybackButtonBar(
+ QMPXVideoPlaybackControlsController* controller )
+ : mController( controller )
+ , mInitialized( false )
+ , mFrameItem( NULL )
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackButtonBar::QMPXVideoPlaybackButtonBar"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackButtonBar::~QMPXVideoPlaybackButtonBar()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackButtonBar::~QMPXVideoPlaybackButtonBar()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::~QMPXVideoPlaybackButtonBar()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackButtonBar::initialize()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackButtonBar::initialize()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackButtonBar::initialize()"));
+
+ QMPXVideoPlaybackDocumentLoader *loader = mController->layoutLoader();
+
+ //
+ // Don't need to initialize buttons once it gets initialized
+ //
+ if ( loader && ! mInitialized )
+ {
+ mInitialized = true;
+
+ //
+ // RW button
+ //
+ QGraphicsWidget *widget = loader->findWidget( QString( "rwButton" ) );
+ HbPushButton *rwButton = qobject_cast<HbPushButton*>( widget );
+ connect( rwButton, SIGNAL( pressed() ), this, SLOT( startRWSeeking() ) );
+ connect( rwButton, SIGNAL( released() ), this, SLOT( endSeeking() ) );
+ mButtons.append( rwButton );
+
+ //
+ // Play button
+ //
+ widget = loader->findWidget( QString( "playButton" ) );
+ HbPushButton *playButton = qobject_cast<HbPushButton*>( widget );
+ connect( playButton, SIGNAL( pressed() ), this, SLOT( handleButtonPressed() ) );
+ connect( playButton, SIGNAL( released() ), this, SLOT( play() ) );
+
+ mButtons.append( playButton );
+
+ //
+ // Pause button
+ //
+ widget = loader->findWidget( QString( "pauseButton" ) );
+ HbPushButton *pauseButton = qobject_cast<HbPushButton*>( widget );
+ connect( pauseButton, SIGNAL( pressed() ), this, SLOT( handleButtonPressed() ) );
+ connect( pauseButton, SIGNAL( released() ), this, SLOT( pause() ) );
+
+ mButtons.append( pauseButton );
+
+ //
+ // FW button
+ //
+ widget = loader->findWidget( QString( "ffButton" ) );
+ HbPushButton *ffButton = qobject_cast<HbPushButton*>( widget );
+ connect( ffButton, SIGNAL( pressed() ), this, SLOT( startFFSeeking() ) );
+ connect( ffButton, SIGNAL( released() ), this, SLOT( endSeeking() ) );
+ mButtons.append( ffButton );
+
+ //
+ // Aspect ratio button
+ //
+ widget = loader->findWidget( QString( "naturalButton" ) );
+ HbPushButton *naturalButton = qobject_cast<HbPushButton*>( widget );
+ connect( naturalButton, SIGNAL( pressed() ), this, SLOT( handleButtonPressed() ) );
+ connect( naturalButton, SIGNAL( released() ), this, SLOT( changeAspectRatio() ) );
+ mButtons.append( naturalButton );
+
+ widget = loader->findWidget( QString( "stretchButton" ) );
+ HbPushButton *stretchButton = qobject_cast<HbPushButton*>( widget );
+ connect( stretchButton, SIGNAL( pressed() ), this, SLOT( handleButtonPressed() ) );
+ connect( stretchButton, SIGNAL( released() ), this, SLOT( changeAspectRatio() ) );
+ mButtons.append( stretchButton );
+
+ widget = loader->findWidget( QString( "zoomButton" ) );
+ HbPushButton *zoomButton = qobject_cast<HbPushButton*>( widget );
+ connect( zoomButton, SIGNAL( pressed() ), this, SLOT( handleButtonPressed() ) );
+ connect( zoomButton, SIGNAL( released() ), this, SLOT( changeAspectRatio() ) );
+ mButtons.append( zoomButton );
+
+ //
+ // Details button
+ //
+ widget = loader->findWidget( QString( "detailsButton" ) );
+ HbPushButton *detailsButton = qobject_cast<HbPushButton*>( widget );
+ connect( detailsButton, SIGNAL( pressed() ), this, SLOT( handleButtonPressed() ) );
+ connect( detailsButton, SIGNAL( released() ), this, SLOT( openDetailsView() ) );
+ mButtons.append( detailsButton );
+
+ for ( int i = 0 ; i < EMPXButtonCount ; i++ )
+ {
+ mButtons[i]->setFlag( QGraphicsItem::ItemIsFocusable, false );
+ }
+
+ //
+ // Set framedrawer for semi transparent background
+ //
+ mFrameItem = new HbFrameItem ( this );
+ mFrameItem->setGeometry( boundingRect() );
+ mFrameItem->frameDrawer().setFrameType( HbFrameDrawer::OnePiece );
+ mFrameItem->frameDrawer().setFillWholeRect( true );
+ mFrameItem->frameDrawer().setFrameGraphicsName( "qtg_fr_status_trans_normal_c" );
+ mFrameItem->setVisible( false );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackButtonBar::play()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackButtonBar::play()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::play()"));
+
+ mController->resetDisappearingTimers( EMPXTimerReset );
+ mController->handleCommand( EMPXPbvCmdPlay );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackButtonBar::startFFSeeking()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackButtonBar::startFFSeeking()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::startFFSeeking()"));
+
+ mButtons[EMPXButtonFF]->setSelected( true );
+
+ mController->resetDisappearingTimers( EMPXTimerCancel );
+ mController->handleCommand( EMPXPbvCmdSeekForward );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackButtonBar::startRWSeeking()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackButtonBar::startRWSeeking()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::startRWSeeking()"));
+
+ mButtons[EMPXButtonRW]->setSelected( true );
+
+ mController->resetDisappearingTimers( EMPXTimerCancel );
+ mController->handleCommand( EMPXPbvCmdSeekBackward );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackButtonBar::endSeeking()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackButtonBar::endSeeking()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::endSeeking()"));
+
+ mButtons[EMPXButtonFF]->setSelected( false );
+ mButtons[EMPXButtonRW]->setSelected( false );
+
+ mController->resetDisappearingTimers( EMPXTimerReset );
+ mController->handleCommand( EMPXPbvCmdEndSeek );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackButtonBar::pause()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackButtonBar::pause()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::pause()"));
+
+ mController->resetDisappearingTimers( EMPXTimerReset );
+ mController->handleCommand( EMPXPbvCmdPause );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackButtonBar::changeAspectRatio()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackButtonBar::changeAspectRatio()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::changeAspectRatio()"));
+
+ mController->resetDisappearingTimers( EMPXTimerReset );
+
+ TMPXVideoPlaybackViewCommandIds cmd = EMPXPbvCmdNaturalAspectRatio;
+
+ if ( mButtons[EMPXButtonStretch]->isVisible() )
+ {
+ cmd = EMPXPbvCmdStretchAspectRatio;
+ }
+ else if ( mButtons[EMPXButtonZoom]->isVisible() )
+ {
+ cmd = EMPXPbvCmdZoomAspectRatio;
+ }
+
+ mController->handleCommand( cmd );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackButtonBar::updateState()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackButtonBar::updateState( TMPXPlaybackState state )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::updateState() state = %d"), state );
+
+ switch ( state )
+ {
+ case EPbStatePlaying:
+ {
+ setEnabled( true );
+
+ mButtons[EMPXButtonPlay]->setVisible( false );
+ mButtons[EMPXButtonPause]->setVisible( true );
+ break;
+ }
+ case EPbStatePaused:
+ {
+ setEnabled( true );
+
+ mButtons[EMPXButtonPause]->setVisible( false );
+ mButtons[EMPXButtonPlay]->setVisible( true );
+ break;
+ }
+ case EPbStateNotInitialised:
+ case EPbStateInitialising:
+ case EPbStateBuffering:
+ {
+ setEnabled( false );
+
+ break;
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackButtonBar::aspectRatioChanged()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackButtonBar::aspectRatioChanged( int aspectRatio )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::aspectRatioChanged() aspectRatio = %d"), aspectRatio );
+
+ switch( aspectRatio )
+ {
+ case EMMFNatural:
+ {
+ mButtons[EMPXButtonNatural]->setVisible( false );
+ mButtons[EMPXButtonStretch]->setVisible( true );
+ mButtons[EMPXButtonZoom]->setVisible( false );
+ break;
+ }
+ case EMMFStretch:
+ {
+ mButtons[EMPXButtonNatural]->setVisible( false );
+ mButtons[EMPXButtonStretch]->setVisible( false );
+ mButtons[EMPXButtonZoom]->setVisible( true );
+ break;
+ }
+ default:
+ {
+ mButtons[EMPXButtonNatural]->setVisible( true );
+ mButtons[EMPXButtonStretch]->setVisible( false );
+ mButtons[EMPXButtonZoom]->setVisible( false );
+ break;
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackButtonBar::handleButtonPressed()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackButtonBar::handleButtonPressed()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::handleButtonPressed()"));
+
+ mController->resetDisappearingTimers( EMPXTimerCancel );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackButtonBar::updateWithFileDetails()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackButtonBar::updateWithFileDetails(
+ QMPXVideoPlaybackViewFileDetails* details )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::updateWithFileDetails()"));
+
+ if ( ! details->mVideoEnabled ||
+ details->mVideoHeight <= 0 ||
+ details->mVideoWidth <= 0 ||
+ details->mTvOutConnected )
+ {
+ mButtons[EMPXButtonNatural]->setEnabled( false );
+ mButtons[EMPXButtonStretch]->setEnabled( false );
+ mButtons[EMPXButtonZoom]->setEnabled( false );
+ }
+ else
+ {
+ mButtons[EMPXButtonNatural]->setEnabled( true );
+ mButtons[EMPXButtonStretch]->setEnabled( true );
+ mButtons[EMPXButtonZoom]->setEnabled( true );
+ }
+
+ //
+ // for audio-only clips and tv-out, default view is audionOnlyView
+ // therefore, dim details button
+ //
+ if ( ! details->mVideoEnabled || details->mTvOutConnected )
+ {
+ mButtons[EMPXButtonDetails]->setEnabled( false );
+ }
+ else
+ {
+ mButtons[EMPXButtonDetails]->setEnabled( true );
+ }
+
+ if ( ! details->mSeekable || ( details->mTvOutConnected && ! details->mTvOutPlayAllowed ) )
+ {
+ mButtons[EMPXButtonRW]->setEnabled( false );
+ mButtons[EMPXButtonFF]->setEnabled( false );
+ }
+ else
+ {
+ mButtons[EMPXButtonRW]->setEnabled( true );
+ mButtons[EMPXButtonFF]->setEnabled( true );
+ }
+
+ if ( ! details->mPausableStream || ( details->mTvOutConnected && ! details->mTvOutPlayAllowed ) )
+ {
+ mButtons[EMPXButtonPause]->setEnabled( false );
+ }
+ else
+ {
+ mButtons[EMPXButtonPause]->setEnabled( true );
+ }
+
+ if ( details->mTvOutConnected && ! details->mTvOutPlayAllowed )
+ {
+ mButtons[EMPXButtonPlay]->setEnabled( false );
+ }
+ else
+ {
+ mButtons[EMPXButtonPlay]->setEnabled( true );
+ }
+
+ //
+ // If it is audio only view, show the background of button
+ //
+ bool backgrondVisible = false;
+
+ if ( mController->viewMode() == EAudioOnlyView )
+ {
+ backgrondVisible = true;
+ }
+
+ for ( int i = 0 ; i < EMPXButtonCount ; i++ )
+ {
+ QGraphicsItem* widget = mButtons[i]->primitive( HbStyle::P_PushButton_background );
+ widget->setVisible( backgrondVisible );
+ }
+
+ mFrameItem->setVisible( ( mController->viewMode() == EFullScreenView )? ETrue:EFalse );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackButtonBar::openDetailsView()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackButtonBar::openDetailsView()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackButtonBar::openDetailsView()"));
+
+ TPlaybackViewMode viewMode = mController->viewMode();
+
+ if ( viewMode == EFullScreenView )
+ {
+ mController->changeViewMode( EDetailsView );
+ }
+}
+
+//End of file
--- a/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackcontrolconfiguration.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackcontrolconfiguration.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -15,13 +15,13 @@
*
*/
-// Version : %version: da1mmcf#13 %
+// Version : %version: da1mmcf#16 %
// INCLUDE FILES
-#include <qgraphicswidget>
+#include <QGraphicsWidget>
#include "mpxvideo_debug.h"
#include "mpxvideoplaybackdocumentloader.h"
@@ -74,6 +74,8 @@
}
addControlToList( EMPXStatusPane );
+
+ emit controlListUpdated();
}
// -------------------------------------------------------------------------------------------------
@@ -103,6 +105,8 @@
{
case EMPXControlCmdFullScreenViewOpened:
{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlConfiguration::updateControlList() full screen view"));
+
widget->setVisible( true );
deleteControlFromList( EMPXDetailsViewPlaybackWindow );
@@ -113,6 +117,8 @@
}
case EMPXControlCmdDetailsViewOpened:
{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlConfiguration::updateControlList() details view"));
+
widget->setVisible( false );
deleteControlFromList( EMPXIndicatorBitmap );
@@ -126,6 +132,8 @@
case EMPXControlCmdTvOutConnected:
case EMPXControlCmdAudionOnlyViewOpened:
{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlConfiguration::updateControlList() audion only view"));
+
widget->setVisible( false );
deleteControlFromList( EMPXDetailsViewPlaybackWindow );
@@ -188,6 +196,8 @@
if ( mControlsController->fileDetails()->mVideoEnabled )
{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlConfiguration::updateControlsWithFileDetails() video enabled"));
+
QGraphicsWidget *widget =
mControlsController->layoutLoader()->findWidget( QString( "transparentWindow" ) );
widget->setVisible( true );
--- a/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackcontrolscontroller.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackcontrolscontroller.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: da1mmcf#25 %
+// Version : %version: da1mmcf#27 %
@@ -23,11 +23,11 @@
#include <coecntrl.h>
#include <bautils.h>
#include <barsread.h>
-#include <stringloader.h>
+#include <StringLoader.h>
#include <f32file.h>
-#include <qtimer>
-#include <qfileinfo>
+#include <QTimer>
+#include <QFileInfo>
#include <thumbnailmanager_qt.h>
#include <hblabel.h>
@@ -92,18 +92,6 @@
setParent( mView );
- mControlsPolicy = new QMPXVideoPlaybackControlPolicy();
- mControlsConfig = new QMPXVideoPlaybackControlConfiguration( this );
-
- connect( mControlsConfig, SIGNAL( controlListUpdated() ), this, SLOT( controlsListUpdated() ) );
-
- mControlsTimer = new QTimer( this );
- mControlsTimer->setInterval( KMPXControlsTimeOut );
- mControlsTimer->setSingleShot( false );
- connect( mControlsTimer, SIGNAL( timeout() ), this, SLOT( hideAllControls() ) );
-
- connect( mView, SIGNAL( tappedOnScreen() ), this, SLOT( handleTappedOnScreen() ) );
-
//
// Create layout loader
//
@@ -116,11 +104,6 @@
QGraphicsWidget *widget = mLoader->findWidget( QString( "content" ) );
mView->setWidget( widget );
- //
- // Update controls list based on configuration + volume
- //
- controlsListUpdated();
-
widget = mLoader->findWidget( QString( "volumeSlider" ) );
mVolumeControl = qobject_cast<QMPXVideoPlaybackNonTouchVolumeBar*>( widget );
}
@@ -134,6 +117,18 @@
delete mLoader;
mLoader = NULL;
}
+
+ mControlsPolicy = new QMPXVideoPlaybackControlPolicy();
+ mControlsConfig = new QMPXVideoPlaybackControlConfiguration( this );
+
+ connect( mControlsConfig, SIGNAL( controlListUpdated() ), this, SLOT( controlsListUpdated() ) );
+
+ mControlsTimer = new QTimer( this );
+ mControlsTimer->setInterval( KMPXControlsTimeOut );
+ mControlsTimer->setSingleShot( false );
+ connect( mControlsTimer, SIGNAL( timeout() ), this, SLOT( hideAllControls() ) );
+
+ connect( mView, SIGNAL( tappedOnScreen() ), this, SLOT( handleTappedOnScreen() ) );
}
// -------------------------------------------------------------------------------------------------
--- a/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackdetailsplaybackwindow.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackdetailsplaybackwindow.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -15,15 +15,18 @@
*
*/
-// Version : %version: 8 %
+// Version : %version: 11 %
-#include <qfileinfo>
-#include <qgraphicsscenemouseevent>
+#include <QFileInfo>
+#include <QGraphicsSceneMouseEvent>
+
#include <hblabel.h>
+#include <hbframeitem.h>
#include <hbpushbutton.h>
+#include <hbframedrawer.h>
#include "mpxvideo_debug.h"
#include "mpxvideoplaybackdocumentloader.h"
@@ -74,13 +77,22 @@
// Connect signal and slot for play button
//
QGraphicsWidget *widget = loader->findWidget( QString( "detailsViewPlayButton" ) );
- HbPushButton *playButton = qobject_cast<HbPushButton*>( widget );
- playButton->setFlag( QGraphicsItem::ItemIsFocusable, false );
+ mPlayButton = qobject_cast<HbPushButton*>( widget );
+ mPlayButton->setFlag( QGraphicsItem::ItemIsFocusable, false );
+
+ connect( mPlayButton, SIGNAL( released() ), this, SLOT( playPause() ) );
+
+ QGraphicsItem *widget1 = mPlayButton->primitive( HbStyle::P_PushButton_background );
+ widget1->setVisible( false );
- connect( playButton, SIGNAL( released() ), this, SLOT( playPause() ) );
-
- QGraphicsItem *widget1 = playButton->primitive( HbStyle::P_PushButton_background );
- widget1->setVisible( false );
+ //
+ // Set framedrawer for semi transparent background
+ //
+ HbFrameItem *frameItem = new HbFrameItem ( mPlayButton );
+ frameItem->setGeometry( mPlayButton->boundingRect() );
+ frameItem->frameDrawer().setFrameType( HbFrameDrawer::OnePiece );
+ frameItem->frameDrawer().setFillWholeRect( true );
+ frameItem->frameDrawer().setFrameGraphicsName( "qtg_fr_status_trans_normal_c" );
}
updateState( mController->state() );
@@ -94,20 +106,16 @@
{
MPX_DEBUG(_L("QMPXVideoPlaybackDetailsPlaybackWindow::updateState() state = %d"), state );
- QMPXVideoPlaybackDocumentLoader *loader = mController->layoutLoader();
-
- QGraphicsWidget *widget = loader->findWidget( QString( "detailsViewPlayButton" ) );
-
switch ( state )
{
case EPbStatePaused:
{
- widget->setVisible( true );
+ mPlayButton->setVisible( true );
break;
}
default:
{
- widget->setVisible( false );
+ mPlayButton->setVisible( false );
break;
}
}
@@ -125,27 +133,27 @@
}
// -------------------------------------------------------------------------------------------------
-// HbVideoBasePlaybackView::event()
+// QMPXVideoPlaybackDetailsPlaybackWindow::mousePressEvent
// -------------------------------------------------------------------------------------------------
//
-bool QMPXVideoPlaybackDetailsPlaybackWindow::event( QEvent *event )
+void QMPXVideoPlaybackDetailsPlaybackWindow::mousePressEvent( QGraphicsSceneMouseEvent *event )
{
- bool consumed = false;
+ MPX_DEBUG(_L("QMPXVideoPlaybackDetailsPlaybackWindow::mousePressEvent"));
+
+ event->accept();
+}
- //
- // Ignore touch event if the gesture event was just received and is being processed
- //
- if ( event->type() == QEvent::UngrabMouse )
- {
- playPause();
- consumed = true;
- }
- else
- {
- consumed = QGraphicsWidget::event( event );
- }
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDetailsPlaybackWindow::mouseReleaseEvent
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackDetailsPlaybackWindow::mouseReleaseEvent( QGraphicsSceneMouseEvent *event )
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackDetailsPlaybackWindow::mouseReleaseEvent"));
- return consumed;
+ Q_UNUSED( event );
+
+ playPause();
}
//End of file
--- a/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackfiledetailswidget.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackfiledetailswidget.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -15,18 +15,18 @@
*
*/
-// Version : %version: 13 %
-
+// Version : %version: 19 %
-#include <qfileinfo>
-#include <qgraphicslinearlayout>
-#include <qdatetime>
-#include <qdir>
+#include <QDir>
+#include <QDateTime>
+#include <QFileInfo>
+#include <hbglobal.h>
#include <hblistwidgetitem.h>
#include <hbratingslider.h>
#include <hblistwidget.h>
+#include <hblistviewitem.h>
#include "mpxvideo_debug.h"
#include "mpxvideoplaybackdocumentloader.h"
@@ -58,8 +58,6 @@
{
MPX_ENTER_EXIT(_L("QMPXVideoPlaybackFileDetailsWidget::~QMPXVideoPlaybackFileDetailsWidget()"));
- HbStyleLoader::unregisterFilePath( ":/hbvideoplaybackview/hblistwidget.css" );
-
if ( mListWidget )
{
delete mListWidget;
@@ -78,7 +76,7 @@
}
// -------------------------------------------------------------------------------------------------
-// QMPXVideoPlaybackFileDetailsWidget::updateControlsWithFileDetails
+// QMPXVideoPlaybackFileDetailsWidget::updateWithFileDetails
// -------------------------------------------------------------------------------------------------
//
void QMPXVideoPlaybackFileDetailsWidget::updateWithFileDetails(
@@ -98,13 +96,14 @@
//
mListWidget = qobject_cast<HbListWidget*>( widget );
+ //
+ // set the min/max number of lines in the second row
+ //
+ HbListViewItem *prototype = mListWidget->listItemPrototype();
+ prototype->setSecondaryTextRowCount(1, 3);
+
if ( ! mFileDetailsUpdated )
- {
- //
- // load file details style sheet
- //
- bool ret = HbStyleLoader::registerFilePath( ":/hbvideoplaybackview/hblistwidget.css" );
-
+ {
mFileDetailsUpdated = true;
QFileInfo fileInfo( details->mClipName );
@@ -117,7 +116,9 @@
//
// Description
//
- addItemToListWidget( "Description", details->mDescription );
+ addItemToListWidget(
+ hbTrId( "txt_videos_list_description" ), details->mDescription );
+
//
// Duration
@@ -126,7 +127,7 @@
{
QString duration = QString("%1").arg(
valueToReadableFormat( (qreal)details->mDuration / (qreal)KPbMilliMultiplier ) );
- addItemToListWidget( "Duration", duration );
+ addItemToListWidget( hbTrId( "txt_videos_list_duration" ), duration );
}
//
@@ -139,39 +140,39 @@
// Date created
//
QString date = QString("%1").arg( fileInfo.created().toString( KDATETIMEFORMAT ) );
- addItemToListWidget( "Date", date );
+ addItemToListWidget( hbTrId( "txt_videos_list_date" ), date );
//
// Date modified
//
QString modified = QString("%1").arg( fileInfo.lastModified().toString( KDATETIMEFORMAT ) );
- addItemToListWidget( "Modified", modified );
+ addItemToListWidget( hbTrId( "txt_videos_list_modified" ), modified );
}
//
// Location
//
- addItemToListWidget( "Location", details->mLocation );
+ addItemToListWidget( hbTrId( "txt_videos_list_location" ), details->mLocation );
//
// Author
//
- addItemToListWidget( "Author", details->mArtist );
+ addItemToListWidget( hbTrId( "txt_videos_list_author" ), details->mArtist );
//
// Copyright
//
- addItemToListWidget( "Copyright", details->mCopyright );
+ addItemToListWidget( hbTrId( "txt_videos_list_copyright" ), details->mCopyright );
//
// Language
//
- addItemToListWidget( "Language", details->mLanguage );
+ addItemToListWidget( hbTrId( "txt_videos_list_language" ), details->mLanguage );
//
// Keywords
//
- addItemToListWidget( "Keywords", details->mKeywords );
+ addItemToListWidget( hbTrId( "txt_videos_list_keywords" ), details->mKeywords );
//
// Size
@@ -185,13 +186,13 @@
{
QString resolution = QString("%1 x %2")
.arg( details->mVideoWidth ).arg( details->mVideoHeight );
- addItemToListWidget( "Resolution", resolution );
+ addItemToListWidget( hbTrId( "txt_videos_list_resolution" ), resolution );
}
//
// Format
//
- addItemToListWidget( "Format", details->mMimeType );
+ addItemToListWidget( hbTrId( "txt_videos_list_format" ), details->mMimeType );
//
// Bitrate
@@ -204,8 +205,8 @@
if ( details->mPlaybackMode == EMPXVideoLocal ||
details->mPlaybackMode == EMPXVideoProgressiveDownload)
{
- QString folder = fileInfo.dir().dirName();
- addItemToListWidget( "Collection", folder );
+ QString folder = fileInfo.dir().dirName();
+ addItemToListWidget( hbTrId( "txt_videos_list_collection_name" ), folder );
}
}
@@ -233,6 +234,11 @@
bool ok = false;
loader->load( KMPXPLAYBACKVIEW_XML, sectionName, &ok );
+
+ if ( ! ok )
+ {
+ MPX_DEBUG(_L("QMPXVideoPlaybackFileDetailsWidget failed to load section"));
+ }
}
}
@@ -304,7 +310,7 @@
// populate Title and its associated text
//
HbListWidgetItem* listWidgetItem = new HbListWidgetItem();
- listWidgetItem->setText( "Title" );
+ listWidgetItem->setText( hbTrId( "txt_videos_title_videos" ) );
listWidgetItem->setSecondaryText( title );
mListWidget->insertItem( 0, listWidgetItem );
}
@@ -331,12 +337,24 @@
details->mPlaybackMode == EMPXVideoProgressiveDownload )
{
QFileInfo fileInfo( details->mClipName );
- float size = fileInfo.size();
-
- if ( size > 0.0 )
+
+ //
+ // to prevent overflow, get an unsigned value of file size
+ //
+ ulong fileSize = fileInfo.size();
+
+ //
+ // convert file size to KB, MB, GB accordingly
+ //
+ if ( fileSize > 0 )
{
QString scale(" KB");
+ //
+ // cast for later conversion with floating point
+ //
+ float size = (float) fileSize;
+
if ( size > KILOBYTE )
{
size /= KILOBYTE;
@@ -360,7 +378,7 @@
QString text = QString("%1").arg( size );
text.append( scale );
- addItemToListWidget( "Size", text );
+ addItemToListWidget( hbTrId( "txt_videos_list_file_size" ), text );
}
}
}
@@ -394,7 +412,7 @@
QString text = QString("%1").arg( bitrate );
text.append( scale );
- addItemToListWidget( "Bitrate", text );
+ addItemToListWidget( hbTrId( "txt_videos_list_bitrate" ), text );
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybacknontouchvolumebar.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,121 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackNonTouchVolumeBar
+*
+*/
+
+// Version : %version: 7 %
+
+
+
+#include <QTimer>
+#include <QGraphicsSceneMouseEvent>
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+#include "mpxvideoplaybacknontouchvolumebar.h"
+
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackNonTouchVolumeBar::QMPXVideoPlaybackNonTouchVolumeBar()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackNonTouchVolumeBar::QMPXVideoPlaybackNonTouchVolumeBar()
+ : HbVolumeSliderPopup()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackNonTouchVolumeBar::QMPXVideoPlaybackNonTouchVolumeBar()"));
+
+ mVolumeTimer = new QTimer( this );
+ mVolumeTimer->setInterval( KMPXControlsTimeOut );
+ mVolumeTimer->setSingleShot( false );
+ connect( mVolumeTimer, SIGNAL( timeout() ), this, SLOT( hideVolumeControl() ) );
+
+ setTickPosition( Hb::NoSliderTicks );
+
+ setRange( KPbPlaybackVolumeLevelMin, KPbPlaybackVolumeLevelMax );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackNonTouchVolumeBar::~QMPXVideoPlaybackNonTouchVolumeBar()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackNonTouchVolumeBar::~QMPXVideoPlaybackNonTouchVolumeBar()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackNonTouchVolumeBar::QMPXVideoPlaybackNonTouchVolumeBar"));
+
+ disconnect( mVolumeTimer, SIGNAL( timeout() ), this, SLOT( hideVolumeControl() ) );
+
+ if ( mVolumeTimer )
+ {
+ if ( mVolumeTimer->isActive() )
+ {
+ mVolumeTimer->stop();
+ }
+
+ delete mVolumeTimer;
+ mVolumeTimer = NULL;
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackNonTouchVolumeBar::setVisible()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackNonTouchVolumeBar::setVisible( bool visible )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackNonTouchVolumeBar::setVisible"));
+
+ if ( mVolumeTimer->isActive() )
+ {
+ mVolumeTimer->stop();
+ }
+
+ if ( visible )
+ {
+ mVolumeTimer->start();
+ }
+
+ HbVolumeSliderPopup::setVisible( visible );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackNonTouchVolumeBar::hideVolumeControl()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackNonTouchVolumeBar::hideVolumeControl()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackNonTouchVolumeBar::hideVolumeControl"));
+
+ setVisible( false );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackNonTouchVolumeBar::mousePressEvent()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackNonTouchVolumeBar::mousePressEvent( QGraphicsSceneMouseEvent *event )
+{
+ event->ignore();
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackNonTouchVolumeBar::mouseReleaseEvent()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackNonTouchVolumeBar::mouseReleaseEvent( QGraphicsSceneMouseEvent *event )
+{
+ event->ignore();
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackprogressbar.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,331 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackProgressBar
+*
+*/
+
+// Version : %version: da1mmcf#13 %
+
+
+
+
+#include <QTime>
+#include <QGraphicsSceneMouseEvent>
+
+#include <hblabel.h>
+#include <hbframeitem.h>
+#include <hbprogressbar.h>
+#include <hbframedrawer.h>
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackprogressbar.h"
+#include "mpxvideoplaybackdocumentloader.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackProgressBar::QMPXVideoPlaybackProgressBar
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackProgressBar::QMPXVideoPlaybackProgressBar(
+ QMPXVideoPlaybackControlsController* controller )
+ : mController( controller )
+ , mDuration( -1 )
+ , mNeedToResumeAfterSetPosition( false )
+ , mInitialized( false )
+ , mDragging( false )
+ , mFrameItem( NULL )
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackProgressBar::QMPXVideoPlaybackProgressBar()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackProgressBar::~QMPXVideoPlaybackProgressBar
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackProgressBar::~QMPXVideoPlaybackProgressBar()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackProgressBar::~QMPXVideoPlaybackProgressBar()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackProgressBar::initialize
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackProgressBar::initialize()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackProgressBar::initialize()"));
+
+ QMPXVideoPlaybackDocumentLoader *loader = mController->layoutLoader();
+
+ //
+ // Don't need to initialize buttons once it gets initialized
+ //
+ if ( loader && ! mInitialized )
+ {
+ mInitialized = true;
+
+ //
+ // progress slider
+ //
+ QGraphicsWidget *widget = loader->findWidget( QString( "progressSlider" ) );
+ mProgressSlider = qobject_cast<HbProgressBar*>( widget );
+
+ //
+ // position label
+ //
+ widget = loader->findWidget( QString( "positionLabel" ) );
+ mPositionLabel= qobject_cast<HbLabel*>( widget );
+
+ //
+ // duration label
+ //
+ widget = loader->findWidget( QString( "durationLabel" ) );
+ mDurationLabel= qobject_cast<HbLabel*>( widget );
+
+ //
+ // If we init the progress bar after pp sends the duration informatin
+ // we need to set the duration manually
+ //
+ durationChanged( (qreal)mController->fileDetails()->mDuration / (qreal)KPbMilliMultiplier );
+
+ //
+ // Set framedrawer for semi transparent background
+ //
+ mFrameItem = new HbFrameItem ( this );
+ mFrameItem->setGeometry( boundingRect() );
+ mFrameItem->frameDrawer().setFrameType( HbFrameDrawer::OnePiece );
+ mFrameItem->frameDrawer().setFillWholeRect( true );
+ mFrameItem->frameDrawer().setFrameGraphicsName( "qtg_fr_status_trans_normal_c" );
+ mFrameItem->setVisible( false );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackProgressBar::durationChanged
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackProgressBar::durationChanged( int duration )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::durationChanged duration = %d"), duration );
+
+ mDuration = duration;
+
+ mDurationLabel->setPlainText( valueToReadableFormat( mDuration ) );
+ mProgressSlider->setRange( 0, mDuration );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackProgressBar::positionChanged
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackProgressBar::positionChanged( int position )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::positionChanged position = %d"), position );
+
+ //
+ // While dragging event, don't update old position information from mpx framework
+ //
+ if ( ! mDragging )
+ {
+ updatePostion( position );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackProgressBar::updatePostion
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackProgressBar::updatePostion( int position )
+{
+ if ( position < 0 )
+ {
+ position = 0;
+ }
+ else if ( position > mDuration )
+ {
+ position = mDuration;
+ }
+
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::updatePostion position = %d"), position );
+
+ mPositionLabel->setPlainText( valueToReadableFormat( position ) );
+ mProgressSlider->setProgressValue( position );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackProgressBar::valueToReadableFormat
+// -------------------------------------------------------------------------------------------------
+//
+QString QMPXVideoPlaybackProgressBar::valueToReadableFormat( int value )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::valueToReadableFormat value = %d"), value);
+
+ int hour = value / 3600;
+ value = value % 3600;
+ int minutes = value / 60;
+ value = value % 60;
+ int second = value;
+
+ QTime time( hour ,minutes ,second );
+ QString str;
+
+ if ( hour == 0 )
+ {
+ str = time.toString("mm:ss");
+ }
+ else
+ {
+ str = time.toString("hh:mm:ss");
+ }
+
+ return str;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackProgressBar::mousePressEvent
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackProgressBar::mousePressEvent( QGraphicsSceneMouseEvent *event )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackProgressBar::mousePressEvent()"));
+
+ mDragging = true;
+
+ mController->resetDisappearingTimers( EMPXTimerCancel );
+
+ //
+ // Pause the playback if it's playing
+ //
+ if( mController->state() == EPbStatePlaying )
+ {
+ mNeedToResumeAfterSetPosition = true;
+ mController->handleCommand( EMPXPbvCmdCustomPause );
+ }
+
+ event->accept();
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackProgressBar::mouseReleaseEvent
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackProgressBar::mouseReleaseEvent( QGraphicsSceneMouseEvent *event )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackProgressBar::mouseReleaseEvent()"));
+
+ mDragging = false;
+
+ mController->resetDisappearingTimers( EMPXTimerReset );
+
+ int position =
+ (int)( ( event->scenePos().x() - mProgressSlider->geometry().x() ) /
+ mProgressSlider->geometry().width() * (qreal)mDuration );
+
+ if ( position > mDuration )
+ {
+ mController->handleCommand( EMPXPbvCmdEndOfClip );
+ }
+ else
+ {
+ if ( position < 0 )
+ {
+ position = 0;
+ }
+
+ mController->handleCommand( EMPXPbvCmdSetPosition, position );
+
+ //
+ // Resume if it was playing
+ //
+ if( mNeedToResumeAfterSetPosition )
+ {
+ mNeedToResumeAfterSetPosition = false;
+ mController->handleCommand( EMPXPbvCmdCustomPlay );
+ }
+ }
+
+ event->accept();
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackProgressBar::mouseMoveEvent
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackProgressBar::mouseMoveEvent( QGraphicsSceneMouseEvent *event )
+{
+ qreal result =
+ ( event->scenePos().x() - mProgressSlider->geometry().x() ) /
+ mProgressSlider->geometry().width() * (qreal)mDuration;
+
+ updatePostion( result );
+
+ event->accept();
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackProgressBar::updateWithFileDetails()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackProgressBar::updateWithFileDetails(
+ QMPXVideoPlaybackViewFileDetails* details )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackProgressBar::updateControlsWithFileDetails()"));
+
+ if ( details->mPlaybackMode == EMPXVideoLiveStreaming )
+ {
+ setEnabled( false );
+ mDurationLabel->setPlainText( "Live" );
+ }
+ else if ( details->mTvOutConnected && ! details->mTvOutPlayAllowed )
+ {
+ setEnabled( false );
+ }
+ else
+ {
+ setEnabled( true );
+ }
+
+ mFrameItem->setVisible( ( mController->viewMode() == EFullScreenView )? ETrue:EFalse );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackProgressBar::updateState()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackProgressBar::updateState( TMPXPlaybackState state )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackProgressBar::updateState() state = %d"), state );
+
+ if ( mController->viewMode() == EAudioOnlyView )
+ {
+ switch ( state )
+ {
+ case EPbStatePlaying:
+ case EPbStatePaused:
+ {
+ updateWithFileDetails( mController->fileDetails() );
+ break;
+ }
+ case EPbStateNotInitialised:
+ case EPbStateInitialising:
+ case EPbStateBuffering:
+ {
+ setEnabled( false );
+ break;
+ }
+ }
+ }
+}
+
+//End of file
--- a/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackstatuspanecontrol.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackstatuspanecontrol.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -15,13 +15,15 @@
*
*/
-// Version : %version: 10 %
+// Version : %version: 12 %
#include <hbmenu.h>
#include <hblabel.h>
#include <hbaction.h>
#include <hbinstance.h>
+#include <hbframeitem.h>
+#include <hbframedrawer.h>
#include <w32std.h>
@@ -43,6 +45,7 @@
TUint controlproperties )
: QMPXVideoPlaybackFullScreenControl( controller, index, widget, controlproperties )
, mActionBack( NULL )
+ , mFrameItem( NULL )
{
MPX_ENTER_EXIT(_L("QMPXVideoPlaybackStatusPaneControl::QMPXVideoPlaybackStatusPaneControl()"));
@@ -160,22 +163,59 @@
{
MPX_DEBUG(_L("QMPXVideoPlaybackStatusPaneControl::updateControlsWithFileDetails()"));
- //
- // If it's details view, need to go back to the default playback view with secondary key
- // If not, we need to go back to the collection view with the secondary key
- //
- if ( mController->viewMode() == EDetailsView )
+ switch( mController->viewMode() )
{
- disconnect( mActionBack, SIGNAL( triggered() ), mController->view(), SLOT( closePlaybackView() ) );
- connect( mActionBack, SIGNAL( triggered() ), this, SLOT( openFullScreenView() ) );
- }
- else
- {
- disconnect( mActionBack, SIGNAL( triggered() ), this, SLOT( openFullScreenView() ) );
- connect( mActionBack, SIGNAL( triggered() ), mController->view(), SLOT( closePlaybackView() ) );
+ case EFullScreenView:
+ {
+ //
+ // Set TitleBar transparent and go back to preview view with back key
+ //
+ disconnect( mActionBack, SIGNAL( triggered() ), this, SLOT( openFullScreenView() ) );
+ connect( mActionBack, SIGNAL( triggered() ), mController->view(), SLOT( closePlaybackView() ) );
+
+ mController->view()->setTitleBarFlags( HbView::TitleBarTransparent );
+ break;
+ }
+ case EDetailsView:
+ {
+ //
+ // Set TitleBar opaque and go back to full screen view with back key
+ //
+ disconnect( mActionBack, SIGNAL( triggered() ), mController->view(), SLOT( closePlaybackView() ) );
+ connect( mActionBack, SIGNAL( triggered() ), this, SLOT( openFullScreenView() ) );
+
+ mController->view()->setTitleBarFlags( HbView::TitleBarFlagNone );
+
+ break;
+ }
+ case EAudioOnlyView:
+ {
+ //
+ // Set TitleBar opaque and go back to preview view with back key
+ //
+ disconnect( mActionBack, SIGNAL( triggered() ), this, SLOT( openFullScreenView() ) );
+ connect( mActionBack, SIGNAL( triggered() ), mController->view(), SLOT( closePlaybackView() ) );
+
+ mController->view()->setTitleBarFlags( HbView::TitleBarFlagNone );
+ break;
+ }
}
setMenu( details );
+
+ //
+ // Set framedrawer for semi transparent background
+ //
+ if ( ! mFrameItem )
+ {
+ mFrameItem = new HbFrameItem ( mTitleLabel );
+ mFrameItem->frameDrawer().setFrameType( HbFrameDrawer::OnePiece );
+ mFrameItem->frameDrawer().setFillWholeRect( true );
+ mFrameItem->frameDrawer().setFrameGraphicsName( "qtg_fr_status_trans_normal_c" );
+ }
+
+ mFrameItem->setGeometry( mTitleLabel->boundingRect() );
+ mFrameItem->setVisible( ( mController->viewMode() == EFullScreenView )? ETrue:EFalse );
}
// -------------------------------------------------------------------------------------------------
@@ -187,17 +227,9 @@
MPX_DEBUG(_L("QMPXVideoPlaybackStatusPaneControl::setMenu()"));
//
- // Set menu
+ // No available menu for now
//
- mController->view()->menu()->clearActions();
-
- if ( ! details->mTvOutConnected || ! details->mTvOutPlayAllowed )
- {
- if ( details->mVideoEnabled && mController->viewMode() != EDetailsView )
- {
- mController->view()->menu()->addAction( tr( "Subtitle" ) );
- }
- }
+ Q_UNUSED( details );
}
// -------------------------------------------------------------------------------------------------
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/inc/mpxvideoplaybackcontrolscontroller.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,374 @@
+/*
+* 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: Implementation of MPXVideoPlaybackControlsController
+*
+*/
+
+// Version : %version: da1mmcf#12 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_
+#define MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_
+
+// INCLUDES
+#include <QObject>
+#include <QPixmap>
+
+#include <mpxplaybackframeworkdefs.h>
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackcontrol.hrh"
+#include "mpxcommonvideoplaybackview.hrh"
+#include "mpxvideoplaybackviewfiledetails.h"
+
+// FORWARD DECLARATIONS
+class QTimer;
+class QString;
+class HbAction;
+class ThumbnailManager;
+class QActionGroup;
+class CMPXVideoViewWrapper;
+class HbVideoBasePlaybackView;
+class QMPXVideoPlaybackControlPolicy;
+class QMPXVideoPlaybackControlsLayout;
+class QMPXVideoPlaybackDocumentLoader;
+class QMPXVideoPlaybackFullScreenControl;
+class QMPXVideoPlaybackNonTouchVolumeBar;
+class QMPXVideoPlaybackControlsController;
+class QMPXVideoPlaybackControlConfiguration;
+
+
+// DATA TYPES
+
+enum TMPXTimerAction
+{
+ EMPXTimerCancel,
+ EMPXTimerReset
+};
+
+enum TThumbNailState
+{
+ EThumbNailEmpty,
+ EThumbNailNotAvailable,
+ EThumbNailRequsted,
+ EThumbNailSet
+};
+
+enum TPlaybackViewMode
+{
+ EFullScreenView,
+ EDetailsView,
+ EAudioOnlyView
+};
+
+const int KMPXControlsTimeOut = 4000;
+
+const QString KMPXPLAYBACKVIEW_XML = ":/hbvideoplaybackview/hbvideoplaybackview.docml";
+
+
+// CLASS DECLARATION
+
+class QMPXVideoPlaybackControlsController : public QObject
+{
+ Q_OBJECT
+
+ public:
+
+ /**
+ * constructor.
+ */
+ QMPXVideoPlaybackControlsController(
+ HbVideoBasePlaybackView *view,
+ CMPXVideoViewWrapper *viewWrapper,
+ QMPXVideoPlaybackViewFileDetails *details );
+
+ /**
+ * Destructor.
+ */
+ virtual ~QMPXVideoPlaybackControlsController();
+
+ public:
+
+ /**
+ * Handle event from container
+ */
+ void handleEvent( TMPXVideoPlaybackControlCommandIds event, int value = 0 );
+
+ /**
+ * Command handling function.
+ * Call HandleCommandL() of container
+ */
+ void handleCommand( TMPXVideoPlaybackViewCommandIds command, int value = 0 );
+
+ /*
+ * Return ETrue if TV-out cable gets connected
+ */
+ inline bool isTvOutConnected();
+
+ /*
+ * Return ETrue if TV-out cable is connected and content can be played
+ */
+ inline bool isTvOutPlaybackAllowed();
+
+ /**
+ * Reset or cancel timers for the controls
+ */
+ void resetDisappearingTimers( TMPXTimerAction timerAction );
+
+ /**
+ * Return state
+ */
+ inline TMPXPlaybackState state();
+
+ /**
+ * Return file details
+ */
+ inline QMPXVideoPlaybackViewFileDetails* fileDetails();
+
+ //
+ // Add the file details to the controls controller when available
+ //
+ void addFileDetails( QMPXVideoPlaybackViewFileDetails* details );
+
+ inline QMPXVideoPlaybackDocumentLoader* layoutLoader();
+
+ inline HbVideoBasePlaybackView* view();
+
+ void updateVideoRectDone();
+
+ TPlaybackViewMode viewMode();
+
+ void changeViewMode( TPlaybackViewMode viewMode, bool transitionEffect = true );
+
+ private:
+ /**
+ * Initialize controller
+ */
+ void initializeController();
+
+ /**
+ * Update controls
+ */
+ void handleStateChange( TMPXPlaybackState newState );
+
+ /**
+ * Show Controls and reset the timers
+ */
+ void showControls();
+
+ /**
+ * Return ETrue if any control is visible
+ */
+ bool isVisible();
+
+ /**
+ * Append a control based on control index
+ */
+ void appendControl( TMPXVideoPlaybackControls controlIndex );
+
+ /**
+ * Set changed volume
+ */
+ void volumeChanged( int volume );
+
+ /**
+ * Set changed duration
+ */
+ void durationChanged( int duration);
+
+ /**
+ * Set changed position
+ */
+ void positionChanged( int position );
+
+ /**
+ * Set changed position
+ */
+ void aspectRatioChanged( int aspectRatio );
+
+ /*
+ * Sets the download size on the progress bar
+ */
+ void setDownloadSize( int size );
+
+ /*
+ * Updates the download ratio on the progress bar
+ */
+ void updateDownloadPosition( int newSize );
+
+ /**
+ * Set changed state on the controls
+ */
+ void updateState();
+
+ /**
+ * Check whether this clip is real format or not
+ */
+ bool realFormat( QString filename );
+
+ /**
+ * Check whether this clip is real format or not for streaming/live streaming
+ */
+ bool realFormatForStreaming( const TDesC& des );
+
+ /**
+ * Check whether this clip is real format or not for local/progressive donwload
+ */
+ bool realFormatForLocal();
+
+ /**
+ * Handle errors
+ */
+ void handleErrors();
+
+ /**
+ * Return ETrue if control is visible
+ */
+ bool isSoftKeyVisible( int value );
+
+ /**
+ * Handle tvout connected/disconnected event
+ */
+ void handleTvOutEvent( bool connected,
+ TMPXVideoPlaybackControlCommandIds event,
+ int value );
+
+ HbAction* createAction( QActionGroup *actionsGroup,
+ int index,
+ const char *slot,
+ const QString& toolTip );
+
+ void updateVideoRect( bool transitionEffect = true );
+
+ void showVolumeControls();
+
+ void setDefaultBitmap();
+
+ void generateThumbNail();
+
+ private slots:
+ void hideAllControls();
+ void skipToNextVideoItem();
+ void skipToPreviousVideoItem();
+ void handleTappedOnScreen();
+ void handleThumbnailReady( QPixmap tnData, void *internal , int id, int error );
+ void controlsListUpdated();
+
+ private:
+ HbVideoBasePlaybackView *mView;
+ CMPXVideoViewWrapper *mViewWrapper;
+ QMPXVideoPlaybackViewFileDetails *mFileDetails;
+
+ QList<QMPXVideoPlaybackFullScreenControl*> mControls;
+
+ QMPXVideoPlaybackControlPolicy *mControlsPolicy;
+ QMPXVideoPlaybackControlConfiguration *mControlsConfig;
+
+ QTimer *mControlsTimer;
+
+ QMPXVideoPlaybackDocumentLoader *mLoader;
+ QMPXVideoPlaybackNonTouchVolumeBar *mVolumeControl;
+
+ ThumbnailManager *mThumbnailManager;
+
+ bool mViewTransitionIsGoingOn;
+ TThumbNailState mThumbNailState;
+
+ TMPXPlaybackState mState;
+ TPlaybackViewMode mViewMode;
+};
+
+// INLINE METHODS
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::state
+// -------------------------------------------------------------------------------------------------
+//
+inline
+TMPXPlaybackState QMPXVideoPlaybackControlsController::state()
+{
+ return mState;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::fileDetails
+// -------------------------------------------------------------------------------------------------
+//
+inline
+QMPXVideoPlaybackViewFileDetails* QMPXVideoPlaybackControlsController::fileDetails()
+{
+ return mFileDetails;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::isTvOutConnected
+// -------------------------------------------------------------------------------------------------
+//
+inline
+bool QMPXVideoPlaybackControlsController::isTvOutConnected()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::isTvOutConnected(%d)"),
+ mFileDetails->mTvOutConnected);
+
+ return mFileDetails->mTvOutConnected;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::isTvOutPlaybackAllowed
+// -------------------------------------------------------------------------------------------------
+//
+inline
+bool QMPXVideoPlaybackControlsController::isTvOutPlaybackAllowed()
+{
+ bool playable = ( ! mFileDetails->mTvOutConnected || mFileDetails->mTvOutPlayAllowed );
+
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::isTvOutPlaybackAllowed() [%d]"),
+ playable);
+
+ return playable;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::layoutLoader
+// -------------------------------------------------------------------------------------------------
+//
+inline
+QMPXVideoPlaybackDocumentLoader* QMPXVideoPlaybackControlsController::layoutLoader()
+{
+ return mLoader;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::view
+// -------------------------------------------------------------------------------------------------
+//
+inline
+HbVideoBasePlaybackView* QMPXVideoPlaybackControlsController::view()
+{
+ return mView;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::viewMode
+// -------------------------------------------------------------------------------------------------
+//
+inline
+TPlaybackViewMode QMPXVideoPlaybackControlsController::viewMode()
+{
+ return mViewMode;
+}
+
+#endif /*MPXVIDEOPLAYBACKCONTROLSCONTROLLER_P_H_*/
+
+// End of File
--- a/videoplayback/hbvideoplaybackview/resources/hblistwidget.css Thu Apr 01 23:13:36 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-HbListViewItem::text-1{
- color: white;
-}
-
-HbListViewItem::text-2{
- color: white;
-}
--- a/videoplayback/hbvideoplaybackview/resources/hbvideoplaybackview.docml Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/hbvideoplaybackview/resources/hbvideoplaybackview.docml Thu Apr 01 23:22:15 2010 +0300
@@ -1,26 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
-<hbdocument version="0.8">
+<hbdocument version="0.9">
<widget name="content" type="HbWidget">
<widget name="buttonBarLayout" type="HbWidget">
<widget name="aspectRatioButtons" type="HbWidget">
<widget name="naturalButton" type="HbPushButton">
- <icon iconName=":/hbvideoplaybackview/images/natural.png" name="icon"/>
+ <icon iconName="qtg_mono_aspect_ratio_natural.svg" name="icon"/>
<sizehint height="50" type="PREFERRED" width="150"/>
<sizehint height="50" type="MINIMUM" width="120"/>
<bool name="visible" value="FALSE"/>
+ <string name="state" value="normal"/>
</widget>
<widget name="stretchButton" type="HbPushButton">
- <icon iconName=":/hbvideoplaybackview/images/stretch.png" name="icon"/>
+ <icon iconName="qtg_mono_aspect_ratio_stretched.svg" name="icon"/>
<real name="z" value="1"/>
<sizehint height="50" type="PREFERRED" width="150"/>
<sizehint height="50" type="MINIMUM" width="120"/>
<bool name="visible" value="FALSE"/>
+ <string name="state" value="normal"/>
</widget>
<widget name="zoomButton" type="HbPushButton">
- <icon iconName=":/hbvideoplaybackview/images/zoom.png" name="icon"/>
+ <icon iconName=":/hbvideoplaybackview/images/qtg_mono_aspect_ratio_zoom.png" name="icon"/>
<real name="z" value="2"/>
<sizehint height="50" type="PREFERRED" width="150"/>
<sizehint height="50" type="MINIMUM" width="120"/>
+ <string name="state" value="normal"/>
</widget>
<real name="z" value="0"/>
<sizehint height="150" type="PREFERRED" width="150"/>
@@ -32,22 +35,25 @@
</layout>
</widget>
<widget name="rwButton" type="HbPushButton">
- <icon iconName=":/hbvideoplaybackview/images/previous.png" name="icon"/>
+ <icon iconName="qtg_mono_previous.svg" name="icon"/>
<sizehint height="50" type="PREFERRED" width="150"/>
<sizehint height="50" type="MINIMUM" width="120"/>
+ <string name="state" value="normal"/>
</widget>
<widget name="playPauseButtons" type="HbWidget">
<widget name="playButton" type="HbPushButton">
- <icon iconName=":/hbvideoplaybackview/images/play.png" name="icon"/>
+ <icon iconName="qtg_mono_play.svg" name="icon"/>
<real name="z" value="1"/>
<sizehint height="50" type="PREFERRED" width="150"/>
<sizehint height="50" type="MINIMUM" width="120"/>
<bool name="visible" value="FALSE"/>
+ <string name="state" value="normal"/>
</widget>
<widget name="pauseButton" type="HbPushButton">
- <icon iconName=":/hbvideoplaybackview/images/pause.png" name="icon"/>
+ <icon iconName="qtg_mono_pause.svg" name="icon"/>
<sizehint height="50" type="PREFERRED" width="150"/>
<sizehint height="50" type="MINIMUM" width="120"/>
+ <string name="state" value="normal"/>
</widget>
<real name="z" value="0"/>
<sizehint height="150" type="PREFERRED" width="150"/>
@@ -58,21 +64,24 @@
</layout>
</widget>
<widget name="ffButton" type="HbPushButton">
- <icon iconName=":/hbvideoplaybackview/images/next.png" name="icon"/>
+ <icon iconName="qtg_mono_next.svg" name="icon"/>
<real name="z" value="7"/>
<sizehint height="50" type="PREFERRED" width="150"/>
<sizehint height="50" type="MINIMUM" width="120"/>
+ <string name="state" value="normal"/>
</widget>
<widget name="detailsButton" type="HbPushButton">
- <icon iconName=":/hbvideoplaybackview/images/details.png" name="icon"/>
+ <icon iconName=":/hbvideoplaybackview/images/qtg_mono_info.png" name="icon"/>
<sizehint height="50" type="PREFERRED" width="150"/>
<sizehint height="50" type="MINIMUM" width="120"/>
+ <string name="state" value="normal"/>
</widget>
<real name="z" value="1"/>
<sizehint height="60" type="PREFERRED" width="640"/>
<sizehint height="50" type="MINIMUM" width="178"/>
<bool name="visible" value="FALSE"/>
- <layout orientation="Horizontal" type="linear">
+ <layout orientation="Horizontal" spacing="0px" type="linear">
+ <contentsmargins bottom="0px" left="0px" right="0px" top="0px"/>
<linearitem itemname="aspectRatioButtons"/>
<linearitem itemname="rwButton"/>
<linearitem itemname="playPauseButtons"/>
@@ -82,10 +91,9 @@
</widget>
<widget name="progressBarLayout" type="HbWidget">
<widget name="positionLabel" type="HbLabel">
- <enums name="alignment" value="AlignRight|AlignVCenter|AlignTrailing"/>
- <real name="z" value="0"/>
+ <enums name="alignment" value="AlignHCenter|AlignVCenter|AlignTrailing"/>
+ <real name="z" value="1"/>
<sizehint height="30" type="PREFERRED" width="30"/>
- <string name="textColor" value="#0000ff"/>
</widget>
<widget name="progressSlider" type="HbProgressBar">
<integer name="progressValue" value="0"/>
@@ -93,16 +101,13 @@
<sizehint height="30" type="PREFERRED" width="200"/>
</widget>
<widget name="durationLabel" type="HbLabel">
- <enums name="alignment" value="AlignLeft|AlignVCenter|AlignTrailing"/>
- <real name="z" value="2"/>
+ <enums name="alignment" value="AlignHCenter|AlignVCenter|AlignTrailing"/>
+ <real name="z" value="1"/>
<sizehint height="30" type="PREFERRED" width="30"/>
- <string name="textColor" value="#0000ff"/>
</widget>
<real name="z" value="3"/>
- <sizehint height="66" type="PREFERRED" width="640"/>
- <sizehint height="38" type="MINIMUM" width="88"/>
- <contentsmargins bottom="0" left="30" right="28" top="20"/>
- <sizehint height="524287" type="MAXIMUM" width="524287"/>
+ <sizehint height="50" type="PREFERRED" width="640"/>
+ <contentsmargins bottom="6" left="30" right="30" top="6"/>
<bool name="visible" value="FALSE"/>
<layout orientation="Horizontal" type="linear">
<linearitem itemname="positionLabel"/>
@@ -141,22 +146,22 @@
<widget name="bitmapLayout" type="HbWidget">
<widget name="audioOnlyBitmap" type="HbLabel">
<enums name="alignment" value="AlignVCenter|AlignHCenter"/>
- <icon iconName=":/hbvideoplaybackview/images/qgn_indi_onimage_audio.svg" name="icon"/>
+ <icon iconName=":/hbvideoplaybackview/images/qtg_large_just_audio.png" name="icon"/>
<bool name="visible" value="FALSE"/>
</widget>
<widget name="partialAudioOnlyBitmap" type="HbLabel">
<enums name="alignment" value="AlignVCenter|AlignHCenter"/>
- <icon iconName=":/hbvideoplaybackview/images/qgn_prop_video_corrupted.svg" name="icon"/>
+ <icon iconName=":/hbvideoplaybackview/images/qtg_large_corrupted.png" name="icon"/>
<bool name="visible" value="FALSE"/>
</widget>
<widget name="realAudioOnlyBitmap" type="HbLabel">
<enums name="alignment" value="AlignVCenter|AlignHCenter"/>
- <icon iconName=":/hbvideoplaybackview/images/realplay.png" name="icon"/>
+ <icon iconName=":/hbvideoplaybackview/images/qtg_large_realplayer.png" name="icon"/>
<bool name="visible" value="FALSE"/>
</widget>
<widget name="tvOutBitmap" type="HbLabel">
<enums name="alignment" value="AlignVCenter|AlignHCenter"/>
- <icon iconName=":/hbvideoplaybackview/images/tv_out.png" name="icon"/>
+ <icon iconName=":/hbvideoplaybackview/images/qtg_large_tv_out.png" name="icon"/>
<bool name="visible" value="FALSE"/>
</widget>
<real name="z" value="1"/>
@@ -175,18 +180,17 @@
<widget name="detailsPlaybackWindow" type="HbWidget">
<widget name="small_transparentWindow" type="HbTransparentWindow">
<widget name="detailsViewPlayButton" type="HbPushButton">
- <icon iconName=":/hbvideoplaybackview/images/play.png" name="icon"/>
+ <icon iconName="qtg_mono_play.svg" name="icon"/>
<real name="z" value="2"/>
- <sizehint height="229" type="PREFERRED" width="320"/>
- <contentsmargins bottom="80" left="120" right="120" top="80"/>
+ <sizehint height="60" type="PREFERRED" width="60"/>
+ <contentsmargins bottom="0" left="0" right="0" top="0"/>
+ <string name="state" value="normal"/>
</widget>
<real name="z" value="0"/>
<sizehint height="229" type="PREFERRED"/>
<layout type="anchor">
- <anchoritem dst="detailsViewPlayButton" dstEdge="LEFT" spacing="0" src="" srcEdge="LEFT"/>
- <anchoritem dst="detailsViewPlayButton" dstEdge="TOP" spacing="0" src="" srcEdge="TOP"/>
- <anchoritem dst="detailsViewPlayButton" dstEdge="RIGHT" spacing="0" src="" srcEdge="RIGHT"/>
- <anchoritem dst="detailsViewPlayButton" dstEdge="BOTTOM" spacing="0" src="" srcEdge="BOTTOM"/>
+ <anchoritem dst="detailsViewPlayButton" dstEdge="CENTERH" spacing="0" src="" srcEdge="CENTERH"/>
+ <anchoritem dst="detailsViewPlayButton" dstEdge="CENTERV" spacing="0" src="" srcEdge="CENTERV"/>
</layout>
</widget>
<widget name="starRatingSlider" type="HbRatingSlider">
@@ -204,12 +208,10 @@
</layout>
</widget>
<widget name="title" type="HbLabel">
- <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
+ <enums name="alignment" value="AlignLeft|AlignVCenter|AlignLeading"/>
<real name="z" value="6"/>
<sizehint height="33" type="PREFERRED" width="640"/>
<bool name="visible" value="FALSE"/>
- <string name="plainText" value=""/>
- <string name="textColor" value="#48a4ff"/>
</widget>
<widget name="transparentWindow" type="HbTransparentWindow">
<real name="z" value="0"/>
@@ -218,7 +220,7 @@
</widget>
<size height="360" name="size" width="640"/>
<real name="z" value="1"/>
- <rect height="360" name="geometry" width="640" x="-140" y="140"/>
+ <rect height="360" name="geometry" width="640" x="0" y="0"/>
<sizehint height="524287" type="MAXIMUM" width="524287"/>
<layout type="anchor">
<anchoritem dst="buttonBarLayout" dstEdge="LEFT" spacing="0" src="" srcEdge="LEFT"/>
@@ -231,19 +233,12 @@
<anchoritem dst="bufferingIcon" dstEdge="CENTERV" spacing="0" src="" srcEdge="CENTERV"/>
<anchoritem dst="title" dstEdge="LEFT" spacing="0" src="" srcEdge="LEFT"/>
<anchoritem dst="title" dstEdge="RIGHT" spacing="0" src="" srcEdge="RIGHT"/>
- <anchoritem dst="title" dstEdge="TOP" spacing="65" src="" srcEdge="TOP"/>
- <anchoritem dst="volumeSlider" dstEdge="TOP" spacing="0" src="title" srcEdge="BOTTOM"/>
- <anchoritem dst="volumeSlider" dstEdge="LEFT" spacing="0" src="" srcEdge="LEFT"/>
- <anchoritem dst="volumeSlider" dstEdge="RIGHT" spacing="80" src="" srcEdge="LEFT"/>
- <anchoritem dst="volumeSlider" dstEdge="BOTTOM" spacing="10" src="progressBarLayout" srcEdge="TOP"/>
+ <anchoritem dst="title" dstEdge="TOP" spacing="62" src="" srcEdge="TOP"/>
<anchoritem dst="fileDetailsLayout" dstEdge="LEFT" spacing="0" src="" srcEdge="CENTERH"/>
<anchoritem dst="fileDetailsLayout" dstEdge="RIGHT" spacing="0" src="" srcEdge="RIGHT"/>
- <anchoritem dst="fileDetailsLayout" dstEdge="BOTTOM" spacing="-116" src="" srcEdge="BOTTOM"/>
- <anchoritem dst="fileDetailsLayout" dstEdge="TOP" spacing="0" src="title" srcEdge="BOTTOM"/>
<anchoritem dst="bitmapLayout" dstEdge="LEFT" spacing="0" src="" srcEdge="LEFT"/>
<anchoritem dst="bitmapLayout" dstEdge="RIGHT" spacing="0" src="" srcEdge="CENTERH"/>
- <anchoritem dst="bitmapLayout" dstEdge="BOTTOM" spacing="-116" src="" srcEdge="BOTTOM"/>
- <anchoritem dst="bitmapLayout" dstEdge="TOP" spacing="65" src="" srcEdge="TOP"/>
+ <anchoritem dst="bitmapLayout" dstEdge="TOP" spacing="62" src="" srcEdge="TOP"/>
<anchoritem dst="detailsPlaybackWindow" dstEdge="TOP" spacing="0" src="title" srcEdge="BOTTOM"/>
<anchoritem dst="detailsPlaybackWindow" dstEdge="LEFT" spacing="0" src="" srcEdge="LEFT"/>
<anchoritem dst="detailsPlaybackWindow" dstEdge="RIGHT" spacing="0" src="" srcEdge="CENTERH"/>
@@ -252,6 +247,15 @@
<anchoritem dst="transparentWindow" dstEdge="TOP" spacing="0" src="" srcEdge="TOP"/>
<anchoritem dst="transparentWindow" dstEdge="RIGHT" spacing="0" src="" srcEdge="RIGHT"/>
<anchoritem dst="transparentWindow" dstEdge="BOTTOM" spacing="0" src="" srcEdge="BOTTOM"/>
+ <anchoritem dst="buttonBarLayout" dstEdge="TOP" spacing="-50" src="" srcEdge="BOTTOM"/>
+ <anchoritem dst="progressBarLayout" dstEdge="TOP" spacing="-50" src="buttonBarLayout" srcEdge="TOP"/>
+ <anchoritem dst="fileDetailsLayout" dstEdge="BOTTOM" spacing="0" src="progressBarLayout" srcEdge="TOP"/>
+ <anchoritem dst="bitmapLayout" dstEdge="BOTTOM" spacing="0" src="progressBarLayout" srcEdge="TOP"/>
+ <anchoritem dst="title" dstEdge="BOTTOM" spacing="100" src="" srcEdge="TOP"/>
+ <anchoritem dst="volumeSlider" dstEdge="LEFT" spacing="0" src="" srcEdge="LEFT"/>
+ <anchoritem dst="volumeSlider" dstEdge="TOP" spacing="0" src="title" srcEdge="BOTTOM"/>
+ <anchoritem dst="volumeSlider" dstEdge="BOTTOM" spacing="0" src="progressBarLayout" srcEdge="TOP"/>
+ <anchoritem dst="fileDetailsLayout" dstEdge="TOP" spacing="62" src="" srcEdge="TOP"/>
</layout>
</widget>
<section name="detailsView">
@@ -260,7 +264,7 @@
<bool name="visible" value="FALSE"/>
</widget>
<widget name="fileDetailsLayout" type="HbWidget">
- <sizehint height="262" type="PREFERRED" width="320"/>
+ <sizehint height="264" type="PREFERRED" width="320"/>
</widget>
<widget name="content" type="HbWidget">
<layout type="anchor">
@@ -277,14 +281,14 @@
<bool name="visible" value="TRUE"/>
</widget>
<widget name="fileDetailsLayout" type="HbWidget">
- <sizehint height="179" type="PREFERRED" width="320"/>
+ <sizehint height="198" type="PREFERRED" width="320"/>
</widget>
<widget name="content" type="HbWidget">
<layout type="anchor">
- <anchoritem dst="fileDetailsLayout" dstEdge="TOP" spacing="0" src="title" srcEdge="TOP"/>
+ <anchoritem dst="fileDetailsLayout" dstEdge="TOP" spacing="62" src="" srcEdge="TOP"/>
<anchoritem dst="fileDetailsLayout" dstEdge="LEFT" spacing="0" src="" srcEdge="CENTERH"/>
<anchoritem dst="fileDetailsLayout" dstEdge="RIGHT" spacing="0" src="" srcEdge="RIGHT"/>
- <anchoritem dst="fileDetailsLayout" dstEdge="BOTTOM" spacing="-116" src="" srcEdge="BOTTOM"/>
+ <anchoritem dst="fileDetailsLayout" dstEdge="BOTTOM" spacing="0" src="progressBarLayout" srcEdge="TOP"/>
</layout>
</widget>
</section>
@@ -294,14 +298,14 @@
<bool name="visible" value="FALSE"/>
</widget>
<widget name="fileDetailsLayout" type="HbWidget">
- <sizehint height="179" type="PREFERRED" width="320"/>
+ <sizehint height="198" type="PREFERRED" width="320"/>
</widget>
<widget name="content" type="HbWidget">
<layout type="anchor">
- <anchoritem dst="fileDetailsLayout" dstEdge="TOP" spacing="0" src="title" srcEdge="TOP"/>
+ <anchoritem dst="fileDetailsLayout" dstEdge="TOP" spacing="62" src="" srcEdge="TOP"/>
<anchoritem dst="fileDetailsLayout" dstEdge="LEFT" spacing="0" src="" srcEdge="CENTERH"/>
<anchoritem dst="fileDetailsLayout" dstEdge="RIGHT" spacing="0" src="" srcEdge="RIGHT"/>
- <anchoritem dst="fileDetailsLayout" dstEdge="BOTTOM" spacing="-116" src="" srcEdge="BOTTOM"/>
+ <anchoritem dst="fileDetailsLayout" dstEdge="BOTTOM" spacing="0" src="progressBarLayout" srcEdge="TOP"/>
</layout>
</widget>
</section>
@@ -311,7 +315,7 @@
<bool name="visible" value="FALSE"/>
</widget>
</section>
- <metadata activeUIState="Common ui state" display="QHD landscape" unit="px">
+ <metadata activeUIState="Common ui state" display="NHD landscape" unit="px">
<resource location="hbvideoplaybackview.qrc"/>
<uistate name="Common ui state" sections="#common"/>
</metadata>
--- a/videoplayback/hbvideoplaybackview/resources/hbvideoplaybackview.qrc Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/hbvideoplaybackview/resources/hbvideoplaybackview.qrc Thu Apr 01 23:22:15 2010 +0300
@@ -1,21 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<RCC>
<qresource prefix="hbvideoplaybackview">
- <file>images/natural.png</file>
- <file>images/pause.png</file>
- <file>images/play.png</file>
- <file>images/stretch.png</file>
- <file>images/volume.png</file>
- <file>images/zoom.png</file>
- <file>images/next.png</file>
- <file>images/previous.png</file>
- <file>images/qgn_prop_video_corrupted.svg</file>
+ <file>images/qtg_mono_aspect_ratio_zoom.png</file>
+ <file>images/qtg_large_corrupted.png</file>
<file>images/connecting_loading.gif</file>
- <file>images/qgn_indi_onimage_audio.svg</file>
- <file>images/tv_out.png</file>
- <file>images/realplay.png</file>
- <file>images/details.png</file>
+ <file>images/qtg_large_just_audio.png</file>
+ <file>images/qtg_large_tv_out.png</file>
+ <file>images/qtg_large_realplayer.png</file>
+ <file>images/qtg_mono_info.png</file>
<file>hbvideoplaybackview.docml</file>
- <file>hblistwidget.css</file>
</qresource>
</RCC>
Binary file videoplayback/hbvideoplaybackview/resources/images/qtg_large_corrupted.png has changed
Binary file videoplayback/hbvideoplaybackview/resources/images/qtg_large_just_audio.png has changed
Binary file videoplayback/hbvideoplaybackview/resources/images/qtg_large_realplayer.png has changed
Binary file videoplayback/hbvideoplaybackview/resources/images/qtg_large_tv_out.png has changed
Binary file videoplayback/hbvideoplaybackview/resources/images/qtg_mono_aspect_ratio_zoom.png has changed
Binary file videoplayback/hbvideoplaybackview/resources/images/qtg_mono_info.png has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testcontrolconfiguration/inc/testcontrolconfiguration.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,81 @@
+/**
+* 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: test module for QMPXVideoPlaybackControlConfiguration
+*
+*/
+
+// Version : %version: 1 %
+
+
+#ifndef __TESTCONTROLCONFIGURATION_H__
+#define __TESTCONTROLCONFIGURATION_H__
+
+
+// INCLUDES
+#include <QtTest/QtTest>
+
+class HbVideoBasePlaybackView;
+class CMPXVideoViewWrapper;
+class QMPXVideoPlaybackViewFileDetails;
+class QMPXVideoPlaybackControlsController;
+class QMPXVideoPlaybackControlConfiguration;
+
+
+
+class TestControlConfiguration : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * will be called before each testfunction is executed.
+ *
+ */
+ void init();
+
+ /**
+ * will be called after every testfunction.
+ *
+ */
+ void cleanup();
+
+ // test functions for the test framework
+
+
+ void setup();
+
+private slots:
+ void testControlList();
+ void testUpdateControlsWithFileDetails();
+ void testUpdateControlList();
+
+
+signals:
+
+ void commandSignal(int);
+
+private:
+ HbVideoBasePlaybackView* mBaseVideoView;
+ CMPXVideoViewWrapper* mVideoViewWrapper;
+ QMPXVideoPlaybackViewFileDetails* mFileDetails;
+ QMPXVideoPlaybackControlsController* mControlsController;
+ QMPXVideoPlaybackControlConfiguration* mControlConfig;
+
+};
+
+
+#endif // __TESTCONTROLCONFIGURATION_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testcontrolconfiguration/src/testcontrolconfiguration.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,196 @@
+/**
+* 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: tester for methods in VideoSortFilterProxyModel
+*
+*/
+
+
+#include <hbapplication.h>
+#include <hbinstance.h>
+#include <qdebug>
+#include <qgraphicswidget>
+
+#include "mpxvideoplaybackcontrol.hrh"
+#include "mpxhelixplaybackplugindefs.h"
+
+#include "testcontrolconfiguration.h"
+
+#include "mpxvideoplaybackviewfiledetails.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+#include "mpxvideoplaybackdocumentloader.h"
+
+
+#define private public
+#include "mpxvideoplaybackcontrolconfiguration.h"
+#undef private
+
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ MPX_ENTER_EXIT(_L("TestControlConfiguration::Main()"));
+
+ HbApplication app(argc, argv);
+ HbMainWindow window;
+
+ TestControlConfiguration tv;
+
+ char *pass[3];
+ pass[0] = argv[0];
+ pass[1] = "-o";
+ pass[2] = "c:\\data\\TestControlConfiguration.txt";
+
+ int res = QTest::qExec(&tv, 3, pass);
+
+ return res;
+}
+
+// ---------------------------------------------------------------------------
+// init
+// ---------------------------------------------------------------------------
+//
+void TestControlConfiguration::init()
+{
+ MPX_ENTER_EXIT(_L("TestControlConfiguration::init()"));
+}
+
+// ---------------------------------------------------------------------------
+// init
+// ---------------------------------------------------------------------------
+//
+void TestControlConfiguration::setup()
+{
+ MPX_ENTER_EXIT(_L("TestControlConfiguration::setup()"));
+
+ mFileDetails = new QMPXVideoPlaybackViewFileDetails();
+
+ mControlsController = new QMPXVideoPlaybackControlsController( mFileDetails );
+
+ mControlConfig = new QMPXVideoPlaybackControlConfiguration( mControlsController );
+}
+
+// ---------------------------------------------------------------------------
+// cleanup
+// ---------------------------------------------------------------------------
+//
+void TestControlConfiguration::cleanup()
+{
+ MPX_ENTER_EXIT(_L("TestControlConfiguration::cleanup()"));
+
+ if ( mFileDetails )
+ {
+ delete mFileDetails;
+ mFileDetails = NULL;
+ }
+
+ if ( mControlsController )
+ {
+ delete mControlsController;
+ mControlsController = NULL;
+ }
+
+ if ( mControlConfig )
+ {
+ delete mControlConfig;
+ mControlConfig = NULL;
+ }
+}
+
+// ---------------------------------------------------------------------------
+// testControlList
+// ---------------------------------------------------------------------------
+//
+void TestControlConfiguration::testControlList()
+{
+ MPX_ENTER_EXIT(_L("TestControlConfiguration::testControlList()"));
+
+ setup();
+
+ QList<TMPXVideoPlaybackControls> controlsList = mControlConfig->controlList();
+
+ QVERIFY( controlsList.contains( EMPXStatusPane ) );
+
+}
+
+// ---------------------------------------------------------------------------
+// testUpdateControlsWithFileDetails
+// ---------------------------------------------------------------------------
+//
+void TestControlConfiguration::testUpdateControlsWithFileDetails()
+{
+ MPX_ENTER_EXIT(_L("TestControlConfiguration::testUpdateControlsWithFileDetails()"));
+
+ setup();
+
+ // 1. test with mVideoEnabled = false
+ mControlsController->mFileDetails->mVideoEnabled = false;
+
+ mControlConfig->updateControlsWithFileDetails();
+
+ QList<TMPXVideoPlaybackControls> controlsList = mControlConfig->controlList();
+
+ QVERIFY( controlsList.contains( EMPXButtonBar ) );
+
+ // 2. test with mVideoEnabled = true
+ mControlsController->mFileDetails->mVideoEnabled = false;
+
+ mControlConfig->updateControlsWithFileDetails();
+
+ QVERIFY( controlsList.contains( EMPXProgressBar ) );
+
+ QGraphicsWidget *widget =
+ mControlsController->layoutLoader()->findWidget( QString( "transparentWindow" ) );
+
+ QVERIFY( widget->isVisible() );
+}
+
+// ---------------------------------------------------------------------------
+// testUpdateControlList
+// ---------------------------------------------------------------------------
+//
+void TestControlConfiguration::testUpdateControlList()
+{
+ MPX_ENTER_EXIT(_L("TestControlConfiguration::testUpdateControlList()"));
+
+ setup();
+
+ // 1. Test for Details View
+ mControlConfig->updateControlList( EMPXControlCmdDetailsViewOpened );
+
+ QList<TMPXVideoPlaybackControls> controlsList = mControlConfig->controlList();
+
+ QVERIFY( controlsList.contains( EMPXFileDetailsWidget ) );
+
+
+ // 2. Test for Fullscreen View
+ mControlConfig->updateControlList( EMPXControlCmdFullScreenViewOpened );
+
+ controlsList = mControlConfig->controlList();
+
+ QVERIFY( ! controlsList.contains( EMPXFileDetailsWidget ) );
+
+
+ // 3. Test for Audio Only View
+ mControlConfig->updateControlList( EMPXControlCmdAudionOnlyViewOpened );
+
+ controlsList = mControlConfig->controlList();
+
+ QVERIFY( ! controlsList.contains( EMPXDetailsViewPlaybackWindow ) );
+ QVERIFY( controlsList.contains( EMPXIndicatorBitmap ) );
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testcontrolconfiguration/stub/inc/mpxvideoplaybackcontrolscontroller.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,348 @@
+/*
+* 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: Implementation of MPXVideoPlaybackControlsController
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_
+#define MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_
+
+// INCLUDES
+#include <qobject>
+
+#include <mpxplaybackframeworkdefs.h>
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackcontrol.hrh"
+#include "mpxcommonvideoplaybackview.hrh"
+#include "mpxvideoplaybackviewfiledetails.h"
+
+// FORWARD DECLARATIONS
+class QTimer;
+class QString;
+class HbAction;
+class QActionGroup;
+class QMPXVideoPlaybackControlPolicy;
+class QMPXVideoPlaybackControlsLayout;
+class QMPXVideoPlaybackDocumentLoader;
+class QMPXVideoPlaybackFullScreenControl;
+class QMPXVideoPlaybackNonTouchVolumeBar;
+class QMPXVideoPlaybackControlsController;
+class QMPXVideoPlaybackControlConfiguration;
+
+
+// DATA TYPES
+
+enum TMPXTimerAction
+{
+ EMPXTimerCancel,
+ EMPXTimerReset
+};
+
+enum TPlaybackViewMode
+{
+ EFullScreenView,
+ EDetailsView,
+ EAudioOnlyView
+};
+
+const int KMPXControlsTimeOut = 4000;
+
+
+// CLASS DECLARATION
+
+class QMPXVideoPlaybackControlsController : public QObject
+{
+ Q_OBJECT
+
+ public:
+
+ /**
+ * constructor.
+ */
+ QMPXVideoPlaybackControlsController( QMPXVideoPlaybackViewFileDetails *details );
+
+ /**
+ * Destructor.
+ */
+ virtual ~QMPXVideoPlaybackControlsController();
+
+ public:
+
+ /**
+ * Handle event from container
+ */
+ void handleEvent( TMPXVideoPlaybackControlCommandIds event, int value = 0 );
+
+ /**
+ * Command handling function.
+ * Call HandleCommandL() of container
+ */
+ void handleCommand( TMPXVideoPlaybackViewCommandIds command, int value = 0 );
+
+ /*
+ * Return ETrue if TV-out cable gets connected
+ */
+ inline bool isTvOutConnected();
+
+ /*
+ * Return ETrue if TV-out cable is connected and content can be played
+ */
+ inline bool isTvOutPlaybackAllowed();
+
+ /**
+ * Reset or cancel timers for the controls
+ */
+ void resetDisappearingTimers( TMPXTimerAction timerAction );
+
+ /**
+ * Return state
+ */
+ inline TMPXPlaybackState state();
+
+ /**
+ * Return file details
+ */
+ inline QMPXVideoPlaybackViewFileDetails* fileDetails();
+
+ //
+ // Add the file details to the controls controller when available
+ //
+ void addFileDetails( QMPXVideoPlaybackViewFileDetails* details );
+
+ QMPXVideoPlaybackDocumentLoader* layoutLoader();
+
+ inline bool isFlipView();
+
+ void updateVideoRectDone();
+
+ void changeViewMode( TPlaybackViewMode viewMode, bool transitionEffect = true );
+
+ TPlaybackViewMode viewMode();
+
+ public:
+ /**
+ * Initialize controller
+ */
+ void initializeController();
+
+ /**
+ * Create controls
+ */
+ void createControls();
+
+ /**
+ * Update controls
+ */
+ void handleStateChange( TMPXPlaybackState newState );
+
+ /**
+ * Update Control's visibility
+ */
+ void updateControlsVisibility();
+
+ /**
+ * Toggle visibility
+ */
+ void toggleVisibility();
+
+ /**
+ * Create/delete controls based on updated control list
+ */
+ void controlsListUpdated();
+
+ /**
+ * Show Controls and reset the timers
+ */
+ void showControls();
+
+ /**
+ * Return ETrue if any control is visible
+ */
+ bool isVisible();
+
+ /**
+ * Append a control based on control index
+ */
+ void appendControl( TMPXVideoPlaybackControls controlIndex );
+
+ /**
+ * Set changed volume
+ */
+ void volumeChanged( int volume );
+
+ /**
+ * Set changed duration
+ */
+ void durationChanged( int duration);
+
+ /**
+ * Set changed position
+ */
+ void positionChanged( int position );
+
+ /**
+ * Set changed position
+ */
+ void aspectRatioChanged( int aspectRatio );
+
+ /*
+ * Sets the download size on the progress bar
+ */
+ void setDownloadSize( int size );
+
+ /*
+ * Updates the download ratio on the progress bar
+ */
+ void updateDownloadPosition( int newSize );
+
+ /**
+ * Set changed state on button bar
+ */
+ void updateStateOnButtonBar();
+
+ /**
+ * Check whether this clip is real format or not
+ */
+ bool realFormat( QString filename );
+
+ /**
+ * Check whether this clip is real format or not for streaming/live streaming
+ */
+ bool realFormatForStreaming( const TDesC& des );
+
+ /**
+ * Check whether this clip is real format or not for local/progressive donwload
+ */
+ bool realFormatForLocal();
+
+ /**
+ * Handle errors
+ */
+ void handleErrors();
+
+ /**
+ * Return ETrue if control is visible
+ */
+ bool isSoftKeyVisible( int value );
+
+ /**
+ * Handle tvout connected/disconnected event
+ */
+ void handleTvOutEvent( bool connected,
+ TMPXVideoPlaybackControlCommandIds event,
+ int value );
+
+ HbAction* createAction( QActionGroup *actionsGroup,
+ int index,
+ const char *slot,
+ const QString& toolTip );
+
+ void updateVideoRect( bool transitionEffect = true );
+
+ void showVolumeControls();
+
+ private slots:
+ void hideAllControls();
+ void skipToNextVideoItem();
+ void skipToPreviousVideoItem();
+ void handleTappedOnScreen();
+
+ public:
+ QMPXVideoPlaybackViewFileDetails *mFileDetails;
+
+ QList<QMPXVideoPlaybackFullScreenControl*> mControls;
+
+ QMPXVideoPlaybackControlPolicy *mControlsPolicy;
+ QMPXVideoPlaybackControlConfiguration *mControlsConfig;
+
+ QTimer *mControlsTimer;
+
+ QMPXVideoPlaybackDocumentLoader *mLoader;
+ QMPXVideoPlaybackNonTouchVolumeBar *mVolumeControl;
+
+ bool mFlipViewOpened;
+ bool mViewTransitionIsGoingOn;
+ TMPXPlaybackState mState;
+ TPlaybackViewMode mViewMode;
+
+};
+
+// INLINE METHODS
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::state
+// -------------------------------------------------------------------------------------------------
+//
+inline
+TMPXPlaybackState QMPXVideoPlaybackControlsController::state()
+{
+ return mState;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::fileDetails
+// -------------------------------------------------------------------------------------------------
+//
+inline
+QMPXVideoPlaybackViewFileDetails* QMPXVideoPlaybackControlsController::fileDetails()
+{
+ return mFileDetails;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::isTvOutConnected
+// -------------------------------------------------------------------------------------------------
+//
+inline
+bool QMPXVideoPlaybackControlsController::isTvOutConnected()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::isTvOutConnected(%d)"),
+ mFileDetails->mTvOutConnected);
+
+ return mFileDetails->mTvOutConnected;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::isTvOutPlaybackAllowed
+// -------------------------------------------------------------------------------------------------
+//
+inline
+bool QMPXVideoPlaybackControlsController::isTvOutPlaybackAllowed()
+{
+ bool playable = ( ! mFileDetails->mTvOutConnected || mFileDetails->mTvOutPlayAllowed );
+
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::isTvOutPlaybackAllowed() [%d]"),
+ playable);
+
+ return playable;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::isFlipView
+// -------------------------------------------------------------------------------------------------
+//
+inline
+bool QMPXVideoPlaybackControlsController::isFlipView()
+{
+ return mFlipViewOpened;
+}
+
+
+#endif /*MPXVIDEOPLAYBACKCONTROLSCONTROLLER_P_H_*/
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testcontrolconfiguration/stub/inc/mpxvideoplaybackdocumentloader.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackDocumentLoader
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKDOCUMENTHANDLER_H_
+#define MPXVIDEOPLAYBACKDOCUMENTHANDLER_H_
+
+
+#include <qobject>
+
+class QList;
+class QGraphicsWidget;
+class QMPXVideoPlaybackControlsController;
+
+class QMPXVideoPlaybackDocumentLoader : public QObject
+{
+ public:
+ QMPXVideoPlaybackDocumentLoader();
+
+ virtual ~QMPXVideoPlaybackDocumentLoader();
+
+ public:
+ QGraphicsWidget* findWidget( const QString &name );
+
+ private:
+ QGraphicsWidget* createWidget( const QString &name );
+ int exist( const QString &name );
+
+ private:
+ QList<QGraphicsWidget*> mWidgets;
+};
+
+#endif /*MPXVIDEOPLAYBACKDOCUMENTHANDLER_H_*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testcontrolconfiguration/stub/inc/mpxvideoplaybackviewfiledetails.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* 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: MPX Video File Details (QT)
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+
+#ifndef __MPXVIDEOPLAYBACKVIEWFILEDETAILS__
+#define __MPXVIDEOPLAYBACKVIEWFILEDETAILS__
+
+#include <qobject.h>
+#include "mpxhelixplaybackplugindefs.h"
+
+
+//
+// CLASS DECLARATION
+//
+class QMPXVideoPlaybackViewFileDetails : public QObject
+{
+ public:
+ //
+ // Constructor
+ //
+ QMPXVideoPlaybackViewFileDetails();
+
+ //
+ // Destructor.
+ //
+ virtual ~QMPXVideoPlaybackViewFileDetails();
+
+ //
+ // Clear all file details
+ //
+ void clearFileDetails();
+
+ public:
+ //
+ // Data
+ //
+ QString mClipName;
+ QString mTitle;
+ QString mArtist;
+ QString mMimeType;
+ QString mDescription;
+ QString mLocation;
+ QString mCopyright;
+ QString mLanguage;
+ QString mKeywords;
+
+ TMPXVideoMode mPlaybackMode;
+ bool mSeekable;
+ bool mPausableStream;
+ bool mAudioEnabled;
+ bool mVideoEnabled;
+ bool mPartialPlayback;
+ bool mRNFormat;
+ bool mTvOutConnected;
+ bool mTvOutPlayAllowed;
+ bool mDrmProtected;
+ bool mMultiItemPlaylist;
+
+ int mVideoHeight;
+ int mVideoWidth;
+ int mBitRate;
+ int mDuration;
+};
+
+#endif // __MPXVIDEOPLAYBACKVIEWFILEDETAILS__
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testcontrolconfiguration/stub/src/mpxvideoplaybackcontrolscontroller.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,397 @@
+/*
+* 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: Implementation of MPXVideoPlaybackControlsController
+*
+*/
+
+// Version : %version: 2 %
+
+
+
+// INCLUDE FILES
+
+#include "../inc/mpxvideoplaybackdocumentloader.h"
+#include "../inc/mpxvideoplaybackviewfiledetails.h"
+#include "../inc/mpxvideoplaybackcontrolscontroller.h"
+
+#include "mpxvideoplaybackcontrolconfiguration.h"
+
+
+// ================= MEMBER FUNCTIONS ==============================================================
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::QMPXVideoPlaybackControlsController()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackControlsController::QMPXVideoPlaybackControlsController(
+ QMPXVideoPlaybackViewFileDetails *details )
+ : mFileDetails( details )
+{
+ initializeController();
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::initializeController()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::initializeController()
+{
+ mLoader = new QMPXVideoPlaybackDocumentLoader();
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::addFileDetails()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::addFileDetails(
+ QMPXVideoPlaybackViewFileDetails* details )
+{
+ Q_UNUSED( details );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController"));
+
+ if ( mLoader )
+ {
+ delete mLoader;
+ mLoader = NULL;
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleEvent
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleEvent(
+ TMPXVideoPlaybackControlCommandIds event, int value )
+{
+ switch ( event )
+ {
+ case EMPXControlCmdTvOutConnected:
+ {
+ handleTvOutEvent( true, event, value );
+ break;
+ }
+ case EMPXControlCmdTvOutDisconnected:
+ {
+ handleTvOutEvent( false, event, value );
+ break;
+ }
+ case EMPXControlCmdSetVolume:
+ {
+ mFileDetails->mAudioEnabled = false;
+ break;
+ }
+ case EMPXControlCmdSetDuration:
+ {
+ mFileDetails->mDuration = value;
+ break;
+ }
+ case EMPXControlCmdShowVolumeControls:
+ {
+ mFileDetails->mAudioEnabled = true;
+ break;
+ }
+ case EMPXControlCmdSetPosition:
+ {
+ mFileDetails->mSeekable = true;
+ break;
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleStateChange
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleStateChange( TMPXPlaybackState newState )
+{
+ Q_UNUSED( newState );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::controlsListUpdated()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::controlsListUpdated()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::appendControl()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::appendControl( TMPXVideoPlaybackControls controlIndex )
+{
+ Q_UNUSED( controlIndex );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::resetDisappearingTimers()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::resetDisappearingTimers( TMPXTimerAction timerAction )
+{
+ Q_UNUSED( timerAction );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::hideAllControls()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::hideAllControls()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::showControls()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::showControls()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::isVisible()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackControlsController::isVisible()
+{
+ return false;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleCommand()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleCommand(
+ TMPXVideoPlaybackViewCommandIds command, int value )
+{
+ Q_UNUSED( command );
+ Q_UNUSED( value );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::volumeChanged()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::volumeChanged( int volume )
+{
+ Q_UNUSED( volume );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::showVolumeControls()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::showVolumeControls()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::durationChanged()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::durationChanged( int duration )
+{
+ Q_UNUSED( duration );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::positionChanged()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::positionChanged( int position )
+{
+ Q_UNUSED( position );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::aspectRatioChanged()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::aspectRatioChanged( int aspectRatio )
+{
+ Q_UNUSED( aspectRatio );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::realFormat()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackControlsController::realFormat( QString filename )
+{
+ Q_UNUSED( filename );
+ return false;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::realFormatForStreaming()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackControlsController::realFormatForStreaming( const TDesC& des )
+{
+ Q_UNUSED( des );
+ bool realFormat = false;
+ return realFormat;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::realFormatForLocal()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackControlsController::realFormatForLocal()
+{
+ bool realFormat = false;
+
+ return realFormat;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::setDownloadSize()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::setDownloadSize( int size )
+{
+ Q_UNUSED( size );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::updateDownloadPosition()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::updateDownloadPosition( int size )
+{
+ Q_UNUSED( size );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleErrors
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleErrors()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::isSoftKeyVisible()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackControlsController::isSoftKeyVisible( int /*value*/ )
+{
+ return false;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleTvOutEvent
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleTvOutEvent(
+ bool connected, TMPXVideoPlaybackControlCommandIds event, int value )
+{
+ Q_UNUSED( event );
+ Q_UNUSED( value );
+ mFileDetails->mTvOutConnected = connected;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::updateVideoRectDone
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::updateVideoRectDone()
+{
+ mViewTransitionIsGoingOn = false;
+
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::skipToPreviousVideoItem
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::skipToPreviousVideoItem()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::skipToNextVideoItem
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::skipToNextVideoItem()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::updateVideoRect()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::updateVideoRect( bool transitionEffect )
+{
+ Q_UNUSED( transitionEffect );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleTappedOnScreen()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleTappedOnScreen()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::changeViewMode
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::changeViewMode(
+ TPlaybackViewMode viewMode, bool transitionEffect )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::changeViewMode()"));
+
+ Q_UNUSED( transitionEffect );
+ mViewMode = viewMode;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::layoutLoader
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackDocumentLoader* QMPXVideoPlaybackControlsController::layoutLoader()
+{
+ return mLoader;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::viewMode
+// -------------------------------------------------------------------------------------------------
+//
+TPlaybackViewMode QMPXVideoPlaybackControlsController::viewMode()
+{
+ return mViewMode;
+}
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testcontrolconfiguration/stub/src/mpxvideoplaybackdocumentloader.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,132 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackDocumentLoader
+*
+*/
+
+// Version : %version: 1 %
+
+
+#include <hbwidget.h>
+#include <hbtransparentwindow.h>
+#include <hblabel.h>
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackdocumentloader.h"
+
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::~QMPXVideoPlaybackDocumentLoader
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackDocumentLoader::~QMPXVideoPlaybackDocumentLoader()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader") );
+
+ for ( int i = 0 ; i < mWidgets.count() ; i++ )
+ {
+ mWidgets.removeAt( 0 );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::findWidget()
+// -------------------------------------------------------------------------------------------------
+//
+QGraphicsWidget *QMPXVideoPlaybackDocumentLoader::findWidget( const QString &name )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::findWidget") );
+
+ QGraphicsWidget *object = NULL;
+
+ int index = exist( name );
+
+ if ( index == -1 )
+ {
+ object = createWidget( name );
+ }
+ else
+ {
+ object = mWidgets[ index ];
+ }
+
+ return object;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::createWidget()
+// -------------------------------------------------------------------------------------------------
+//
+QGraphicsWidget *QMPXVideoPlaybackDocumentLoader::createWidget( const QString &name )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::createWidget") );
+
+ QGraphicsWidget *object = NULL;
+
+ if ( name == "transparentWindow" )
+ {
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::creating transparentWindow") );
+
+ object = new HbTransparentWindow();
+ object->setObjectName( name );
+
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::appending to object list") );
+ mWidgets.append( object );
+ }
+ else if ( name == "title" )
+ {
+ object = new HbLabel();
+ object->setObjectName( name );
+ mWidgets.append( object );
+ }
+
+ return object;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::exist()
+// -------------------------------------------------------------------------------------------------
+//
+int QMPXVideoPlaybackDocumentLoader::exist( const QString &name )
+{
+ int i = 0;
+
+ for ( ; i < mWidgets.count() ; i++ )
+ {
+ if( mWidgets[i]->objectName() == name )
+ {
+ break;
+ }
+ }
+
+ if ( i == mWidgets.count() )
+ {
+ i = -1;
+ }
+
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::exist %d"), i );
+
+ return i;
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testcontrolconfiguration/stub/src/mpxvideoplaybackviewfiledetails.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* 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: class for MPX Video File Details (Qt)
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+//
+// INCLUDE FILES
+//
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackviewfiledetails.h"
+
+
+// ============================ MEMBER FUNCTIONS ===================================================
+
+QMPXVideoPlaybackViewFileDetails::QMPXVideoPlaybackViewFileDetails()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackViewFileDetails::QMPXVideoPlaybackViewFileDetails()"));
+
+ clearFileDetails();
+}
+
+QMPXVideoPlaybackViewFileDetails::~QMPXVideoPlaybackViewFileDetails()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackViewFileDetails::~QMPXVideoPlaybackViewFileDetails()"));
+
+ clearFileDetails();
+}
+
+void
+QMPXVideoPlaybackViewFileDetails::clearFileDetails()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackViewFileDetails::ClearFileDetails()"));
+
+ mMimeType = tr("");
+ mTitle = tr("");
+ mArtist = tr("");
+ mClipName = tr("");
+ mDescription = tr("");
+ mLocation = tr("");
+ mCopyright = tr("");
+ mLanguage = tr("");
+ mKeywords = tr("");
+
+ mPlaybackMode = EMPXVideoLocal;
+ mSeekable = false;
+ mPausableStream = false;
+ mAudioEnabled = false;
+ mVideoEnabled = false;
+ mPartialPlayback = false;
+ mRNFormat = false;
+
+ mDuration = 0;
+ mTvOutConnected = false;
+ mTvOutPlayAllowed = true;
+ mDrmProtected = false;
+
+ mVideoHeight = 0;
+ mVideoWidth = 0;
+ mBitRate = 0;
+}
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testcontrolconfiguration/testcontrolconfiguration.pro Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,48 @@
+#
+# 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: Project file for building testcontrolconfiguration
+#
+#
+# Version : %version: 1 %
+
+
+TEMPLATE = app
+TARGET = testcontrolconfiguration
+CONFIG += qtestlib hb qt
+
+DEPENDPATH += . \
+ inc \
+ src
+
+INCLUDEPATH += stub/inc \
+ ../inc \
+ ../../inc \
+ ../../../inc \
+ ../../../../inc \
+ $$MW_LAYER_SYSTEMINCLUDE
+
+DEPENDPATH += stub/inc stub/src inc src
+
+# Input
+HEADERS += ../../../controlinc/mpxvideoplaybackcontrolconfiguration.h \
+ mpxvideoplaybackdocumentloader.h \
+ testcontrolconfiguration.h \
+ mpxvideoplaybackcontrolscontroller.h \
+ mpxvideoplaybackviewfiledetails.h
+
+SOURCES += ../../../controlsrc/mpxvideoplaybackcontrolconfiguration.cpp \
+ mpxvideoplaybackdocumentloader.cpp \
+ testcontrolconfiguration.cpp \
+ mpxvideoplaybackviewfiledetails.cpp \
+ mpxvideoplaybackcontrolscontroller.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testfullscreencontrol/inc/testfullscreencontrol.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,91 @@
+/**
+* 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: test module for QMPXVideoPlaybackFullScreenControl
+*
+*/
+
+#ifndef __TESTFULLSCREENCONTROL_H__
+#define __TESTFULLSCREENCONTROL_H__
+
+
+// INCLUDES
+#include <QtTest/QtTest>
+
+#include "mpxvideoplaybackcontrol.hrh"
+
+
+class QMPXVideoPlaybackViewFileDetails;
+class QMPXVideoPlaybackControlsController;
+class QMPXVideoPlaybackFullScreenControl;
+
+
+
+class TestFullScreenControl : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * will be called before each testfunction is executed.
+ *
+ */
+ void init();
+
+ /**
+ * will be called after every testfunction.
+ *
+ */
+ void cleanup();
+
+ // test functions for the test framework
+
+
+ void setup(TMPXVideoPlaybackControls control);
+
+ void createControl(TMPXVideoPlaybackControls control);
+
+private slots:
+
+ void testControlIndex();
+
+ void testVolumeChanged();
+
+ void testDurationChanged();
+
+ void testPositionChanged();
+
+ void testAspectRatioChanged();
+
+ void testUpdateState();
+
+ void testUpdateControlsWithFileDetails();
+
+ void testUpdateControlProperties();
+
+signals:
+
+ void commandSignal(int);
+
+private:
+ QMPXVideoPlaybackViewFileDetails* mFileDetails;
+ QMPXVideoPlaybackControlsController* mControlsController;
+ QMPXVideoPlaybackFullScreenControl* mFullScreenControl;
+
+};
+
+
+#endif // __TESTFULLSCREENCONTROL_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testfullscreencontrol/src/testfullscreencontrol.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,308 @@
+/**
+* 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: tester for methods in QMPXVideoPlaybackFullScreenControl
+*
+*/
+
+// Version : %version: 1 %
+
+
+#include <hbapplication.h>
+#include <hbinstance.h>
+#include <qdebug>
+
+#include "mpxhelixplaybackplugindefs.h"
+
+#include "testfullscreencontrol.h"
+
+#include "mpxvideoplaybackviewfiledetails.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+#include "mpxvideoplaybackprogressbar.h"
+#include "mpxvideoplaybackbuttonbar.h"
+
+
+#define private public
+#define protected public
+#include "mpxvideoplaybackfullscreencontrol.h"
+#undef protected
+#undef private
+
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ MPX_ENTER_EXIT(_L("TestFullScreenControl::Main()"));
+
+ HbApplication app(argc, argv);
+ HbMainWindow window;
+
+ TestFullScreenControl tv;
+
+ char *pass[3];
+ pass[0] = argv[0];
+ pass[1] = "-o";
+ pass[2] = "c:\\data\\TestFullScreenControl.txt";
+
+ int res = QTest::qExec(&tv, 3, pass);
+
+ return res;
+}
+
+// ---------------------------------------------------------------------------
+// init
+// ---------------------------------------------------------------------------
+//
+void TestFullScreenControl::init()
+{
+ MPX_ENTER_EXIT(_L("TestFullScreenControl::init()"));
+}
+
+// ---------------------------------------------------------------------------
+// setup
+// ---------------------------------------------------------------------------
+//
+void TestFullScreenControl::setup(TMPXVideoPlaybackControls control)
+{
+ MPX_ENTER_EXIT(_L("TestFullScreenControl::setup()"));
+
+ mFileDetails = new QMPXVideoPlaybackViewFileDetails();
+
+ mControlsController = new QMPXVideoPlaybackControlsController( mFileDetails );
+
+ createControl( control );
+}
+
+// ---------------------------------------------------------------------------
+// createControl
+// ---------------------------------------------------------------------------
+//
+void TestFullScreenControl::createControl(TMPXVideoPlaybackControls control)
+{
+ MPX_ENTER_EXIT(_L("TestFullScreenControl::createControl()"));
+
+ switch ( control )
+ {
+ case EMPXStatusPane:
+ {
+ mFullScreenControl = new QMPXVideoPlaybackFullScreenControl( mControlsController,
+ control,
+ NULL,
+ 0 );
+ break;
+ }
+ case EMPXProgressBar:
+ {
+ QMPXVideoPlaybackProgressBar *progressBar =
+ new QMPXVideoPlaybackProgressBar( mControlsController );
+
+ mFullScreenControl = new QMPXVideoPlaybackFullScreenControl( mControlsController,
+ control,
+ progressBar,
+ 0 );
+
+ break;
+ }
+ case EMPXButtonBar:
+ {
+ QMPXVideoPlaybackButtonBar *buttonBar =
+ new QMPXVideoPlaybackButtonBar( mControlsController );
+
+ mFullScreenControl = new QMPXVideoPlaybackFullScreenControl( mControlsController,
+ control,
+ buttonBar,
+ 0 );
+
+ break;
+ }
+ case EMPXDetailsViewPlaybackWindow:
+ {
+ break;
+ }
+ }
+}
+
+// ---------------------------------------------------------------------------
+// cleanup
+// ---------------------------------------------------------------------------
+//
+void TestFullScreenControl::cleanup()
+{
+ MPX_ENTER_EXIT(_L("TestFullScreenControl::cleanup()"));
+
+ if ( mFileDetails )
+ {
+ delete mFileDetails;
+ mFileDetails = NULL;
+ }
+
+ if ( mControlsController )
+ {
+ delete mControlsController;
+ mControlsController = NULL;
+ }
+
+ if ( mFullScreenControl )
+ {
+ delete mFullScreenControl;
+ mFullScreenControl = NULL;
+ }
+}
+
+// ---------------------------------------------------------------------------
+// testControlIndex
+// ---------------------------------------------------------------------------
+//
+void TestFullScreenControl::testControlIndex()
+{
+ MPX_ENTER_EXIT(_L("TestFullScreenControl::testControlIndex()"));
+
+ setup( EMPXStatusPane );
+
+ QVERIFY( mFullScreenControl->controlIndex() == EMPXStatusPane );
+}
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+void TestFullScreenControl::testVolumeChanged()
+{
+ setup( EMPXStatusPane );
+
+ QVERIFY( ! mFullScreenControl->volumeChanged( 50 ) );
+
+}
+
+// ---------------------------------------------------------------------------
+// testDurationChanged
+// ---------------------------------------------------------------------------
+//
+void TestFullScreenControl::testDurationChanged()
+{
+ MPX_ENTER_EXIT(_L("TestFullScreenControl::testDurationChanged()"));
+
+ // test for progress bar
+ delete mFullScreenControl;
+ mFullScreenControl = NULL;
+ setup( EMPXProgressBar );
+ QVERIFY( mFullScreenControl->durationChanged( 100 ) );
+ QVERIFY( static_cast<QMPXVideoPlaybackProgressBar*>(mFullScreenControl->mControl)->mDuration == 100 );
+
+ // test for something other than progress bar
+ delete mFullScreenControl;
+ mFullScreenControl = NULL;
+ setup( EMPXStatusPane );
+ QVERIFY( ! mFullScreenControl->durationChanged( 100 ) );
+
+}
+
+// ---------------------------------------------------------------------------
+// testPositionChanged
+// ---------------------------------------------------------------------------
+//
+void TestFullScreenControl::testPositionChanged()
+{
+ MPX_ENTER_EXIT(_L("TestFullScreenControl::testPositionChanged()"));
+
+ // test for progress bar
+ delete mFullScreenControl;
+ mFullScreenControl = NULL;
+ setup( EMPXProgressBar );
+ QVERIFY( mFullScreenControl->positionChanged( 100 ) );
+ QVERIFY( static_cast<QMPXVideoPlaybackProgressBar*>(mFullScreenControl->mControl)->mPosition == 100 );
+
+ // test for something other than progress bar
+ delete mFullScreenControl;
+ mFullScreenControl = NULL;
+ setup( EMPXStatusPane );
+ QVERIFY( ! mFullScreenControl->positionChanged( 100 ) );
+}
+
+// ---------------------------------------------------------------------------
+// testAspectRatioChanged
+// ---------------------------------------------------------------------------
+//
+void TestFullScreenControl::testAspectRatioChanged()
+{
+ MPX_ENTER_EXIT(_L("TestFullScreenControl::testAspectRatioChanged()"));
+
+ // test for button bar
+ delete mFullScreenControl;
+ mFullScreenControl = NULL;
+ setup( EMPXButtonBar );
+ QVERIFY( mFullScreenControl->aspectRatioChanged( 3 ) ); // EMMFNatural
+ QVERIFY( static_cast<QMPXVideoPlaybackButtonBar*>(mFullScreenControl->mControl)->mAspectRatio == 3 );
+
+ // test for something other than button bar
+ delete mFullScreenControl;
+ mFullScreenControl = NULL;
+ setup( EMPXStatusPane );
+ QVERIFY( ! mFullScreenControl->aspectRatioChanged( 3 ) ); // EMMFNatural
+}
+
+// ---------------------------------------------------------------------------
+// testUpdateState
+// ---------------------------------------------------------------------------
+//
+void TestFullScreenControl::testUpdateState()
+{
+ MPX_ENTER_EXIT(_L("TestFullScreenControl::testUpdateState()"));
+
+ delete mFullScreenControl;
+ mFullScreenControl = NULL;
+ setup( EMPXButtonBar );
+ mFullScreenControl->updateState( EPbStatePaused );
+ QVERIFY( static_cast<QMPXVideoPlaybackButtonBar*>(mFullScreenControl->mControl)->mState == EPbStatePaused );
+}
+
+// ---------------------------------------------------------------------------
+// testUpdateControlsWithFileDetails
+// ---------------------------------------------------------------------------
+//
+void TestFullScreenControl::testUpdateControlsWithFileDetails()
+{
+ MPX_ENTER_EXIT(_L("TestFullScreenControl::testUpdateControlsWithFileDetails()"));
+
+ delete mFullScreenControl;
+ mFullScreenControl = NULL;
+ setup( EMPXButtonBar );
+
+ mFileDetails->mPausableStream = true;
+
+ mFullScreenControl->updateControlsWithFileDetails(mFileDetails);
+
+ QVERIFY( static_cast<QMPXVideoPlaybackButtonBar*>(mFullScreenControl->mControl)->mShowPauseButton );
+}
+
+// ---------------------------------------------------------------------------
+// testUpdateControlProperties
+// ---------------------------------------------------------------------------
+//
+void TestFullScreenControl::testUpdateControlProperties()
+{
+ MPX_ENTER_EXIT(_L("TestFullScreenControl::testUpdateControlProperties()"));
+
+ setup(EMPXStatusPane);
+
+ mFullScreenControl->updateControlProperties( 1 );
+
+ QVERIFY( mFullScreenControl != NULL );
+
+ QVERIFY( mFullScreenControl->mProperties == 1 );
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testfullscreencontrol/stub/inc/mpxvideoplaybackbuttonbar.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackButtonBar
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKBUTTONBAR_H_
+#define MPXVIDEOPLAYBACKBUTTONBAR_H_
+
+#include <hbwidget.h>
+#include <MMFScalingCustomCommandConstants.h>
+#include <mpxplaybackframeworkdefs.h>
+
+
+class QMPXVideoPlaybackViewFileDetails;
+class QMPXVideoPlaybackControlsController;
+
+// DATA TYPES
+enum TMPXButton
+{
+ EMPXButtonRW,
+ EMPXButtonPlay,
+ EMPXButtonPause,
+ EMPXButtonFF,
+ EMPXButtonNatural,
+ EMPXButtonStretch,
+ EMPXButtonZoom,
+ EMPXButtonDetails,
+ EMPXButtonCount // Should always be the last value
+};
+
+
+class QMPXVideoPlaybackButtonBar : public HbWidget
+{
+ Q_OBJECT
+
+ public:
+ QMPXVideoPlaybackButtonBar( QMPXVideoPlaybackControlsController* controller );
+ virtual ~QMPXVideoPlaybackButtonBar();
+
+ void aspectRatioChanged( int aspectRatio );
+
+ void updateWithFileDetails( QMPXVideoPlaybackViewFileDetails* details );
+
+ void updateState( TMPXPlaybackState state );
+
+ public:
+ QMPXVideoPlaybackControlsController *mController;
+ bool mInitialized;
+ int mAspectRatio;
+ TMPXPlaybackState mState;
+ bool mShowPauseButton;
+};
+
+#endif /*MPXVIDEOPLAYBACKBUTTONBAR_H_*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testfullscreencontrol/stub/inc/mpxvideoplaybackcontrolscontroller.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,343 @@
+/*
+* 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: Implementation of MPXVideoPlaybackControlsController
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_
+#define MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_
+
+// INCLUDES
+#include <qobject>
+
+#include <mpxplaybackframeworkdefs.h>
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackcontrol.hrh"
+#include "mpxcommonvideoplaybackview.hrh"
+#include "mpxvideoplaybackviewfiledetails.h"
+
+// FORWARD DECLARATIONS
+class QTimer;
+class QString;
+class HbAction;
+class QActionGroup;
+class QMPXVideoPlaybackControlPolicy;
+class QMPXVideoPlaybackFullScreenControl;
+class QMPXVideoPlaybackNonTouchVolumeBar;
+class QMPXVideoPlaybackControlsController;
+class QMPXVideoPlaybackControlConfiguration;
+
+
+// DATA TYPES
+
+enum TMPXTimerAction
+{
+ EMPXTimerCancel,
+ EMPXTimerReset
+};
+
+enum TPlaybackViewMode
+{
+ EFullScreenView,
+ EDetailsView,
+ EAudioOnlyView
+};
+
+const int KMPXControlsTimeOut = 4000;
+
+
+// CLASS DECLARATION
+
+class QMPXVideoPlaybackControlsController : public QObject
+{
+ Q_OBJECT
+
+ public:
+
+ /**
+ * constructor.
+ */
+ QMPXVideoPlaybackControlsController( QMPXVideoPlaybackViewFileDetails *details );
+
+ /**
+ * Destructor.
+ */
+ virtual ~QMPXVideoPlaybackControlsController();
+
+ public:
+
+ /**
+ * Handle event from container
+ */
+ void handleEvent( TMPXVideoPlaybackControlCommandIds event, int value = 0 );
+
+ /**
+ * Command handling function.
+ * Call HandleCommandL() of container
+ */
+ void handleCommand( TMPXVideoPlaybackViewCommandIds command, int value = 0 );
+
+ /*
+ * Return ETrue if TV-out cable gets connected
+ */
+ inline bool isTvOutConnected();
+
+ /*
+ * Return ETrue if TV-out cable is connected and content can be played
+ */
+ inline bool isTvOutPlaybackAllowed();
+
+ /**
+ * Reset or cancel timers for the controls
+ */
+ void resetDisappearingTimers( TMPXTimerAction timerAction );
+
+ /**
+ * Return state
+ */
+ inline TMPXPlaybackState state();
+
+ /**
+ * Return file details
+ */
+ inline QMPXVideoPlaybackViewFileDetails* fileDetails();
+
+ //
+ // Add the file details to the controls controller when available
+ //
+ void addFileDetails( QMPXVideoPlaybackViewFileDetails* details );
+
+ inline bool isFlipView();
+
+ void updateVideoRectDone();
+
+ void changeViewMode( TPlaybackViewMode viewMode, bool transitionEffect = true );
+
+ TPlaybackViewMode viewMode();
+
+ public:
+ /**
+ * Initialize controller
+ */
+ void initializeController();
+
+ /**
+ * Create controls
+ */
+ void createControls();
+
+ /**
+ * Update controls
+ */
+ void handleStateChange( TMPXPlaybackState newState );
+
+ /**
+ * Update Control's visibility
+ */
+ void updateControlsVisibility();
+
+ /**
+ * Toggle visibility
+ */
+ void toggleVisibility();
+
+ /**
+ * Create/delete controls based on updated control list
+ */
+ void controlsListUpdated();
+
+ /**
+ * Show Controls and reset the timers
+ */
+ void showControls();
+
+ /**
+ * Return ETrue if any control is visible
+ */
+ bool isVisible();
+
+ /**
+ * Append a control based on control index
+ */
+ void appendControl( TMPXVideoPlaybackControls controlIndex );
+
+ /**
+ * Set changed volume
+ */
+ void volumeChanged( int volume );
+
+ /**
+ * Set changed duration
+ */
+ void durationChanged( int duration);
+
+ /**
+ * Set changed position
+ */
+ void positionChanged( int position );
+
+ /**
+ * Set changed position
+ */
+ void aspectRatioChanged( int aspectRatio );
+
+ /*
+ * Sets the download size on the progress bar
+ */
+ void setDownloadSize( int size );
+
+ /*
+ * Updates the download ratio on the progress bar
+ */
+ void updateDownloadPosition( int newSize );
+
+ /**
+ * Set changed state on button bar
+ */
+ void updateStateOnButtonBar();
+
+ /**
+ * Check whether this clip is real format or not
+ */
+ bool realFormat( QString filename );
+
+ /**
+ * Check whether this clip is real format or not for streaming/live streaming
+ */
+ bool realFormatForStreaming( const TDesC& des );
+
+ /**
+ * Check whether this clip is real format or not for local/progressive donwload
+ */
+ bool realFormatForLocal();
+
+ /**
+ * Handle errors
+ */
+ void handleErrors();
+
+ /**
+ * Return ETrue if control is visible
+ */
+ bool isSoftKeyVisible( int value );
+
+ /**
+ * Handle tvout connected/disconnected event
+ */
+ void handleTvOutEvent( bool connected,
+ TMPXVideoPlaybackControlCommandIds event,
+ int value );
+
+ HbAction* createAction( QActionGroup *actionsGroup,
+ int index,
+ const char *slot,
+ const QString& toolTip );
+
+ void updateVideoRect( bool transitionEffect = true );
+
+ void showVolumeControls();
+
+ private slots:
+ void hideAllControls();
+ void skipToNextVideoItem();
+ void skipToPreviousVideoItem();
+ void handleTappedOnScreen();
+
+ public:
+ QMPXVideoPlaybackViewFileDetails *mFileDetails;
+
+ QList<QMPXVideoPlaybackFullScreenControl*> mControls;
+
+ QMPXVideoPlaybackControlPolicy *mControlsPolicy;
+ QMPXVideoPlaybackControlConfiguration *mControlsConfig;
+
+ QTimer *mControlsTimer;
+
+ QMPXVideoPlaybackNonTouchVolumeBar *mVolumeControl;
+
+ bool mFlipViewOpened;
+ bool mViewTransitionIsGoingOn;
+ TMPXPlaybackState mState;
+ TPlaybackViewMode mViewMode;
+
+};
+
+// INLINE METHODS
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::state
+// -------------------------------------------------------------------------------------------------
+//
+inline
+TMPXPlaybackState QMPXVideoPlaybackControlsController::state()
+{
+ return mState;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::fileDetails
+// -------------------------------------------------------------------------------------------------
+//
+inline
+QMPXVideoPlaybackViewFileDetails* QMPXVideoPlaybackControlsController::fileDetails()
+{
+ return mFileDetails;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::isTvOutConnected
+// -------------------------------------------------------------------------------------------------
+//
+inline
+bool QMPXVideoPlaybackControlsController::isTvOutConnected()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::isTvOutConnected(%d)"),
+ mFileDetails->mTvOutConnected);
+
+ return mFileDetails->mTvOutConnected;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::isTvOutPlaybackAllowed
+// -------------------------------------------------------------------------------------------------
+//
+inline
+bool QMPXVideoPlaybackControlsController::isTvOutPlaybackAllowed()
+{
+ bool playable = ( ! mFileDetails->mTvOutConnected || mFileDetails->mTvOutPlayAllowed );
+
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::isTvOutPlaybackAllowed() [%d]"),
+ playable);
+
+ return playable;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::isFlipView
+// -------------------------------------------------------------------------------------------------
+//
+inline
+bool QMPXVideoPlaybackControlsController::isFlipView()
+{
+ return mFlipViewOpened;
+}
+
+
+#endif /*MPXVIDEOPLAYBACKCONTROLSCONTROLLER_P_H_*/
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testfullscreencontrol/stub/inc/mpxvideoplaybackdetailsplaybackwindow.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackDetailsPlaybackWindow
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKDETAILSPLAYBACKWINDOW_H_
+#define MPXVIDEOPLAYBACKDETAILSPLAYBACKWINDOW_H_
+
+#include <hbwidget.h>
+#include <mpxplaybackframeworkdefs.h>
+
+
+class QMPXVideoPlaybackControlsController;
+
+class QMPXVideoPlaybackDetailsPlaybackWindow : public HbWidget
+{
+ Q_OBJECT
+
+ public:
+ QMPXVideoPlaybackDetailsPlaybackWindow( QMPXVideoPlaybackControlsController* controller );
+ virtual ~QMPXVideoPlaybackDetailsPlaybackWindow();
+ void updateState( TMPXPlaybackState state );
+
+ private:
+ QMPXVideoPlaybackControlsController *mController;
+
+ bool mInitialized;
+};
+
+#endif /*MPXVIDEOPLAYBACKDETAILSPLAYBACKWINDOW_H_*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testfullscreencontrol/stub/inc/mpxvideoplaybackfiledetailswidget.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackFileDetailsWidget
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKFILEDETAILSWIDGET_H_
+#define MPXVIDEOPLAYBACKFILEDETAILSWIDGET_H_
+
+#include <hbwidget.h>
+#include <hbstyleloader.h>
+
+class QMPXVideoPlaybackViewFileDetails;
+class QMPXVideoPlaybackControlsController;
+class HbListWidget;
+
+class QMPXVideoPlaybackFileDetailsWidget : public HbWidget
+{
+ Q_OBJECT
+
+ public:
+ QMPXVideoPlaybackFileDetailsWidget( QMPXVideoPlaybackControlsController* controller );
+ virtual ~QMPXVideoPlaybackFileDetailsWidget();
+
+ void updateWithFileDetails( QMPXVideoPlaybackViewFileDetails* details );
+
+ private:
+ QMPXVideoPlaybackControlsController *mController;
+ HbListWidget *mListWidget;
+ bool mFileDetailsUpdated;
+
+};
+
+#endif /*MPXVIDEOPLAYBACKFILEDETAILSWIDGET_H_*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testfullscreencontrol/stub/inc/mpxvideoplaybackprogressbar.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackProgressBar
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKPROGRESSBAR_H_
+#define MPXVIDEOPLAYBACKPROGRESSBAR_H_
+
+#include <hbwidget.h>
+#include <mpxplaybackframeworkdefs.h>
+
+class HbLabel;
+class QPainter;
+class HbProgressBar;
+class QMPXVideoPlaybackViewFileDetails;
+class QMPXVideoPlaybackControlsController;
+
+class QMPXVideoPlaybackProgressBar : public HbWidget
+{
+ Q_OBJECT
+
+ public:
+ QMPXVideoPlaybackProgressBar( QMPXVideoPlaybackControlsController* controller );
+ virtual ~QMPXVideoPlaybackProgressBar();
+
+ void updateWithFileDetails( QMPXVideoPlaybackViewFileDetails* details );
+
+ void durationChanged( int duration );
+ void positionChanged( int position );
+ void updateState( TMPXPlaybackState state );
+
+ public:
+ QMPXVideoPlaybackControlsController *mController;
+ int mDuration;
+ bool mNeedToResumeAfterSetPosition;
+ bool mInitialized;
+ bool mDragging;
+ int mPosition;
+
+};
+
+#endif /*MPXVIDEOPLAYBACKPROGRESSBAR_H_*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testfullscreencontrol/stub/inc/mpxvideoplaybackviewfiledetails.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* 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: MPX Video File Details (QT)
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+
+#ifndef __MPXVIDEOPLAYBACKVIEWFILEDETAILS__
+#define __MPXVIDEOPLAYBACKVIEWFILEDETAILS__
+
+#include <qobject.h>
+#include "mpxhelixplaybackplugindefs.h"
+
+
+//
+// CLASS DECLARATION
+//
+class QMPXVideoPlaybackViewFileDetails : public QObject
+{
+ public:
+ //
+ // Constructor
+ //
+ QMPXVideoPlaybackViewFileDetails();
+
+ //
+ // Destructor.
+ //
+ virtual ~QMPXVideoPlaybackViewFileDetails();
+
+ //
+ // Clear all file details
+ //
+ void clearFileDetails();
+
+ public:
+ //
+ // Data
+ //
+ QString mClipName;
+ QString mTitle;
+ QString mArtist;
+ QString mMimeType;
+ QString mDescription;
+ QString mLocation;
+ QString mCopyright;
+ QString mLanguage;
+ QString mKeywords;
+
+ TMPXVideoMode mPlaybackMode;
+ bool mSeekable;
+ bool mPausableStream;
+ bool mAudioEnabled;
+ bool mVideoEnabled;
+ bool mPartialPlayback;
+ bool mRNFormat;
+ bool mTvOutConnected;
+ bool mTvOutPlayAllowed;
+ bool mDrmProtected;
+ bool mMultiItemPlaylist;
+
+ int mVideoHeight;
+ int mVideoWidth;
+ int mBitRate;
+ int mDuration;
+};
+
+#endif // __MPXVIDEOPLAYBACKVIEWFILEDETAILS__
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testfullscreencontrol/stub/src/hblabel.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,58 @@
+/*
+* 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: Implementation of HbLabel
+*
+*/
+
+// Version : %version: 1 %
+
+
+#include "hblabel.h"
+
+// -------------------------------------------------------------------------------------------------
+// HbPushButton::HbPushButton
+// -------------------------------------------------------------------------------------------------
+//
+HbLabel::HbLabel()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbLabel::~HbLabel
+// -------------------------------------------------------------------------------------------------
+//
+HbLabel::~HbLabel()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbLabel::setVisible
+// -------------------------------------------------------------------------------------------------
+//
+void HbLabel::setVisible( bool visible )
+{
+ mVisible = visible;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbLabel::isVisible
+// -------------------------------------------------------------------------------------------------
+//
+bool HbLabel::isVisible()
+{
+ return mVisible;
+}
+
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testfullscreencontrol/stub/src/mpxvideoplaybackbuttonbar.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,88 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackButtonBar
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#include <hbslider.h>
+#include <hbaction.h>
+#include <hbiconitem.h>
+#include <hbpushbutton.h>
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackbuttonbar.h"
+#include "mpxcommonvideoplaybackview.hrh"
+#include "mpxvideoplaybackcontrolscontroller.h"
+
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackButtonBar::QMPXVideoPlaybackButtonBar()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackButtonBar::QMPXVideoPlaybackButtonBar(
+ QMPXVideoPlaybackControlsController* controller )
+ : mController( controller )
+ , mInitialized( false )
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackButtonBar::QMPXVideoPlaybackButtonBar"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackButtonBar::~QMPXVideoPlaybackButtonBar()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackButtonBar::~QMPXVideoPlaybackButtonBar()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::~QMPXVideoPlaybackButtonBar()"));
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackButtonBar::updateState()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackButtonBar::updateState( TMPXPlaybackState state )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::updateState() state = %d"), state );
+ mState = state;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackButtonBar::aspectRatioChanged()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackButtonBar::aspectRatioChanged( int aspectRatio )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::aspectRatioChanged() aspectRatio = %d"), aspectRatio );
+
+ mAspectRatio = aspectRatio;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackButtonBar::updateWithFileDetails()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackButtonBar::updateWithFileDetails(
+ QMPXVideoPlaybackViewFileDetails* details )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::updateWithFileDetails()"));
+
+ mShowPauseButton = details->mPausableStream;
+}
+
+//End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testfullscreencontrol/stub/src/mpxvideoplaybackcontrolscontroller.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,391 @@
+/*
+* 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: Implementation of MPXVideoPlaybackControlsController
+*
+*/
+
+// Version : %version: 2 %
+
+
+
+// INCLUDE FILES
+#include <coecntrl.h>
+#include <bautils.h>
+#include <barsread.h>
+#include <stringloader.h>
+#include <f32file.h>
+
+#include <qtimer>
+
+#include <hblabel.h>
+#include <hbaction.h>
+#include <hbiconanimator.h>
+
+#include "../inc/mpxvideoplaybackviewfiledetails.h"
+#include "../inc/mpxvideoplaybackcontrolscontroller.h"
+
+#include "mpxvideoplaybackcontrolconfiguration.h"
+
+
+// ================= MEMBER FUNCTIONS ==============================================================
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::QMPXVideoPlaybackControlsController()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackControlsController::QMPXVideoPlaybackControlsController(
+ QMPXVideoPlaybackViewFileDetails *details )
+ : mFileDetails( details )
+{
+ initializeController();
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::initializeController()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::initializeController()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::addFileDetails()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::addFileDetails(
+ QMPXVideoPlaybackViewFileDetails* details )
+{
+ Q_UNUSED( details );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleEvent
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleEvent(
+ TMPXVideoPlaybackControlCommandIds event, int value )
+{
+ switch ( event )
+ {
+ case EMPXControlCmdTvOutConnected:
+ {
+ handleTvOutEvent( true, event, value );
+ break;
+ }
+ case EMPXControlCmdTvOutDisconnected:
+ {
+ handleTvOutEvent( false, event, value );
+ break;
+ }
+ case EMPXControlCmdSetVolume:
+ {
+ mFileDetails->mAudioEnabled = false;
+ break;
+ }
+ case EMPXControlCmdSetDuration:
+ {
+ mFileDetails->mDuration = value;
+ break;
+ }
+ case EMPXControlCmdShowVolumeControls:
+ {
+ mFileDetails->mAudioEnabled = true;
+ break;
+ }
+ case EMPXControlCmdSetPosition:
+ {
+ mFileDetails->mSeekable = true;
+ break;
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleStateChange
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleStateChange( TMPXPlaybackState newState )
+{
+ Q_UNUSED( newState );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::controlsListUpdated()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::controlsListUpdated()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::appendControl()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::appendControl( TMPXVideoPlaybackControls controlIndex )
+{
+ Q_UNUSED( controlIndex );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::resetDisappearingTimers()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::resetDisappearingTimers( TMPXTimerAction timerAction )
+{
+ Q_UNUSED( timerAction );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::hideAllControls()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::hideAllControls()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::showControls()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::showControls()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::isVisible()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackControlsController::isVisible()
+{
+ return false;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleCommand()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleCommand(
+ TMPXVideoPlaybackViewCommandIds command, int value )
+{
+ Q_UNUSED( command );
+ Q_UNUSED( value );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::volumeChanged()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::volumeChanged( int volume )
+{
+ Q_UNUSED( volume );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::showVolumeControls()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::showVolumeControls()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::durationChanged()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::durationChanged( int duration )
+{
+ Q_UNUSED( duration );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::positionChanged()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::positionChanged( int position )
+{
+ Q_UNUSED( position );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::aspectRatioChanged()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::aspectRatioChanged( int aspectRatio )
+{
+ Q_UNUSED( aspectRatio );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::realFormat()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackControlsController::realFormat( QString filename )
+{
+ Q_UNUSED( filename );
+ return false;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::realFormatForStreaming()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackControlsController::realFormatForStreaming( const TDesC& des )
+{
+ Q_UNUSED( des );
+ bool realFormat = false;
+ return realFormat;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::realFormatForLocal()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackControlsController::realFormatForLocal()
+{
+ bool realFormat = false;
+
+ return realFormat;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::setDownloadSize()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::setDownloadSize( int size )
+{
+ Q_UNUSED( size );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::updateDownloadPosition()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::updateDownloadPosition( int size )
+{
+ Q_UNUSED( size );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleErrors
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleErrors()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::isSoftKeyVisible()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackControlsController::isSoftKeyVisible( int /*value*/ )
+{
+ return false;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleTvOutEvent
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleTvOutEvent(
+ bool connected, TMPXVideoPlaybackControlCommandIds event, int value )
+{
+ Q_UNUSED( event );
+ Q_UNUSED( value );
+ mFileDetails->mTvOutConnected = connected;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::updateVideoRectDone
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::updateVideoRectDone()
+{
+ mViewTransitionIsGoingOn = false;
+
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::skipToPreviousVideoItem
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::skipToPreviousVideoItem()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::skipToNextVideoItem
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::skipToNextVideoItem()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::updateVideoRect()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::updateVideoRect( bool transitionEffect )
+{
+ Q_UNUSED( transitionEffect );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleTappedOnScreen()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleTappedOnScreen()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::changeViewMode
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::changeViewMode(
+ TPlaybackViewMode viewMode, bool transitionEffect )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::changeViewMode()"));
+ Q_UNUSED( transitionEffect );
+
+ mViewMode = viewMode;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::viewMode
+// -------------------------------------------------------------------------------------------------
+//
+TPlaybackViewMode QMPXVideoPlaybackControlsController::viewMode()
+{
+ return mViewMode;
+}
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testfullscreencontrol/stub/src/mpxvideoplaybackdetailsplaybackwindow.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackProgressBar
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#include <qfileinfo>
+#include <qgraphicsscenemouseevent>
+
+#include <hblabel.h>
+#include <hbpushbutton.h>
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+#include "mpxvideoplaybackdetailsplaybackwindow.h"
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDetailsPlaybackWindow::QMPXVideoPlaybackDetailsPlaybackWindow
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackDetailsPlaybackWindow::QMPXVideoPlaybackDetailsPlaybackWindow(
+ QMPXVideoPlaybackControlsController* controller )
+ : mController( controller )
+ , mInitialized( false )
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackDetailsPlaybackWindow::QMPXVideoPlaybackDetailsPlaybackWindow()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDetailsPlaybackWindow::~QMPXVideoPlaybackDetailsPlaybackWindow
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackDetailsPlaybackWindow::~QMPXVideoPlaybackDetailsPlaybackWindow()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackDetailsPlaybackWindow::~QMPXVideoPlaybackDetailsPlaybackWindow()"));
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDetailsPlaybackWindow::updateState()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackDetailsPlaybackWindow::updateState( TMPXPlaybackState state )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackDetailsPlaybackWindow::updateState() state = %d"), state );
+}
+
+//End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testfullscreencontrol/stub/src/mpxvideoplaybackfiledetailswidget.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,72 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackFileDetailsWidget
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#include <qfileinfo>
+#include <qgraphicslinearlayout>
+#include <qdatetime>
+#include <qdir>
+
+#include <hblistwidgetitem.h>
+#include <hbratingslider.h>
+#include <hblistwidget.h>
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackfiledetailswidget.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+
+const float KILOBYTE = 1024 ;
+const QString KDATETIMEFORMAT = "d/M/yyyy hh:mm:ss ap";
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFileDetailsWidget::QMPXVideoPlaybackFileDetailsWidget
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackFileDetailsWidget::QMPXVideoPlaybackFileDetailsWidget(
+ QMPXVideoPlaybackControlsController* controller )
+ : mController( controller )
+ , mListWidget( 0 )
+ , mFileDetailsUpdated( false )
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackFileDetailsWidget::QMPXVideoPlaybackFileDetailsWidget()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFileDetailsWidget::~QMPXVideoPlaybackFileDetailsWidget
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackFileDetailsWidget::~QMPXVideoPlaybackFileDetailsWidget()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackFileDetailsWidget::~QMPXVideoPlaybackFileDetailsWidget()"));
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFileDetailsWidget::updateControlsWithFileDetails
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackFileDetailsWidget::updateWithFileDetails(
+ QMPXVideoPlaybackViewFileDetails* details )
+{
+
+}
+
+
+//End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testfullscreencontrol/stub/src/mpxvideoplaybackprogressbar.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,97 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackProgressBar
+*
+*/
+
+// Version : %version: 2 %
+
+
+
+
+#include <qtime>
+#include <qgraphicsscenemouseevent>
+
+#include <hblabel.h>
+#include <hbprogressbar.h>
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackprogressbar.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackProgressBar::QMPXVideoPlaybackProgressBar
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackProgressBar::QMPXVideoPlaybackProgressBar(
+ QMPXVideoPlaybackControlsController* controller )
+ : mController( controller )
+ , mDuration( -1 )
+ , mNeedToResumeAfterSetPosition( false )
+ , mInitialized( false )
+ , mDragging( false )
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackProgressBar::QMPXVideoPlaybackProgressBar()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackProgressBar::~QMPXVideoPlaybackProgressBar
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackProgressBar::~QMPXVideoPlaybackProgressBar()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackProgressBar::~QMPXVideoPlaybackProgressBar()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackProgressBar::durationChanged
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackProgressBar::durationChanged( int duration )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::durationChanged duration = %d"), duration );
+ mDuration = duration;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackProgressBar::positionChanged
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackProgressBar::positionChanged( int position )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::positionChanged position = %d"), position );
+ mPosition = position;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackProgressBar::updateWithFileDetails()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackProgressBar::updateWithFileDetails(
+ QMPXVideoPlaybackViewFileDetails* details )
+{
+ Q_UNUSED( details );
+ MPX_DEBUG(_L("QMPXVideoPlaybackProgressBar::updateControlsWithFileDetails()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackProgressBar::updateState()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackProgressBar::updateState( TMPXPlaybackState state )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackProgressBar::updateState() state = %d"), state );
+}
+
+//End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testfullscreencontrol/stub/src/mpxvideoplaybackviewfiledetails.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* 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: class for MPX Video File Details (Qt)
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+//
+// INCLUDE FILES
+//
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackviewfiledetails.h"
+
+
+// ============================ MEMBER FUNCTIONS ===================================================
+
+QMPXVideoPlaybackViewFileDetails::QMPXVideoPlaybackViewFileDetails()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackViewFileDetails::QMPXVideoPlaybackViewFileDetails()"));
+
+ clearFileDetails();
+}
+
+QMPXVideoPlaybackViewFileDetails::~QMPXVideoPlaybackViewFileDetails()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackViewFileDetails::~QMPXVideoPlaybackViewFileDetails()"));
+
+ clearFileDetails();
+}
+
+void
+QMPXVideoPlaybackViewFileDetails::clearFileDetails()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackViewFileDetails::ClearFileDetails()"));
+
+ mMimeType = tr("");
+ mTitle = tr("");
+ mArtist = tr("");
+ mClipName = tr("");
+ mDescription = tr("");
+ mLocation = tr("");
+ mCopyright = tr("");
+ mLanguage = tr("");
+ mKeywords = tr("");
+
+ mPlaybackMode = EMPXVideoLocal;
+ mSeekable = false;
+ mPausableStream = false;
+ mAudioEnabled = false;
+ mVideoEnabled = false;
+ mPartialPlayback = false;
+ mRNFormat = false;
+
+ mDuration = 0;
+ mTvOutConnected = false;
+ mTvOutPlayAllowed = true;
+ mDrmProtected = false;
+
+ mVideoHeight = 0;
+ mVideoWidth = 0;
+ mBitRate = 0;
+}
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testfullscreencontrol/testfullscreencontrol.pro Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,57 @@
+#
+# 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: Project file for building testfullscreencontrol
+#
+#
+# Version : %version: 1 %
+
+
+TEMPLATE = app
+TARGET = testfullscreencontrol
+CONFIG += qtestlib hb qt
+
+DEPENDPATH += . \
+ inc \
+ src
+
+INCLUDEPATH += stub/inc \
+ ../inc \
+ ../../inc \
+ ../../../inc \
+ ../../../../inc \
+ /epoc32/include/platform/mw \
+
+DEPENDPATH += stub/inc stub/src inc src
+
+# Input
+HEADERS += ../../../controlinc/mpxvideoplaybackfullscreencontrol.h \
+ inc/testfullscreencontrol.h \
+ mpxvideoplaybackcontrolscontroller.h \
+ mpxvideoplaybackviewfiledetails.h \
+ mpxvideoplaybackprogressbar.h \
+ mpxvideoplaybackbuttonbar.h \
+ mpxvideoplaybackfiledetailswidget.h \
+ mpxvideoplaybackdetailsplaybackwindow.h
+
+
+SOURCES += ../../../controlsrc/mpxvideoplaybackfullscreencontrol.cpp \
+ src/testfullscreencontrol.cpp \
+ mpxvideoplaybackcontrolscontroller.cpp \
+ mpxvideoplaybackviewfiledetails.cpp \
+ mpxvideoplaybackprogressbar.cpp \
+ mpxvideoplaybackbuttonbar.cpp \
+ mpxvideoplaybackfiledetailswidget.cpp \
+ mpxvideoplaybackdetailsplaybackwindow.cpp
+
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackbuttonbar/inc/testmpxvideoplaybackbuttonbar.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,79 @@
+/**
+* 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: tester for methods in TestMPXVideoPlaybackButtonBar
+*
+*/
+
+// Version : %version: 1 %
+
+#ifndef __TESTMPXVIDEOPLAYBACKBUTTONBAR_H__
+#define __TESTMPXVIDEOPLAYBACKBUTTONBAR_H__
+
+
+// INCLUDES
+#include <QtTest/QtTest>
+
+class QMPXVideoPlaybackButtonBar;
+class QMPXVideoPlaybackControlsController;
+
+class TestMPXVideoPlaybackButtonBar : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * will be called before each testfunction is executed.
+ *
+ */
+ void init();
+
+ /**
+ * will be called after every testfunction.
+ *
+ */
+ void cleanup();
+
+ // test functions for the test framework
+private slots:
+
+ // the order in which these testXX methods are declared is important
+ // changing this order will affect the test results
+ void testPlay();
+ void testStartFFSeeking();
+ void testStartRWSeeking();
+ void testEndSeeking();
+ void testPause();
+ void testChangeAspectRatio();
+ void testUpdateState();
+ void testAspectRatioChanged();
+ void testHandleButtonPressed();
+ void testUpdateWithFileDetails();
+ void testOpenDetailsView();
+
+signals:
+ void commandSignal(int);
+
+private:
+ QMPXVideoPlaybackButtonBar* mButtonBar;
+ QMPXVideoPlaybackControlsController* mController;
+};
+
+
+#endif // __TESTMPXVIDEOPLAYBACKBUTTONBAR_H__
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackbuttonbar/src/testmpxvideoplaybackbuttonbar.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,405 @@
+/**
+* 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: tester for methods in TestMPXVideoPlaybackButtonBar
+*
+*/
+
+// Version : %version: 1 %
+
+
+#include <qdebug>
+#include <hbmainwindow.h>
+#include <hbapplication.h>
+
+#include "testmpxvideoplaybackbuttonbar.h"
+#include "mpxvideoplaybackviewfiledetails.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+#include "hbpushbutton.h"
+
+#define private public
+#include "mpxvideoplaybackbuttonbar.h"
+#undef private
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackButtonBar::Main()"));
+
+ HbApplication app(argc, argv);
+ HbMainWindow window;
+
+ TestMPXVideoPlaybackButtonBar tv;
+
+ char *pass[3];
+ pass[0] = argv[0];
+ pass[1] = "-o";
+ pass[2] = "c:\\data\\testmpxvideoplaybackbuttonbar.txt";
+
+ int res = QTest::qExec(&tv, 3, pass);
+
+ return res;
+}
+
+
+// ---------------------------------------------------------------------------
+// init
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackButtonBar::init()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackButtonBar::init()"));
+
+ mController = new QMPXVideoPlaybackControlsController();
+ mButtonBar = new QMPXVideoPlaybackButtonBar( mController );
+
+ mButtonBar->initialize();
+}
+
+// ---------------------------------------------------------------------------
+// cleanup
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackButtonBar::cleanup()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackButtonBar::cleanup()"));
+
+ if ( mController )
+ {
+ delete mController;
+ mController = NULL;
+ }
+
+ if ( mButtonBar )
+ {
+ delete mButtonBar;
+ mButtonBar = NULL;
+ }
+}
+
+// ---------------------------------------------------------------------------
+// testPlay
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackButtonBar::testPlay()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackButtonBar::testPlay()"));
+
+ init();
+
+ mButtonBar->mButtons[EMPXButtonPlay]->release();
+
+ QVERIFY( mController->mTimerAction == EMPXTimerReset );
+ QVERIFY( mController->mCommand == EMPXPbvCmdPlay );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testStartFFSeeking
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackButtonBar::testStartFFSeeking()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackButtonBar::testStartFFSeeking()"));
+
+ init();
+
+ mButtonBar->mButtons[EMPXButtonFF]->press();
+
+ QVERIFY( mButtonBar->mButtons[EMPXButtonFF]->mSelected == true );
+ QVERIFY( mController->mTimerAction == EMPXTimerCancel );
+ QVERIFY( mController->mCommand == EMPXPbvCmdSeekForward );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testStartRWSeeking
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackButtonBar::testStartRWSeeking()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackButtonBar::testStartRWSeeking()"));
+
+ init();
+
+ mButtonBar->mButtons[EMPXButtonRW]->press();
+
+ QVERIFY( mButtonBar->mButtons[EMPXButtonRW]->mSelected == true );
+ QVERIFY( mController->mTimerAction == EMPXTimerCancel );
+ QVERIFY( mController->mCommand == EMPXPbvCmdSeekBackward );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testEndSeeking
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackButtonBar::testEndSeeking()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackButtonBar::testEndSeeking()"));
+
+ init();
+
+ mButtonBar->mButtons[EMPXButtonRW]->release();
+
+ QVERIFY( mButtonBar->mButtons[EMPXButtonFF]->mSelected == false );
+ QVERIFY( mButtonBar->mButtons[EMPXButtonRW]->mSelected == false );
+ QVERIFY( mController->mTimerAction == EMPXTimerReset );
+ QVERIFY( mController->mCommand == EMPXPbvCmdEndSeek );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testPause
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackButtonBar::testPause()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackButtonBar::testPause()"));
+
+ init();
+
+ mButtonBar->mButtons[EMPXButtonPause]->release();
+
+ QVERIFY( mController->mTimerAction == EMPXTimerReset );
+ QVERIFY( mController->mCommand == EMPXPbvCmdPause );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testChangeAspectRatio
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackButtonBar::testChangeAspectRatio()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackButtonBar::testChangeAspectRatio()"));
+
+ init();
+
+ //
+ // Test natural
+ //
+ mButtonBar->mButtons[EMPXButtonNatural]->setVisible( true );
+ mButtonBar->mButtons[EMPXButtonStretch]->setVisible( false );
+ mButtonBar->mButtons[EMPXButtonZoom]->setVisible( false );
+ mButtonBar->mButtons[EMPXButtonNatural]->release();
+
+ QVERIFY( mController->mTimerAction == EMPXTimerReset );
+ QVERIFY( mController->mCommand == EMPXPbvCmdNaturalAspectRatio );
+
+ //
+ // Test stretch
+ //
+ mButtonBar->mButtons[EMPXButtonNatural]->setVisible( false );
+ mButtonBar->mButtons[EMPXButtonStretch]->setVisible( true );
+ mButtonBar->mButtons[EMPXButtonZoom]->setVisible( false );
+ mButtonBar->mButtons[EMPXButtonStretch]->release();
+
+ QVERIFY( mController->mTimerAction == EMPXTimerReset );
+ QVERIFY( mController->mCommand == EMPXPbvCmdStretchAspectRatio );
+
+ //
+ // Test stretch
+ //
+ mButtonBar->mButtons[EMPXButtonNatural]->setVisible( false );
+ mButtonBar->mButtons[EMPXButtonStretch]->setVisible( false );
+ mButtonBar->mButtons[EMPXButtonZoom]->setVisible( true );
+ mButtonBar->mButtons[EMPXButtonZoom]->release();
+
+ QVERIFY( mController->mTimerAction == EMPXTimerReset );
+ QVERIFY( mController->mCommand == EMPXPbvCmdZoomAspectRatio );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testUpdateState
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackButtonBar::testUpdateState()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackButtonBar::testUpdateState()"));
+
+ init();
+
+ //
+ // Playing
+ //
+ TMPXPlaybackState state = EPbStatePlaying;
+ mButtonBar->updateState( state );
+
+ QVERIFY( mButtonBar->mButtons[EMPXButtonPlay]->mVisible == false );
+ QVERIFY( mButtonBar->mButtons[EMPXButtonPause]->mVisible == true );
+
+ //
+ // Paused
+ //
+ state = EPbStatePaused;
+ mButtonBar->updateState( state );
+
+ QVERIFY( mButtonBar->mButtons[EMPXButtonPlay]->mVisible == true );
+ QVERIFY( mButtonBar->mButtons[EMPXButtonPause]->mVisible == false );
+
+ //
+ // Not initialized
+ //
+ state = EPbStateNotInitialised;
+ mButtonBar->updateState( state );
+
+ QVERIFY( mButtonBar->isEnabled() == false );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testAspectRatioChanged
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackButtonBar::testAspectRatioChanged()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackButtonBar::testAspectRatioChanged()"));
+
+ init();
+
+ //
+ // Natural
+ //
+ int aspectRatio = EMMFNatural;
+ mButtonBar->aspectRatioChanged( aspectRatio );
+ QVERIFY( mButtonBar->mButtons[EMPXButtonNatural]->mVisible == false );
+ QVERIFY( mButtonBar->mButtons[EMPXButtonStretch]->mVisible == true );
+ QVERIFY( mButtonBar->mButtons[EMPXButtonZoom]->mVisible == false );
+
+ //
+ // Stretch
+ //
+ aspectRatio = EMMFStretch;
+ mButtonBar->aspectRatioChanged( aspectRatio );
+ QVERIFY( mButtonBar->mButtons[EMPXButtonNatural]->mVisible == false );
+ QVERIFY( mButtonBar->mButtons[EMPXButtonStretch]->mVisible == false );
+ QVERIFY( mButtonBar->mButtons[EMPXButtonZoom]->mVisible == true );
+
+ //
+ // Zoom
+ //
+ aspectRatio = EMMFZoom;
+ mButtonBar->aspectRatioChanged( aspectRatio );
+ QVERIFY( mButtonBar->mButtons[EMPXButtonNatural]->mVisible == true );
+ QVERIFY( mButtonBar->mButtons[EMPXButtonStretch]->mVisible == false );
+ QVERIFY( mButtonBar->mButtons[EMPXButtonZoom]->mVisible == false );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testHandleButtonPressed
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackButtonBar::testHandleButtonPressed()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackButtonBar::testHandleButtonPressed()"));
+
+ init();
+
+ mButtonBar->mButtons[EMPXButtonNatural]->press();
+
+ QVERIFY( mController->mTimerAction == EMPXTimerCancel );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testUpdateWithFileDetails
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackButtonBar::testUpdateWithFileDetails()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackButtonBar::testUpdateWithFileDetails()"));
+
+ init();
+
+ QMPXVideoPlaybackViewFileDetails *details = mController->fileDetails();
+
+ details->mVideoEnabled = true;
+ details->mVideoHeight = 1;
+ details->mVideoWidth = 1;
+ details->mTvOutConnected = false;
+ details->mTvOutPlayAllowed = true;
+ details->mSeekable = true;
+ details->mPausableStream = true;
+
+ mButtonBar->updateWithFileDetails( details );
+ QVERIFY( mButtonBar->mButtons[EMPXButtonNatural]->mEnabled == true );
+ QVERIFY( mButtonBar->mButtons[EMPXButtonStretch]->mEnabled == true );
+ QVERIFY( mButtonBar->mButtons[EMPXButtonZoom]->mEnabled == true );
+ QVERIFY( mButtonBar->mButtons[EMPXButtonRW]->mEnabled == true );
+ QVERIFY( mButtonBar->mButtons[EMPXButtonPause]->mEnabled == true );
+ QVERIFY( mButtonBar->mButtons[EMPXButtonPlay]->mEnabled == true );
+ QVERIFY( mButtonBar->mButtons[EMPXButtonDetails]->mEnabled == true );
+
+ details->mVideoEnabled = false;
+ details->mVideoHeight = 0;
+ details->mVideoWidth = 1;
+ details->mTvOutConnected = true;
+ details->mTvOutPlayAllowed = true;
+ details->mSeekable = false;
+ details->mPausableStream = false;
+
+ mButtonBar->updateWithFileDetails( details );
+ QVERIFY( mButtonBar->mButtons[EMPXButtonNatural]->mEnabled == false );
+ QVERIFY( mButtonBar->mButtons[EMPXButtonStretch]->mEnabled == false );
+ QVERIFY( mButtonBar->mButtons[EMPXButtonZoom]->mEnabled == false );
+ QVERIFY( mButtonBar->mButtons[EMPXButtonRW]->mEnabled == false );
+ QVERIFY( mButtonBar->mButtons[EMPXButtonPause]->mEnabled == false );
+ QVERIFY( mButtonBar->mButtons[EMPXButtonPlay]->mEnabled == true );
+ QVERIFY( mButtonBar->mButtons[EMPXButtonDetails]->mEnabled == false );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testOpenDetailsView
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackButtonBar::testOpenDetailsView()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackButtonBar::testOpenDetailsView()"));
+
+ init();
+
+ QSignalSpy spy( mButtonBar, SIGNAL( openDetailsView() ) );
+
+ mController->mViewMode = EFullScreenView;
+ mButtonBar->mButtons[EMPXButtonDetails]->release();
+ QVERIFY( mController->mViewMode == EDetailsView );
+
+ mController->mViewMode = EDetailsView;
+ mButtonBar->mButtons[EMPXButtonDetails]->release();
+ QVERIFY( mController->mViewMode == EDetailsView );
+
+ mController->mViewMode = EAudioOnlyView;
+ mButtonBar->mButtons[EMPXButtonDetails]->release();
+ QVERIFY( mController->mViewMode == EAudioOnlyView );
+
+ cleanup();
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackbuttonbar/stub/inc/hbpushbutton.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,62 @@
+/*
+* 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: Implementation of HbPushButton
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef HBPUSHBUTTON_H_
+#define HBPUSHBUTTON_H
+
+#include <hbwidget.h>
+#include <hbstyle.h>
+
+class QGraphicsItem;
+
+class HbPushButton : public HbWidget
+{
+ Q_OBJECT
+
+ public:
+ HbPushButton();
+ virtual ~HbPushButton();
+
+ public:
+ void setEnabled( bool enabled );
+ void setVisible( bool visible );
+ void setSelected( bool selected );
+ bool isEnabled();
+ bool isVisible();
+ bool isSelected();
+ QGraphicsItem* primitive( HbStyle::Primitive primitive ) const;
+ void press();
+ void release();
+
+ signals:
+ void pressed();
+ void released();
+
+ public:
+ bool mVisible;
+ bool mEnabled;
+ bool mSelected;
+
+ QGraphicsItem *mBackground;
+};
+
+#endif /*HBPUSHBUTTON_H*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackbuttonbar/stub/inc/mpxvideoplaybackcontrolscontroller.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,153 @@
+/*
+* 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: Implementation of MPXVideoPlaybackControlsController
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_
+#define MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_
+
+// INCLUDES
+#include <qobject>
+#include <mpxplaybackframeworkdefs.h>
+
+#include "mpxvideo_debug.h"
+#include "mpxcommonvideoplaybackview.hrh"
+#include "mpxvideoplaybackviewfiledetails.h"
+
+// FORWARD DECLARATIONS
+class QMPXVideoPlaybackDocumentLoader;
+
+
+// DATA TYPES
+
+enum TMPXTimerAction
+{
+ EMPXTimerCancel,
+ EMPXTimerReset
+};
+
+enum TPlaybackViewMode
+{
+ EFullScreenView,
+ EDetailsView,
+ EAudioOnlyView
+};
+
+// CLASS DECLARATION
+
+class QMPXVideoPlaybackControlsController : public QObject
+{
+ Q_OBJECT
+
+ public:
+
+ /**
+ * constructor.
+ */
+ QMPXVideoPlaybackControlsController();
+
+ /**
+ * Destructor.
+ */
+ virtual ~QMPXVideoPlaybackControlsController();
+
+ public:
+
+ /**
+ * Command handling function.
+ * Call HandleCommandL() of container
+ */
+ void handleCommand( TMPXVideoPlaybackViewCommandIds command, int value = 0 );
+
+ /**
+ * Reset or cancel timers for the controls
+ */
+ void resetDisappearingTimers( TMPXTimerAction timerAction );
+
+ /**
+ * Return state
+ */
+ inline TMPXPlaybackState state();
+
+ /**
+ * Return file details
+ */
+ inline QMPXVideoPlaybackViewFileDetails* fileDetails();
+
+ inline QMPXVideoPlaybackDocumentLoader* layoutLoader();
+
+ TPlaybackViewMode viewMode();
+
+ void changeViewMode( TPlaybackViewMode viewMode, bool transitionEffect = true );
+
+ public:
+ QMPXVideoPlaybackViewFileDetails *mFileDetails;
+ QMPXVideoPlaybackDocumentLoader *mLoader;
+
+ TMPXPlaybackState mState;
+ TPlaybackViewMode mViewMode;
+ TMPXTimerAction mTimerAction;
+ TMPXVideoPlaybackViewCommandIds mCommand;
+ int mCommandValue;
+};
+
+// INLINE METHODS
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::state
+// -------------------------------------------------------------------------------------------------
+//
+inline
+TMPXPlaybackState QMPXVideoPlaybackControlsController::state()
+{
+ return mState;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::fileDetails
+// -------------------------------------------------------------------------------------------------
+//
+inline
+QMPXVideoPlaybackViewFileDetails* QMPXVideoPlaybackControlsController::fileDetails()
+{
+ return mFileDetails;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::layoutLoader
+// -------------------------------------------------------------------------------------------------
+//
+inline
+QMPXVideoPlaybackDocumentLoader* QMPXVideoPlaybackControlsController::layoutLoader()
+{
+ return mLoader;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::viewMode
+// -------------------------------------------------------------------------------------------------
+//
+inline
+TPlaybackViewMode QMPXVideoPlaybackControlsController::viewMode()
+{
+ return mViewMode;
+}
+
+#endif /*MPXVIDEOPLAYBACKCONTROLSCONTROLLER_P_H_*/
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackbuttonbar/stub/inc/mpxvideoplaybackdocumentloader.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackDocumentLoader
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKDOCUMENTHANDLER_H_
+#define MPXVIDEOPLAYBACKDOCUMENTHANDLER_H_
+
+
+#include <qobject>
+
+class QList;
+class QGraphicsWidget;
+class QMPXVideoPlaybackControlsController;
+
+class QMPXVideoPlaybackDocumentLoader : public QObject
+{
+ public:
+ QMPXVideoPlaybackDocumentLoader();
+
+ virtual ~QMPXVideoPlaybackDocumentLoader();
+
+ public:
+ QGraphicsWidget* findWidget( const QString &name );
+
+ private:
+ QGraphicsWidget* createWidget( const QString &name );
+ int exist( const QString &name );
+
+ private:
+ QList<QGraphicsWidget*> mWidgets;
+};
+
+#endif /*MPXVIDEOPLAYBACKDOCUMENTHANDLER_H_*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackbuttonbar/stub/inc/mpxvideoplaybackviewfiledetails.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* 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: MPX Video File Details (QT)
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+
+#ifndef __MPXVIDEOPLAYBACKVIEWFILEDETAILS__
+#define __MPXVIDEOPLAYBACKVIEWFILEDETAILS__
+
+#include <qobject.h>
+#include "mpxhelixplaybackplugindefs.h"
+
+
+//
+// CLASS DECLARATION
+//
+class QMPXVideoPlaybackViewFileDetails : public QObject
+{
+ public:
+ //
+ // Constructor
+ //
+ QMPXVideoPlaybackViewFileDetails();
+
+ //
+ // Destructor.
+ //
+ virtual ~QMPXVideoPlaybackViewFileDetails();
+
+ //
+ // Clear all file details
+ //
+ void clearFileDetails();
+
+ public:
+ //
+ // Data
+ //
+ QString mClipName;
+ QString mTitle;
+ QString mArtist;
+ QString mMimeType;
+ QString mDescription;
+ QString mLocation;
+ QString mCopyright;
+ QString mLanguage;
+ QString mKeywords;
+
+ TMPXVideoMode mPlaybackMode;
+ bool mSeekable;
+ bool mPausableStream;
+ bool mAudioEnabled;
+ bool mVideoEnabled;
+ bool mPartialPlayback;
+ bool mRNFormat;
+ bool mTvOutConnected;
+ bool mTvOutPlayAllowed;
+ bool mDrmProtected;
+ bool mMultiItemPlaylist;
+
+ int mVideoHeight;
+ int mVideoWidth;
+ int mBitRate;
+ int mDuration;
+};
+
+#endif // __MPXVIDEOPLAYBACKVIEWFILEDETAILS__
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackbuttonbar/stub/src/hbpushbutton.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,150 @@
+/*
+* 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: Implementation of HbPushButton
+*
+*/
+
+// Version : %version: 1 %
+
+#include <qgraphicswidget>
+
+#include "mpxvideo_debug.h"
+#include "hbpushbutton.h"
+
+// -------------------------------------------------------------------------------------------------
+// HbPushButton::HbPushButton
+// -------------------------------------------------------------------------------------------------
+//
+HbPushButton::HbPushButton()
+{
+ MPX_ENTER_EXIT(_L("HbPushButton::HbPushButton()"));
+
+ mBackground = new QGraphicsWidget();
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbPushButton::~HbPushButton
+// -------------------------------------------------------------------------------------------------
+//
+HbPushButton::~HbPushButton()
+{
+ MPX_DEBUG(_L("HbPushButton::HbPushButton") );
+
+ if ( mBackground )
+ {
+ delete mBackground;
+ mBackground = NULL;
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbPushButton::setEnabled
+// -------------------------------------------------------------------------------------------------
+//
+void HbPushButton::setEnabled( bool enabled )
+{
+ MPX_DEBUG(_L("HbPushButton::setEnabled %d"), enabled );
+
+ mEnabled = enabled;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbPushButton::isEnabled
+// -------------------------------------------------------------------------------------------------
+//
+bool HbPushButton::isEnabled()
+{
+ MPX_DEBUG(_L("HbPushButton::isEnabled %d"), mEnabled );
+
+ return mEnabled;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbPushButton::setVisible
+// -------------------------------------------------------------------------------------------------
+//
+void HbPushButton::setVisible( bool visible )
+{
+ MPX_DEBUG(_L("HbPushButton::setVisible %d"), visible );
+
+ mVisible = visible;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbPushButton::isVisible
+// -------------------------------------------------------------------------------------------------
+//
+bool HbPushButton::isVisible()
+{
+ MPX_DEBUG(_L("HbPushButton::isVisible %d"), mVisible );
+
+ return mVisible;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbPushButton::setSelected
+// -------------------------------------------------------------------------------------------------
+//
+void HbPushButton::setSelected( bool selected )
+{
+ MPX_DEBUG(_L("HbPushButton::setSelected %d"), selected );
+
+ mSelected = selected;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbPushButton::isSelected
+// -------------------------------------------------------------------------------------------------
+//
+bool HbPushButton::isSelected()
+{
+ MPX_DEBUG(_L("HbPushButton::isSelected %d"), mSelected );
+
+ return mSelected;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbPushButton::primitive
+// -------------------------------------------------------------------------------------------------
+//
+QGraphicsItem* HbPushButton::primitive( HbStyle::Primitive primitive ) const
+{
+ MPX_DEBUG(_L("HbPushButton::primitive") );
+
+ return mBackground;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbPushButton::press
+// -------------------------------------------------------------------------------------------------
+//
+void HbPushButton::press()
+{
+ MPX_DEBUG(_L("HbPushButton::press") );
+
+ emit pressed();
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbPushButton::release
+// -------------------------------------------------------------------------------------------------
+//
+void HbPushButton::release()
+{
+ MPX_DEBUG(_L("HbPushButton::release") );
+
+ emit released();
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackbuttonbar/stub/src/mpxvideoplaybackcontrolscontroller.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,89 @@
+/*
+* 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: Implementation of MPXVideoPlaybackControlsController
+*
+*/
+
+// Version : %version: 2 %
+
+
+
+// INCLUDE FILES
+
+
+#include "mpxvideoplaybackdocumentloader.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+
+// ================= MEMBER FUNCTIONS ==============================================================
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::QMPXVideoPlaybackControlsController()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackControlsController::QMPXVideoPlaybackControlsController()
+ : mViewMode( EFullScreenView )
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::QMPXVideoPlaybackControlsController()"));
+
+ mLoader = new QMPXVideoPlaybackDocumentLoader();
+ mFileDetails = new QMPXVideoPlaybackViewFileDetails();
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleCommand()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleCommand(
+ TMPXVideoPlaybackViewCommandIds command, int value )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::handleCommand(%d)"), command);
+
+ mCommand = command;
+ mCommandValue = value;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::changeViewMode
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::changeViewMode(
+ TPlaybackViewMode viewMode, bool transitionEffect )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::changeViewMode()"));
+
+ Q_UNUSED( transitionEffect );
+ mViewMode = viewMode;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::resetDisappearingTimers()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::resetDisappearingTimers( TMPXTimerAction timerAction )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::resetDisappearingTimers()"));
+
+ mTimerAction = timerAction;
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackbuttonbar/stub/src/mpxvideoplaybackdocumentloader.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,123 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackDocumentLoader
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#include "hbpushbutton.h"
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackdocumentloader.h"
+
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::~QMPXVideoPlaybackDocumentLoader
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackDocumentLoader::~QMPXVideoPlaybackDocumentLoader()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader") );
+
+ for ( int i = 0 ; i < mWidgets.count() ; i++ )
+ {
+ mWidgets.removeAt( 0 );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::findWidget()
+// -------------------------------------------------------------------------------------------------
+//
+QGraphicsWidget *QMPXVideoPlaybackDocumentLoader::findWidget( const QString &name )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::findWidget") );
+
+ QGraphicsWidget *object = NULL;
+
+ int index = exist( name );
+
+ if ( index == -1 )
+ {
+ object = createWidget( name );
+ }
+ else
+ {
+ object = mWidgets[ index ];
+ }
+
+ return object;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::createWidget()
+// -------------------------------------------------------------------------------------------------
+//
+QGraphicsWidget *QMPXVideoPlaybackDocumentLoader::createWidget( const QString &name )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::createWidget") );
+
+ QGraphicsWidget *object = NULL;
+
+ if ( name == "rwButton" || name == "pauseButton" || name == "playButton" ||
+ name == "ffButton" || name == "naturalButton" || name == "stretchButton" ||
+ name == "zoomButton" || name == "detailsButton" )
+ {
+ object = new HbPushButton();
+ object->setObjectName( name );
+ mWidgets.append( object );
+ }
+
+ return object;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::exist()
+// -------------------------------------------------------------------------------------------------
+//
+int QMPXVideoPlaybackDocumentLoader::exist( const QString &name )
+{
+ int i = 0;
+
+ for ( ; i < mWidgets.count() ; i++ )
+ {
+ if( mWidgets[i]->objectName() == name )
+ {
+ break;
+ }
+ }
+
+ if ( i == mWidgets.count() )
+ {
+ i = -1;
+ }
+
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::exist %d"), i );
+
+ return i;
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackbuttonbar/stub/src/mpxvideoplaybackviewfiledetails.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* 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: class for MPX Video File Details (Qt)
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+//
+// INCLUDE FILES
+//
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackviewfiledetails.h"
+
+
+// ============================ MEMBER FUNCTIONS ===================================================
+
+QMPXVideoPlaybackViewFileDetails::QMPXVideoPlaybackViewFileDetails()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackViewFileDetails::QMPXVideoPlaybackViewFileDetails()"));
+
+ clearFileDetails();
+}
+
+QMPXVideoPlaybackViewFileDetails::~QMPXVideoPlaybackViewFileDetails()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackViewFileDetails::~QMPXVideoPlaybackViewFileDetails()"));
+
+ clearFileDetails();
+}
+
+void
+QMPXVideoPlaybackViewFileDetails::clearFileDetails()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackViewFileDetails::ClearFileDetails()"));
+
+ mMimeType = tr("");
+ mTitle = tr("");
+ mArtist = tr("");
+ mClipName = tr("");
+ mDescription = tr("");
+ mLocation = tr("");
+ mCopyright = tr("");
+ mLanguage = tr("");
+ mKeywords = tr("");
+
+ mPlaybackMode = EMPXVideoLocal;
+ mSeekable = false;
+ mPausableStream = false;
+ mAudioEnabled = false;
+ mVideoEnabled = false;
+ mPartialPlayback = false;
+ mRNFormat = false;
+
+ mDuration = 0;
+ mTvOutConnected = false;
+ mTvOutPlayAllowed = true;
+ mDrmProtected = false;
+
+ mVideoHeight = 0;
+ mVideoWidth = 0;
+ mBitRate = 0;
+}
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackbuttonbar/testmpxvideoplaybackbuttonbar.pro Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,43 @@
+#
+# 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: Project file for building testmpxvideoplaybackbuttonbar
+#
+#
+# Version : %version: 1 %
+
+TEMPLATE = app
+TARGET = testmpxvideoplaybackbuttonbar
+CONFIG += qtestlib qt hb
+
+INCLUDEPATH += stub/inc \
+ ../../../../inc \
+ ../../../inc
+
+
+DEPENDPATH += inc src stub/inc stub/src
+
+# Input
+HEADERS += testmpxvideoplaybackbuttonbar.h \
+ mpxvideoplaybackcontrolscontroller.h \
+ mpxvideoplaybackdocumentloader.h \
+ mpxvideoplaybackviewfiledetails.h \
+ hbpushbutton.h \
+ ../../controlinc/mpxvideoplaybackbuttonbar.h
+
+SOURCES += testmpxvideoplaybackbuttonbar.cpp \
+ mpxvideoplaybackcontrolscontroller.cpp \
+ mpxvideoplaybackdocumentloader.cpp \
+ mpxvideoplaybackviewfiledetails.cpp \
+ hbpushbutton.cpp \
+ ../../controlsrc/mpxvideoplaybackbuttonbar.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackcontrolpolicy/inc/testmpxvideoplaybackcontrolpolicy.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,69 @@
+/**
+* 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: tester for methods in TestMPXVideoPlaybackControlPolicy
+*
+*/
+
+// Version : %version: 1 %
+
+#ifndef __TESTMPXVIDEOPLAYBACKCONTROLPOLICY_H__
+#define __TESTMPXVIDEOPLAYBACKCONTROLPOLICY_H__
+
+
+// INCLUDES
+#include <QtTest/QtTest>
+
+class QMPXVideoPlaybackControlPolicy;
+class QMPXVideoPlaybackViewFileDetails;
+
+class TestMPXVideoPlaybackControlPolicy : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * will be called before each testfunction is executed.
+ *
+ */
+ void init();
+
+ /**
+ * will be called after every testfunction.
+ *
+ */
+ void cleanup();
+
+ // test functions for the test framework
+private slots:
+
+ // the order in which these testXX methods are declared is important
+ // changing this order will affect the test results
+ void testBufferingAnimationPolicy();
+ void testStatusPanePolicy();
+ void testControlBarPolicy();
+ void testDetailsWidgetPolicy();
+
+signals:
+ void commandSignal();
+
+private:
+ QMPXVideoPlaybackControlPolicy* mPolicy;
+ QMPXVideoPlaybackViewFileDetails* mDetails;
+};
+
+
+#endif // __TESTMPXVIDEOPLAYBACKCONTROLPOLICY_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackcontrolpolicy/src/testmpxvideoplaybackcontrolpolicy.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,175 @@
+/**
+* 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: tester for methods in TestMPXVideoPlaybackControlPolicy
+*
+*/
+
+// Version : %version: 1 %
+
+
+#include <qdebug>
+
+#include <hbmainwindow.h>
+#include <hbapplication.h>
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackviewfiledetails.h"
+#include "testmpxvideoplaybackcontrolpolicy.h"
+
+#define private public
+#include "mpxvideoplaybackcontrolpolicy.h"
+#undef private
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackControlPolicy::Main()"));
+
+ HbApplication app(argc, argv);
+ HbMainWindow window;
+
+ TestMPXVideoPlaybackControlPolicy tv;
+
+ char *pass[3];
+ pass[0] = argv[0];
+ pass[1] = "-o";
+ pass[2] = "c:\\data\\testmpxvideoplaybackcontrolpolicy.txt";
+
+ int res = QTest::qExec(&tv, 3, pass);
+
+ return res;
+}
+
+
+// ---------------------------------------------------------------------------
+// init
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackControlPolicy::init()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackControlPolicy::init()"));
+
+ mPolicy = new QMPXVideoPlaybackControlPolicy();
+ mDetails = new QMPXVideoPlaybackViewFileDetails();
+}
+
+// ---------------------------------------------------------------------------
+// cleanup
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackControlPolicy::cleanup()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackControlPolicy::cleanup()"));
+
+ if ( mPolicy )
+ {
+ delete mPolicy;
+ mPolicy = NULL;
+ }
+
+ if ( mDetails )
+ {
+ delete mDetails;
+ mDetails = NULL;
+ }
+}
+
+// ---------------------------------------------------------------------------
+// testBufferingAnimationPolicy
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackControlPolicy::testBufferingAnimationPolicy()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackControlPolicy::testBufferingAnimationPolicy()"));
+
+ init();
+
+ TUint properties = 0;
+
+ mPolicy->setControlProperties( EMPXBufferingAnimation, properties, mDetails, EFullScreenView );
+
+ QVERIFY( properties == ( EMPXShownWhenInitializing | EMPXShownWhenBuffering ) );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testStatusPanePolicy
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackControlPolicy::testStatusPanePolicy()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackControlPolicy::testStatusPanePolicy()"));
+
+ init();
+
+ TUint properties = 0;
+
+ mDetails->mPlaybackMode = EMPXVideoLocal;
+
+ mPolicy->setControlProperties( EMPXStatusPane, properties, mDetails, EFullScreenView );
+ QVERIFY( properties == ( EMPXShownWhenPlaying | EMPXShownWhenPaused | EMPXShownWhenSeeking ) );
+
+ mPolicy->setControlProperties( EMPXStatusPane, properties, mDetails, EDetailsView );
+ QVERIFY( properties == EMPXAllProperties );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testControlBarPolicy
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackControlPolicy::testControlBarPolicy()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackControlPolicy::testControlBarPolicy()"));
+
+ init();
+
+ TUint properties = 0;
+
+ mPolicy->setControlProperties( EMPXButtonBar, properties, mDetails, EDetailsView );
+ QVERIFY( properties == 0 );
+
+ mPolicy->setControlProperties( EMPXProgressBar, properties, mDetails, EAudioOnlyView );
+ QVERIFY( properties == EMPXAllProperties );
+
+ mPolicy->setControlProperties( EMPXButtonBar, properties, mDetails, EFullScreenView );
+ QVERIFY( properties == ( EMPXShownWhenPlaying | EMPXShownWhenPaused | EMPXShownWhenSeeking ) );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testDetailsWidgetPolicy
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackControlPolicy::testDetailsWidgetPolicy()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackControlPolicy::testDetailsWidgetPolicy()"));
+
+ init();
+
+ TUint properties = 0;
+
+ mPolicy->setControlProperties( EMPXFileDetailsWidget, properties, mDetails, EAudioOnlyView );
+ QVERIFY( properties == EMPXAllProperties );
+
+ cleanup();
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackcontrolpolicy/stub/inc/mpxvideoplaybackcontrolscontroller.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,124 @@
+/*
+* 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: Implementation of MPXVideoPlaybackControlsController
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_
+#define MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_
+
+// INCLUDES
+#include <qobject>
+#include <mpxplaybackframeworkdefs.h>
+
+#include "mpxvideo_debug.h"
+#include "mpxcommonvideoplaybackview.hrh"
+
+
+// FORWARD DECLARATIONS
+
+
+// DATA TYPES
+
+enum TMPXTimerAction
+{
+ EMPXTimerCancel,
+ EMPXTimerReset
+};
+
+enum TPlaybackViewMode
+{
+ EFullScreenView,
+ EDetailsView,
+ EAudioOnlyView
+};
+
+const int KMPXControlsTimeOut = 4000;
+
+// CLASS DECLARATION
+
+class QMPXVideoPlaybackControlsController : public QObject
+{
+ Q_OBJECT
+
+ public:
+
+ /**
+ * constructor.
+ */
+ QMPXVideoPlaybackControlsController();
+
+ /**
+ * Destructor.
+ */
+ virtual ~QMPXVideoPlaybackControlsController();
+
+ public:
+
+ /**
+ * Command handling function.
+ * Call HandleCommandL() of container
+ */
+ void handleCommand( TMPXVideoPlaybackViewCommandIds command, int value = 0 );
+
+ /**
+ * Reset or cancel timers for the controls
+ */
+ void resetDisappearingTimers( TMPXTimerAction timerAction );
+
+ /**
+ * Return state
+ */
+ inline TMPXPlaybackState state();
+
+ TPlaybackViewMode viewMode();
+
+ void changeViewMode( TPlaybackViewMode viewMode, bool transitionEffect = true );
+
+ public:
+ TMPXPlaybackState mState;
+ TPlaybackViewMode mViewMode;
+ TMPXTimerAction mTimerAction;
+ TMPXVideoPlaybackViewCommandIds mCommand;
+ int mCommandValue;
+};
+
+// INLINE METHODS
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::state
+// -------------------------------------------------------------------------------------------------
+//
+inline
+TMPXPlaybackState QMPXVideoPlaybackControlsController::state()
+{
+ return mState;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::viewMode
+// -------------------------------------------------------------------------------------------------
+//
+inline
+TPlaybackViewMode QMPXVideoPlaybackControlsController::viewMode()
+{
+ return mViewMode;
+}
+
+#endif /*MPXVIDEOPLAYBACKCONTROLSCONTROLLER_P_H_*/
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackcontrolpolicy/stub/inc/mpxvideoplaybackviewfiledetails.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* 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: MPX Video File Details (QT)
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+
+#ifndef __MPXVIDEOPLAYBACKVIEWFILEDETAILS__
+#define __MPXVIDEOPLAYBACKVIEWFILEDETAILS__
+
+#include <qobject.h>
+#include "mpxhelixplaybackplugindefs.h"
+
+
+//
+// CLASS DECLARATION
+//
+class QMPXVideoPlaybackViewFileDetails : public QObject
+{
+ public:
+ //
+ // Constructor
+ //
+ QMPXVideoPlaybackViewFileDetails();
+
+ //
+ // Destructor.
+ //
+ virtual ~QMPXVideoPlaybackViewFileDetails();
+
+ //
+ // Clear all file details
+ //
+ void clearFileDetails();
+
+ public:
+ //
+ // Data
+ //
+ QString mClipName;
+ QString mTitle;
+ QString mArtist;
+ QString mMimeType;
+ QString mDescription;
+ QString mLocation;
+ QString mCopyright;
+ QString mLanguage;
+ QString mKeywords;
+
+ TMPXVideoMode mPlaybackMode;
+ bool mSeekable;
+ bool mPausableStream;
+ bool mAudioEnabled;
+ bool mVideoEnabled;
+ bool mPartialPlayback;
+ bool mRNFormat;
+ bool mTvOutConnected;
+ bool mTvOutPlayAllowed;
+ bool mDrmProtected;
+ bool mMultiItemPlaylist;
+
+ int mVideoHeight;
+ int mVideoWidth;
+ int mBitRate;
+ int mDuration;
+};
+
+#endif // __MPXVIDEOPLAYBACKVIEWFILEDETAILS__
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackcontrolpolicy/stub/src/mpxvideoplaybackviewfiledetails.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* 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: class for MPX Video File Details (Qt)
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+//
+// INCLUDE FILES
+//
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackviewfiledetails.h"
+
+
+// ============================ MEMBER FUNCTIONS ===================================================
+
+QMPXVideoPlaybackViewFileDetails::QMPXVideoPlaybackViewFileDetails()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackViewFileDetails::QMPXVideoPlaybackViewFileDetails()"));
+
+ clearFileDetails();
+}
+
+QMPXVideoPlaybackViewFileDetails::~QMPXVideoPlaybackViewFileDetails()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackViewFileDetails::~QMPXVideoPlaybackViewFileDetails()"));
+
+ clearFileDetails();
+}
+
+void
+QMPXVideoPlaybackViewFileDetails::clearFileDetails()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackViewFileDetails::ClearFileDetails()"));
+
+ mMimeType = tr("");
+ mTitle = tr("");
+ mArtist = tr("");
+ mClipName = tr("");
+ mDescription = tr("");
+ mLocation = tr("");
+ mCopyright = tr("");
+ mLanguage = tr("");
+ mKeywords = tr("");
+
+ mPlaybackMode = EMPXVideoLocal;
+ mSeekable = false;
+ mPausableStream = false;
+ mAudioEnabled = false;
+ mVideoEnabled = false;
+ mPartialPlayback = false;
+ mRNFormat = false;
+
+ mDuration = 0;
+ mTvOutConnected = false;
+ mTvOutPlayAllowed = true;
+ mDrmProtected = false;
+
+ mVideoHeight = 0;
+ mVideoWidth = 0;
+ mBitRate = 0;
+}
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackcontrolpolicy/testmpxvideoplaybackcontrolpolicy.pro Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,37 @@
+#
+# 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: Project file for building testmpxvideoplaybackcontrolpolicy
+#
+#
+# Version : %version: 1 %
+
+TEMPLATE = app
+TARGET = testmpxvideoplaybackcontrolpolicy
+CONFIG += qtestlib qt hb
+
+INCLUDEPATH += stub/inc \
+ ../../../../inc \
+ ../../../inc
+
+
+DEPENDPATH += inc src stub/inc stub/src
+
+# Input
+HEADERS += testmpxvideoplaybackcontrolpolicy.h \
+ mpxvideoplaybackviewfiledetails.h \
+ ../../controlinc/mpxvideoplaybackcontrolpolicy.h
+
+SOURCES += testmpxvideoplaybackcontrolpolicy.cpp \
+ mpxvideoplaybackviewfiledetails.cpp \
+ ../../controlsrc/mpxvideoplaybackcontrolpolicy.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdetailsplaybackwindow/inc/testmpxvideoplaybackdetailsplaybackwindow.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,74 @@
+/**
+* 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: tester for methods in TestMPXVideoPlaybackDetailsPlaybackWindow
+*
+*/
+
+// Version : %version: 1 %
+
+
+#ifndef __TESTMPXVIDEOPLAYDETAILSPLAYBACKWINDOW_H__
+#define __TESTMPXVIDEOPLAYDETAILSPLAYBACKWINDOW_H__
+
+
+// INCLUDES
+#include <QtTest/QtTest>
+
+class QEvent;
+class QMPXVideoPlaybackDetailsPlaybackWindow;
+class QMPXVideoPlaybackControlsController;
+
+class TestMPXVideoPlaybackDetailsPlaybackWindow : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * will be called before each testfunction is executed.
+ *
+ */
+ void init();
+
+ /**
+ * will be called after every testfunction.
+ *
+ */
+ void cleanup();
+
+ // test functions for the test framework
+private slots:
+
+ // the order in which these testXX methods are declared is important
+ // changing this order will affect the test results
+ void testUpdateState();
+ void testPlayPause();
+ void testMousePressEvent();
+ void testMouseReleaseEvent();
+
+signals:
+ void commandSignal(int);
+
+private:
+ QMPXVideoPlaybackDetailsPlaybackWindow* mWindow;
+ QMPXVideoPlaybackControlsController* mController;
+};
+
+
+#endif // __TESTMPXVIDEOPLAYDETAILSPLAYBACKWINDOW_H__
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdetailsplaybackwindow/src/testmpxvideoplaybackdetailsplaybackwindow.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,179 @@
+/**
+* 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: tester for methods in TestMPXVideoPlaybackDetailsPlaybackWindow
+*
+*/
+
+// Version : %version: 1 %
+
+
+#include <qdebug>
+#include <qgraphicsscenemouseevent>
+
+#include <hbmainwindow.h>
+#include <hbapplication.h>
+
+#include "hbpushbutton.h"
+#include "mpxvideoplaybackviewfiledetails.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+#include "testmpxvideoplaybackdetailsplaybackwindow.h"
+
+
+#define private public
+#include "mpxvideoplaybackdetailsplaybackwindow.h"
+#undef private
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackDetailsPlaybackWindow::Main()"));
+
+ HbApplication app(argc, argv);
+ HbMainWindow window;
+
+ TestMPXVideoPlaybackDetailsPlaybackWindow tv;
+
+ char *pass[3];
+ pass[0] = argv[0];
+ pass[1] = "-o";
+ pass[2] = "c:\\data\\testmpxvideoplaybackdetailsplaybackwindow.txt";
+
+ int res = QTest::qExec(&tv, 3, pass);
+
+ return res;
+}
+
+// ---------------------------------------------------------------------------
+// init
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackDetailsPlaybackWindow::init()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackDetailsPlaybackWindow::init()"));
+
+ mController = new QMPXVideoPlaybackControlsController();
+ mWindow = new QMPXVideoPlaybackDetailsPlaybackWindow( mController );
+
+ mWindow->initialize();
+}
+
+// ---------------------------------------------------------------------------
+// cleanup
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackDetailsPlaybackWindow::cleanup()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackDetailsPlaybackWindow::cleanup()"));
+
+ if ( mController )
+ {
+ delete mController;
+ mController = NULL;
+ }
+
+ if ( mWindow )
+ {
+ delete mWindow;
+ mWindow = NULL;
+ }
+}
+
+// ---------------------------------------------------------------------------
+// testUpdateState
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackDetailsPlaybackWindow::testUpdateState()
+{
+ MPX_ENTER_EXIT(
+ _L("TestMPXVideoPlaybackDetailsPlaybackWindow::testUpdateState()"));
+
+ init();
+
+ TMPXPlaybackState state = EPbStatePlaying;
+ mWindow->updateState( state );
+ QVERIFY( mWindow->mPlayButton->isVisible() == false );
+
+ state = EPbStatePaused;
+ mWindow->updateState( state );
+ QVERIFY( mWindow->mPlayButton->isVisible() == true );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testMousePressEvent
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackDetailsPlaybackWindow::testMousePressEvent()
+{
+ MPX_ENTER_EXIT(
+ _L("TestMPXVideoPlaybackDetailsPlaybackWindow::testMousePressEvent()"));
+
+ init();
+
+ QGraphicsSceneMouseEvent* event =
+ new QGraphicsSceneMouseEvent( QEvent::GraphicsSceneMousePress );
+ event->setAccepted( false );
+
+ mWindow->mousePressEvent( event );
+
+ QVERIFY( event->isAccepted() );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testMouseReleaseEvent
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackDetailsPlaybackWindow::testMouseReleaseEvent()
+{
+ MPX_ENTER_EXIT(
+ _L("TestMPXVideoPlaybackDetailsPlaybackWindow::testMouseReleaseEvent()"));
+
+ init();
+
+ QGraphicsSceneMouseEvent* event =
+ new QGraphicsSceneMouseEvent( QEvent::GraphicsSceneMouseRelease );
+
+ mWindow->mouseReleaseEvent( event );
+ QVERIFY( mController->mCommand == EMPXPbvCmdPlayPause );
+
+ delete event;
+ event = NULL;
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testPlayPause
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackDetailsPlaybackWindow::testPlayPause()
+{
+ MPX_ENTER_EXIT(
+ _L("TestMPXVideoPlaybackDetailsPlaybackWindow::testPlayPause()"));
+
+ init();
+
+ mWindow->mPlayButton->release();
+ QVERIFY( mController->mCommand == EMPXPbvCmdPlayPause );
+
+ cleanup();
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdetailsplaybackwindow/stub/inc/hbpushbutton.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,62 @@
+/*
+* 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: Implementation of HbPushButton
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef HBPUSHBUTTON_H_
+#define HBPUSHBUTTON_H
+
+#include <hbwidget.h>
+#include <hbstyle.h>
+
+class QGraphicsItem;
+
+class HbPushButton : public HbWidget
+{
+ Q_OBJECT
+
+ public:
+ HbPushButton();
+ virtual ~HbPushButton();
+
+ public:
+ void setEnabled( bool enabled );
+ void setVisible( bool visible );
+ void setSelected( bool selected );
+ bool isEnabled();
+ bool isVisible();
+ bool isSelected();
+ QGraphicsItem* primitive( HbStyle::Primitive primitive ) const;
+ void press();
+ void release();
+
+ signals:
+ void pressed();
+ void released();
+
+ public:
+ bool mVisible;
+ bool mEnabled;
+ bool mSelected;
+
+ QGraphicsItem *mBackground;
+};
+
+#endif /*HBPUSHBUTTON_H*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdetailsplaybackwindow/stub/inc/mpxvideoplaybackcontrolscontroller.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,153 @@
+/*
+* 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: Implementation of MPXVideoPlaybackControlsController
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_
+#define MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_
+
+// INCLUDES
+#include <qobject>
+#include <mpxplaybackframeworkdefs.h>
+
+#include "mpxvideo_debug.h"
+#include "mpxcommonvideoplaybackview.hrh"
+#include "mpxvideoplaybackviewfiledetails.h"
+
+// FORWARD DECLARATIONS
+class QMPXVideoPlaybackDocumentLoader;
+
+
+// DATA TYPES
+
+enum TMPXTimerAction
+{
+ EMPXTimerCancel,
+ EMPXTimerReset
+};
+
+enum TPlaybackViewMode
+{
+ EFullScreenView,
+ EDetailsView,
+ EAudioOnlyView
+};
+
+// CLASS DECLARATION
+
+class QMPXVideoPlaybackControlsController : public QObject
+{
+ Q_OBJECT
+
+ public:
+
+ /**
+ * constructor.
+ */
+ QMPXVideoPlaybackControlsController();
+
+ /**
+ * Destructor.
+ */
+ virtual ~QMPXVideoPlaybackControlsController();
+
+ public:
+
+ /**
+ * Command handling function.
+ * Call HandleCommandL() of container
+ */
+ void handleCommand( TMPXVideoPlaybackViewCommandIds command, int value = 0 );
+
+ /**
+ * Reset or cancel timers for the controls
+ */
+ void resetDisappearingTimers( TMPXTimerAction timerAction );
+
+ /**
+ * Return state
+ */
+ inline TMPXPlaybackState state();
+
+ /**
+ * Return file details
+ */
+ inline QMPXVideoPlaybackViewFileDetails* fileDetails();
+
+ inline QMPXVideoPlaybackDocumentLoader* layoutLoader();
+
+ TPlaybackViewMode viewMode();
+
+ void changeViewMode( TPlaybackViewMode viewMode, bool transitionEffect = true );
+
+ public:
+ QMPXVideoPlaybackViewFileDetails *mFileDetails;
+ QMPXVideoPlaybackDocumentLoader *mLoader;
+
+ TMPXPlaybackState mState;
+ TPlaybackViewMode mViewMode;
+ TMPXTimerAction mTimerAction;
+ TMPXVideoPlaybackViewCommandIds mCommand;
+ int mCommandValue;
+};
+
+// INLINE METHODS
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::state
+// -------------------------------------------------------------------------------------------------
+//
+inline
+TMPXPlaybackState QMPXVideoPlaybackControlsController::state()
+{
+ return mState;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::fileDetails
+// -------------------------------------------------------------------------------------------------
+//
+inline
+QMPXVideoPlaybackViewFileDetails* QMPXVideoPlaybackControlsController::fileDetails()
+{
+ return mFileDetails;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::layoutLoader
+// -------------------------------------------------------------------------------------------------
+//
+inline
+QMPXVideoPlaybackDocumentLoader* QMPXVideoPlaybackControlsController::layoutLoader()
+{
+ return mLoader;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::viewMode
+// -------------------------------------------------------------------------------------------------
+//
+inline
+TPlaybackViewMode QMPXVideoPlaybackControlsController::viewMode()
+{
+ return mViewMode;
+}
+
+#endif /*MPXVIDEOPLAYBACKCONTROLSCONTROLLER_P_H_*/
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdetailsplaybackwindow/stub/inc/mpxvideoplaybackdocumentloader.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackDocumentLoader
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKDOCUMENTHANDLER_H_
+#define MPXVIDEOPLAYBACKDOCUMENTHANDLER_H_
+
+
+#include <qobject>
+#include <qlist>
+
+class QGraphicsWidget;
+class QMPXVideoPlaybackControlsController;
+
+class QMPXVideoPlaybackDocumentLoader : public QObject
+{
+ public:
+ QMPXVideoPlaybackDocumentLoader();
+ virtual ~QMPXVideoPlaybackDocumentLoader();
+
+ public:
+ QGraphicsWidget* findWidget( const QString &name );
+
+ private:
+ QGraphicsWidget* createWidget( const QString &name );
+ int exist( const QString &name );
+
+ private:
+ QList<QGraphicsWidget*> mWidgets;
+};
+
+#endif /*MPXVIDEOPLAYBACKDOCUMENTHANDLER_H_*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdetailsplaybackwindow/stub/inc/mpxvideoplaybackviewfiledetails.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* 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: MPX Video File Details (QT)
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+
+#ifndef __MPXVIDEOPLAYBACKVIEWFILEDETAILS__
+#define __MPXVIDEOPLAYBACKVIEWFILEDETAILS__
+
+#include <qobject.h>
+#include "mpxhelixplaybackplugindefs.h"
+
+
+//
+// CLASS DECLARATION
+//
+class QMPXVideoPlaybackViewFileDetails : public QObject
+{
+ public:
+ //
+ // Constructor
+ //
+ QMPXVideoPlaybackViewFileDetails();
+
+ //
+ // Destructor.
+ //
+ virtual ~QMPXVideoPlaybackViewFileDetails();
+
+ //
+ // Clear all file details
+ //
+ void clearFileDetails();
+
+ public:
+ //
+ // Data
+ //
+ QString mClipName;
+ QString mTitle;
+ QString mArtist;
+ QString mMimeType;
+ QString mDescription;
+ QString mLocation;
+ QString mCopyright;
+ QString mLanguage;
+ QString mKeywords;
+
+ TMPXVideoMode mPlaybackMode;
+ bool mSeekable;
+ bool mPausableStream;
+ bool mAudioEnabled;
+ bool mVideoEnabled;
+ bool mPartialPlayback;
+ bool mRNFormat;
+ bool mTvOutConnected;
+ bool mTvOutPlayAllowed;
+ bool mDrmProtected;
+ bool mMultiItemPlaylist;
+
+ int mVideoHeight;
+ int mVideoWidth;
+ int mBitRate;
+ int mDuration;
+};
+
+#endif // __MPXVIDEOPLAYBACKVIEWFILEDETAILS__
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdetailsplaybackwindow/stub/src/hbpushbutton.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,150 @@
+/*
+* 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: Implementation of HbPushButton
+*
+*/
+
+// Version : %version: 1 %
+
+#include <qgraphicswidget>
+
+#include "mpxvideo_debug.h"
+#include "hbpushbutton.h"
+
+// -------------------------------------------------------------------------------------------------
+// HbPushButton::HbPushButton
+// -------------------------------------------------------------------------------------------------
+//
+HbPushButton::HbPushButton()
+{
+ MPX_ENTER_EXIT(_L("HbPushButton::HbPushButton()"));
+
+ mBackground = new QGraphicsWidget();
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbPushButton::~HbPushButton
+// -------------------------------------------------------------------------------------------------
+//
+HbPushButton::~HbPushButton()
+{
+ MPX_DEBUG(_L("HbPushButton::HbPushButton") );
+
+ if ( mBackground )
+ {
+ delete mBackground;
+ mBackground = NULL;
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbPushButton::setEnabled
+// -------------------------------------------------------------------------------------------------
+//
+void HbPushButton::setEnabled( bool enabled )
+{
+ MPX_DEBUG(_L("HbPushButton::setEnabled %d"), enabled );
+
+ mEnabled = enabled;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbPushButton::isEnabled
+// -------------------------------------------------------------------------------------------------
+//
+bool HbPushButton::isEnabled()
+{
+ MPX_DEBUG(_L("HbPushButton::isEnabled %d"), mEnabled );
+
+ return mEnabled;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbPushButton::setVisible
+// -------------------------------------------------------------------------------------------------
+//
+void HbPushButton::setVisible( bool visible )
+{
+ MPX_DEBUG(_L("HbPushButton::setVisible %d"), visible );
+
+ mVisible = visible;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbPushButton::isVisible
+// -------------------------------------------------------------------------------------------------
+//
+bool HbPushButton::isVisible()
+{
+ MPX_DEBUG(_L("HbPushButton::isVisible %d"), mVisible );
+
+ return mVisible;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbPushButton::setSelected
+// -------------------------------------------------------------------------------------------------
+//
+void HbPushButton::setSelected( bool selected )
+{
+ MPX_DEBUG(_L("HbPushButton::setSelected %d"), selected );
+
+ mSelected = selected;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbPushButton::isSelected
+// -------------------------------------------------------------------------------------------------
+//
+bool HbPushButton::isSelected()
+{
+ MPX_DEBUG(_L("HbPushButton::isSelected %d"), mSelected );
+
+ return mSelected;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbPushButton::primitive
+// -------------------------------------------------------------------------------------------------
+//
+QGraphicsItem* HbPushButton::primitive( HbStyle::Primitive primitive ) const
+{
+ MPX_DEBUG(_L("HbPushButton::primitive") );
+
+ return mBackground;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbPushButton::press
+// -------------------------------------------------------------------------------------------------
+//
+void HbPushButton::press()
+{
+ MPX_DEBUG(_L("HbPushButton::press") );
+
+ emit pressed();
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbPushButton::release
+// -------------------------------------------------------------------------------------------------
+//
+void HbPushButton::release()
+{
+ MPX_DEBUG(_L("HbPushButton::release") );
+
+ emit released();
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdetailsplaybackwindow/stub/src/mpxvideoplaybackcontrolscontroller.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,88 @@
+/*
+* 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: Implementation of MPXVideoPlaybackControlsController
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+// INCLUDE FILES
+
+
+#include "mpxvideoplaybackdocumentloader.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+
+// ================= MEMBER FUNCTIONS ==============================================================
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::QMPXVideoPlaybackControlsController()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackControlsController::QMPXVideoPlaybackControlsController()
+ : mViewMode( EFullScreenView )
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::QMPXVideoPlaybackControlsController()"));
+
+ mLoader = new QMPXVideoPlaybackDocumentLoader();
+ mFileDetails = new QMPXVideoPlaybackViewFileDetails();
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleCommand()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleCommand(
+ TMPXVideoPlaybackViewCommandIds command, int value )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::handleCommand(%d)"), command);
+
+ mCommand = command;
+ mCommandValue = value;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::changeViewMode
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::changeViewMode(
+ TPlaybackViewMode viewMode, bool transitionEffect )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::changeViewMode()"));
+
+ mViewMode = viewMode;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::resetDisappearingTimers()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::resetDisappearingTimers( TMPXTimerAction timerAction )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::resetDisappearingTimers()"));
+
+ mTimerAction = timerAction;
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdetailsplaybackwindow/stub/src/mpxvideoplaybackdocumentloader.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,121 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackDocumentLoader
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#include "hbpushbutton.h"
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackdocumentloader.h"
+
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::~QMPXVideoPlaybackDocumentLoader
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackDocumentLoader::~QMPXVideoPlaybackDocumentLoader()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader") );
+
+ for ( int i = 0 ; i < mWidgets.count() ; i++ )
+ {
+ mWidgets.removeAt( 0 );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::findWidget()
+// -------------------------------------------------------------------------------------------------
+//
+QGraphicsWidget *QMPXVideoPlaybackDocumentLoader::findWidget( const QString &name )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::findWidget") );
+
+ QGraphicsWidget *object = NULL;
+
+ int index = exist( name );
+
+ if ( index == -1 )
+ {
+ object = createWidget( name );
+ }
+ else
+ {
+ object = mWidgets[ index ];
+ }
+
+ return object;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::createWidget()
+// -------------------------------------------------------------------------------------------------
+//
+QGraphicsWidget *QMPXVideoPlaybackDocumentLoader::createWidget( const QString &name )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::createWidget") );
+
+ QGraphicsWidget *object = NULL;
+
+ if ( name == "detailsViewPlayButton" )
+ {
+ object = new HbPushButton();
+ object->setObjectName( name );
+ mWidgets.append( object );
+ }
+
+ return object;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::exist()
+// -------------------------------------------------------------------------------------------------
+//
+int QMPXVideoPlaybackDocumentLoader::exist( const QString &name )
+{
+ int i = 0;
+
+ for ( ; i < mWidgets.count() ; i++ )
+ {
+ if( mWidgets[i]->objectName() == name )
+ {
+ break;
+ }
+ }
+
+ if ( i == mWidgets.count() )
+ {
+ i = -1;
+ }
+
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::exist %d"), i );
+
+ return i;
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdetailsplaybackwindow/stub/src/mpxvideoplaybackviewfiledetails.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* 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: class for MPX Video File Details (Qt)
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+//
+// INCLUDE FILES
+//
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackviewfiledetails.h"
+
+
+// ============================ MEMBER FUNCTIONS ===================================================
+
+QMPXVideoPlaybackViewFileDetails::QMPXVideoPlaybackViewFileDetails()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackViewFileDetails::QMPXVideoPlaybackViewFileDetails()"));
+
+ clearFileDetails();
+}
+
+QMPXVideoPlaybackViewFileDetails::~QMPXVideoPlaybackViewFileDetails()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackViewFileDetails::~QMPXVideoPlaybackViewFileDetails()"));
+
+ clearFileDetails();
+}
+
+void
+QMPXVideoPlaybackViewFileDetails::clearFileDetails()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackViewFileDetails::ClearFileDetails()"));
+
+ mMimeType = tr("");
+ mTitle = tr("");
+ mArtist = tr("");
+ mClipName = tr("");
+ mDescription = tr("");
+ mLocation = tr("");
+ mCopyright = tr("");
+ mLanguage = tr("");
+ mKeywords = tr("");
+
+ mPlaybackMode = EMPXVideoLocal;
+ mSeekable = false;
+ mPausableStream = false;
+ mAudioEnabled = false;
+ mVideoEnabled = false;
+ mPartialPlayback = false;
+ mRNFormat = false;
+
+ mDuration = 0;
+ mTvOutConnected = false;
+ mTvOutPlayAllowed = true;
+ mDrmProtected = false;
+
+ mVideoHeight = 0;
+ mVideoWidth = 0;
+ mBitRate = 0;
+}
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdetailsplaybackwindow/testmpxvideoplaybackdetailsplaybackwindow.pro Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,43 @@
+#
+# 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: Project file for building testmpxvideoplaybackdetailsplaybackwindow
+#
+#
+# Version : %version: 1 %
+
+TEMPLATE = app
+TARGET = testmpxvideoplaybackdetailsplaybackwindow
+CONFIG += qtestlib qt hb
+
+INCLUDEPATH += stub/inc \
+ ../../../../inc \
+ ../../../inc
+
+
+DEPENDPATH += inc src stub/inc stub/src
+
+# Input
+HEADERS += testmpxvideoplaybackdetailsplaybackwindow.h \
+ mpxvideoplaybackcontrolscontroller.h \
+ mpxvideoplaybackdocumentloader.h \
+ mpxvideoplaybackviewfiledetails.h \
+ hbpushbutton.h \
+ ../../controlinc/mpxvideoplaybackdetailsplaybackwindow.h
+
+SOURCES += testmpxvideoplaybackdetailsplaybackwindow.cpp \
+ mpxvideoplaybackcontrolscontroller.cpp \
+ mpxvideoplaybackdocumentloader.cpp \
+ mpxvideoplaybackviewfiledetails.cpp \
+ hbpushbutton.cpp \
+ ../../controlsrc/mpxvideoplaybackdetailsplaybackwindow.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdocumentloader/inc/testmpxvideoplaybackdocumentloader.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,66 @@
+/**
+* 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: tester for methods in TestMPXVideoPlaybackDocumentLoader
+*
+*/
+
+// Version : %version: 1 %
+
+#ifndef __TESTMPXVIDEOPLAYBACKDOCUMENTLOADER_H__
+#define __TESTMPXVIDEOPLAYBACKDOCUMENTLOADER_H__
+
+
+// INCLUDES
+#include <QtTest/QtTest>
+
+class QMPXVideoPlaybackDocumentLoader;
+class QMPXVideoPlaybackControlsController;
+
+class TestMPXVideoPlaybackDocumentLoader : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * will be called before each testfunction is executed.
+ *
+ */
+ void init();
+
+ /**
+ * will be called after every testfunction.
+ *
+ */
+ void cleanup();
+
+ // test functions for the test framework
+private slots:
+
+ // the order in which these testXX methods are declared is important
+ // changing this order will affect the test results
+ void testCreateObject();
+
+signals:
+ void commandSignal();
+
+private:
+ QMPXVideoPlaybackDocumentLoader* mLoader;
+ QMPXVideoPlaybackControlsController* mController;
+};
+
+
+#endif // __TESTMPXVIDEOPLAYBACKDOCUMENTLOADER_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdocumentloader/src/testmpxvideoplaybackdocumentloader.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,120 @@
+/**
+* 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: tester for methods in TestMPXVideoPlaybackDocumentLoader
+*
+*/
+
+// Version : %version: 1 %
+
+
+#include <qdebug>
+#include <qobject>
+
+#include <hbmainwindow.h>
+#include <hbapplication.h>
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+#include "testmpxvideoplaybackdocumentloader.h"
+
+#define private public
+#include "mpxvideoplaybackdocumentloader.h"
+#undef private
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackDocumentLoader::Main()"));
+
+ HbApplication app(argc, argv);
+ HbMainWindow window;
+
+ TestMPXVideoPlaybackDocumentLoader tv;
+
+ char *pass[3];
+ pass[0] = argv[0];
+ pass[1] = "-o";
+ pass[2] = "c:\\data\\testmpxvideoplaybackdocumentloader.txt";
+
+ int res = QTest::qExec(&tv, 3, pass);
+
+ return res;
+}
+
+
+// ---------------------------------------------------------------------------
+// init
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackDocumentLoader::init()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackDocumentLoader::init()"));
+
+ mController = new QMPXVideoPlaybackControlsController();
+ mLoader = new QMPXVideoPlaybackDocumentLoader( mController );
+}
+
+// ---------------------------------------------------------------------------
+// cleanup
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackDocumentLoader::cleanup()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackDocumentLoader::cleanup()"));
+
+ if ( mLoader )
+ {
+ delete mLoader;
+ mLoader = NULL;
+ }
+
+ if ( mController )
+ {
+ delete mController;
+ mController = NULL;
+ }
+}
+
+// ---------------------------------------------------------------------------
+// testCreateObject
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackDocumentLoader::testCreateObject()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackDocumentLoader::testCreateObject()"));
+
+ init();
+
+ QObject *object = mLoader->createObject( "", "buttonBarLayout" );
+ QVERIFY( object->objectName() == "buttonBarLayout" );
+
+ object = mLoader->createObject( "", "progressBarLayout" );
+ QVERIFY( object->objectName() == "progressBarLayout" );
+
+ object = mLoader->createObject( "", "fileDetailsLayout" );
+ QVERIFY( object->objectName() == "fileDetailsLayout" );
+
+ object = mLoader->createObject( "", "volumeSlider" );
+ QVERIFY( object->objectName() == "volumeSlider" );
+
+ object = mLoader->createObject( "", "detailsPlaybackWindow" );
+ QVERIFY( object->objectName() == "detailsPlaybackWindow" );
+
+ cleanup();
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdocumentloader/stub/inc/mpxvideoplaybackbuttonbar.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackButtonBar
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKBUTTONBAR_H_
+#define MPXVIDEOPLAYBACKBUTTONBAR_H_
+
+
+#include <qobject>
+
+class QMPXVideoPlaybackControlsController;
+
+
+class QMPXVideoPlaybackButtonBar : public QObject
+{
+ Q_OBJECT
+
+ public:
+ QMPXVideoPlaybackButtonBar( QMPXVideoPlaybackControlsController* controller );
+ virtual ~QMPXVideoPlaybackButtonBar();
+
+ public:
+ QMPXVideoPlaybackControlsController *mController;
+};
+
+#endif /*MPXVIDEOPLAYBACKBUTTONBAR_H_*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdocumentloader/stub/inc/mpxvideoplaybackcontrolscontroller.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,124 @@
+/*
+* 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: Implementation of MPXVideoPlaybackControlsController
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_
+#define MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_
+
+// INCLUDES
+#include <qobject>
+#include <mpxplaybackframeworkdefs.h>
+
+#include "mpxvideo_debug.h"
+#include "mpxhelixplaybackplugindefs.h"
+#include "mpxcommonvideoplaybackview.hrh"
+
+// FORWARD DECLARATIONS
+
+// DATA TYPES
+
+enum TMPXTimerAction
+{
+ EMPXTimerCancel,
+ EMPXTimerReset
+};
+
+enum TPlaybackViewMode
+{
+ EFullScreenView,
+ EDetailsView,
+ EAudioOnlyView
+};
+
+const QString KMPXPLAYBACKVIEW_XML = ":/hbvideoplaybackview/hbvideoplaybackview.docml";
+
+// CLASS DECLARATION
+
+class QMPXVideoPlaybackControlsController : public QObject
+{
+ Q_OBJECT
+
+ public:
+
+ /**
+ * constructor.
+ */
+ QMPXVideoPlaybackControlsController();
+
+ /**
+ * Destructor.
+ */
+ virtual ~QMPXVideoPlaybackControlsController();
+
+ public:
+
+ /**
+ * Command handling function.
+ * Call HandleCommandL() of container
+ */
+ void handleCommand( TMPXVideoPlaybackViewCommandIds command, int value = 0 );
+
+ /**
+ * Reset or cancel timers for the controls
+ */
+ void resetDisappearingTimers( TMPXTimerAction timerAction );
+
+ /**
+ * Return state
+ */
+ inline TMPXPlaybackState state();
+
+ TPlaybackViewMode viewMode();
+
+ void changeViewMode( TPlaybackViewMode viewMode, bool transitionEffect = true );
+
+ public:
+
+ TMPXPlaybackState mState;
+ TPlaybackViewMode mViewMode;
+ TMPXTimerAction mTimerAction;
+ TMPXVideoPlaybackViewCommandIds mCommand;
+ int mCommandValue;
+};
+
+// INLINE METHODS
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::state
+// -------------------------------------------------------------------------------------------------
+//
+inline
+TMPXPlaybackState QMPXVideoPlaybackControlsController::state()
+{
+ return mState;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::viewMode
+// -------------------------------------------------------------------------------------------------
+//
+inline
+TPlaybackViewMode QMPXVideoPlaybackControlsController::viewMode()
+{
+ return mViewMode;
+}
+
+#endif /*MPXVIDEOPLAYBACKCONTROLSCONTROLLER_P_H_*/
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdocumentloader/stub/inc/mpxvideoplaybackdetailsplaybackwindow.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackDetailsPlaybackWindow
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKDETAILSPLAYBACKWINDOW_H_
+#define MPXVIDEOPLAYBACKDETAILSPLAYBACKWINDOW_H_
+
+#include <qobject>
+
+class QMPXVideoPlaybackControlsController;
+
+class QMPXVideoPlaybackDetailsPlaybackWindow : public QObject
+{
+ Q_OBJECT
+
+ public:
+ QMPXVideoPlaybackDetailsPlaybackWindow( QMPXVideoPlaybackControlsController* controller );
+ virtual ~QMPXVideoPlaybackDetailsPlaybackWindow();
+
+ private:
+ QMPXVideoPlaybackControlsController *mController;
+};
+
+#endif /*MPXVIDEOPLAYBACKDETAILSPLAYBACKWINDOW_H_*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdocumentloader/stub/inc/mpxvideoplaybackfiledetailswidget.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackFileDetailsWidget
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKFILEDETAILSWIDGET_H_
+#define MPXVIDEOPLAYBACKFILEDETAILSWIDGET_H_
+
+#include <qobject>
+
+class QMPXVideoPlaybackControlsController;
+
+
+class QMPXVideoPlaybackFileDetailsWidget : public QObject
+{
+ Q_OBJECT
+
+ public:
+ QMPXVideoPlaybackFileDetailsWidget( QMPXVideoPlaybackControlsController* controller );
+ virtual ~QMPXVideoPlaybackFileDetailsWidget();
+
+ private:
+ QMPXVideoPlaybackControlsController *mController;
+};
+
+#endif /*MPXVIDEOPLAYBACKFILEDETAILSWIDGET_H_*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdocumentloader/stub/inc/mpxvideoplaybacknontouchvolumebar.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,38 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackNonTouchVolumeBar
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKNONTOUCHVOLUMEBAR_H_
+#define MPXVIDEOPLAYBACKNONTOUCHVOLUMEBAR_H_
+
+#include <qobject>
+
+class QMPXVideoPlaybackNonTouchVolumeBar : public QObject
+{
+ Q_OBJECT
+
+ public:
+ QMPXVideoPlaybackNonTouchVolumeBar();
+
+ virtual ~QMPXVideoPlaybackNonTouchVolumeBar();
+};
+
+#endif /*MPXVIDEOPLAYBACKNONTOUCHVOLUMEBAR_H_*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdocumentloader/stub/inc/mpxvideoplaybackprogressbar.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,42 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackProgressBar
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKPROGRESSBAR_H_
+#define MPXVIDEOPLAYBACKPROGRESSBAR_H_
+
+#include <qobject>
+
+class QMPXVideoPlaybackControlsController;
+
+class QMPXVideoPlaybackProgressBar : public QObject
+{
+ Q_OBJECT
+
+ public:
+ QMPXVideoPlaybackProgressBar( QMPXVideoPlaybackControlsController* controller );
+ virtual ~QMPXVideoPlaybackProgressBar();
+
+ public:
+ QMPXVideoPlaybackControlsController *mController;
+};
+
+#endif /*MPXVIDEOPLAYBACKPROGRESSBAR_H_*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdocumentloader/stub/src/mpxvideoplaybackbuttonbar.cpp Thu Apr 01 23:22:15 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: Implementation of QMPXVideoPlaybackButtonBar
+*
+*/
+
+// Version : %version: 1 %
+
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackbuttonbar.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackButtonBar::QMPXVideoPlaybackButtonBar()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackButtonBar::QMPXVideoPlaybackButtonBar(
+ QMPXVideoPlaybackControlsController* controller )
+ : mController( controller )
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackButtonBar::QMPXVideoPlaybackButtonBar"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackButtonBar::~QMPXVideoPlaybackButtonBar()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackButtonBar::~QMPXVideoPlaybackButtonBar()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::~QMPXVideoPlaybackButtonBar()"));
+}
+
+//End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdocumentloader/stub/src/mpxvideoplaybackcontrolscontroller.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,84 @@
+/*
+* 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: Implementation of MPXVideoPlaybackControlsController
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+// INCLUDE FILES
+
+
+#include "mpxvideoplaybackcontrolscontroller.h"
+
+// ================= MEMBER FUNCTIONS ==============================================================
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::QMPXVideoPlaybackControlsController()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackControlsController::QMPXVideoPlaybackControlsController()
+ : mViewMode( EFullScreenView )
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::QMPXVideoPlaybackControlsController()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleCommand()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleCommand(
+ TMPXVideoPlaybackViewCommandIds command, int value )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::handleCommand(%d)"), command);
+
+ mCommand = command;
+ mCommandValue = value;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::changeViewMode
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::changeViewMode(
+ TPlaybackViewMode viewMode, bool transitionEffect )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::changeViewMode()"));
+
+ mViewMode = viewMode;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::resetDisappearingTimers()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::resetDisappearingTimers( TMPXTimerAction timerAction )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::resetDisappearingTimers()"));
+
+ mTimerAction = timerAction;
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdocumentloader/stub/src/mpxvideoplaybackdetailsplaybackwindow.cpp Thu Apr 01 23:22:15 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: Implementation of QMPXVideoPlaybackProgressBar
+*
+*/
+
+// Version : %version: 1 %
+
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+#include "mpxvideoplaybackdetailsplaybackwindow.h"
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDetailsPlaybackWindow::QMPXVideoPlaybackDetailsPlaybackWindow
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackDetailsPlaybackWindow::QMPXVideoPlaybackDetailsPlaybackWindow(
+ QMPXVideoPlaybackControlsController* controller )
+ : mController( controller )
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackDetailsPlaybackWindow::QMPXVideoPlaybackDetailsPlaybackWindow()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDetailsPlaybackWindow::~QMPXVideoPlaybackDetailsPlaybackWindow
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackDetailsPlaybackWindow::~QMPXVideoPlaybackDetailsPlaybackWindow()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackDetailsPlaybackWindow::~QMPXVideoPlaybackDetailsPlaybackWindow()"));
+}
+
+//End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdocumentloader/stub/src/mpxvideoplaybackfiledetailswidget.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackFileDetailsWidget
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackfiledetailswidget.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFileDetailsWidget::QMPXVideoPlaybackFileDetailsWidget
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackFileDetailsWidget::QMPXVideoPlaybackFileDetailsWidget(
+ QMPXVideoPlaybackControlsController* controller )
+ : mController( controller )
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackFileDetailsWidget::QMPXVideoPlaybackFileDetailsWidget()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFileDetailsWidget::~QMPXVideoPlaybackFileDetailsWidget
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackFileDetailsWidget::~QMPXVideoPlaybackFileDetailsWidget()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackFileDetailsWidget::~QMPXVideoPlaybackFileDetailsWidget()"));
+
+}
+
+//End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdocumentloader/stub/src/mpxvideoplaybacknontouchvolumebar.cpp Thu Apr 01 23:22:15 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: Implementation of QMPXVideoPlaybackNonTouchVolumeBar
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+#include "mpxvideoplaybacknontouchvolumebar.h"
+
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackNonTouchVolumeBar::QMPXVideoPlaybackNonTouchVolumeBar()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackNonTouchVolumeBar::QMPXVideoPlaybackNonTouchVolumeBar()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackNonTouchVolumeBar::QMPXVideoPlaybackNonTouchVolumeBar()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackNonTouchVolumeBar::~QMPXVideoPlaybackNonTouchVolumeBar()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackNonTouchVolumeBar::~QMPXVideoPlaybackNonTouchVolumeBar()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackNonTouchVolumeBar::QMPXVideoPlaybackNonTouchVolumeBar"));
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdocumentloader/stub/src/mpxvideoplaybackprogressbar.cpp Thu Apr 01 23:22:15 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: Implementation of QMPXVideoPlaybackProgressBar
+*
+*/
+
+// Version : %version: 1 %
+
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackprogressbar.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackProgressBar::QMPXVideoPlaybackProgressBar
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackProgressBar::QMPXVideoPlaybackProgressBar(
+ QMPXVideoPlaybackControlsController* controller )
+ : mController( controller )
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackProgressBar::QMPXVideoPlaybackProgressBar()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackProgressBar::~QMPXVideoPlaybackProgressBar
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackProgressBar::~QMPXVideoPlaybackProgressBar()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackProgressBar::~QMPXVideoPlaybackProgressBar()"));
+}
+
+//End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackdocumentloader/testmpxvideoplaybackdocumentloader.pro Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,47 @@
+#
+# 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: Project file for building testmpxvideoplaybackdocumentloader
+#
+#
+# Version : %version: 1 %
+
+TEMPLATE = app
+TARGET = testmpxvideoplaybackdocumentloader
+CONFIG += qtestlib qt hb
+
+INCLUDEPATH += stub/inc \
+ ../../../../inc \
+ ../../../inc
+
+
+DEPENDPATH += inc src stub/inc stub/src
+
+# Input
+HEADERS += testmpxvideoplaybackdocumentloader.h \
+ mpxvideoplaybackcontrolscontroller.h \
+ mpxvideoplaybackfiledetailswidget.h \
+ mpxvideoplaybackdetailsplaybackwindow.h \
+ mpxvideoplaybackprogressbar.h \
+ mpxvideoplaybackbuttonbar.h \
+ mpxvideoplaybacknontouchvolumebar.h \
+ ../../controlinc/mpxvideoplaybackdocumentloader.h
+
+SOURCES += testmpxvideoplaybackdocumentloader.cpp \
+ mpxvideoplaybackcontrolscontroller.cpp \
+ mpxvideoplaybackfiledetailswidget.cpp \
+ mpxvideoplaybackdetailsplaybackwindow.cpp \
+ mpxvideoplaybackprogressbar.cpp \
+ mpxvideoplaybackbuttonbar.cpp \
+ mpxvideoplaybacknontouchvolumebar.cpp \
+ ../../controlsrc/mpxvideoplaybackdocumentloader.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackfiledetailswidget/inc/testmpxvideoplaybackfiledetailswidget.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,85 @@
+/**
+* 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: tester for methods in TestMPXVideoPlaybackFileDetailsWidget
+*
+*/
+
+// Version : %version: 1 %
+
+#ifndef __TESTMPXVIDEOPLAYBACKFILEDETAILSWIDGET_H__
+#define __TESTMPXVIDEOPLAYBACKFILEDETAILSWIDGET_H__
+
+
+// INCLUDES
+#include <QtTest/QtTest>
+
+class QMPXVideoPlaybackFileDetailsWidget;
+class QMPXVideoPlaybackControlsController;
+
+class TestMPXVideoPlaybackFileDetailsWidget : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * will be called before each testfunction is executed.
+ *
+ */
+ void init();
+
+ /**
+ * will be called after every testfunction.
+ *
+ */
+ void cleanup();
+
+ // test functions for the test framework
+private slots:
+
+ // the order in which these testXX methods are declared is important
+ // changing this order will affect the test results
+ void testTitle();
+ void testDescription();
+ void testDuration();
+ void testDate();
+ void testLocation();
+ void testAuthor();
+ void testCopyright();
+ void testLanguage();
+ void testKeywords();
+ void testSize();
+ void testResolution();
+ void testFormat();
+ void testBitrate();
+ void testFolder();
+
+private:
+ void verifyResult( QString primaryText,
+ bool exist,
+ QString expectedSecondaryText = "",
+ bool needToBeCompared = true );
+
+signals:
+ void commandSignal(int);
+
+private:
+ QMPXVideoPlaybackFileDetailsWidget* mWidget;
+ QMPXVideoPlaybackControlsController* mController;
+};
+
+
+#endif // __TESTMPXVIDEOPLAYBACKFILEDETAILSWIDGET_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackfiledetailswidget/src/testmpxvideoplaybackfiledetailswidget.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,542 @@
+/**
+* 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: tester for methods in TestMPXVideoPlaybackFileDetailsWidget
+*
+*/
+
+// Version : %version: 1 %
+
+
+#include <qdebug>
+#include <hbmainwindow.h>
+#include <hbapplication.h>
+#include <hblistwidget.h>
+#include <hblistwidgetitem.h>
+
+#include "mpxvideoplaybackviewfiledetails.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+#include "testmpxvideoplaybackfiledetailswidget.h"
+
+#define private public
+#include "mpxvideoplaybackfiledetailswidget.h"
+#undef private
+
+const QString KFILEPATH = "C:\\data\\qvptestconf.txt";
+
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackFileDetailsWidget::Main()"));
+
+ HbApplication app(argc, argv);
+ HbMainWindow window;
+
+ TestMPXVideoPlaybackFileDetailsWidget tv;
+
+ char *pass[3];
+ pass[0] = argv[0];
+ pass[1] = "-o";
+ pass[2] = "c:\\data\\testmpxvideoplaybackfiledetailswidget.txt";
+
+ int res = QTest::qExec(&tv, 3, pass);
+
+ return res;
+}
+
+
+// ---------------------------------------------------------------------------
+// init
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackFileDetailsWidget::init()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackFileDetailsWidget::init()"));
+
+ mController = new QMPXVideoPlaybackControlsController();
+ mWidget = new QMPXVideoPlaybackFileDetailsWidget( mController );
+}
+
+// ---------------------------------------------------------------------------
+// cleanup
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackFileDetailsWidget::cleanup()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackFileDetailsWidget::cleanup()"));
+
+ if ( mController )
+ {
+ delete mController;
+ mController = NULL;
+ }
+
+ if ( mWidget )
+ {
+ delete mWidget;
+ mWidget = NULL;
+ }
+}
+
+// ---------------------------------------------------------------------------
+// testTitle
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackFileDetailsWidget::testTitle()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackFileDetailsWidget::testTitle()"));
+
+ init();
+
+ QMPXVideoPlaybackViewFileDetails *details = mController->fileDetails();
+
+ //
+ // For Audio only view
+ //
+ mController->mViewMode = EAudioOnlyView;
+
+ // If title information is available
+ details->mTitle = "Title for Test clip";
+ mWidget->updateWithFileDetails( details );
+ verifyResult( "Title", true, details->mTitle );
+
+ mWidget->mListWidget->clear();
+ mWidget->mFileDetailsUpdated = false;
+
+ // If title informatio is not available
+ details->mTitle = "";
+ details->mClipName = KFILEPATH;
+
+ mWidget->updateWithFileDetails( details );
+ verifyResult( "Title", true, "qvptestconf" );
+
+ mWidget->mListWidget->clear();
+ mWidget->mFileDetailsUpdated = false;
+
+ //
+ // For Details view
+ //
+ mController->mViewMode = EFullScreenView;
+
+ mWidget->updateWithFileDetails( details );
+
+ verifyResult( "Title", false );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testDescription
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackFileDetailsWidget::testDescription()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackFileDetailsWidget::testDescription()"));
+
+ init();
+
+ QMPXVideoPlaybackViewFileDetails *details = mController->fileDetails();
+ details->mDescription = "This is for unit test";
+
+ mWidget->updateWithFileDetails( details );
+
+ verifyResult( "Description", true, details->mDescription );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testDate
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackFileDetailsWidget::testDuration()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackFileDetailsWidget::testDuration()"));
+
+ init();
+
+ QMPXVideoPlaybackViewFileDetails *details = mController->fileDetails();
+
+ //
+ // If it's local mode, need to show the duration
+ //
+ details->mPlaybackMode = EMPXVideoLiveStreaming;
+ details->mDuration = 3700000;
+
+ mWidget->updateWithFileDetails( details );
+
+ verifyResult( "Duration", "" );
+
+ mWidget->mListWidget->clear();
+ mWidget->mFileDetailsUpdated = false;
+
+ //
+ // If it's local mode, need to show the duration
+ //
+ details->mPlaybackMode = EMPXVideoLocal;
+ details->mDuration = 3700000;
+
+ mWidget->updateWithFileDetails( details );
+
+ verifyResult( "Duration", true, "1 hr 1 min 40 sec " );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testDate
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackFileDetailsWidget::testDate()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackFileDetailsWidget::testDate()"));
+
+ init();
+
+ QMPXVideoPlaybackViewFileDetails *details = mController->fileDetails();
+
+ //
+ // If it is streaming case, we don't show size information
+ //
+ details->mClipName = KFILEPATH;
+ details->mPlaybackMode = EMPXVideoStreaming;
+ mWidget->updateWithFileDetails( details );
+
+ verifyResult( "Date", false );
+ verifyResult( "Modified", false );
+
+ mWidget->mListWidget->clear();
+ mWidget->mFileDetailsUpdated = false;
+
+ //
+ // If it is local, we show size information
+ //
+ details->mClipName = KFILEPATH;
+ details->mPlaybackMode = EMPXVideoLocal;
+ mWidget->updateWithFileDetails( details );
+
+ verifyResult( "Date", true, "", false );
+ verifyResult( "Modified", true, "", false );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testLocation
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackFileDetailsWidget::testLocation()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackFileDetailsWidget::testLocation()"));
+
+ init();
+
+ QMPXVideoPlaybackViewFileDetails *details = mController->fileDetails();
+ details->mLocation = "C:\\data\\Videos\\";
+
+ mWidget->updateWithFileDetails( details );
+
+ verifyResult( "Location", true, details->mLocation );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testAuthor
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackFileDetailsWidget::testAuthor()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackFileDetailsWidget::testAuthor()"));
+
+ init();
+
+ QMPXVideoPlaybackViewFileDetails *details = mController->fileDetails();
+ details->mArtist = "Fusion";
+
+ mWidget->updateWithFileDetails( details );
+
+ verifyResult( "Author", true, details->mArtist );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testCopyright
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackFileDetailsWidget::testCopyright()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackFileDetailsWidget::testCopyright()"));
+
+ init();
+
+ QMPXVideoPlaybackViewFileDetails *details = mController->fileDetails();
+ details->mCopyright = "Fusion team";
+
+ mWidget->updateWithFileDetails( details );
+
+ verifyResult( "Copyright", true, details->mCopyright );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testLanguage
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackFileDetailsWidget::testLanguage()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackFileDetailsWidget::testLanguage()"));
+
+ init();
+
+ QMPXVideoPlaybackViewFileDetails *details = mController->fileDetails();
+ details->mLanguage = "English";
+
+ mWidget->updateWithFileDetails( details );
+
+ verifyResult( "Language", true, details->mLanguage );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testKeywords
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackFileDetailsWidget::testKeywords()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackFileDetailsWidget::testKeywords()"));
+
+ init();
+
+ QMPXVideoPlaybackViewFileDetails *details = mController->fileDetails();
+ details->mKeywords = "QTest";
+
+ mWidget->updateWithFileDetails( details );
+
+ verifyResult( "Keywords", true, details->mKeywords );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testSize
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackFileDetailsWidget::testSize()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackFileDetailsWidget::testSize()"));
+
+ init();
+
+ QMPXVideoPlaybackViewFileDetails *details = mController->fileDetails();
+
+ //
+ // If it is streaming case, we don't show size information
+ //
+ details->mPlaybackMode = EMPXVideoStreaming;
+ details->mClipName = KFILEPATH;
+
+ mWidget->updateWithFileDetails( details );
+
+ verifyResult( "Size", false );
+
+ mWidget->mListWidget->clear();
+ mWidget->mFileDetailsUpdated = false;
+
+ //
+ // If it is local, we show size information
+ //
+ details->mPlaybackMode = EMPXVideoLocal;
+ mWidget->updateWithFileDetails( details );
+
+ verifyResult( "Size", true, "", false );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testResolution
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackFileDetailsWidget::testResolution()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackFileDetailsWidget::testResolution()"));
+
+ init();
+
+ QMPXVideoPlaybackViewFileDetails *details = mController->fileDetails();
+
+ //
+ // If it is audio only clip, don't need to show resolution
+ //
+ details->mVideoEnabled = false;
+
+ mWidget->updateWithFileDetails( details );
+
+ verifyResult( "Resolution", false );
+
+ mWidget->mListWidget->clear();
+ mWidget->mFileDetailsUpdated = false;
+
+ //
+ // If it has video track
+ //
+ details->mVideoEnabled = true;
+ details->mVideoWidth = 640;
+ details->mVideoHeight = 360;
+
+ mWidget->updateWithFileDetails( details );
+
+ QString resolution = QString("%1 x %2")
+ .arg( details->mVideoWidth ).arg( details->mVideoHeight );
+
+ verifyResult( "Resolution", true, resolution );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testFormat
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackFileDetailsWidget::testFormat()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackFileDetailsWidget::testFormat()"));
+
+ init();
+
+ QMPXVideoPlaybackViewFileDetails *details = mController->fileDetails();
+ details->mMimeType = "Nothing";
+
+ mWidget->updateWithFileDetails( details );
+
+ verifyResult( "Format", true, details->mMimeType );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testBitrate
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackFileDetailsWidget::testBitrate()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackFileDetailsWidget::testBitrate()"));
+
+
+ init();
+
+ QMPXVideoPlaybackViewFileDetails *details = mController->fileDetails();
+ details->mBitRate = 1024;
+
+ mWidget->updateWithFileDetails( details );
+
+ verifyResult( "Bitrate", true, "1024 Kbps" );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testFolder
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackFileDetailsWidget::testFolder()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackFileDetailsWidget::testFolder()"));
+
+ init();
+
+ QMPXVideoPlaybackViewFileDetails *details = mController->fileDetails();
+
+ //
+ // If it is streaming case, we don't show folder information
+ //
+ details->mPlaybackMode = EMPXVideoStreaming;
+ details->mClipName = KFILEPATH;
+
+ mWidget->updateWithFileDetails( details );
+
+ verifyResult( "Collection", false );
+
+ mWidget->mListWidget->clear();
+ mWidget->mFileDetailsUpdated = false;
+
+ //
+ // If it is local case, we show folder information
+ //
+ details->mPlaybackMode = EMPXVideoLocal;
+
+ mWidget->updateWithFileDetails( details );
+
+ verifyResult( "Collection", true, "", false );
+
+ cleanup();
+
+}
+
+// ---------------------------------------------------------------------------
+// verifyResult
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackFileDetailsWidget::verifyResult(
+ QString primaryText, bool exist, QString expectedSecondaryText, bool needToBeCompared )
+{
+ QString secondaryText = "";
+ int i = 0;
+
+ for( ; i < mWidget->mListWidget->count() ; i++ )
+ {
+ HbListWidgetItem *item = mWidget->mListWidget->item( i );
+
+ if ( item->text() == primaryText )
+ {
+ secondaryText = item->secondaryText();
+ break;
+ }
+ }
+
+ //
+ // If the item needs to be existed in HbListWidget, check the result
+ //
+ if ( exist )
+ {
+ if ( needToBeCompared )
+ {
+ QVERIFY( expectedSecondaryText == secondaryText );
+ }
+ else
+ {
+ //
+ // Doens't need to compare the secondary text. Just make sure it's in the list
+ //
+ QVERIFY( i < mWidget->mListWidget->count() );
+ }
+
+ }
+ //
+ // If not, just make sure that item is not in the list
+ //
+ else
+ {
+ QVERIFY( i == mWidget->mListWidget->count() );
+ }
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackfiledetailswidget/stub/inc/hbglobal.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,47 @@
+/*
+* 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: class for HbGlobal
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef HBGLOBAL_H
+#define HBGLOBAL_H
+
+#include <QtGlobal>
+
+#ifdef BUILD_HB_CORE
+# define HB_CORE_EXPORT Q_DECL_EXPORT
+# define HB_CORE_PRIVATE_EXPORT Q_DECL_EXPORT
+#else
+# define HB_CORE_EXPORT Q_DECL_IMPORT
+# define HB_CORE_PRIVATE_EXPORT Q_DECL_IMPORT
+#endif // BUILD_HB_CORE
+
+#ifdef BUILD_HB_WIDGETS
+# define HB_WIDGETS_EXPORT Q_DECL_EXPORT
+# define HB_WIDGETS_PRIVATE_EXPORT Q_DECL_EXPORT
+#else
+# define HB_WIDGETS_EXPORT Q_DECL_IMPORT
+# define HB_WIDGETS_PRIVATE_EXPORT Q_DECL_IMPORT
+#endif // BUILD_HB_WIDGETS
+
+
+QString hbTrId( QString string, int n = -1 );
+
+
+#endif // HBGLOBAL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackfiledetailswidget/stub/inc/mpxvideoplaybackcontrolscontroller.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,156 @@
+/*
+* 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: Implementation of MPXVideoPlaybackControlsController
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_
+#define MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_
+
+// INCLUDES
+#include <qobject>
+#include <mpxplaybackframeworkdefs.h>
+
+#include "mpxvideo_debug.h"
+#include "mpxhelixplaybackplugindefs.h"
+#include "mpxcommonvideoplaybackview.hrh"
+#include "mpxvideoplaybackviewfiledetails.h"
+
+// FORWARD DECLARATIONS
+class QMPXVideoPlaybackDocumentLoader;
+
+
+// DATA TYPES
+
+enum TMPXTimerAction
+{
+ EMPXTimerCancel,
+ EMPXTimerReset
+};
+
+enum TPlaybackViewMode
+{
+ EFullScreenView,
+ EDetailsView,
+ EAudioOnlyView
+};
+
+const QString KMPXPLAYBACKVIEW_XML = ":/hbvideoplaybackview/hbvideoplaybackview.docml";
+
+// CLASS DECLARATION
+
+class QMPXVideoPlaybackControlsController : public QObject
+{
+ Q_OBJECT
+
+ public:
+
+ /**
+ * constructor.
+ */
+ QMPXVideoPlaybackControlsController();
+
+ /**
+ * Destructor.
+ */
+ virtual ~QMPXVideoPlaybackControlsController();
+
+ public:
+
+ /**
+ * Command handling function.
+ * Call HandleCommandL() of container
+ */
+ void handleCommand( TMPXVideoPlaybackViewCommandIds command, int value = 0 );
+
+ /**
+ * Reset or cancel timers for the controls
+ */
+ void resetDisappearingTimers( TMPXTimerAction timerAction );
+
+ /**
+ * Return state
+ */
+ inline TMPXPlaybackState state();
+
+ /**
+ * Return file details
+ */
+ inline QMPXVideoPlaybackViewFileDetails* fileDetails();
+
+ inline QMPXVideoPlaybackDocumentLoader* layoutLoader();
+
+ TPlaybackViewMode viewMode();
+
+ void changeViewMode( TPlaybackViewMode viewMode, bool transitionEffect = true );
+
+ public:
+ QMPXVideoPlaybackViewFileDetails *mFileDetails;
+ QMPXVideoPlaybackDocumentLoader *mLoader;
+
+ TMPXPlaybackState mState;
+ TPlaybackViewMode mViewMode;
+ TMPXTimerAction mTimerAction;
+ TMPXVideoPlaybackViewCommandIds mCommand;
+ int mCommandValue;
+};
+
+// INLINE METHODS
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::state
+// -------------------------------------------------------------------------------------------------
+//
+inline
+TMPXPlaybackState QMPXVideoPlaybackControlsController::state()
+{
+ return mState;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::fileDetails
+// -------------------------------------------------------------------------------------------------
+//
+inline
+QMPXVideoPlaybackViewFileDetails* QMPXVideoPlaybackControlsController::fileDetails()
+{
+ return mFileDetails;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::layoutLoader
+// -------------------------------------------------------------------------------------------------
+//
+inline
+QMPXVideoPlaybackDocumentLoader* QMPXVideoPlaybackControlsController::layoutLoader()
+{
+ return mLoader;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::viewMode
+// -------------------------------------------------------------------------------------------------
+//
+inline
+TPlaybackViewMode QMPXVideoPlaybackControlsController::viewMode()
+{
+ return mViewMode;
+}
+
+#endif /*MPXVIDEOPLAYBACKCONTROLSCONTROLLER_P_H_*/
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackfiledetailswidget/stub/inc/mpxvideoplaybackdocumentloader.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,52 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackDocumentLoader
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKDOCUMENTHANDLER_H_
+#define MPXVIDEOPLAYBACKDOCUMENTHANDLER_H_
+
+
+#include <qobject>
+
+class QList;
+class QGraphicsWidget;
+class QMPXVideoPlaybackControlsController;
+
+class QMPXVideoPlaybackDocumentLoader : public QObject
+{
+ public:
+ QMPXVideoPlaybackDocumentLoader();
+
+ virtual ~QMPXVideoPlaybackDocumentLoader();
+
+ public:
+ QGraphicsWidget* findWidget( const QString &name );
+ void load( const QString &fileName, const QString §ion , bool *ok );
+
+ private:
+ QGraphicsWidget* createWidget( const QString &name );
+ int exist( const QString &name );
+
+ private:
+ QList<QGraphicsWidget*> mWidgets;
+};
+
+#endif /*MPXVIDEOPLAYBACKDOCUMENTHANDLER_H_*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackfiledetailswidget/stub/inc/mpxvideoplaybackviewfiledetails.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* 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: MPX Video File Details (QT)
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+
+#ifndef __MPXVIDEOPLAYBACKVIEWFILEDETAILS__
+#define __MPXVIDEOPLAYBACKVIEWFILEDETAILS__
+
+#include <qobject.h>
+#include "mpxhelixplaybackplugindefs.h"
+
+
+//
+// CLASS DECLARATION
+//
+class QMPXVideoPlaybackViewFileDetails : public QObject
+{
+ public:
+ //
+ // Constructor
+ //
+ QMPXVideoPlaybackViewFileDetails();
+
+ //
+ // Destructor.
+ //
+ virtual ~QMPXVideoPlaybackViewFileDetails();
+
+ //
+ // Clear all file details
+ //
+ void clearFileDetails();
+
+ public:
+ //
+ // Data
+ //
+ QString mClipName;
+ QString mTitle;
+ QString mArtist;
+ QString mMimeType;
+ QString mDescription;
+ QString mLocation;
+ QString mCopyright;
+ QString mLanguage;
+ QString mKeywords;
+
+ TMPXVideoMode mPlaybackMode;
+ bool mSeekable;
+ bool mPausableStream;
+ bool mAudioEnabled;
+ bool mVideoEnabled;
+ bool mPartialPlayback;
+ bool mRNFormat;
+ bool mTvOutConnected;
+ bool mTvOutPlayAllowed;
+ bool mDrmProtected;
+ bool mMultiItemPlaylist;
+
+ int mVideoHeight;
+ int mVideoWidth;
+ int mBitRate;
+ int mDuration;
+};
+
+#endif // __MPXVIDEOPLAYBACKVIEWFILEDETAILS__
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackfiledetailswidget/stub/src/hbglobal.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,95 @@
+/*
+* 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: class for HbGlobal
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#include "hbglobal.h"
+#include <qstring>
+
+
+QString hbTrId( QString string, int n )
+{
+ Q_UNUSED( n );
+
+ QString loc = "";
+
+ if ( string == "txt_videos_list_description" )
+ {
+ loc = "Description";
+ }
+ else if ( string == "txt_videos_list_duration" )
+ {
+ loc = "Duration";
+ }
+ else if ( string == "txt_videos_list_date" )
+ {
+ loc = "Date";
+ }
+ else if ( string == "txt_videos_list_modified" )
+ {
+ loc = "Modified";
+ }
+ else if ( string == "txt_videos_list_location" )
+ {
+ loc = "Location";
+ }
+ else if ( string == "txt_videos_list_author" )
+ {
+ loc = "Author";
+ }
+ else if ( string == "txt_videos_list_copyright" )
+ {
+ loc = "Copyright";
+ }
+ else if ( string == "txt_videos_list_language" )
+ {
+ loc = "Language";
+ }
+ else if ( string == "txt_videos_list_keywords" )
+ {
+ loc = "Keywords";
+ }
+ else if ( string == "txt_videos_list_resolution" )
+ {
+ loc = "Resolution";
+ }
+ else if ( string == "txt_videos_list_format" )
+ {
+ loc = "Format";
+ }
+ else if ( string == "txt_videos_list_collection_name" )
+ {
+ loc = "Collection";
+ }
+ else if ( string == "txt_videos_title_videos" )
+ {
+ loc = "Title";
+ }
+ else if ( string == "txt_videos_list_file_size" )
+ {
+ loc = "Size";
+ }
+ else if ( string == "txt_videos_list_bitrate" )
+ {
+ loc = "Bitrate";
+ }
+ return loc;
+}
+
+//End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackfiledetailswidget/stub/src/mpxvideoplaybackcontrolscontroller.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,89 @@
+/*
+* 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: Implementation of MPXVideoPlaybackControlsController
+*
+*/
+
+// Version : %version: 2 %
+
+
+
+// INCLUDE FILES
+
+
+#include "mpxvideoplaybackdocumentloader.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+
+// ================= MEMBER FUNCTIONS ==============================================================
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::QMPXVideoPlaybackControlsController()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackControlsController::QMPXVideoPlaybackControlsController()
+ : mViewMode( EFullScreenView )
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::QMPXVideoPlaybackControlsController()"));
+
+ mLoader = new QMPXVideoPlaybackDocumentLoader();
+ mFileDetails = new QMPXVideoPlaybackViewFileDetails();
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleCommand()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleCommand(
+ TMPXVideoPlaybackViewCommandIds command, int value )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::handleCommand(%d)"), command);
+
+ mCommand = command;
+ mCommandValue = value;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::changeViewMode
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::changeViewMode(
+ TPlaybackViewMode viewMode, bool transitionEffect )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::changeViewMode()"));
+
+ Q_UNUSED( transitionEffect );
+ mViewMode = viewMode;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::resetDisappearingTimers()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::resetDisappearingTimers( TMPXTimerAction timerAction )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::resetDisappearingTimers()"));
+
+ mTimerAction = timerAction;
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackfiledetailswidget/stub/src/mpxvideoplaybackdocumentloader.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,133 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackDocumentLoader
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#include <hblistwidget.h>
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackdocumentloader.h"
+
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::~QMPXVideoPlaybackDocumentLoader
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackDocumentLoader::~QMPXVideoPlaybackDocumentLoader()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader") );
+
+ for ( int i = 0 ; i < mWidgets.count() ; i++ )
+ {
+ mWidgets.removeAt( 0 );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::findWidget()
+// -------------------------------------------------------------------------------------------------
+//
+QGraphicsWidget *QMPXVideoPlaybackDocumentLoader::findWidget( const QString &name )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::findWidget") );
+
+ QGraphicsWidget *object = NULL;
+
+ int index = exist( name );
+
+ if ( index == -1 )
+ {
+ object = createWidget( name );
+ }
+ else
+ {
+ object = mWidgets[ index ];
+ }
+
+ return object;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::createWidget()
+// -------------------------------------------------------------------------------------------------
+//
+QGraphicsWidget *QMPXVideoPlaybackDocumentLoader::createWidget( const QString &name )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::createWidget") );
+
+ QGraphicsWidget *object = NULL;
+
+ if ( name == "fileDetails" )
+ {
+ object = new HbListWidget();
+ object->setObjectName( name );
+ mWidgets.append( object );
+ }
+
+ return object;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::exist()
+// -------------------------------------------------------------------------------------------------
+//
+int QMPXVideoPlaybackDocumentLoader::exist( const QString &name )
+{
+ int i = 0;
+
+ for ( ; i < mWidgets.count() ; i++ )
+ {
+ if( mWidgets[i]->objectName() == name )
+ {
+ break;
+ }
+ }
+
+ if ( i == mWidgets.count() )
+ {
+ i = -1;
+ }
+
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::exist %d"), i );
+
+ return i;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::load()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackDocumentLoader::load(
+ const QString &fileName, const QString §ion , bool *ok )
+{
+ Q_UNUSED( fileName );
+ Q_UNUSED( section );
+ Q_UNUSED( ok );
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackfiledetailswidget/stub/src/mpxvideoplaybackviewfiledetails.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* 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: class for MPX Video File Details (Qt)
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+//
+// INCLUDE FILES
+//
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackviewfiledetails.h"
+
+
+// ============================ MEMBER FUNCTIONS ===================================================
+
+QMPXVideoPlaybackViewFileDetails::QMPXVideoPlaybackViewFileDetails()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackViewFileDetails::QMPXVideoPlaybackViewFileDetails()"));
+
+ clearFileDetails();
+}
+
+QMPXVideoPlaybackViewFileDetails::~QMPXVideoPlaybackViewFileDetails()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackViewFileDetails::~QMPXVideoPlaybackViewFileDetails()"));
+
+ clearFileDetails();
+}
+
+void
+QMPXVideoPlaybackViewFileDetails::clearFileDetails()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackViewFileDetails::ClearFileDetails()"));
+
+ mMimeType = tr("");
+ mTitle = tr("");
+ mArtist = tr("");
+ mClipName = tr("");
+ mDescription = tr("");
+ mLocation = tr("");
+ mCopyright = tr("");
+ mLanguage = tr("");
+ mKeywords = tr("");
+
+ mPlaybackMode = EMPXVideoLocal;
+ mSeekable = false;
+ mPausableStream = false;
+ mAudioEnabled = false;
+ mVideoEnabled = false;
+ mPartialPlayback = false;
+ mRNFormat = false;
+
+ mDuration = 0;
+ mTvOutConnected = false;
+ mTvOutPlayAllowed = true;
+ mDrmProtected = false;
+
+ mVideoHeight = 0;
+ mVideoWidth = 0;
+ mBitRate = 0;
+}
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackfiledetailswidget/testmpxvideoplaybackfiledetailswidget.pro Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,42 @@
+#
+# 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: Project file for building testmpxvideoplaybackfiledetailswidget
+#
+#
+# Version : %version: 2 %
+
+TEMPLATE = app
+TARGET = testmpxvideoplaybackfiledetailswidget
+CONFIG += qtestlib qt hb
+
+INCLUDEPATH += stub/inc \
+ ../../../../inc \
+ ../../../inc
+
+DEPENDPATH += inc src stub/inc stub/src
+
+# Input
+HEADERS += testmpxvideoplaybackfiledetailswidget.h \
+ mpxvideoplaybackcontrolscontroller.h \
+ mpxvideoplaybackdocumentloader.h \
+ mpxvideoplaybackviewfiledetails.h \
+ hbglobal.h \
+ ../../controlinc/mpxvideoplaybackfiledetailswidget.h
+
+SOURCES += testmpxvideoplaybackfiledetailswidget.cpp \
+ mpxvideoplaybackcontrolscontroller.cpp \
+ mpxvideoplaybackdocumentloader.cpp \
+ mpxvideoplaybackviewfiledetails.cpp \
+ hbglobal.cpp \
+ ../../controlsrc/mpxvideoplaybackfiledetailswidget.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackvolumebar/inc/testmpxvideoplaybackvolumebar.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,68 @@
+/**
+* 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: tester for methods in TestMPXVideoPlaybackVolumeBar
+*
+*/
+
+// Version : %version: 1 %
+
+#ifndef __TESTMPXVIDEOPLAYBACKVOLUMEBAR_H__
+#define __TESTMPXVIDEOPLAYBACKVOLUMEBAR_H__
+
+
+// INCLUDES
+#include <QtTest/QtTest>
+
+class QMPXVideoPlaybackNonTouchVolumeBar;
+
+class TestMPXVideoPlaybackVolumeBar : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * will be called before each testfunction is executed.
+ *
+ */
+ void init();
+
+ /**
+ * will be called after every testfunction.
+ *
+ */
+ void cleanup();
+
+ // test functions for the test framework
+private slots:
+
+ // the order in which these testXX methods are declared is important
+ // changing this order will affect the test results
+ void testSetVisible();
+ void testHideVolumeControl();
+ void testMousePressEvent();
+ void testMouseReleaseEvent();
+
+
+signals:
+ void commandSignal();
+
+private:
+ QMPXVideoPlaybackNonTouchVolumeBar* mVolumeBar;
+};
+
+
+#endif // __TESTMPXVIDEOPLAYBACKVOLUMEBAR_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackvolumebar/src/testmpxvideoplaybackvolumebar.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,173 @@
+/**
+* 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: tester for methods in TestMPXVideoPlaybackVolumeBar
+*
+*/
+
+// Version : %version: 2 %
+
+
+#include <qdebug>
+#include <qtimer>
+#include <qgraphicsscenemouseevent>
+
+#include <hbmainwindow.h>
+#include <hbapplication.h>
+#include <hbvolumeslider.h>
+
+#include "mpxvideo_debug.h"
+#include "testmpxvideoplaybackvolumebar.h"
+
+#define private public
+#include "mpxvideoplaybacknontouchvolumebar.h"
+#undef private
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackVolumeBar::Main()"));
+
+ HbApplication app(argc, argv);
+ HbMainWindow window;
+
+ TestMPXVideoPlaybackVolumeBar tv;
+
+ char *pass[3];
+ pass[0] = argv[0];
+ pass[1] = "-o";
+ pass[2] = "c:\\data\\testmpxvideoplaybackvolumebar.txt";
+
+ int res = QTest::qExec(&tv, 3, pass);
+
+ return res;
+}
+
+
+// ---------------------------------------------------------------------------
+// init
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackVolumeBar::init()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackVolumeBar::init()"));
+
+ mVolumeBar = new QMPXVideoPlaybackNonTouchVolumeBar();
+}
+
+// ---------------------------------------------------------------------------
+// cleanup
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackVolumeBar::cleanup()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackVolumeBar::cleanup()"));
+
+ if ( mVolumeBar )
+ {
+ delete mVolumeBar;
+ mVolumeBar = NULL;
+ }
+}
+
+// ---------------------------------------------------------------------------
+// testSetVisible
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackVolumeBar::testSetVisible()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackVolumeBar::testSetVisible()"));
+
+ init();
+
+ mVolumeBar->setVisible( false );
+
+ QVERIFY( mVolumeBar->mVolumeTimer->isActive() == false );
+ QVERIFY( mVolumeBar->isVisible() == false );
+
+ mVolumeBar->setVisible( true );
+
+ QVERIFY( mVolumeBar->mVolumeTimer->isActive() == true );
+ QVERIFY( mVolumeBar->isVisible() == true );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testHideVolumeControl
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackVolumeBar::testHideVolumeControl()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackVolumeBar::testHideVolumeControl()"));
+
+ init();
+
+ connect( this, SIGNAL( commandSignal() ), mVolumeBar, SLOT( hideVolumeControl() ) );
+ emit commandSignal();
+ disconnect( this, SIGNAL( commandSignal() ), mVolumeBar, SLOT( hideVolumeControl() ) );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testMousePressEvent
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackVolumeBar::testMousePressEvent()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackVolumeBar::testMousePressEvent()"));
+
+ init();
+
+ QGraphicsSceneMouseEvent* event =
+ new QGraphicsSceneMouseEvent( QEvent::GraphicsSceneMousePress );
+ event->setAccepted( true );
+
+ mVolumeBar->mousePressEvent( event );
+
+ QVERIFY( ! event->isAccepted() );
+
+ delete event;
+ event = NULL;
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testMouseReleaseEvent
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackVolumeBar::testMouseReleaseEvent()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackVolumeBar::testMouseReleaseEvent()"));
+
+ init();
+
+ QGraphicsSceneMouseEvent* event =
+ new QGraphicsSceneMouseEvent( QEvent::GraphicsSceneMouseRelease );
+ event->setAccepted( true );
+
+ mVolumeBar->mouseReleaseEvent( event );
+ QVERIFY( ! event->isAccepted() );
+
+ delete event;
+ event = NULL;
+
+ cleanup();
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackvolumebar/stub/inc/mpxvideoplaybackcontrolscontroller.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,124 @@
+/*
+* 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: Implementation of MPXVideoPlaybackControlsController
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_
+#define MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_
+
+// INCLUDES
+#include <qobject>
+#include <mpxplaybackframeworkdefs.h>
+
+#include "mpxvideo_debug.h"
+#include "mpxcommonvideoplaybackview.hrh"
+
+
+// FORWARD DECLARATIONS
+
+
+// DATA TYPES
+
+enum TMPXTimerAction
+{
+ EMPXTimerCancel,
+ EMPXTimerReset
+};
+
+enum TPlaybackViewMode
+{
+ EFullScreenView,
+ EDetailsView,
+ EAudioOnlyView
+};
+
+const int KMPXControlsTimeOut = 4000;
+
+// CLASS DECLARATION
+
+class QMPXVideoPlaybackControlsController : public QObject
+{
+ Q_OBJECT
+
+ public:
+
+ /**
+ * constructor.
+ */
+ QMPXVideoPlaybackControlsController();
+
+ /**
+ * Destructor.
+ */
+ virtual ~QMPXVideoPlaybackControlsController();
+
+ public:
+
+ /**
+ * Command handling function.
+ * Call HandleCommandL() of container
+ */
+ void handleCommand( TMPXVideoPlaybackViewCommandIds command, int value = 0 );
+
+ /**
+ * Reset or cancel timers for the controls
+ */
+ void resetDisappearingTimers( TMPXTimerAction timerAction );
+
+ /**
+ * Return state
+ */
+ inline TMPXPlaybackState state();
+
+ TPlaybackViewMode viewMode();
+
+ void changeViewMode( TPlaybackViewMode viewMode, bool transitionEffect = true );
+
+ public:
+ TMPXPlaybackState mState;
+ TPlaybackViewMode mViewMode;
+ TMPXTimerAction mTimerAction;
+ TMPXVideoPlaybackViewCommandIds mCommand;
+ int mCommandValue;
+};
+
+// INLINE METHODS
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::state
+// -------------------------------------------------------------------------------------------------
+//
+inline
+TMPXPlaybackState QMPXVideoPlaybackControlsController::state()
+{
+ return mState;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::viewMode
+// -------------------------------------------------------------------------------------------------
+//
+inline
+TPlaybackViewMode QMPXVideoPlaybackControlsController::viewMode()
+{
+ return mViewMode;
+}
+
+#endif /*MPXVIDEOPLAYBACKCONTROLSCONTROLLER_P_H_*/
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoplaybackvolumebar/testmpxvideoplaybackvolumebar.pro Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,35 @@
+#
+# 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: Project file for building testmpxvideoplaybackvolumebar
+#
+#
+# Version : %version: 1 %
+
+TEMPLATE = app
+TARGET = testmpxvideoplaybackvolumebar
+CONFIG += qtestlib qt hb
+
+INCLUDEPATH += stub/inc \
+ ../../../../inc \
+ ../../../inc
+
+
+DEPENDPATH += inc src stub/inc stub/src
+
+# Input
+HEADERS += testmpxvideoplaybackvolumebar.h \
+ ../../controlinc/mpxvideoplaybacknontouchvolumebar.h
+
+SOURCES += testmpxvideoplaybackvolumebar.cpp \
+ ../../controlsrc/mpxvideoplaybacknontouchvolumebar.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoviewwrapper/stub/src/hbvideobaseplaybackview.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,194 @@
+/*
+* 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: Implementation of Video playback view
+*
+*/
+
+// Version : %version: 4 %
+
+
+
+// Include Files
+#include <aknappui.h>
+#include <qgraphicssceneevent>
+#include <hbinstance.h>
+#include <mmf/common/mmferrors.h>
+
+#include "../inc/hbvideobaseplaybackview.h"
+
+
+// Member Functions
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoPlaybackView::HbVideoPlaybackView()
+// -------------------------------------------------------------------------------------------------
+//
+HbVideoBasePlaybackView::HbVideoBasePlaybackView()
+{
+ mCurrentError = KErrNone;
+ mViewActive = false;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoPlaybackView::~HbVideoPlaybackView()
+// -------------------------------------------------------------------------------------------------
+//
+HbVideoBasePlaybackView::~HbVideoBasePlaybackView()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::handleActivateView()
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::handleActivateView()
+{
+ mViewActive = true;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::handleDeactivateView()
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::handleDeactivateView()
+{
+ mViewActive = false;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::mousePress
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::mousePressEvent( QGraphicsSceneMouseEvent *event )
+{
+ Q_UNUSED( event );
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::itemChange
+// -------------------------------------------------------------------------------------------------
+//
+QVariant HbVideoBasePlaybackView::itemChange( GraphicsItemChange change, const QVariant &value )
+{
+ return QGraphicsWidget::itemChange( change, value );
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::closePlaybackView()
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::paint( QPainter *painter,
+ const QStyleOptionGraphicsItem *option,
+ QWidget *widget )
+{
+ Q_UNUSED( painter );
+ Q_UNUSED( option );
+ Q_UNUSED( widget );
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::event()
+// -------------------------------------------------------------------------------------------------
+//
+bool HbVideoBasePlaybackView::event( QEvent *event )
+{
+ Q_UNUSED( event );
+ bool consumed = false;
+
+ return consumed;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::handleClosePlaybackView()
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::handleClosePlaybackView()
+{
+ mViewActive = false;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::issuePlayCommand
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::issuePlayCommand()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::handleBufferingState
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::handleBufferingState()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::handlePluginError()
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::handlePluginError( int aError )
+{
+ mCurrentError = aError;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::doClosePlayer
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::doClosePlayer()
+{
+ mViewActive = false;
+}
+
+
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::retrievePdlInformation
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::retrievePdlInformation()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::closePlaybackView()
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::closePlaybackView()
+{
+ mViewActive = false;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::startClosingPlaybackView()
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::startClosingPlaybackView()
+{
+ mViewActive = false;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::getWindow()
+// -------------------------------------------------------------------------------------------------
+//
+RWindow *HbVideoBasePlaybackView::getWindow()
+{
+ return static_cast<RWindow*>( hbInstance->allMainWindows()[0]->effectiveWinId()->DrawableWindow() );
+}
+
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoviewwrapper/stub/src/mpxplaybackutilityimpl.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,721 @@
+/*
+* Copyright (c) 2006 - 2007 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: Playback Utility implementation
+*
+*/
+
+// Version : %version: %
+
+#include <bamdesca.h>
+#include <s32mem.h>
+#include <e32math.h>
+#include <mpxcmn.h>
+#include <mpxplaybackobserver.h>
+#include <mpxcollectionplaylist.h>
+#include <mpxmedia.h>
+#include <mpxmessagemonitor.h>
+#include <mpxtaskqueue.h>
+#include <mpxuser.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxcommandgeneraldefs.h>
+#include <mpxcollectionpath.h>
+#include <mpxplaybackcommanddefs.h>
+#include <mpxsubscription.h>
+#include <mpxlog.h>
+
+#include "mpxplaybackutilityimpl.h"
+
+// ============================== MEMBER FUNCTIONS ============================
+
+// ---------------------------------------------------------------------------
+// Retrieves playback utility from TLS. Creates if it's not there.
+// ---------------------------------------------------------------------------
+//
+MMPXPlaybackUtility* CMPXPlaybackUtility::UtilityL(
+ const TUid& aModeId,
+ const TMPXCategory aCategory)
+ {
+ MMPXPlaybackUtility* utility( NULL );
+
+ utility = CMPXPlaybackUtility::NewL( aModeId, NULL, aCategory );
+
+ return utility;
+ }
+
+// ----------------------------------------------------------------------------
+// Two phases constructor
+// ----------------------------------------------------------------------------
+//
+CMPXPlaybackUtility* CMPXPlaybackUtility::NewL(const TUid& aModeId,
+ MMPXPlaybackObserver* aObs,
+ const TMPXCategory aCategory)
+ {
+ CMPXPlaybackUtility* p=new(ELeave)CMPXPlaybackUtility();
+ CleanupStack::PushL(p);
+ p->ConstructL(aModeId,aObs,aCategory);
+ CleanupStack::Pop(p);
+ return p;
+ }
+
+// ----------------------------------------------------------------------------
+// Destructor
+// ----------------------------------------------------------------------------
+//
+CMPXPlaybackUtility::~CMPXPlaybackUtility()
+ {
+ iObservers.Close();
+ }
+
+// ----------------------------------------------------------------------------
+// C++ constructor
+// Create a unique name out of thread ID and this pointer: no other instance of
+// this object will have the same name; used to identify this object for
+// recieving messages
+// ----------------------------------------------------------------------------
+//
+CMPXPlaybackUtility::CMPXPlaybackUtility()
+ : iCallbackOngoing(EFalse)
+ {
+ }
+
+// ----------------------------------------------------------------------------
+// 2nd construtor
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::ConstructL(const TUid& /* aModeId */,
+ MMPXPlaybackObserver* /* aObs */,
+ const TMPXCategory /* aCategory */)
+ {
+ iState = EPbStateInitialised;
+ }
+
+// ----------------------------------------------------------------------------
+// Add a observer
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::AddObserverL(MMPXPlaybackObserver& aObs)
+ {
+ iObservers.AppendL(&aObs);
+ }
+
+// ----------------------------------------------------------------------------
+// Remove a observer
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::RemoveObserverL(MMPXPlaybackObserver& /* aObs */)
+ {
+
+ }
+
+// ----------------------------------------------------------------------------
+// Returns PIds of clients that are using the engine in the mode
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::GetClientsL(RArray<TProcessId>& /* aClients */)
+ {
+
+ }
+
+// ----------------------------------------------------------------------------
+// Initializes a track given by aIndex in path aCollectionPath
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::InitL(
+ const CMPXCollectionPlaylist& /* aPlaylist */,
+ TBool /*aPlay */ )
+ {
+
+ }
+
+// ----------------------------------------------------------------------------
+// Inititialises with a single song, may not be part of any collection
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::InitL(const TDesC& /* aUri */, const TDesC8* /* aType */ )
+ {
+
+ }
+
+// ----------------------------------------------------------------------------
+// Inititialises with a single song, may not be part of any collection
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::InitL(RFile& /* aShareableFile */)
+ {
+
+ }
+
+// ----------------------------------------------------------------------------
+// Inititialises with a URI
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::InitStreamingL(const TDesC& /* aUri */, const TDesC8* /* aType */, const TInt /* aAccessPoint */)
+{
+
+}
+
+
+// ----------------------------------------------------------------------------
+// Inititialises with a file, may not be part of any collection
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::InitStreamingL(RFile& /* aShareableFile */, const TInt /* aAccessPoint */)
+{
+
+}
+
+// ----------------------------------------------------------------------------
+// Frees up client side resources only; a player is freed when there are no
+// clients using it, and all resources are freed when the last client closed
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::Close()
+ {
+
+ }
+
+// ----------------------------------------------------------------------------
+// Stops any async operations that are currently under way
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::CancelRequest()
+ {
+
+ }
+
+// ----------------------------------------------------------------------------
+// Issue player commands, with optional data.
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::CommandL(TMPXPlaybackCommand /* aCmd */, TInt /* aData */)
+ {
+
+ }
+
+// ----------------------------------------------------------------------------
+// Issue player commands
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::CommandL(
+ CMPXCommand& aCmd,
+ MMPXPlaybackCallback* /* aCallback */)
+ {
+ TMPXPlaybackCommand cmdType = static_cast<TMPXPlaybackCommand>(
+ aCmd.ValueTObjectL<TInt>(KMPXCommandPlaybackGeneralType));
+
+ switch ( cmdType )
+ {
+ case EPbCmdPlay:
+ {
+ iState = EPbStatePlaying;
+ break;
+ }
+ case EPbCmdDecreaseVolume:
+ {
+ CMPXMessage* message = CMPXMessage::NewL();
+ message->SetTObjectValueL<TMPXMessageId>( KMPXMessageGeneralId, KMPXMessageGeneral );
+ message->SetTObjectValueL<TInt>( KMPXMessageGeneralEvent, TMPXPlaybackMessage::EPropertyChanged );
+ message->SetTObjectValueL<TInt>( KMPXMessageGeneralType, EPbPropertyVolume );
+ message->SetTObjectValueL<TInt>( KMPXMessageGeneralData, 0 );
+ iObservers[0]->HandlePlaybackMessage( message, KErrNone );
+ }
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// Current state of player
+// ----------------------------------------------------------------------------
+//
+TMPXPlaybackState CMPXPlaybackUtility::StateL() const
+ {
+ return iState;
+ }
+
+// ----------------------------------------------------------------------------
+// Determine whether there is a song by the state of the engine: if there is,
+// its OK to return MMPXMedia, else NULL is returned
+// ----------------------------------------------------------------------------
+//
+MMPXSource* CMPXPlaybackUtility::Source()
+ {
+ return this;
+ }
+
+// ----------------------------------------------------------------------------
+// Get player manager
+// ----------------------------------------------------------------------------
+//
+MMPXPlayerManager& CMPXPlaybackUtility::PlayerManager()
+ {
+ }
+
+// ----------------------------------------------------------------------------
+// Set playback property, EPropertyChanged event when complete
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::SetL(TMPXPlaybackProperty aProperty,TInt /* aValue */ )
+ {
+ if ( aProperty == EPbPropertyMute )
+ {
+ CMPXMessage* message = CMPXMessage::NewL();
+ message->SetTObjectValueL<TMPXMessageId>( KMPXMessageGeneralId, KMPXMessageGeneral );
+ message->SetTObjectValueL<TInt>( KMPXMessageGeneralEvent, TMPXPlaybackMessage::EPropertyChanged );
+ message->SetTObjectValueL<TInt>( KMPXMessageGeneralType, 0 );
+ message->SetTObjectValueL<TInt>( KMPXMessageGeneralData, 0 );
+ iObservers[0]->HandlePlaybackMessage( message, KErrNone );
+ }
+ else if ( aProperty == EPbPropertyPosition )
+ {
+ CMPXMessage* message = CMPXMessage::NewL();
+ message->SetTObjectValueL<TMPXMessageId>( KMPXMessageGeneralId, KMPXMessageGeneral );
+ message->SetTObjectValueL<TInt>( KMPXMessageGeneralEvent, TMPXPlaybackMessage::EPropertyChanged );
+ message->SetTObjectValueL<TInt>( KMPXMessageGeneralType, EPbPropertyPosition );
+ message->SetTObjectValueL<TInt>( KMPXMessageGeneralData, 50 );
+ iObservers[0]->HandlePlaybackMessage( message, KErrNone );
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// Send property request
+// Result will be called back in HandleProperty
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::ValueL(MMPXPlaybackCallback& /* aCallback */,
+ TMPXPlaybackProperty /* aProperty */)
+ {
+
+ }
+
+// ----------------------------------------------------------------------------
+// Send property request
+// Result will be called back in HandleProperty
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::PropertyL(
+ MMPXPlaybackCallback& /* aCallback */,
+ TMPXPlaybackProperty /* aProperty */)
+ {
+
+ }
+
+// ----------------------------------------------------------------------------
+// Return a list of mime types supported by playback framework
+// ----------------------------------------------------------------------------
+//
+CDesCArray* CMPXPlaybackUtility::SupportedMimeTypes()
+ {
+ CDesCArray* desArray = NULL;
+
+ return desArray;
+ }
+
+// ----------------------------------------------------------------------------
+// Return a list of mime types supported by playback framework
+// ----------------------------------------------------------------------------
+//
+CDesCArray* CMPXPlaybackUtility::SupportedExtensions()
+ {
+ CDesCArray* desArray = NULL;
+
+ return desArray;
+ }
+
+// ----------------------------------------------------------------------------
+// Return a list of mime types supported by playback framework
+// ----------------------------------------------------------------------------
+//
+CDesCArray* CMPXPlaybackUtility::SupportedSchemas()
+ {
+ CDesCArray* desArray = NULL;
+
+ return desArray;
+ }
+
+// ----------------------------------------------------------------------------
+// Sets the priority of the playback utility
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::SetPriority( TInt /* aPriority */ )
+ {
+
+ }
+
+
+// ----------------------------------------------------------------------------
+// CMPXPlaybackUtility::AddSubscriptionL
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::AddSubscriptionL(
+ const CMPXSubscription& /* aSubscription */)
+ {
+
+ }
+
+// ----------------------------------------------------------------------------
+// CMPXPlaybackUtility::RemoveSubscriptionL
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::RemoveSubscriptionL(
+ const CMPXSubscription& /* aSubscription */ )
+ {
+
+ }
+
+// ----------------------------------------------------------------------------
+// CMPXPlaybackUtility::ClearSubscriptionsL
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::ClearSubscriptionsL()
+ {
+
+ }
+// ----------------------------------------------------------------------------
+// Get a list of player types
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::GetPlayerTypesL(
+ RArray<TMPXPlaybackPlayerType>& /* aTypes */ )
+ {
+
+ }
+
+// ----------------------------------------------------------------------------
+// Returns display name for custom types
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXPlaybackUtility::PlayerTypeDisplayNameL(TMPXPlaybackPlayerType /* aType */ )
+ {
+ HBufC* buf=NULL;
+ return buf;
+ }
+
+// ----------------------------------------------------------------------------
+// Get the list of UIDs of all players
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::GetPlayerListL(RArray<TUid>& /* aPlayers */)
+ {
+
+ }
+
+// ----------------------------------------------------------------------------
+// Get the list of UIDs of players with the specific type
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::GetPlayerListL(RArray<TUid>& /* aPlayers */,
+ TMPXPlaybackPlayerType /* aType */)
+ {
+
+ }
+
+// ----------------------------------------------------------------------------
+// Asynchronous method: when server completes message, RunL() will be called
+// and then the observer is notified of the results. Data required for the
+// results that is not supplied by the server is stored; data supplied by the
+// server is written back into packaged descriptors in this address space
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::SubPlayerNamesL(MMPXPlaybackCallback& /* aCallback */,
+ TUid /* aPlayer */)
+ {
+
+ }
+
+// ----------------------------------------------------------------------------
+// Selects all players with the type
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::SelectPlayersL(TMPXPlaybackPlayerType /* aType */)
+ {
+
+ }
+
+// ----------------------------------------------------------------------------
+// Selects a specific player
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::SelectPlayerL(TUid /* aPlayer */ )
+ {
+
+ }
+
+// ----------------------------------------------------------------------------
+// Selects a specific player and sub player
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::SelectSubPlayerL(TUid /* aPlayer */, TInt /* aSubPlayerIndex */)
+ {
+
+ }
+
+// ----------------------------------------------------------------------------
+// Clears all selection criteria.
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::ClearSelectPlayersL()
+ {
+
+ }
+
+// ----------------------------------------------------------------------------
+// Retreives the current selection
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::GetSelectionL(TMPXPlaybackPlayerType& /* aType */,
+ TUid& /* aPlayer */,
+ TInt& /* aSubPlayerIndex */,
+ HBufC*& /* aSubPlayerName */)
+ {
+
+ }
+
+// ----------------------------------------------------------------------------
+// The current player
+// ----------------------------------------------------------------------------
+//
+MMPXPlayer* CMPXPlaybackUtility::CurrentPlayer()
+ {
+ return NULL;
+ }
+
+// ----------------------------------------------------------------------------
+// The 'type' of the player
+// ----------------------------------------------------------------------------
+//
+TMPXPlaybackPlayerType CMPXPlaybackUtility::TypeL()
+ {
+ MPX_FUNC_EX("CMPXPlaybackUtility::TypeL()");
+ return EPbLocal;
+ }
+
+// ----------------------------------------------------------------------------
+// The name of player type
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXPlaybackUtility::TypeNameL()
+ {
+ HBufC* buf=NULL;
+ return buf;
+ }
+
+// ----------------------------------------------------------------------------
+// Get sub players
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::SubPlayerNamesL(MMPXPlaybackCallback& aCallback)
+ {
+ MPX_FUNC_EX("CMPXPlaybackUtility::SubPlayerNamesL()");
+ SubPlayerNamesL(aCallback,UidL());
+ }
+
+// ----------------------------------------------------------------------------
+// Selected sub player index
+// ----------------------------------------------------------------------------
+//
+TInt CMPXPlaybackUtility::SubPlayerL() const
+ {
+ return 0;
+ }
+
+// ----------------------------------------------------------------------------
+// The UID identifying this player
+// ----------------------------------------------------------------------------
+//
+TUid CMPXPlaybackUtility::UidL() const
+ {
+ }
+
+// ----------------------------------------------------------------------------
+// Path to the collection
+// ----------------------------------------------------------------------------
+//
+CMPXCollectionPlaylist* CMPXPlaybackUtility::PlaylistL()
+ {
+ MPX_FUNC_EX("CMPXPlaybackUtility::PlaylistL()");
+ CMPXCollectionPlaylist *p = NULL;
+
+ return p;
+ }
+
+// ----------------------------------------------------------------------------
+// Return file handle
+// ----------------------------------------------------------------------------
+//
+RFile* CMPXPlaybackUtility::FileL()
+ {
+ RFile* file(NULL);
+ return file;
+ }
+
+// ----------------------------------------------------------------------------
+// URI of current song
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXPlaybackUtility::UriL()
+ {
+ HBufC* buf=NULL;
+ return buf;
+ }
+
+// ----------------------------------------------------------------------------
+// Request for media properties.
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::MediaL(
+ const TArray<TMPXAttribute>& aAttrs,
+ MMPXPlaybackCallback& aCallback)
+ {
+ MediaL( aAttrs, aCallback, NULL );
+ }
+
+// ----------------------------------------------------------------------------
+// Request for media properties.
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::MediaL(
+ const TArray<TMPXAttribute>& /* aAttrs */,
+ MMPXPlaybackCallback& /* aCallback */,
+ CMPXAttributeSpecs* /* aSpecs */)
+ {
+
+ }
+
+// ----------------------------------------------------------------------------
+// Server has completed the message, and if there's no error, the results are
+// available. The server completes with the function id (or error) so the correct
+// callback is made
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::RunL()
+ {
+
+ }
+
+// ----------------------------------------------------------------------------
+// Canceling by the server
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::DoCancel()
+ {
+
+ }
+
+// ----------------------------------------------------------------------------
+// Sends error message to all observers - maybe it should only be to the
+// client that calls the async method
+// ----------------------------------------------------------------------------
+//
+TInt CMPXPlaybackUtility::RunError(TInt /* aError */)
+ {
+ return KErrNone;
+ }
+
+// ----------------------------------------------------------------------------
+// Distributes messages to all observers
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::MessageReceived(TInt /* aMsgData */, TInt /* aError */)
+ {
+
+ }
+
+// ----------------------------------------------------------------------------
+// Distributes messages to all observers
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::HandleMessageL(TInt /* aMsgData */, TInt /* aError */)
+ {
+
+ }
+
+// ----------------------------------------------------------------------------
+// Handle error in RunL
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::HandleRunErrorL(TInt /* aError */)
+ {
+
+ }
+
+
+// ----------------------------------------------------------------------------
+// Read a buffer from server
+// ----------------------------------------------------------------------------
+//
+HBufC* CMPXPlaybackUtility::DesL(TInt /* aSize */)
+ {
+ HBufC* des=NULL;
+
+ return des;
+ }
+
+// ----------------------------------------------------------------------------
+// Adds a sync request to the queue: if there is no outstanding request,
+// it will be executed immediately
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::AddRequestL(TMPXPlaybackServerOp /*aFunction */,
+ MMPXPlaybackCallback* /* aCallback */,
+ TInt /* aParamData */,
+ CBufBase* /* aBuf */,
+ TAny* /* aPtr */,
+ CBase* /* aAlivePtr */)
+ {
+
+ }
+
+// ----------------------------------------------------------------------------
+// Executes the next request in the queue.
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::ExecuteNextRequest()
+ {
+
+ }
+
+
+
+#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
+// ----------------------------------------------------------------------------
+// Inititialises with a single song, may not be part of any collection
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::Init64L(RFile64& /* aShareableFile */)
+ {
+
+ }
+
+// ----------------------------------------------------------------------------
+// Inititialises with a file, may not be part of any collection
+// ----------------------------------------------------------------------------
+//
+void CMPXPlaybackUtility::InitStreaming64L(RFile64& /* aShareableFile */, const TInt /* aAccessPoint */)
+ {
+
+ }
+
+// ----------------------------------------------------------------------------
+// Return file handle
+// ----------------------------------------------------------------------------
+//
+RFile64* CMPXPlaybackUtility::File64L()
+ {
+ RFile64* file(NULL);
+
+ return file;
+ }
+
+#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoviewwrapper/stub/src/mpxvideoplaybackcontrolscontroller.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,387 @@
+/*
+* 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: Implementation of MPXVideoPlaybackControlsController
+*
+*/
+
+// Version : %version: 4 %
+
+
+
+// INCLUDE FILES
+#include <coecntrl.h>
+#include <bautils.h>
+#include <barsread.h>
+#include <stringloader.h>
+#include <f32file.h>
+
+#include <qtimer>
+
+#include <hblabel.h>
+#include <hbaction.h>
+#include <hbiconanimator.h>
+
+#include "mpxvideoviewwrapper.h"
+#include "hbvideobaseplaybackview.h"
+#include "mpxvideoplaybackbuttonbar.h"
+#include "mpxvideoplaybackprogressbar.h"
+#include "mpxvideoplaybackcontrolpolicy.h"
+#include "mpxvideoplaybackdocumentloader.h"
+#include "mpxvideoplaybackviewfiledetails.h"
+#include "mpxvideoplaybackstatuspanecontrol.h"
+#include "mpxvideoplaybackfiledetailswidget.h"
+#include "mpxvideoplaybacknontouchvolumebar.h"
+#include "mpxvideoplaybackfullscreencontrol.h"
+#include "../inc/mpxvideoplaybackcontrolscontroller.h"
+#include "mpxvideoplaybackcontrolconfiguration.h"
+
+
+// ================= MEMBER FUNCTIONS ==============================================================
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::QMPXVideoPlaybackControlsController()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackControlsController::QMPXVideoPlaybackControlsController(
+ HbVideoBasePlaybackView *view,
+ CMPXVideoViewWrapper *viewWrapper,
+ QMPXVideoPlaybackViewFileDetails *details )
+ : mView( view )
+ , mViewWrapper( viewWrapper )
+ , mFileDetails( details )
+{
+ initializeController();
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::initializeController()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::initializeController()
+{
+
+ //createControls();
+
+ connect( mView, SIGNAL( tappedOnScreen() ), this, SLOT( handleTappedOnScreen() ) );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::addFileDetails()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::addFileDetails(
+ QMPXVideoPlaybackViewFileDetails* details )
+{
+ Q_UNUSED( details );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController"));
+
+ disconnect( mView, SIGNAL( tappedOnScreen() ), this, SLOT( handleTappedOnScreen() ) );
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleEvent
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleEvent(
+ TMPXVideoPlaybackControlCommandIds event, int value )
+{
+ switch ( event )
+ {
+ case EMPXControlCmdTvOutConnected:
+ {
+ handleTvOutEvent( true, event, value );
+ break;
+ }
+ case EMPXControlCmdTvOutDisconnected:
+ {
+ handleTvOutEvent( false, event, value );
+ break;
+ }
+ case EMPXControlCmdSetVolume:
+ {
+ mFileDetails->mAudioEnabled = false;
+ break;
+ }
+ case EMPXControlCmdSetDuration:
+ {
+ mFileDetails->mDuration = value;
+ break;
+ }
+ case EMPXControlCmdShowVolumeControls:
+ {
+ mFileDetails->mAudioEnabled = true;
+ break;
+ }
+ case EMPXControlCmdSetPosition:
+ {
+ mFileDetails->mSeekable = true;
+ break;
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleStateChange
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleStateChange( TMPXPlaybackState newState )
+{
+ Q_UNUSED( newState );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::controlsListUpdated()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::controlsListUpdated()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::appendControl()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::appendControl( TMPXVideoPlaybackControls controlIndex )
+{
+ Q_UNUSED( controlIndex );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::resetDisappearingTimers()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::resetDisappearingTimers( TMPXTimerAction timerAction )
+{
+ Q_UNUSED( timerAction );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::hideAllControls()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::hideAllControls()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::showControls()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::showControls()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::isVisible()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackControlsController::isVisible()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleCommand()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleCommand(
+ TMPXVideoPlaybackViewCommandIds command, int value )
+{
+ Q_UNUSED( command );
+ Q_UNUSED( value );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::volumeChanged()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::volumeChanged( int volume )
+{
+ Q_UNUSED( volume );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::showVolumeControls()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::showVolumeControls()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::durationChanged()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::durationChanged( int duration )
+{
+ Q_UNUSED( duration );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::positionChanged()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::positionChanged( int position )
+{
+ Q_UNUSED( position );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::aspectRatioChanged()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::aspectRatioChanged( int aspectRatio )
+{
+ Q_UNUSED( aspectRatio );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::realFormat()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackControlsController::realFormat( QString filename )
+{
+ Q_UNUSED( filename );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::realFormatForStreaming()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackControlsController::realFormatForStreaming( const TDesC& des )
+{
+ Q_UNUSED( des );
+ bool realFormat = false;
+ return realFormat;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::realFormatForLocal()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackControlsController::realFormatForLocal()
+{
+ bool realFormat = false;
+
+ return realFormat;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::setDownloadSize()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::setDownloadSize( int size )
+{
+ Q_UNUSED( size );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::updateDownloadPosition()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::updateDownloadPosition( int size )
+{
+ Q_UNUSED( size );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleErrors
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleErrors()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::isSoftKeyVisible()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackControlsController::isSoftKeyVisible( int /*value*/ )
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleTvOutEvent
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleTvOutEvent(
+ bool connected, TMPXVideoPlaybackControlCommandIds event, int value )
+{
+ Q_UNUSED( event );
+ Q_UNUSED( value );
+ mFileDetails->mTvOutConnected = connected;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::updateVideoRectDone
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::updateVideoRectDone()
+{
+ mViewTransitionIsGoingOn = false;
+
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::skipToPreviousVideoItem
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::skipToPreviousVideoItem()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::skipToNextVideoItem
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::skipToNextVideoItem()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::updateVideoRect()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::updateVideoRect( bool transitionEffect )
+{
+ Q_UNUSED( transitionEffect );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleTappedOnScreen()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleTappedOnScreen()
+{
+
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoviewwrapper/stub/src/mpxvideoplaybackdisplayhandler.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,351 @@
+/*
+* 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: Implementation of video playback display handler
+*
+*/
+
+// Version : %version: 4 %
+
+#include <sysutil.h>
+#include <s32file.h>
+#include <mpxcommand.h>
+#include <mpxcommandgeneraldefs.h>
+#include <mpxplaybackutility.h>
+#include <mpxvideoplaybackdefs.h>
+
+#include "mpxvideoviewwrapper.h"
+#include "mpxvideoplaybackdisplayhandler.h"
+#include "mpxvideoregion.h"
+#include "mpxvideoplaybackviewfiledetails.h"
+
+const TInt KVIDEORESIZINGREPEATRATE = 50000;
+const TReal32 KTRANSITIONEFFECTCNT = 8;
+
+_LIT( KAspectRatioFile, "c:\\private\\200159b2\\mpxvideoplayer_aspect_ratio.dat" );
+
+
+CMPXVideoPlaybackDisplayHandler::CMPXVideoPlaybackDisplayHandler( MMPXPlaybackUtility* aPlayUtil,
+ CMPXVideoViewWrapper* aViewWrapper )
+ : iPlaybackUtility( aPlayUtil )
+ , iViewWrapper( aViewWrapper )
+{
+}
+
+CMPXVideoPlaybackDisplayHandler::~CMPXVideoPlaybackDisplayHandler()
+{
+}
+
+CMPXVideoPlaybackDisplayHandler*
+CMPXVideoPlaybackDisplayHandler::NewL( MMPXPlaybackUtility* aPlayUtil,
+ CMPXVideoViewWrapper* aViewWrapper )
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::NewL()"));
+
+ CMPXVideoPlaybackDisplayHandler* self =
+ new(ELeave) CMPXVideoPlaybackDisplayHandler( aPlayUtil, aViewWrapper );
+
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+ return self;
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::ConstructL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackDisplayHandler::ConstructL()
+{
+ LoadAspectRatioL();
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::CreateDisplayWindowL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackDisplayHandler::CreateDisplayWindowL(
+ RWsSession& aWs,
+ CWsScreenDevice& aScreenDevice,
+ RWindow& aWin,
+ TRect aDisplayRect )
+{
+ Q_UNUSED( aWs );
+ Q_UNUSED( aScreenDevice );
+ Q_UNUSED( aWin );
+ Q_UNUSED( aDisplayRect );
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::RemoveDisplayWindow()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackDisplayHandler::RemoveDisplayWindow()
+{
+#ifdef SYMBIAN_BUILD_GCE
+ if ( iVideoDisplay )
+ {
+ delete iVideoDisplay;
+ iVideoDisplay = NULL;
+ }
+#else
+ if ( iDirectScreenAccess )
+ {
+ delete iDirectScreenAccess;
+ iDirectScreenAccess = NULL;
+ }
+#endif
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::HandleVideoDisplayMessageL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackDisplayHandler::HandleVideoDisplayMessageL( CMPXMessage* aMessage )
+{
+
+ TMPXVideoDisplayCommand message =
+ ( *(aMessage->Value<TMPXVideoDisplayCommand>(KMPXMediaVideoDisplayCommand)) );
+
+ switch ( message )
+ {
+#ifdef SYMBIAN_BUILD_GCE
+ case EPbMsgVideoSurfaceCreated:
+ {
+ SurfaceCreatedL( aMessage );
+ break;
+ }
+ case EPbMsgVideoSurfaceChanged:
+ {
+ SurfaceChangedL( aMessage );
+ break;
+ }
+ case EPbMsgVideoSurfaceRemoved:
+ {
+ SurfaceRemoved();
+ break;
+ }
+#endif
+ }
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::SetAspectRatioL()
+// -------------------------------------------------------------------------------------------------
+//
+TInt CMPXVideoPlaybackDisplayHandler::SetAspectRatioL( TMPXVideoPlaybackCommand aCmd )
+{
+ Q_UNUSED( aCmd );
+ TInt aspectRatio = 0;
+
+ iCurrentIndexForAspectRatio = 1;
+
+ return aspectRatio;
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::SetDefaultAspectRatioL
+// -------------------------------------------------------------------------------------------------
+//
+TInt CMPXVideoPlaybackDisplayHandler::SetDefaultAspectRatioL(
+ QMPXVideoPlaybackViewFileDetails* aFileDetails,
+ TReal aDisplayAspectRatio )
+{
+ Q_UNUSED( aFileDetails );
+ Q_UNUSED( aDisplayAspectRatio );
+ TInt newAspectRatio = EMMFNatural;
+
+ return newAspectRatio;
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::SaveAspectRatioL
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackDisplayHandler::SaveAspectRatioL()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::LoadAspectRatioL
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackDisplayHandler::LoadAspectRatioL()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::UpdateVideoRectL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackDisplayHandler::UpdateVideoRectL( TRect aClipRect, TBool transitionEffect )
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::UpdateVideoRectL()"));
+ Q_UNUSED( transitionEffect );
+
+ iTlXDiff = (TReal32)( aClipRect.iTl.iX );
+ iTlYDiff = (TReal32)( aClipRect.iTl.iY );
+ iBrXDiff = (TReal32)( aClipRect.iBr.iX );
+ iBrYDiff = (TReal32)( aClipRect.iBr.iY );
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::UpdateVideoRectTimeOutL()
+// -------------------------------------------------------------------------------------------------
+//
+TInt CMPXVideoPlaybackDisplayHandler::UpdateVideoRectTimeOutL( TAny* aPtr )
+{
+ Q_UNUSED( aPtr );
+ return KErrNone;
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::CalculateVideoRectL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackDisplayHandler::CalculateVideoRectL()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::SetVideoRectL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackDisplayHandler::SetVideoRectL( TRect aRect )
+{
+ Q_UNUSED( aRect );
+}
+
+#ifdef SYMBIAN_BUILD_GCE
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::AddDisplayWindowL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackDisplayHandler::AddDisplayWindowL( CWsScreenDevice& aScreenDevice,
+ RWindowBase& aWindowBase,
+ RWindow* aWin )
+{
+ Q_UNUSED( aScreenDevice );
+ Q_UNUSED( aWindowBase );
+ Q_UNUSED( aWin );
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::SurfaceCreatedL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackDisplayHandler::SurfaceCreatedL( CMPXMessage* aMessage )
+{
+ Q_UNUSED( aMessage );
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::SurfaceChangedL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackDisplayHandler::SurfaceChangedL( CMPXMessage* aMessage )
+{
+ Q_UNUSED( aMessage );
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::SurfaceRemoved()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackDisplayHandler::SurfaceRemoved()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::SetNgaAspectRatioL()
+// -------------------------------------------------------------------------------------------------
+//
+TInt CMPXVideoPlaybackDisplayHandler::SetNgaAspectRatioL( TMPXVideoPlaybackCommand aCmd )
+{
+ Q_UNUSED( aCmd );
+ return KErrNone;
+}
+
+
+#else
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::SetDisplayWindowL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackDisplayHandler::SetDisplayWindowL( RWsSession& aWs,
+ CWsScreenDevice& aScreenDevice,
+ RWindowBase& aWin,
+ TRect aClipRect )
+{
+ Q_UNUSED( aWs );
+ Q_UNUSED( aScreenDevice );
+ Q_UNUSED( aWin );
+ Q_UNUSED( aClipRect );
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::Restart()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackDisplayHandler::Restart( RDirectScreenAccess::TTerminationReasons aReason )
+{
+ Q_UNUSED( aReason );
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::RestartDsaL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackDisplayHandler::RestartDsaL()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::AbortNow()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackDisplayHandler::AbortNow( RDirectScreenAccess::TTerminationReasons aReason )
+{
+ Q_UNUSED( aReason );
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::CreateAbortDsaCmdL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackDisplayHandler::CreateAbortDsaCmdL()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::CreateAspectRatioCommandL()
+// -------------------------------------------------------------------------------------------------
+//
+TInt CMPXVideoPlaybackDisplayHandler::CreateAspectRatioCommandL( TMPXVideoPlaybackCommand aCmd )
+{
+ Q_UNUSED( aCmd );
+}
+
+#endif
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoviewwrapper/stub/src/mpxvideoplaybackuserinputhandler.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,267 @@
+/*
+* 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: Implementation of playback view's input handler
+*
+*/
+
+// Version : %version: 4 %
+
+
+// INCLUDE FILES
+#include <qobject>
+#include <e32std.h>
+#include <w32std.h> // RWindowBase
+#include <e32base.h>
+#include <aknutils.h>
+#include <eikclbd.h>
+#include <aknconsts.h>
+#include <remconcoreapi.h>
+#include <remconcoreapitarget.h>
+#include <remconinterfaceselector.h> // Side volume key
+#include <mpxplaybackframeworkdefs.h>
+#include <centralrepository.h> // for peripheral display timeout setting
+#include <settingsinternalcrkeys.h> // display timeout setting keys
+#include <hwrmlightdomaincrkeys.h>
+#include <mpxvideoplaybackdefs.h>
+
+#include <HAL.h>
+#include <hal_data.h>
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoviewwrapper.h"
+#include "mpxcommonvideoplaybackview.hrh"
+#include "../inc/mpxvideoplaybackuserinputhandler.h"
+
+
+// CONSTANTS
+const TInt KMPXMicroSecondsInASecond = 1000000;
+
+
+// ======== MEMBER FUNCTIONS =======================================================================
+
+// -------------------------------------------------------------------------------------------------
+// MPXVideoPlaybackUserInputHandler::CMPXVideoPlaybackUserInputHandler()
+// -------------------------------------------------------------------------------------------------
+//
+CMPXVideoPlaybackUserInputHandler::CMPXVideoPlaybackUserInputHandler( CMPXVideoViewWrapper* aWrapper )
+ : iViewWrapper( aWrapper )
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::NewL()
+// -------------------------------------------------------------------------------------------------
+//
+CMPXVideoPlaybackUserInputHandler* CMPXVideoPlaybackUserInputHandler::NewL(
+ CMPXVideoViewWrapper* aWrapper, TBool aTvOutConnected )
+{
+ MPX_DEBUG(_L("CMPXVideoPlaybackUserInputHandler::NewL()"));
+
+ CMPXVideoPlaybackUserInputHandler* self =
+ new (ELeave) CMPXVideoPlaybackUserInputHandler( aWrapper );
+ CleanupStack::PushL( self );
+ self->ConstructL( aTvOutConnected );
+ CleanupStack::Pop();
+ return self;
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackUserInputHandler::ConstructL( TBool aTvOutConnected )
+{
+ Q_UNUSED( aTvOutConnected );
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::~CMPXVideoPlaybackUserInputHandler()
+// -------------------------------------------------------------------------------------------------
+//
+CMPXVideoPlaybackUserInputHandler::~CMPXVideoPlaybackUserInputHandler()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::MrccatoPlay()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackUserInputHandler::MrccatoPlay( TRemConCoreApiPlaybackSpeed /*aSpeed*/,
+ TRemConCoreApiButtonAction aButtonAct )
+{
+ Q_UNUSED( aButtonAct );
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::MrccatoCommand()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackUserInputHandler::MrccatoCommand(TRemConCoreApiOperationId aOperationId,
+ TRemConCoreApiButtonAction aButtonAct )
+{
+ Q_UNUSED( aOperationId );
+ Q_UNUSED( aButtonAct );
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::DoHandleMediaKey()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackUserInputHandler::DoHandleMediaKey( TRemConCoreApiOperationId aOperationId,
+ TRemConCoreApiButtonAction aButtonAct )
+{
+ Q_UNUSED( aOperationId );
+ Q_UNUSED( aButtonAct );
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::HandleFastForward()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackUserInputHandler::HandleFastForward(TRemConCoreApiButtonAction aButtonAct)
+{
+ Q_UNUSED( aButtonAct );
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::HandleRewind()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackUserInputHandler::HandleRewind(TRemConCoreApiButtonAction aButtonAct)
+{
+ Q_UNUSED( aButtonAct );
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::HandleVolumeUp()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackUserInputHandler::HandleVolumeUp(TRemConCoreApiButtonAction aButtonAct)
+{
+ Q_UNUSED( aButtonAct );
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::HandleVolumeDown()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackUserInputHandler::HandleVolumeDown(TRemConCoreApiButtonAction aButtonAct)
+{
+ Q_UNUSED( aButtonAct );
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::ProcessKeyEvent()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackUserInputHandler::ProcessKeyEventL( const TKeyEvent& aKeyEvent,
+ TEventCode aType )
+{
+ Q_UNUSED( aKeyEvent );
+ Q_UNUSED( aType );
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::ProcessMediaKey()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackUserInputHandler::ProcessMediaKey(TRemConCoreApiOperationId aOperationId,
+ TRemConCoreApiButtonAction aButtonAct)
+{
+ Q_UNUSED( aOperationId );
+ Q_UNUSED( aButtonAct );
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL()
+// -------------------------------------------------------------------------------------------------
+//
+TInt CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL( TAny* aPtr )
+{
+ Q_UNUSED( aPtr );
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatL()
+{
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::SetForeground()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackUserInputHandler::SetForeground(TBool aForeground)
+{
+ Q_UNUSED( aForeground );
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::DisableBacklight()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackUserInputHandler::DisableBacklight()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::EnableBacklight()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackUserInputHandler::EnableBacklight()
+{
+
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::HandleTVOutEvent()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackUserInputHandler::HandleTVOutEventL( TBool aTVOutConnected )
+{
+ Q_UNUSED( aTVOutConnected );
+}
+
+
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::HandleDisplayTimeout
+// -------------------------------------------------------------------------------------------------
+//
+TInt CMPXVideoPlaybackUserInputHandler::HandleDisplayTimeout( TAny* aPtr )
+{
+ Q_UNUSED( aPtr );
+}
+
+// -----------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::RestartDisplayTimer
+// -----------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackUserInputHandler::RestartDisplayTimer()
+{
+
+}
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testprogressbar/inc/testprogressbar.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,75 @@
+/**
+* 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: tester for methods in TestMPXVideoPlaybackButtonBar
+*
+*/
+
+// Version : %version: 1 %
+
+#ifndef __TESTPROGRESSBAR_H__
+#define __TESTPROGRESSBAR_H__
+
+
+// INCLUDES
+#include <QtTest/QtTest>
+
+class QMPXVideoPlaybackProgressBar;
+class QMPXVideoPlaybackControlsController;
+
+class TestProgressBar : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * will be called before each testfunction is executed.
+ *
+ */
+ void init();
+
+ /**
+ * will be called after every testfunction.
+ *
+ */
+ void cleanup();
+
+ void setup();
+
+ // test functions for the test framework
+private slots:
+ void testMousePressEvent();
+ void testMouseReleaseEvent();
+ void testMouseMoveEvent();
+ void testUpdateWithFileDetails();
+ void testUpdateState();
+ void testDurationChanged();
+ void testPositionChanged();
+
+
+signals:
+ void commandSignal(int);
+
+private:
+ QMPXVideoPlaybackProgressBar* mProgBar;
+ QMPXVideoPlaybackControlsController* mController;
+};
+
+
+#endif // __TESTPROGRESSBAR_H__
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testprogressbar/src/testprogressbar.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,250 @@
+/**
+* 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: tester for methods in TestMPXVideoPlaybackButtonBar
+*
+*/
+
+// Version : %version: 1 %
+
+
+#include <qdebug>
+#include <hbmainwindow.h>
+#include <hbapplication.h>
+#include <qgraphicssceneevent>
+#include <hbprogressbar.h>
+
+
+#include "testprogressbar.h"
+#include "mpxvideoplaybackviewfiledetails.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+#include "hblabel.h"
+
+#define private public
+#include "mpxvideoplaybackprogressbar.h"
+#undef private
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ MPX_ENTER_EXIT(_L("TestProgressBar::Main()"));
+
+ HbApplication app(argc, argv);
+ HbMainWindow window;
+
+ TestProgressBar tv;
+
+ char *pass[3];
+ pass[0] = argv[0];
+ pass[1] = "-o";
+ pass[2] = "c:\\data\\TestProgressBar.txt";
+
+ int res = QTest::qExec(&tv, 3, pass);
+
+ return res;
+}
+
+
+// ---------------------------------------------------------------------------
+// init
+// ---------------------------------------------------------------------------
+//
+void TestProgressBar::init()
+{
+ MPX_ENTER_EXIT(_L("TestProgressBar::init()"));
+}
+
+// ---------------------------------------------------------------------------
+// setup
+// ---------------------------------------------------------------------------
+//
+void TestProgressBar::setup()
+{
+ MPX_ENTER_EXIT(_L("TestProgressBar::setup()"));
+
+ mController = new QMPXVideoPlaybackControlsController();
+ mProgBar = new QMPXVideoPlaybackProgressBar( mController );
+
+ mProgBar->initialize();
+}
+
+// ---------------------------------------------------------------------------
+// cleanup
+// ---------------------------------------------------------------------------
+//
+void TestProgressBar::cleanup()
+{
+ MPX_ENTER_EXIT(_L("TestProgressBar::cleanup()"));
+
+ if ( mController )
+ {
+ delete mController;
+ mController = NULL;
+ }
+
+ if ( mProgBar )
+ {
+ delete mProgBar;
+ mProgBar = NULL;
+ }
+}
+
+// ---------------------------------------------------------------------------
+// testMousePressEvent
+// ---------------------------------------------------------------------------
+//
+void TestProgressBar::testMousePressEvent()
+{
+ MPX_ENTER_EXIT(_L("TestProgressBar::testMousePressEvent()"));
+
+ setup();
+ mController->mState = EPbStatePlaying;
+ QGraphicsSceneMouseEvent* event = new QGraphicsSceneMouseEvent( QEvent::GraphicsSceneMousePress );
+ event->setAccepted( false );
+
+ mProgBar->mousePressEvent(event);
+
+ QVERIFY( mController->mTimerAction == EMPXTimerCancel );
+ QVERIFY( mProgBar->mNeedToResumeAfterSetPosition );
+ QVERIFY( event->isAccepted() );
+
+ delete event;
+ event = NULL;
+}
+
+// ---------------------------------------------------------------------------
+// testMouseReleaseEvent
+// ---------------------------------------------------------------------------
+//
+void TestProgressBar::testMouseReleaseEvent()
+{
+ MPX_ENTER_EXIT(_L("TestProgressBar::testMouseReleaseEvent()"));
+
+ setup();
+ QGraphicsSceneMouseEvent* event = new QGraphicsSceneMouseEvent( QEvent::GraphicsSceneMouseRelease );
+ event->setAccepted( false );
+
+ mProgBar->mouseReleaseEvent(event);
+
+ QVERIFY( mController->mTimerAction == EMPXTimerReset );
+ QVERIFY( event->isAccepted() );
+
+ delete event;
+ event = NULL;
+}
+
+// ---------------------------------------------------------------------------
+// testMouseMoveEvent
+// ---------------------------------------------------------------------------
+//
+void TestProgressBar::testMouseMoveEvent()
+{
+ MPX_ENTER_EXIT(_L("TestProgressBar::testMouseMoveEvent()"));
+
+ setup();
+ QGraphicsSceneMouseEvent* event = new QGraphicsSceneMouseEvent( QEvent::GraphicsSceneMouseMove );
+ event->setAccepted( false );
+ mProgBar->mDuration = 0;
+
+ mProgBar->mouseMoveEvent(event);
+
+ QVERIFY( mProgBar->mPositionLabel->mTextSet );
+ QVERIFY( event->isAccepted() );
+
+ delete event;
+ event = NULL;
+}
+
+// ---------------------------------------------------------------------------
+// testUpdateWithFileDetails
+// ---------------------------------------------------------------------------
+//
+void TestProgressBar::testUpdateWithFileDetails()
+{
+ MPX_ENTER_EXIT(_L("TestProgressBar::testUpdateWithFileDetails()"));
+
+ setup();
+
+ // test for live
+ mController->mFileDetails->mPlaybackMode = EMPXVideoLiveStreaming;
+ mProgBar->updateWithFileDetails( mController->mFileDetails );
+ QVERIFY( mProgBar->mDurationLabel->mLabelText == "Live" );
+
+ // test for tv-out
+ mController->mFileDetails->mPlaybackMode = EMPXVideoLocal;
+ mController->mFileDetails->mTvOutConnected = true;
+ mController->mFileDetails->mTvOutPlayAllowed = false;
+ mProgBar->updateWithFileDetails( mController->mFileDetails );
+ QVERIFY( ! mProgBar->isEnabled() );
+
+}
+
+// ---------------------------------------------------------------------------
+// testUpdateState
+// ---------------------------------------------------------------------------
+//
+void TestProgressBar::testUpdateState()
+{
+ MPX_ENTER_EXIT(_L("TestProgressBar::testUpdateState()"));
+
+ setup();
+
+ // test for 1st block of cases
+ mController->mFileDetails->mPlaybackMode = EMPXVideoLiveStreaming;
+ mController->mViewMode = EAudioOnlyView;
+ mProgBar->updateState(EPbStatePlaying);
+ QVERIFY( mProgBar->mDurationLabel->mLabelText == "Live" );
+
+ // test for 2nd block of cases
+ mProgBar->updateState(EPbStateBuffering);
+ QVERIFY( ! mProgBar->isEnabled() );
+
+}
+
+// ---------------------------------------------------------------------------
+// testDurationChanged
+// ---------------------------------------------------------------------------
+//
+void TestProgressBar::testDurationChanged()
+{
+ MPX_ENTER_EXIT(_L("TestProgressBar::testDurationChanged()"));
+
+ setup();
+
+ mProgBar->durationChanged( 120 );
+
+ QVERIFY( mProgBar->mDuration == 120 );
+ QVERIFY( mProgBar->mProgressSlider->maximum() == 120 );
+
+}
+
+// ---------------------------------------------------------------------------
+// testPositionChanged
+// ---------------------------------------------------------------------------
+//
+void TestProgressBar::testPositionChanged()
+{
+ MPX_ENTER_EXIT(_L("TestProgressBar::testPositionChanged()"));
+
+ setup();
+ mProgBar->mDragging = false;
+
+ mProgBar->positionChanged( 60 );
+ QVERIFY( mProgBar->mPositionLabel->mTextSet );
+
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testprogressbar/stub/inc/hblabel.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* 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 Implementation of HbLabel
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef HBLABEL_H_
+#define HBLABEL_H_
+
+#include <hbwidget.h>
+
+
+class HbLabel : public HbWidget
+{
+ Q_OBJECT
+
+ public:
+ HbLabel();
+ virtual ~HbLabel();
+
+ public:
+ void setVisible( bool visible );
+
+ bool isVisible();
+
+ void setPlainText(const QString &text);
+
+ public:
+ bool mVisible;
+ bool mTextSet;
+ QString mLabelText;
+};
+
+#endif /*HBPUSHBUTTON_H*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testprogressbar/stub/inc/mpxvideoplaybackcontrolscontroller.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,349 @@
+/*
+* 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: Implementation of MPXVideoPlaybackControlsController
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_
+#define MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_
+
+// INCLUDES
+#include <qobject>
+
+#include <mpxplaybackframeworkdefs.h>
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackcontrol.hrh"
+#include "mpxcommonvideoplaybackview.hrh"
+#include "mpxvideoplaybackviewfiledetails.h"
+
+// FORWARD DECLARATIONS
+class QTimer;
+class QString;
+class HbAction;
+class QActionGroup;
+class QMPXVideoPlaybackControlPolicy;
+class QMPXVideoPlaybackControlsLayout;
+class QMPXVideoPlaybackDocumentLoader;
+class QMPXVideoPlaybackFullScreenControl;
+class QMPXVideoPlaybackNonTouchVolumeBar;
+class QMPXVideoPlaybackControlsController;
+class QMPXVideoPlaybackControlConfiguration;
+
+
+// DATA TYPES
+
+enum TMPXTimerAction
+{
+ EMPXTimerCancel,
+ EMPXTimerReset
+};
+
+enum TPlaybackViewMode
+{
+ EFullScreenView,
+ EDetailsView,
+ EAudioOnlyView
+};
+
+const int KMPXControlsTimeOut = 4000;
+
+
+// CLASS DECLARATION
+
+class QMPXVideoPlaybackControlsController : public QObject
+{
+ Q_OBJECT
+
+ public:
+
+ /**
+ * constructor.
+ */
+ QMPXVideoPlaybackControlsController();
+
+ /**
+ * Destructor.
+ */
+ virtual ~QMPXVideoPlaybackControlsController();
+
+ public:
+
+ /**
+ * Handle event from container
+ */
+ void handleEvent( TMPXVideoPlaybackControlCommandIds event, int value = 0 );
+
+ /**
+ * Command handling function.
+ * Call HandleCommandL() of container
+ */
+ void handleCommand( TMPXVideoPlaybackViewCommandIds command, int value = 0 );
+
+ /*
+ * Return ETrue if TV-out cable gets connected
+ */
+ inline bool isTvOutConnected();
+
+ /*
+ * Return ETrue if TV-out cable is connected and content can be played
+ */
+ inline bool isTvOutPlaybackAllowed();
+
+ /**
+ * Reset or cancel timers for the controls
+ */
+ void resetDisappearingTimers( TMPXTimerAction timerAction );
+
+ /**
+ * Return state
+ */
+ inline TMPXPlaybackState state();
+
+ /**
+ * Return file details
+ */
+ inline QMPXVideoPlaybackViewFileDetails* fileDetails();
+
+ //
+ // Add the file details to the controls controller when available
+ //
+ void addFileDetails( QMPXVideoPlaybackViewFileDetails* details );
+
+ QMPXVideoPlaybackDocumentLoader* layoutLoader();
+
+ inline bool isFlipView();
+
+ void updateVideoRectDone();
+
+ void changeViewMode( TPlaybackViewMode viewMode, bool transitionEffect = true );
+
+ TPlaybackViewMode viewMode();
+
+ public:
+ /**
+ * Initialize controller
+ */
+ void initializeController();
+
+ /**
+ * Create controls
+ */
+ void createControls();
+
+ /**
+ * Update controls
+ */
+ void handleStateChange( TMPXPlaybackState newState );
+
+ /**
+ * Update Control's visibility
+ */
+ void updateControlsVisibility();
+
+ /**
+ * Toggle visibility
+ */
+ void toggleVisibility();
+
+ /**
+ * Create/delete controls based on updated control list
+ */
+ void controlsListUpdated();
+
+ /**
+ * Show Controls and reset the timers
+ */
+ void showControls();
+
+ /**
+ * Return ETrue if any control is visible
+ */
+ bool isVisible();
+
+ /**
+ * Append a control based on control index
+ */
+ void appendControl( TMPXVideoPlaybackControls controlIndex );
+
+ /**
+ * Set changed volume
+ */
+ void volumeChanged( int volume );
+
+ /**
+ * Set changed duration
+ */
+ void durationChanged( int duration);
+
+ /**
+ * Set changed position
+ */
+ void positionChanged( int position );
+
+ /**
+ * Set changed position
+ */
+ void aspectRatioChanged( int aspectRatio );
+
+ /*
+ * Sets the download size on the progress bar
+ */
+ void setDownloadSize( int size );
+
+ /*
+ * Updates the download ratio on the progress bar
+ */
+ void updateDownloadPosition( int newSize );
+
+ /**
+ * Set changed state on button bar
+ */
+ void updateStateOnButtonBar();
+
+ /**
+ * Check whether this clip is real format or not
+ */
+ bool realFormat( QString filename );
+
+ /**
+ * Check whether this clip is real format or not for streaming/live streaming
+ */
+ bool realFormatForStreaming( const TDesC& des );
+
+ /**
+ * Check whether this clip is real format or not for local/progressive donwload
+ */
+ bool realFormatForLocal();
+
+ /**
+ * Handle errors
+ */
+ void handleErrors();
+
+ /**
+ * Return ETrue if control is visible
+ */
+ bool isSoftKeyVisible( int value );
+
+ /**
+ * Handle tvout connected/disconnected event
+ */
+ void handleTvOutEvent( bool connected,
+ TMPXVideoPlaybackControlCommandIds event,
+ int value );
+
+ HbAction* createAction( QActionGroup *actionsGroup,
+ int index,
+ const char *slot,
+ const QString& toolTip );
+
+ void updateVideoRect( bool transitionEffect = true );
+
+ void showVolumeControls();
+
+ private slots:
+ void hideAllControls();
+ void skipToNextVideoItem();
+ void skipToPreviousVideoItem();
+ void handleTappedOnScreen();
+
+ public:
+ QMPXVideoPlaybackViewFileDetails *mFileDetails;
+
+ QList<QMPXVideoPlaybackFullScreenControl*> mControls;
+
+ QMPXVideoPlaybackControlPolicy *mControlsPolicy;
+ QMPXVideoPlaybackControlConfiguration *mControlsConfig;
+
+ QTimer *mControlsTimer;
+
+ QMPXVideoPlaybackDocumentLoader *mLoader;
+ QMPXVideoPlaybackNonTouchVolumeBar *mVolumeControl;
+
+ bool mFlipViewOpened;
+ bool mViewTransitionIsGoingOn;
+ TMPXPlaybackState mState;
+ TPlaybackViewMode mViewMode;
+ TMPXTimerAction mTimerAction;
+
+};
+
+// INLINE METHODS
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::state
+// -------------------------------------------------------------------------------------------------
+//
+inline
+TMPXPlaybackState QMPXVideoPlaybackControlsController::state()
+{
+ return mState;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::fileDetails
+// -------------------------------------------------------------------------------------------------
+//
+inline
+QMPXVideoPlaybackViewFileDetails* QMPXVideoPlaybackControlsController::fileDetails()
+{
+ return mFileDetails;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::isTvOutConnected
+// -------------------------------------------------------------------------------------------------
+//
+inline
+bool QMPXVideoPlaybackControlsController::isTvOutConnected()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::isTvOutConnected(%d)"),
+ mFileDetails->mTvOutConnected);
+
+ return mFileDetails->mTvOutConnected;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::isTvOutPlaybackAllowed
+// -------------------------------------------------------------------------------------------------
+//
+inline
+bool QMPXVideoPlaybackControlsController::isTvOutPlaybackAllowed()
+{
+ bool playable = ( ! mFileDetails->mTvOutConnected || mFileDetails->mTvOutPlayAllowed );
+
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::isTvOutPlaybackAllowed() [%d]"),
+ playable);
+
+ return playable;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::isFlipView
+// -------------------------------------------------------------------------------------------------
+//
+inline
+bool QMPXVideoPlaybackControlsController::isFlipView()
+{
+ return mFlipViewOpened;
+}
+
+
+#endif /*MPXVIDEOPLAYBACKCONTROLSCONTROLLER_P_H_*/
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testprogressbar/stub/inc/mpxvideoplaybackdocumentloader.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackDocumentLoader
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKDOCUMENTHANDLER_H_
+#define MPXVIDEOPLAYBACKDOCUMENTHANDLER_H_
+
+
+#include <qobject>
+
+class QList;
+class QGraphicsWidget;
+class QMPXVideoPlaybackControlsController;
+
+class QMPXVideoPlaybackDocumentLoader : public QObject
+{
+ public:
+ QMPXVideoPlaybackDocumentLoader();
+
+ virtual ~QMPXVideoPlaybackDocumentLoader();
+
+ public:
+ QGraphicsWidget* findWidget( const QString &name );
+
+ private:
+ QGraphicsWidget* createWidget( const QString &name );
+ int exist( const QString &name );
+
+ private:
+ QList<QGraphicsWidget*> mWidgets;
+};
+
+#endif /*MPXVIDEOPLAYBACKDOCUMENTHANDLER_H_*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testprogressbar/stub/inc/mpxvideoplaybackfullscreencontrol.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,103 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackFullScreenControl
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKFULLSCREENCONTROL_H_
+#define MPXVIDEOPLAYBACKFULLSCREENCONTROL_H_
+
+#include <qobject>
+
+#include <mpxvideoplaybackcontrol.hrh>
+#include <mpxplaybackframeworkdefs.h>
+
+class HbWidget;
+class QMPXVideoPlaybackViewFileDetails;
+class QMPXVideoPlaybackControlsController;
+
+class QMPXVideoPlaybackFullScreenControl : public QObject
+{
+ Q_OBJECT
+
+ public:
+ QMPXVideoPlaybackFullScreenControl( QMPXVideoPlaybackControlsController* controller,
+ TMPXVideoPlaybackControls index,
+ HbWidget* widget,
+ TUint controlproperties );
+
+ virtual ~QMPXVideoPlaybackFullScreenControl();
+
+ public:
+
+ /**
+ * Set visibility of each control
+ */
+ virtual void setVisibility( TMPXPlaybackState aState );
+
+ /**
+ * return control index
+ */
+ TMPXVideoPlaybackControls controlIndex();
+
+ /**
+ * set changed volume
+ */
+ bool volumeChanged( int aVolume );
+
+ /**
+ * set changed duration
+ */
+ bool durationChanged( int duration );
+
+ /**
+ * set changed volume
+ */
+ bool positionChanged( int position );
+
+ /**
+ * Set changed position
+ */
+ bool aspectRatioChanged( int aspectRatio );
+
+ /**
+ * set changed state
+ */
+ void updateState( TMPXPlaybackState state );
+
+ /*
+ * Update the controls with the file details
+ */
+ virtual void updateControlsWithFileDetails( QMPXVideoPlaybackViewFileDetails *details );
+
+ virtual void setVisible( bool visible );
+
+ virtual bool isVisible();
+
+ virtual void updateControlProperties( TUint properties );
+
+ protected:
+ QMPXVideoPlaybackControlsController* mController;
+ HbWidget *mControl;
+ TMPXVideoPlaybackControls mControlIndex;
+ TUint mProperties;
+ bool mVisible;
+};
+
+#endif /*MPXVIDEOPLAYBACKFULLSCREENCONTROL_H_*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testprogressbar/stub/inc/mpxvideoplaybackviewfiledetails.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* 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: MPX Video File Details (QT)
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+
+#ifndef __MPXVIDEOPLAYBACKVIEWFILEDETAILS__
+#define __MPXVIDEOPLAYBACKVIEWFILEDETAILS__
+
+#include <qobject.h>
+#include "mpxhelixplaybackplugindefs.h"
+
+
+//
+// CLASS DECLARATION
+//
+class QMPXVideoPlaybackViewFileDetails : public QObject
+{
+ public:
+ //
+ // Constructor
+ //
+ QMPXVideoPlaybackViewFileDetails();
+
+ //
+ // Destructor.
+ //
+ virtual ~QMPXVideoPlaybackViewFileDetails();
+
+ //
+ // Clear all file details
+ //
+ void clearFileDetails();
+
+ public:
+ //
+ // Data
+ //
+ QString mClipName;
+ QString mTitle;
+ QString mArtist;
+ QString mMimeType;
+ QString mDescription;
+ QString mLocation;
+ QString mCopyright;
+ QString mLanguage;
+ QString mKeywords;
+
+ TMPXVideoMode mPlaybackMode;
+ bool mSeekable;
+ bool mPausableStream;
+ bool mAudioEnabled;
+ bool mVideoEnabled;
+ bool mPartialPlayback;
+ bool mRNFormat;
+ bool mTvOutConnected;
+ bool mTvOutPlayAllowed;
+ bool mDrmProtected;
+ bool mMultiItemPlaylist;
+
+ int mVideoHeight;
+ int mVideoWidth;
+ int mBitRate;
+ int mDuration;
+};
+
+#endif // __MPXVIDEOPLAYBACKVIEWFILEDETAILS__
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testprogressbar/stub/src/hblabel.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* 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: Implementation of HbLabel
+*
+*/
+
+// Version : %version: 1 %
+
+
+#include "hblabel.h"
+
+// -------------------------------------------------------------------------------------------------
+// HbPushButton::HbPushButton
+// -------------------------------------------------------------------------------------------------
+//
+HbLabel::HbLabel()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbLabel::~HbLabel
+// -------------------------------------------------------------------------------------------------
+//
+HbLabel::~HbLabel()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbLabel::setVisible
+// -------------------------------------------------------------------------------------------------
+//
+void HbLabel::setVisible( bool visible )
+{
+ mVisible = visible;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbLabel::setPlainText
+// -------------------------------------------------------------------------------------------------
+//
+void HbLabel::setPlainText(const QString &text)
+{
+ mTextSet = true;
+ mLabelText = text;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbLabel::isVisible
+// -------------------------------------------------------------------------------------------------
+//
+bool HbLabel::isVisible()
+{
+ return mVisible;
+}
+
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testprogressbar/stub/src/mpxvideoplaybackcontrolscontroller.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,403 @@
+/*
+* Copyright (c) 20010 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: Implementation of MPXVideoPlaybackControlsController
+*
+*/
+
+// Version : %version:2 %
+
+
+
+// INCLUDE FILES
+
+
+#include "mpxvideoplaybackdocumentloader.h"
+#include "mpxvideoplaybackviewfiledetails.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+
+#include "mpxvideoplaybackcontrolconfiguration.h"
+
+
+// ================= MEMBER FUNCTIONS ==============================================================
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::QMPXVideoPlaybackControlsController()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackControlsController::QMPXVideoPlaybackControlsController()
+{
+ initializeController();
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::initializeController()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::initializeController()
+{
+ mLoader = new QMPXVideoPlaybackDocumentLoader();
+ mFileDetails = new QMPXVideoPlaybackViewFileDetails();
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::addFileDetails()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::addFileDetails(
+ QMPXVideoPlaybackViewFileDetails* details )
+{
+ Q_UNUSED( details );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController"));
+
+ if ( mLoader )
+ {
+ delete mLoader;
+ mLoader = NULL;
+ }
+
+ if ( mFileDetails )
+ {
+ delete mFileDetails;
+ mFileDetails = NULL;
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleEvent
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleEvent(
+ TMPXVideoPlaybackControlCommandIds event, int value )
+{
+ switch ( event )
+ {
+ case EMPXControlCmdTvOutConnected:
+ {
+ handleTvOutEvent( true, event, value );
+ break;
+ }
+ case EMPXControlCmdTvOutDisconnected:
+ {
+ handleTvOutEvent( false, event, value );
+ break;
+ }
+ case EMPXControlCmdSetVolume:
+ {
+ mFileDetails->mAudioEnabled = false;
+ break;
+ }
+ case EMPXControlCmdSetDuration:
+ {
+ mFileDetails->mDuration = value;
+ break;
+ }
+ case EMPXControlCmdShowVolumeControls:
+ {
+ mFileDetails->mAudioEnabled = true;
+ break;
+ }
+ case EMPXControlCmdSetPosition:
+ {
+ mFileDetails->mSeekable = true;
+ break;
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleStateChange
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleStateChange( TMPXPlaybackState newState )
+{
+ Q_UNUSED( newState );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::controlsListUpdated()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::controlsListUpdated()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::appendControl()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::appendControl( TMPXVideoPlaybackControls controlIndex )
+{
+ Q_UNUSED( controlIndex );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::resetDisappearingTimers()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::resetDisappearingTimers( TMPXTimerAction timerAction )
+{
+ mTimerAction = timerAction;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::hideAllControls()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::hideAllControls()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::showControls()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::showControls()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::isVisible()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackControlsController::isVisible()
+{
+ return false;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleCommand()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleCommand(
+ TMPXVideoPlaybackViewCommandIds command, int value )
+{
+ Q_UNUSED( command );
+ Q_UNUSED( value );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::volumeChanged()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::volumeChanged( int volume )
+{
+ Q_UNUSED( volume );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::showVolumeControls()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::showVolumeControls()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::durationChanged()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::durationChanged( int duration )
+{
+ Q_UNUSED( duration );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::positionChanged()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::positionChanged( int position )
+{
+ Q_UNUSED( position );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::aspectRatioChanged()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::aspectRatioChanged( int aspectRatio )
+{
+ Q_UNUSED( aspectRatio );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::realFormat()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackControlsController::realFormat( QString filename )
+{
+ Q_UNUSED( filename );
+ return false;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::realFormatForStreaming()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackControlsController::realFormatForStreaming( const TDesC& des )
+{
+ Q_UNUSED( des );
+ bool realFormat = false;
+ return realFormat;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::realFormatForLocal()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackControlsController::realFormatForLocal()
+{
+ bool realFormat = false;
+
+ return realFormat;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::setDownloadSize()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::setDownloadSize( int size )
+{
+ Q_UNUSED( size );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::updateDownloadPosition()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::updateDownloadPosition( int size )
+{
+ Q_UNUSED( size );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleErrors
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleErrors()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::isSoftKeyVisible()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackControlsController::isSoftKeyVisible( int /*value*/ )
+{
+ return false;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleTvOutEvent
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleTvOutEvent(
+ bool connected, TMPXVideoPlaybackControlCommandIds event, int value )
+{
+ Q_UNUSED( event );
+ Q_UNUSED( value );
+ mFileDetails->mTvOutConnected = connected;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::updateVideoRectDone
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::updateVideoRectDone()
+{
+ mViewTransitionIsGoingOn = false;
+
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::skipToPreviousVideoItem
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::skipToPreviousVideoItem()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::skipToNextVideoItem
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::skipToNextVideoItem()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::updateVideoRect()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::updateVideoRect( bool transitionEffect )
+{
+ Q_UNUSED( transitionEffect );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleTappedOnScreen()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleTappedOnScreen()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::changeViewMode
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::changeViewMode(
+ TPlaybackViewMode viewMode, bool transitionEffect )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::changeViewMode()"));
+
+ Q_UNUSED( transitionEffect );
+ mViewMode = viewMode;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::layoutLoader
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackDocumentLoader* QMPXVideoPlaybackControlsController::layoutLoader()
+{
+ return mLoader;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::viewMode
+// -------------------------------------------------------------------------------------------------
+//
+TPlaybackViewMode QMPXVideoPlaybackControlsController::viewMode()
+{
+ return mViewMode;
+}
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testprogressbar/stub/src/mpxvideoplaybackdocumentloader.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,140 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackDocumentLoader
+*
+*/
+
+// Version : %version: 1 %
+
+
+#include <hbwidget.h>
+#include <hbtransparentwindow.h>
+#include <hbprogressbar.h>
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackdocumentloader.h"
+#include "hblabel.h"
+
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::~QMPXVideoPlaybackDocumentLoader
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackDocumentLoader::~QMPXVideoPlaybackDocumentLoader()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader") );
+
+ for ( int i = 0 ; i < mWidgets.count() ; i++ )
+ {
+ mWidgets.removeAt( 0 );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::findWidget()
+// -------------------------------------------------------------------------------------------------
+//
+QGraphicsWidget *QMPXVideoPlaybackDocumentLoader::findWidget( const QString &name )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::findWidget") );
+
+ QGraphicsWidget *object = NULL;
+
+ int index = exist( name );
+
+ if ( index == -1 )
+ {
+ object = createWidget( name );
+ }
+ else
+ {
+ object = mWidgets[ index ];
+ }
+
+ return object;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::createWidget()
+// -------------------------------------------------------------------------------------------------
+//
+QGraphicsWidget *QMPXVideoPlaybackDocumentLoader::createWidget( const QString &name )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::createWidget") );
+
+ QGraphicsWidget *object = NULL;
+
+ if ( name == "transparentWindow" )
+ {
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::creating transparentWindow") );
+
+ object = new HbTransparentWindow();
+ object->setObjectName( name );
+
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::appending to object list") );
+ mWidgets.append( object );
+ }
+ else if ( name == "title" || name == "positionLabel" || name == "durationLabel" )
+ {
+ object = new HbLabel();
+ object->setObjectName( name );
+ mWidgets.append( object );
+ }
+ else if ( name == "progressSlider" )
+ {
+ object = new HbProgressBar();
+ object->setObjectName( name );
+ mWidgets.append( object );
+ }
+
+
+ return object;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::exist()
+// -------------------------------------------------------------------------------------------------
+//
+int QMPXVideoPlaybackDocumentLoader::exist( const QString &name )
+{
+ int i = 0;
+
+ for ( ; i < mWidgets.count() ; i++ )
+ {
+ if( mWidgets[i]->objectName() == name )
+ {
+ break;
+ }
+ }
+
+ if ( i == mWidgets.count() )
+ {
+ i = -1;
+ }
+
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::exist %d"), i );
+
+ return i;
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testprogressbar/stub/src/mpxvideoplaybackfullscreencontrol.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,196 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackFullScreenControl
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#include <w32std.h>
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackbuttonbar.h"
+#include "mpxvideoplaybackprogressbar.h"
+#include "mpxvideoplaybackfullscreencontrol.h"
+#include "mpxvideoplaybackfiledetailswidget.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+#include "mpxvideoplaybackdetailsplaybackwindow.h"
+
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::QMPXVideoPlaybackFullScreenControl()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackFullScreenControl::QMPXVideoPlaybackFullScreenControl(
+ QMPXVideoPlaybackControlsController* controller,
+ TMPXVideoPlaybackControls index,
+ HbWidget* widget,
+ TUint controlproperties )
+ : mController( controller )
+ , mControl( widget )
+ , mControlIndex( index )
+ , mProperties( controlproperties )
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackFullScreenControl::QMPXVideoPlaybackFullScreenControl()"));
+
+ setParent( mController );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::~QMPXVideoPlaybackFullScreenControl()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackFullScreenControl::~QMPXVideoPlaybackFullScreenControl()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackFullScreenControl"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::setVisible()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackFullScreenControl::setVisible( bool visible )
+{
+ mControl->setVisible( visible );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::isVisible()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackFullScreenControl::isVisible()
+{
+ return mVisible;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::setVisibility()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackFullScreenControl::setVisibility( TMPXPlaybackState /*state*/ )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackFullScreenControl::setVisibility()"));
+
+ mVisible = true;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::controlIndex()
+// -------------------------------------------------------------------------------------------------
+//
+TMPXVideoPlaybackControls QMPXVideoPlaybackFullScreenControl::controlIndex()
+{
+ return mControlIndex;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::volumeChanged()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackFullScreenControl::volumeChanged( int /*volume*/ )
+{
+ return true;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::durationChanged()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackFullScreenControl::durationChanged( int duration )
+{
+ bool changed = EFalse;
+
+ if ( mControlIndex == EMPXProgressBar )
+ {
+ MPX_DEBUG(_L("QMPXVideoPlaybackFullScreenControl::DurationChanged() [%d]"), duration);
+
+ static_cast<QMPXVideoPlaybackProgressBar*>(mControl)->durationChanged( duration );
+
+ changed = ETrue;
+ }
+
+ return changed;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::positionChanged()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackFullScreenControl::positionChanged( int position )
+{
+ bool changed = EFalse;
+
+ if ( mControlIndex == EMPXProgressBar )
+ {
+ MPX_DEBUG(_L("QMPXVideoPlaybackFullScreenControl::positionChanged() [%d]"), position);
+
+ static_cast<QMPXVideoPlaybackProgressBar*>(mControl)->positionChanged( position );
+
+ changed = ETrue;
+ }
+
+ return changed;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::aspectRatioChanged()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackFullScreenControl::aspectRatioChanged( int aspectRatio )
+{
+ bool changed = EFalse;
+
+ if ( mControlIndex == EMPXButtonBar )
+ {
+ MPX_DEBUG(
+ _L("QMPXVideoPlaybackFullScreenControl::aspectRatioChanged() [%d]"), aspectRatio);
+
+ static_cast<QMPXVideoPlaybackButtonBar*>(mControl)->aspectRatioChanged( aspectRatio );
+
+ changed = ETrue;
+ }
+
+ return changed;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::updateState()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackFullScreenControl::updateState( TMPXPlaybackState state )
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::updateControlsWithFileDetails()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackFullScreenControl::updateControlsWithFileDetails(
+ QMPXVideoPlaybackViewFileDetails* details )
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::updateControlProperties()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackFullScreenControl::updateControlProperties( TUint properties )
+{
+ mProperties = properties;
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testprogressbar/stub/src/mpxvideoplaybackviewfiledetails.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* 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: class for MPX Video File Details (Qt)
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+//
+// INCLUDE FILES
+//
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackviewfiledetails.h"
+
+
+// ============================ MEMBER FUNCTIONS ===================================================
+
+QMPXVideoPlaybackViewFileDetails::QMPXVideoPlaybackViewFileDetails()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackViewFileDetails::QMPXVideoPlaybackViewFileDetails()"));
+
+ clearFileDetails();
+}
+
+QMPXVideoPlaybackViewFileDetails::~QMPXVideoPlaybackViewFileDetails()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackViewFileDetails::~QMPXVideoPlaybackViewFileDetails()"));
+
+ clearFileDetails();
+}
+
+void
+QMPXVideoPlaybackViewFileDetails::clearFileDetails()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackViewFileDetails::ClearFileDetails()"));
+
+ mMimeType = tr("");
+ mTitle = tr("");
+ mArtist = tr("");
+ mClipName = tr("");
+ mDescription = tr("");
+ mLocation = tr("");
+ mCopyright = tr("");
+ mLanguage = tr("");
+ mKeywords = tr("");
+
+ mPlaybackMode = EMPXVideoLocal;
+ mSeekable = false;
+ mPausableStream = false;
+ mAudioEnabled = false;
+ mVideoEnabled = false;
+ mPartialPlayback = false;
+ mRNFormat = false;
+
+ mDuration = 100;
+ mTvOutConnected = false;
+ mTvOutPlayAllowed = true;
+ mDrmProtected = false;
+
+ mVideoHeight = 0;
+ mVideoWidth = 0;
+ mBitRate = 0;
+}
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testprogressbar/testprogressbar.pro Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,43 @@
+#
+# 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: Project file for building testprogressbar
+#
+#
+# Version : %version: 1 %
+
+TEMPLATE = app
+TARGET = testprogressbar
+CONFIG += qtestlib qt hb
+
+INCLUDEPATH += stub/inc \
+ ../../../../inc \
+ ../../../inc
+
+
+DEPENDPATH += stub/inc stub/src inc src
+
+# Input
+HEADERS += testprogressbar.h \
+ mpxvideoplaybackcontrolscontroller.h \
+ mpxvideoplaybackdocumentloader.h \
+ mpxvideoplaybackviewfiledetails.h \
+ hblabel.h \
+ ../../controlinc/mpxvideoplaybackprogressbar.h
+
+SOURCES += testprogressbar.cpp \
+ mpxvideoplaybackcontrolscontroller.cpp \
+ mpxvideoplaybackdocumentloader.cpp \
+ mpxvideoplaybackviewfiledetails.cpp \
+ hblabel.cpp \
+ ../../controlsrc/mpxvideoplaybackprogressbar.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/teststatuspanecontrol/inc/teststatuspanecontrol.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,88 @@
+/**
+* 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: test module for QMPXVideoPlaybackStatusPaneControl
+*
+*/
+
+// Version : %version: 1 %
+
+
+#ifndef __TESTSTATUSPANECONTROL_H__
+#define __TESTSTATUSPANECONTROL_H__
+
+
+// INCLUDES
+#include <QtTest/QtTest>
+
+class HbVideoBasePlaybackView;
+class CMPXVideoViewWrapper;
+class QMPXVideoPlaybackViewFileDetails;
+class QMPXVideoPlaybackControlsController;
+class QMPXVideoPlaybackStatusPaneControl;
+
+
+
+class TestStatusPaneControl : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * will be called before each testfunction is executed.
+ *
+ */
+ void init();
+
+ /**
+ * will be called after every testfunction.
+ *
+ */
+ void cleanup();
+
+ // test functions for the test framework
+
+
+ void setup();
+
+private slots:
+
+ void testSetVisible();
+ void testSetMenu();
+ void testUpdateControlsWithFileDetails();
+ void testSetVisibility();
+ void testControlListUpdated();
+ void testSlot_handleAboutToShow();
+ void testSlot_handleAboutToHide();
+ void testSlot_openFullScreenView();
+
+
+
+signals:
+
+ void commandSignal();
+
+private:
+ HbVideoBasePlaybackView* mBaseVideoView;
+ CMPXVideoViewWrapper* mVideoViewWrapper;
+ QMPXVideoPlaybackViewFileDetails* mFileDetails;
+ QMPXVideoPlaybackControlsController* mControlsController;
+ QMPXVideoPlaybackStatusPaneControl* mStatusPane;
+
+};
+
+
+#endif // __TESTSTATUSPANECONTROL_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/teststatuspanecontrol/src/teststatuspanecontrol.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,310 @@
+/**
+* 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: tester for methods in status pane control
+*
+*/
+
+// Version : %version: 3 %
+
+
+#include <hbapplication.h>
+#include <hbinstance.h>
+#include <hbmenu.h>
+#include <QDebug>
+
+
+#include "mpxvideoplaybackcontrol.hrh"
+#include "mpxhelixplaybackplugindefs.h"
+
+#include "teststatuspanecontrol.h"
+
+#include "mpxvideoplaybackviewfiledetails.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+#include "hbvideobaseplaybackview.h"
+#include "mpxvideoviewwrapper.h"
+#include "mpxvideoplaybackdocumentloader.h"
+#include "hblabel.h"
+
+#define private public
+#define protected public
+#include "mpxvideoplaybackstatuspanecontrol.h"
+#undef protected
+#undef private
+
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ MPX_ENTER_EXIT(_L("TestStatusPaneControl::Main()"));
+
+ HbApplication app(argc, argv);
+ HbMainWindow window;
+
+ TestStatusPaneControl tv;
+
+ char *pass[3];
+ pass[0] = argv[0];
+ pass[1] = "-o";
+ pass[2] = "c:\\data\\TestStatusPaneControl.txt";
+
+ int res = QTest::qExec(&tv, 3, pass);
+
+ return res;
+}
+
+// ---------------------------------------------------------------------------
+// init
+// ---------------------------------------------------------------------------
+//
+void TestStatusPaneControl::init()
+{
+ MPX_ENTER_EXIT(_L("TestStatusPaneControl::init()"));
+}
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+void TestStatusPaneControl::setup()
+{
+ MPX_ENTER_EXIT(_L("TestStatusPaneControl::setup()"));
+
+ mBaseVideoView = new HbVideoBasePlaybackView();
+ TRAPD( err, mVideoViewWrapper = CMPXVideoViewWrapper::NewL( mBaseVideoView ) );
+
+ mFileDetails = new QMPXVideoPlaybackViewFileDetails();
+
+ mControlsController = new QMPXVideoPlaybackControlsController( mBaseVideoView,
+ mVideoViewWrapper,
+ mFileDetails );
+
+ mStatusPane = new QMPXVideoPlaybackStatusPaneControl( mControlsController,
+ EMPXStatusPane,
+ NULL,
+ 0 );
+
+}
+
+// ---------------------------------------------------------------------------
+// cleanup
+// ---------------------------------------------------------------------------
+//
+void TestStatusPaneControl::cleanup()
+{
+ MPX_ENTER_EXIT(_L("TestStatusPaneControl::cleanup()"));
+
+ if ( mBaseVideoView )
+ {
+ delete mBaseVideoView;
+ mBaseVideoView = NULL;
+ }
+
+ if ( mVideoViewWrapper )
+ {
+ delete mVideoViewWrapper;
+ mVideoViewWrapper = NULL;
+ }
+
+ if ( mFileDetails )
+ {
+ delete mFileDetails;
+ mFileDetails = NULL;
+ }
+
+ if ( mControlsController )
+ {
+ delete mControlsController;
+ mControlsController = NULL;
+ }
+
+ if ( mStatusPane )
+ {
+ delete mStatusPane;
+ mStatusPane = NULL;
+ }
+}
+
+// ---------------------------------------------------------------------------
+// testSetMenu
+// ---------------------------------------------------------------------------
+//
+void TestStatusPaneControl::testSetMenu()
+{
+ MPX_ENTER_EXIT(_L("TestStatusPaneControl::testSetMenu()"));
+
+ setup();
+
+ mFileDetails->mTvOutConnected = false;
+ mFileDetails->mVideoEnabled = true;
+
+ mStatusPane->setMenu( mFileDetails );
+
+ QVERIFY( mControlsController->view()->menu()->isEmpty() );
+}
+
+// ---------------------------------------------------------------------------
+// testSetVisible
+// ---------------------------------------------------------------------------
+//
+void TestStatusPaneControl::testSetVisible()
+{
+ MPX_ENTER_EXIT(_L("TestStatusPaneControl::testSetVisible()"));
+
+ setup();
+
+ // 1. Set visible
+ mStatusPane->setVisible( true );
+ QVERIFY( mStatusPane->isVisible() );
+ QVERIFY( mStatusPane->mTitleLabel->isVisible() );
+
+ // 2. Set invisible
+ mStatusPane->setVisible( false );
+ QVERIFY( ! mStatusPane->isVisible() );
+ QVERIFY( ! mStatusPane->mTitleLabel->isVisible() );
+
+}
+
+// ---------------------------------------------------------------------------
+// testUpdateControlsWithFileDetails
+// ---------------------------------------------------------------------------
+//
+void TestStatusPaneControl::testUpdateControlsWithFileDetails()
+{
+ MPX_ENTER_EXIT(_L("TestStatusPaneControl::testUpdateControlsWithFileDetails()"));
+
+ setup();
+
+ // 1. test for full creen mode
+ mControlsController->mViewMode = EFullScreenView;
+
+ mFileDetails->mTvOutConnected = true;
+
+ mStatusPane->updateControlsWithFileDetails( mFileDetails );
+
+ QVERIFY( mControlsController->view()->mTitleFlag == HbView::TitleBarTransparent );
+
+ // 2. test for detial view mode
+ mControlsController->mViewMode = EDetailsView;
+
+ mFileDetails->mTvOutConnected = true;
+
+ mStatusPane->updateControlsWithFileDetails( mFileDetails );
+
+ QVERIFY( mControlsController->view()->mTitleFlag == HbView::TitleBarFlagNone );
+
+ // 3. test for audio only mode
+ mControlsController->mViewMode = EAudioOnlyView;
+
+ mFileDetails->mTvOutConnected = true;
+
+ mStatusPane->updateControlsWithFileDetails( mFileDetails );
+
+ QVERIFY( mControlsController->view()->mTitleFlag == HbView::TitleBarFlagNone );
+}
+
+// ---------------------------------------------------------------------------
+// testSetVisibility
+// ---------------------------------------------------------------------------
+//
+void TestStatusPaneControl::testSetVisibility()
+{
+ MPX_ENTER_EXIT(_L("TestStatusPaneControl::testSetVisibility()"));
+
+ setup();
+
+ // 1. test for first block of cases:
+ mStatusPane->setVisibility( EPbStatePaused );
+ QVERIFY( mControlsController->view()->menu()->isEmpty() );
+
+ // 2. test for second block of cases:
+ mStatusPane->setVisibility( EPbStateInitialising );
+ QVERIFY( mControlsController->view()->menu()->isEmpty() );
+}
+
+// ---------------------------------------------------------------------------
+// testControlListUpdated
+// ---------------------------------------------------------------------------
+//
+void TestStatusPaneControl::testControlListUpdated()
+{
+ MPX_ENTER_EXIT(_L("TestStatusPaneControl::testControlListUpdated()"));
+
+ setup();
+
+ mStatusPane->controlListUpdated( mFileDetails );
+
+ QVERIFY( mControlsController->view()->menu()->isEmpty() );
+}
+
+// ---------------------------------------------------------------------------
+// testSlot_handleAboutToShow
+// ---------------------------------------------------------------------------
+//
+void TestStatusPaneControl::testSlot_handleAboutToShow()
+{
+ MPX_ENTER_EXIT(_L("TestStatusPaneControl::testSlot_handleAboutToShow()"));
+
+ setup();
+
+ connect( this, SIGNAL( commandSignal() ), mStatusPane, SLOT( handleAboutToShow() ) );
+
+ emit commandSignal();
+
+ QVERIFY( mControlsController->mTimerAction == EMPXTimerCancel );
+
+ disconnect( this, SIGNAL( commandSignal() ), mStatusPane, SLOT( handleAboutToShow() ) );
+}
+
+// ---------------------------------------------------------------------------
+// testSlot_handleAboutToHide
+// ---------------------------------------------------------------------------
+//
+void TestStatusPaneControl::testSlot_handleAboutToHide()
+{
+ MPX_ENTER_EXIT(_L("TestStatusPaneControl::testSlot_handleAboutToHide()"));
+
+ setup();
+
+ connect( this, SIGNAL( commandSignal() ), mStatusPane, SLOT( handleAboutToHide() ) );
+
+ emit commandSignal();
+
+ QVERIFY( mControlsController->mTimerAction == EMPXTimerReset );
+
+ disconnect( this, SIGNAL( commandSignal() ), mStatusPane, SLOT( handleAboutToHide() ) );
+}
+
+// ---------------------------------------------------------------------------
+// testSlot_openFullScreenView
+// ---------------------------------------------------------------------------
+//
+void TestStatusPaneControl::testSlot_openFullScreenView()
+{
+ MPX_ENTER_EXIT(_L("TestStatusPaneControl::testSlot_openFullScreenView()"));
+
+ setup();
+
+ connect( this, SIGNAL( commandSignal() ), mStatusPane, SLOT( openFullScreenView() ) );
+
+ emit commandSignal();
+
+ QVERIFY( mControlsController->mViewMode == EFullScreenView );
+
+ disconnect( this, SIGNAL( commandSignal() ), mStatusPane, SLOT( openFullScreenView() ) );
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/teststatuspanecontrol/stub/inc/hblabel.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* 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 Implementation of HbLabel
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef HBLABEL_H_
+#define HBLABEL_H_
+
+#include <hbwidget.h>
+
+
+class HbLabel : public HbWidget
+{
+ Q_OBJECT
+
+ public:
+ HbLabel();
+ virtual ~HbLabel();
+
+ public:
+ void setVisible( bool visible );
+
+ bool isVisible();
+
+ public:
+ bool mVisible;
+};
+
+#endif /*HBPUSHBUTTON_H*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/teststatuspanecontrol/stub/inc/hbvideobaseplaybackview.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* 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: HB Video playback view
+*
+*/
+
+// Version : %version: 2 %
+
+
+
+// This file defines the API for .dll
+
+#ifndef __HBVIDEOBASEPLAYBACKVIEW_H__
+#define __HBVIDEOBASEPLAYBACKVIEW_H__
+
+// Include Files
+#include <hbview.h>
+
+class CMPXVideoViewWrapper;
+class RWindow;
+
+// Constants
+
+// Forward Declarations
+
+// Class Definitions
+
+class HbVideoBasePlaybackView : public HbView
+{
+ Q_OBJECT
+
+ public:
+ HbVideoBasePlaybackView();
+ virtual ~HbVideoBasePlaybackView();
+
+ void handleActivateView();
+
+ void handleDeactivateView();
+
+ void mousePressEvent( QGraphicsSceneMouseEvent *event );
+
+ QVariant itemChange( GraphicsItemChange change, const QVariant &value );
+
+ void paint( QPainter *painter,
+ const QStyleOptionGraphicsItem *option,
+ QWidget *widget );
+
+ bool event( QEvent *event );
+
+ virtual void handleClosePlaybackView();
+
+ virtual void handleBufferingState();
+
+ virtual void issuePlayCommand();
+
+ virtual void handlePluginError( int aError );
+
+ virtual void retrievePdlInformation();
+
+ virtual void closePlaybackView();
+
+ void startClosingPlaybackView();
+
+ virtual void doClosePlayer();
+
+ void setTitleBarFlags( HbTitleBarFlags flags );
+
+ public:
+ int mCurrentError; // default = KErrNone
+ bool mViewActive;
+ HbTitleBarFlags mTitleFlag;
+
+ public:
+ friend class CMPXVideoViewWrapper;
+
+};
+
+#endif // __HBVIDEOBASEPLAYBACKVIEW_H__
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/teststatuspanecontrol/stub/inc/mpxvideoplaybackcontrolscontroller.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,368 @@
+/*
+* 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: Implementation of MPXVideoPlaybackControlsController
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_
+#define MPXVIDEOPLAYBACKCONTROLSCONTROLLER_H_
+
+// INCLUDES
+#include <qobject>
+
+#include <mpxplaybackframeworkdefs.h>
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackcontrol.hrh"
+#include "mpxcommonvideoplaybackview.hrh"
+#include "mpxvideoplaybackviewfiledetails.h"
+
+// FORWARD DECLARATIONS
+class QTimer;
+class QString;
+class HbAction;
+class QActionGroup;
+class CMPXVideoViewWrapper;
+class HbVideoBasePlaybackView;
+class QMPXVideoPlaybackControlPolicy;
+class QMPXVideoPlaybackControlsLayout;
+class QMPXVideoPlaybackDocumentLoader;
+class QMPXVideoPlaybackFullScreenControl;
+class QMPXVideoPlaybackNonTouchVolumeBar;
+class QMPXVideoPlaybackControlsController;
+class QMPXVideoPlaybackControlConfiguration;
+
+
+// DATA TYPES
+
+enum TMPXTimerAction
+{
+ EMPXTimerCancel,
+ EMPXTimerReset
+};
+
+enum TPlaybackViewMode
+{
+ EFullScreenView,
+ EDetailsView,
+ EAudioOnlyView
+};
+
+const int KMPXControlsTimeOut = 4000;
+
+
+// CLASS DECLARATION
+
+class QMPXVideoPlaybackControlsController : public QObject
+{
+ Q_OBJECT
+
+ public:
+
+ /**
+ * constructor.
+ */
+ QMPXVideoPlaybackControlsController(
+ HbVideoBasePlaybackView *view,
+ CMPXVideoViewWrapper *viewWrapper,
+ QMPXVideoPlaybackViewFileDetails *details );
+
+ /**
+ * Destructor.
+ */
+ virtual ~QMPXVideoPlaybackControlsController();
+
+ public:
+
+ /**
+ * Handle event from container
+ */
+ void handleEvent( TMPXVideoPlaybackControlCommandIds event, int value = 0 );
+
+ /**
+ * Command handling function.
+ * Call HandleCommandL() of container
+ */
+ void handleCommand( TMPXVideoPlaybackViewCommandIds command, int value = 0 );
+
+ /*
+ * Return ETrue if TV-out cable gets connected
+ */
+ inline bool isTvOutConnected();
+
+ /*
+ * Return ETrue if TV-out cable is connected and content can be played
+ */
+ inline bool isTvOutPlaybackAllowed();
+
+ /**
+ * Reset or cancel timers for the controls
+ */
+ void resetDisappearingTimers( TMPXTimerAction timerAction );
+
+ /**
+ * Return state
+ */
+ inline TMPXPlaybackState state();
+
+ /**
+ * Return file details
+ */
+ inline QMPXVideoPlaybackViewFileDetails* fileDetails();
+
+ //
+ // Add the file details to the controls controller when available
+ //
+ void addFileDetails( QMPXVideoPlaybackViewFileDetails* details );
+
+ QMPXVideoPlaybackDocumentLoader* layoutLoader();
+
+ inline HbVideoBasePlaybackView* view();
+
+ inline bool isFlipView();
+
+ void updateVideoRectDone();
+
+ void changeViewMode( TPlaybackViewMode viewMode, bool transitionEffect = true );
+
+ TPlaybackViewMode viewMode();
+
+ public:
+ /**
+ * Initialize controller
+ */
+ void initializeController();
+
+ /**
+ * Create controls
+ */
+ void createControls();
+
+ /**
+ * Update controls
+ */
+ void handleStateChange( TMPXPlaybackState newState );
+
+ /**
+ * Update Control's visibility
+ */
+ void updateControlsVisibility();
+
+ /**
+ * Toggle visibility
+ */
+ void toggleVisibility();
+
+ /**
+ * Create/delete controls based on updated control list
+ */
+ void controlsListUpdated();
+
+ /**
+ * Show Controls and reset the timers
+ */
+ void showControls();
+
+ /**
+ * Return ETrue if any control is visible
+ */
+ bool isVisible();
+
+ /**
+ * Append a control based on control index
+ */
+ void appendControl( TMPXVideoPlaybackControls controlIndex );
+
+ /**
+ * Set changed volume
+ */
+ void volumeChanged( int volume );
+
+ /**
+ * Set changed duration
+ */
+ void durationChanged( int duration);
+
+ /**
+ * Set changed position
+ */
+ void positionChanged( int position );
+
+ /**
+ * Set changed position
+ */
+ void aspectRatioChanged( int aspectRatio );
+
+ /*
+ * Sets the download size on the progress bar
+ */
+ void setDownloadSize( int size );
+
+ /*
+ * Updates the download ratio on the progress bar
+ */
+ void updateDownloadPosition( int newSize );
+
+ /**
+ * Set changed state on button bar
+ */
+ void updateStateOnButtonBar();
+
+ /**
+ * Check whether this clip is real format or not
+ */
+ bool realFormat( QString filename );
+
+ /**
+ * Check whether this clip is real format or not for streaming/live streaming
+ */
+ bool realFormatForStreaming( const TDesC& des );
+
+ /**
+ * Check whether this clip is real format or not for local/progressive donwload
+ */
+ bool realFormatForLocal();
+
+ /**
+ * Handle errors
+ */
+ void handleErrors();
+
+ /**
+ * Return ETrue if control is visible
+ */
+ bool isSoftKeyVisible( int value );
+
+ /**
+ * Handle tvout connected/disconnected event
+ */
+ void handleTvOutEvent( bool connected,
+ TMPXVideoPlaybackControlCommandIds event,
+ int value );
+
+ HbAction* createAction( QActionGroup *actionsGroup,
+ int index,
+ const char *slot,
+ const QString& toolTip );
+
+ void updateVideoRect( bool transitionEffect = true );
+
+ void showVolumeControls();
+
+ private slots:
+ void hideAllControls();
+ void skipToNextVideoItem();
+ void skipToPreviousVideoItem();
+ void handleTappedOnScreen();
+
+ public:
+ HbVideoBasePlaybackView *mView;
+ CMPXVideoViewWrapper *mViewWrapper;
+ QMPXVideoPlaybackViewFileDetails *mFileDetails;
+
+ QList<QMPXVideoPlaybackFullScreenControl*> mControls;
+
+ QMPXVideoPlaybackControlPolicy *mControlsPolicy;
+ QMPXVideoPlaybackControlConfiguration *mControlsConfig;
+
+ QTimer *mControlsTimer;
+
+ QMPXVideoPlaybackDocumentLoader *mLoader;
+ QMPXVideoPlaybackNonTouchVolumeBar *mVolumeControl;
+
+ bool mFlipViewOpened;
+ bool mViewTransitionIsGoingOn;
+ TMPXPlaybackState mState;
+ TPlaybackViewMode mViewMode;
+ TMPXTimerAction mTimerAction;
+
+};
+
+// INLINE METHODS
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::state
+// -------------------------------------------------------------------------------------------------
+//
+inline
+TMPXPlaybackState QMPXVideoPlaybackControlsController::state()
+{
+ return mState;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::fileDetails
+// -------------------------------------------------------------------------------------------------
+//
+inline
+QMPXVideoPlaybackViewFileDetails* QMPXVideoPlaybackControlsController::fileDetails()
+{
+ return mFileDetails;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::isTvOutConnected
+// -------------------------------------------------------------------------------------------------
+//
+inline
+bool QMPXVideoPlaybackControlsController::isTvOutConnected()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::isTvOutConnected(%d)"),
+ mFileDetails->mTvOutConnected);
+
+ return mFileDetails->mTvOutConnected;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::isTvOutPlaybackAllowed
+// -------------------------------------------------------------------------------------------------
+//
+inline
+bool QMPXVideoPlaybackControlsController::isTvOutPlaybackAllowed()
+{
+ bool playable = ( ! mFileDetails->mTvOutConnected || mFileDetails->mTvOutPlayAllowed );
+
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::isTvOutPlaybackAllowed() [%d]"),
+ playable);
+
+ return playable;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::view
+// -------------------------------------------------------------------------------------------------
+//
+inline
+HbVideoBasePlaybackView* QMPXVideoPlaybackControlsController::view()
+{
+ return mView;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::isFlipView
+// -------------------------------------------------------------------------------------------------
+//
+inline
+bool QMPXVideoPlaybackControlsController::isFlipView()
+{
+ return mFlipViewOpened;
+}
+
+
+#endif /*MPXVIDEOPLAYBACKCONTROLSCONTROLLER_P_H_*/
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/teststatuspanecontrol/stub/inc/mpxvideoplaybackdocumentloader.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackDocumentLoader
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKDOCUMENTHANDLER_H_
+#define MPXVIDEOPLAYBACKDOCUMENTHANDLER_H_
+
+
+#include <qobject>
+
+class QList;
+class QGraphicsWidget;
+class QMPXVideoPlaybackControlsController;
+
+class QMPXVideoPlaybackDocumentLoader : public QObject
+{
+ public:
+ QMPXVideoPlaybackDocumentLoader();
+
+ virtual ~QMPXVideoPlaybackDocumentLoader();
+
+ public:
+ QGraphicsWidget* findWidget( const QString &name );
+
+ private:
+ QGraphicsWidget* createWidget( const QString &name );
+ int exist( const QString &name );
+
+ private:
+ QList<QGraphicsWidget*> mWidgets;
+};
+
+#endif /*MPXVIDEOPLAYBACKDOCUMENTHANDLER_H_*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/teststatuspanecontrol/stub/inc/mpxvideoplaybackfullscreencontrol.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,103 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackFullScreenControl
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKFULLSCREENCONTROL_H_
+#define MPXVIDEOPLAYBACKFULLSCREENCONTROL_H_
+
+#include <qobject>
+
+#include <mpxvideoplaybackcontrol.hrh>
+#include <mpxplaybackframeworkdefs.h>
+
+class HbWidget;
+class QMPXVideoPlaybackViewFileDetails;
+class QMPXVideoPlaybackControlsController;
+
+class QMPXVideoPlaybackFullScreenControl : public QObject
+{
+ Q_OBJECT
+
+ public:
+ QMPXVideoPlaybackFullScreenControl( QMPXVideoPlaybackControlsController* controller,
+ TMPXVideoPlaybackControls index,
+ HbWidget* widget,
+ TUint controlproperties );
+
+ virtual ~QMPXVideoPlaybackFullScreenControl();
+
+ public:
+
+ /**
+ * Set visibility of each control
+ */
+ virtual void setVisibility( TMPXPlaybackState aState );
+
+ /**
+ * return control index
+ */
+ TMPXVideoPlaybackControls controlIndex();
+
+ /**
+ * set changed volume
+ */
+ bool volumeChanged( int aVolume );
+
+ /**
+ * set changed duration
+ */
+ bool durationChanged( int duration );
+
+ /**
+ * set changed volume
+ */
+ bool positionChanged( int position );
+
+ /**
+ * Set changed position
+ */
+ bool aspectRatioChanged( int aspectRatio );
+
+ /**
+ * set changed state
+ */
+ void updateState( TMPXPlaybackState state );
+
+ /*
+ * Update the controls with the file details
+ */
+ virtual void updateControlsWithFileDetails( QMPXVideoPlaybackViewFileDetails *details );
+
+ virtual void setVisible( bool visible );
+
+ virtual bool isVisible();
+
+ virtual void updateControlProperties( TUint properties );
+
+ protected:
+ QMPXVideoPlaybackControlsController* mController;
+ HbWidget *mControl;
+ TMPXVideoPlaybackControls mControlIndex;
+ TUint mProperties;
+ bool mVisible;
+};
+
+#endif /*MPXVIDEOPLAYBACKFULLSCREENCONTROL_H_*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/teststatuspanecontrol/stub/inc/mpxvideoplaybackviewfiledetails.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* 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: MPX Video File Details (QT)
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+
+#ifndef __MPXVIDEOPLAYBACKVIEWFILEDETAILS__
+#define __MPXVIDEOPLAYBACKVIEWFILEDETAILS__
+
+#include <qobject.h>
+#include "mpxhelixplaybackplugindefs.h"
+
+
+//
+// CLASS DECLARATION
+//
+class QMPXVideoPlaybackViewFileDetails : public QObject
+{
+ public:
+ //
+ // Constructor
+ //
+ QMPXVideoPlaybackViewFileDetails();
+
+ //
+ // Destructor.
+ //
+ virtual ~QMPXVideoPlaybackViewFileDetails();
+
+ //
+ // Clear all file details
+ //
+ void clearFileDetails();
+
+ public:
+ //
+ // Data
+ //
+ QString mClipName;
+ QString mTitle;
+ QString mArtist;
+ QString mMimeType;
+ QString mDescription;
+ QString mLocation;
+ QString mCopyright;
+ QString mLanguage;
+ QString mKeywords;
+
+ TMPXVideoMode mPlaybackMode;
+ bool mSeekable;
+ bool mPausableStream;
+ bool mAudioEnabled;
+ bool mVideoEnabled;
+ bool mPartialPlayback;
+ bool mRNFormat;
+ bool mTvOutConnected;
+ bool mTvOutPlayAllowed;
+ bool mDrmProtected;
+ bool mMultiItemPlaylist;
+
+ int mVideoHeight;
+ int mVideoWidth;
+ int mBitRate;
+ int mDuration;
+};
+
+#endif // __MPXVIDEOPLAYBACKVIEWFILEDETAILS__
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/teststatuspanecontrol/stub/inc/mpxvideoviewwrapper.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2008 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: MPX Video base playback view
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+// This file defines the API for .dll
+
+#ifndef __MPXVIDEOVIEWWRAPPER_H__
+#define __MPXVIDEOVIEWWRAPPER_H__
+
+// Include Files
+
+#include <e32base.h> // CBase
+#include <e32std.h> // TBuf
+
+
+#include "mpxvideoplaybackcontrol.hrh"
+
+// Constants
+
+// Forward Declarations
+class HbVideoBasePlaybackView;
+class QMPXVideoPlaybackViewFileDetails;
+
+
+// Class Definitions
+
+class CMPXVideoViewWrapper : public CBase
+{
+ public:
+ static CMPXVideoViewWrapper* NewL( HbVideoBasePlaybackView* aView );
+ virtual ~CMPXVideoViewWrapper();
+
+ CMPXVideoViewWrapper( HbVideoBasePlaybackView* aView );
+ void ConstructL();
+
+ void SetFileDetails(TBool aDefault);
+
+ public:
+ void HandleCommandL( TInt aCommand );
+
+ TBool IsLive();
+
+ TBool IsPlaylist();
+
+ TBool IsMultiItemPlaylist();
+
+ void RequestMediaL();
+
+ void ActivateClosePlayerActiveObject();
+
+ void IssueVideoAppForegroundCmdL( TBool aForeground );
+
+
+ public: // data
+
+ HbVideoBasePlaybackView* iView;
+ TBool iMediaRequested;
+ QMPXVideoPlaybackViewFileDetails* iFileDetails;
+ TBool iClosePlayerAO;
+ TBool iForeground;
+
+};
+
+#endif // __MPXVIDEOVIEWWRAPPER_H__
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/teststatuspanecontrol/stub/src/hblabel.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,58 @@
+/*
+* 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: Implementation of HbLabel
+*
+*/
+
+// Version : %version: 1 %
+
+
+#include "hblabel.h"
+
+// -------------------------------------------------------------------------------------------------
+// HbPushButton::HbPushButton
+// -------------------------------------------------------------------------------------------------
+//
+HbLabel::HbLabel()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbLabel::~HbLabel
+// -------------------------------------------------------------------------------------------------
+//
+HbLabel::~HbLabel()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbLabel::setVisible
+// -------------------------------------------------------------------------------------------------
+//
+void HbLabel::setVisible( bool visible )
+{
+ mVisible = visible;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbLabel::isVisible
+// -------------------------------------------------------------------------------------------------
+//
+bool HbLabel::isVisible()
+{
+ return mVisible;
+}
+
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/teststatuspanecontrol/stub/src/hbvideobaseplaybackview.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,188 @@
+/*
+* 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: Implementation of Video playback view
+*
+*/
+
+// Version : %version: 2 %
+
+
+
+// Include Files
+#include <qgraphicssceneevent>
+#include <hbinstance.h>
+#include <mmf/common/mmferrors.h>
+
+#include "../inc/hbvideobaseplaybackview.h"
+
+
+// Member Functions
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoPlaybackView::HbVideoPlaybackView()
+// -------------------------------------------------------------------------------------------------
+//
+HbVideoBasePlaybackView::HbVideoBasePlaybackView()
+{
+ mCurrentError = KErrNone;
+ mViewActive = false;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoPlaybackView::~HbVideoPlaybackView()
+// -------------------------------------------------------------------------------------------------
+//
+HbVideoBasePlaybackView::~HbVideoBasePlaybackView()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::handleActivateView()
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::handleActivateView()
+{
+ mViewActive = true;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::handleDeactivateView()
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::handleDeactivateView()
+{
+ mViewActive = false;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::mousePress
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::mousePressEvent( QGraphicsSceneMouseEvent *event )
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::itemChange
+// -------------------------------------------------------------------------------------------------
+//
+QVariant HbVideoBasePlaybackView::itemChange( GraphicsItemChange change, const QVariant &value )
+{
+ return QGraphicsWidget::itemChange( change, value );
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::closePlaybackView()
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::paint( QPainter *painter,
+ const QStyleOptionGraphicsItem *option,
+ QWidget *widget )
+{
+ Q_UNUSED( widget );
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::event()
+// -------------------------------------------------------------------------------------------------
+//
+bool HbVideoBasePlaybackView::event( QEvent *event )
+{
+ bool consumed = false;
+
+ return consumed;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::handleClosePlaybackView()
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::handleClosePlaybackView()
+{
+ mViewActive = false;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::issuePlayCommand
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::issuePlayCommand()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::handleBufferingState
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::handleBufferingState()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::handlePluginError()
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::handlePluginError( int aError )
+{
+ mCurrentError = aError;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::doClosePlayer
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::doClosePlayer()
+{
+ mViewActive = false;
+}
+
+
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::retrievePdlInformation
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::retrievePdlInformation()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::closePlaybackView()
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::closePlaybackView()
+{
+ mViewActive = false;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::startClosingPlaybackView()
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::startClosingPlaybackView()
+{
+ mViewActive = false;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::setTitleBarFlags()
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::setTitleBarFlags( HbTitleBarFlags flags )
+{
+ mTitleFlag = flags;
+}
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/teststatuspanecontrol/stub/src/mpxvideoplaybackcontrolscontroller.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,407 @@
+/*
+* 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: Implementation of MPXVideoPlaybackControlsController
+*
+*/
+
+// Version : %version: 2 %
+
+
+
+// INCLUDE FILES
+#include <coecntrl.h>
+#include <bautils.h>
+#include <barsread.h>
+#include <stringloader.h>
+#include <f32file.h>
+
+#include <qtimer>
+
+#include <hblabel.h>
+#include <hbaction.h>
+#include <hbiconanimator.h>
+
+#include "../inc/mpxvideoviewwrapper.h"
+#include "../inc/hbvideobaseplaybackview.h"
+#include "../inc/mpxvideoplaybackdocumentloader.h"
+#include "../inc/mpxvideoplaybackviewfiledetails.h"
+#include "../inc/mpxvideoplaybackcontrolscontroller.h"
+
+#include "mpxvideoplaybackcontrolconfiguration.h"
+
+
+// ================= MEMBER FUNCTIONS ==============================================================
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::QMPXVideoPlaybackControlsController()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackControlsController::QMPXVideoPlaybackControlsController(
+ HbVideoBasePlaybackView *view,
+ CMPXVideoViewWrapper *viewWrapper,
+ QMPXVideoPlaybackViewFileDetails *details )
+ : mView( view )
+ , mViewWrapper( viewWrapper )
+ , mFileDetails( details )
+{
+ initializeController();
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::initializeController()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::initializeController()
+{
+ mLoader = new QMPXVideoPlaybackDocumentLoader();
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::addFileDetails()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::addFileDetails(
+ QMPXVideoPlaybackViewFileDetails* details )
+{
+ Q_UNUSED( details );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleEvent
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleEvent(
+ TMPXVideoPlaybackControlCommandIds event, int value )
+{
+ switch ( event )
+ {
+ case EMPXControlCmdTvOutConnected:
+ {
+ handleTvOutEvent( true, event, value );
+ break;
+ }
+ case EMPXControlCmdTvOutDisconnected:
+ {
+ handleTvOutEvent( false, event, value );
+ break;
+ }
+ case EMPXControlCmdSetVolume:
+ {
+ mFileDetails->mAudioEnabled = false;
+ break;
+ }
+ case EMPXControlCmdSetDuration:
+ {
+ mFileDetails->mDuration = value;
+ break;
+ }
+ case EMPXControlCmdShowVolumeControls:
+ {
+ mFileDetails->mAudioEnabled = true;
+ break;
+ }
+ case EMPXControlCmdSetPosition:
+ {
+ mFileDetails->mSeekable = true;
+ break;
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleStateChange
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleStateChange( TMPXPlaybackState newState )
+{
+ Q_UNUSED( newState );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::controlsListUpdated()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::controlsListUpdated()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::appendControl()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::appendControl( TMPXVideoPlaybackControls controlIndex )
+{
+ Q_UNUSED( controlIndex );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::resetDisappearingTimers()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::resetDisappearingTimers( TMPXTimerAction timerAction )
+{
+ mTimerAction = timerAction;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::hideAllControls()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::hideAllControls()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::showControls()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::showControls()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::isVisible()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackControlsController::isVisible()
+{
+ return false;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleCommand()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleCommand(
+ TMPXVideoPlaybackViewCommandIds command, int value )
+{
+ Q_UNUSED( command );
+ Q_UNUSED( value );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::volumeChanged()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::volumeChanged( int volume )
+{
+ Q_UNUSED( volume );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::showVolumeControls()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::showVolumeControls()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::durationChanged()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::durationChanged( int duration )
+{
+ Q_UNUSED( duration );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::positionChanged()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::positionChanged( int position )
+{
+ Q_UNUSED( position );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::aspectRatioChanged()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::aspectRatioChanged( int aspectRatio )
+{
+ Q_UNUSED( aspectRatio );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::realFormat()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackControlsController::realFormat( QString filename )
+{
+ Q_UNUSED( filename );
+ return false;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::realFormatForStreaming()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackControlsController::realFormatForStreaming( const TDesC& des )
+{
+ bool realFormat = false;
+ return realFormat;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::realFormatForLocal()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackControlsController::realFormatForLocal()
+{
+ bool realFormat = false;
+
+ return realFormat;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::setDownloadSize()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::setDownloadSize( int size )
+{
+ Q_UNUSED( size );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::updateDownloadPosition()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::updateDownloadPosition( int size )
+{
+ Q_UNUSED( size );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleErrors
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleErrors()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::isSoftKeyVisible()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackControlsController::isSoftKeyVisible( int /*value*/ )
+{
+ return false;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleTvOutEvent
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleTvOutEvent(
+ bool connected, TMPXVideoPlaybackControlCommandIds event, int value )
+{
+ Q_UNUSED( event );
+ Q_UNUSED( value );
+ mFileDetails->mTvOutConnected = connected;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::updateVideoRectDone
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::updateVideoRectDone()
+{
+ mViewTransitionIsGoingOn = false;
+
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::skipToPreviousVideoItem
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::skipToPreviousVideoItem()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::skipToNextVideoItem
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::skipToNextVideoItem()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::updateVideoRect()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::updateVideoRect( bool transitionEffect )
+{
+ Q_UNUSED( transitionEffect );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleTappedOnScreen()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleTappedOnScreen()
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::changeViewMode
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::changeViewMode(
+ TPlaybackViewMode viewMode, bool transitionEffect )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::changeViewMode()"));
+
+ Q_UNUSED( transitionEffect );
+ mViewMode = viewMode;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::layoutLoader
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackDocumentLoader* QMPXVideoPlaybackControlsController::layoutLoader()
+{
+ return mLoader;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::viewMode
+// -------------------------------------------------------------------------------------------------
+//
+TPlaybackViewMode QMPXVideoPlaybackControlsController::viewMode()
+{
+ return mViewMode;
+}
+
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/teststatuspanecontrol/stub/src/mpxvideoplaybackdocumentloader.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,132 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackDocumentLoader
+*
+*/
+
+// Version : %version: 1 %
+
+
+#include <hbwidget.h>
+#include <hbtransparentwindow.h>
+#include <hblabel.h>
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackdocumentloader.h"
+
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::~QMPXVideoPlaybackDocumentLoader
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackDocumentLoader::~QMPXVideoPlaybackDocumentLoader()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader") );
+
+ for ( int i = 0 ; i < mWidgets.count() ; i++ )
+ {
+ mWidgets.removeAt( 0 );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::findWidget()
+// -------------------------------------------------------------------------------------------------
+//
+QGraphicsWidget *QMPXVideoPlaybackDocumentLoader::findWidget( const QString &name )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::findWidget") );
+
+ QGraphicsWidget *object = NULL;
+
+ int index = exist( name );
+
+ if ( index == -1 )
+ {
+ object = createWidget( name );
+ }
+ else
+ {
+ object = mWidgets[ index ];
+ }
+
+ return object;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::createWidget()
+// -------------------------------------------------------------------------------------------------
+//
+QGraphicsWidget *QMPXVideoPlaybackDocumentLoader::createWidget( const QString &name )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::createWidget") );
+
+ QGraphicsWidget *object = NULL;
+
+ if ( name == "transparentWindow" )
+ {
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::creating transparentWindow") );
+
+ object = new HbTransparentWindow();
+ object->setObjectName( name );
+
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::appending to object list") );
+ mWidgets.append( object );
+ }
+ else if ( name == "title" )
+ {
+ object = new HbLabel();
+ object->setObjectName( name );
+ mWidgets.append( object );
+ }
+
+ return object;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::exist()
+// -------------------------------------------------------------------------------------------------
+//
+int QMPXVideoPlaybackDocumentLoader::exist( const QString &name )
+{
+ int i = 0;
+
+ for ( ; i < mWidgets.count() ; i++ )
+ {
+ if( mWidgets[i]->objectName() == name )
+ {
+ break;
+ }
+ }
+
+ if ( i == mWidgets.count() )
+ {
+ i = -1;
+ }
+
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::exist %d"), i );
+
+ return i;
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/teststatuspanecontrol/stub/src/mpxvideoplaybackfullscreencontrol.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,196 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackFullScreenControl
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#include <w32std.h>
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackbuttonbar.h"
+#include "mpxvideoplaybackprogressbar.h"
+#include "mpxvideoplaybackfullscreencontrol.h"
+#include "mpxvideoplaybackfiledetailswidget.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+#include "mpxvideoplaybackdetailsplaybackwindow.h"
+
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::QMPXVideoPlaybackFullScreenControl()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackFullScreenControl::QMPXVideoPlaybackFullScreenControl(
+ QMPXVideoPlaybackControlsController* controller,
+ TMPXVideoPlaybackControls index,
+ HbWidget* widget,
+ TUint controlproperties )
+ : mController( controller )
+ , mControl( widget )
+ , mControlIndex( index )
+ , mProperties( controlproperties )
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackFullScreenControl::QMPXVideoPlaybackFullScreenControl()"));
+
+ setParent( mController );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::~QMPXVideoPlaybackFullScreenControl()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackFullScreenControl::~QMPXVideoPlaybackFullScreenControl()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackFullScreenControl"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::setVisible()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackFullScreenControl::setVisible( bool visible )
+{
+ mControl->setVisible( visible );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::isVisible()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackFullScreenControl::isVisible()
+{
+ return mVisible;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::setVisibility()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackFullScreenControl::setVisibility( TMPXPlaybackState /*state*/ )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackFullScreenControl::setVisibility()"));
+
+ mVisible = true;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::controlIndex()
+// -------------------------------------------------------------------------------------------------
+//
+TMPXVideoPlaybackControls QMPXVideoPlaybackFullScreenControl::controlIndex()
+{
+ return mControlIndex;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::volumeChanged()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackFullScreenControl::volumeChanged( int /*volume*/ )
+{
+ return true;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::durationChanged()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackFullScreenControl::durationChanged( int duration )
+{
+ bool changed = EFalse;
+
+ if ( mControlIndex == EMPXProgressBar )
+ {
+ MPX_DEBUG(_L("QMPXVideoPlaybackFullScreenControl::DurationChanged() [%d]"), duration);
+
+ static_cast<QMPXVideoPlaybackProgressBar*>(mControl)->durationChanged( duration );
+
+ changed = ETrue;
+ }
+
+ return changed;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::positionChanged()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackFullScreenControl::positionChanged( int position )
+{
+ bool changed = EFalse;
+
+ if ( mControlIndex == EMPXProgressBar )
+ {
+ MPX_DEBUG(_L("QMPXVideoPlaybackFullScreenControl::positionChanged() [%d]"), position);
+
+ static_cast<QMPXVideoPlaybackProgressBar*>(mControl)->positionChanged( position );
+
+ changed = ETrue;
+ }
+
+ return changed;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::aspectRatioChanged()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackFullScreenControl::aspectRatioChanged( int aspectRatio )
+{
+ bool changed = EFalse;
+
+ if ( mControlIndex == EMPXButtonBar )
+ {
+ MPX_DEBUG(
+ _L("QMPXVideoPlaybackFullScreenControl::aspectRatioChanged() [%d]"), aspectRatio);
+
+ static_cast<QMPXVideoPlaybackButtonBar*>(mControl)->aspectRatioChanged( aspectRatio );
+
+ changed = ETrue;
+ }
+
+ return changed;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::updateState()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackFullScreenControl::updateState( TMPXPlaybackState state )
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::updateControlsWithFileDetails()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackFullScreenControl::updateControlsWithFileDetails(
+ QMPXVideoPlaybackViewFileDetails* details )
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::updateControlProperties()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackFullScreenControl::updateControlProperties( TUint properties )
+{
+ mProperties = properties;
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/teststatuspanecontrol/stub/src/mpxvideoplaybackviewfiledetails.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* 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: class for MPX Video File Details (Qt)
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+//
+// INCLUDE FILES
+//
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackviewfiledetails.h"
+
+
+// ============================ MEMBER FUNCTIONS ===================================================
+
+QMPXVideoPlaybackViewFileDetails::QMPXVideoPlaybackViewFileDetails()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackViewFileDetails::QMPXVideoPlaybackViewFileDetails()"));
+
+ clearFileDetails();
+}
+
+QMPXVideoPlaybackViewFileDetails::~QMPXVideoPlaybackViewFileDetails()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackViewFileDetails::~QMPXVideoPlaybackViewFileDetails()"));
+
+ clearFileDetails();
+}
+
+void
+QMPXVideoPlaybackViewFileDetails::clearFileDetails()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackViewFileDetails::ClearFileDetails()"));
+
+ mMimeType = tr("");
+ mTitle = tr("");
+ mArtist = tr("");
+ mClipName = tr("");
+ mDescription = tr("");
+ mLocation = tr("");
+ mCopyright = tr("");
+ mLanguage = tr("");
+ mKeywords = tr("");
+
+ mPlaybackMode = EMPXVideoLocal;
+ mSeekable = false;
+ mPausableStream = false;
+ mAudioEnabled = false;
+ mVideoEnabled = false;
+ mPartialPlayback = false;
+ mRNFormat = false;
+
+ mDuration = 0;
+ mTvOutConnected = false;
+ mTvOutPlayAllowed = true;
+ mDrmProtected = false;
+
+ mVideoHeight = 0;
+ mVideoWidth = 0;
+ mBitRate = 0;
+}
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/teststatuspanecontrol/stub/src/mpxvideoviewwrapper.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,239 @@
+/*
+* 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: Implementation of Video base playback view
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+// Include Files
+
+#include "../inc/mpxvideoviewwrapper.h"
+#include "../inc/hbvideobaseplaybackview.h"
+#include "../inc/mpxvideoplaybackviewfiledetails.h"
+#include "mpxcommonvideoplaybackview.hrh"
+
+// Member Functions
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::CMPXVideoViewWrapper()
+// -------------------------------------------------------------------------------------------------
+//
+CMPXVideoViewWrapper::CMPXVideoViewWrapper( HbVideoBasePlaybackView* aView )
+ : iView( aView )
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::NewL()
+// -------------------------------------------------------------------------------------------------
+//
+CMPXVideoViewWrapper* CMPXVideoViewWrapper::NewL( HbVideoBasePlaybackView* aView )
+{
+ CMPXVideoViewWrapper* self = new (ELeave) CMPXVideoViewWrapper( aView );
+
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ return self;
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::ConstructL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::ConstructL()
+{
+ iMediaRequested = EFalse;
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::~CMPXVideoViewWrapper()
+// -------------------------------------------------------------------------------------------------
+//
+CMPXVideoViewWrapper::~CMPXVideoViewWrapper()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::IsLive()
+// -------------------------------------------------------------------------------------------------
+//
+TBool CMPXVideoViewWrapper::IsLive()
+{
+ return EFalse;
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::IsPlaylist()
+// -------------------------------------------------------------------------------------------------
+//
+TBool CMPXVideoViewWrapper::IsPlaylist()
+{
+ return EFalse;
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::HandleCommandL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::HandleCommandL( TInt aCommand )
+{
+ switch ( aCommand )
+ {
+ case EMPXPbvCmdNextListItem:
+ {
+ SetFileDetails( EFalse );
+ break;
+ }
+
+ case EMPXPbvCmdPreviousListItem:
+ {
+ SetFileDetails( ETrue );
+ break;
+ }
+ }
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// Request for the media object
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::RequestMediaL()
+{
+ iMediaRequested = ETrue;
+
+ SetFileDetails( ETrue );
+
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::ActivateClosePlayerActiveObject
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::ActivateClosePlayerActiveObject()
+{
+ iClosePlayerAO = ETrue;
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::IsMultiItemPlaylist()
+// -------------------------------------------------------------------------------------------------
+//
+TBool CMPXVideoViewWrapper::IsMultiItemPlaylist()
+{
+ return iFileDetails->mMultiItemPlaylist;
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::SetFileDetails()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::SetFileDetails(TBool aDefault)
+{
+ if ( iFileDetails )
+ {
+ delete iFileDetails;
+ iFileDetails = NULL;
+ }
+
+ iFileDetails = new QMPXVideoPlaybackViewFileDetails();
+
+
+ _LIT(KTestMimeType, "video/3gp");
+ const QString qMimeType( (QChar*)KTestMimeType().Ptr(), KTestMimeType().Length() );
+ iFileDetails->mMimeType = qMimeType;
+
+
+ _LIT(KTestTitle, "Test Video Title");
+ const QString qTitle( (QChar*)KTestTitle().Ptr(), KTestTitle().Length() );
+ iFileDetails->mTitle = qTitle;
+
+
+ _LIT(KTestArtist, "TestArtist");
+ const QString qArtist( (QChar*)KTestArtist().Ptr(), KTestArtist().Length() );
+ iFileDetails->mArtist = qArtist;
+
+
+ _LIT(KTestDescription, "Test Description");
+ const QString qDescription( (QChar*)KTestDescription().Ptr(), KTestDescription().Length() );
+ iFileDetails->mDescription = qDescription;
+
+
+ _LIT(KTestLocation, "Test Location");
+ const QString qLocation( (QChar*)KTestLocation().Ptr(), KTestLocation().Length() );
+ iFileDetails->mLocation = qLocation;
+
+
+ _LIT(KTestCopyright, "Test Copyright");
+ const QString qCopyright( (QChar*)KTestCopyright().Ptr(), KTestCopyright().Length() );
+ iFileDetails->mCopyright = qCopyright;
+
+
+ _LIT(KTestLanguage, "Test Language");
+ const QString qLanguage( (QChar*)KTestLanguage().Ptr(), KTestLanguage().Length() );
+ iFileDetails->mLanguage = qLanguage;
+
+
+ _LIT(KTestKeywords, "Test Keywords");
+ const QString qKeywords( (QChar*)KTestKeywords().Ptr(), KTestKeywords().Length() );
+ iFileDetails->mKeywords = qKeywords;
+
+
+ if ( aDefault )
+ {
+ _LIT(KTestClipName, "testClip.3gp");
+ const QString qClipname( (QChar*)KTestClipName().Ptr(), KTestClipName().Length() );
+ iFileDetails->mClipName = qClipname;
+ }
+ else
+ {
+ _LIT(KTestClipName, "nextClip.3gp");
+ const QString qClipname( (QChar*)KTestClipName().Ptr(), KTestClipName().Length() );
+ iFileDetails->mClipName = qClipname;
+ }
+
+
+ iFileDetails->mPlaybackMode = EMPXVideoLocal;
+ iFileDetails->mSeekable = true;
+ iFileDetails->mPausableStream = true;
+ iFileDetails->mAudioEnabled = true;
+ iFileDetails->mVideoEnabled = true;
+ iFileDetails->mPartialPlayback = false;
+ iFileDetails->mRNFormat = false;
+ iFileDetails->mDuration = 100;
+ iFileDetails->mTvOutConnected = false;
+ iFileDetails->mTvOutPlayAllowed = true;
+ iFileDetails->mDrmProtected = false;
+ iFileDetails->mMultiItemPlaylist = false;
+ iFileDetails->mVideoHeight = 320;
+ iFileDetails->mVideoWidth = 240;
+ iFileDetails->mBitRate = 16000;
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::IssueVideoAppForegroundCmd()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::IssueVideoAppForegroundCmdL( TBool aForeground )
+{
+ iForeground = aForeground;
+}
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/teststatuspanecontrol/teststatuspanecontrol.pro Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,56 @@
+#
+# 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: Project file for building teststatuspanecontrol
+#
+#
+# Version : %version: 1 %
+
+
+TEMPLATE = app
+TARGET = teststatuspanecontrol
+CONFIG += qtestlib hb qt
+
+DEPENDPATH += . \
+ inc \
+ src
+
+INCLUDEPATH += stub/inc \
+ ../inc \
+ ../../inc \
+ ../../../inc \
+ ../../../../inc \
+
+DEPENDPATH += stub/inc stub/src inc src
+
+# Input
+HEADERS += ../../../controlinc/mpxvideoplaybackstatuspanecontrol.h \
+ inc/teststatuspanecontrol.h \
+ mpxvideoplaybackcontrolscontroller.h \
+ mpxvideoplaybackviewfiledetails.h \
+ hbvideobaseplaybackview.h \
+ mpxvideoviewwrapper.h \
+ mpxvideoplaybackdocumentloader.h \
+ mpxvideoplaybackfullscreencontrol.h \
+ hblabel.h
+
+SOURCES += ../../../controlsrc/mpxvideoplaybackstatuspanecontrol.cpp \
+ src/teststatuspanecontrol.cpp \
+ mpxvideoplaybackcontrolscontroller.cpp \
+ mpxvideoplaybackviewfiledetails.cpp \
+ hbvideobaseplaybackview.cpp \
+ mpxvideoviewwrapper.cpp \
+ mpxvideoplaybackdocumentloader.cpp \
+ mpxvideoplaybackfullscreencontrol.cpp \
+ hblabel.cpp
+
\ No newline at end of file
--- a/videoplayback/hbvideoplaybackview/tsrc/testuserinputhandler/stub/src/hbvideobaseplaybackview.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/hbvideoplaybackview/tsrc/testuserinputhandler/stub/src/hbvideobaseplaybackview.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 1 %
+// Version : %version: 2 %
@@ -72,6 +72,7 @@
//
void HbVideoBasePlaybackView::mousePressEvent( QGraphicsSceneMouseEvent *event )
{
+ Q_UNUSED( event );
}
// -------------------------------------------------------------------------------------------------
@@ -91,6 +92,8 @@
const QStyleOptionGraphicsItem *option,
QWidget *widget )
{
+ Q_UNUSED( painter );
+ Q_UNUSED( option );
Q_UNUSED( widget );
}
@@ -101,6 +104,7 @@
//
bool HbVideoBasePlaybackView::event( QEvent *event )
{
+ Q_UNUSED( event );
bool consumed = false;
return consumed;
--- a/videoplayback/hbvideoplaybackview/tsrc/testuserinputhandler/stub/src/mpxvideoviewwrapper.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/hbvideoplaybackview/tsrc/testuserinputhandler/stub/src/mpxvideoviewwrapper.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 1 %
+// Version : %version: 2 %
@@ -93,7 +93,7 @@
//
void CMPXVideoViewWrapper::CreateGeneralPlaybackCommandL( int aCmd )
{
-
+ Q_UNUSED( aCmd );
}
// -------------------------------------------------------------------------------------------------
--- a/videoplayback/hbvideoplaybackview/tsrc/testvideodisplayhandler/stub/src/hbvideobaseplaybackview.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideodisplayhandler/stub/src/hbvideobaseplaybackview.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 1 %
+// Version : %version: 2 %
@@ -72,6 +72,7 @@
//
void HbVideoBasePlaybackView::mousePressEvent( QGraphicsSceneMouseEvent *event )
{
+ Q_UNUSED( event );
}
// -------------------------------------------------------------------------------------------------
@@ -91,6 +92,8 @@
const QStyleOptionGraphicsItem *option,
QWidget *widget )
{
+ Q_UNUSED( painter );
+ Q_UNUSED( option );
Q_UNUSED( widget );
}
@@ -101,6 +104,7 @@
//
bool HbVideoBasePlaybackView::event( QEvent *event )
{
+ Q_UNUSED( event );
bool consumed = false;
return consumed;
--- a/videoplayback/hbvideoplaybackview/tsrc/testvideodisplayhandler/stub/src/mpxvideoviewwrapper.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideodisplayhandler/stub/src/mpxvideoviewwrapper.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 2 %
+// Version : %version: 3 %
@@ -93,7 +93,7 @@
//
void CMPXVideoViewWrapper::CreateGeneralPlaybackCommandL( int aCmd )
{
-
+ Q_UNUSED( aCmd );
}
// -------------------------------------------------------------------------------------------------
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/inc/testmpxvideoplaybackcontrolscontroller.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,126 @@
+/**
+* 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: tester for methods in Video Playback Controls Controller
+*
+*/
+
+// Version : %version: 1 %
+
+#ifndef __TESTMPXVIDEOPLAYBACKCONTROLSCONTROLLER_H__
+#define __TESTMPXVIDEOPLAYBACKCONTROLSCONTROLLER_H__
+
+
+// INCLUDES
+#include <QtTest/QtTest>
+#include "mpxvideoplaybackcontrol.hrh"
+
+// FORWARD DECLARATIONS
+class HbVideoBasePlaybackView;
+class CMPXVideoViewWrapper;
+class QMPXVideoPlaybackControlsController;
+class QMPXVideoPlaybackViewFileDetails;
+
+class TestMPXVideoPlaybackControlsController : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * will be called before each testfunction is executed.
+ *
+ */
+ void init();
+
+ /**
+ * will be called after every testfunction.
+ *
+ */
+ void cleanup();
+
+private:
+
+ void verifyHandleEventStateChangedResult( int value );
+ void verifyHandleEventTvOutResult( bool tvOutConnected, bool value );
+
+private slots:
+
+ //
+ // test addFileDetails()
+ //
+ void testAddFileDetails();
+
+ //
+ // test handleEvent()
+ //
+ void testHandleEventSetPosition();
+ void testHandleEventSetDuration();
+ void testHandleEventStateChanged();
+ void testHandleEventSetVolume();
+ void testHandleEventSetAspectRatio();
+ void testHandleEventSetDownloadSize();
+ void testHandleEventDownloadUpdated();
+ void testHandleEventDownloadComplete();
+ void testHandleEventSetDownloadPaused();
+ void testHandleEventClearDownloadPaused();
+ void testHandleEventTvOutConnected();
+ void testHandleEventTvOutDisconnected();
+ void testHandleEventHandleErrors();
+ void testHandleEventShowVolumeControls();
+
+ //
+ // test handleCommand()
+ //
+ void testHandleCommand();
+
+ //
+ // test handleTappedOnScreen()
+ //
+ void testHandleTappedOnScreen();
+
+ //
+ // test updateVideoRectDone()
+ //
+ void testUpdateVideoRectDone();
+
+ //
+ // test private slot skipToNextVideoItem()
+ //
+ void testslot_skipToNextVideoItem();
+
+ //
+ // test private slot skipToPreviousVideoItem()
+ //
+ void testslot_skipToPreviousVideoItem();
+
+signals:
+
+ void commandSignal();
+
+private:
+
+ HbVideoBasePlaybackView* mBaseVideoView;
+ CMPXVideoViewWrapper* mViewWrapper;
+ QMPXVideoPlaybackControlsController* mController;
+ QMPXVideoPlaybackViewFileDetails* mFileDetails;
+
+};
+
+
+#endif // __TESTMPXVIDEOPLAYBACKCONTROLSCONTROLLER_H__
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/src/testmpxvideoplaybackcontrolscontroller.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,913 @@
+/**
+* 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: tester for methods in Video Playback Controls Controller
+*
+*/
+
+// Version : %version: 1 %
+
+#include <e32err.h>
+#include <w32std.h>
+#include <qobject>
+
+#include <hbapplication.h>
+#include <hbinstance.h>
+#include <hblabel.h>
+#include <MMFScalingCustomCommandConstants.h>
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackcontrol.hrh"
+#include "mpxcommonvideoplaybackview.hrh"
+#include "testmpxvideoplaybackcontrolscontroller.h"
+#include "hbvideobaseplaybackview.h"
+#include "mpxvideoplaybackviewfiledetails.h"
+#include "mpxvideoviewwrapper.h"
+#include "mpxvideoplaybackfullscreencontrol.h"
+#include "mpxvideoplaybackcontrolconfiguration.h"
+#include "mpxvideoplaybacknontouchvolumebar.h"
+#include "thumbnailmanager_qt.h"
+#include "mpxvideoplaybackdocumentloader.h"
+
+#define private public
+#include "mpxvideoplaybackcontrolscontroller.h"
+#undef private
+
+const TInt KControlListsUpdated = 12; // additional extension of TMPXPlaybackState
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ HbApplication app(argc, argv);
+ HbMainWindow window;
+
+ TestMPXVideoPlaybackControlsController tv;
+
+ char *pass[3];
+ pass[0] = argv[0];
+ pass[1] = "-o";
+ pass[2] = "c:\\data\\TestMPXVideoPlaybackControlsController.txt";
+
+ int res = QTest::qExec(&tv, 3, pass);
+
+ return res;
+}
+
+
+// ---------------------------------------------------------------------------
+// init
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackControlsController::init()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackControlsController::init()"));
+
+ mBaseVideoView = new HbVideoBasePlaybackView();
+ mFileDetails = new QMPXVideoPlaybackViewFileDetails();
+ mViewWrapper = CMPXVideoViewWrapper::NewL( mBaseVideoView );
+ mController = new QMPXVideoPlaybackControlsController( mBaseVideoView,
+ mViewWrapper,
+ mFileDetails );
+}
+
+// ---------------------------------------------------------------------------
+// cleanup
+// ---------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackControlsController::cleanup()
+{
+ MPX_ENTER_EXIT(_L("TestMPXVideoPlaybackControlsController::cleanup()"));
+
+ delete mController;
+ mController = NULL;
+
+ delete mFileDetails;
+ mFileDetails = NULL;
+
+ delete mViewWrapper;
+ mViewWrapper = NULL;
+
+ delete mBaseVideoView;
+ mBaseVideoView = NULL;
+}
+
+// -------------------------------------------------------------------------------------------------
+// TestMPXVideoPlaybackControlsController::testAddFileDetails
+// -------------------------------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackControlsController::testAddFileDetails()
+{
+ MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testAddFileDetails()") );
+
+ init();
+
+ //
+ // local real media with no video
+ //
+ mFileDetails->mClipName = QString("testClip.rm");
+ mFileDetails->mMimeType = QString("video/x-pn-realvideo");
+
+ mController->addFileDetails( mFileDetails );
+
+ QVERIFY( mController->mFileDetails->mRNFormat == true );
+ QVERIFY( mController->mViewMode == EAudioOnlyView );
+ QVERIFY( mController->mControlsConfig->mUpdateControlsWithFileDetails == true );
+ QVERIFY( mController->mControlsConfig->mState == EMPXControlCmdTvOutConnected );
+
+ //
+ // local 3GPP media with video-only
+ //
+ mFileDetails->mClipName = QString("testClip.3gp");
+ mFileDetails->mMimeType = QString("video/3gpp");
+ mFileDetails->mVideoEnabled = true;
+ mController->mViewMode = EFullScreenView;
+ mFileDetails->mTvOutConnected = true;
+ QFileInfo videoOnlyFile( mFileDetails->mClipName );
+
+ mController->addFileDetails( mFileDetails );
+
+ QVERIFY( mController->mFileDetails->mRNFormat == false );
+ QVERIFY( mController->mControlsConfig->mUpdateControlsWithFileDetails == true );
+
+ //
+ // validate 'TvOutConnected'
+ //
+ verifyHandleEventTvOutResult(true, true);
+
+ //
+ // video-only, validate volume control is dimmed
+ //
+ QVERIFY( mController->mVolumeControl->mValue == 0 );
+ QVERIFY( mController->mVolumeControl->isEnabled() == false );
+
+ //
+ // verify 'title' (via mClipName) is set properly
+ //
+ for ( int i=0 ; i < mController->mLoader->mWidgets.count() ; i++ )
+ {
+ if( mController->mLoader->mWidgets[i]->objectName() == QString( "title" ) )
+ {
+ HbLabel *titleLabel = qobject_cast<HbLabel*>( mController->mLoader->mWidgets[i] );
+ QVERIFY( titleLabel->plainText() == videoOnlyFile.baseName() );
+ break;
+ }
+ }
+
+ //
+ // non-local audio-video media, TvOut is not connected
+ //
+ mFileDetails->mClipName = QString("rtsp:://www.youtube.com/testClip.rm");
+ mFileDetails->mPlaybackMode = EMPXVideoStreaming;
+ mFileDetails->mTvOutConnected = false;
+ mFileDetails->mAudioEnabled = true;
+ mFileDetails->mTitle = QString("Clip Title");
+
+ mController->addFileDetails( mFileDetails );
+
+ QVERIFY( mController->mFileDetails->mRNFormat == true );
+ QVERIFY( mController->mControlsConfig->mUpdateControlsWithFileDetails == true );
+
+ //
+ // verify 'title' (via mTitle) is set properly
+ //
+ for ( int i=0 ; i < mController->mLoader->mWidgets.count() ; i++ )
+ {
+ if( mController->mLoader->mWidgets[i]->objectName() == QString( "title" ) )
+ {
+ HbLabel *titleLabel = qobject_cast<HbLabel*>( mController->mLoader->mWidgets[i] );
+ QVERIFY( titleLabel->plainText() == mFileDetails->mTitle );
+ break;
+ }
+ }
+
+ cleanup();
+}
+
+// -------------------------------------------------------------------------------------------------
+// TestMPXVideoPlaybackControlsController::testHandleEventSetPosition
+// -------------------------------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackControlsController::testHandleEventSetPosition()
+{
+ MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleEventSetPosition()"));
+
+ init();
+ int value = 20000;
+
+ mController->handleEvent( EMPXControlCmdSetPosition, value );
+
+ for ( int i = 0 ; i < mController->mControls.count() ; i++ )
+ {
+ QVERIFY( mController->mControls[i]->mPosition == ( value / KPbMilliMultiplier ) );
+ }
+
+ cleanup();
+}
+
+// -------------------------------------------------------------------------------------------------
+// TestMPXVideoPlaybackControlsController::testHandleEventSetDuration
+// -------------------------------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackControlsController::testHandleEventSetDuration()
+{
+ MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleEventSetDuration()"));
+
+ init();
+ int value = 30000;
+
+ mController->handleEvent( EMPXControlCmdSetDuration, value );
+
+ for ( int i = 0 ; i < mController->mControls.count() ; i++ )
+ {
+ QVERIFY( mController->mControls[i]->mDuration == ( value / KPbMilliMultiplier ) );
+ }
+
+ cleanup();
+}
+
+// -------------------------------------------------------------------------------------------------
+// TestMPXVideoPlaybackControlsController::testHandleEventStateChanged
+// -------------------------------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackControlsController::testHandleEventStateChanged()
+{
+ MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleEventStateChanged()"));
+
+ init();
+ TMPXVideoPlaybackControlCommandIds event = EMPXControlCmdStateChanged;
+
+ //
+ // state change (EPbStateInitialised, streaming)
+ //
+ int value = EPbStateInitialised;
+ mFileDetails->mPlaybackMode = EMPXVideoStreaming;
+ mController->handleEvent( event, value );
+ verifyHandleEventStateChangedResult( value );
+
+ //
+ // state change (EPbStateInitialised, live-streaming)
+ //
+ value = EPbStateInitialised;
+ mFileDetails->mPlaybackMode = EMPXVideoLiveStreaming;
+ mController->handleEvent( event, value );
+ verifyHandleEventStateChangedResult( value );
+
+ //
+ // state change (EPbStateInitialised, non-streaming)
+ //
+ value = EPbStateInitialised;
+ mFileDetails->mPlaybackMode = EMPXVideoLocal;
+ mController->handleEvent( event, value );
+ verifyHandleEventStateChangedResult( value );
+
+ //
+ // state change (EPbStateInitialising)
+ //
+ value = EPbStateInitialising;
+ mController->handleEvent( event, value );
+ verifyHandleEventStateChangedResult( value );
+
+ //
+ // state change (EPbStateBuffering)
+ //
+ value = EPbStateBuffering;
+ mController->handleEvent( event, value );
+ verifyHandleEventStateChangedResult( value );
+
+ //
+ // state change (EPbStatePlaying)
+ //
+ value = EPbStatePlaying;
+ mController->handleEvent( event, value );
+ verifyHandleEventStateChangedResult( value );
+
+ //
+ // state change (EPbStatePaused)
+ //
+ value = EPbStatePaused;
+ mController->handleEvent( event, value );
+ verifyHandleEventStateChangedResult( value );
+
+ //
+ // state change (EPbStateNotInitialised)
+ //
+ value = EPbStateNotInitialised;
+ mController->handleEvent( event, value );
+ verifyHandleEventStateChangedResult( value );
+
+ //
+ // state change (EPbStateStopped)
+ //
+ value = EPbStateStopped;
+ mController->handleEvent( event, value );
+ verifyHandleEventStateChangedResult( value );
+
+ //
+ // state change (EPbStateSeekingForward)
+ //
+ value = EPbStateSeekingForward;
+ mController->handleEvent( event, value );
+ verifyHandleEventStateChangedResult( value );
+
+ //
+ // state change (EPbStateSeekingBackward)
+ //
+ value = EPbStateSeekingBackward;
+ mController->handleEvent( event, value );
+ verifyHandleEventStateChangedResult( value );
+
+ //
+ // state change (EPbStateShuttingDown)
+ //
+ value = EPbStateShuttingDown;
+ mController->handleEvent( event, value );
+ verifyHandleEventStateChangedResult( value );
+
+ //
+ // state change (EPbStateDownloading)
+ //
+ value = EPbStateDownloading;
+ mController->handleEvent( event, value );
+ verifyHandleEventStateChangedResult( value );
+
+ //
+ // state change (EPbStatePluginSeeking)
+ //
+ value = EPbStatePluginSeeking;
+ mController->handleEvent( event, value );
+ verifyHandleEventStateChangedResult( value );
+
+ cleanup();
+}
+
+// -------------------------------------------------------------------------------------------------
+// TestMPXVideoPlaybackControlsController::verifyHandleEventStateChangedResult
+// -------------------------------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackControlsController::verifyHandleEventStateChangedResult( int value )
+{
+ MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::verifyHandleEventStateChangedResult()"));
+
+ if ( value == EPbStateInitialised &&
+ ( mController->mFileDetails->mPlaybackMode == EMPXVideoStreaming ||
+ mController->mFileDetails->mPlaybackMode == EMPXVideoLiveStreaming ) )
+ {
+ QVERIFY( mController->mControlsConfig->mState == EMPXControlCmdPluginInitialized );
+ }
+ else if ( value == EPbStatePlaying || value == EPbStateInitialising ||
+ value == EPbStateBuffering || value == EPbStatePaused ||
+ value == EPbStateNotInitialised )
+ {
+ for ( int i = 0 ; i < mController->mControls.count() ; i++ )
+ {
+ QVERIFY( mController->mControls[i]->mState == value );
+ QVERIFY( mController->mControls[i]->mVisibilityState == value );
+ }
+ }
+ else
+ {
+ QVERIFY( mController->mState == value );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// TestMPXVideoPlaybackControlsController::testHandleEventSetVolume
+// -------------------------------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackControlsController::testHandleEventSetVolume()
+{
+ MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleEventSetVolume()"));
+
+ init();
+ int value = 40;
+
+ mController->handleEvent( EMPXControlCmdSetVolume, value );
+ QVERIFY( mController->mVolumeControl->mValue == value );
+
+ cleanup();
+}
+
+// -------------------------------------------------------------------------------------------------
+// TestMPXVideoPlaybackControlsController::testHandleEventSetAspectRatio
+// -------------------------------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackControlsController::testHandleEventSetAspectRatio()
+{
+ MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleEventSetAspectRatio()"));
+
+ init();
+ int numScalingType = 5;
+
+ for ( int i = 0; i < numScalingType; i++ )
+ {
+ mController->handleEvent( EMPXControlCmdSetAspectRatio, i );
+
+ for ( int j = 0 ; j < mController->mControls.count() ; j++ )
+ {
+ QVERIFY( mController->mControls[j]->mAspectRatio == i );
+ }
+ }
+
+ cleanup();
+}
+
+// -------------------------------------------------------------------------------------------------
+// TestMPXVideoPlaybackControlsController::testHandleEventSetDownloadSize
+// -------------------------------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackControlsController::testHandleEventSetDownloadSize()
+{
+ MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleEventSetDownloadSize()") );
+
+ init();
+ int value = 50;
+
+ mController->handleEvent( EMPXControlCmdSetDownloadSize, value );
+
+ for ( int i = 0 ; i < mController->mControls.count() ; i++ )
+ {
+ QVERIFY( mController->mControls[i]->mDownloadSize == value );
+ }
+
+ cleanup();
+}
+
+// -------------------------------------------------------------------------------------------------
+// TestMPXVideoPlaybackControlsController::testHandleEventDownloadUpdated
+// -------------------------------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackControlsController::testHandleEventDownloadUpdated()
+{
+ MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleEventDownloadUpdated()") );
+
+ init();
+ int value = 55;
+
+ mController->handleEvent( EMPXControlCmdDownloadUpdated, value );
+
+ for ( int i = 0 ; i < mController->mControls.count() ; i++ )
+ {
+ QVERIFY( mController->mControls[i]->mDownloadPosition == value );
+ }
+
+ cleanup();
+}
+
+// -------------------------------------------------------------------------------------------------
+// TestMPXVideoPlaybackControlsController::testHandleEventDownloadComplete
+// -------------------------------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackControlsController::testHandleEventDownloadComplete()
+{
+ MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleEventDownloadComplete()") );
+
+ init();
+ int value = 60;
+
+ mController->handleEvent( EMPXControlCmdDownloadComplete, value );
+
+ for ( int i = 0 ; i < mController->mControls.count() ; i++ )
+ {
+ QVERIFY( mController->mControls[i]->mDownloadPosition == value );
+ }
+
+ cleanup();
+}
+
+// -------------------------------------------------------------------------------------------------
+// TestMPXVideoPlaybackControlsController::testHandleEventSetDownloadPaused
+// -------------------------------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackControlsController::testHandleEventSetDownloadPaused()
+{
+ MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleEventSetDownloadPaused()") );
+
+ init();
+ int value = 0;
+
+ mController->handleEvent( EMPXControlCmdSetDownloadPaused, value );
+
+ QVERIFY( mController->mControlsConfig->mState == KControlListsUpdated );
+
+ cleanup();
+}
+
+// -------------------------------------------------------------------------------------------------
+// TestMPXVideoPlaybackControlsController::testHandleEventClearDownloadPaused
+// -------------------------------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackControlsController::testHandleEventClearDownloadPaused()
+{
+ MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleEventClearDownloadPaused()") );
+
+ init();
+ int value = 0;
+
+ mController->handleEvent( EMPXControlCmdClearDownloadPaused, value );
+
+ QVERIFY( mController->mControlsConfig->mState == KControlListsUpdated );
+
+ cleanup();
+}
+
+// -------------------------------------------------------------------------------------------------
+// TestMPXVideoPlaybackControlsController::testHandleEventTvOutConnected
+// -------------------------------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackControlsController::testHandleEventTvOutConnected()
+{
+ MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleEventTvOutConnected()") );
+
+ init();
+
+ //
+ // TV-Out Connected, value = true, EMPXVideoLocal
+ //
+ mController->handleEvent( EMPXControlCmdTvOutConnected, true );
+ verifyHandleEventTvOutResult( true, true );
+
+ //
+ // TV-Out Connected, value = false, EMPXVideoLocal
+ //
+ mController->handleEvent( EMPXControlCmdTvOutConnected, false );
+ verifyHandleEventTvOutResult( true, false );
+
+ //
+ // TV-Out Connected, value = false, non-EMPXVideoLocal
+ //
+ mController->mFileDetails->mPlaybackMode = EMPXVideoStreaming;
+ mController->handleEvent( EMPXControlCmdTvOutConnected, false );
+ verifyHandleEventTvOutResult( true, false );
+
+ cleanup();
+}
+
+// -------------------------------------------------------------------------------------------------
+// TestMPXVideoPlaybackControlsController::verifyHandleEventTvOutResult
+// -------------------------------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackControlsController::verifyHandleEventTvOutResult( bool tvOutConnected,
+ bool value )
+{
+ MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::verifyHandleEventTvOutResult(%d,%d)"),
+ tvOutConnected, value );
+
+ QVERIFY( mController->mFileDetails->mTvOutConnected == tvOutConnected );
+
+ //
+ // validate setDefaultBitmap()
+ //
+ for ( int i=0 ; i < mController->mLoader->mWidgets.count() ; i++ )
+ {
+ bool val = mController->mLoader->isVisible(i);
+
+ if( mController->mLoader->mWidgets[i]->objectName() == QString( "tvOutBitmap" ) )
+ {
+ QVERIFY( tvOutConnected? val == true : val == false );
+ }
+ else if( mController->mLoader->mWidgets[i]->objectName() == QString( "realAudioOnlyBitmap" ) )
+ {
+ QVERIFY( mFileDetails->mRNFormat? val == true : val == false );
+ }
+ else if( mController->mLoader->mWidgets[i]->objectName() == QString( "partialAudioOnlyBitmap" ) )
+ {
+ QVERIFY( mFileDetails->mPartialPlayback? val == true : val == false );
+ }
+ else if( mController->mLoader->mWidgets[i]->objectName() == QString( "audioOnlyBitmap" ) )
+ {
+ QVERIFY( tvOutConnected? val == false : val == true );
+ }
+ }
+
+ //
+ // validate generateThumbNail()
+ //
+ if ( tvOutConnected )
+ {
+ QVERIFY( ( mController->mFileDetails->mPlaybackMode == EMPXVideoLocal )?
+ mController->mThumbNailState == EThumbNailRequsted :
+ mController->mThumbNailState == EThumbNailNotAvailable );
+ QVERIFY( mController->mFileDetails->mTvOutPlayAllowed == value );
+ QVERIFY( mController->mViewMode == EAudioOnlyView );
+ QVERIFY( mController->mControlsConfig->mState == EMPXControlCmdTvOutConnected );
+ QVERIFY( mController->mThumbnailManager->mThumbSize == ThumbnailManager::ThumbnailLarge );
+ QVERIFY( mController->mThumbnailManager->mQuality == ThumbnailManager::OptimizeForPerformance );
+ QVERIFY( mController->mViewTransitionIsGoingOn == false );
+ }
+ else if ( mController->mFileDetails->mVideoEnabled )
+ {
+ QVERIFY( mController->mViewTransitionIsGoingOn == true );
+ QVERIFY( mController->mFileDetails->mTvOutPlayAllowed == true );
+ QVERIFY( mController->mViewMode == EFullScreenView );
+ }
+ else if ( ! mController->mFileDetails->mVideoEnabled )
+ {
+ QVERIFY( mController->mViewTransitionIsGoingOn == false );
+ QVERIFY( mController->mFileDetails->mTvOutPlayAllowed == true );
+ QVERIFY( mController->mViewMode == EAudioOnlyView );
+ }
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// TestMPXVideoPlaybackControlsController::testHandleEventTvOutDisconnected
+// -------------------------------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackControlsController::testHandleEventTvOutDisconnected()
+{
+ MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleEventTvOutDisconnected()") );
+
+ init();
+
+ //
+ // TV-Out Disconnected, value = true
+ //
+ mController->handleEvent( EMPXControlCmdTvOutDisconnected, true );
+ verifyHandleEventTvOutResult( false, true );
+
+ //
+ // TV-Out Disconnected, value = false
+ //
+ mController->handleEvent( EMPXControlCmdTvOutDisconnected, false );
+ verifyHandleEventTvOutResult( false, false );
+
+ cleanup();
+}
+
+// -------------------------------------------------------------------------------------------------
+// TestMPXVideoPlaybackControlsController::testHandleEventHandleErrors
+// -------------------------------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackControlsController::testHandleEventHandleErrors()
+{
+ MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleEventHandleErrors()") );
+
+ init();
+
+ //
+ // handle error
+ //
+ mController->handleEvent( EMPXControlCmdHandleErrors, 0 );
+
+ QVERIFY( mController->mThumbNailState == EThumbNailEmpty );
+ QVERIFY( mController->mState == EPbStateNotInitialised );
+ QVERIFY( mController->mViewMode == EFullScreenView );
+
+ cleanup();
+}
+
+// -------------------------------------------------------------------------------------------------
+// TestMPXVideoPlaybackControlsController::testHandleEventShowVolumeControls
+// -------------------------------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackControlsController::testHandleEventShowVolumeControls()
+{
+ MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleEventShowVolumeControls()") );
+
+ init();
+
+ mController->handleEvent( EMPXControlCmdShowVolumeControls, 0 );
+
+ QVERIFY( mController->mVolumeControl->mVisible == true );
+
+ cleanup();
+}
+
+// -------------------------------------------------------------------------------------------------
+// TestMPXVideoPlaybackControlsController::testHandleCommand
+// -------------------------------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackControlsController::testHandleCommand()
+{
+ MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleCommand()") );
+
+ init();
+
+ mController->handleCommand( EMPXPbvCmdSetPosition, 0 );
+ QVERIFY( mViewWrapper->mProperty == EPbPropertyPosition );
+
+ mController->handleCommand( EMPXPbvCmdSetVolume, 0 );
+ QVERIFY( mViewWrapper->mProperty == EPbPropertyVolume );
+
+ mController->handleCommand( EMPXPbvCmdPlay, 0 );
+ QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdPlay );
+
+ mController->handleCommand( EMPXPbvCmdPause, 0 );
+ QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdPause );
+
+ mController->handleCommand( EMPXPbvCmdPlayPause, 0 );
+ QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdPlayPause );
+
+ mController->handleCommand( EMPXPbvCmdStop, 0 );
+ QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdStop );
+
+ mController->handleCommand( EMPXPbvCmdClose, 0 );
+ QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdClose );
+
+ mController->handleCommand( EMPXPbvCmdMute, 0 );
+ QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdMute );
+
+ mController->handleCommand( EMPXPbvCmdUnMute, 0 );
+ QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdUnMute );
+
+ mController->handleCommand( EMPXPbvCmdChangeAspectRatio, 0 );
+ QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdChangeAspectRatio );
+
+ mController->handleCommand( EMPXPbvCmdNaturalAspectRatio, 0 );
+ QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdNaturalAspectRatio );
+
+ mController->handleCommand( EMPXPbvCmdZoomAspectRatio, 0 );
+ QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdZoomAspectRatio );
+
+ mController->handleCommand( EMPXPbvCmdStretchAspectRatio, 0 );
+ QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdStretchAspectRatio );
+
+ mController->handleCommand( EMPXPbvCmdSeekForward, 0 );
+ QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdSeekForward );
+
+ mController->handleCommand( EMPXPbvCmdSeekBackward, 0 );
+ QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdSeekBackward );
+
+ mController->handleCommand( EMPXPbvCmdEndSeek, 0 );
+ QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdEndSeek );
+
+ mController->handleCommand( EMPXPbvCmdNextListItem, 0 );
+ QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdNextListItem );
+
+ mController->handleCommand( EMPXPbvCmdPreviousListItem, 0 );
+ QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdPreviousListItem );
+
+ mController->handleCommand( EMPXPbvCmdDecreaseVolume, 0 );
+ QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdDecreaseVolume );
+
+ mController->handleCommand( EMPXPbvCmdIncreaseVolume, 0 );
+ QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdIncreaseVolume );
+
+ mController->handleCommand( EMPXPbvCmdPosition, 0 );
+ QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdPosition );
+
+ mController->handleCommand( EMPXPbvCmdSave, 0 );
+ QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdSave );
+
+ mController->handleCommand( EMPXPbvCmdResetControls, 0 );
+ QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdResetControls );
+
+ mController->handleCommand( EMPXPbvCmdShortPressForward, 0 );
+ QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdShortPressForward );
+
+ mController->handleCommand( EMPXPbvCmdShortPressBackward, 0 );
+ QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdShortPressBackward );
+
+ mController->handleCommand( EMPXPbvCmdShowFileDetails, 0 );
+ QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdShowFileDetails );
+
+ mController->handleCommand( EMPXPbvCmdEndOfClip, 0 );
+ QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdEndOfClip );
+
+ mController->handleCommand( EMPXPbvCmdCustomPause, 0 );
+ QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdCustomPause );
+
+ mController->handleCommand( EMPXPbvCmdCustomPlay, 0 );
+ QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdCustomPlay );
+
+ mController->handleCommand( EMPXPbvCmdExit, 0 );
+ QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdExit );
+
+ mController->handleCommand( EMPXPbvLaunchDRMDetails, 0 );
+ QVERIFY( mViewWrapper->mCommandId == EMPXPbvLaunchDRMDetails );
+
+ mController->handleCommand( EMPXPbvSurfaceCreated, 0 );
+ QVERIFY( mViewWrapper->mCommandId == EMPXPbvSurfaceCreated );
+
+ cleanup();
+}
+
+// -------------------------------------------------------------------------------------------------
+// TestMPXVideoPlaybackControlsController::testHandleTappedOnScreen
+// -------------------------------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackControlsController::testHandleTappedOnScreen()
+{
+ MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testHandleTappedOnScreen()") );
+
+ init();
+
+ //
+ // preset variables
+ //
+ mFileDetails->mVideoEnabled = true;
+ mController->mViewMode = EFullScreenView;
+
+ //
+ // playing state
+ //
+ mController->mState = EPbStatePlaying;
+ mBaseVideoView->mouseReleaseEvent(0);
+ QVERIFY( mController->mControlsTimer->isActive() == true );
+ for ( int i = 0 ; i < mController->mControls.count() ; i++ )
+ {
+ QVERIFY( mController->mControls[i]->mVisibilityState == EPbStatePlaying );
+ }
+
+ //
+ // pause state
+ //
+ mController->mState = EPbStatePaused;
+ mBaseVideoView->mouseReleaseEvent(0);
+ QVERIFY( mController->mControlsTimer->isActive() == false );
+ for ( int i = 0 ; i < mController->mControls.count() ; i++ )
+ {
+ QVERIFY( mController->mControls[i]->mVisibilityState == EPbStatePaused );
+ }
+
+ cleanup();
+}
+
+// -------------------------------------------------------------------------------------------------
+// TestMPXVideoPlaybackControlsController::testUpdateVideoRectDone
+// -------------------------------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackControlsController::testUpdateVideoRectDone()
+{
+ MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testUpdateVideoRectDone()") );
+
+ init();
+
+ mController->updateVideoRectDone();
+
+ //
+ // default is full-screen
+ //
+ QVERIFY( mController->mControlsConfig->mState == EMPXControlCmdFullScreenViewOpened );
+
+ //
+ // validate Details view
+ //
+ mController->mViewMode = EDetailsView;
+
+ mController->updateVideoRectDone();
+
+ QVERIFY( mController->mControlsConfig->mState == EMPXControlCmdDetailsViewOpened );
+
+ cleanup();
+}
+
+// -------------------------------------------------------------------------------------------------
+// TestMPXVideoPlaybackControlsController::testslot_skipToNextVideoItem
+// -------------------------------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackControlsController::testslot_skipToNextVideoItem()
+{
+ MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testslot_skipToNextVideoItem()") );
+
+ init();
+
+ connect( this, SIGNAL( commandSignal() ), mController, SLOT( skipToNextVideoItem() ) );
+
+ emit commandSignal();
+
+ QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdNextListItem );
+
+ disconnect( this, SIGNAL( commandSignal() ), mController, SLOT( skipToNextVideoItem() ) );
+
+ cleanup();
+}
+
+// -------------------------------------------------------------------------------------------------
+// TestMPXVideoPlaybackControlsController::testslot_skipToPreviousVideoItem
+// -------------------------------------------------------------------------------------------------
+//
+void TestMPXVideoPlaybackControlsController::testslot_skipToPreviousVideoItem()
+{
+ MPX_DEBUG(_L("TestMPXVideoPlaybackControlsController::testslot_skipToPreviousVideoItem()") );
+
+ init();
+
+ connect( this, SIGNAL( commandSignal() ), mController, SLOT( skipToPreviousVideoItem() ) );
+
+ emit commandSignal();
+
+ QVERIFY( mViewWrapper->mCommandId == EMPXPbvCmdPreviousListItem );
+
+ disconnect( this, SIGNAL( commandSignal() ), mController, SLOT( skipToPreviousVideoItem() ) );
+
+ cleanup();
+}
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/inc/hbvideobaseplaybackview.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* 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: HB Video playback view
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+// This file defines the API for .dll
+
+#ifndef __HBVIDEOBASEPLAYBACKVIEW_H__
+#define __HBVIDEOBASEPLAYBACKVIEW_H__
+
+// Include Files
+#include <hbview.h>
+
+class CMPXVideoViewWrapper;
+class RWindow;
+
+// Constants
+
+// Forward Declarations
+
+// Class Definitions
+
+class HbVideoBasePlaybackView : public HbView
+{
+ Q_OBJECT
+
+ public:
+ HbVideoBasePlaybackView();
+ virtual ~HbVideoBasePlaybackView();
+
+ void mouseReleaseEvent( QGraphicsSceneMouseEvent *event );
+
+ signals:
+ void tappedOnScreen();
+};
+
+#endif // __HBVIDEOBASEPLAYBACKVIEW_H__
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/inc/mpxvideoplaybackbuttonbar.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackButtonBar
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKBUTTONBAR_H_
+#define MPXVIDEOPLAYBACKBUTTONBAR_H_
+
+#include <hbwidget.h>
+
+class QMPXVideoPlaybackControlsController;
+
+// DATA TYPES
+
+class QMPXVideoPlaybackButtonBar : public HbWidget
+{
+ Q_OBJECT
+
+ public:
+
+ QMPXVideoPlaybackButtonBar( QMPXVideoPlaybackControlsController* controller );
+ virtual ~QMPXVideoPlaybackButtonBar();
+ void initialize();
+
+};
+
+#endif /*MPXVIDEOPLAYBACKBUTTONBAR_H_*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/inc/mpxvideoplaybackcontrolconfiguration.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,98 @@
+/*
+* Copyright (c) 20101 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: Implementation of CMPXVideoPlaybackControlConfiguration
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKCONTROLCONFIGURATION_H_
+#define MPXVIDEOPLAYBACKCONTROLCONFIGURATION_H_
+
+// INCLUDES
+#include <qobject>
+
+#include <mpxplaybackframeworkdefs.h>
+#include "mpxvideoplaybackcontrol.hrh"
+#include "mpxhelixplaybackplugindefs.h"
+
+// FORWARD DECLARATIONS
+class QMPXVideoPlaybackControlsController;
+
+// DATA TYPES
+
+// CLASS DECLARATION
+class QMPXVideoPlaybackControlConfiguration : public QObject
+{
+ Q_OBJECT
+
+ public:
+
+ /**
+ * constructor.
+ */
+ QMPXVideoPlaybackControlConfiguration( QMPXVideoPlaybackControlsController* controller );
+
+ /**
+ * Destructor.
+ */
+ virtual ~QMPXVideoPlaybackControlConfiguration();
+
+ public:
+ /**
+ * Update control list
+ */
+ void updateControlList( TMPXVideoPlaybackControlCommandIds event );
+
+ /**
+ * Return control list
+ */
+ QList<TMPXVideoPlaybackControls>& controlList();
+
+ void updateControlsWithFileDetails();
+
+ private:
+ /**
+ * Create control list
+ */
+ void createControlList();
+
+ /**
+ * Delete controls from list
+ */
+ void deleteControlFromList( TMPXVideoPlaybackControls control );
+
+ /**
+ * Add controls to list
+ */
+ void addControlToList( TMPXVideoPlaybackControls control );
+
+ signals:
+ void controlListUpdated();
+
+ public:
+
+ TInt mState;
+ bool mUpdateControlsWithFileDetails;
+
+ private:
+ QMPXVideoPlaybackControlsController *mControlsController;
+ QList<TMPXVideoPlaybackControls> mControlsList;
+};
+
+#endif /*MPXVIDEOPLAYBACKCONTROLCONFIGURATION_H_*/
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/inc/mpxvideoplaybackcontrolpolicy.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,65 @@
+/*
+* 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: Implementation of MPXVideoPlaybackControlPolicy
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKCONTROLPOLICY_H_
+#define MPXVIDEOPLAYBACKCONTROLPOLICY_H_
+
+// INCLUDES
+#include <qobject>
+
+#include "mpxvideoplaybackcontrol.hrh"
+#include "mpxvideoplaybackcontrolscontroller.h"
+
+// FORWARD DECLARATIONS
+class QMPXVideoPlaybackViewFileDetails;
+
+// DATA TYPES
+
+// CLASS DECLARATION
+class QMPXVideoPlaybackControlPolicy : public QObject
+{
+ Q_OBJECT
+
+ public:
+
+ /**
+ * Two-phased constructor.
+ */
+ QMPXVideoPlaybackControlPolicy();
+
+ /**
+ * Destructor.
+ */
+ virtual ~QMPXVideoPlaybackControlPolicy();
+
+ public:
+ /**
+ * Sets the control properties per policy
+ */
+ void setControlProperties( TMPXVideoPlaybackControls controlIndex,
+ TUint& properties,
+ QMPXVideoPlaybackViewFileDetails *details,
+ TPlaybackViewMode viewMode );
+};
+
+#endif /*MPXVIDEOPLAYBACKCONTROLPOLICY_H_*/
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/inc/mpxvideoplaybackdetailsplaybackwindow.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackDetailsPlaybackWindow
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKDETAILSPLAYBACKWINDOW_H_
+#define MPXVIDEOPLAYBACKDETAILSPLAYBACKWINDOW_H_
+
+#include <hbwidget.h>
+
+
+class QMPXVideoPlaybackControlsController;
+
+class QMPXVideoPlaybackDetailsPlaybackWindow : public HbWidget
+{
+ Q_OBJECT
+
+ public:
+ QMPXVideoPlaybackDetailsPlaybackWindow( QMPXVideoPlaybackControlsController* controller );
+ virtual ~QMPXVideoPlaybackDetailsPlaybackWindow();
+ void initialize();
+
+ private:
+ QMPXVideoPlaybackControlsController *mController;
+
+ bool mInitialized;
+};
+
+#endif /*MPXVIDEOPLAYBACKDETAILSPLAYBACKWINDOW_H_*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/inc/mpxvideoplaybackdisplayhandler.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,173 @@
+/*
+* 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: Implementation of video playback display handler
+*
+*/
+
+// Version : %version: 1 %
+
+
+#ifndef __CMPXVIDEOPLAYBACKDISPLAYHANDLER_H__
+#define __CMPXVIDEOPLAYBACKDISPLAYHANDLER_H__
+
+// INCLUDES
+
+#include <mpxmessage2.h>
+#include <mmfscalingcustomcommandconstants.h>
+#include <mpxvideoplaybackdefs.h>
+#ifdef SYMBIAN_BUILD_GCE
+#include <mediaclientvideodisplay.h>
+#else
+#include <w32std.h>
+#endif
+
+
+//
+// CLASS DECLARATION
+//
+class MMPXPlaybackUtility;
+class CMPXVideoViewWrapper;
+class QMPXVideoPlaybackViewFileDetails;
+
+/*
+ * CMPXVideoPlaybackDisplayHandler
+ *
+ */
+class CMPXVideoPlaybackDisplayHandler : public CBase
+#ifndef SYMBIAN_BUILD_GCE
+ , public MDirectScreenAccess
+#endif
+{
+ //
+ // To save user's preference for scaling type in video ratio + screen ratio
+ //
+ typedef struct
+ {
+ TReal32 videoRatio;
+ TReal32 screenRatio;
+ TMMFScalingType scalingType;
+ } TMPXAspectRatio ;
+
+ public:
+
+ ~CMPXVideoPlaybackDisplayHandler();
+
+ static CMPXVideoPlaybackDisplayHandler* NewL( MMPXPlaybackUtility* aPlayUtil,
+ CMPXVideoViewWrapper* aViewWrapper );
+
+ void CreateDisplayWindowL( RWsSession& aWs,
+ CWsScreenDevice& aScreenDevice,
+ RWindow& aWin,
+ TRect aDisplayRect );
+
+ void RemoveDisplayWindow();
+
+ void HandleVideoDisplayMessageL( CMPXMessage* aMessage );
+
+ TInt SetAspectRatioL( TMPXVideoPlaybackCommand aCmd );
+
+ TInt SetDefaultAspectRatioL( QMPXVideoPlaybackViewFileDetails* aFileDetails,
+ TReal aDisplayAspectRatio );
+
+ void UpdateVideoRectL( TRect aRect, TBool transitionEffect );
+
+ private:
+
+ CMPXVideoPlaybackDisplayHandler( MMPXPlaybackUtility* aPlayUtil,
+ CMPXVideoViewWrapper* aViewWrapper );
+
+ void ConstructL();
+
+ void LoadAspectRatioL();
+
+ void SaveAspectRatioL();
+
+ void SetVideoRectL( TRect aClipRect );
+
+ void CalculateVideoRectL();
+
+ static TInt UpdateVideoRectTimeOutL( TAny* aPtr );
+
+#ifdef SYMBIAN_BUILD_GCE
+
+ private:
+ void AddDisplayWindowL( CWsScreenDevice& aScreenDevice,
+ RWindowBase& aWindowBase,
+ RWindow* aWin );
+
+ void SurfaceCreatedL( CMPXMessage* aMessage );
+ void SurfaceChangedL( CMPXMessage* aMessage );
+ void SurfaceRemoved();
+ TInt SetNgaAspectRatioL( TMPXVideoPlaybackCommand aCmd );
+
+#else
+
+ private:
+ //
+ // MDirectScreenAccess Implementation
+ //
+ void AbortNow( RDirectScreenAccess::TTerminationReasons aReason );
+ void Restart( RDirectScreenAccess::TTerminationReasons aReason );
+
+ TInt CreateAspectRatioCommandL( TMPXVideoPlaybackCommand aCmd );
+
+ void SetDisplayWindowL( RWsSession& aWs,
+ CWsScreenDevice& aScreenDevice,
+ RWindowBase& aWin,
+ TRect aClipRect );
+ void RestartDsaL();
+ void CreateAbortDsaCmdL();
+
+#endif
+
+ public:
+ MMPXPlaybackUtility* iPlaybackUtility;
+
+ RArray<TMPXAspectRatio> iAspectRatioArray;
+ TInt iCurrentIndexForAspectRatio;
+ TReal iDisplayAspectRatio;
+
+ TRect iWindowRect;
+
+ TReal32 iTlXDiff;
+ TReal32 iTlYDiff;
+ TReal32 iBrXDiff;
+ TReal32 iBrYDiff;
+
+ TInt iTransitionEffectCnt;
+
+ CPeriodic* iResizingTimer;
+ CMPXVideoViewWrapper* iViewWrapper;
+
+#ifdef SYMBIAN_BUILD_GCE
+ CMediaClientVideoDisplay* iVideoDisplay;
+
+ RWindowBase* iWindowBase;
+ TBool iSurfaceCached;
+ TSurfaceId iSurfaceId;
+ TRect iCropRect;
+ TVideoAspectRatio iAspectRatio;
+ TReal32 iScaleWidth;
+ TReal32 iScaleHeight;
+ TInt iHorizontalPosition;
+ TInt iVerticalPosition;
+ TVideoRotation iRotation;
+ TAutoScaleType iAutoScale;
+#else
+ CDirectScreenAccess* iDirectScreenAccess;
+#endif
+
+};
+
+#endif // __CMPXVIDEOPLAYBACKDISPLAYHANDLER_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/inc/mpxvideoplaybackdocumentloader.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackDocumentLoader
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKDOCUMENTHANDLER_H_
+#define MPXVIDEOPLAYBACKDOCUMENTHANDLER_H_
+
+
+#include <qobject>
+#include <hbdocumentloader.h>
+
+class QList;
+class QGraphicsWidget;
+class QMPXVideoPlaybackControlsController;
+
+class QMPXVideoPlaybackDocumentLoader : public QObject
+{
+ public:
+ QMPXVideoPlaybackDocumentLoader( QMPXVideoPlaybackControlsController *controller );
+
+ virtual ~QMPXVideoPlaybackDocumentLoader();
+
+ public:
+
+ QGraphicsWidget* findWidget( const QString &name );
+ void load( const QString &fileName, const QString §ion , bool *ok );
+ void load( const QString &fileName, bool *ok );
+ bool isVisible( int index );
+
+ private:
+ QGraphicsWidget* createWidget( const QString &name );
+ int exist( const QString &name );
+
+ public:
+ QList<QGraphicsWidget*> mWidgets;
+
+ private:
+
+ QMPXVideoPlaybackControlsController* mController;
+ int mIndex;
+};
+
+#endif /*MPXVIDEOPLAYBACKDOCUMENTHANDLER_H_*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/inc/mpxvideoplaybackfiledetailswidget.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,44 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackFileDetailsWidget
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKFILEDETAILSWIDGET_H_
+#define MPXVIDEOPLAYBACKFILEDETAILSWIDGET_H_
+
+#include <hbwidget.h>
+
+class QMPXVideoPlaybackControlsController;
+
+
+class QMPXVideoPlaybackFileDetailsWidget : public HbWidget
+{
+ Q_OBJECT
+
+ public:
+ QMPXVideoPlaybackFileDetailsWidget( QMPXVideoPlaybackControlsController* controller );
+ virtual ~QMPXVideoPlaybackFileDetailsWidget();
+ void initialize();
+
+ private:
+ QMPXVideoPlaybackControlsController *mController;
+};
+
+#endif /*MPXVIDEOPLAYBACKFILEDETAILSWIDGET_H_*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/inc/mpxvideoplaybackfullscreencontrol.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,125 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackFullScreenControl
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKFULLSCREENCONTROL_H_
+#define MPXVIDEOPLAYBACKFULLSCREENCONTROL_H_
+
+#include <qobject>
+
+#include <mpxvideoplaybackcontrol.hrh>
+#include <mpxplaybackframeworkdefs.h>
+
+class HbWidget;
+class QMPXVideoPlaybackViewFileDetails;
+class QMPXVideoPlaybackControlsController;
+
+class QMPXVideoPlaybackFullScreenControl : public QObject
+{
+ Q_OBJECT
+
+ public:
+ QMPXVideoPlaybackFullScreenControl( QMPXVideoPlaybackControlsController* controller,
+ TMPXVideoPlaybackControls index,
+ HbWidget* widget,
+ TUint controlproperties );
+
+ virtual ~QMPXVideoPlaybackFullScreenControl();
+
+ public:
+
+ /**
+ * Set visibility of each control
+ */
+ virtual void setVisibility( TMPXPlaybackState aState );
+
+ /**
+ * return control index
+ */
+ TMPXVideoPlaybackControls controlIndex();
+
+ /**
+ * set changed volume
+ */
+ bool volumeChanged( int aVolume );
+
+ /**
+ * set changed duration
+ */
+ bool durationChanged( int duration );
+
+ /**
+ * set changed volume
+ */
+ bool positionChanged( int position );
+
+ /**
+ * Set changed position
+ */
+ bool aspectRatioChanged( int aspectRatio );
+
+ /**
+ * set changed volume
+ */
+ bool setDownloadSize( int size );
+
+ /**
+ * set changed state
+ */
+ void updateState( TMPXPlaybackState state );
+
+ /*
+ * UpdateDownloadPosition
+ * updates the download ratio on the progress bar
+ */
+ bool updateDownloadPosition( int size );
+
+ /*
+ * Update the controls with the file details
+ */
+ virtual void updateControlsWithFileDetails( QMPXVideoPlaybackViewFileDetails *details );
+
+ virtual void setVisible( bool visible );
+
+ virtual bool isVisible();
+
+ virtual void updateControlProperties( TUint properties );
+
+ public:
+ int mPosition;
+ int mDuration;
+ int mAspectRatio;
+ int mDownloadSize;
+ int mDownloadPosition;
+ int mVolume;
+
+ bool mVisible;
+ TMPXPlaybackState mState;
+ TMPXPlaybackState mVisibilityState;
+
+ protected:
+ QMPXVideoPlaybackControlsController* mController;
+ HbWidget *mControl;
+ TMPXVideoPlaybackControls mControlIndex;
+ TUint mProperties;
+};
+
+#endif /*MPXVIDEOPLAYBACKFULLSCREENCONTROL_H_*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/inc/mpxvideoplaybacknontouchvolumebar.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackNonTouchVolumeBar
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKNONTOUCHVOLUMEBAR_H_
+#define MPXVIDEOPLAYBACKNONTOUCHVOLUMEBAR_H_
+
+
+#include <hbvolumeslider.h>
+
+class QTimer;
+class QGraphicsSceneMouseEvent;
+
+class QMPXVideoPlaybackNonTouchVolumeBar : public HbVolumeSlider
+{
+ Q_OBJECT
+
+ public:
+ QMPXVideoPlaybackNonTouchVolumeBar(
+ bool currentValueVisible = false, QGraphicsItem *parent = 0 );
+
+ virtual ~QMPXVideoPlaybackNonTouchVolumeBar();
+
+ public:
+ void setVisible( bool visible );
+
+ void setValue( int value );
+
+ public:
+
+ bool mVisible;
+ int mValue;
+
+};
+
+#endif /*MPXVIDEOPLAYBACKNONTOUCHVOLUMEBAR_H_*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/inc/mpxvideoplaybackprogressbar.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,44 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackProgressBar
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKPROGRESSBAR_H_
+#define MPXVIDEOPLAYBACKPROGRESSBAR_H_
+
+#include <hbwidget.h>
+#include <mpxplaybackframeworkdefs.h>
+
+class QMPXVideoPlaybackControlsController;
+
+class QMPXVideoPlaybackProgressBar : public HbWidget
+{
+ Q_OBJECT
+
+ public:
+ QMPXVideoPlaybackProgressBar( QMPXVideoPlaybackControlsController* controller );
+ virtual ~QMPXVideoPlaybackProgressBar();
+ void initialize();
+
+ private:
+ QMPXVideoPlaybackControlsController *mController;
+};
+
+#endif /*MPXVIDEOPLAYBACKPROGRESSBAR_H_*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/inc/mpxvideoplaybackstatuspanecontrol.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackStatusPaneControl
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKSTATUSPANECONTROL_H_
+#define MPXVIDEOPLAYBACKSTATUSPANECONTROL_H_
+
+
+#include "mpxvideoplaybackfullscreencontrol.h"
+
+
+class QMPXVideoPlaybackControlsController;
+
+class QMPXVideoPlaybackStatusPaneControl : public QMPXVideoPlaybackFullScreenControl
+{
+ Q_OBJECT
+
+ public:
+ QMPXVideoPlaybackStatusPaneControl( QMPXVideoPlaybackControlsController* controller,
+ TMPXVideoPlaybackControls index,
+ HbWidget* widget,
+ TUint controlproperties );
+
+ virtual ~QMPXVideoPlaybackStatusPaneControl();
+
+};
+
+#endif /*MPXVIDEOPLAYBACKSTATUSPANECONTROL_H_*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/inc/mpxvideoplaybackviewfiledetails.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* 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: MPX Video File Details (QT)
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+
+#ifndef __MPXVIDEOPLAYBACKVIEWFILEDETAILS__
+#define __MPXVIDEOPLAYBACKVIEWFILEDETAILS__
+
+#include <qobject.h>
+#include "mpxhelixplaybackplugindefs.h"
+
+
+//
+// CLASS DECLARATION
+//
+class QMPXVideoPlaybackViewFileDetails : public QObject
+{
+ public:
+ //
+ // Constructor
+ //
+ QMPXVideoPlaybackViewFileDetails();
+
+ //
+ // Destructor.
+ //
+ virtual ~QMPXVideoPlaybackViewFileDetails();
+
+ //
+ // Clear all file details
+ //
+ void clearFileDetails();
+
+ public:
+ //
+ // Data
+ //
+ QString mClipName;
+ QString mTitle;
+ QString mArtist;
+ QString mMimeType;
+ QString mDescription;
+ QString mLocation;
+ QString mCopyright;
+ QString mLanguage;
+ QString mKeywords;
+
+ TMPXVideoMode mPlaybackMode;
+ bool mSeekable;
+ bool mPausableStream;
+ bool mAudioEnabled;
+ bool mVideoEnabled;
+ bool mPartialPlayback;
+ bool mRNFormat;
+ bool mTvOutConnected;
+ bool mTvOutPlayAllowed;
+ bool mDrmProtected;
+ bool mMultiItemPlaylist;
+
+ int mVideoHeight;
+ int mVideoWidth;
+ int mBitRate;
+ int mDuration;
+};
+
+#endif // __MPXVIDEOPLAYBACKVIEWFILEDETAILS__
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/inc/mpxvideoviewwrapper.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,74 @@
+/*
+* 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 MPX Video Wrapper
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+// This file defines the API for .dll
+
+#ifndef __MPXVIDEOVIEWWRAPPER_H__
+#define __MPXVIDEOVIEWWRAPPER_H__
+
+// Include Files
+
+#include <e32base.h> // CBase
+#include <e32std.h> // TBuf
+#include <mpxplaybackframeworkdefs.h>
+
+#include "mpxvideoplaybackcontrol.hrh"
+
+// Constants
+
+// Forward Declarations
+class HbVideoBasePlaybackView;
+class QMPXVideoPlaybackViewFileDetails;
+
+
+// Class Definitions
+
+class CMPXVideoViewWrapper : public CBase
+{
+ public:
+ static CMPXVideoViewWrapper* NewL( HbVideoBasePlaybackView* aView );
+ virtual ~CMPXVideoViewWrapper();
+
+ CMPXVideoViewWrapper( HbVideoBasePlaybackView* aView );
+ void ConstructL();
+
+ public:
+ void HandleCommandL( TInt aCommand );
+
+ void SetPropertyL( TMPXPlaybackProperty aProperty, TInt aValue );
+
+ void UpdateVideoRect( TInt aX, TInt aY, TInt aWidth, TInt aHeight, TBool transitionEffect );
+
+
+ public: // data
+
+ HbVideoBasePlaybackView* mView;
+ TBool mMediaRequested;
+ QMPXVideoPlaybackViewFileDetails* mFileDetails;
+ TBool mClosePlayerAO;
+ TBool mForeground;
+ int mProperty;
+ int mCommandId;
+};
+
+#endif // __MPXVIDEOVIEWWRAPPER_H__
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/inc/thumbnailmanager_qt.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,382 @@
+/*
+* 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 tn manager object
+ *
+*/
+
+// Version : %version: 1 %
+
+
+#ifndef THUMBNAILMANAGER_QT_H
+#define THUMBNAILMANAGER_QT_H
+
+#include <qobject>
+#include <QPixmap.h>
+#include <qmap.h>
+
+class QString;
+class QSize;
+
+class ThumbnailManager : public QObject
+ {
+ Q_OBJECT
+
+public:
+ /** Thumbnail size. */
+ enum ThumbnailSize
+ {
+ /**
+ * Small thumbnail (64x64 ?)
+ */
+ ThumbnailSmall = 0,
+ /**
+ * Medium thumbnail (128x128 ?)
+ */
+ ThumbnailMedium,
+ /**
+ * Large thumbnail (256x256 ?)
+ */
+ ThumbnailLarge
+ };
+
+ /** Mode of thumbnail creation. */
+ enum ThumbnailMode
+ {
+ /**
+ * Default mode. This means that:
+ * - Thumbnail must be as large as requested (unless the actual object is smaller).
+ * - Smaller thumbnails may be up scaled to desired resolution.
+ * - Aspect ratio is maintained and thumbnails are not cropped. The
+ * resulting thumbnail may smaller in either width or height if
+ * the aspect ratio of the object does not match the aspect ratio
+ * of the requested size.
+ */
+ Default = 0,
+
+ /**
+ * Allow thumbnails which are smaller than requested are. Thumbnail
+ * bitmaps are never up scaled if this flag is set.
+ */
+ AllowAnySize = 1,
+
+ /**
+ * New thumbnail images are not created if this flag is set. Only
+ * existing thumbnails may be returned. If a requested thumbnail does
+ * not exist null pixmap will be returned.
+ */
+ DoNotCreate = 2,
+
+ /**
+ * Thumbnail images are cropped to match requested aspect ratio. If
+ * this mode is set, the size of the resulting thumbnail always
+ * matches the requested size.
+ */
+ CropToAspectRatio = 4
+ };
+
+ /** Priority of the request. */
+ enum Priority
+ {
+ PriorityIdle=-100,
+ PriorityLow=-20,
+ PriorityStandard=0,
+ PriorityUserInput=10,
+ PriorityHigh=20,
+ };
+
+ /** Quality versus speed preference setting */
+ enum QualityPreference
+ {
+ /**
+ * Prefer thumbnails in the highest quality possible disregarding
+ * any negative impact on performance.
+ */
+ OptimizeForQuality,
+
+ /**
+ * Get thumbnails as fast as possible, even if
+ * it means lower quality.
+ */
+ OptimizeForPerformance
+ };
+
+ /** Display modes. */
+ enum DisplayMode
+ {
+ /** No display mode */
+ None,
+
+ /** Monochrome display mode (1 bpp) */
+ Gray2,
+
+ /** Four grayscales display mode (2 bpp) */
+ Gray4,
+
+ /** 16 grayscales display mode (4 bpp) */
+ Gray16,
+
+ /** 256 grayscales display mode (8 bpp) */
+ Gray256,
+
+ /** Low colour GA 16 colour display mode (4 bpp) */
+ Color16,
+
+ /** 256 colour display mode (8 bpp) */
+ Color256,
+
+ /** 64,000 colour display mode (16 bpp) */
+ Color64K,
+
+ /** True colour display mode (24 bpp) */
+ Color16M,
+
+ /** (Not an actual display mode used for moving buffers containing bitmaps) */
+ Rgb,
+
+ /** 4096 colour display (12 bpp). */
+ Color4K,
+
+ /** True colour display mode (32 bpp, but top byte is unused and unspecified) */
+ Color16MU,
+
+ /** Display mode with alpha (24bpp colour plus 8bpp alpha) */
+ Color16MA,
+
+ /** Pre-multiplied Alpha display mode
+ * (24bpp color multiplied with the alpha channel value, plus 8bpp alpha) */
+ Color16MAP
+ };
+
+ struct TnRequest {
+ QString name;
+ void *id;
+ int priority;
+ bool cancelled;
+
+ TnRequest(QString name, void *id, int priority, bool cancelled) {
+ this->name = name;
+ this->id = id;
+ this->priority = priority;
+ this->cancelled = cancelled;
+ }
+
+ TnRequest() {
+ name = QString("");
+ id = 0;
+ priority = PriorityIdle;
+ cancelled = false;
+ }
+ };
+
+ /**
+ * Constructor
+ *
+ * @param parentPtr parent
+ */
+ ThumbnailManager( QObject* parentPtr = NULL );
+
+ /**
+ * Destructor
+ */
+ virtual ~ThumbnailManager();
+
+ /**
+ * Get quality versus performance preference.
+ *
+ * @return quality versus performance preference
+ */
+ QualityPreference qualityPreference() const;
+
+ /**
+ * Set quality versus performance preference.
+ *
+ * @param qualityPreference New quality versus performance preference
+ * value.
+ * @return true on success
+ */
+ bool setQualityPreference( QualityPreference qualityPreference );
+
+ /**
+ * Get the current display mode for thumbnail bitmaps.
+ *
+ * @return current display mode for thumbnail bitmaps
+ */
+ DisplayMode displayMode() const;
+
+ /**
+ * Set new display mode for thumbnail bitmaps.
+ *
+ * @param displayMode new display mode for thumbnail bitmaps.
+ * @return true on success
+ */
+ bool setDisplayMode( DisplayMode displayMode );
+
+ /**
+ * Get the current desired size for thumbnail bitmaps.
+ *
+ * @return Current desired size for thumbnail bitmaps (in pixels).
+ */
+ QSize thumbnailSize() const;
+
+ /**
+ * Set desired size for thumbnail bitmaps.
+ *
+ * @param thumbnailSize New desired thumbnail size.
+ * @return true on success
+ */
+ bool setThumbnailSize( const QSize& thumbnailSize );
+
+ /**
+ * Set desired size for thumbnail bitmaps.
+ *
+ * @param thumbnailSize New desired thumbnail size.
+ * @return true on success
+ */
+ bool setThumbnailSize( ThumbnailSize thumbnailSize );
+
+ /**
+ * Get current mode for thumbnail generation.
+ *
+ * @return Current mode.
+ */
+ ThumbnailMode mode() const;
+
+ /**
+ * Set mode for thumbnail generation.
+ *
+ * @param mode New flags.
+ * @return true on success
+ */
+ bool setMode( ThumbnailMode mode );
+
+ /**
+ * Get a thumbnail for an object file. If a thumbnail already exists, it
+ * is loaded and if a thumbnail does not exist, it is created
+ * transparently. If thumbnail loadinf fails thumbnailReady signal is emited
+ * with null pixmap and error code.
+ *
+ * @param fileName Source object or file
+ * @param clientData Pointer to arbitrary client data.
+ * This pointer is not used by the API for
+ * anything other than returning it in the
+ * ThumbnailReady signal.
+ * @param priority Priority for this operation
+ * @return Thumbnail request ID or -1 if request failed. This can be used to
+ * cancel the request or change priority.
+ * The ID is specific to this tnm
+ * instance and may not be shared with other
+ * instances.
+ */
+ int getThumbnail( const QString& fileName, void * clientData = NULL,
+ int priority = PriorityIdle );
+
+ /**
+ * Get a persistent thumbnail for an object file. If a thumbnail already
+ * exists, it is loaded and if a thumbnail does not exist, it is created
+ * transparently. If thumbnail loading fails thumbnailReady signal is emited
+ * with null pixmap and error code.
+ *
+ * @param thumbnailId Thumbnail ID
+ * @param clientData Pointer to arbitrary client data.
+ * This pointer is not used by the API for
+ * anything other than returning it in the
+ * ThumbnailReady signal.
+ * @param priority Priority for this operation
+ * @return Thumbnail request ID or -1 if request failed. This can be used to
+ * cancel the request or change priority.
+ * The ID is specific to this tnm
+ * instance and may not be shared with other
+ * instances.
+ */
+ int getThumbnail( unsigned long int thumbnailId, void * clientData = NULL,
+ int priority = PriorityIdle );
+
+ /**
+ * Set a thumbnail for an object file generated from pixmap delivered.
+ * thumbnailReady() signal will be emited when the operation is complete.
+ *
+ * @param source Pixmap from which the thumbnail will be created
+ * @param fileName file name
+ * @param clientData Pointer to arbitrary client data.
+ * This pointer is not used by the API for
+ * anything other than returning it in the
+ * ThumbnailReady callback.
+ * @param priority Priority for this operation
+ * @return Thumbnail request ID or -1 if request failed. This can be used to
+ * cancel the request or change priority.
+ *
+ */
+ int setThumbnail( const QPixmap& source, const QString& fileName,
+ void * clientData = NULL, Priority priority = PriorityIdle );
+
+ /**
+ * Delete all thumbnails for a given object. This is an asynchronous
+ * operation, which always returns immediately.
+ *
+ * @param fileName Source file
+ */
+ void deleteThumbnails( const QString& fileName );
+
+ /**
+ * Delete all thumbnails for a given object. This is an asynchronous
+ * operation, which always returns immediately.
+ *
+ * @param thumbnailId thumbnail id
+ */
+ void deleteThumbnails( unsigned long int thumbnailId );
+
+ /**
+ * Cancel a thumbnail operation.
+ *
+ * @param id Request ID for the operation to be cancelled.
+ * @return true if cancelling was successful.
+ */
+ bool cancelRequest( int id );
+
+ /**
+ * Change the priority of a queued thumbnail operation.
+ *
+ * @param id Request ID for the request which to assign a new
+ * priority.
+ * @param newPriority New priority value
+ * @return true if change was successful.
+ */
+ bool changePriority( int id, Priority newPriority );
+
+
+ void emitThumbnailReady(int tnId );
+
+signals:
+ /**
+ * Final thumbnail bitmap generation or loading is complete.
+ *
+ * @param pixmap An object representing the resulting thumbnail.
+ * @param clientData Client data
+ * @param id Request ID for the operation
+ * @param errorCode error code
+ */
+ void thumbnailReady( QPixmap , void * , int , int );
+
+public:
+
+ static QMap<int, TnRequest> mRequests;
+
+ ThumbnailSize mThumbSize;
+ QualityPreference mQuality;
+ bool mGetThumbFails;
+ int mThumbnailReadyError;
+
+};
+
+#endif // QTNMWRAPPER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/src/hbvideobaseplaybackview.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* 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: Implementation of Video playback view
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+// Include Files
+#include <aknappui.h>
+#include <qgraphicssceneevent>
+#include <hbinstance.h>
+#include <mmf/common/mmferrors.h>
+
+#include "../inc/hbvideobaseplaybackview.h"
+#include "mpxvideo_debug.h"
+
+
+// Member Functions
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoPlaybackView::HbVideoPlaybackView()
+// -------------------------------------------------------------------------------------------------
+//
+HbVideoBasePlaybackView::HbVideoBasePlaybackView()
+{
+ MPX_DEBUG(_L("HbVideoBasePlaybackView::HbVideoBasePlaybackView()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoPlaybackView::~HbVideoPlaybackView()
+// -------------------------------------------------------------------------------------------------
+//
+HbVideoBasePlaybackView::~HbVideoBasePlaybackView()
+{
+ MPX_DEBUG(_L("HbVideoBasePlaybackView::~HbVideoBasePlaybackView()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::mouseReleaseEvent
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::mouseReleaseEvent( QGraphicsSceneMouseEvent *event )
+{
+ MPX_DEBUG(_L("HbVideoBasePlaybackView::mouseReleaseEvent()"));
+ Q_UNUSED( event );
+ emit tappedOnScreen();
+}
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/src/mpxvideoplaybackbuttonbar.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackButtonBar
+*
+*/
+
+// Version : %version: 1 %
+
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackbuttonbar.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackButtonBar::QMPXVideoPlaybackButtonBar()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackButtonBar::QMPXVideoPlaybackButtonBar(
+ QMPXVideoPlaybackControlsController* controller )
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackButtonBar::QMPXVideoPlaybackButtonBar"));
+ Q_UNUSED( controller );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackButtonBar::~QMPXVideoPlaybackButtonBar()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackButtonBar::~QMPXVideoPlaybackButtonBar()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackButtonBar::~QMPXVideoPlaybackButtonBar()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackButtonBar::initialize()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackButtonBar::initialize()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackButtonBar::initialize()"));
+}
+
+
+//End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/src/mpxvideoplaybackcontrolconfiguration.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,157 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackControlConfiguration
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+// INCLUDE FILES
+
+#include <qgraphicswidget>
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackdocumentloader.h"
+#include "mpxvideoplaybackviewfiledetails.h"
+#include "mpxvideoplaybackcontrolconfiguration.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+
+const TInt KControlListUpdated = 12; // additional extension of TMPXPlaybackState
+
+// ================= MEMBER FUNCTIONS ==============================================================
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackControlConfiguration::CMPXVideoPlaybackControlConfiguration()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackControlConfiguration::QMPXVideoPlaybackControlConfiguration(
+ QMPXVideoPlaybackControlsController* controller)
+ : mControlsController( controller )
+{
+ createControlList();
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlConfiguration::~QMPXVideoPlaybackControlConfiguration()
+// Destructor.
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackControlConfiguration::~QMPXVideoPlaybackControlConfiguration()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlConfiguration::~QMPXVideoPlaybackControlConfiguration"));
+
+ mControlsList.clear();
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlConfiguration::createControlList()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlConfiguration::createControlList()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlConfiguration::createControlList()"));
+
+ QMPXVideoPlaybackViewFileDetails* fileDetails = mControlsController->fileDetails();
+
+ if ( fileDetails->mPlaybackMode != EMPXVideoLocal )
+ {
+ //
+ // if it's not local mode, add branding animation control to show while initializing
+ //
+ addControlToList( EMPXBufferingAnimation );
+ }
+
+ addControlToList( EMPXStatusPane );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlConfiguration::controlList
+// -------------------------------------------------------------------------------------------------
+//
+QList<TMPXVideoPlaybackControls>& QMPXVideoPlaybackControlConfiguration::controlList()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlConfiguration::controlList()"));
+
+ return mControlsList;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlConfiguration::updateControlList
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlConfiguration::updateControlList(
+ TMPXVideoPlaybackControlCommandIds event )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlConfiguration::updateControlList(%d)"), event);
+
+ if ( event == EMPXControlCmdFullScreenViewOpened ||
+ event == EMPXControlCmdDetailsViewOpened ||
+ event == EMPXControlCmdPluginInitialized )
+ {
+ mState = event;
+ }
+ else if ( event == EMPXControlCmdTvOutConnected ||
+ event == EMPXControlCmdAudionOnlyViewOpened )
+ {
+ mState = EMPXControlCmdTvOutConnected;
+ }
+ else
+ {
+ mState = KControlListUpdated;
+ }
+
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlConfiguration::deleteControlFromList
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlConfiguration::deleteControlFromList(
+ TMPXVideoPlaybackControls control )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlConfiguration::deleteControlFromList(%d)"), control);
+
+ mControlsList.removeAll( control );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlConfiguration::addControlToList
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlConfiguration::addControlToList(
+ TMPXVideoPlaybackControls control )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlConfiguration::addControlToList(%d)"), control);
+
+ if ( ! mControlsList.contains( control ) )
+ {
+ mControlsList.append( control );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlConfiguration::updateControlsWithFileDetails
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlConfiguration::updateControlsWithFileDetails()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlConfiguration::updateControlsWithFileDetails()"));
+
+ mUpdateControlsWithFileDetails = true;
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/src/mpxvideoplaybackcontrolpolicy.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,126 @@
+/*
+* 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: Implementation of MPXVideoPlaybackControlPolicy
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+// INCLUDE FILES
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackcontrolpolicy.h"
+#include "mpxvideoplaybackviewfiledetails.h"
+
+// ================= MEMBER FUNCTIONS ==============================================================
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackControlPolicy::CMPXVideoPlaybackControlPolicy()
+// C++ default constructor can NOT contain any code, that might leave.
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackControlPolicy::QMPXVideoPlaybackControlPolicy()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlPolicy::QMPXVideoPlaybackControlPolicy()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlPolicy::~QMPXVideoPlaybackControlPolicy()
+// Destructor.
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackControlPolicy::~QMPXVideoPlaybackControlPolicy()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlPolicy::~QMPXVideoPlaybackControlPolicy()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlPolicy::setControlProperties()
+// -------------------------------------------------------------------------------------------------
+//
+void
+QMPXVideoPlaybackControlPolicy::setControlProperties( TMPXVideoPlaybackControls controlIndex,
+ TUint& properties,
+ QMPXVideoPlaybackViewFileDetails *details,
+ TPlaybackViewMode viewMode )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlPolicy::setControlProperties()"));
+
+ properties = 0;
+
+ switch ( controlIndex )
+ {
+ case EMPXBufferingAnimation:
+ {
+ properties = EMPXShownWhenInitializing |
+ EMPXShownWhenBuffering;
+ break;
+ }
+ case EMPXStatusPane:
+ {
+ if ( details->mPlaybackMode != EMPXVideoLocal ||
+ viewMode == EAudioOnlyView ||
+ viewMode == EDetailsView )
+ {
+ properties = EMPXAllProperties;
+ }
+ else
+ {
+ properties = EMPXShownWhenPlaying |
+ EMPXShownWhenPaused |
+ EMPXShownWhenSeeking;
+ }
+ break;
+ }
+ case EMPXButtonBar:
+ case EMPXProgressBar:
+ {
+ //
+ // We don't delete ButtonBar and Progress Bar from the controlsList
+ // to update information all the time though it's not visible or activated
+ // So just hide these if it is details view
+ //
+ if ( viewMode == EDetailsView )
+ {
+ properties = 0;
+ }
+ else if ( viewMode == EAudioOnlyView )
+ {
+ properties = EMPXAllProperties;
+ }
+ else
+ {
+ properties = EMPXShownWhenPlaying |
+ EMPXShownWhenPaused |
+ EMPXShownWhenSeeking;
+ }
+ break;
+ }
+ case EMPXFileDetailsWidget:
+ case EMPXIndicatorBitmap:
+ case EMPXDetailsViewPlaybackWindow:
+ {
+ //
+ // Add all these controls when it is details view or audio only view
+ // Once it's added to controlsList, these are visible always
+ //
+ properties = EMPXAllProperties;
+ break;
+ }
+ }
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/src/mpxvideoplaybackdetailsplaybackwindow.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackProgressBar
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+#include "mpxvideoplaybackdetailsplaybackwindow.h"
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDetailsPlaybackWindow::QMPXVideoPlaybackDetailsPlaybackWindow
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackDetailsPlaybackWindow::QMPXVideoPlaybackDetailsPlaybackWindow(
+ QMPXVideoPlaybackControlsController* controller )
+ : mController( controller )
+ , mInitialized( false )
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackDetailsPlaybackWindow::QMPXVideoPlaybackDetailsPlaybackWindow()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDetailsPlaybackWindow::~QMPXVideoPlaybackDetailsPlaybackWindow
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackDetailsPlaybackWindow::~QMPXVideoPlaybackDetailsPlaybackWindow()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackDetailsPlaybackWindow::~QMPXVideoPlaybackDetailsPlaybackWindow()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDetailsPlaybackWindow::initialize
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackDetailsPlaybackWindow::initialize()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackDetailsPlaybackWindow::initialize()"));
+
+}
+
+
+//End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/src/mpxvideoplaybackdocumentloader.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,272 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackDocumentLoader
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#include <hblistwidget.h>
+#include <hblabel.h>
+#include <hbtransparentwindow.h>
+#include <hbratingslider.h>
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackdocumentloader.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+
+#include "mpxvideoplaybackbuttonbar.h"
+#include "mpxvideoplaybackprogressbar.h"
+#include "mpxvideoplaybackfiledetailswidget.h"
+#include "mpxvideoplaybacknontouchvolumebar.h"
+#include "mpxvideoplaybackcontrolconfiguration.h"
+#include "mpxvideoplaybackdetailsplaybackwindow.h"
+
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader(
+ QMPXVideoPlaybackControlsController *controller )
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader()"));
+ mController = controller;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::~QMPXVideoPlaybackDocumentLoader
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackDocumentLoader::~QMPXVideoPlaybackDocumentLoader()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::QMPXVideoPlaybackDocumentLoader : mWidgets.count(%d)"),
+ mWidgets.count() );
+
+ for ( int i = 0 ; i < mWidgets.count() ; i++ )
+ {
+ mWidgets.removeAt( 0 );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::findWidget()
+// -------------------------------------------------------------------------------------------------
+//
+QGraphicsWidget *QMPXVideoPlaybackDocumentLoader::findWidget( const QString &name )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::findWidget(%s)"), name.data() );
+
+ QGraphicsWidget *object = NULL;
+
+ //int index = exist( name );
+ mIndex = exist( name );
+
+ if ( mIndex == -1 )
+ {
+ object = createWidget( name );
+ }
+ else
+ {
+ object = mWidgets[ mIndex ];
+ }
+
+ return object;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::createWidget()
+// -------------------------------------------------------------------------------------------------
+//
+QGraphicsWidget *QMPXVideoPlaybackDocumentLoader::createWidget( const QString &name )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::createWidget(%s)"), name.data() );
+
+ QGraphicsWidget *object = NULL;
+
+ if ( name == "transparentWindow" ||
+ name == "small_transparentWindow" )
+ {
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::creating transparentWindow") );
+
+ object = new HbTransparentWindow();
+ object->setObjectName( name );
+
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::appending[transparentWindow] to object list") );
+ mWidgets.append( object );
+ }
+ else if ( name == "content" || name == "bitmapLayout" )
+ {
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::creating HbWidget") );
+
+ object = new HbWidget();
+ object->setObjectName( name );
+
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::appending[HbWidget] to object list") );
+ mWidgets.append( object );
+ }
+ else if ( name == "title" || name == "bufferingIcon" ||
+ name == "tvOutBitmap" || name == "realAudioOnlyBitmap" ||
+ name == "partialAudioOnlyBitmap" || name == "audioOnlyBitmap" )
+ {
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::creating HbLabel") );
+
+ object = new HbLabel();
+ object->setObjectName( name );
+
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::appending[HbLabel] to object list") );
+ mWidgets.append( object );
+ }
+ else if ( name == "buttonBarLayout" )
+ {
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::creating buttonBarLayout") );
+
+ object = new QMPXVideoPlaybackButtonBar( mController );
+ object->setObjectName( name );
+
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::appending[buttonBarLayout] to object list") );
+ mWidgets.append( object );
+ }
+ else if ( name == "progressBarLayout" )
+ {
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::creating progressBarLayout") );
+
+ object = new QMPXVideoPlaybackProgressBar( mController );
+ object->setObjectName( name );
+
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::appending[progressBarLayout] to object list") );
+ mWidgets.append( object );
+ }
+ else if ( name == "fileDetailsLayout" )
+ {
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::creating fileDetailsLayout") );
+
+ object = new QMPXVideoPlaybackFileDetailsWidget( mController );
+ object->setObjectName( name );
+
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::appending[fileDetailsLayout] to object list") );
+ mWidgets.append( object );
+ }
+ else if ( name == "volumeSlider" )
+ {
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::creating volumeSlider") );
+
+ object = new QMPXVideoPlaybackNonTouchVolumeBar();
+ object->setObjectName( name );
+
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::appending[volumeSlider] to object list") );
+ mWidgets.append( object );
+ }
+ else if ( name == "detailsPlaybackWindow" )
+ {
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::creating detailsPlaybackWindow") );
+
+ object = new QMPXVideoPlaybackDetailsPlaybackWindow( mController );
+ object->setObjectName( name );
+
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::appending[detailsPlaybackWindow] to object list") );
+ mWidgets.append( object );
+ }
+ else if ( name == "fileDetails" )
+ {
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::creating HbListWidget") );
+
+ object = new HbListWidget();
+ object->setObjectName( name );
+
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::appending[HbListWidget] to object list") );
+ mWidgets.append( object );
+ }
+ else if ( name == "nonLocalPlayback" )
+ {
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::creating HbRatingSlider") );
+
+ object = new HbRatingSlider();
+ object->setObjectName( name );
+
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::appending[HbRatingSlider] to object list") );
+ mWidgets.append( object );
+ }
+
+ return object;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::exist()
+// -------------------------------------------------------------------------------------------------
+//
+int QMPXVideoPlaybackDocumentLoader::exist( const QString &name )
+{
+ int i = 0;
+
+ for ( ; i < mWidgets.count() ; i++ )
+ {
+ if( mWidgets[i]->objectName() == name )
+ {
+ break;
+ }
+ }
+
+ if ( i == mWidgets.count() )
+ {
+ i = -1;
+ }
+
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::exist(%s) returns %d"),
+ name.data(), i );
+
+ return i;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::load()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackDocumentLoader::load(
+ const QString &fileName, const QString §ion , bool *ok )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::load(fileName=%s, section=%s)"),
+ fileName.data(), section.data() );
+
+ Q_UNUSED( fileName );
+ Q_UNUSED( section );
+ *ok = true;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::load()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackDocumentLoader::load(
+ const QString &fileName, bool *ok )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::load(fileName=%s)"), fileName.data() );
+ Q_UNUSED( fileName );
+ *ok = true;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::isVisible()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackDocumentLoader::isVisible( int index )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackDocumentLoader::isVisible(%d)"), index );
+
+ return mWidgets[ index ]->isVisible();
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/src/mpxvideoplaybackfiledetailswidget.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,58 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackFileDetailsWidget
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackfiledetailswidget.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFileDetailsWidget::QMPXVideoPlaybackFileDetailsWidget
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackFileDetailsWidget::QMPXVideoPlaybackFileDetailsWidget(
+ QMPXVideoPlaybackControlsController* controller )
+ : mController( controller )
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackFileDetailsWidget::QMPXVideoPlaybackFileDetailsWidget()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFileDetailsWidget::~QMPXVideoPlaybackFileDetailsWidget
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackFileDetailsWidget::~QMPXVideoPlaybackFileDetailsWidget()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackFileDetailsWidget::~QMPXVideoPlaybackFileDetailsWidget()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFileDetailsWidget::initialize
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackFileDetailsWidget::initialize()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackFileDetailsWidget::initialize"));
+}
+
+
+//End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/src/mpxvideoplaybackfullscreencontrol.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,197 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackFullScreenControl
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#include <w32std.h>
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackbuttonbar.h"
+#include "mpxvideoplaybackprogressbar.h"
+#include "mpxvideoplaybackfullscreencontrol.h"
+#include "mpxvideoplaybackfiledetailswidget.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+#include "mpxvideoplaybackdetailsplaybackwindow.h"
+
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::QMPXVideoPlaybackFullScreenControl()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackFullScreenControl::QMPXVideoPlaybackFullScreenControl(
+ QMPXVideoPlaybackControlsController* controller,
+ TMPXVideoPlaybackControls index,
+ HbWidget* widget,
+ TUint controlproperties )
+ : mController( controller )
+ , mControl( widget )
+ , mControlIndex( index )
+ , mProperties( controlproperties )
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackFullScreenControl::QMPXVideoPlaybackFullScreenControl()"));
+
+ setParent( mController );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::~QMPXVideoPlaybackFullScreenControl()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackFullScreenControl::~QMPXVideoPlaybackFullScreenControl()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackFullScreenControl"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::setVisible()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackFullScreenControl::setVisible( bool visible )
+{
+ //mControl->setVisible( visible );
+ mVisible = visible;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::isVisible()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackFullScreenControl::isVisible()
+{
+ //return mControl->isVisible();
+ return mVisible;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::setVisibility()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackFullScreenControl::setVisibility( TMPXPlaybackState state )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackFullScreenControl::setVisibility(%d)"), state);
+
+ mVisibilityState = state;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::controlIndex()
+// -------------------------------------------------------------------------------------------------
+//
+TMPXVideoPlaybackControls QMPXVideoPlaybackFullScreenControl::controlIndex()
+{
+ return mControlIndex;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::volumeChanged()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackFullScreenControl::volumeChanged( int volume )
+{
+ mVolume = volume;
+ return true;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::durationChanged()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackFullScreenControl::durationChanged( int duration )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackFullScreenControl::durationChanged() [%d]"), duration );
+ mDuration = duration;
+ return true;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::positionChanged()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackFullScreenControl::positionChanged( int position )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackFullScreenControl::positionChanged() [%d]"), position );
+ mPosition = position;
+ return true;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::aspectRatioChanged()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackFullScreenControl::aspectRatioChanged( int aspectRatio )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackFullScreenControl::aspectRatioChanged() [%d]"), aspectRatio );
+ mAspectRatio = aspectRatio;
+ return true;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::setDownloadSize()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackFullScreenControl::setDownloadSize( int size )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackFullScreenControl::setDownloadSize() [%d]"), size );
+ mDownloadSize = size;
+ return true;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::updateDownloadPosition()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackFullScreenControl::updateDownloadPosition( int size )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackFullScreenControl::updateDownloadPosition() [%d]"), size );
+ mDownloadPosition = size;
+ return true;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::updateState()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackFullScreenControl::updateState( TMPXPlaybackState state )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackFullScreenControl::updateState() [%d]"), state );
+ mState = state;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::updateControlsWithFileDetails()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackFullScreenControl::updateControlsWithFileDetails(
+ QMPXVideoPlaybackViewFileDetails* details )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackFullScreenControl::updateControlsWithFileDetails()") );
+ Q_UNUSED( details );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFullScreenControl::updateControlProperties()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackFullScreenControl::updateControlProperties( TUint properties )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackFullScreenControl::updateControlProperties()") );
+ mProperties = properties;
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/src/mpxvideoplaybacknontouchvolumebar.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,74 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackNonTouchVolumeBar
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#include <qtimer>
+#include <qgraphicsscenemouseevent>
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+#include "mpxvideoplaybacknontouchvolumebar.h"
+
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackNonTouchVolumeBar::QMPXVideoPlaybackNonTouchVolumeBar()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackNonTouchVolumeBar::QMPXVideoPlaybackNonTouchVolumeBar(
+ bool currentValueVisible,QGraphicsItem *parent )
+ : HbVolumeSlider( currentValueVisible, parent )
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackNonTouchVolumeBar::QMPXVideoPlaybackNonTouchVolumeBar()"));
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackNonTouchVolumeBar::~QMPXVideoPlaybackNonTouchVolumeBar()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackNonTouchVolumeBar::~QMPXVideoPlaybackNonTouchVolumeBar()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackNonTouchVolumeBar::QMPXVideoPlaybackNonTouchVolumeBar"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackNonTouchVolumeBar::setVisible()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackNonTouchVolumeBar::setVisible( bool visible )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackNonTouchVolumeBar::setVisible"));
+
+ mVisible = visible;
+
+ QGraphicsItem::setVisible( visible );
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackNonTouchVolumeBar::setValue()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackNonTouchVolumeBar::setValue( int value )
+{
+ mValue = value;
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/src/mpxvideoplaybackprogressbar.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackProgressBar
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackprogressbar.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackProgressBar::QMPXVideoPlaybackProgressBar
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackProgressBar::QMPXVideoPlaybackProgressBar(
+ QMPXVideoPlaybackControlsController* controller )
+ : mController( controller )
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackProgressBar::QMPXVideoPlaybackProgressBar()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackProgressBar::~QMPXVideoPlaybackProgressBar
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackProgressBar::~QMPXVideoPlaybackProgressBar()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackProgressBar::~QMPXVideoPlaybackProgressBar()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackProgressBar::initialize
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackProgressBar::initialize()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackProgressBar::initialize()"));
+}
+
+//End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/src/mpxvideoplaybackstatuspanecontrol.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* 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: Implementation of QMPXVideoPlaybackStatusPaneControl
+*
+*/
+
+// Version : %version: 1 %
+
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackstatuspanecontrol.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackStatusPaneControl::QMPXVideoPlaybackStatusPaneControl()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackStatusPaneControl::QMPXVideoPlaybackStatusPaneControl(
+ QMPXVideoPlaybackControlsController* controller,
+ TMPXVideoPlaybackControls index,
+ HbWidget* widget,
+ TUint controlproperties )
+ : QMPXVideoPlaybackFullScreenControl( controller, index, widget, controlproperties )
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackStatusPaneControl::QMPXVideoPlaybackStatusPaneControl()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackStatusPaneControl::~QMPXVideoPlaybackStatusPaneControl()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackStatusPaneControl::~QMPXVideoPlaybackStatusPaneControl()
+{
+}
+
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/src/mpxvideoplaybackviewfiledetails.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* 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: class for MPX Video File Details (Qt)
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+//
+// INCLUDE FILES
+//
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackviewfiledetails.h"
+
+
+// ============================ MEMBER FUNCTIONS ===================================================
+
+QMPXVideoPlaybackViewFileDetails::QMPXVideoPlaybackViewFileDetails()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackViewFileDetails::QMPXVideoPlaybackViewFileDetails()"));
+
+ clearFileDetails();
+}
+
+QMPXVideoPlaybackViewFileDetails::~QMPXVideoPlaybackViewFileDetails()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackViewFileDetails::~QMPXVideoPlaybackViewFileDetails()"));
+
+ clearFileDetails();
+}
+
+void
+QMPXVideoPlaybackViewFileDetails::clearFileDetails()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackViewFileDetails::ClearFileDetails()"));
+
+ mMimeType = tr("");
+ mTitle = tr("");
+ mArtist = tr("");
+ mClipName = tr("");
+ mDescription = tr("");
+ mLocation = tr("");
+ mCopyright = tr("");
+ mLanguage = tr("");
+ mKeywords = tr("");
+
+ mPlaybackMode = EMPXVideoLocal;
+ mSeekable = false;
+ mPausableStream = false;
+ mAudioEnabled = false;
+ mVideoEnabled = false;
+ mPartialPlayback = false;
+ mRNFormat = false;
+
+ mDuration = 0;
+ mTvOutConnected = false;
+ mTvOutPlayAllowed = true;
+ mDrmProtected = false;
+
+ mVideoHeight = 0;
+ mVideoWidth = 0;
+ mBitRate = 0;
+}
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/src/mpxvideoviewwrapper.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,110 @@
+/*
+* 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: Implementation of Video wrapper
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+// Include Files
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoviewwrapper.h"
+#include "hbvideobaseplaybackview.h"
+#include "mpxvideoplaybackviewfiledetails.h"
+#include "mpxcommonvideoplaybackview.hrh"
+
+// Member Functions
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::CMPXVideoViewWrapper()
+// -------------------------------------------------------------------------------------------------
+//
+CMPXVideoViewWrapper::CMPXVideoViewWrapper( HbVideoBasePlaybackView* aView )
+ : mView( aView )
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::NewL()
+// -------------------------------------------------------------------------------------------------
+//
+CMPXVideoViewWrapper* CMPXVideoViewWrapper::NewL( HbVideoBasePlaybackView* aView )
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::CMPXVideoViewWrapper()"));
+ CMPXVideoViewWrapper* self = new (ELeave) CMPXVideoViewWrapper( aView );
+
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ return self;
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::ConstructL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::ConstructL()
+{
+ mMediaRequested = EFalse;
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::~CMPXVideoViewWrapper()
+// -------------------------------------------------------------------------------------------------
+//
+CMPXVideoViewWrapper::~CMPXVideoViewWrapper()
+{
+ MPX_DEBUG(_L("CMPXVideoViewWrapper::~CMPXVideoViewWrapper"));
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::HandleCommandL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::HandleCommandL( TInt aCommand )
+{
+ mCommandId = aCommand;
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::SetPropertyL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::SetPropertyL( TMPXPlaybackProperty aProperty, TInt aValue )
+{
+ mProperty = aProperty;
+ Q_UNUSED( aValue );
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::UpdateVideoRect()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::UpdateVideoRect(
+ TInt aX, TInt aY, TInt aWidth, TInt aHeight, TBool transitionEffect )
+{
+ Q_UNUSED( aX );
+ Q_UNUSED( aY );
+ Q_UNUSED( aWidth );
+ Q_UNUSED( aHeight );
+ Q_UNUSED( transitionEffect );
+}
+
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/stub/src/thumbnailmanager_qt.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,154 @@
+/*
+* 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 tn manager
+ *
+*/
+
+// Version : %version: 1 %
+
+#include <qsize.h>
+#include "thumbnailmanager_qt.h"
+
+QMap<int, ThumbnailManager::TnRequest> ThumbnailManager::mRequests = QMap<int, ThumbnailManager::TnRequest>();
+
+ThumbnailManager::ThumbnailManager( QObject* parentPtr ) :
+QObject( parentPtr ),
+mGetThumbFails(false),
+mThumbnailReadyError(0)
+{
+}
+
+ThumbnailManager::~ThumbnailManager()
+{
+}
+
+ThumbnailManager::QualityPreference ThumbnailManager::qualityPreference() const
+{
+ return mQuality;
+}
+
+bool ThumbnailManager::setQualityPreference( QualityPreference
+ qualityPreference )
+{
+ mQuality = qualityPreference;
+ return true;
+}
+
+ThumbnailManager::DisplayMode ThumbnailManager::displayMode() const
+{
+ return Color16MAP;
+}
+
+bool ThumbnailManager::setDisplayMode( ThumbnailManager::DisplayMode displayMode )
+{
+ Q_UNUSED(displayMode);
+ return true;
+}
+
+QSize ThumbnailManager::thumbnailSize() const
+{
+ return QSize(128, 128); // ThumbnailMedium?
+}
+
+bool ThumbnailManager::setThumbnailSize( const QSize& thumbnailSize )
+{
+ Q_UNUSED(thumbnailSize);
+ return true;
+}
+
+bool ThumbnailManager::setThumbnailSize( ThumbnailSize thumbnailSize )
+{
+ mThumbSize = thumbnailSize;
+ return true;
+}
+
+ThumbnailManager::ThumbnailMode ThumbnailManager::mode() const
+{
+ return Default;
+}
+
+bool ThumbnailManager::setMode( ThumbnailMode mode )
+{
+ Q_UNUSED(mode);
+ return true;
+}
+
+int ThumbnailManager::getThumbnail( const QString& fileName, void * clientData,
+ int priority )
+{
+ Q_UNUSED(fileName);
+ Q_UNUSED(clientData);
+ Q_UNUSED(priority);
+ return 0;
+}
+
+int ThumbnailManager::getThumbnail( unsigned long int thumbnailId, void * clientData,
+ int priority )
+{
+ Q_UNUSED(thumbnailId);
+ Q_UNUSED(clientData);
+ Q_UNUSED(priority);
+ return 0;
+}
+
+int ThumbnailManager::setThumbnail( const QPixmap& source, const QString& filename,
+ void * clientData , Priority priority )
+{
+ Q_UNUSED(source);
+ Q_UNUSED(filename);
+ Q_UNUSED(clientData);
+ Q_UNUSED(priority);
+ return 0;
+}
+
+void ThumbnailManager::deleteThumbnails( const QString& fileName )
+{
+ Q_UNUSED(fileName);
+}
+
+void ThumbnailManager::deleteThumbnails( unsigned long int thumbnailId )
+{
+ Q_UNUSED(thumbnailId);
+}
+
+bool ThumbnailManager::cancelRequest( int id )
+{
+ if(mRequests.contains(id)) {
+ mRequests[id].cancelled = true;
+ }
+ return true;
+}
+
+bool ThumbnailManager::changePriority( int id, Priority newPriority )
+{
+ if(mRequests.contains(id)) {
+ mRequests[id].priority = newPriority;
+ }
+ return true;
+}
+
+void ThumbnailManager::emitThumbnailReady(int tnId )
+{
+ QPixmap pixmap(100,100);
+ pixmap.fill(Qt::white);
+ void* internal = 0;
+
+ if(mRequests.contains(tnId)) {
+ internal = mRequests[tnId].id;
+ mRequests.remove(tnId);
+ }
+
+ emit thumbnailReady(pixmap, internal, tnId, mThumbnailReadyError);
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackcontrolscontroller/testmpxvideoplaybackcontrolscontroller.pro Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,73 @@
+#
+# 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: Project file for building testmpxvideoplaybackcontrolscontroller
+#
+#
+# Version : %version: 1 %
+
+
+TEMPLATE = app
+TARGET = testmpxvideoplaybackcontrolscontroller
+CONFIG += qtestlib hb qt
+
+DEPENDPATH += . \
+ inc \
+ src
+
+INCLUDEPATH += stub/inc \
+ ../inc \
+ ../../inc \
+ ../../controlinc \
+ ../../../inc \
+ ../../../../inc \
+
+DEPENDPATH += stub/inc stub/src inc src
+
+# Input
+HEADERS += hbvideobaseplaybackview.h \
+ mpxvideoplaybackbuttonbar.h \
+ mpxvideoplaybackcontrolpolicy.h \
+ mpxvideoplaybackcontrolconfiguration.h \
+ mpxvideoplaybackdetailsplaybackwindow.h \
+ mpxvideoplaybackdocumentloader.h \
+ mpxvideoplaybackfiledetailswidget.h \
+ mpxvideoplaybackfullscreencontrol.h \
+ mpxvideoplaybacknontouchvolumebar.h \
+ mpxvideoplaybackprogressbar.h \
+ mpxvideoplaybackstatuspanecontrol.h \
+ mpxvideoplaybackviewfiledetails.h \
+ mpxvideoviewwrapper.h \
+ thumbnailmanager_qt.h \
+ testmpxvideoplaybackcontrolscontroller.h \
+ ../../inc/mpxvideoplaybackcontrolscontroller.h
+
+
+SOURCES += hbvideobaseplaybackview.cpp \
+ mpxvideoplaybackbuttonbar.cpp \
+ mpxvideoplaybackcontrolpolicy.cpp \
+ mpxvideoplaybackcontrolconfiguration.cpp \
+ mpxvideoplaybackdetailsplaybackwindow.cpp \
+ mpxvideoplaybackdocumentloader.cpp \
+ mpxvideoplaybackfiledetailswidget.cpp \
+ mpxvideoplaybackfullscreencontrol.cpp \
+ mpxvideoplaybacknontouchvolumebar.cpp \
+ mpxvideoplaybackprogressbar.cpp \
+ mpxvideoplaybackstatuspanecontrol.cpp \
+ mpxvideoplaybackviewfiledetails.cpp \
+ mpxvideoviewwrapper.cpp \
+ thumbnailmanager_qt.cpp \
+ testmpxvideoplaybackcontrolscontroller.cpp \
+ ../../controlsrc/mpxvideoplaybackcontrolscontroller.cpp
+
+
\ No newline at end of file
--- a/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackview/stub/src/mpxvideoviewwrapper.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackview/stub/src/mpxvideoviewwrapper.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 4 %
+// Version : %version: 5 %
@@ -93,7 +93,7 @@
//
void CMPXVideoViewWrapper::CreateGeneralPlaybackCommandL( int aCmd )
{
-
+ Q_UNUSED( aCmd );
}
// -------------------------------------------------------------------------------------------------
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/viewinc/mpxvideoplaybackdisplayhandler.h Thu Apr 01 23:22:15 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: Implementation of video playback display handler
+*
+*/
+
+// Version : %version: 8 %
+
+
+#ifndef __CMPXVIDEOPLAYBACKDISPLAYHANDLER_H__
+#define __CMPXVIDEOPLAYBACKDISPLAYHANDLER_H__
+
+// INCLUDES
+
+#include <mpxmessage2.h>
+#include <MMFScalingCustomCommandConstants.h>
+#include <mpxvideoplaybackdefs.h>
+#include <mediaclientvideodisplay.h>
+
+
+//
+// CLASS DECLARATION
+//
+class CMPXVideoContainer;
+class MMPXPlaybackUtility;
+class CMPXVideoViewWrapper;
+class QMPXVideoPlaybackViewFileDetails;
+
+/*
+ * CMPXVideoPlaybackDisplayHandler
+ *
+ */
+class CMPXVideoPlaybackDisplayHandler : public CBase
+{
+ //
+ // To save user's preference for scaling type in video ratio + screen ratio
+ //
+ typedef struct
+ {
+ TReal32 videoRatio;
+ TReal32 screenRatio;
+ TMMFScalingType scalingType;
+ } TMPXAspectRatio ;
+
+ public:
+
+ ~CMPXVideoPlaybackDisplayHandler();
+
+ static CMPXVideoPlaybackDisplayHandler* NewL( MMPXPlaybackUtility* aPlayUtil,
+ CMPXVideoViewWrapper* aViewWrapper );
+
+ void CreateDisplayWindowL( RWsSession& aWs,
+ CWsScreenDevice& aScreenDevice,
+ RWindow& aWin,
+ TRect aDisplayRect );
+
+ void RemoveDisplayWindow();
+
+ void HandleVideoDisplayMessageL( CMPXMessage* aMessage );
+
+ TInt SetAspectRatioL( TMPXVideoPlaybackCommand aCmd );
+
+ TInt SetDefaultAspectRatioL( QMPXVideoPlaybackViewFileDetails* aFileDetails,
+ TReal aDisplayAspectRatio );
+
+ void UpdateVideoRectL( TRect aRect, TBool transitionEffect );
+
+ private:
+
+ CMPXVideoPlaybackDisplayHandler( MMPXPlaybackUtility* aPlayUtil,
+ CMPXVideoViewWrapper* aViewWrapper );
+
+ void ConstructL();
+
+ void LoadAspectRatioL();
+
+ void SaveAspectRatioL();
+
+ void SetVideoRectL( TRect aClipRect );
+
+ void CalculateVideoRectL();
+
+ static TInt UpdateVideoRectTimeOutL( TAny* aPtr );
+
+ private:
+ void AddDisplayWindowL( CWsScreenDevice& aScreenDevice,
+ RWindowBase& aWindowBase,
+ RWindow* aWin );
+
+ void SurfaceCreatedL( CMPXMessage* aMessage );
+ void SurfaceChangedL( CMPXMessage* aMessage );
+ void SurfaceRemoved();
+ TInt SetNgaAspectRatioL( TMPXVideoPlaybackCommand aCmd );
+
+ private:
+ MMPXPlaybackUtility* iPlaybackUtility;
+
+ RArray<TMPXAspectRatio> iAspectRatioArray;
+ TInt iCurrentIndexForAspectRatio;
+ TReal iDisplayAspectRatio;
+
+ TRect iWindowRect;
+
+ TReal32 iTlXDiff;
+ TReal32 iTlYDiff;
+ TReal32 iBrXDiff;
+ TReal32 iBrYDiff;
+
+ TInt iTransitionEffectCnt;
+
+ CPeriodic* iResizingTimer;
+ CMPXVideoViewWrapper* iViewWrapper;
+
+ CMediaClientVideoDisplay* iVideoDisplay;
+
+ RWindowBase* iWindowBase;
+ TBool iSurfaceCached;
+ TSurfaceId iSurfaceId;
+ TRect iCropRect;
+ TVideoAspectRatio iAspectRatio;
+ TReal32 iScaleWidth;
+ TReal32 iScaleHeight;
+ TInt iHorizontalPosition;
+ TInt iVerticalPosition;
+ TVideoRotation iRotation;
+ TAutoScaleType iAutoScale;
+ CMPXVideoContainer* iVideoContainer;
+};
+
+#endif // __CMPXVIDEOPLAYBACKDISPLAYHANDLER_H__
--- a/videoplayback/hbvideoplaybackview/viewsrc/hbvideobaseplaybackview.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/hbvideoplaybackview/viewsrc/hbvideobaseplaybackview.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: da1mmcf#28 %
+// Version : %version: da1mmcf#30 %
@@ -23,8 +23,8 @@
-#include <qtimer>
-#include <qgraphicssceneevent>
+#include <QTimer>
+#include <QGraphicsSceneEvent>
#include <hbmenu.h>
#include <hbaction.h>
@@ -34,7 +34,7 @@
#include <textresolver.h>
#include <mmf/common/mmferrors.h>
-#include <drmhelper.h>
+#include <DRMHelper.h>
#include <mpxvideoplaybackdefs.h>
#include <mpxplaybackcommanddefs.h>
@@ -364,19 +364,6 @@
}
// -------------------------------------------------------------------------------------------------
-// HbVideoBasePlaybackView::closePlaybackView()
-// -------------------------------------------------------------------------------------------------
-//
-void HbVideoBasePlaybackView::paint( QPainter *painter,
- const QStyleOptionGraphicsItem *option,
- QWidget *widget )
-{
- Q_UNUSED( widget );
-
- painter->fillRect( option->exposedRect, Qt::black );
-}
-
-// -------------------------------------------------------------------------------------------------
// HbVideoBasePlaybackView::getWindow()
// -------------------------------------------------------------------------------------------------
//
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/viewsrc/mpxvideoplaybackuserinputhandler.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,619 @@
+/*
+* 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: Implementation of playback view's input handler
+*
+*/
+
+// Version : %version: 6 %
+
+
+// INCLUDE FILES
+#include <e32std.h>
+#include <w32std.h> // RWindowBase
+#include <e32base.h>
+#include <AknUtils.h>
+#include <eikclbd.h>
+#include <aknconsts.h>
+#include <remconcoreapi.h>
+#include <remconcoreapitarget.h>
+#include <remconinterfaceselector.h> // Side volume key
+#include <mpxplaybackframeworkdefs.h>
+#include <centralrepository.h> // for peripheral display timeout setting
+#include <settingsinternalcrkeys.h> // display timeout setting keys
+#include <hwrmlightdomaincrkeys.h>
+#include <mpxvideoplaybackdefs.h>
+
+#include <hal.h>
+#include <hal_data.h>
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoviewwrapper.h"
+#include "mpxcommonvideoplaybackview.hrh"
+#include "mpxvideoplaybackuserinputhandler.h"
+
+
+// CONSTANTS
+const TInt KMPXMicroSecondsInASecond = 1000000;
+
+
+// ======== MEMBER FUNCTIONS =======================================================================
+
+// -------------------------------------------------------------------------------------------------
+// MPXVideoPlaybackUserInputHandler::CMPXVideoPlaybackUserInputHandler()
+// -------------------------------------------------------------------------------------------------
+//
+CMPXVideoPlaybackUserInputHandler::CMPXVideoPlaybackUserInputHandler( CMPXVideoViewWrapper* aWrapper )
+ : iViewWrapper( aWrapper )
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::NewL()
+// -------------------------------------------------------------------------------------------------
+//
+CMPXVideoPlaybackUserInputHandler* CMPXVideoPlaybackUserInputHandler::NewL(
+ CMPXVideoViewWrapper* aWrapper, TBool aTvOutConnected )
+{
+ MPX_DEBUG(_L("CMPXVideoPlaybackUserInputHandler::NewL()"));
+
+ CMPXVideoPlaybackUserInputHandler* self =
+ new (ELeave) CMPXVideoPlaybackUserInputHandler( aWrapper );
+ CleanupStack::PushL( self );
+ self->ConstructL( aTvOutConnected );
+ CleanupStack::Pop();
+ return self;
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::ConstructL
+// Symbian 2nd phase constructor can leave.
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackUserInputHandler::ConstructL( TBool aTvOutConnected )
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::ConstructL()"));
+
+ iVolumeRepeatTimer = CPeriodic::NewL( CActive::EPriorityStandard );
+ iDisplayTimer = CPeriodic::NewL( CPeriodic::EPriorityStandard );
+ iInterfaceSelector = CRemConInterfaceSelector::NewL();
+ iCoreTarget = CRemConCoreApiTarget::NewL( *iInterfaceSelector, *this );
+
+ iTVOutConnected = aTvOutConnected;
+
+ // Start the timer if TV out is connected
+ if ( iTVOutConnected )
+ {
+ // Get the display light time-out value from CenRep
+ CRepository* repository = CRepository::NewLC( KCRUidLightSettings );
+
+ // What's the timeout value (in seconds ) for the display light?
+ repository->Get( KDisplayLightsTimeout, iDisplayTimeOut );
+ MPX_DEBUG(_L("CMPXVideoPlaybackUserInputHandler::ConstructL Display Timeout( %d )"), iDisplayTimeOut);
+
+ CleanupStack::PopAndDestroy( repository );
+
+ // Convert the timeout value to microseconds
+ iDisplayTimeOut *= KMPXMicroSecondsInASecond;
+
+ RestartDisplayTimer();
+ }
+
+ // not detrimental if Media Keys dont work - so ignore any errors here
+ TRAP_IGNORE( iInterfaceSelector->OpenTargetL() );
+
+ iProcessingInputType = EMpxVideoNone;
+ iForeground = ETrue;
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::~CMPXVideoPlaybackUserInputHandler()
+// -------------------------------------------------------------------------------------------------
+//
+CMPXVideoPlaybackUserInputHandler::~CMPXVideoPlaybackUserInputHandler()
+{
+ if ( iVolumeRepeatTimer )
+ {
+ iVolumeRepeatTimer->Cancel();
+ delete iVolumeRepeatTimer;
+ }
+
+ if ( iDisplayTimer )
+ {
+ iDisplayTimer->Cancel();
+ delete iDisplayTimer;
+ }
+
+ if ( iInterfaceSelector )
+ {
+ delete iInterfaceSelector;
+ iCoreTarget = NULL;
+ iInterfaceSelector = NULL;
+ }
+
+ // make sure that backlight enabled when
+ // the view updates or deactivates
+ EnableBacklight();
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::MrccatoPlay()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackUserInputHandler::MrccatoPlay( TRemConCoreApiPlaybackSpeed /*aSpeed*/,
+ TRemConCoreApiButtonAction aButtonAct )
+{
+ MPX_ENTER_EXIT(
+ _L("CMPXVideoPlaybackUserInputHandler::MrccatoPlay"),
+ _L("aButtonAct = %d"), aButtonAct );
+
+ ProcessMediaKey(ERemConCoreApiPlay, aButtonAct);
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::MrccatoCommand()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackUserInputHandler::MrccatoCommand(TRemConCoreApiOperationId aOperationId,
+ TRemConCoreApiButtonAction aButtonAct )
+{
+ MPX_ENTER_EXIT(
+ _L("CMPXVideoPlaybackUserInputHandler::MrccatoCommand"),
+ _L("aButtonAct = %d"), aButtonAct );
+
+ ProcessMediaKey(aOperationId, aButtonAct);
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::DoHandleMediaKey()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackUserInputHandler::DoHandleMediaKey( TRemConCoreApiOperationId aOperationId,
+ TRemConCoreApiButtonAction aButtonAct )
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::DoHandleMediaKey()"));
+
+ switch ( aOperationId )
+ {
+ case ERemConCoreApiStop:
+ {
+ if ( aButtonAct == ERemConCoreApiButtonClick )
+ {
+ TRAP_IGNORE(iViewWrapper->HandleCommandL( EMPXPbvCmdStop ));
+ }
+ break;
+ }
+ case ERemConCoreApiRewind:
+ {
+ HandleRewind(aButtonAct);
+ break;
+ }
+ case ERemConCoreApiFastForward:
+ {
+ HandleFastForward(aButtonAct);
+ break;
+ }
+ case ERemConCoreApiVolumeUp:
+ {
+ HandleVolumeUp(aButtonAct);
+ break;
+ }
+ case ERemConCoreApiVolumeDown:
+ {
+ HandleVolumeDown(aButtonAct);
+ break;
+ }
+ case ERemConCoreApiPausePlayFunction:
+ {
+ if ( aButtonAct == ERemConCoreApiButtonClick )
+ {
+ TRAP_IGNORE(iViewWrapper->HandleCommandL(EMPXPbvCmdPlayPause));
+ }
+ break;
+ }
+ case ERemConCoreApiPause:
+ {
+ TRAP_IGNORE(iViewWrapper->HandleCommandL(EMPXPbvCmdPause));
+ break;
+ }
+ case ERemConCoreApiPlay:
+ {
+ if ( aButtonAct == ERemConCoreApiButtonClick )
+ {
+ TRAP_IGNORE(iViewWrapper->HandleCommandL(EMPXPbvCmdPlay));
+ }
+ break;
+ }
+ default:
+ break;
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::HandleFastForward()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackUserInputHandler::HandleFastForward(TRemConCoreApiButtonAction aButtonAct)
+{
+ if (aButtonAct == ERemConCoreApiButtonPress)
+ {
+ TRAP_IGNORE(iViewWrapper->HandleCommandL(EMPXPbvCmdSeekForward));
+ }
+ else if (aButtonAct == ERemConCoreApiButtonRelease)
+ {
+ TRAP_IGNORE(iViewWrapper->HandleCommandL(EMPXPbvCmdEndSeek));
+ }
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::HandleRewind()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackUserInputHandler::HandleRewind(TRemConCoreApiButtonAction aButtonAct)
+{
+ if (aButtonAct == ERemConCoreApiButtonPress)
+ {
+ TRAP_IGNORE(iViewWrapper->HandleCommandL(EMPXPbvCmdSeekBackward));
+ }
+ else if (aButtonAct == ERemConCoreApiButtonRelease)
+ {
+ TRAP_IGNORE(iViewWrapper->HandleCommandL(EMPXPbvCmdEndSeek));
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::HandleVolumeUp()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackUserInputHandler::HandleVolumeUp(TRemConCoreApiButtonAction aButtonAct)
+{
+ switch ( aButtonAct )
+ {
+ case ERemConCoreApiButtonPress:
+ {
+ // Volume Up - Pressed
+ if ( iVolumeRepeatTimer->IsActive() )
+ {
+ iVolumeRepeatTimer->Cancel();
+ }
+
+ iVolumeRepeatUp = ETrue;
+ iVolumeRepeatTimer->Start(
+ KAknStandardKeyboardRepeatRate,
+ KAknStandardKeyboardRepeatRate,
+ TCallBack(
+ CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL,
+ this ) );
+
+ break;
+ }
+ case ERemConCoreApiButtonRelease:
+ {
+ // Volume Up - Released
+ iVolumeRepeatTimer->Cancel();
+ break;
+ }
+ case ERemConCoreApiButtonClick:
+ {
+ // Volume Up - Clicked
+ TRAP_IGNORE( iViewWrapper->HandleCommandL( EMPXPbvCmdIncreaseVolume ) );
+ break;
+ }
+ }
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::HandleVolumeDown()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackUserInputHandler::HandleVolumeDown(TRemConCoreApiButtonAction aButtonAct)
+{
+ switch ( aButtonAct )
+ {
+ case ERemConCoreApiButtonPress:
+ {
+ // Volume Up - Pressed
+ if ( iVolumeRepeatTimer->IsActive() )
+ {
+ iVolumeRepeatTimer->Cancel();
+ }
+
+ iVolumeRepeatUp = EFalse;
+ iVolumeRepeatTimer->Start(
+ KAknStandardKeyboardRepeatRate,
+ KAknStandardKeyboardRepeatRate,
+ TCallBack(
+ CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL,
+ this ) );
+
+ break;
+ }
+ case ERemConCoreApiButtonRelease:
+ {
+ // Volume Up - Released
+ iVolumeRepeatTimer->Cancel();
+ break;
+ }
+ case ERemConCoreApiButtonClick:
+ {
+ // Volume Down - Clicked
+ TRAP_IGNORE( iViewWrapper->HandleCommandL( EMPXPbvCmdDecreaseVolume ) );
+ break;
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::ProcessKeyEvent()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackUserInputHandler::ProcessKeyEventL( const TKeyEvent& /*aKeyEvent*/,
+ TEventCode /*aType*/ )
+{
+ MPX_DEBUG(_L("MPXVideoPlaybackUserInputHandler::ProcessKeyEvent"));
+
+ /*
+ switch (iProcessingInputType)
+ {
+ case EMpxVideoNone:
+ {
+ if (aType == EEventKeyDown && iForeground)
+ {
+ iProcessingInputType = EMpxVideoKeyboard;
+ iLastPressedKeyCode = aKeyEvent.iCode;
+ iLastPressedKeyScanCode = aKeyEvent.iScanCode;
+ if ( iTVOutConnected )
+ {
+ RestartDisplayTimer();
+ }
+ iViewWrapper->DoHandleKeyEventL( aKeyEvent, aType );
+ }
+ break;
+ }
+ case EMpxVideoKeyboard:
+ {
+ if (aType == EEventKeyUp)
+ {
+ // only handle up event for the key being handled
+ // ignore spurious key presses
+ if (aKeyEvent.iCode == iLastPressedKeyCode &&
+ aKeyEvent.iScanCode == iLastPressedKeyScanCode)
+ {
+ iViewWrapper->DoHandleKeyEventL( aKeyEvent, aType );
+
+ // reset the value only on key up event
+ iProcessingInputType = EMpxVideoNone;
+ }
+ }
+ break;
+ }
+ default:
+ {
+ // user input is disallowed
+ break;
+ }
+ } // switch*/
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::ProcessMediaKey()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackUserInputHandler::ProcessMediaKey(TRemConCoreApiOperationId aOperationId,
+ TRemConCoreApiButtonAction aButtonAct)
+{
+ MPX_DEBUG(_L("CMPXVideoPlaybackUserInputHandler::ProcessMediaKey"));
+
+ switch (iProcessingInputType)
+ {
+ case EMpxVideoNone:
+ {
+ if (aButtonAct == ERemConCoreApiButtonPress && iForeground)
+ {
+ iProcessingInputType = EMpxVideoMediaKeys;
+ iLastMediaKeyPressed = aOperationId;
+ DoHandleMediaKey(aOperationId, aButtonAct);
+ if ( iTVOutConnected )
+ {
+ RestartDisplayTimer();
+ }
+ }
+ else if (aButtonAct == ERemConCoreApiButtonClick && iForeground)
+ {
+ DoHandleMediaKey(aOperationId, aButtonAct);
+ if ( iTVOutConnected )
+ {
+ RestartDisplayTimer();
+ }
+ // reset on click AND/OR release
+ iProcessingInputType = EMpxVideoNone;
+ }
+ break;
+ }
+ case EMpxVideoMediaKeys:
+ {
+ if (aButtonAct == ERemConCoreApiButtonRelease)
+ {
+ // handle only if this release is for media-key being currently handled
+ // ignore spurious media key presses
+ if (iLastMediaKeyPressed == aOperationId)
+ {
+ DoHandleMediaKey(aOperationId, aButtonAct);
+ // reset on click AND/OR release
+ iProcessingInputType = EMpxVideoNone;
+ }
+ }
+ break;
+ }
+ default:
+ {
+ // user input is disallowed
+ break;
+ }
+ } // switch
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL()
+// -------------------------------------------------------------------------------------------------
+//
+TInt CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL( TAny* aPtr )
+{
+ MPX_DEBUG(_L("CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatTimeoutL()"));
+
+ static_cast<CMPXVideoPlaybackUserInputHandler*>(aPtr)->HandleVolumeRepeatL();
+
+ return KErrNone;
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatL()
+{
+ MPX_DEBUG(_L("CMPXVideoPlaybackUserInputHandler::HandleVolumeRepeatL()"));
+
+ TMPXVideoPlaybackViewCommandIds command = EMPXPbvCmdDecreaseVolume;
+
+ if ( iVolumeRepeatUp )
+ {
+ command = EMPXPbvCmdIncreaseVolume;
+ }
+
+ iViewWrapper->HandleCommandL( command );
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::SetForeground()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackUserInputHandler::SetForeground(TBool aForeground)
+{
+ iForeground = aForeground;
+
+ if ( !iForeground )
+ {
+ // we are in background so reset iProcessingInputType value
+ iProcessingInputType = EMpxVideoNone;
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::DisableBacklight()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackUserInputHandler::DisableBacklight()
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::DisableBacklight"));
+
+ // cancel the timer
+ iDisplayTimer->Cancel();
+
+ // disable the backlight
+ HAL::Set( HALData::EBacklightState, 0 );
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::EnableBacklight()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackUserInputHandler::EnableBacklight()
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::EnableBacklight"));
+
+ // enable the backlight
+ HAL::Set( HALData::EBacklightState, 1 );
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::HandleTVOutEvent()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackUserInputHandler::HandleTVOutEventL(TBool aTVOutConnected)
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::HandleTVOutEvent"));
+
+ iTVOutConnected = aTVOutConnected;
+
+ if ( iTVOutConnected )
+ {
+ // Get the display light time-out value from CenRep
+ CRepository* repository = CRepository::NewLC( KCRUidLightSettings );
+
+ // What's the timeout value (in seconds ) for the display light?
+ repository->Get( KDisplayLightsTimeout, iDisplayTimeOut );
+ MPX_DEBUG(_L("CMPXVideoPlaybackUserInputHandler::ConstructL Display Timeout( %d )"), iDisplayTimeOut);
+
+ CleanupStack::PopAndDestroy( repository );
+
+ // Convert the timeout value to microseconds
+ iDisplayTimeOut *= KMPXMicroSecondsInASecond;
+
+ RestartDisplayTimer();
+ }
+ else
+ {
+ iDisplayTimer->Cancel();
+ EnableBacklight();
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::HandleDisplayTimeout
+// -------------------------------------------------------------------------------------------------
+//
+TInt CMPXVideoPlaybackUserInputHandler::HandleDisplayTimeout( TAny* aPtr )
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::HandleDisplayTimeout"));
+
+ static_cast<CMPXVideoPlaybackUserInputHandler*>(aPtr)->DisableBacklight();
+
+ return KErrNone;
+}
+
+// -----------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::RestartDisplayTimer
+// -----------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackUserInputHandler::RestartDisplayTimer()
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackUserInputHandler::RestartDisplayTimer"));
+
+ // check if the display timer is running if so cancelit
+ if ( iDisplayTimer->IsActive() )
+ {
+ iDisplayTimer->Cancel();
+ }
+ else
+ {
+ // timeout has happened and the backlight is disabled
+ // enable the backlight
+ HAL::Set( HALData::EBacklightState, 1 );
+ }
+
+ TBool backlightState;
+ TInt ret = HAL::Get( HALData::EBacklightState, backlightState );
+
+ // Re start the display backlight timer
+ iDisplayTimer->Start( iDisplayTimeOut, iDisplayTimeOut,
+ TCallBack( CMPXVideoPlaybackUserInputHandler::HandleDisplayTimeout, this ) );
+}
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackviewplugin/inc/mpxhbvideoplaybackviewplugin.h Thu Apr 01 23:22:15 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: QMpxHbVideoPlaybackViewPlugin
+*
+*/
+
+// Version : %version: 6 %
+
+
+#ifndef QMPXHBVIDEOPLAYBACKVIEWPLUGIN_H
+#define QMPXHBVIDEOPLAYBACKVIEWPLUGIN_H
+
+#include <QObject>
+#include <mpxviewpluginqt.h>
+
+
+// FORWARD DECLARATION
+class HbVideoPlaybackView;
+
+/**
+ * MPX playback view plugin definition.
+ *
+ */
+class QMpxHbVideoPlaybackViewPlugin : public MpxViewPlugin
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * C++ default constructor.
+ */
+ QMpxHbVideoPlaybackViewPlugin();
+
+ /**
+ * Destructor.
+ *
+ */
+ virtual ~QMpxHbVideoPlaybackViewPlugin();
+
+ // from QViewPlugin
+
+ void createView();
+
+ void destroyView();
+
+ void activateView();
+
+ void deactivateView();
+
+ QGraphicsWidget* getView();
+
+signals:
+ void command( int aCommand );
+
+public slots:
+ void orientationChange(Qt::Orientation orientation);
+
+ void back();
+
+public:
+ HbVideoPlaybackView* mView;
+ bool mViewActivated;
+
+};
+
+
+#endif //QMPXHBVIDEOPLAYBACKVIEWPLUGIN_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackviewplugin/src/mpxhbvideoplaybackviewplugin.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,139 @@
+/*
+* 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: QMpxHbVideoPlaybackViewPlugin
+*
+*/
+
+// Version : %version: 6 %
+
+
+
+#include <QtGui>
+#include <hbview.h>
+#include <xqplugin.h>
+#include <hbinstance.h>
+
+#include "mpxvideo_debug.h"
+#include "hbvideoplaybackview.h"
+#include "mpxhbvideocommondefs.h"
+#include "mpxhbvideoplaybackviewplugin.h"
+
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+QMpxHbVideoPlaybackViewPlugin::QMpxHbVideoPlaybackViewPlugin()
+ : mView( NULL )
+ , mViewActivated ( false )
+{
+ MPX_ENTER_EXIT(_L("QMpxHbVideoPlaybackViewPlugin::QMpxHbVideoPlaybackViewPlugin()"));
+}
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+QMpxHbVideoPlaybackViewPlugin::~QMpxHbVideoPlaybackViewPlugin()
+{
+ MPX_ENTER_EXIT(_L("QMpxHbVideoPlaybackViewPlugin::~QMpxHbVideoPlaybackViewPlugin()"));
+ destroyView();
+}
+
+// ---------------------------------------------------------------------------
+// Create view
+// ---------------------------------------------------------------------------
+//
+void QMpxHbVideoPlaybackViewPlugin::createView()
+{
+ MPX_ENTER_EXIT(_L("QMpxHbVideoPlaybackViewPlugin::createView()"));
+
+ mView = new HbVideoPlaybackView();
+ connect( mView, SIGNAL( activatePreviousView() ), this, SLOT( back() ) );
+}
+
+// ---------------------------------------------------------------------------
+// Destroy view
+// ---------------------------------------------------------------------------
+//
+void QMpxHbVideoPlaybackViewPlugin::destroyView()
+{
+ MPX_ENTER_EXIT(_L("QMpxHbVideoPlaybackViewPlugin::destroyView()"));
+
+ if ( mView )
+ {
+ delete mView;
+ mView = NULL;
+ }
+}
+
+// ---------------------------------------------------------------------------
+// Activate view
+// ---------------------------------------------------------------------------
+//
+void QMpxHbVideoPlaybackViewPlugin::activateView()
+{
+ MPX_ENTER_EXIT(_L("QMpxHbVideoPlaybackViewPlugin::activateView()"));
+
+ if ( mView && !mViewActivated )
+ {
+ mView->handleActivateView();
+ mViewActivated = true;
+ }
+}
+
+// ---------------------------------------------------------------------------
+// Deactivate view
+// ---------------------------------------------------------------------------
+//
+void QMpxHbVideoPlaybackViewPlugin::deactivateView()
+{
+ MPX_ENTER_EXIT(_L("QMpxHbVideoPlaybackViewPlugin::deactivateView()"));
+
+ mView->handleDeactivateView();
+ mViewActivated = false;
+}
+
+// ---------------------------------------------------------------------------
+// Get view
+// ---------------------------------------------------------------------------
+//
+QGraphicsWidget* QMpxHbVideoPlaybackViewPlugin::getView()
+{
+ return mView;
+}
+
+// ---------------------------------------------------------------------------
+// QMpxHbVideoPlaybackViewPlugin::orientationChange
+// ---------------------------------------------------------------------------
+//
+void QMpxHbVideoPlaybackViewPlugin::orientationChange( Qt::Orientation orientation )
+{
+ Q_UNUSED( orientation );
+}
+
+// ---------------------------------------------------------------------------
+// QMpxHbVideoPlaybackViewPlugin::back
+// ---------------------------------------------------------------------------
+//
+void QMpxHbVideoPlaybackViewPlugin::back()
+{
+ MPX_ENTER_EXIT(_L("QMpxHbVideoPlaybackViewPlugin::back()"));
+
+ emit command( MpxHbVideoCommon::CollectionView );
+}
+
+XQ_EXPORT_PLUGIN2( hbvideoplaybackviewplugin, QMpxHbVideoPlaybackViewPlugin );
+
+// End of File
--- a/videoplayback/inc/hbvideobaseplaybackview.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/inc/hbvideobaseplaybackview.h Thu Apr 01 23:22:15 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: da1mmcf#11 %
+// Version : %version: da1mmcf#12 %
@@ -92,10 +92,6 @@
bool event( QEvent *event );
- void paint( QPainter *painter,
- const QStyleOptionGraphicsItem *option,
- QWidget *widget );
-
RWindow *getWindow();
protected:
--- a/videoplayback/inc/mpxcommonvideoplaybackview.hrh Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/inc/mpxcommonvideoplaybackview.hrh Thu Apr 01 23:22:15 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 9 %
+// Version : %version: 10 %
#ifndef MPXCOMMONVIDEOPLAYBACKVIEW_HRH
@@ -57,7 +57,9 @@
EMPXPbvCmdCustomPlay,
EMPXPbvCmdExit,
EMPXPbvLaunchDRMDetails,
- EMPXPbvSurfaceCreated
+ EMPXPbvSurfaceCreated,
+ EMPXPbvSurfaceRemoved,
+ EMPXPbvCmdRealOneBitmapTimeout
};
#endif // MPXCOMMONVIDEOPLAYBACKVIEW_HRH
--- a/videoplayback/videohelix/group/mpxvideohelixplayback.mmp Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/videohelix/group/mpxvideohelixplayback.mmp Thu Apr 01 23:22:15 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 13 %
+// Version : %version: ou1cpsw#14 %
@@ -74,6 +74,8 @@
LIBRARY drmutility.lib
LIBRARY caf.lib
LIBRARY mmcommon.lib
+LIBRARY hwrmlightclient.lib // Lights control
+LIBRARY centralrepository.lib // For display backlight timeout value
#ifdef __ACCESSORY_FW
LIBRARY accclient.lib
--- a/videoplayback/videohelix/inc/mpxvideodlmgrif.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/videohelix/inc/mpxvideodlmgrif.h Thu Apr 01 23:22:15 2010 +0300
@@ -15,13 +15,13 @@
*
*/
-// Version : %version: 9 %
+// Version : %version: 10 %
#ifndef __MPXVIDEODLMGRIF_H__
#define __MPXVIDEODLMGRIF_H__
-#include <downloadmgrclientapiext.h>
+#include <DownloadMgrClientApiExt.h>
#include <mpxplaybackcommanddefs.h>
//
--- a/videoplayback/videohelix/inc/mpxvideohelixplayback.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/videohelix/inc/mpxvideohelixplayback.h Thu Apr 01 23:22:15 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 8 %
+// Version : %version: 10 %
@@ -162,8 +162,9 @@
* @param aUri URI of the item
* @param aType the mime type of the item
* @param aAccessPoint the access point
+ * @param aPosition the starting position
*/
- void InitStreamingL(const TDesC& aUri, const TDesC8& aType, TInt aAccessPoint);
+ void InitStreamingL(const TDesC& aUri, const TDesC8& aType, TInt aAccessPoint, TInt aPosition);
/**
* Initializes a file handle for playback.
@@ -171,8 +172,9 @@
* @since S60 9.2
* @param aFile file handle of a file
* @param aAccessPoint the access point
+ * @param aPosition the starting position
*/
- void InitStreamingL(RFile& aFile, TInt aAccessPoint);
+ void InitStreamingL(RFile& aFile, TInt aAccessPoint, TInt aPosition);
/**
* Initializes filename and handle
@@ -181,7 +183,7 @@
* @param aUri URI of the item
*/
RFile& OpenFileHandleL( const TDesC& aUri );
-
+
/**
* Open file handle
*
@@ -192,20 +194,21 @@
void OpenFileHandleL( const TDesC& aUri, RFile& aFile );
/**
- * Handle open file handle
+ * Checks if the Uri is a streaming link
*
* @since S60 9.2
- * @param aError open file error
+ * @param aUri URL or file name
*/
- void HandleOpenFileHandleL( TInt aError );
-
+ void CheckForStreamingUrlL( const TDesC& aUri );
+
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
/*
* Initializes a song for playback
* @param aFile RFile64 of a song
+ * @param aPosition the starting position
*/
- void Initialise64L( RFile64& aFile );
+ void Initialise64L( RFile64& aFile, TInt aPosition );
/**
* Initializes a file handle for playback.
@@ -213,8 +216,9 @@
* @since S60 9.2
* @param aFile RFile64 of a file
* @param aAccessPoint the access point
+ * @param aPosition the starting position
*/
- void InitStreaming64L(RFile64& aFile, TInt aAccessPoint);
+ void InitStreaming64L( RFile64& aFile, TInt aAccessPoint, TInt aPosition );
/**
* Initializes filename and handle
@@ -232,8 +236,27 @@
* @param aFile a 64-bit file handle
*/
void OpenFileHandle64L( const TDesC& aUri, RFile64& aFile );
-
-#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
+
+#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
+
+
+ /*
+ * Initializes a clip for playback
+ * @since S60 9.2
+ *
+ * @param aSong the song path,
+ * @param aPosition the starting position
+ */
+ void InitialiseWithPositionL( const TDesC& aSong, TInt aPosition = 0 );
+
+ /**
+ * Initializes a song for playback.
+ *
+ * @since S60 9.2
+ * @param aFile file handle of a song
+ * @param aPosition the starting position
+ */
+ void InitialiseWithPositionL(RFile& aSong, TInt aPosition = 0 );
private:
@@ -247,7 +270,7 @@
* that can leave
*/
void ConstructL();
-
+
private:
//
// Data
--- a/videoplayback/videohelix/inc/mpxvideoplaybackcontroller.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/videohelix/inc/mpxvideoplaybackcontroller.h Thu Apr 01 23:22:15 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 18 %
+// Version : %version: ou1cpsw#21 %
#ifndef _CMPXVIDEOPLAYBACKCONTROLLER_H_
@@ -51,7 +51,7 @@
class CMediaRecognizer;
class CMPXVideoSeeker;
class CMpxVideoDrmHelper;
-
+class CHWRMLight;
//
// CLASS DECLARATION
//
@@ -94,7 +94,7 @@
void HandleSettingChange( const TUid& aRepositoryUid,
TUint32 aSettingId );
- void OpenFileL( const TDesC& aMediaFile, RFile& aFile, TInt aAccessPointId = -1 );
+ void OpenFileL( const TDesC& aMediaFile, RFile& aFile, TInt aPosition, TInt aAccessPointId = KUseDefaultIap );
void HandleGeneralPlaybackCommandL( CMPXCommand& aCmd );
@@ -117,7 +117,7 @@
void SetPlaybackModeL();
- TBool IsDisplayOff();
+ TBool IsKeyLocked();
TBool IsAlarm();
TBool IsPhoneCall();
TBool IsActivePhoneCall();
@@ -125,16 +125,15 @@
TBool IsVoiceCall();
void HandleTvOutEventL( TBool aConnected );
- static TInt HandleBackLightTimout( TAny* aPtr );
- void DoHandleBackLightTimout();
- void StartBackLightTimer();
- void CancelBackLightTimer();
+
void HandleError(TInt error);
void SetVolumeSteps( TInt aVolumeSteps );
void HandleVolumeL( TBool aIncrease );
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
- void OpenFile64L( const TDesC& aMediaFile, RFile64& aFile, TInt aAccessPointId = -1 );
+
+ void OpenFile64L( const TDesC& aMediaFile, RFile64& aFile, TInt aPosition, TInt aAccessPointId = KUseDefaultIap );
+
#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
@@ -144,7 +143,7 @@
void RestartDSA( CMPXCommand& aCmd );
inline void AbortDSA();
- void InitVolumeWatchers();
+ void InitVolumeWatchersL();
void ChangeState(TMPXVideoPlaybackState aChangeToState);
@@ -156,6 +155,32 @@
void DetermineMediaTypeL();
void ResetMemberVariables();
+
+ void StartLightsControl();
+ void CancelLightsControl();
+
+ void EnableDisplayBacklight();
+ void DisableDisplayBacklight();
+
+ static TInt HandleBackLightTimeout( TAny* aPtr );
+ void DoHandleBackLightTimeout();
+ void StartBackLightTimer();
+ void CancelBackLightTimer();
+
+ void InitUserActivityTimerL();
+ void RestartUserActivityTimer();
+ void CancelUserActivityTimer();
+ static TInt HandleUserActivityTimeout( TAny* aPtr );
+ void DoHandleUserActivityTimeout();
+
+ TTimeIntervalMicroSeconds32 InitDisplayTimerL();
+ void RestartDisplayTimer();
+ void CancelDisplayTimer();
+ static TInt HandleDisplayTimeout( TAny* aPtr );
+ void DoHandleDisplayTimeout();
+
+ CHWRMLight* GetLightsL();
+ void ReleaseLights();
protected:
@@ -217,10 +242,23 @@
// Video seeker
CMPXVideoSeeker* iVideoSeeker;
- CPeriodic* iBackLightTimer;
+ // Timer for calling User::ResetInactivityTime() periodicallly while playing.
+ // This keeps backligth on and screensaver off.
+ CPeriodic* iBackLightTimer;
+
+ // Timer to turn display lights off when playing to TV-out
+ CPeriodic* iDisplayTimer;
+ TTimeIntervalMicroSeconds32 iDisplayTimerTimeout;
+ // Timer monitoring user activity when TV-out is connected
+ CPeriodic* iUserActivityTimer;
+
+
TBool iSeekable;
CMpxVideoDrmHelper* iDrmHelper;
+ CHWRMLight* iLight;
+ TInt iLightStatus;
+ TInt iSavedPosition;
public: // Friend classes
--- a/videoplayback/videohelix/inc/mpxvideoplayerutility.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/videohelix/inc/mpxvideoplayerutility.h Thu Apr 01 23:22:15 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 9 %
+// Version : %version: 10 %
#ifndef __MPXVIDEOPLAYERUTILITY__
@@ -123,6 +123,8 @@
const TSurfaceId& aSurfaceId,
const TRect& aCropRect,
TVideoAspectRatio aAspectRatio );
+
+ void SurfaceRemovedFromView();
#endif
--- a/videoplayback/videohelix/src/mpxvideodlmgrif.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/videohelix/src/mpxvideodlmgrif.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -15,6 +15,7 @@
*
*/
+
// Version : %version: 23 %
@@ -501,6 +502,7 @@
//
// Notify the player and the UI view that the download is complete
//
+ HandleCustomCommand( EMMFROPControllerSetDownloadSize, iDlTotalSize );
HandleCustomCommand( EMMFROPControllerSetDownloadComplete, ETrue );
}
--- a/videoplayback/videohelix/src/mpxvideohelixplayback.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/videohelix/src/mpxvideohelixplayback.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 11 %
+// Version : %version: 14 %
//
@@ -114,7 +114,11 @@
}
TInt err = aFile.Open( iFs, aUri, EFileRead | EFileShareReadersOrWriters );
- HandleOpenFileHandleL( err );
+
+ if ( err != KErrNone )
+ {
+ CheckForStreamingUrlL( aUri );
+ }
}
// ----------------------------------------------------------------------------
@@ -124,7 +128,20 @@
void CMPXVideoHelixPlayback::InitialiseL( const TDesC& aSong )
{
MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::InitialiseL()"),
- _L("aSong %S"), &aSong );
+ _L("aSong %S"), &aSong );
+
+ InitialiseWithPositionL( aSong );
+}
+
+
+// ----------------------------------------------------------------------------
+// Initializes a clip for playback from a file name with position
+// ----------------------------------------------------------------------------
+//
+void CMPXVideoHelixPlayback::InitialiseWithPositionL( const TDesC& aSong, TInt aPosition )
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::InitialiseL()"),
+ _L("aSong %S, aPosition %d"), &aSong, aPosition );
RFile fileHandle;
@@ -134,17 +151,17 @@
if ( err == KErrNone )
{
- iVideoPlaybackCtlr->OpenFileL( aSong, fileHandle );
+ iVideoPlaybackCtlr->OpenFileL( aSong, fileHandle, aPosition );
}
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
else if ( err == KErrTooBig )
{
- //
+ //
// use RFile64 handle
//
RFile64 fileHandle64;
CleanupClosePushL( fileHandle64 );
-
+
MPX_TRAPD( err, OpenFileHandle64L( aSong, fileHandle64 ));
if ( err != KErrNone )
@@ -154,18 +171,18 @@
}
else
{
- iVideoPlaybackCtlr->OpenFile64L( aSong, fileHandle64 );
+ iVideoPlaybackCtlr->OpenFile64L( aSong, fileHandle64, aPosition );
}
-
- CleanupStack::PopAndDestroy(); // fileHandle64
+
+ CleanupStack::PopAndDestroy(); // fileHandle64
}
#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
else
{
// Handle error
- iVideoPlaybackCtlr->HandleError( err );
+ iVideoPlaybackCtlr->HandleError( err );
}
-
+
CleanupStack::PopAndDestroy(); // fileHandle
}
@@ -176,11 +193,23 @@
void CMPXVideoHelixPlayback::InitialiseL( RFile& aSong )
{
MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::InitialiseL( RFile )"));
+
+ InitialiseWithPositionL( aSong );
+}
+// ----------------------------------------------------------------------------
+// Initializes a clip for playback from a file handle with position
+// ----------------------------------------------------------------------------
+//
+void CMPXVideoHelixPlayback::InitialiseWithPositionL( RFile& aSong, TInt aPosition )
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::InitialiseWithPositionL( RFile )"),
+ _L("aPosition %d"), aPosition );
+
TFileName filename;
aSong.FullName( filename );
- iVideoPlaybackCtlr->OpenFileL( filename, aSong );
+ iVideoPlaybackCtlr->OpenFileL( filename, aSong, aPosition );
}
@@ -190,10 +219,11 @@
//
void CMPXVideoHelixPlayback::InitStreamingL( const TDesC& aUri,
const TDesC8& /*aType*/,
- TInt aAccessPoint )
+ TInt aAccessPoint,
+ TInt aPosition )
{
MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::InitStreamingL()"),
- _L("aUri %S, aType %d"), &aUri, aAccessPoint );
+ _L("aUri %S, aAccessPoint %d, aPosition %d"), &aUri, aAccessPoint, aPosition );
RFile fileHandle;
@@ -208,7 +238,7 @@
}
else
{
- iVideoPlaybackCtlr->OpenFileL( aUri, fileHandle, aAccessPoint );
+ iVideoPlaybackCtlr->OpenFileL( aUri, fileHandle, aPosition, aAccessPoint );
}
CleanupStack::PopAndDestroy();
@@ -218,14 +248,15 @@
// Initializes a clip for playback from a file handle
// ----------------------------------------------------------------------------
//
-void CMPXVideoHelixPlayback::InitStreamingL( RFile& aFile, TInt aAccessPoint )
+void CMPXVideoHelixPlayback::InitStreamingL( RFile& aFile, TInt aAccessPoint, TInt aPosition )
{
- MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::InitStreamingL( RFile )"));
+ MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::InitStreamingL( RFile )"),
+ _L("aAccessPoint = %d, aPosition = %d"), aAccessPoint, aPosition );
TFileName filename;
aFile.FullName( filename );
- iVideoPlaybackCtlr->OpenFileL( filename, aFile, aAccessPoint );
+ iVideoPlaybackCtlr->OpenFileL( filename, aFile, aPosition, aAccessPoint );
}
// ----------------------------------------------------------------------------
@@ -315,34 +346,23 @@
MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::CancelRequest()"));
}
-// ----------------------------------------------------------------------------
-// Handle Open File Handle
-// ----------------------------------------------------------------------------
+// ------------------------------------------------------------------------------------------------
+// CMPXVideoHelixPlayback::CheckForStreamingUrlL()
+// ------------------------------------------------------------------------------------------------
//
-void CMPXVideoHelixPlayback::HandleOpenFileHandleL( TInt aError )
+void CMPXVideoHelixPlayback::CheckForStreamingUrlL( const TDesC& aUri )
{
- MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::HandleOpenFileHandleL()"));
-
- //
- // Remap KErrNotReady to KErrNotFound, because it is referencing a drive
- // that is not existent
- //
- if ( aError == KErrNotReady )
+ MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::CMPXVideoHelixPlayback::CheckForStreamingUrlL()"));
+
+ CMediaRecognizer* recognizer = CMediaRecognizer::NewL();
+ CleanupStack::PushL( recognizer );
+
+ if ( ! recognizer->IsValidStreamingPrefix( aUri ) )
{
- aError = KErrNotFound;
+ User::LeaveIfError( KErrNotFound );
}
-
- MPX_DEBUG(_L("CMPXVideoHelixPlayback::HandleOpenFileHandleL() Open error = %d"), aError);
-
- //
- // if aSong is an streaming link and contains one of the streaming schemas
- // eg. rtsp:// , http:// etc. then a file handle can not be opened
- // ignore KErrBadName
- //
- if ( aError != KErrBadName )
- {
- User::LeaveIfError( aError );
- }
+
+ CleanupStack::PopAndDestroy( recognizer );
}
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
@@ -363,35 +383,40 @@
}
TInt err = aFile.Open( iFs, aUri, EFileRead | EFileShareReadersOrWriters );
- HandleOpenFileHandleL( err );
+
+ if ( err != KErrNone )
+ {
+ CheckForStreamingUrlL( aUri );
+ }
}
// ----------------------------------------------------------------------------
// Initializes a clip for playback from a 64-bit file handle
// ----------------------------------------------------------------------------
//
-void CMPXVideoHelixPlayback::Initialise64L( RFile64& aSong )
+void CMPXVideoHelixPlayback::Initialise64L( RFile64& aSong, TInt aPosition )
{
- MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::Initialise64L( RFile64 )"));
-
+ MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::Initialise64L( RFile64 )"),
+ _L("aPosition %d"), aPosition );
TFileName filename;
aSong.FullName( filename );
- iVideoPlaybackCtlr->OpenFile64L( filename, aSong );
+ iVideoPlaybackCtlr->OpenFile64L( filename, aSong, aPosition );
}
// ----------------------------------------------------------------------------
// Initializes a clip for playback from a 64-bit file handle
// ----------------------------------------------------------------------------
//
-void CMPXVideoHelixPlayback::InitStreaming64L( RFile64& aFile, TInt aAccessPoint )
+void CMPXVideoHelixPlayback::InitStreaming64L( RFile64& aFile, TInt aAccessPoint, TInt aPosition )
{
- MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::InitStreaming64L( RFile64 )"));
+ MPX_ENTER_EXIT(_L("CMPXVideoHelixPlayback::InitStreaming64L( RFile64 )"),
+ _L("aAccessPoint = %d, aPosition %d"), aAccessPoint, aPosition );
TFileName filename;
aFile.FullName( filename );
- iVideoPlaybackCtlr->OpenFile64L( filename, aFile, aAccessPoint );
+ iVideoPlaybackCtlr->OpenFile64L( filename, aFile, aPosition, aAccessPoint );
}
#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
--- a/videoplayback/videohelix/src/mpxvideoplaybackcontroller.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/videohelix/src/mpxvideoplaybackcontroller.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 43 %
+// Version : %version: ou1cpsw#49 %
//
@@ -38,10 +38,12 @@
#include <ctsydomainpskeys.h>
#include <mmf/common/mmferrors.h>
-#include <hal.h>
-#include <hal_data.h>
#include <e32std.h>
#include <devsoundif.h>
+#include <avkondomainpskeys.h>
+#include <hwrmlight.h>
+#include <centralrepository.h> // For display timeout setting
+#include <hwrmlightdomaincrkeys.h>
#include "mpxvideoregion.h"
#include "mpxvideoplaybackcontroller.h"
@@ -62,7 +64,9 @@
//
// Backlight Timeout in Micro Seconds
//
-#define KMPXBackLightTimeOut 3500000
+const TInt KMPXBackLightTimeOut = 3500000;
+const TInt KMPXInactivityTimeout = 3 * KMPXBackLightTimeOut;
+const TInt KMPXMicroSecondsInASecond = 1000000;
#define KOneKilobyte 1024
@@ -145,13 +149,13 @@
MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::ConstructL()"));
iMPXPluginObs = &aObs;
- iAccessPointId = -1;
+ iAccessPointId = KUseDefaultIap;
iVideoSeeker = CMPXVideoSeeker::NewL( this );
// Initiliaze to True
iSeekable = ETrue;
- InitVolumeWatchers();
+ InitVolumeWatchersL();
CreatePreInitStatesL();
@@ -160,6 +164,8 @@
iBackLightTimer = CPeriodic::NewL( CActive::EPriorityStandard );
iDrmHelper = CMpxVideoDrmHelper::NewL();
+
+ iSavedPosition = 0;
}
// ----------------------------------------------------------------------------
@@ -169,7 +175,6 @@
void CMPXVideoPlaybackController::CloseController()
{
MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::CloseController()"));
-
ChangeState( EMPXVideoNotInitialized );
}
@@ -179,7 +184,8 @@
//
void CMPXVideoPlaybackController::OpenFileL( const TDesC& aMediaFile,
RFile& aFile,
- TInt aAccessPointId )
+ TInt aPosition,
+ TInt aAccessPointId )
{
MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::OpenFileL()"),
_L("file = %S"), &aMediaFile );
@@ -209,6 +215,8 @@
DetermineMediaTypeL();
SetPlaybackModeL();
+ iSavedPosition = aPosition;
+
//
// Create accessory monitor to search for TV-Out events
//
@@ -258,6 +266,7 @@
, iForegroundPause(EFalse)
, iAllowAutoPlay(ETrue)
, iHelixLoadingStarted(EFalse)
+ , iLightStatus(CHWRMLight::ELightStatusUnknown)
{
}
@@ -340,6 +349,17 @@
delete iPlayer;
iPlayer = NULL;
}
+
+ if ( iUserActivityTimer )
+ {
+ iUserActivityTimer->Cancel();
+ delete iUserActivityTimer;
+ iUserActivityTimer = NULL;
+ }
+
+ ReleaseLights();
+
+ CancelDisplayTimer();
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
@@ -525,6 +545,11 @@
break;
}
+ case EPbCmdSurfaceRemoved:
+ {
+ iPlayer->SurfaceRemovedFromView();
+ break;
+ }
default:
{
break;
@@ -975,8 +1000,12 @@
{
case KMPXVideoPlaybackMute:
{
+ TInt muteValue( EFalse );
+
+ TRAP_IGNORE( muteValue = iMuteWatcher->CurrentValueL() );
+
iMPXPluginObs->HandlePluginEvent( MMPXPlaybackPluginObserver::EPMuteChanged,
- iMuteWatcher->CurrentValueL(),
+ muteValue,
KErrNone );
// fall through
}
@@ -989,10 +1018,6 @@
iState->HandleVolumeChange();
break;
}
- default:
- {
- break;
- }
}
}
}
@@ -1186,11 +1211,11 @@
//
if ( iFileDetails->iVideoEnabled )
{
- StartBackLightTimer();
+ StartLightsControl();
}
else
{
- CancelBackLightTimer();
+ CancelLightsControl();
}
break;
@@ -1198,42 +1223,44 @@
case EMPXVideoPaused:
{
iState = iPausedState;
- CancelBackLightTimer();
+ CancelLightsControl();
break;
}
case EMPXVideoInitializing:
{
iState = iInitialisingState;
- StartBackLightTimer();
+ StartLightsControl();
break;
}
case EMPXVideoInitialized:
{
iState = iInitialisedState;
+ StartLightsControl();
break;
}
case EMPXVideoBuffering:
{
iState = iBufferingState;
- StartBackLightTimer();
+ StartLightsControl();
break;
}
case EMPXVideoSeeking:
{
iState = iSeekingState;
+ StartLightsControl();
break;
}
case EMPXVideoStopped:
{
iState = iStoppedState;
- CancelBackLightTimer();
+ CancelLightsControl();
break;
}
case EMPXVideoNotInitialized:
{
ResetMemberVariables();
iState = iNotIntialisedState;
- CancelBackLightTimer();
+ CancelLightsControl();
break;
}
}
@@ -1304,11 +1331,11 @@
//
iFileDetails->iMaxVolume = iPlayer->MaxVolume();
- //
+ //
// FourCC Code
//
- iFileDetails->iFourCCCode = iPlayer->FourCCCode();
-
+ iFileDetails->iFourCCCode = iPlayer->FourCCCode();
+
//
// Mime Type
//
@@ -1423,7 +1450,7 @@
{
iFileDetails->iKeywords = metaData->Value().AllocL();
}
-
+
CleanupStack::PopAndDestroy( metaData );
}
@@ -1725,17 +1752,17 @@
}
// -----------------------------------------------------------------------------
-// CMPXVideoPlaybackController::IsDisplayOff
+// CMPXVideoPlaybackController::IsKeyLocked
// -----------------------------------------------------------------------------
//
-TBool CMPXVideoPlaybackController::IsDisplayOff()
+TBool CMPXVideoPlaybackController::IsKeyLocked()
{
- TBool displayState;
- HAL::Get( HALData::EDisplayState, displayState );
+ TBool keylock( EFalse );
+ RProperty::Get( KPSUidAvkonDomain, KAknKeyguardStatus, keylock );
- MPX_DEBUG(_L("CMPXVideoPlaybackController::IsDisplayOff(%d)"), !displayState);
+ MPX_DEBUG(_L("CMPXVideoPlaybackController::IsKeyLocked(%d)"), keylock);
- return !displayState;
+ return keylock;
}
// ------------------------------------------------------------------------------------------------
@@ -1766,6 +1793,22 @@
iState->SendErrorToViewL( KMPXVideoTvOutPlaybackNotAllowed );
}
+ else
+ {
+ // If lights are being controlled enable display timer so that screen backlight will be turned
+ // of after timeout.
+ if ( iBackLightTimer->IsActive() )
+ {
+ RestartDisplayTimer();
+ }
+ }
+ }
+ else
+ {
+ // TV out disconnected
+ CancelDisplayTimer();
+ // Ensure that lights are on after this
+ ReleaseLights();
}
//
@@ -1797,6 +1840,7 @@
{
iBackLightTimer->Cancel();
}
+
}
// ------------------------------------------------------------------------------------------------
@@ -1811,17 +1855,18 @@
iBackLightTimer->Start(
0,
KMPXBackLightTimeOut,
- TCallBack( CMPXVideoPlaybackController::HandleBackLightTimout, this ));
+ TCallBack( CMPXVideoPlaybackController::HandleBackLightTimeout, this ));
}
+
}
// -------------------------------------------------------------------------------------------------
// Handle back light timer timeout callback
// -------------------------------------------------------------------------------------------------
//
-TInt CMPXVideoPlaybackController::HandleBackLightTimout( TAny* aPtr )
+TInt CMPXVideoPlaybackController::HandleBackLightTimeout( TAny* aPtr )
{
- static_cast<CMPXVideoPlaybackController*>(aPtr)->DoHandleBackLightTimout();
+ static_cast<CMPXVideoPlaybackController*>(aPtr)->DoHandleBackLightTimeout();
return KErrNone;
}
@@ -1829,35 +1874,419 @@
// Handle back light timer timeout
// -------------------------------------------------------------------------------------------------
//
-void CMPXVideoPlaybackController::DoHandleBackLightTimout()
+void CMPXVideoPlaybackController::DoHandleBackLightTimeout()
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::DoHandleBackLightTimeout()"));
+
+ TBool tvOutConnected( EFalse );
+ if ( iAccessoryMonitor )
+ {
+ tvOutConnected = iAccessoryMonitor->IsTvOutConnected();
+ }
+
+ // User activity timer runs always when TV-out is connected
+ // it keeps resetting display timer and keeps lights on whenever there is user activity
+ if ( tvOutConnected )
+ {
+ MPX_DEBUG ( _L("CMPXVideoPlaybackController::DoHandleBackLightTimeout() inactivity time = %d"), User::InactivityTime().Int() );
+ // Cancel activity timer. Otherwise resetting inactivity time would fire user activity detection
+ CancelUserActivityTimer();
+ }
+
+ User::ResetInactivityTime();
+
+ if ( tvOutConnected )
+ {
+ // Restart user activity timer. It must be running between backlight timer intervals so that backlight
+ // can be turned on if user activity is detected.
+ RestartUserActivityTimer();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CMPXVideoPlaybackController::StartLightsControl
+// -----------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackController::StartLightsControl()
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::StartLightsControl()"));
+
+ StartBackLightTimer();
+
+ if (iAccessoryMonitor )
+ {
+ if ( iAccessoryMonitor->IsTvOutConnected() )
+ {
+ RestartDisplayTimer();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+// CMPXVideoPlaybackController::CancelLightsControl
+// -----------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackController::CancelLightsControl()
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::CancelLightsControl()"));
+
+ // This is called whenever there is no need to keep screensaver of anymore
+ // This means that also displaytimer and activity monitoring can be stopped.
+ // This method is not correct place for these calls
+ CancelBackLightTimer();
+
+ CancelUserActivityTimer();
+
+ CancelDisplayTimer();
+
+ // Ensure that lights are on
+ EnableDisplayBacklight();
+
+ // Release lights if releserved
+ ReleaseLights();
+}
+
+
+// -----------------------------------------------------------------------------
+// CMPXVideoPlaybackController::InitDisplayTimerL
+// -----------------------------------------------------------------------------
+//
+TTimeIntervalMicroSeconds32 CMPXVideoPlaybackController::InitDisplayTimerL()
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::InitDisplayTimerL()"));
+
+ if ( !iDisplayTimer )
+ {
+ iDisplayTimer = CPeriodic::NewL( CPeriodic::EPriorityStandard );
+
+ MPX_DEBUG(_L("CMPXVideoPlaybackController::InitDisplayTimerL() - created") );
+
+ }
+
+ if ( iDisplayTimerTimeout.Int() == 0 )
+ {
+ // Get the display light time-out value from CenRep
+ CRepository* repository = CRepository::NewLC( KCRUidLightSettings );
+ // What's the timeout value (in seconds ) for the display light?
+ TInt displayTimeOut ( 0 );
+ repository->Get( KDisplayLightsTimeout, displayTimeOut );
+
+ if ( ( displayTimeOut * KMPXMicroSecondsInASecond ) > KMaxTInt )
+ {
+ iDisplayTimerTimeout = KMaxTInt;
+ }
+ else
+ {
+ iDisplayTimerTimeout = displayTimeOut * KMPXMicroSecondsInASecond;
+ }
+
+ CleanupStack::PopAndDestroy( repository );
+ }
+
+
+ MPX_DEBUG( _L("CMPXVideoPlaybackController::InitDisplayTimerL Timeout(%d)"), iDisplayTimerTimeout.Int() );
+
+ // Convert the timeout value to microseconds
+ return iDisplayTimerTimeout;
+}
+
+// -----------------------------------------------------------------------------
+// CMPXVideoPlaybackController::RestartDisplayTimer
+// -----------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackController::RestartDisplayTimer()
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::RestartDisplayTimer"));
+
+ TTimeIntervalMicroSeconds32 displayTimeOut(0);
+ // Leave system to safe state if following leaves. Lights stay on
+ MPX_TRAPD(err, displayTimeOut=InitDisplayTimerL(); )
+ if ( err == KErrNone )
+ {
+ // check if the display timer is running and cancel it
+ if ( iDisplayTimer->IsActive() )
+ {
+ iDisplayTimer->Cancel();
+ }
+
+ MPX_DEBUG( _L("CMPXVideoPlaybackController::RestartDisplayTimer() restarting displayTimer to=%d ms"), displayTimeOut.Int() );
+
+ iDisplayTimer->Start( displayTimeOut, displayTimeOut,
+ TCallBack( CMPXVideoPlaybackController::HandleDisplayTimeout, this ) );
+ }
+
+}
+
+// -----------------------------------------------------------------------------
+// CMPXVideoPlaybackController::CancelDisplayTimer
+// -----------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackController::CancelDisplayTimer()
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::CancelDisplayTimer"));
+
+ if ( iDisplayTimer )
+ {
+ if ( iDisplayTimer->IsActive() )
+ {
+ iDisplayTimer->Cancel();
+ }
+ delete iDisplayTimer;
+ iDisplayTimer = NULL;
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::HandleDisplayTimeout
+// -------------------------------------------------------------------------------------------------
+//
+TInt CMPXVideoPlaybackController::HandleDisplayTimeout( TAny* aPtr )
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::HandleDisplayTimeout"));
+
+ static_cast<CMPXVideoPlaybackController*>(aPtr)->DoHandleDisplayTimeout();
+
+ return KErrNone;
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackUserInputHandler::DoHandleDisplayTimeout
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackController::DoHandleDisplayTimeout( )
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::DoHandleDisplayTimeout"));
+
+ DisableDisplayBacklight();
+ // Avoid missing user activity immediately after lights are turned off
+ RestartUserActivityTimer();
+}
+
+
+
+// ------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackController::EnableDisplayBacklight
+// ------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackController::EnableDisplayBacklight()
{
- MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::DoHandleBackLightTimout()"));
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::EnableDisplayBacklight()"));
+
+ // ELightStatusUnknown - We are not controlling lights and we don't care about lights
+ // ELightOn - Ligths are certainly on
+ MPX_DEBUG(_L("CMPXVideoPlaybackController::EnableDisplayBacklight() iLightStatus=%d"), iLightStatus );
+
+ // We are responsible of turning lights on only if we have switched them off.
+ if ( iLightStatus == CHWRMLight::ELightOff )
+ {
+
+ MPX_TRAPD( err,
+ {
+ // Following GetLightsL() call will not leave.
+ // This call should not result to creation of CHWRMLight in this case
+ // because CHWRMLight was created when lights were turned off.
+ CHWRMLight* lights= GetLightsL();
+ if ( lights->LightStatus(CHWRMLight::EPrimaryDisplay) == CHWRMLight::ELightOff )
+ {
+ MPX_DEBUG(_L("CMPXVideoPlaybackController::EnableDisplayBacklight() enabling") );
+
+ lights->LightOnL( CHWRMLight::EPrimaryDisplay, 0 );
+ iLightStatus = CHWRMLight::ELightOn;
+ }
+ } );
+
+ }
+
+}
+
+// ------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackController::DisableDisplayBacklight
+// ------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackController::DisableDisplayBacklight()
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::DisableDisplayBacklight()"));
+
+ // No major harm done if following block leaves. Lights are left on
+ MPX_TRAPD( err,
+ {
+ CHWRMLight* lights = GetLightsL();
+ if ( lights->LightStatus(CHWRMLight::EPrimaryDisplay) == CHWRMLight::ELightOn )
+ {
+ MPX_DEBUG(_L("CMPXVideoPlaybackController::DisableDisplayBacklight() disabling") );
+
+ lights->LightOffL( CHWRMLight::EPrimaryDisplay, 0 );
+ iLightStatus = CHWRMLight::ELightOff;
+ }
+ } );
+
+}
+
+
+// ------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackController::InitUserActivityTimer
+// ------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackController::InitUserActivityTimerL()
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::InitUserActivityTimerL()"));
+
+ iUserActivityTimer = CPeriodic::NewL( CActive::EPriorityStandard);
+
+ // This timer will not run to the end. Timer will be canceled and reset at backlight timeout.
+ iUserActivityTimer->Start(
+ 0,
+ KMPXInactivityTimeout,
+ TCallBack( CMPXVideoPlaybackController::HandleUserActivityTimeout, this ));
+
+}
- User::ResetInactivityTime();
+// ------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackController::RestartUserActivityTimer
+// ------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackController::RestartUserActivityTimer()
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::RestartUserActivityTimer()"));
+
+ if ( !iUserActivityTimer )
+ {
+ // This is first call. Create and initialize timer
+ MPX_TRAPD( err,
+ {
+ InitUserActivityTimerL();
+ } );
+ // If user activity timer creation fails we can't detect user activity and
+ // get lights back on when user taps screen.
+ // Leave lights on.
+ if ( err != KErrNone )
+ {
+ EnableDisplayBacklight();
+ }
+ }
+
+ if ( iUserActivityTimer )
+ {
+ if ( iUserActivityTimer->IsActive() )
+ {
+ iUserActivityTimer->Cancel();
+ }
+ // Not interested about inactivity callback, only activity
+ // If CPeriodic::Inactivity is started with argument 0
+ // timer will fire when system's user inactivity timer resets.
+ iUserActivityTimer->Inactivity( 0 );
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackController::CancelUserActivityTimer
+// ------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackController::CancelUserActivityTimer()
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::CancelUserActivityTimer()"));
+
+ if ( iUserActivityTimer )
+ {
+ if ( iUserActivityTimer->IsActive() )
+ {
+ iUserActivityTimer->Cancel();
+ }
+ }
+}
+
+// ------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackController::HandleUserActivityTimeout
+// ------------------------------------------------------------------------------------------------
+//
+TInt CMPXVideoPlaybackController::HandleUserActivityTimeout( TAny* aPtr )
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::HandleUserActivityTimeout()"));
+
+ static_cast<CMPXVideoPlaybackController*>(aPtr)->DoHandleUserActivityTimeout();
+ return KErrNone;
+}
+
+// ------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackController::DoHandleUserActivityTimeout
+// ------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackController::DoHandleUserActivityTimeout()
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::DoHandleUserActivityTimeout()"));
+
+ // Act only once for detected activity.
+ if ( iUserActivityTimer->IsActive() )
+ {
+ iUserActivityTimer->Cancel();
+ }
+
+ // iUserActivityTimer runs when TV-out is connected and playback with video is going on
+ // This timer fires in two situations.
+ // a) Lights are off and user activity is detected - Turn lights on and restart display timer
+ // b) Lights are on and user activity is detected - restart display timer to prevent lights go off
+ EnableDisplayBacklight();
+
+ // Start counting down to next lights off
+ RestartDisplayTimer();
+}
+
+// ------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackController::GetLightsL
+// ------------------------------------------------------------------------------------------------
+//
+CHWRMLight* CMPXVideoPlaybackController::GetLightsL()
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::GetLightsL()"));
+
+ if ( !iLight )
+ {
+ MPX_DEBUG( _L("CMPXVideoPlaybackController::GetLightsL() - creating") );
+ iLight = CHWRMLight::NewL();
+ }
+ return iLight;
+}
+
+// ------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackController::ReleaseLights
+// ------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackController::ReleaseLights()
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::ReleaseLights()"));
+
+ if ( iLight )
+ {
+ // If iLights was created when ReleaseLights was called then TV out must be connected and lights may be off.
+ // This call ensures that lights are on again.
+ EnableDisplayBacklight();
+
+ MPX_DEBUG( _L("CMPXVideoPlaybackController::ReleaseLights() - deleting") );
+ delete iLight;
+ iLight = NULL;
+ }
}
// -------------------------------------------------------------------------------------------------
// CMPXVideoPlaybackController::InitVolumeWatchers()
// -------------------------------------------------------------------------------------------------
//
-void CMPXVideoPlaybackController::InitVolumeWatchers()
+void CMPXVideoPlaybackController::InitVolumeWatchersL()
{
MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::InitVolumeWatchers()"));
if ( ! iVolumeWatcher )
{
- MPX_TRAPD( err,
- iVolumeWatcher = CMPXCenRepWatcher::NewL( KCRUidMPXVideoSettings,
- KMPXVideoPlaybackVolume,
- this ) );
+ iVolumeWatcher = CMPXCenRepWatcher::NewL( KCRUidMPXVideoSettings,
+ KMPXVideoPlaybackVolume,
+ this );
}
if ( ! iMuteWatcher )
{
- MPX_TRAPD( err,
- iMuteWatcher = CMPXCenRepWatcher::NewL( KCRUidMPXVideoSettings,
- KMPXVideoPlaybackMute,
- this ) );
+ iMuteWatcher = CMPXCenRepWatcher::NewL( KCRUidMPXVideoSettings,
+ KMPXVideoPlaybackMute,
+ this );
}
//
@@ -1907,6 +2336,16 @@
iPlayer->Reset();
+ //
+ // Delete the video accessory observer when the plugin
+ // goes back to Not Initialised state.
+ //
+ if ( iAccessoryMonitor )
+ {
+ delete iAccessoryMonitor;
+ iAccessoryMonitor = NULL;
+ }
+
if ( iFileDetails )
{
delete iFileDetails;
@@ -1951,6 +2390,8 @@
// Reset the flag to retrieve the Buffering percentage from Helix
//
iHelixLoadingStarted = EFalse;
+
+ iSavedPosition = 0;
}
// ------------------------------------------------------------------------------------------------
@@ -2008,10 +2449,11 @@
//
void CMPXVideoPlaybackController::OpenFile64L( const TDesC& aMediaFile,
RFile64& aFile,
+ TInt aPosition,
TInt aAccessPointId )
{
MPX_ENTER_EXIT(_L("CMPXVideoPlaybackController::OpenFile64L( RFile64 )"),
- _L("file = %S"), &aMediaFile );
+ _L("file = %S, position = %d"), &aMediaFile, aPosition );
TBool fileExists = EFalse;
@@ -2038,6 +2480,8 @@
DetermineMediaTypeL();
SetPlaybackModeL();
+ iSavedPosition = aPosition;
+
//
// Create accessory monitor to search for TV-Out events
//
--- a/videoplayback/videohelix/src/mpxvideoplaybackmode.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/videohelix/src/mpxvideoplaybackmode.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 17 %
+// Version : %version: 20 %
@@ -180,7 +180,7 @@
if ( iVideoPlaybackCtlr->iAppInForeground )
{
if ( iVideoPlaybackCtlr->IsAlarm() ||
- ( iVideoPlaybackCtlr->IsDisplayOff() && iVideoPlaybackCtlr->iFileDetails->iVideoEnabled ) )
+ ( iVideoPlaybackCtlr->IsKeyLocked() && iVideoPlaybackCtlr->iFileDetails->iVideoEnabled ) )
{
iVideoPlaybackCtlr->iForegroundPause = ETrue;
iVideoPlaybackCtlr->iState->HandlePause();
@@ -213,7 +213,7 @@
MPX_TRAPD( err,
iVideoPlaybackCtlr->iState->SendErrorToViewL( KMPXVideoCallOngoingError ) );
}
- else if ( iVideoPlaybackCtlr->IsDisplayOff() &&
+ else if ( iVideoPlaybackCtlr->IsKeyLocked() &&
iVideoPlaybackCtlr->iFileDetails->iVideoEnabled )
{
iVideoPlaybackCtlr->iForegroundPause = ETrue;
@@ -262,7 +262,7 @@
if ( networkMode == RMobilePhone::ENetworkModeGsm)
{
- networkMode2g = ETrue;
+ networkMode2g = ETrue;
}
mobilePhone.Close();
@@ -346,13 +346,14 @@
{
MPX_ENTER_EXIT(_L("CMPXStreamingPlaybackMode::HandleOpenComplete()"));
- // since SDP files are opened as KMmfUidFileSource type, we need to set
- // the access point for SDP files before Prepare is called on Helix
//
- // for RAM files and URLs - access point is already been set
- // at the point of adding data source
-
- if ( iVideoPlaybackCtlr->iMediaType == CMediaRecognizer::ELocalSdpFile )
+ // There is no need to send the access point if it is set to use default.
+ // SDP files are opened as KMmfUidFileSource type, we need to set the access point for
+ // SDP files before Prepare is called on Helix for RAM files and URLs - access point is
+ // already been set at the point of adding data source
+ //
+ if ( iVideoPlaybackCtlr->iAccessPointId != KUseDefaultIap &&
+ iVideoPlaybackCtlr->iMediaType == CMediaRecognizer::ELocalSdpFile )
{
const TMMFMessageDestinationPckg destinationPckg(KUidInterfaceMMFHelixController);
const TPckgBuf<TBool> savePckg( EFalse );
@@ -393,7 +394,7 @@
MPX_TRAPD(err,
iVideoPlaybackCtlr->iState->SendErrorToViewL( KMPXVideoCallOngoingError ));
}
- else if ( iVideoPlaybackCtlr->IsDisplayOff() && iVideoPlaybackCtlr->iFileDetails->iVideoEnabled )
+ else if ( iVideoPlaybackCtlr->IsKeyLocked() && iVideoPlaybackCtlr->iFileDetails->iVideoEnabled )
{
//exit for live streaming
}
@@ -445,7 +446,8 @@
TRAP_IGNORE( iVideoPlaybackCtlr->iState->SendErrorToViewL( err ) );
}
}
- else
+ // Streaming link is non-pausable and no alarm stop playback
+ else if ( !iVideoPlaybackCtlr->IsAlarm() )
{
iVideoPlaybackCtlr->iPlayer->Stop();
@@ -505,7 +507,7 @@
{
if ( iVideoPlaybackCtlr->IsPhoneCall() ||
iVideoPlaybackCtlr->IsVideoCall() ||
- ( iVideoPlaybackCtlr->IsDisplayOff() && iVideoPlaybackCtlr->iFileDetails->iVideoEnabled ))
+ ( iVideoPlaybackCtlr->IsKeyLocked() && iVideoPlaybackCtlr->iFileDetails->iVideoEnabled ))
{
iVideoPlaybackCtlr->iState->HandlePause();
}
--- a/videoplayback/videohelix/src/mpxvideoplaybackstate.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/videohelix/src/mpxvideoplaybackstate.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 33 %
+// Version : %version: 35 %
//
@@ -979,7 +979,20 @@
if ( aError == KErrNone )
{
iVideoPlaybackCtlr->iPlaybackMode->HandleOpenComplete();
-
+
+ //
+ // call setposition with converted value saved in openfile
+ //
+ if ( iVideoPlaybackCtlr->iSavedPosition > 0 )
+ {
+ MPX_DEBUG(_L("CMPXInitialisingState::HandleOpenComplete() iSavedPosition %d"), iVideoPlaybackCtlr->iSavedPosition );
+
+ TInt64 pos( iVideoPlaybackCtlr->iSavedPosition );
+ pos *= KPbMilliMultiplier;
+
+ iVideoPlaybackCtlr->iPlayer->SetPositionL( pos );
+ }
+
MPX_DEBUG(_L("CMPXInitialisingState::HandleOpenComplete() Sending Prepare()"));
iVideoPlaybackCtlr->iPlayer->Prepare();
@@ -1876,7 +1889,7 @@
void CMPXSeekingState::HandleBackground()
{
MPX_DEBUG(_L("CMPXSeekingState::HandleBackground()"));
- MPX_TRAPD( err, iVideoPlaybackCtlr->iState->HandleStopSeekL() );
+ MPX_TRAPD( err, HandleStopSeekL() );
iVideoPlaybackCtlr->iPlaybackMode->HandleBackground();
}
@@ -1886,6 +1899,7 @@
void CMPXSeekingState::HandlePause()
{
MPX_DEBUG(_L("CMPXSeekingState::HandlePause()"));
+ MPX_TRAPD( err, HandleStopSeekL() );
iVideoPlaybackCtlr->iPlaybackMode->HandlePause();
}
--- a/videoplayback/videohelix/src/mpxvideoplayerutility.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/videohelix/src/mpxvideoplayerutility.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 15 %
+// Version : %version: 18 %
#include <AudioPreference.h>
@@ -79,6 +79,12 @@
iControllerEventMonitor = NULL;
}
+ if ( ! iSurfaceId.IsNull() )
+ {
+ MPX_TRAPD( err, SendSurfaceCommandL( EPbMsgVideoRemoveDisplayWindow ) );
+ iSurfaceId = TSurfaceId::CreateNullId();
+ }
+
iController.Close();
iDirectScreenAccessAbort = EFalse;
}
@@ -274,6 +280,21 @@
}
}
+
+// -------------------------------------------------------------------------------------------------
+// CMpxVideoPlayerUtility::SurfaceRemovedFromView()
+// -------------------------------------------------------------------------------------------------
+//
+void CMpxVideoPlayerUtility::SurfaceRemovedFromView()
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerUtility::SurfaceRemovedFromView()"));
+
+ if ( ! iSurfaceId.IsNull() )
+ {
+ iSurfaceId = TSurfaceId::CreateNullId();
+ }
+}
+
TBool CMpxVideoPlayerUtility::AudioEnabledL() const
{
TBool enabled;
@@ -569,19 +590,17 @@
{
TInt error = KErrNone;
- if ( iSurfaceId.IsNull() )
+ if ( !iSurfaceId.IsNull() )
{
- error = KErrNotFound;
- }
+ //
+ // Send command to view to remove the surface
+ //
+ MPX_TRAPD( err, SendSurfaceCommandL( EPbMsgVideoSurfaceRemoved ) );
- //
- // Send command to view to remove the surface
- //
- MPX_TRAPD( err, SendSurfaceCommandL( EPbMsgVideoSurfaceRemoved ) );
+ error = iVideoPlaySurfaceSupportCustomCommands.SurfaceRemoved( iSurfaceId );
- error = iVideoPlaySurfaceSupportCustomCommands.SurfaceRemoved( iSurfaceId );
-
- iSurfaceId = TSurfaceId::CreateNullId();
+ iSurfaceId = TSurfaceId::CreateNullId();
+ }
return error;
}
--- a/videoplayback/videohelix/src/mpxvideoseeker.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/videohelix/src/mpxvideoseeker.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 7 %
+// Version : %version: 8 %
// INCLUDE FILES
@@ -128,7 +128,7 @@
TInt trickplaySpeed = KDefaultTrickPlaySpeed;
- if ( !iForward )
+ if ( ! iForward )
{
trickplaySpeed *= -1;
}
@@ -152,16 +152,22 @@
iIncrements *= -1;
}
- iSeekTimer->Start( 0,
- interval,
- TCallBack( CMPXVideoSeeker::UpdatePosition, this ) );
+ if ( ! iSeekTimer->IsActive() )
+ {
+ iSeekTimer->Start( 0,
+ interval,
+ TCallBack( CMPXVideoSeeker::UpdatePosition, this ) );
+ }
#endif
if ( err == KErrNone )
{
- iTrickPlayTimer->Start( KTrickPlayTimeout,
- 0,
- TCallBack( CMPXVideoSeeker::StopTrickPlay, this ) );
+ if ( ! iTrickPlayTimer->IsActive() )
+ {
+ iTrickPlayTimer->Start( KTrickPlayTimeout,
+ 0,
+ TCallBack( CMPXVideoSeeker::StopTrickPlay, this ) );
+ }
}
}
--- a/videoplayback/videohelix/tsrc/ut_videohelixtest/conf/videohelixtest.cfg Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/videohelix/tsrc/ut_videohelixtest/conf/videohelixtest.cfg Thu Apr 01 23:22:15 2010 +0300
@@ -653,7 +653,6 @@
waittestclass test
pause 100
test GetMedia
-test DisconnectTvOut
waittestclass test
delete test
pause 1000
@@ -821,5 +820,85 @@
pause 1000
[Endtest]
+[Test]
+title 54. HDMI Tv-Out - Unprotected Content
+create videohelixtest test
+test Initialize 60000 10 vhpp_test.3gp KErrNone KErrNone KErrNone
+waittestclass test
+pause 100
+test ConnectHDMITvOut
+waittestclass test
+test DisconnectHDMITvOut
+waittestclass test
+delete test
+pause 1000
+[Endtest]
+[Test]
+title 55. InitialiseWithPositionL with file missing
+create videohelixtest test
+test InitializeWithPositionL 0 10 6575 vhpp_nofile.3gp KErrNotFound KErrNone KErrNone
+waittestclass test
+test GetMedia
+waittestclass test
+delete test
+pause 1000
+[Endtest]
+
+[Test]
+title 56. InitialiseL with 32-bit file handle
+create videohelixtest test
+test InitializeHandleWithPositionL ERFile 60000 10 6575 vhpp_test.3gp KErrNone KErrNone KErrNone
+waittestclass test
+delete test
+pause 1000
+[Endtest]
+
+[Test]
+title 57. Initialise with rtsp link & AP
+create videohelixtest test
+test InitializeLinkWithPositionL 0 10 6575 rtsp:\/\/link.3gp KErrNone KErrNone KErrNone
+waittestclass test
+delete test
+pause 1000
+[Endtest]
+
+[Test]
+title 58. Play rtsp link (forces buffering state)
+create videohelixtest test
+test InitializeLinkWithPositionL 0 10 6575 rtsp:\/\/link.3gp KErrNone KErrNone KErrNone
+waittestclass test
+test IssueGeneralCommand EPbCmdPlay KErrNone ECallbackBuffering
+waittestclass test
+delete test
+pause 1000
+[Endtest]
+
+[Test]
+title 59. Initialise with SDP file via 32-bit file handle
+create videohelixtest test
+test InitializeHandleWithPositionL ERFile 60000 10 6575 sdp_test.sdp KErrNone KErrNone KErrNone
+waittestclass test
+delete test
+pause 1000
+[Endtest]
+
+[Test]
+title 60. InitialiseL with 64-bit file handle
+create videohelixtest test
+test InitializeHandleWithPositionL ERFile64 60000 10 6575 vhpp_test.3gp KErrNone KErrNone KErrNone
+waittestclass test
+delete test
+pause 1000
+[Endtest]
+
+[Test]
+title 61. Initialise with SDP file via 64-bit file handle
+create videohelixtest test
+test InitializeHandleWithPositionL ERFile64 60000 10 6575 sdp_test.sdp KErrNone KErrNone KErrNone
+waittestclass test
+delete test
+pause 1000
+[Endtest]
+
--- a/videoplayback/videohelix/tsrc/ut_videohelixtest/group/videohelixtest.mmp Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/videohelix/tsrc/ut_videohelixtest/group/videohelixtest.mmp Thu Apr 01 23:22:15 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 7 %
+// Version : %version: ou1cpsw#8 %
@@ -88,5 +88,6 @@
LIBRARY centralrepository.lib
LIBRARY flogger.lib
LIBRARY playbackhelper.lib
+LIBRARY hwrmlightclient.lib // Lights control
// End of File
--- a/videoplayback/videohelix/tsrc/ut_videohelixtest/inc/mpxvideoplayerutility_stub.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/videohelix/tsrc/ut_videohelixtest/inc/mpxvideoplayerutility_stub.h Thu Apr 01 23:22:15 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 10 %
+// Version : %version: 11 %
#ifndef __MPXVIDEOPLAYERUTILITY__
@@ -111,6 +111,8 @@
void SetVolumeSteps( TInt aVolumeSteps );
+ void SurfaceRemovedFromView();
+
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
void OpenFile64L( const RFile64& aFile );
#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
--- a/videoplayback/videohelix/tsrc/ut_videohelixtest/inc/videohelixtest.h Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/videohelix/tsrc/ut_videohelixtest/inc/videohelixtest.h Thu Apr 01 23:22:15 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 10 %
+// Version : %version: 12 %
#ifndef __VHPPTESTCASE_H__
@@ -165,11 +165,17 @@
virtual TInt EndPhoneCall();
virtual TInt SetTvOutConnectedL( CStifItemParser& aItem );
virtual TInt SetTvOutDisconnectedL();
- virtual TInt CVHPPTestClass::ConnectTvOutL( CStifItemParser& aItem );
- virtual TInt CVHPPTestClass::DisconnectTvOutL();
+ virtual TInt ConnectTvOutL( CStifItemParser& aItem );
+ virtual TInt DisconnectTvOutL();
virtual TInt SetDrmProtectedL( CStifItemParser& aItem );
virtual TInt IssueSeekedToEndCommandL( CStifItemParser& aItem );
virtual TInt HandleVolumeL( CStifItemParser& aItem );
+ virtual TInt ConnectHDMITvOutL();
+ virtual TInt DisconnectHDMITvOutL();
+ virtual TInt SetHDMITvOutConnectedL();
+ virtual TInt InitializeWithPositionL( CStifItemParser& aItem );
+ virtual TInt InitializeLinkWithPositionL( CStifItemParser& aItem );
+ virtual TInt InitializeHandleWithPositionL( CStifItemParser& aItem );
// ---------------------------------------------------------------------
// Helper Functions
--- a/videoplayback/videohelix/tsrc/ut_videohelixtest/src/mpxvideoplayerutility_stub.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/videohelix/tsrc/ut_videohelixtest/src/mpxvideoplayerutility_stub.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 12 %
+// Version : %version: 13 %
#include <audiopreference.h>
#include <mmf/server/mmffile.h>
@@ -743,6 +743,10 @@
return KErrNone;
}
+void CMpxVideoPlayerUtility::SurfaceRemovedFromView()
+{
+}
+
#endif
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
--- a/videoplayback/videohelix/tsrc/ut_videohelixtest/src/videohelixtestbody.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayback/videohelix/tsrc/ut_videohelixtest/src/videohelixtestbody.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 16 %
+// Version : %version: 18 %
// [INCLUDE FILES] - do not remove
@@ -115,8 +115,14 @@
ENTRY( "SetDrmProtected", CVHPPTestClass::SetDrmProtectedL ),
ENTRY( "IssueSeekedToEndCommand", CVHPPTestClass::IssueSeekedToEndCommandL),
- ENTRY( "HandleVolume", CVHPPTestClass::HandleVolumeL )
-
+ ENTRY( "HandleVolume", CVHPPTestClass::HandleVolumeL ),
+ ENTRY( "ConnectHDMITvOut", CVHPPTestClass::ConnectHDMITvOutL ),
+ ENTRY( "DisconnectHDMITvOut", CVHPPTestClass::DisconnectHDMITvOutL ),
+ ENTRY( "SetHDMITvOutConnected", CVHPPTestClass::SetHDMITvOutConnectedL ),
+
+ ENTRY ("InitializeWithPositionL", CVHPPTestClass::InitializeWithPositionL),
+ ENTRY ("InitializeLinkWithPositionL", CVHPPTestClass::InitializeLinkWithPositionL),
+ ENTRY ("InitializeHandleWithPositionL", CVHPPTestClass::InitializeHandleWithPositionL)
//
// ADD NEW ENTRIES HERE
@@ -2165,4 +2171,308 @@
return err;
}
+TInt
+CVHPPTestClass::ConnectHDMITvOutL( )
+{
+ MPX_ENTER_EXIT(_L("CVHPPTestClass::ConnectHDMITvOutL()"));
+ iLog->Log(_L("CVHPPTestClass::ConnectHDMITvOutL()"));
+
+ // Connect HDMI TV Out
+ iAccObserver->SetTvOutHDMI( ETrue );
+
+ //
+ // Add event for callback
+ //
+ TCallbackEvent* event = new TCallbackEvent;
+
+ event->iEvent = EPbCmdTvOutEvent;
+ event->iData = ETrue;
+ event->iError = ETrue;
+
+ AddExpectedEvent( event );
+
+ iAccObserver->UpdateTvOutStatusL( ETrue );
+
+ return KErrNone;
+}
+
+TInt
+CVHPPTestClass::DisconnectHDMITvOutL()
+{
+ MPX_ENTER_EXIT(_L("CVHPPTestClass::DisconnectHDMITvOutL()"));
+ iLog->Log(_L("CVHPPTestClass::DisconnectHDMITvOutL()"));
+
+ // Connect HDMI TV Out
+ iAccObserver->SetTvOutHDMI( EFalse );
+
+ //
+ // Add event for callback
+ //
+ TCallbackEvent* event = new TCallbackEvent;
+
+ event->iEvent = EPbCmdTvOutEvent;
+ event->iData = EFalse;
+ event->iError = ETrue;
+
+ AddExpectedEvent( event );
+
+ iAccObserver->UpdateTvOutStatusL( EFalse );
+
+ return KErrNone;
+}
+
+TInt
+CVHPPTestClass::SetHDMITvOutConnectedL()
+{
+ MPX_ENTER_EXIT(_L("CVHPPTestClass::SetHDMITvOutConnectedL()"));
+ iLog->Log(_L("CVHPPTestClass::SetHDMITvOutConnectedL()"));
+
+ iAccObserver->SetTvOutHDMI( ETrue );
+
+ return KErrNone;
+}
+
+TInt
+CVHPPTestClass::InitializeWithPositionL( CStifItemParser& aItem )
+{
+ MPX_ENTER_EXIT(_L("CVHPPTestClass::InitializeL()"));
+ iLog->Log(_L("CVHPPTestClass::InitializeL()"));
+
+ TInt duration;
+ TInt volumeSteps;
+ TInt position;
+
+ TInt err = aItem.GetNextInt( duration );
+
+ if ( err == KErrNone )
+ {
+ //
+ // We will always get an Init Complete message out
+ //
+ TCallbackEvent* event = new TCallbackEvent;
+
+ event->iEvent = EPInitialised;
+ event->iData = duration;
+ event->iError = KErrNone;
+
+ AddExpectedEvent( event );
+
+ //
+ // read number of volume steps
+ //
+ err = aItem.GetNextInt( volumeSteps );
+
+ if ( err == KErrNone )
+ {
+ //
+ // set volume steps
+ //
+ SetVolumeSteps( volumeSteps );
+
+ err = aItem.GetNextInt( position );
+
+ if (err == KErrNone )
+ {
+ TBuf<120> fullPath;
+
+ err = ReadFileInitializationParameters( aItem, fullPath );
+
+ if ( err == KErrNone )
+ {
+ PreparePluginL();
+
+ //
+ // Initalize the Plugin with a file name
+ //
+ MPX_DEBUG(_L("Initialize the Plugin: filename = %S, position = %d"), &fullPath, position);
+ iLog->Log(_L("Initialize the Plugin: filename = %S, position = %d"), &fullPath, position);
+
+ iPlaybackPlugin->InitialiseWithPositionL( fullPath, position );
+ }
+
+ }
+ }
+ }
+
+ return err;
+}
+
+
+TInt
+CVHPPTestClass::InitializeLinkWithPositionL( CStifItemParser& aItem )
+{
+ MPX_ENTER_EXIT(_L("CVHPPTestClass::InitializeLinkL()"));
+ iLog->Log(_L("CVHPPTestClass::InitializeLinkL()"));
+
+ TInt duration;
+ TInt volumeSteps;
+ TInt position;
+
+ TInt err = aItem.GetNextInt( duration );
+
+ if ( err == KErrNone )
+ {
+ //
+ // We will always get an Init Complete message out
+ //
+ TCallbackEvent* event = new TCallbackEvent;
+
+ event->iEvent = EPInitialised;
+ event->iData = duration;
+ event->iError = KErrNone;
+
+ AddExpectedEvent( event );
+
+ //
+ // read number of volume steps
+ //
+ err = aItem.GetNextInt( volumeSteps );
+
+ if ( err == KErrNone )
+ {
+ //
+ // set volume steps
+ //
+ SetVolumeSteps( volumeSteps );
+
+ err = aItem.GetNextInt( position );
+
+ if ( err == KErrNone )
+ {
+ TPtrC link;
+
+ //
+ // Read in the link from the config file
+ //
+ TInt err = aItem.GetNextString( link );
+
+ if ( err == KErrNone )
+ {
+ TInt err = ReadInitializationErrors( aItem );
+
+ if ( err == KErrNone )
+ {
+ PreparePluginL();
+
+ //
+ // Extract the streaming link from the ram file and
+ // Initalize the Plugin with the link and an access point
+ //
+ MPX_DEBUG(_L("Initialize the Plugin: link = %S, position = %d"), &link, position);
+ iLog->Log(_L("Initialize the Plugin: link = %S, position = %d"), &link, position);
+
+ iPlaybackPlugin->InitStreamingL( link, KNullDesC8, 11, position );
+ }
+ }
+ }
+ }
+ }
+
+ return err;
+}
+
+
+TInt
+CVHPPTestClass::InitializeHandleWithPositionL( CStifItemParser& aItem )
+{
+ MPX_ENTER_EXIT(_L("CVHPPTestClass::InitializeHandleL()"));
+ iLog->Log(_L("CVHPPTestClass::InitializeHandleL()"));
+
+ TInt duration;
+ TInt volumeSteps;
+ TInt position;
+ TInt fileHandle32;
+
+ TInt err = aItem.GetNextInt( fileHandle32 );
+
+ if ( err == KErrNone )
+ {
+
+#ifndef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
+ //
+ // set RFile as default if the 64-bit flag is not defined
+ //
+ fileHandle32 = ETrue;
+#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
+
+ err = aItem.GetNextInt( duration );
+
+ if ( err == KErrNone )
+ {
+ //
+ // We will always get an Init Complete message out
+ //
+ TCallbackEvent* event = new TCallbackEvent;
+
+ event->iEvent = EPInitialised;
+ event->iData = duration;
+ event->iError = KErrNone;
+
+ AddExpectedEvent( event );
+
+ //
+ // read number of volume steps
+ //
+ err = aItem.GetNextInt( volumeSteps );
+
+ if ( err == KErrNone )
+ {
+ //
+ // set volume steps
+ //
+ SetVolumeSteps( volumeSteps );
+
+ err = aItem.GetNextInt( position );
+
+ if (err == KErrNone )
+ {
+ TBuf<120> fullPath;
+
+ err = ReadFileInitializationParameters( aItem, fullPath );
+
+ if ( err == KErrNone )
+ {
+ PreparePluginL();
+
+ RFs fs;
+ TInt error = fs.Connect();
+ TInt fileError = KErrNone;
+
+ //
+ // Open a file handle to the clip
+ //
+ if ( fileHandle32 )
+ {
+ RFile file;
+ fileError = file.Open( fs, fullPath, EFileRead );
+ iPlaybackPlugin->InitialiseWithPositionL( file, position );
+ file.Close();
+ }
+#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
+ else
+ {
+ RFile64 file64;
+ fileError = file64.Open( fs, fullPath, EFileRead );
+ iPlaybackPlugin->Initialise64L( file64, position );
+ file64.Close();
+ }
+#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
+
+ //
+ // Initalize the Plugin with a file name
+ //
+ MPX_DEBUG(_L("Initialize the Plugin with File Handle: filename = %S, position = %d"), &fullPath, position);
+ iLog->Log(_L("Initialize the Plugin with File Handle: filename = %S, position = %d"), &fullPath, position);
+
+ fs.Close();
+ }
+ }
+
+ }
+ }
+ }
+
+ return err;
+}
+
// EOF
--- a/videoplayer.pro Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayer.pro Thu Apr 01 23:22:15 2010 +0300
@@ -18,7 +18,8 @@
TEMPLATE = subdirs
CONFIG += ordered
symbian: {
-BLD_INF_RULES.prj_mmpfiles += $$LITERAL_HASH"include \"videoplayer_plat/group/bld.inf\""
+BLD_INF_RULES.prj_mmpfiles += $$LITERAL_HASH"include \"videoplayer_plat/group/bld.inf\"" \
+ $$LITERAL_HASH"include \"mediasettings/group/bld.inf\""
SUBDIRS += videoplayback
SUBDIRS += videoplayerapp
SUBDIRS += videocollection
--- a/videoplayerapp/hbvideoplayer/sis/videoplayer_stub.pkg Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayerapp/hbvideoplayer/sis/videoplayer_stub.pkg Thu Apr 01 23:22:15 2010 +0300
@@ -63,5 +63,6 @@
"" - "z:\sys\bin\videoplayer.exe"
"" - "z:\resource\apps\videoplayer.r*"
"" - "z:\private\10003a3f\import\apps\videoplayer_reg.r*"
+"" - "z:\resource\qt\translations\videos.qm"
--- a/videoplayerapp/hbvideoplayer/sis/videoplayer_udeb.pkg Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayerapp/hbvideoplayer/sis/videoplayer_udeb.pkg Thu Apr 01 23:22:15 2010 +0300
@@ -45,22 +45,23 @@
;
; Playback Plugin
;
-"/epoc32/release/armv5/udeb/mpxvideohelixplayback.dll" - "!:/sys/bin/mpxvideohelixplayback.dll"
-"/epoc32/data/z/resource/plugins/mpxvideohelixplayback.rsc" - "!:/resource/plugins/mpxvideohelixplayback.rsc"
+"/epoc32/release/armv5/udeb/mpxvideohelixplayback.dll" - "!:/sys/bin/mpxvideohelixplayback.dll"
+"/epoc32/data/z/resource/plugins/mpxvideohelixplayback.rsc" - "!:/resource/plugins/mpxvideohelixplayback.rsc"
; Collection view and wrapper
-"/epoc32/release/armv5/udeb/videocollectionview.dll" - "!:/sys/bin/videocollectionview.dll"
-"/epoc32/data/z/resource/plugins/videocollectionview.rsc" -"!:/resource/plugins/videocollectionview.rsc"
-"/epoc32/release/armv5/udeb/videocollectionwrapper.dll" - "!:/sys/bin/videocollectionwrapper.dll"
-"/epoc32/data/z/resource/plugins/videofiledetailsview.rsc" -"!:/resource/plugins/videofiledetailsview.rsc"
-"/epoc32/release/armv5/udeb/videofiledetailsview.dll" - "!:/sys/bin/videofiledetailsview.dll"
+"/epoc32/release/armv5/udeb/videocollectionview.dll" - "!:/sys/bin/videocollectionview.dll"
+"/epoc32/data/z/resource/plugins/videocollectionview.rsc" - "!:/resource/plugins/videocollectionview.rsc"
+"/epoc32/release/armv5/udeb/videocollectionwrapper.dll" - "!:/sys/bin/videocollectionwrapper.dll"
+"/epoc32/data/z/resource/plugins/videofiledetailsview.rsc" - "!:/resource/plugins/videofiledetailsview.rsc"
+"/epoc32/release/armv5/udeb/videofiledetailsview.dll" - "!:/sys/bin/videofiledetailsview.dll"
; Executable and default resource files
-"/epoc32/release/armv5/udeb/videoplayerengine.dll" - "!:/sys/bin/videoplayerengine.dll"
-"/epoc32/release/armv5/udeb/videoplayer.exe" - "!:/sys/bin/videoplayer.exe"
-"/epoc32/data/z/resource/apps/videoplayer.rsc" - "!:/resource/apps/videoplayer.rsc"
-"/epoc32/data/z/private/10003a3f/import/apps/videoplayer_reg.rsc" - "!:/private/10003a3f/import/apps/videoplayer_reg.rsc"
+"/epoc32/release/armv5/udeb/videoplayerengine.dll" - "!:/sys/bin/videoplayerengine.dll"
+"/epoc32/release/armv5/udeb/videoplayer.exe" - "!:/sys/bin/videoplayer.exe"
+"/epoc32/data/z/resource/apps/videoplayer.rsc" - "!:/resource/apps/videoplayer.rsc"
+"/epoc32/data/z/private/10003a3f/import/apps/videoplayer_reg.rsc" - "!:/private/10003a3f/import/apps/videoplayer_reg.rsc"
+"/epoc32/data/z/resource/qt/translations/videos_en.qm" - "!:/resource/qt/translations/videos.qm"
-"/epoc32/data/z/resource/plugins/hbvideoplaybackviewplugin.rsc" - "!:/resource/plugins/hbvideoplaybackviewplugin.rsc"
-"/epoc32/release/armv5/udeb/hbvideoplaybackview.dll" - "!:/sys/bin/hbvideoplaybackview.dll"
-"/epoc32/release/armv5/udeb/hbvideoplaybackviewplugin.dll" - "!:/sys/bin/hbvideoplaybackviewplugin.dll"
+"/epoc32/data/z/resource/plugins/hbvideoplaybackviewplugin.rsc" - "!:/resource/plugins/hbvideoplaybackviewplugin.rsc"
+"/epoc32/release/armv5/udeb/hbvideoplaybackview.dll" - "!:/sys/bin/hbvideoplaybackview.dll"
+"/epoc32/release/armv5/udeb/hbvideoplaybackviewplugin.dll" - "!:/sys/bin/hbvideoplaybackviewplugin.dll"
--- a/videoplayerapp/hbvideoplayer/sis/videoplayer_urel.pkg Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayerapp/hbvideoplayer/sis/videoplayer_urel.pkg Thu Apr 01 23:22:15 2010 +0300
@@ -45,22 +45,23 @@
;
; Playback Plugin
;
-"/epoc32/release/armv5/urel/mpxvideohelixplayback.dll" - "!:/sys/bin/mpxvideohelixplayback.dll"
-"/epoc32/data/z/resource/plugins/mpxvideohelixplayback.rsc" - "!:/resource/plugins/mpxvideohelixplayback.rsc"
+"/epoc32/release/armv5/urel/mpxvideohelixplayback.dll" - "!:/sys/bin/mpxvideohelixplayback.dll"
+"/epoc32/data/z/resource/plugins/mpxvideohelixplayback.rsc" - "!:/resource/plugins/mpxvideohelixplayback.rsc"
; Collection view and wrapper
-"/epoc32/release/armv5/urel/videocollectionview.dll" - "!:/sys/bin/videocollectionview.dll"
-"/epoc32/data/z/resource/plugins/videocollectionview.rsc" -"!:/resource/plugins/videocollectionview.rsc"
-"/epoc32/release/armv5/urel/videocollectionwrapper.dll" - "!:/sys/bin/videocollectionwrapper.dll"
-"/epoc32/data/z/resource/plugins/videofiledetailsview.rsc" -"!:/resource/plugins/videofiledetailsview.rsc"
-"/epoc32/release/armv5/urel/videofiledetailsview.dll" - "!:/sys/bin/videofiledetailsview.dll"
+"/epoc32/release/armv5/urel/videocollectionview.dll" - "!:/sys/bin/videocollectionview.dll"
+"/epoc32/data/z/resource/plugins/videocollectionview.rsc" - "!:/resource/plugins/videocollectionview.rsc"
+"/epoc32/release/armv5/urel/videocollectionwrapper.dll" - "!:/sys/bin/videocollectionwrapper.dll"
+"/epoc32/data/z/resource/plugins/videofiledetailsview.rsc" - "!:/resource/plugins/videofiledetailsview.rsc"
+"/epoc32/release/armv5/urel/videofiledetailsview.dll" - "!:/sys/bin/videofiledetailsview.dll"
; Executable and default resource files
-"/epoc32/release/armv5/urel/videoplayerengine.dll" - "!:/sys/bin/videoplayerengine.dll"
-"/epoc32/release/armv5/urel/videoplayer.exe" - "!:/sys/bin/videoplayer.exe"
-"/epoc32/data/z/resource/apps/videoplayer.rsc" - "!:/resource/apps/videoplayer.rsc"
-"/epoc32/data/z/private/10003a3f/import/apps/videoplayer_reg.rsc" - "!:/private/10003a3f/import/apps/videoplayer_reg.rsc"
+"/epoc32/release/armv5/urel/videoplayerengine.dll" - "!:/sys/bin/videoplayerengine.dll"
+"/epoc32/release/armv5/urel/videoplayer.exe" - "!:/sys/bin/videoplayer.exe"
+"/epoc32/data/z/resource/apps/videoplayer.rsc" - "!:/resource/apps/videoplayer.rsc"
+"/epoc32/data/z/private/10003a3f/import/apps/videoplayer_reg.rsc" - "!:/private/10003a3f/import/apps/videoplayer_reg.rsc"
+"/epoc32/data/z/resource/qt/translations/videos_en.qm" - "!:/resource/qt/translations/videos.qm"
-"/epoc32/data/z/resource/plugins/hbvideoplaybackviewplugin.rsc" - "!:/resource/plugins/hbvideoplaybackviewplugin.rsc"
-"/epoc32/release/armv5/urel/hbvideoplaybackview.dll" - "!:/sys/bin/hbvideoplaybackview.dll"
-"/epoc32/release/armv5/urel/hbvideoplaybackviewplugin.dll" - "!:/sys/bin/hbvideoplaybackviewplugin.dll"
+"/epoc32/data/z/resource/plugins/hbvideoplaybackviewplugin.rsc" - "!:/resource/plugins/hbvideoplaybackviewplugin.rsc"
+"/epoc32/release/armv5/urel/hbvideoplaybackview.dll" - "!:/sys/bin/hbvideoplaybackview.dll"
+"/epoc32/release/armv5/urel/hbvideoplaybackviewplugin.dll" - "!:/sys/bin/hbvideoplaybackviewplugin.dll"
--- a/videoplayerapp/hbvideoplayer/src/main.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayerapp/hbvideoplayer/src/main.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -15,10 +15,12 @@
*
*/
-// Version : %version: 8 %
+// Version : %version: 9 %
#include <QObject>
+#include <QTranslator>
+#include <QLocale>
#include <hbapplication.h>
#include <hbmainwindow.h>
#include <xqserviceutil.h>
@@ -29,20 +31,36 @@
{
HbApplication app(argc, argv);
+ // Load the translation file.
+ QString lang = QLocale::system().name();
+
+ QTranslator translator;
+
+ bool loaded(false);
+
+ loaded = translator.load( "videos_" + lang, QString("c:/resource/qt/translations") );
+
+ if (!loaded)
+ {
+ translator.load("videos_" + lang, QString("z:/resource/qt/translations") );
+ }
+
+ // Install the translator
+ app.installTranslator(&translator);
+
// has the application been launched via XQ Service Framework
- bool isService = XQServiceUtil::isService();
-
+ bool isService = XQServiceUtil::isService();
+
if (!isService)
{
- app.setApplicationName( QObject::tr("Videos") );
+ app.setApplicationName(hbTrId("txt_videos_title_videos"));
}
HbMainWindow mainWindow( 0, Hb::WindowFlagTransparent );
mainWindow.setAttribute( Qt::WA_OpaquePaintEvent );
-
+
QVideoPlayerEngine *engine = new QVideoPlayerEngine(isService);
engine->initialize();
mainWindow.show();
return app.exec();
-
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/videoplayerengine/inc/mpxvideoplaybackwrapper.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* 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: Implementation of QMpxVideoPlaybackWrapper
+*
+*/
+
+// Version : %version: 3 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKWRAPPER_H_
+#define MPXVIDEOPLAYBACKWRAPPER_H_
+
+#include <QObject>
+#include <QString>
+#include <QFile>
+
+#include "mpxhbvideocommondefs.h"
+
+class CMpxVideoPlayerAppUiEngine;
+
+class QMpxVideoPlaybackWrapper : public QObject
+{
+ Q_OBJECT
+
+ public:
+ QMpxVideoPlaybackWrapper();
+ virtual ~QMpxVideoPlaybackWrapper();
+
+ int playMedia( QString aFileName );
+ void openPlaybackView() ;
+
+ private:
+ void initializePlugins();
+
+ signals:
+ void handlePlaybackView( int viewId );
+
+ private: //data
+ CMpxVideoPlayerAppUiEngine *mUiEngine;
+};
+
+#endif /* MPXVIDEOPLAYBACKWRAPPER_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/videoplayerengine/inc/mpxvideoplayerappuiengine.h Thu Apr 01 23:22:15 2010 +0300
@@ -0,0 +1,350 @@
+/*
+* 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: CMpxVideoPlayerAppUiEngine
+ *
+*/
+
+// Version : %version: 3 %
+
+
+
+#ifndef CMPXVIDEOPLAYERAPPUIENGINE_H
+#define CMPXVIDEOPLAYERAPPUIENGINE_H
+
+#include <e32base.h>
+#include <mpxplaybackutility.h>
+#include <mpxviewutility.h>
+#include <mpxcollectionutility.h>
+#include <mpxmessage2.h>
+#include <mpxcollectionplaylist.h>
+#include <mediarecognizer.h>
+#include <mpxplaybackobserver.h>
+#include <mpxviewactivationobserver.h>
+#include <mpxcollectionobserver.h>
+#include <mpxcollectionuihelperobserver.h>
+
+class CMpxVideoEmbeddedPdlHandler;
+class CMPXCommonUiHelper;
+class MMPXCollectionUiHelper;
+class CAiwGenericParamList;
+class CVideoPlaylistUtility;
+class QMpxVideoPlaybackWrapper;
+
+/**
+* Application UI class.
+*
+* @lib mpxvideoplayer.exe
+* @since MpxVideoPlayer 0.1
+*/
+class CMpxVideoPlayerAppUiEngine : public CBase,
+ public MMPXPlaybackObserver,
+ public MMPXViewActivationObserver,
+ public MMPXCollectionObserver ,
+ public MMPXCHelperEmbeddedOpenObserver
+{
+ public: // Constructors and destructor
+ static CMpxVideoPlayerAppUiEngine* NewL( QMpxVideoPlaybackWrapper* aWrapper );
+
+ /**
+ * Destructor.
+ */
+ virtual ~CMpxVideoPlayerAppUiEngine();
+
+ public:
+ /*
+ * Retrieve the playback utility pointer
+ */
+ inline MMPXPlaybackUtility* PlaybackUtility();
+
+ /**
+ * Opens the specified file in response to a corresponding message.
+ *
+ * @param aFile File to be opened.
+ * @param aParams aiw generic parameters for the file
+ */
+ void OpenFileL( RFile& aFile, const CAiwGenericParamList* aParams );
+
+ /**
+ * Opens the specified file in response to a corresponding message.
+ *
+ * @param aFile File to be opened.
+ */
+ void OpenFileL( const TDesC& aFileName );
+
+ /**
+ * Opens the specified mpx media object.
+ *
+ * @param aMedia Media to be opened.
+ */
+ void OpenMediaL( const CMPXMedia& aMedia );
+
+ /**
+ * Handle playback message
+ *
+ * @param aMessage playback message
+ */
+ void DoHandlePlaybackMessageL( const CMPXMessage& aMessage );
+
+ /**
+ * Handle Player Changed Playback Message
+ */
+ void HandlePlaybackPlayerChangedL();
+
+ /**
+ * Sets mpx components ready for application shutdown
+ */
+ void PrepareCloseMpxL();
+
+ /**
+ * Sets AppUiEngine in stand alone "mode"
+ */
+ void StartStandAloneL();
+
+ /**
+ * Handle media properties.
+ */
+ void DoHandelCollectionMediaL( const CMPXMedia& aMedia );
+
+ /**
+ * Steps one level up in collection path
+ */
+ void StepBackCollectionPathL();
+
+ /**
+ * Initialize the playback engine with a collection path
+ * @param aPath The collection path to create the playlist from
+ */
+ void InitPlaybackEngineL( CMPXCollectionPath& aPath );
+
+ /**
+ * Process activation message.
+ * @param aMsg reference to activation message
+ */
+ void ProcessActivationMessageL( const TDesC8 &aMsg );
+
+ /*
+ * Handle embedded playback message
+ * @param aMessageUid message identification uid
+ * @param aMessageParameters aiw generic parameters
+ */
+ TBool HandleMessageL( TUid aMessageUid,
+ const TDesC8& aMessageParameters );
+
+ /**
+ * From MMPXPlaybackObserver
+ * Handle playback message
+ *
+ * @since 3.1
+ * @param aMessage playback message
+ * @param aErr system error code.
+ */
+ void HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError );
+
+ /**
+ * From MMPXViewActivationObserver
+ * Handle view activation.
+ *
+ * @since 3.1
+ * @param aCurrentViewType Current view type Uid.
+ * @param aPreviousViewType Previous view type Uid.
+ */
+ void HandleViewActivation( const TUid& aCurrentViewType, const TUid& aPreviousViewType );
+
+
+ /**
+ * From MPXCollectionObserver
+ * @since S60 3.2.3
+ * @param aMessage collection message, ownership not transferred.
+ * Please check aMsg is not NULL before using it. If aErr is not
+ * KErrNone, plugin might still call back with more info in the aMsg.
+ * @param aErr system error code
+ */
+ void HandleCollectionMessage( CMPXMessage* aMsg, TInt /*aErr*/ );
+
+ /**
+ * From MMPXCollectionObserver
+ * Handle media properties.
+ *
+ * @since 3.1
+ * @param aMedia media properties.
+ * @param aError Error code.
+ */
+ void HandleCollectionMediaL( const CMPXMedia& aMedia, TInt aError );
+
+ /**
+ * From MMPXCollectionObserver
+ * Handles the collection entries being opened.
+ *
+ * @since 3.1
+ * @param aEntries Collection entries opened.
+ * @param aIndex Focused entry.
+ * @param aComplete ETrue no more entries. EFalse more entries
+ * expected.
+ * @param aError Error code.
+ */
+ void HandleOpenL( const CMPXMedia& aEntries,
+ TInt aIndex,
+ TBool aComplete,
+ TInt aError );
+
+ /**
+ * From MMPXCollectionObserver
+ * Handles the item being opened.
+ *
+ * @since 3.1
+ * @param aPlaylist Collection playlist, owner ship is transfered.
+ * @param aError Error code.
+ */
+ void HandleOpenL( const CMPXCollectionPlaylist& aPlaylist, TInt aError);
+
+ // from base class MMPXCHelperEmbeddedOpenObserver
+ /**
+ * From MMPXCHelperEmbeddedOpenObserver
+ * Handles errors from opening in embedded mode
+ *
+ * @since 3.1
+ * @param aErr Error code
+ * @param aCategory Type of item to be opened.
+ */
+ void HandleEmbeddedOpenL( TInt aErr, TMPXGeneralCategory aCategory );
+
+ void CreateEmbeddedPdlPlaybackUtilityMemberVariablesL();
+
+ /*
+ * Handles the "back" button.
+ */
+ void HandleSoftKeyBackL();
+
+ /*
+ * Processes shell commands.
+ * @param aCommand
+ * @param aDocumentName
+ * @param aTail
+ * @return ETrue if document name exists
+ */
+ TBool ProcessCommandParametersL( TApaCommand aCommand,
+ TFileName& aDocumentName,
+ const TDesC8& aTail );
+
+ /*
+ * Provides the static function for the callback to exit the application
+ * Called by CIdle iIdle
+ * @since 9.2
+ * @param aPtr Pointer to callback class
+ * @return KErrNone
+ */
+ static TInt ExitApplicationL( TAny* aPtr );
+
+ private:
+ /**
+ * Constructor
+ */
+ CMpxVideoPlayerAppUiEngine( QMpxVideoPlaybackWrapper* aWrapper );
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+
+ void HandleMultiLinksFileL( const TDesC& aFileName,
+ CMediaRecognizer::TMediaType aMediaType );
+
+ void HandleMultiLinksFileL( RFile& aFile,
+ CMediaRecognizer::TMediaType aMediaType );
+
+ void DoHandleMultiLinksFileL( CVideoPlaylistUtility* aPlaylistUtil,
+ TBool aSingleLink,
+ TBool aLocalFile );
+
+ /**
+ * Handles the Url descriptor
+ *
+ * @param aUrl - the ulr to be handled
+ */
+ void HandleUrlDesL(const TDesC& aUrl);
+
+ TPtrC GetLinkLC( const TDesC& aFileName,
+ CMediaRecognizer::TMediaType aMediaType,
+ TBool aUseFileHandle = EFalse );
+
+ TInt HandleAiwGenericParamListL( const CAiwGenericParamList* aParams );
+
+ /**
+ * Handle collection message
+ *
+ * @param aMessage collection message
+ */
+ void DoHandleCollectionMessageL( CMPXMessage* aMessage );
+
+ void CreatePlaybackUtilityMemberVariablesL();
+
+ void CreateCollectionUtilityMemberVariablesL();
+
+ void CreateRemoteControlListenerL();
+
+ /*
+ * Activates an active object to exit the application
+ * @since 5.0
+ */
+ void ActivateExitActiveObject();
+
+ /*
+ * Called to stop and exit the application
+ * @since 9.2
+ * @return void
+ */
+ virtual void DoExitApplicationL();
+
+ /*
+ * used to send media info to plugin
+ */
+ void UpdatePbPluginMediaL();
+
+ void ActivateVideoPlaybackView();
+
+ private: // data
+
+ //
+ // Owned Utilities
+ //
+ MMPXPlaybackUtility* iPlaybackUtility;
+ //Do we need this? MMPXViewUtility* iViewUtility;
+ MMPXCollectionUtility* iCollectionUtility;
+ MMPXCollectionUiHelper* iCollectionUiHelper; // own
+
+ TUid iVideoCollectionId;
+
+ CIdle* iExitAo;
+ CMediaRecognizer* iRecognizer; // own
+ CMpxVideoEmbeddedPdlHandler* iPdlHandler; // own
+
+ TInt iAccessPointId;
+ TBool iMultilinkPlaylist;
+ TBool iSeekable;
+ TBool iUpdateSeekInfo;
+
+ QMpxVideoPlaybackWrapper* iPlaybackWrapper;
+};
+
+//
+// Inline methods
+//
+inline
+MMPXPlaybackUtility* CMpxVideoPlayerAppUiEngine::PlaybackUtility()
+{
+ return iPlaybackUtility;
+}
+
+#endif // CMPXVIDEOPLAYERAPPUIENGINE_H
--- a/videoplayerapp/videoplayerengine/src/mpxvideoplayerappuiengine.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayerapp/videoplayerengine/src/mpxvideoplayerappuiengine.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 3 %
+// Version : %version: 4 %
@@ -35,11 +35,9 @@
#include <mpxcollectionhelperfactory.h>
#include <mpxcollectionplugin.hrh>
#include <mpxmediageneralextdefs.h>
+#include <mmf/common/mmfcontrollerframeworkbase.h>
#include <streaminglinkmodel.h>
-#include <ApSettingsHandlerUi.h>
-#include <aputils.h>
-#include <MPSettingsModel.h>
#include <coeutils.h>
#include <videoplaylistutility.h>
#include <mpxvideoplaybackdefs.h>
@@ -61,7 +59,7 @@
iCollectionUtility( NULL ),
iExitAo( NULL ),
iRecognizer( NULL ),
- iExtAccessPointId( KErrUnknown ),
+ iAccessPointId( KUseDefaultIap ),
iMultilinkPlaylist( EFalse ),
iSeekable( ETrue ),
iUpdateSeekInfo( EFalse ),
@@ -331,7 +329,7 @@
{
TInt32 apId = KErrUnknown;
genParamAccessPoint->Value().Get( apId );
- iExtAccessPointId = apId;
+ iAccessPointId = apId;
}
}
}
@@ -373,7 +371,6 @@
}
else if ( mediaType == CMediaRecognizer::ELocalSdpFile )
{
- SetAccessPointL();
iPlaybackUtility->InitStreamingL( aFile, iAccessPointId );
}
else
@@ -422,7 +419,6 @@
}
else if ( mediaType == CMediaRecognizer::ELocalSdpFile )
{
- SetAccessPointL();
iPlaybackUtility->InitStreamingL( aFileName,
(TDesC8*)(&KDATATYPEVIDEOHELIX),
iAccessPointId );
@@ -850,7 +846,6 @@
}
else
{
- SetAccessPointL();
iPlaybackUtility->InitStreamingL( link,
(TDesC8*)(&KDATATYPEVIDEOHELIX),
iAccessPointId );
@@ -859,10 +854,6 @@
}
else
{
- if ( ! aLocalFile )
- {
- SetAccessPointL();
- }
CMPXMedia* playlist = aPlaylistUtil->GetPlayListL( iAccessPointId );
CleanupStack::PushL( playlist );
@@ -892,197 +883,12 @@
MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::HandleUrlDesL()"),
_L("aUrl = %S"), &aUrl );
- SetAccessPointL();
-
iPlaybackUtility->InitStreamingL( aUrl,
(TDesC8*)(&KDATATYPEVIDEOHELIX),
iAccessPointId );
}
// -------------------------------------------------------------------------------------------------
-// CMpxVideoPlayerAppUiEngine::SetAccessPointL
-// -------------------------------------------------------------------------------------------------
-//
-void CMpxVideoPlayerAppUiEngine::SetAccessPointL()
-{
- MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::SetAccessPointL()"));
-
- // a value was passed in for argument aAPId
- if ( ( iExtAccessPointId != KErrUnknown ) && IsWLANAccessPointL( iExtAccessPointId ) )
- {
- // if the external AP(passed in by an embedding app)
- // is a WLAN AP - it must be used
- iAccessPointId = iExtAccessPointId;
- }
- else
- {
- // attempt to read the default AP
- TInt defaultAPId(0);
-
- MPX_TRAPD( err, defaultAPId = GetDefaultAccessPointL() );
-
- if ( (err == KErrNone) && (defaultAPId != 0))
- {
- // a valid default AP has been read and should be used
- iAccessPointId = defaultAPId;
- }
- else
- {
- // a valid AP was NOT read ...
-
- if (iExtAccessPointId != KErrUnknown)
- {
- // use the AP passed in by embedding app, regardless of bearer type
- iAccessPointId = iExtAccessPointId;
- }
- else
- {
- // open the Access Point selection dialog and make a selection
- TUint32 apUid = SelectAPFromListL();
-
- // if the user actually selected an AP from the dialog
- // i.e. the user did not "cancel" the dialog
- if ( apUid != 0 )
- {
- // convert the AccessPoint-Uid to AccessPoint-Id
- iAccessPointId = GetAccessPointIdForUIDL(apUid);
- }
- }
- }
- }
-}
-
-// -------------------------------------------------------------------------------------------------
-// CMpxVideoPlayerAppUiEngine::IsWLANAccessPointL
-// -------------------------------------------------------------------------------------------------
-//
-TBool CMpxVideoPlayerAppUiEngine::IsWLANAccessPointL( TInt aAPId )
-{
- MPX_DEBUG(_L("CMpxVideoPlayerAppUiEngine::IsWLANAccessPointL(%d)"), aAPId);
-
- TBool wlanAP(EFalse);
-
- TApBearerType apBearerType = EApBearerTypeAllBearers;
-
- CCommsDatabase* commsDb = CCommsDatabase::NewL( EDatabaseTypeIAP );
- CleanupStack::PushL( commsDb );
-
- CApUtils* apUtils = CApUtils::NewLC( *commsDb );
-
- // in case there's some reserved IAP (i.e. DVB-H), which can potentially cause
- // a mismatch between WAP ID and IAP ID database, we should always
- // check to get the correct WAP record ID for a given IAP record ID
- // before we obtain the bearer type
-
- MPX_TRAPD( err,
- {
- TInt32 wapId = apUtils->WapIdFromIapIdL( aAPId );
- apBearerType = apUtils->BearerTypeL( wapId );
- } );
-
- CleanupStack::PopAndDestroy(2); // apUtils, commsDb
-
- //
- // Only use AP passed in if it's of WLAN bearer type
- // This method is being called only for Embedded.
- //
- if ( ! err && apBearerType == EApBearerTypeWLAN)
- {
- wlanAP = ETrue;
- }
-
- MPX_DEBUG(_L("CMpxVideoPlayerAppUiEngine::IsWLANAccessPointL() return %d"), wlanAP);
-
- return wlanAP;
-}
-
-// -------------------------------------------------------------------------------------------------
-// CMpxVideoPlayerAppUiEngine::GetDefaultAccessPointL
-// -------------------------------------------------------------------------------------------------
-//
-TInt CMpxVideoPlayerAppUiEngine::GetDefaultAccessPointL()
-{
- TInt defaultAP(0);
- TUint32 iap;
-
- CMPSettingsModel* ropSettings = CMPSettingsModel::NewL( KSettingsModelForROPUid );
-
- CleanupStack::PushL( ropSettings );
-
- ropSettings->LoadSettingsL( EConfigDefault );
-
- User::LeaveIfError( ropSettings->GetDefaultAp( iap ) );
-
- CleanupStack::PopAndDestroy(); // ropSettings
-
- defaultAP = GetAccessPointIdForUIDL( iap );
-
- MPX_DEBUG(_L("CMpxVideoPlayerAppUiEngine::GetDefaultAccessPointL(%d)"), defaultAP);
-
- return defaultAP;
-}
-
-// -------------------------------------------------------------------------------------------------
-// CMpxVideoPlayerAppUiEngine::GetAccessPointIdForUIDL
-// -------------------------------------------------------------------------------------------------
-//
-TInt CMpxVideoPlayerAppUiEngine::GetAccessPointIdForUIDL( TUint32 aAPUid )
-{
- TInt apId(0);
-
- CCommsDatabase* commsDb = CCommsDatabase::NewL( EDatabaseTypeIAP );
- CleanupStack::PushL( commsDb );
-
- CApUtils* apUtils = CApUtils::NewLC( *commsDb );
-
- apId = static_cast<TInt32>( apUtils->IapIdFromWapIdL( aAPUid ) );
-
- CleanupStack::PopAndDestroy(2); // apUtils, commsDb
-
- MPX_DEBUG(_L("CMpxVideoPlayerAppUiEngine::GetAccessPointIdForUIDL(%d)"), apId);
-
- return apId;
-}
-
-// -------------------------------------------------------------------------------------------------
-// CMpxVideoPlayerAppUiEngine::SelectAPFromListL
-// -------------------------------------------------------------------------------------------------
-//
-TUint32 CMpxVideoPlayerAppUiEngine::SelectAPFromListL()
-{
- MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::SelectAPFromListL()"));
-
- TUint32 apUid(0);
- TUint32 returnVal(0);
-
- CApSettingsHandler* dlg =
- CApSettingsHandler::NewLC( ETrue,
- EApSettingsSelListIsPopUp,
- EApSettingsSelMenuSelectNormal,
- KEApIspTypeAll,
- EApBearerTypeAll,
- KEApSortNameAscending,
- EIPv4 | EIPv6 );
-
- if ( dlg->RunSettingsL( iAccessPointId, apUid ) )
- {
- if ( apUid > 0 )
- {
- returnVal = apUid;
- }
- }
-
- if ( apUid <= 0 )
- {
- User::Leave( KErrCancel );
- }
-
- CleanupStack::PopAndDestroy( dlg );
-
- return returnVal;
-}
-
-// -------------------------------------------------------------------------------------------------
// CMpxVideoPlayerAppUiEngine::ProcessActivationMessageL
// -------------------------------------------------------------------------------------------------
//
--- a/videoplayerapp/videoplayerengine/src/videoplayerengine.cpp Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayerapp/videoplayerengine/src/videoplayerengine.cpp Thu Apr 01 23:22:15 2010 +0300
@@ -15,10 +15,10 @@
*
*/
-// Version : %version: 20 %
+// Version : %version: da1mmcf#21 %
-#include <qapplication>
+#include <QApplication>
#include <hbinstance.h>
#include <xqpluginloader.h>
--- a/videoplayerapp/videoplayerengine/videoplayerengine.pro Thu Apr 01 23:13:36 2010 +0300
+++ b/videoplayerapp/videoplayerengine/videoplayerengine.pro Thu Apr 01 23:22:15 2010 +0300
@@ -14,7 +14,7 @@
# Description: Project file for building Videoplayer components
#
#
-# Version : %version: 19 %
+# Version : %version: da1mmcf#20 %
TEMPLATE = lib
@@ -44,12 +44,8 @@
-lmpxcommon.dll \
-lestor.dll \
-lfbscli.dll \
- -lapengine.dll \
- -lapsettingshandlerui.dll \
- -lmpsettengine.dll \
-lplaybackhelper.dll \
-lvideoplaylistutility.dll \
- -lcommdb.dll \
-lservicehandler.dll \
-lxqservice.dll \
-lxqserviceutil.dll \