--- a/layers.sysdef.xml Tue Feb 02 00:12:10 2010 +0200
+++ b/layers.sysdef.xml Thu Apr 01 22:38:49 2010 +0300
@@ -1,63 +1,29 @@
<?xml version="1.0"?>
-<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_4_0.dtd" [
+<!DOCTYPE SystemDefinition SYSTEM "sysdef_1_5_1.dtd" [
<!ENTITY layer_real_source_path "sf/app/videoplayer" >
]>
-<SystemDefinition name="video" schema="1.4.0">
+<SystemDefinition name="video" schema="1.5.1">
<systemModel>
<layer name="app_layer">
+
<module name="videoplayer">
- <unit unitID="vado.videoplayer" mrp="" bldFile="&layer_real_source_path;/group" name="videoplayer" />
+ <unit unitID="vado.videoplayer" mrp="" bldFile="&layer_real_source_path;" name="videoplayer" proFile="videoplayer.pro" qmakeArgs="-r" />
</module>
+
</layer>
- <layer name="api_test_layer">
- <module name="video_player_file_details_dialog_api_tsrc">
- <unit unitID="vado.video_player_file_details_dialog_api_test" name="video_player_file_details_dialog_api_tsrc" bldFile="&layer_real_source_path;/videoplayer_plat/video_player_file_details_dialog_api/tsrc/group" mrp=""/>
- </module>
- <module name="videoplayer_startup_api_tsrc">
- <unit unitID="vado.videoplayer_startup_api_test" name="videoplayer_startup_api_tsrc" bldFile="&layer_real_source_path;/videoplayer_plat/videoplayer_startup_api/tsrc/group" mrp=""/>
- </module>
+ <layer name="qt_unit_test_layer">
+ <module name="vado.videocollectionwrapper.tsrc">
+ <unit unitID="vado.testvideocollectionlistener" mrp="" bldFile="&layer_real_source_path;/videocollection/videocollectionwrapper/tsrc/testvideocollectionlistener" proFile="testvideocollectionlistener.pro" name="unittest.testvideocollectionlistener"/>
+ </module>
+ </layer>
+
+ <layer name="api_test_layer">
</layer>
<layer name="unit_test_layer">
-
- <module name="videoplayer_tsrc">
- <unit unitID="vado.videohelix_test" name="videohelix_tsrc" bldFile="&layer_real_source_path;/videoplayback/videohelix/tsrc/ut_videohelixtest/group" mrp=""/>
- <unit unitID="vado.videoplaybackcontrols_test" name="videoplaybackcontrols_tsrc" bldFile="&layer_real_source_path;/videoplayback/videoplaybackcontrols/tsrc/videoplaybackcontrols_test/group" mrp=""/>
- <unit unitID="vado.userinputhandler_test" name="userinputhandler_tsrc" bldFile="&layer_real_source_path;/videoplayback/videoplaybackviews/tsrc/ut_userinputhandlertest/group" mrp=""/>
- <unit unitID="vado.mpxvideoplayer_test" name="mpxvideoplayer_tsrc" bldFile="&layer_real_source_path;/videoplayerapp/mpxvideoplayer/tsrc/ut_mpxvideoplayertest/group" mrp=""/>
- </module>
-
- <module name="videofeeds_tsrc">
- <unit unitID="vado.feeds_tests_dependency1" name="feeds_tests_dependency1" bldFile="&layer_real_source_path;/tsrc/VCXTestCommon/group" mrp=""/>
- <unit unitID="vado.feeds_tests_dependency2" name="feeds_tests_dependency2" bldFile="&layer_real_source_path;/tsrc/VCXTestUtilModule/group" mrp=""/>
- <unit unitID="vado.feeds_tests_dependency3" name="feeds_tests_dependency3" bldFile="&layer_real_source_path;/videofeeds/server/tsrc/IptvTestUtility/group" mrp=""/>
- <unit unitID="vado.feeds_tests_dependency4" name="feeds_tests_dependency4" bldFile="&layer_real_source_path;/tsrc/VCXTestMyVideosCollectionClient/group" mrp=""/>
-
- <unit unitID="vado.serviceprovisioning_test" name="serviceprovisioning_tsrc" bldFile="&layer_real_source_path;/videofeeds/server/tsrc/VCXProvisioningTest/group" mrp=""/>
- <unit unitID="vado.servicemanagement_test" name="servicemanagement_tsrc" bldFile="&layer_real_source_path;/videofeeds/server/tsrc/VCXServiceManagementApiTest/group" mrp=""/>
- <unit unitID="vado.vodcontent_test" name="vodcontent_tsrc" bldFile="&layer_real_source_path;/videofeeds/server/tsrc/VCXVodContentApiTest/group" mrp=""/>
- </module>
-
- <module name="mpxmyvideoscollection_tsrc">
- <unit unitID="vado.mvcollection_tests_dependency1" name="mvcollection_tests_dependency1" bldFile="&layer_real_source_path;/tsrc/VCXTestCommon/group" mrp=""/>
- <unit unitID="vado.mvcollection_tests_dependency2" name="mvcollection_tests_dependency2" bldFile="&layer_real_source_path;/tsrc/VCXTestUtilModule/group" mrp=""/>
- <unit unitID="vado.mvcollection_tests_dependency3" name="mvcollection_tests_dependency3" bldFile="&layer_real_source_path;/tsrc/VCXTestMyVideosCollectionClient/group" mrp=""/>
-
- <unit unitID="vado.mpxmyvideoscollection_test" name="mpxmyvideoscollection_tsrc" bldFile="&layer_real_source_path;/videocollection/mpxmyvideoscollection/tsrc/mpxmvcolltest/group" mrp=""/>
- </module>
-
- <module name="other_tsrc">
- <unit unitID="vado.other_tests_dependency1" name="other_tests_dependency1" bldFile="&layer_real_source_path;/tsrc/VCXTestCommon/group" mrp=""/>
- <unit unitID="vado.other_tests_dependency2" name="other_tests_dependency2" bldFile="&layer_real_source_path;/tsrc/VCXTestUtilModule/group" mrp=""/>
- <unit unitID="vado.other_tests_dependency3" name="other_tests_dependency3" bldFile="&layer_real_source_path;/tsrc/VCXTestMyVideosCollectionClient/group" mrp=""/>
-
- <unit unitID="vado.mediasettingsengine_test" name="mediasettingsengine_tsrc" bldFile="&layer_real_source_path;/mediasettings/mediasettingsengine/tsrc/mediasettingsenginetest/group" mrp=""/>
- <unit unitID="vado.vpsettingsenginetest_test" name="vpsettingsenginetest_tsrc" bldFile="&layer_real_source_path;/mediasettings/videoplayersettingsengine/tsrc/vpsettingsenginetest/group" mrp=""/>
- </module>
-
</layer>
</systemModel>
-</SystemDefinition>
+</SystemDefinition>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/bwins/videocollectionwrapperu.def Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,68 @@
+EXPORTS
+ ?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 *)
+ ?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)
+ ?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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/eabi/videocollectionwrapperu.def Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,68 @@
+EXPORTS
+ _ZN18VideoThumbnailData11qt_metacallEN11QMetaObject4CallEiPPv @ 1 NONAME
+ _ZN18VideoThumbnailData11qt_metacastEPKc @ 2 NONAME
+ _ZN18VideoThumbnailData12getThumbnailE10TMPXItemId @ 3 NONAME
+ _ZN18VideoThumbnailData15removeThumbnailE10TMPXItemId @ 4 NONAME
+ _ZN18VideoThumbnailData16staticMetaObjectE @ 5 NONAME DATA 16
+ _ZN18VideoThumbnailData17freeThumbnailDataEv @ 6 NONAME
+ _ZN18VideoThumbnailData17thumbnailsFetchedE5QListI10TMPXItemIdE @ 7 NONAME
+ _ZN18VideoThumbnailData19getStaticMetaObjectEv @ 8 NONAME
+ _ZN18VideoThumbnailData22startFetchingThumbnailEii @ 9 NONAME
+ _ZN18VideoThumbnailData23startBackgroundFetchingEi @ 10 NONAME
+ _ZN18VideoThumbnailData24enableBackgroundFetchingEb @ 11 NONAME
+ _ZN18VideoThumbnailData8instanceEv @ 12 NONAME
+ _ZN18VideoThumbnailDataC1Ev @ 13 NONAME
+ _ZN18VideoThumbnailDataC2Ev @ 14 NONAME
+ _ZN18VideoThumbnailDataD0Ev @ 15 NONAME
+ _ZN18VideoThumbnailDataD1Ev @ 16 NONAME
+ _ZN18VideoThumbnailDataD2Ev @ 17 NONAME
+ _ZN22VideoCollectionWrapper11asyncStatusEiR8QVariant @ 18 NONAME
+ _ZN22VideoCollectionWrapper11qt_metacallEN11QMetaObject4CallEiPPv @ 19 NONAME
+ _ZN22VideoCollectionWrapper11qt_metacastEPKc @ 20 NONAME
+ _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
+ _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
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/inc/videocollectioncommon.h Thu Apr 01 22:38:49 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: definition of common data for video collection components
+*
+*/
+
+#ifndef __VIDEOCOLLECTIONCOMMON_H__
+#define __VIDEOCOLLECTIONCOMMON_H__
+
+
+#include <QObject>
+
+namespace VideoCollectionCommon
+{
+ /**
+ * enums indicating keys for the detail data
+ * fetched from video model
+ */
+ enum VideoDetailKey
+ {
+ KeyUndefined = Qt::UserRole,
+ KeyDateTime,
+ KeySizeValue,
+ KeyStatus,
+ KeyMetaData,
+ KeyFilePath,
+ KeyLast
+ };
+
+ /**
+ * Keys for the metadata map fetched from video model.
+ * These are strings, because QVariant only supports QMap<QString, QVariant>
+ */
+ const char* const MetaKeyDate = "MetaKeyDate";
+ const char* const MetaKeyDurationString = "MetaKeyDurationString";
+ const char* const MetaKeySizeString = "MetaKeySizeString";
+ const char* const MetaKeyStarRating = "MetaKeyStarRating";
+ const char* const MetaKeyDRMInfo = "MetaKeyDRMInfo";
+ const char* const MetaKeyServiceURL = "MetaKeyServiceURL";
+ const char* const MetaKeyDescription = "MetaKeyDescription";
+ const char* const MetaKeyModifiedDate = "MetaKeyModifiedDate";
+ const char* const MetaKeyShotLocation = "MetaKeyShotLocation";
+ const char* const MetaKeyAuthor = "MetaKeyAuthor";
+ const char* const MetaKeyCopyright = "MetaKeyCopyright";
+ const char* const MetaKeyAudioType = "MetaKeyAudioType";
+ const char* const MetaKeyLanguageString = "MetaKeyLanguageString";
+ const char* const MetaKeyKeywords = "MetaKeyKeywords";
+ const char* const MetaKeyVideoResolutionString = "MetaKeyVideoResolutionString";
+ const char* const MetaKeyBitRate = "MetaKeyBitRate";
+ const char* const MetaKeyFormat = "MetaKeyFormat";
+
+ enum VideoItemStatus
+ {
+ StatusNone = 0,
+ StatusDeleted
+ };
+
+ /**
+ * Labels for the different details. Needs to be in the same
+ * 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")
+ };
+
+ /**
+ * Order of keys in the labels const array.
+ */
+ const char * const VideoDetailLabelKeys[] = {
+ MetaKeyDRMInfo,
+ MetaKeyServiceURL,
+ MetaKeyDescription,
+ MetaKeyDurationString,
+ MetaKeyDate,
+ MetaKeyModifiedDate,
+ MetaKeyShotLocation,
+ MetaKeyAuthor,
+ MetaKeyCopyright,
+ MetaKeyAudioType,
+ MetaKeyLanguageString,
+ MetaKeyKeywords,
+ MetaKeySizeString,
+ MetaKeyVideoResolutionString,
+ MetaKeyFormat,
+ MetaKeyBitRate
+ };
+
+
+ /**
+ * Collection related asyncronous
+ * operations status codes
+ */
+ enum VideoCollectionAsyncStatus
+ {
+ statusSingleDeleteFail = 1,
+ statusMultipleDeleteFail,
+ statusMultipleDeleteSucceed
+ };
+
+
+}
+#endif // __VIDEOCOLLECTIONCOMMON_H__
--- a/videocollection/mpxmyvideoscollection/download/src/vcxmyvideosdownloadutil.cpp Tue Feb 02 00:12:10 2010 +0200
+++ b/videocollection/mpxmyvideoscollection/download/src/vcxmyvideosdownloadutil.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -15,8 +15,7 @@
*
*/
-
-
+#define MVCOLLECTION_10_1_DISABLE_DOWNLOADS
// INCLUDE FILES
#include <mpxlog.h>
@@ -130,12 +129,17 @@
CVcxMyVideosDownloadUtil::~CVcxMyVideosDownloadUtil()
{
MPX_FUNC("CVcxMyVideosDownloadUtil::~CVcxMyVideosDownloadUtil");
+
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
iDownloadManager.Disconnect(); //disconnects all downloads and puts them to pause
iDownloadManager.Close();
delete iDownloadDeleteTimer;
iDownloadsToDelete.Close();
iDeleteContent.Close();
-
+
if ( iConnUtil )
{
iConnUtil->RemoveObserver( this );
@@ -165,6 +169,10 @@
{
MPX_FUNC("CVcxMyVideosDownloadUtil::ConstructL");
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
TUid uid = TUid::Uid( KVcxUidMyVideosMpxCollection );
iDownloadManager.ConnectL( uid, *this, ETrue );
@@ -188,6 +196,11 @@
void CVcxMyVideosDownloadUtil::StartDownloadL( CMPXMedia& aDownload )
{
MPX_FUNC("CVcxMyVideosDownloadUtil::StartDownloadL");
+
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
// Requesting a new connection, update state
iRoamingOngoing = EFalse;
TInt err( KErrNone );
@@ -294,6 +307,10 @@
//
TInt CVcxMyVideosDownloadUtil::PauseDownload( TUint32 aDownloadId )
{
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return 0;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
RHttpDownload* download = Download( aDownloadId );
if ( !download )
@@ -313,6 +330,9 @@
THttpDownloadEvent aEvent )
{
MPX_FUNC("CVcxMyVideosDownloadUtil::HandleDMgrEventL");
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
TInt32 downloadId;
aDownload.GetIntAttribute( EDlAttrId, downloadId );
@@ -457,6 +477,10 @@
//
RHttpDownload* CVcxMyVideosDownloadUtil::Download( TUint32 aDownloadId )
{
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return 0;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
if ( aDownloadId == 0 )
{
return NULL;
@@ -486,6 +510,9 @@
RHttpDownload* CVcxMyVideosDownloadUtil::Download( const TDesC& aFileName )
{
MPX_FUNC("CVcxMyVideosDownloadUtil::Download()");
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return 0;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
TInt count = iDownloadManager.CurrentDownloads().Count();
TInt i;
@@ -525,6 +552,11 @@
{
MPX_FUNC("CVcxMyVideosDownloadUtil::CancelDownload");
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return 0;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
+
if ( iDownloadManager.CurrentDownloads().Count() < 1 )
{
return KErrNotFound;
@@ -559,6 +591,10 @@
TBool CVcxMyVideosDownloadUtil::RequestIsRoamingAllowedL()
{
MPX_FUNC("CVcxMyVideosDownloadUtil::RequestIsRoamingAllowedL");
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return EFalse;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
iDownloadManager.Disconnect();
iRoamingOngoing = ETrue;
return ETrue;
@@ -571,6 +607,10 @@
void CVcxMyVideosDownloadUtil::IapChangedL()
{
MPX_FUNC("CVcxMyVideosDownloadUtil::IapChangedL");
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
if ( !iRoamingOngoing )
{
// This is not roaming situation, must not call GetIap()
@@ -601,6 +641,10 @@
RHttpDownload& aDownload,
TVcxMyVideosDownloadState& aDownloadState )
{
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
TInt32 dlStateInDlManager;
aDownload.GetIntAttribute( EDlAttrState, dlStateInDlManager );
@@ -636,6 +680,10 @@
TInt8 CVcxMyVideosDownloadUtil::DownloadProgress( RHttpDownload& aDownload, TUint64& aDownloaded,
TBool aAllowSilentReset )
{
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return 0;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
TInt64 downloaded;
TInt32 fullSize;
@@ -703,6 +751,10 @@
//
const TDesC& CVcxMyVideosDownloadUtil::GetS60DlStateDes( TInt32 aState )
{
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return KVcxUnknownStateDes;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
switch ( aState )
{
case EHttpDlCreated:
@@ -764,6 +816,10 @@
//
const TDesC& CVcxMyVideosDownloadUtil::GetS60DlProgressDes( TInt32 aProgress )
{
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return KVcxUnknownProgressDes;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
switch ( aProgress )
{
case EHttpProgNone:
@@ -850,6 +906,10 @@
//
void CVcxMyVideosDownloadUtil::DeleteDownloadAsync( TInt32 aDownloadId, TBool aDeleteContent )
{
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
iDownloadsToDelete.Append( aDownloadId );
iDeleteContent.Append( aDeleteContent );
if ( !iDownloadDeleteTimer->IsActive() )
@@ -864,6 +924,10 @@
//
void CVcxMyVideosDownloadUtil::TimerExpired( CVcxMyVideosTimer* aTimer )
{
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
if ( aTimer == iDownloadDeleteTimer )
{
for ( TInt i = 0; i < iDownloadsToDelete.Count(); i++ )
@@ -911,6 +975,9 @@
void CVcxMyVideosDownloadUtil::ClearOrphanDownloadsL( CMPXMedia& aVideoList )
{
MPX_FUNC("CVcxMyVideosDownloadUtil::ClearOrphanDownloadsL");
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
const CDownloadArray& downloads = Downloads();
@@ -950,6 +1017,10 @@
//
void CVcxMyVideosDownloadUtil::NotifyDownloadStarted()
{
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
iMediatorEventProvider->RaiseEvent( TUid::Uid( KVcxNsMpxMediatorDomain ),
TUid::Uid( KVcxNsMpxMediatorCategory ),
KVcxNsMpxEventDownloadStarted ,
@@ -963,6 +1034,10 @@
//
void CVcxMyVideosDownloadUtil::NotifyIfNoActiveDownloads()
{
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
if ( !ActiveDownloadCount() )
{
iMediatorEventProvider->RaiseEvent( TUid::Uid( KVcxNsMpxMediatorDomain ),
@@ -979,6 +1054,10 @@
//
void CVcxMyVideosDownloadUtil::NotifyDownloadCompleted( const TDesC8& aMsg )
{
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
iMediatorEventProvider->RaiseEvent( TUid::Uid( KVcxNsMpxMediatorDomain ),
TUid::Uid( KVcxNsMpxMediatorCategory ),
KVcxNsMpxEventDownloadCompleted,
@@ -992,6 +1071,10 @@
//
void CVcxMyVideosDownloadUtil::NotifyNewVideosCountDecreased( const TDesC8& aMsg )
{
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
iMediatorEventProvider->RaiseEvent( TUid::Uid( KVcxNsMpxMediatorDomain ),
TUid::Uid( KVcxNsMpxMediatorCategory ),
KVcxNsMpxEventNewVideosCountDecreased,
@@ -1005,6 +1088,10 @@
//
TInt32 CVcxMyVideosDownloadUtil::ActiveDownloadCount()
{
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return 0;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
const CDownloadArray& dlarray = Downloads();
TInt32 dlCount( 0 );
@@ -1032,6 +1119,12 @@
MPX_FUNC("CVcxMyVideosDownloadUtil::CreateFilePathL");
HBufC* path = HBufC::NewL( KMaxPathLength );
+
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return path;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
+
CleanupStack::PushL( path ); // 1->
TPtr pathPtr( path->Des() );
@@ -1089,6 +1182,9 @@
void CVcxMyVideosDownloadUtil::GeneratePathL( const CMPXMedia& aMedia, TDes& aPath, TInt aCounter )
{
MPX_FUNC("CVcxMyVideosDownloadUtil::GeneratePathL");
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
_LIT( KBasePathNormal, "\\My Videos\\Downloads\\" );
_LIT( KBasePathSystemDrive, "\\Data\\My Videos\\Downloads\\" );
@@ -1236,6 +1332,10 @@
//
void CVcxMyVideosDownloadUtil::FindSubDirL( const TDesC& aPath )
{
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
MPX_FUNC("CVcxMyVideosDownloadUtil::FindSubDirL");
MPX_DEBUG2("CVcxMyVideosDownloadUtil:: aPath = %S", &aPath);
@@ -1291,6 +1391,10 @@
TInt CVcxMyVideosDownloadUtil::FileCountL( const TDesC& aPath )
{
TInt count = 0; // return 0 in case of fail
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return 0;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
CDir* dir = NULL;
TInt err = iFs.GetDir( aPath, KEntryAttNormal | KEntryAttMatchMask, ESortBySize, dir );
@@ -1314,6 +1418,10 @@
{
MPX_FUNC("CVcxMyVideosDownloadUtil::UsedMemoryDesL");
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return iUsedMemoryDrivePath;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
CVcxMyVideosDriveMonitor* driveMonitor = CVcxMyVideosDriveMonitor::NewL( iFs );
CleanupStack::PushL( driveMonitor ); // 1->
driveMonitor->GetUsedMemoryL( iUsedDrive );
@@ -1333,6 +1441,10 @@
//
void CVcxMyVideosDownloadUtil::StopProgressTimer()
{
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
if ( ActiveDownloadCount() == 0 )
{
MPX_DEBUG1("CVcxMyVideosDownloadUtil:: stopped iDownloadProgressTimer");
@@ -1346,6 +1458,10 @@
//
void CVcxMyVideosDownloadUtil::StartProgressTimer()
{
+#ifdef MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+ return;
+#endif // MVCOLLECTION_10_1_DISABLE_DOWNLOADS
+
if ( !iDownloadProgressTimer->IsActive() && ActiveDownloadCount() > 0 )
{
MPX_DEBUG1("CVcxMyVideosDownloadUtil:: started iDownloadProgressTimer");
--- a/videocollection/mpxmyvideoscollection/inc/vcxmyvideosvideocache.h Tue Feb 02 00:12:10 2010 +0200
+++ b/videocollection/mpxmyvideoscollection/inc/vcxmyvideosvideocache.h Thu Apr 01 22:38:49 2010 +0300
@@ -11,12 +11,11 @@
*
* Contributors:
*
-* Description: Contains cached MDS media items*
+* Description: Contains cached MDS media items*
*/
-
#ifndef VCXMYVIDEOSVIDEOCACHE_H
#define VCXMYVIDEOSVIDEOCACHE_H
@@ -348,6 +347,10 @@
*/
TVcxMyVideosSortingOrder iLastSortingOrder;
+ /**
+ * Set to ETrue when doing videolist fetching.
+ */
+ TBool IsFetchingVideoList;
private:
/**
--- a/videocollection/mpxmyvideoscollection/src/vcxmyvideosmdsdb.cpp Tue Feb 02 00:12:10 2010 +0200
+++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideosmdsdb.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -11,12 +11,11 @@
*
* Contributors:
*
-* Description: MPX My Videos collection plugin's MDS database class*
+* Description: MPX My Videos collection plugin's MDS database class*
*/
-
//#include <harvesterclient.h>
#include <mpxlog.h>
#include <mdeconstants.h>
@@ -31,6 +30,9 @@
#include <mpxmediavideodefs.h>
#include "vcxmyvideosmdsdb.h"
#include "vcxmyvideoscollectionutil.h"
+#include "vcxmyvideosmdsalbums.h"
+#include "vcxmyvideoscollectionutil.h"
+#include "vcxmyvideosmdscmdqueue.h"
_LIT( KVcxVideoObjectName, "Video" );
//1 (ID)
@@ -78,18 +80,20 @@
{
MPX_FUNC( "CVcxMyVideosMdsDb::ConstructL" );
+ iCmdQueue = CVcxMyVideosMdsCmdQueue::NewL( *this );
+
iActiveSchedulerWait = new (ELeave) CActiveSchedulerWait;
MPX_DEBUG1( "CVcxMyVideosMdsDb::ConstructL CMdESession::NewL" );
// Create session
- iMDSError = KErrNone;
+ iMdsError = KErrNone;
- iMDSSession = CMdESession::NewL( *this );
- if (!iMDSSession)
+ iMdsSession = CMdESession::NewL( *this );
+ if (!iMdsSession)
{
// Failed to create session, leave
- User::Leave( iMDSError );
+ User::Leave( iMdsError );
}
// Wait until session opened
@@ -97,21 +101,21 @@
MPX_DEBUG1( "CVcxMyVideosMdsDb::ConstructL iActiveSchedulerWait->Start done" );
- if ( iMDSError != KErrNone )
+ if ( iMdsError != KErrNone )
{
- MPX_DEBUG2("Failed to create session to MDS: %d", iMDSError);
- User::LeaveIfError( iMDSError );
+ MPX_DEBUG2("Failed to create session to MDS: %d", iMdsError);
+ User::LeaveIfError( iMdsError );
}
// Get the schema definitions
- iMDSError = KErrNone;
+ iMdsError = KErrNone;
GetSchemaDefinitionsL();
// Is schema ok
- if ( iMDSError != KErrNone )
+ if ( iMdsError != KErrNone )
{
// Schema not loaded, abort
- User::Leave( iMDSError );
+ User::Leave( iMdsError );
}
MPX_DEBUG1( "CVcxMyVideosMdsDb::ConstructL Adding observers" );
@@ -121,9 +125,15 @@
// do not bother us much since we try to fetch the item from the db
// after the add notification anyways, and then we use video condition.
// Eventually extra events are ignored.
- iMDSSession->AddObjectObserverL( *this, NULL );
+ iMdsSession->AddObjectObserverL( *this, NULL );
+
+ iMdsSession->AddObjectPresentObserverL( *this );
- iMDSSession->AddObjectPresentObserverL( *this );
+ iAlbums = CVcxMyVideosMdsAlbums::NewL( *this );
+
+ TCallBack callBack( AsyncHandleQueryCompleted, this );
+ iAsyncHandleQueryCompleteCaller = new (ELeave) CAsyncCallBack( callBack,
+ CActive::EPriorityStandard );
}
// ---------------------------------------------------------------------------
@@ -182,31 +192,42 @@
{
MPX_FUNC( "CVcxMyVideosMdsDb::~CVcxMyVideosMdsDb()" );
- if ( iMDSSession )
+ Cancel();
+
+ delete iCmdQueue;
+
+ if ( iMdsSession )
{
- TRAP_IGNORE( iMDSSession->RemoveObjectObserverL( *this ) );
+ TRAP_IGNORE( iMdsSession->RemoveObjectObserverL( *this ) );
}
- Cancel();
-
delete iVideoQuery;
- delete iMDSSession;
+ delete iAlbums;
+ delete iMdsSession;
delete iActiveSchedulerWait;
+ delete iAsyncHandleQueryCompleteCaller;
}
// ---------------------------------------------------------------------------
// CVcxMyVideosMdsDb::Cancel
// ---------------------------------------------------------------------------
//
-void CVcxMyVideosMdsDb::Cancel()
+void CVcxMyVideosMdsDb::Cancel( TRequestType aType )
{
MPX_FUNC("CVcxMyVideosMdsDb::Cancel()");
- if ( iVideoQuery )
+ iCmdQueue->Cancel( aType );
+
+ if ( aType == EAll || aType == EGetVideoList )
{
- iVideoQuery->Cancel();
+ if ( iVideoQuery )
+ {
+ iVideoQuery->Cancel();
+ }
+ iVideoListFetchingIsOngoing = EFalse;
}
- iVideoListFetchingIsOngoing = EFalse;
+
+ iAlbums->Cancel( aType );
}
// ---------------------------------------------------------------------------
@@ -219,13 +240,13 @@
{
MPX_FUNC( "CVcxMyVideosMdsDb::AddVideoL" );
- if ( !iMDSSession )
+ if ( !iMdsSession )
{
- MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session(%d), leaving", iMDSError);
- User::Leave( iMDSError );
+ MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session(%d), leaving", iMdsError);
+ User::Leave( iMdsError );
}
- CMdEObject* object = iMDSSession->NewObjectLC(
+ CMdEObject* object = iMdsSession->NewObjectLC(
*iVideoObjectDef, aVideo.ValueText( KMPXMediaGeneralUri ) ); // 1->
// check if the file exists and use the creation time from the file
@@ -260,11 +281,11 @@
}
Media2ObjectL( aVideo, *object );
- TRAPD( err, aMdsId = iMDSSession->AddObjectL( *object ) );
+ TRAPD( err, aMdsId = iMdsSession->AddObjectL( *object ) );
if ( err != KErrNone )
{
- MPX_DEBUG2( "CVcxMyVideosMdsDb:: iMDSSession->AddObjectL leaved with error: %d", err );
+ MPX_DEBUG2( "CVcxMyVideosMdsDb:: iMdsSession->AddObjectL leaved with error: %d", err );
User::Leave( err );
}
@@ -290,10 +311,10 @@
{
MPX_FUNC( "CVcxMyVideosMdsDb::RemoveVideoL" );
- if ( !iMDSSession )
+ if ( !iMdsSession )
{
- MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session, returning %d", iMDSError);
- return iMDSError;
+ MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session, returning %d", iMdsError);
+ return iMdsError;
}
TInt retValue( KErrNone );
@@ -301,7 +322,7 @@
MPX_DEBUG2( "CVcxMyVideosMdsDb:: removing object %d", aMdsId );
- TRAPD( err, id = iMDSSession->RemoveObjectL( aMdsId ) );
+ TRAPD( err, id = iMdsSession->RemoveObjectL( aMdsId ) );
if ( err == KErrNone )
{
@@ -317,7 +338,7 @@
}
else
{
- MPX_DEBUG2( "CVcxMyVideosMdsDb:: iMDSSession->RemoveObjectL left: %d", err );
+ MPX_DEBUG2( "CVcxMyVideosMdsDb:: iMdsSession->RemoveObjectL left: %d", err );
retValue = err;
}
@@ -332,10 +353,10 @@
{
MPX_FUNC( "CVcxMyVideosMdsDb::UpdateVideoL" );
- if ( !iMDSSession )
+ if ( !iMdsSession )
{
- MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session(%d), leaving", iMDSError);
- User::Leave( iMDSError );
+ MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session(%d), leaving", iMdsError);
+ User::Leave( iMdsError );
}
TMPXItemId mpxId = aVideo.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId );
@@ -343,7 +364,7 @@
MPX_DEBUG2("CVcxMyVideosMdsDb::UpdateVideoL updating object %d ", mpxId.iId1);
CMdEObject* object =
- iMDSSession->OpenObjectL( mpxId.iId1, *iVideoObjectDef );
+ iMdsSession->OpenObjectL( mpxId.iId1, *iVideoObjectDef );
if ( object == NULL )
{
// No object with this ID was found!
@@ -360,7 +381,7 @@
Media2ObjectL( aVideo, *object );
- iMDSSession->CommitObjectL(*object);
+ iMdsSession->CommitObjectL(*object);
CleanupStack::PopAndDestroy(object);
}
@@ -382,11 +403,30 @@
TBool aAscending, TBool aFullDetails, CMPXMedia*& aVideoList )
{
MPX_FUNC( "CVcxMyVideosMdsDb::CreateVideoListL" );
+
+ CVcxMyVideosMdsCmdGetVideoList* cmd = CVcxMyVideosMdsCmdGetVideoList::NewL();
+ cmd->iCmdType = CVcxMyVideosMdsDb::EGetVideoList;
+ cmd->iSortingOrder = aSortingOrder;
+ cmd->iAscending = aAscending;
+ cmd->iFullDetails = aFullDetails;
+ cmd->iVideoList = &aVideoList;
- if ( !iMDSSession )
+ iCmdQueue->ExecuteCmdL( cmd ); //ownership moves
+ }
+
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsDb::DoCreateVideoListL
+// ---------------------------------------------------------------------------
+//
+void CVcxMyVideosMdsDb::DoCreateVideoListL( TVcxMyVideosSortingOrder aSortingOrder,
+ TBool aAscending, TBool aFullDetails, CMPXMedia*& aVideoList )
+ {
+ MPX_FUNC( "CVcxMyVideosMdsDb::DoCreateVideoListL" );
+
+ if ( !iMdsSession )
{
- MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session(%d), leaving", iMDSError);
- User::Leave( iMDSError );
+ MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session(%d), leaving", iMdsError);
+ User::Leave( iMdsError );
}
if ( iVideoListFetchingIsOngoing )
@@ -405,7 +445,7 @@
delete iVideoQuery;
iVideoQuery = NULL;
- iVideoQuery = iMDSSession->NewObjectQueryL(
+ iVideoQuery = iMdsSession->NewObjectQueryL(
*iNamespaceDef,
*iVideoObjectDef,
this);
@@ -550,38 +590,48 @@
// ---------------------------------------------------------------------------
//
void CVcxMyVideosMdsDb::HandleQueryCompleted(
-#if _DEBUG
- CMdEQuery& aQuery,
-#else
CMdEQuery& /*aQuery*/,
-#endif
TInt /*aError*/)
{
- MPX_FUNC( "CVcxMyVideosMdsDb::HandleQueryCompleted" );
+ iAsyncHandleQueryCompleteCaller->CallBack();
+ }
- if ( !iVideoList )
+// ---------------------------------------------------------------------------
+// CVcxMyVideosMdsDb::AsyncHandleQueryCompleted
+// ---------------------------------------------------------------------------
+//
+TInt CVcxMyVideosMdsDb::AsyncHandleQueryCompleted( TAny* aThis )
+ {
+ MPX_FUNC( "CVcxMyVideosMdsDb::AsyncHandleQueryCompleted" );
+
+ CVcxMyVideosMdsDb* thisObj = static_cast<CVcxMyVideosMdsDb*>( aThis );
+
+ if ( !thisObj->iVideoList )
{
MPX_DEBUG1("CVcxMyVideosMdsDb:: iVideoList is NULL, should never happen");
- return;
+ return KErrNone;
}
#ifdef _DEBUG
- CMPXMediaArray* array = iVideoList->Value<CMPXMediaArray>( KMPXMediaArrayContents );
+ CMPXMediaArray* array = thisObj->iVideoList->Value<CMPXMediaArray>( KMPXMediaArrayContents );
#endif
- MPX_DEBUG2("CVcxMyVideosMdsDb:: query contains %d items", aQuery.Count());
+ MPX_DEBUG2("CVcxMyVideosMdsDb:: query contains %d items", thisObj->iVideoQuery->Count());
MPX_DEBUG2("CVcxMyVideosMdsDb:: iVideoList contains %d items", array->Count());
- if (iActiveSchedulerWait->IsStarted())
+ if ( thisObj->iActiveSchedulerWait->IsStarted() )
{
- iActiveSchedulerWait->AsyncStop();
+ thisObj->iActiveSchedulerWait->AsyncStop();
}
- iVideoListFetchingIsOngoing = EFalse;
- iMdsDbObserver->HandleCreateVideoListResp( iVideoList, KErrNotFound /* KErrNotFound = no new items */,
+ thisObj->iVideoListFetchingIsOngoing = EFalse;
+ thisObj->iMdsDbObserver->HandleCreateVideoListResp( thisObj->iVideoList, KErrNotFound /* KErrNotFound = no new items */,
ETrue /* complete */);
- iVideoList = NULL; // not owned by us -> just clear
+ thisObj->iVideoList = NULL; // not owned by us -> just clear
+
+ thisObj->iCmdQueue->CmdFinished();
+ return KErrNone;
}
// ---------------------------------------------------------------------------
@@ -628,9 +678,9 @@
{
MPX_DEBUG2( "CVcxMyVideosMdsDb::HandleSessionOpened: %d", aError );
- iMDSError = aError;
- delete iMDSSession;
- iMDSSession = NULL;
+ iMdsError = aError;
+ delete iMdsSession;
+ iMdsSession = NULL;
}
}
@@ -662,9 +712,9 @@
MPX_DEBUG2( "CVcxMyVideosMdsDb::HandleSessionError: %d", aError );
- iMDSError = aError;
- delete iMDSSession;
- iMDSSession = NULL;
+ iMdsError = aError;
+ delete iMdsSession;
+ iMdsSession = NULL;
}
// ---------------------------------------------------------------------------
@@ -676,7 +726,7 @@
TObserverNotificationType aType,
const RArray<TItemId>& aObjectIdArray)
{
- TRAP( iMDSError, DoHandleObjectNotificationL( aType, aObjectIdArray ));
+ TRAP( iMdsError, DoHandleObjectNotificationL( aType, aObjectIdArray ));
}
// ---------------------------------------------------------------------------
@@ -685,20 +735,20 @@
//
CMdEObject* CVcxMyVideosMdsDb::ObjectL( const TItemId aId )
{
- if ( !iMDSSession )
+ if ( !iMdsSession )
{
- MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session(%d), leaving", iMDSError);
- User::Leave( iMDSError );
+ MPX_DEBUG2("CVcxMyVideosMdsDb:: no mds session(%d), leaving", iMdsError);
+ User::Leave( iMdsError );
}
// If the id is not valid, just return NULL, because
- // iMDSSession->GetObjectL leaves in that case
+ // iMdsSession->GetObjectL leaves in that case
if ( aId == KNoId )
{
return NULL;
}
- CMdEObject* object = iMDSSession->GetObjectL( aId, *iVideoObjectDef );
+ CMdEObject* object = iMdsSession->GetObjectL( aId, *iVideoObjectDef );
if ( object )
{
@@ -1385,7 +1435,7 @@
MPX_FUNC( "CVcxMyVideosMdsDb::GetSchemaDefinitionsL" );
// Namespace
- iNamespaceDef = &(iMDSSession->GetDefaultNamespaceDefL());
+ iNamespaceDef = &(iMdsSession->GetDefaultNamespaceDefL());
// Default object definitions
iVideoObjectDef = &(iNamespaceDef->GetObjectDefL( KVcxVideoObjectName ));
@@ -1420,9 +1470,9 @@
iRatingPropertyDef = &(iVideoObjectDef->GetPropertyDefL(
KVcxRatingPropertyName )); //19
iBitratePropertyDef = &(iVideoObjectDef->GetPropertyDefL(
- KVcxBitratePropertyName )); //20
+ KVcxBitratePropertyName )); //20
iAudioFourCcPropertyDef = &(iVideoObjectDef->GetPropertyDefL(
- KVcxAudioFourCcPropertyName )); //21
+ KVcxAudioFourCcPropertyName )); //21
iWidthPropertyDef = &(iVideoObjectDef->GetPropertyDefL(
KVcxWidthPropertyName )); //22
iHeightPropertyDef = &(iVideoObjectDef->GetPropertyDefL(
--- a/videocollection/mpxmyvideoscollection/src/vcxmyvideosvideocache.cpp Tue Feb 02 00:12:10 2010 +0200
+++ b/videocollection/mpxmyvideoscollection/src/vcxmyvideosvideocache.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -11,12 +11,11 @@
*
* Contributors:
*
-* Description: Video list cache. Contains cached data from MDS.*
+* Description: Video list cache. Contains cached data from MDS.*
*/
-
// INCLUDE FILES
#include <mpxlog.h>
#include <mpxmedia.h>
@@ -385,6 +384,8 @@
{
MPX_DEBUG2("CVcxMyVideosVideoCache:: MDSID(%d) not found from cache, ok", aMdsIds[j]);
+ //TODO: This doesnt work with new mds cmd queue. Cancel must be done if there is _any_ async req going on.
+ // Maybe the fetching could be changed to asynchronous...
if ( iCollection.iMyVideosMdsDb->iVideoListFetchingIsOngoing )
{
// If list fetching is not canceled, CreateVideoObjectL will leave with KErrNotReady.
@@ -588,7 +589,7 @@
TVcxMyVideosSortingOrder sortingOrder = SortingOrderL();
- if ( iCollection.iMyVideosMdsDb->iVideoListFetchingIsOngoing
+ if ( IsFetchingVideoList
&& sortingOrder == iLastSortingOrder && !aForce )
{
MPX_DEBUG1("CVcxMyVideosVideoCache:: iVideoList creation is already ongoing, skipping");
@@ -599,10 +600,11 @@
{
MPX_DEBUG1("CVcxMyVideosVideoCache:: iVideoList was partial or in wrong order or aForce was ETrue, recreating");
- if ( iCollection.iMyVideosMdsDb->iVideoListFetchingIsOngoing )
+ if ( IsFetchingVideoList )
{
MPX_DEBUG1("CVcxMyVideosVideoCache:: video list fetching is ongoing, canceling it");
- iCollection.iMyVideosMdsDb->Cancel();
+ iCollection.iMyVideosMdsDb->Cancel( CVcxMyVideosMdsDb::EGetVideoList );
+ IsFetchingVideoList = EFalse;
}
ResetVideoListL();
@@ -628,6 +630,7 @@
EFalse /* brief list */,
iVideoList /* use existing */ );
+ IsFetchingVideoList = ETrue;
iLastSortingOrder = sortingOrder;
iVideoListIsPartial = ETrue;
}
@@ -1030,7 +1033,7 @@
}
}
- // 23
+ // 22
if ( aVideo.IsSupported( KMPXMediaVideoHeight ) )
{
TUint16 height = aVideo.ValueTObjectL<TUint16>( KMPXMediaVideoHeight );
@@ -1491,7 +1494,8 @@
{
MPX_FUNC("CVcxMyVideosVideoCache::ResetVideoListL");
- iCollection.iMyVideosMdsDb->Cancel();
+ //TODO: when should we cancel...
+ //iCollection.iMyVideosMdsDb->Cancel();
CMPXMediaArray* mediaArray =
iVideoList->ValueCObjectL<CMPXMediaArray>( KMPXMediaArrayContents );
Binary file videocollection/videocollectionview/conf/s60.confml has changed
Binary file videocollection/videocollectionview/conf/videolistview.confml has changed
Binary file videocollection/videocollectionview/conf/videolistview_2002BC63.crml has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/data/collectionview.docml Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<hbdocument version="0.9">
+ <object name="vc:mAddtoCollection" type="HbAction">
+ <string locid="Add to collection..." name="text"/>
+ </object>
+ <object name="vc:mCreateNewCollection" type="HbAction">
+ <string locid="Create new collection..." name="text"/>
+ </object>
+ <object name="vc:mDeleteMultiple" type="HbAction">
+ <string locid="Delete..." name="text"/>
+ </object>
+ <object name="vc:mDate" type="HbAction">
+ <string locid="Date" name="text"/>
+ </object>
+ <object name="vc:mName" type="HbAction">
+ <string locid="Name" name="text"/>
+ </object>
+ <object name="vc:mNumberOfItems" type="HbAction">
+ <string locid="Number of items" name="text"/>
+ </object>
+ <object name="vc:mTotalLength" type="HbAction">
+ <string locid="Total length" name="text"/>
+ </object>
+ <object name="vc:mSize" type="HbAction">
+ <string locid="Size" name="text"/>
+ </object>
+ <widget name="view" type="VideoListView">
+ <widget name="vc:mOptionsMenu" role="HbView:menu" type="HbMenu">
+ <ref object="vc:mAddtoCollection" role="HbMenu:addAction"/>
+ <ref object="vc:mCreateNewCollection" role="HbMenu:addAction"/>
+ <ref object="vc:mDeleteMultiple" role="HbMenu:addAction"/>
+ <widget name="vc:mSortBy" role="HbMenu:menu" type="HbMenu">
+ <ref object="vc:mDate" role="HbMenu:addAction"/>
+ <ref object="vc:mName" role="HbMenu:addAction"/>
+ <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"/>
+ </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"/>
+ <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="MAXIMUM" width="2504062.01158un"/>
+ <bool name="visible" value="TRUE"/>
+ <string name="plainText" value="(No videos)"/>
+ <sizehint height="6un" type="PREFERRED"/>
+ </widget>
+ <widget name="vc:mHintTextLabel" type="HbLabel">
+ <enums name="textWrapping" value="TextWordWrap"/>
+ <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
+ <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"/>
+ </widget>
+ <widget name="vc:mHintButtonLayout" type="HbWidget">
+ <widget name="vc:mHintButton" type="HbPushButton">
+ <real name="z" value="1"/>
+ <sizehint height="6un" type="MAXIMUM" width="12un"/>
+ <bool name="visible" value="TRUE"/>
+ <sizehint type="PREFERRED" width="12un"/>
+ </widget>
+ <real name="z" value="0"/>
+ <sizehint height="11.9403un" type="PREFERRED" width="23.8806un"/>
+ <layout orientation="Horizontal" type="linear">
+ <stretchitem stretchfactor="1"/>
+ <linearitem itemname="vc:mHintButton"/>
+ <stretchitem stretchfactor="1"/>
+ </layout>
+ </widget>
+ <real name="z" value="0"/>
+ <sizehint height="23.8806un" type="PREFERRED" width="23.8806un"/>
+ <layout orientation="Vertical" type="linear">
+ <stretchitem stretchfactor="1"/>
+ <linearitem itemname="vc:mNoVideosLabel"/>
+ <linearitem itemname="vc:mHintTextLabel"/>
+ <linearitem itemname="vc:mHintButtonLayout"/>
+ <stretchitem stretchfactor="1"/>
+ </layout>
+ </widget>
+ <real name="z" value="0"/>
+ <sizehint height="23.8806un" type="PREFERRED" width="23.8806un"/>
+ <layout type="stacked">
+ <stackitem itemname="vc:mListWidget"/>
+ <stackitem itemname="vc:mHintWidget"/>
+ </layout>
+ </widget>
+ <layout orientation="Vertical" type="linear">
+ <linearitem itemname="vc:mBanner"/>
+ <linearitem itemname="vc:mStackedLayout"/>
+ </layout>
+ </widget>
+ </widget>
+ <metadata activeUIState="Common ui state" display="QHD 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/images/mono_video_addvideos.svg Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generator: Mobile Designer 3.0 2.0 -->
+<svg width="40" height="40" viewBox="0 0 40 40"
+ stroke-miterlimit="2" enable-background="new" zoomAndPan="disable"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:ev="http://www.w3.org/2001/xml-events"
+ xml:space="preserve" version="1.1" baseProfile="Normal">
+
+<!-- Scene 1 -->
+<g id="Scene_1">
+ <rect x="0" y="0" width="40" height="40" opacity="0.5019" fill="none"/>
+ <path
+ d="M16 28 c0 -0.33 0.02 -0.67 0.05 -1 h-3.05 v-16
+ h12 v5.39 c0.96 -0.24 1.96 -0.39 3 -0.39 v-2
+ h3 v2.39 c1.06 0.27 2.07 0.68 3 1.22 v-14.61
+ h-3 v3 h-3 v-3 h-3 v5
+ h-12 v-5 h-3 v3 h-3 v-3
+ h-3 v32 h3 v-3 h3 v3
+ h3 v-5 h3.18 c-0.1 -0.65 -0.17 -1.31 -0.17 -2
+ Z M28 8 h3 v4 h-3 v-4 Z M10 30
+ h-3 v-4 h3 v4 Z M10 24 h-3
+ v-4 h3 v4 Z M10 18 h-3 v-4
+ h3 v4 Z M10 12 h-3 v-4 h3
+ v4 Z"/>
+ <rect x="19.5" y="24.2" width="18.37" height="5.51"/>
+ <rect x="25.87" y="19.37" width="5.87" height="16.24"/>
+</g>
+
+</svg>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/data/images/mono_video_removevideos.svg Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generator: Mobile Designer 3.0 2.0 -->
+<svg width="40" height="40" viewBox="0 0 40 40"
+ stroke-miterlimit="2" enable-background="new" zoomAndPan="disable"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:ev="http://www.w3.org/2001/xml-events"
+ xml:space="preserve" version="1.1" baseProfile="Normal">
+
+<!-- Scene 1 -->
+<g id="Scene_1">
+ <rect x="0" y="0" width="40" height="40" opacity="0.5019" fill="none"/>
+ <path
+ d="M16 28 c0 -0.33 0.02 -0.67 0.05 -1 h-3.05 v-16
+ h12 v5.39 c0.96 -0.24 1.96 -0.39 3 -0.39 v-2
+ h3 v2.39 c1.06 0.27 2.07 0.68 3 1.22 v-14.61
+ h-3 v3 h-3 v-3 h-3 v5
+ h-12 v-5 h-3 v3 h-3 v-3
+ h-3 v32 h3 v-3 h3 v3
+ h3 v-5 h3.18 c-0.1 -0.65 -0.17 -1.31 -0.17 -2
+ Z M28 8 h3 v4 h-3 v-4 Z M10 30
+ h-3 v-4 h3 v4 Z M10 24 h-3
+ v-4 h3 v4 Z M10 18 h-3 v-4
+ h3 v4 Z M10 12 h-3 v-4 h3
+ v4 Z"/>
+ <rect x="19.5" y="24.2" width="18.37" height="5.51"/>
+</g>
+
+</svg>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/data/images/mono_video_sortvideos.svg Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generator: Mobile Designer 3.0 2.0 -->
+<svg width="40" height="40" viewBox="0 0 40 40"
+ stroke-miterlimit="2" enable-background="new" zoomAndPan="disable"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:ev="http://www.w3.org/2001/xml-events"
+ xml:space="preserve" version="1.1" baseProfile="Normal">
+
+<!-- Scene 1 -->
+<g id="Scene_1">
+ <rect x="0" y="0" width="40" height="40" opacity="0.5019" fill="none"/>
+ <path
+ d="M16 28 c0 -0.33 0.02 -0.67 0.05 -1 h-3.05 v-16
+ h12 v5.39 c0.96 -0.24 1.96 -0.39 3 -0.39 v-2
+ h3 v2.39 c1.06 0.27 2.07 0.68 3 1.22 v-14.61
+ h-3 v3 h-3 v-3 h-3 v5
+ h-12 v-5 h-3 v3 h-3 v-3
+ h-3 v32 h3 v-3 h3 v3
+ h3 v-5 h3.18 c-0.1 -0.65 -0.17 -1.31 -0.17 -2
+ Z M28 8 h3 v4 h-3 v-4 Z M10 30
+ h-3 v-4 h3 v4 Z M10 24 h-3
+ v-4 h3 v4 Z M10 18 h-3 v-4
+ h3 v4 Z M10 12 h-3 v-4 h3
+ v4 Z"/>
+ <ellipse cx="19.87" cy="19.49" rx="2.74" ry="2.62"/>
+ <ellipse cx="26.24" cy="25.37" rx="2.74" ry="2.62"/>
+ <ellipse cx="32.75" cy="31.74" rx="2.74" ry="2.62"/>
+</g>
+
+</svg>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/data/images/qtg_mono_video_all.svg Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+ <!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
+]>
+<svg version="1.1"
+ xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
+ x="0px" y="0px" width="40px" height="40px" viewBox="0 0 40 40" enable-background="new 0 0 40 40" xml:space="preserve">
+<defs>
+</defs>
+<rect opacity="0.5" fill="none" width="40" height="40"/>
+<path d="M33,4v3h-3V4h-3v5H13V4h-3v3H7V4H4v32h3v-3h3v3h3v-5h14v5h3v-3h3v3h3V4H33z M33,9v4h-3V9H33z M30,21h3v4h-3V21z M30,19v-4h3
+ v4H30z M10,9v4H7V9H10z M7,21h3v4H7V21z M7,19v-4h3v4H7z M7,31v-4h3v4H7z M13,28V12h14v16H13z M30,31v-4h3v4H30z"/>
+</svg>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/data/images/qtg_mono_video_collection.svg Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+ <!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
+]>
+<svg version="1.1"
+ xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
+ x="0px" y="0px" width="40px" height="40px" viewBox="0 0 40 40" enable-background="new 0 0 40 40" xml:space="preserve">
+<defs>
+</defs>
+<rect opacity="0.5" fill="none" width="40" height="40"/>
+<polygon points="35,8 17,8 17,5 3,5 3,11 35,11 "/>
+<polygon points="17,16 34,16 37,16 37,13 3,13 3,33 17,33 17,30 6,30 6,16 "/>
+<path d="M37,18v2h-2v-2h-2v3h-8v-3h-2v2h-2v-2h-2v21h2v-2h2v2h2v-3h8v3h2v-2h2v2h2V18H37z M23,35h-2v-3h2V35z M23,30h-2v-3h2V30z
+ M23,25h-2v-3h2V25z M33,33h-8v-9h8V33z M37,35h-2v-3h2V35z M37,30h-2v-3h2V30z M37,25h-2v-3h2V25z"/>
+</svg>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/data/images/qtg_mono_video_services.svg Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+ <!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
+]>
+<svg version="1.1"
+ xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
+ x="0px" y="0px" width="40px" height="40px" viewBox="0 0 40 40" enable-background="new 0 0 40 40" xml:space="preserve">
+<defs>
+</defs>
+<rect opacity="0.5" fill="none" width="40" height="40"/>
+<path d="M16,28c0-0.338,0.023-0.67,0.05-1H13V11h12v5.394C25.961,16.146,26.963,16,28,16v-2h3v2.394
+ c1.064,0.275,2.072,0.687,3,1.225V3h-3v3h-3V3h-3v5H13V3h-3v3H7V3H4v32h3v-3h3v3h3v-5h3.18C16.07,29.348,16,28.684,16,28z M28,8h3v4
+ h-3V8z M10,30H7v-4h3V30z M10,24H7v-4h3V24z M10,18H7v-4h3V18z M10,12H7V8h3V12z"/>
+<path d="M28,18c-5.523,0-10,4.476-10,10s4.477,10,10,10s10-4.477,10-10S33.523,18,28,18z M21.457,32.588
+ c-0.553-0.787-0.965-1.678-1.208-2.637l1.17-0.23l1,2L21.457,32.588z M33.082,34.174l-0.502-0.453l1-2l1.346,0.264
+ C34.445,32.82,33.822,33.563,33.082,34.174z M33.869,24.801l-1.148-0.443l0.652,0.885l0.469-0.207c0,0,0.574,0.547,0.547,0.729
+ c-0.025,0.184-0.885,1.018-0.885,1.018l-0.754,0.268l-0.994-0.816L31,25.607l0.469,1.121l0.627,0.652c0,0,1.096-0.156,1.252-0.027
+ c0.156,0.131-0.209,1.123-0.209,1.123l-1.826,1.877l-0.182,1.877c-1.018,0.523-1.121,1.328-1.121,1.328s-0.262-0.051-0.939,0.707
+ c-0.678,0.754-1.408,0.557-1.408,0.557c-0.861,0-1.018-0.557-1.018-0.74c0-0.182-0.859-1.59-0.859-2.061
+ c0-0.469,0.26-1.043,0.26-1.043c0.053-0.678-0.678-2.502-0.678-2.502h-0.756l-0.262-0.574c-2.449,0.521-2.555-0.105-2.92-0.783
+ s0.053-2.502,0.287-2.789c0.15-0.184,0.949-0.76,1.506-1.152L28.936,25l1-2l-4-1l-2.23,0.84c0.043-0.029,0.072-0.049,0.072-0.049
+ l-0.234-0.34c-0.158-0.338,0.859-0.807,0.859-0.807c0.393,0.262,0.652,0,0.652,0l0.104-0.262l-0.104-0.39l0.484-0.602
+ C26.314,20.139,27.141,20,28,20c0.9,0,1.762,0.156,2.568,0.432L30,21l1,1l0.947-0.947c2.096,1.197,3.602,3.314,3.961,5.799
+ c-0.418-0.84-0.762-1.816-0.762-1.816L33.869,24.801z"/>
+</svg>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/data/images/services_icon.svg Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+ <!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
+]>
+<svg version="1.1"
+ xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
+ x="0px" y="0px" width="40px" height="40px" viewBox="0 0 40 40" enable-background="new 0 0 40 40" xml:space="preserve">
+<defs>
+</defs>
+<rect opacity="0.5" fill="none" width="40" height="40"/>
+<path d="M16,28c0-0.338,0.023-0.67,0.05-1H13V11h12v5.394C25.961,16.146,26.963,16,28,16v-2h3v2.394
+ c1.064,0.275,2.072,0.687,3,1.225V3h-3v3h-3V3h-3v5H13V3h-3v3H7V3H4v32h3v-3h3v3h3v-5h3.18C16.07,29.348,16,28.684,16,28z M28,8h3v4
+ h-3V8z M10,30H7v-4h3V30z M10,24H7v-4h3V24z M10,18H7v-4h3V18z M10,12H7V8h3V12z"/>
+<path d="M28,18c-5.523,0-10,4.476-10,10s4.477,10,10,10s10-4.477,10-10S33.523,18,28,18z M21.457,32.588
+ c-0.553-0.787-0.965-1.678-1.208-2.637l1.17-0.23l1,2L21.457,32.588z M33.082,34.174l-0.502-0.453l1-2l1.346,0.264
+ C34.445,32.82,33.822,33.563,33.082,34.174z M33.869,24.801l-1.148-0.443l0.652,0.885l0.469-0.207c0,0,0.574,0.547,0.547,0.729
+ c-0.025,0.184-0.885,1.018-0.885,1.018l-0.754,0.268l-0.994-0.816L31,25.607l0.469,1.121l0.627,0.652c0,0,1.096-0.156,1.252-0.027
+ c0.156,0.131-0.209,1.123-0.209,1.123l-1.826,1.877l-0.182,1.877c-1.018,0.523-1.121,1.328-1.121,1.328s-0.262-0.051-0.939,0.707
+ c-0.678,0.754-1.408,0.557-1.408,0.557c-0.861,0-1.018-0.557-1.018-0.74c0-0.182-0.859-1.59-0.859-2.061
+ c0-0.469,0.26-1.043,0.26-1.043c0.053-0.678-0.678-2.502-0.678-2.502h-0.756l-0.262-0.574c-2.449,0.521-2.555-0.105-2.92-0.783
+ s0.053-2.502,0.287-2.789c0.15-0.184,0.949-0.76,1.506-1.152L28.936,25l1-2l-4-1l-2.23,0.84c0.043-0.029,0.072-0.049,0.072-0.049
+ l-0.234-0.34c-0.158-0.338,0.859-0.807,0.859-0.807c0.393,0.262,0.652,0,0.652,0l0.104-0.262l-0.104-0.39l0.484-0.602
+ C26.314,20.139,27.141,20,28,20c0.9,0,1.762,0.156,2.568,0.432L30,21l1,1l0.947-0.947c2.096,1.197,3.602,3.314,3.961,5.799
+ c-0.418-0.84-0.762-1.816-0.762-1.816L33.869,24.801z"/>
+</svg>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/data/images/services_icon_pressed.svg Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+ <!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
+]>
+<svg version="1.1"
+ xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
+ x="0px" y="0px" width="40px" height="40px" viewBox="0 0 40 40" enable-background="new 0 0 40 40" xml:space="preserve">
+<defs>
+</defs>
+<rect opacity="0.5" fill="none" width="40" height="40"/>
+<path d="M16,28c0-0.338,0.023-0.67,0.05-1H13V11h12v5.394C25.961,16.146,26.963,16,28,16v-2h3v2.394
+ c1.064,0.275,2.072,0.687,3,1.225V3h-3v3h-3V3h-3v5H13V3h-3v3H7V3H4v32h3v-3h3v3h3v-5h3.18C16.07,29.348,16,28.684,16,28z M28,8h3v4
+ h-3V8z M10,30H7v-4h3V30z M10,24H7v-4h3V24z M10,18H7v-4h3V18z M10,12H7V8h3V12z"/>
+<path d="M28,18c-5.523,0-10,4.476-10,10s4.477,10,10,10s10-4.477,10-10S33.523,18,28,18z M21.457,32.588
+ c-0.553-0.787-0.965-1.678-1.208-2.637l1.17-0.23l1,2L21.457,32.588z M33.082,34.174l-0.502-0.453l1-2l1.346,0.264
+ C34.445,32.82,33.822,33.563,33.082,34.174z M33.869,24.801l-1.148-0.443l0.652,0.885l0.469-0.207c0,0,0.574,0.547,0.547,0.729
+ c-0.025,0.184-0.885,1.018-0.885,1.018l-0.754,0.268l-0.994-0.816L31,25.607l0.469,1.121l0.627,0.652c0,0,1.096-0.156,1.252-0.027
+ c0.156,0.131-0.209,1.123-0.209,1.123l-1.826,1.877l-0.182,1.877c-1.018,0.523-1.121,1.328-1.121,1.328s-0.262-0.051-0.939,0.707
+ c-0.678,0.754-1.408,0.557-1.408,0.557c-0.861,0-1.018-0.557-1.018-0.74c0-0.182-0.859-1.59-0.859-2.061
+ c0-0.469,0.26-1.043,0.26-1.043c0.053-0.678-0.678-2.502-0.678-2.502h-0.756l-0.262-0.574c-2.449,0.521-2.555-0.105-2.92-0.783
+ s0.053-2.502,0.287-2.789c0.15-0.184,0.949-0.76,1.506-1.152L28.936,25l1-2l-4-1l-2.23,0.84c0.043-0.029,0.072-0.049,0.072-0.049
+ l-0.234-0.34c-0.158-0.338,0.859-0.807,0.859-0.807c0.393,0.262,0.652,0,0.652,0l0.104-0.262l-0.104-0.39l0.484-0.602
+ C26.314,20.139,27.141,20,28,20c0.9,0,1.762,0.156,2.568,0.432L30,21l1,1l0.947-0.947c2.096,1.197,3.602,3.314,3.961,5.799
+ c-0.418-0.84-0.762-1.816-0.762-1.816L33.869,24.801z"/>
+</svg>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/data/videocollectionview.qrc Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,16 @@
+<RCC>
+ <qresource prefix="/layout" >
+ <file alias="collectionview.docml">collectionview.docml</file>
+ <file alias="videolistselectiondialog.docml">videolistselectiondialog.docml</file>
+ </qresource>
+ <qresource prefix="/" >
+ <file>images/qtg_mono_video_all.svg</file>
+ <file>images/qtg_mono_video_collection.svg</file>
+ <file>images/qtg_mono_video_services.svg</file>
+ <file>images/mono_video_addvideos.svg</file>
+ <file>images/mono_video_removevideos.svg</file>
+ <file>images/mono_video_sortvideos.svg</file>
+ <file>images/services_icon.svg</file>
+ <file>images/services_icon_pressed.svg</file>
+ </qresource>
+</RCC>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/data/videolistselectiondialog.docml Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<hbdocument version="0.8">
+ <widget name="mMultiSelectionDialog" type="VideoListSelectionDialog">
+ <widget name="mHeadingWidget" role="HbDialog:headingWidget" type="HbWidget">
+ <widget name="mHeadingLabel" type="HbLabel">
+ <sizehint height="3.9un" type="PREFERRED"/>
+ <string name="plainText" value="Label"/>
+ <fontspec name="fontSpec" role="Primary" textpaneheight="26.8"/>
+ </widget>
+ <widget name="mCheckBoxContainer" type="HbWidget">
+ <widget name="mCheckMarkAll" type="HbCheckBox">
+ <sizehint type="PREFERRED" width="30.20844un"/>
+ <string name="text" value="Mark All"/>
+ <fontspec name="fontSpec" role="Secondary" textpaneheight="23.45"/>
+ </widget>
+ <widget name="mSelectionCount" type="HbLabel">
+ <enums name="alignment" value="AlignRight"/>
+ <sizehint height="4.5un" type="PREFERRED" width="20.22703un"/>
+ <string name="plainText" value="Label"/>
+ </widget>
+ <real name="z" value="2"/>
+ <sizehint height="6un" type="PREFERRED" width="23.8806un"/>
+ <bool name="focusLooping" value="FALSE"/>
+ <layout type="anchor">
+ <anchoritem dst="mSelectionCount" dstEdge="RIGHT" spacing="0un" src="" srcEdge="RIGHT"/>
+ <anchoritem dst="mSelectionCount" dstEdge="TOP" spacing="0.5un" src="" srcEdge="TOP"/>
+ <anchoritem dst="mCheckMarkAll" dstEdge="TOP" spacing="0.5un" src="" srcEdge="TOP"/>
+ <anchoritem dst="mCheckMarkAll" dstEdge="RIGHT" spacing="-0.5un" src="mSelectionCount" srcEdge="LEFT"/>
+ <anchoritem dst="mCheckMarkAll" dstEdge="LEFT" spacing="0un" src="" srcEdge="LEFT"/>
+ </layout>
+ </widget>
+ <real name="z" value="0"/>
+ <contentsmargins bottom="1un" left="0un" right="0un" top="1un"/>
+ <layout orientation="Vertical" spacing="1un" type="linear">
+ <linearitem itemname="mHeadingLabel"/>
+ <linearitem itemname="mCheckBoxContainer"/>
+ </layout>
+ </widget>
+ <widget name="mListContainer" role="HbDialog:contentWidget" type="HbStackedWidget"/>
+ <sizehint height="95.22388un" type="PREFERRED" width="53.58209un"/>
+ </widget>
+ <metadata activeUIState="Common ui state" display="QHD 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/inc/videocollectionuiloader.h Thu Apr 01 22:38:49 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:
+*
+*/
+
+#ifndef _VIDEOCOLLECTIONUILOADER_H_
+#define _VIDEOCOLLECTIONUILOADER_H_
+
+// System includes
+#include <hbdocumentloader.h>
+
+// Constants
+static const char* DOCML_VIDEOCOLLECTIONVIEW_FILE = ":/layout/collectionview.docml";
+static const char* DOCML_NAME_VIEW = "view";
+
+// Videocollection View
+static const char* DOCML_NAME_VC_HEADINGBANNER = "vc:mBanner";
+static const char* DOCML_NAME_VC_VIDEOLISTWIDGET = "vc:mListWidget";
+static const char* DOCML_NAME_VC_VIDEOHINTWIDGET = "vc:mHintWidget";
+
+// Videocollection Options Menu
+static const char* DOCML_NAME_OPTIONS_MENU = "vc:mOptionsMenu";
+static const char* DOCML_NAME_SORT_MENU = "vc:mSortBy";
+
+static const char* DOCML_NAME_SORT_BY_DATE = "vc:mDate";
+static const char* DOCML_NAME_SORT_BY_NAME = "vc:mName";
+static const char* DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS = "vc:mNumberOfItems";
+static const char* DOCML_NAME_SORT_BY_TOTAL_LENGTH = "vc:mTotalLength";
+static const char* DOCML_NAME_SORT_BY_RATING = "vc:mRating";
+static const char* DOCML_NAME_SORT_BY_SIZE = "vc:mSize";
+
+static const char* DOCML_NAME_ADD_TO_COLLECTION = "vc:mAddtoCollection";
+static const char* DOCML_NAME_CREATE_COLLECTION = "vc:mCreateNewCollection";
+static const char* DOCML_NAME_DELETE_MULTIPLE = "vc:mDeleteMultiple";
+
+static const char* DOCML_NAME_PLAY_IN_QUEUE = "vc:mPlayInQueue";
+static const char* DOCML_NAME_PLAY_ALL_ITEMS = "vc:mPlayAllItems";
+
+// Videocollection hint widget
+static const char* DOCML_NAME_HINT_BUTTON = "vc:mHintButton";
+static const char* DOCML_NAME_HINT_LABEL = "vc:mHintTextLabel";
+
+// 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_MARKALL = "mCheckMarkAll";
+static const char* DOCML_NAME_LBL_SELECTION = "mSelectionCount";
+static const char* DOCML_NAME_LIST_CONTAINER = "mListContainer";
+
+
+// Class declaration
+class VideoCollectionUiLoader : public HbDocumentLoader
+{
+
+public:
+
+ VideoCollectionUiLoader();
+
+ ~VideoCollectionUiLoader();
+
+ /**
+ * Returns the requested widget casted to correct type
+ *
+ * @param name Name of the widget
+ * @return Pointer to the widget
+ */
+ template<class T>
+ T* findWidget( QString name )
+ {
+ return qobject_cast<T*>( HbDocumentLoader::findWidget( name ) );
+ }
+
+ /**
+ * Returns the requested object casted to correct type
+ *
+ * @param name Name of the object
+ * @return Pointer to the object
+ */
+ template<class T>
+ T* findObject( QString name )
+ {
+ return qobject_cast<T*>( HbDocumentLoader::findObject( name ) );
+ }
+
+private:
+
+ QObject *createObject( const QString& type, const QString &name );
+};
+
+#endif // _VIDEOCOLLECTIONUILOADER_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/inc/videocollectionviewplugin.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,132 @@
+/*
+* 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
+
+
+// INCLUDES
+#include <qobject>
+#include <mpxviewpluginqt.h>
+#include <qpointer.h>
+
+class HbAction;
+class VideoCollectionUiLoader;
+class VideoListView;
+
+
+class VideoCollectionViewPlugin : public MpxViewPlugin
+ {
+
+ Q_OBJECT
+
+public: // Constructor / destructor
+
+ /**
+ * 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
+ *
+ * @return QGraphicsWidget*
+ */
+ QGraphicsWidget* getView();
+
+signals:
+ /**
+ * Command signal, plugin user shoulf connect this in case it wants
+ * to receive commands emitted from the view.
+ *
+ * @param command id
+ */
+ void command( int );
+
+public slots: // from QViewPlugin
+
+ /**
+ * Plugin user can notify orientation changes by connecting into this slot
+ * ti it's signal. In normal cases, view handles orientation chages itself.
+ *
+ * @param orientation new 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/inc/videocollectionviewutils.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,103 @@
+/*
+* 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: video collection view plugin's ui utils class
+*
+*/
+
+#ifndef __VIDEOCOLLECTIONVIEWUTILS_H__
+#define __VIDEOCOLLECTIONVIEWUTILS_H__
+
+#include <qobject.h>
+
+class VideoCollectionViewUtils : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * 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 VideoCollectionViewUtils& instance();
+
+ /**
+ * Saves the sorting role and order to cenrep.
+ *
+ * @param role The sorting role.
+ * @param order The sorting order (e.g. ascending or descending).
+ * @return Zero if operation succeeded, less than zero in error cases.
+ */
+ int saveSortingValues(int role, Qt::SortOrder order);
+
+ /**
+ * Loads the sorting role and order from cenrep.
+ *
+ * @param role On return contains the sorting role.
+ * @param order On return contains the sorting order
+ * @return Zero if operation succeeded, less than zero in error cases.
+ */
+ int loadSortingValues(int& role, Qt::SortOrder& order);
+
+ /**
+ * Get service icon resource strings from cenrep.
+ *
+ * @param icon On return contains the resource string for icon image.
+ * @param iconPressed On return contains the resource string for pressed icon image.
+ * @return Zero if operation succeeded, less than zero in error cases.
+ */
+ int getServiceIconStrings(QString& icon, QString& iconPressed);
+
+ /**
+ * Get service URI string.
+ *
+ * @return Service URI string. Invalid string in error cases.
+ */
+ QString getServiceUriString();
+
+public slots:
+
+ /**
+ * Shows status msgs
+ *
+ * @param statusCode status code
+ * @param additional additional data gotten from the status
+ */
+ void showStatusMsgSlot(int statusCode, QVariant &additional);
+
+private:
+
+ /**
+ * disables copy-constructor and assingment operator
+ */
+ Q_DISABLE_COPY(VideoCollectionViewUtils)
+
+ /**
+ * constructor
+ */
+ VideoCollectionViewUtils();
+
+ /**
+ * destructor
+ */
+ virtual ~VideoCollectionViewUtils();
+
+
+};
+
+#endif //__VIDEOCOLLECTIONUIUTILS_H__
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/inc/videohintwidget.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,147 @@
+/*
+* 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 hint widget
+*
+*/
+
+
+#ifndef VIDEOHINTWIDGET_H
+#define VIDEOHINTWIDGET_H
+
+#include <hbwidget.h>
+
+class HbPushButton;
+class HbLabel;
+class VideoCollectionUiLoader;
+class QGraphicsItem;
+
+/**
+ * Widget for displaying no videos text and possible hint and button for user
+ * find where to download new videos.
+ */
+class VideoHintWidget : public HbWidget
+{
+ Q_OBJECT
+
+public:
+
+ enum HintLevel {
+ AllVideos,
+ Collection
+ };
+
+ /**
+ * Contructor.
+ *
+ * @param parent parent of this widget
+ */
+ VideoHintWidget(VideoCollectionUiLoader *uiLoader, QGraphicsItem *parent = 0);
+
+ /**
+ * Destructor.
+ *
+ */
+ ~VideoHintWidget();
+
+ /**
+ * Method creates colleciton wrapper, grid and list views,
+ * layout and activates correct view based on the current orientation
+ *
+ * @return int 0 initialization ok, < 0 if fails.
+ */
+ int initialize();
+
+ /**
+ * Sets the level where the hint is correctly. Hint displays differently in
+ * for example collection level, than in allVideos level.
+ *
+ * @param level The current level.
+ */
+ void setLevel(HintLevel level);
+
+ /**
+ * Overridden from QGraphicsItem. Sets the visibility of this widget.
+ *
+ * @param visible true if widget is set visible, false othervise.
+ */
+ void setVisible(bool visible);
+
+private slots:
+
+ /**
+ * Method activates correct view based on the given orientation.
+ */
+ void orientationChangedSlot(Qt::Orientation orientation);
+
+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();
+
+private:
+
+ Q_DISABLE_COPY(VideoHintWidget)
+
+ /**
+ * Pointer to the XML UI (DocML) loader, not owned
+ */
+ VideoCollectionUiLoader *mUiLoader;
+
+ /**
+ * Service button object.
+ */
+ HbPushButton *mServiceButton;
+
+ /**
+ * Hint text label (ie. the second row label).
+ */
+ HbLabel *mHintLabel;
+
+ /**
+ * Service icon resource string.
+ */
+ QString mServiceIconString;
+
+ /**
+ * Service icon pressed resource string.
+ */
+ QString mServiceIconPressedString;
+
+ /**
+ * Service icon.
+ */
+ HbIcon *mServiceIcon;
+
+ /**
+ * Current hint level.
+ */
+ HintLevel mCurrentLevel;
+
+};
+
+#endif // VIDEOHINTWIDGET_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/inc/videolistselectiondialog.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,177 @@
+/*
+* 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 selection dialog
+*
+*/
+
+#ifndef VIDEOLISTSELECTIONDIALOG_H
+#define VIDEOLISTSELECTIONDIALOG_H
+
+#include <hbdialog.h>
+#include <qlist.h>
+#include <qitemselectionmodel.h>
+
+class QGraphicItem;
+class QItemSelection;
+class HbLabel;
+class HbCheckBox;
+class HbStackedWidget;
+class VideoListWidget;
+class VideoCollectionUiLoader;
+class VideoSortFilterProxyModel;
+
+class VideoListSelectionDialog: public HbDialog
+{
+ /**
+ * definition required for emitting / connecting signals
+ */
+ Q_OBJECT
+
+ /**
+ * disable copy-constructor and assignment operator
+ */
+ Q_DISABLE_COPY(VideoListSelectionDialog)
+
+
+public:
+
+ /**
+ * Constructor
+ *
+ * @param uiLoader used to load UI components from docml
+ * @param parent item's parent component
+ */
+ VideoListSelectionDialog(VideoCollectionUiLoader *uiLoader, QGraphicsItem *parent=0);
+
+ /**
+ * Destructor
+ */
+ ~VideoListSelectionDialog();
+
+ /**
+ * Method setups provided title and videolist content widget.
+ * Prepares dialog for showing.
+ * 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.
+ */
+ void setContent(const QString &title, VideoListWidget *videoList);
+
+ /**
+ * 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:
+
+ /**
+ * Shows modal dialog build from the provided Videolistwidget.
+ *
+ * @return HbAction primary action if "OK" iis pressed
+ */
+ HbAction* exec();
+
+private slots:
+
+ /**
+ * Slot connected to mCheckBox's stateChanged -signal.
+ * Selects or deselects all items if mForcedCheck -flag is false.
+ *
+ * If Forcedcehck is true, it indeicates that we want to change the checked state
+ * only, not slect or deselect anything. This is needed for example if after
+ * all items are marked, user manually deselects item's. In that case all is not
+ * marked, so checked state needs to be changed.
+ *
+ * @param state Qt::Checked everything should be set as selected.
+ */
+ void markAllStateChangedSlot(int state);
+
+ /**
+ * disables or enables popup's primary action in case selection changes
+ *
+ * @param selected item selection list containing selected
+ * @param deselected item selection list containing not selected (not used in this scope)
+ */
+ void selectionChangedSlot(const QItemSelection &selected, const QItemSelection &deselected);
+
+ /**
+ * Changes the counter value. Sets the checkbutton state based on selection count.
+ *
+ */
+ void updateCounterSlot();
+
+private:
+
+ /**
+ * connects all required signals into appropriate slots
+ * for selection mode
+ */
+ void connectSignals();
+
+ /**
+ * disconnects all signals
+ */
+ void disconnectSignals();
+
+private:
+
+ /**
+ * docml UI loader, not owned
+ */
+ VideoCollectionUiLoader *mUiLoader;
+
+ /**
+ * content videolist, not owned
+ */
+ VideoListWidget *mVideoList;
+
+ /**
+ * Selection
+ */
+ QItemSelection mSelection;
+
+ /**
+ * header label
+ */
+ HbLabel *mHeading;
+
+ /**
+ * counter label from docml
+ */
+ HbLabel *mItemCount;
+
+ /**
+ * mark all checkbox
+ */
+ HbCheckBox *mCheckBox;
+
+ /**
+ * videolist container in dialog
+ */
+ HbStackedWidget *mListContainer;
+
+ /**
+ * flag indicating that we've changed check-btn state
+ * explicitly and don't wanna handle selection based on that
+ */
+ bool mForcedCheck;
+
+};
+
+#endif //VIDEOLISTSELECTIONDIALOG_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/inc/videolistview.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,427 @@
+/*
+* 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 view class definition
+*
+*/
+
+
+#ifndef VIDEOLISTVIEW_H
+#define VIDEOLISTVIEW_H
+
+#include <hbview.h>
+#include <qnamespace.h>
+#include <QtCore/QtGlobal>
+
+class QGraphicsItem;
+class VideoListWidget;
+class VideoHintWidget;
+class QActionGroup;
+class QVariant;
+class VideoCollectionViewUtils;
+class VideoSortFilterProxyModel;
+class VideoCollectionWrapper;
+class HbStackedWidget;
+class VideoCollectionUiLoader;
+class HbGroupBox;
+class VideoListSelectionDialog;
+class HbMenu;
+class VideoServices;
+
+
+/**
+ * Class acts as an container for widgets that are used to display different
+ * data: all videos, video collections or video services.
+ *
+ * Class is also responsible to mainatain correct widget active selected by the user's
+ * tap from the toolbar and creating and maintaining main menu commonly used by all widgets.
+ *
+ */
+class VideoListView : public HbView
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * Contructor.
+ * @param uiLoader VideoCollectionUiLoader instance for this view
+ * @param parent parent of this view
+ */
+ VideoListView(VideoCollectionUiLoader *uiLoader, QGraphicsItem *parent = 0);
+
+ /**
+ * Destructor.
+ *
+ */
+ ~VideoListView();
+
+ /**
+ * Creates and initializes view objects, toolbar and menu and connects signals
+ *
+ * @return 0 if ok, < 0 if intialisation fails
+ */
+ int initializeView();
+
+ /**
+ * Activates current widget to be shown, enables menu and connects
+ * orientation change signals.
+ *
+ * @return 0 activation ok, < 0 if activation fails
+ */
+ int activateView();
+
+ /**
+ * Deactivates current widget, disables menu and disconnects
+ * orientation change signals.
+ *
+ */
+ void deactivateView();
+
+ /**
+ * Back implementation.
+ * Not used at the moment
+ *
+ */
+ void back();
+
+
+signals:
+
+ /**
+ * Command signal. Should be connected to the
+ * plugin interface's command -signal in order to
+ * get the emitted commands transported uotside plugin.
+ *
+ * @param int command id
+ */
+ void command(int);
+
+private slots:
+
+ /**
+ * slot is connected to model's modelReady -signal
+ */
+ void modelReadySlot();
+
+ /**
+ * slot is connected to service's titleReady -signal
+ */
+ void titleReadySlot(const QString& title);
+
+ /**
+ * Slot is connected to model slots informing changes in item count
+ * Method checks the current model state and updates accrodingly
+ *
+ */
+ void layoutChangedSlot();
+
+ /**
+ * Slot is connected into toolbar's all videos tab's
+ * triggered signal.
+ *
+ * Activates all videos widget by calling changeWidget.
+ *
+ */
+ void openAllVideosViewSlot();
+
+ /**
+ * Slot is connected into toolbar's video collection tab's
+ * triggered signal.
+ *
+ * Activates video collection widget by calling changeWidget.
+ *
+ */
+ void openCollectionViewSlot();
+
+ /**
+ * Slot is connected into toolbar's Service tab's
+ * triggered signal.
+ *
+ * Activates Service widget by calling changeWidget.
+ *
+ */
+ void openServicesViewSlot();
+
+ /**
+ * Slot is connected into main menus sort -items
+ * Method checks sorting role based on active menu item and starts sorting
+ *
+ */
+ void startSorting();
+
+ /**
+ * Slot is connected into main menus "delete items" (delete...) signal
+ *
+ * Calls ui utils to show multiple delete dialog for current widget
+ *
+ */
+ void deleteItemsSlot();
+
+ /**
+ * Slot is connected into main menus "Create new collection..." signal
+ * Shows a selection dialog for creating a new collection
+ *
+ */
+ void createCollectionSlot();
+
+ /**
+ * Slot is connected into toolbar's "Add videos" signal
+ *
+ */
+ void addVideosToCollectionSlot();
+
+ /**
+ * Slot is connected into main menus aboutToShow -signal
+ *
+ */
+ void aboutToShowMainMenuSlot();
+
+ /**
+ * Slot is connected into hbInstance's primary window's
+ * aboutToChangeOrientation -signal. This is called when
+ * orientation is to be change.
+ */
+ void aboutToChangeOrientationSlot();
+
+ /**
+ * Slot is connected into hbInstance's primary window's
+ * aboutToChangeOrientation -signal. This is called when
+ * orientation is changed.
+ *
+ * @param orientation new orientation
+ */
+ void orientationChangedSlot( Qt::Orientation orientation );
+
+ /**
+ * Slot is connected into viewdollectionwrapper's asyncStatus -signal
+ * If status is failed delete, refiltering is called to model before
+ * error message is shown.
+ *
+ * @param statusCode code of error
+ * @param additional additional data of status
+ */
+ void handleAsyncStatusSlot(int statusCode, QVariant &additional);
+
+ /**
+ * Slot is connected to videolistwidgets collectionOpened -signal
+ *
+ * @param collectionOpened
+ * @param collection contains the name of the collection opened
+ */
+ void collectionOpenedSlot(bool collectionOpened, const QString& collection);
+
+ /**
+ * Slot is connected into toolbar's sort by tab's
+ * triggered signal.
+ *
+ * Activates sort by popup menu.
+ *
+ */
+ void openSortByMenuSlot();
+
+ // 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:
+
+ /**
+ * Cleans all possibly created objects from this. In some cases there are no quarantees
+ * that they were created correctly, and thus is better to start again from clean slate.
+ */
+ void cleanup();
+
+ /**
+ * Method creates 3 tabs for the view's toolbar: all videos, collections and Services.
+ * Tabs' icons are loaded and theiur triggered signals are connected into corresponding slots.
+ *
+ * @return 0 creation ok, < 0 creation fails
+ */
+ int createToolbar();
+
+ /**
+ * Creates action with given parameters. createActionGroup() must be called successfully
+ * before using this method.
+ *
+ * @param tooltip Tooltip text for the action.
+ * @param icon Filepath for the icon file.
+ * @param actionGroup Actiongroup for created action.
+ * @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();
+
+ /**
+ * 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.
+ *
+ * @param show Set this to false if you want to force hide the hint.
+ */
+ void showHint(bool show = true);
+
+ /**
+ * Updates the sublabel text.
+ */
+ void updateSubLabel();
+
+private:
+
+ /**
+ * actions ids used in main menu and tool bar
+ */
+ enum TViewActionIds
+ {
+ EActionSortBy = 1,
+ EActionSortByDate,
+ EActionSortByName,
+ EACtionSortByItemCount,
+ EActionSortByLength,
+ EActionSortBySize,
+ EActionNewCollection,
+ EActionAddToCollection,
+ EActionDelete,
+ ETBActionAllVideos,
+ ETBActionCollections,
+ ETBActionServices,
+ ETBActionAddVideos,
+ ETBActionRemoveVideos,
+ ETBActionSortVideos
+ };
+
+
+ /**
+ * sort menu object.
+ */
+ HbMenu *mSortMenu;
+
+ /**
+ * reference to video collection view utils
+ */
+ VideoCollectionViewUtils &mUiUtils;
+
+ /**
+ * pointer to videocollectionwrapper
+ */
+ VideoCollectionWrapper *mWrapper;
+
+ /**
+ * Pointer to the XML UI (DocML) loader, not owned
+ */
+ VideoCollectionUiLoader* mUiLoader;
+
+ /**
+ * view model object.
+ */
+ VideoSortFilterProxyModel *mModel;
+
+ /**
+ * Boolean for knowing when the app was started as a service.
+ */
+ bool mIsService;
+
+ /**
+ * Boolean for knowing when the model is ready.
+ */
+ 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
+ */
+ VideoListWidget* mVideoListWidget;
+
+ /**
+ * Widget for showing the hint text.
+ */
+ VideoHintWidget* mVideoHintWidget;
+
+ /**
+ * Action group for the toolbar.
+ */
+ QActionGroup* mToolbarViewsActionGroup;
+
+ /**
+ * Action group for the toolbar.
+ */
+ QActionGroup* mToolbarCollectionActionGroup;
+
+ /**
+ * map containing pointers to main menu actions
+ */
+ QMap<TViewActionIds, HbAction*> mMenuActions;
+
+ /**
+ * map containing toolbar actions
+ */
+ QMap<TViewActionIds, HbAction*> mToolbarActions;
+
+ /**
+ * Soring roles mapped to appropriate actions.
+ */
+ QMap<HbAction*, int> mSortingRoles;
+
+ /**
+ * String containing the name of the currently open collection
+ */
+ QString mCollectionName;
+
+ /**
+ * selection dialog
+ */
+ VideoListSelectionDialog *mSelectionDialog;
+
+};
+
+#endif // VIDEOLISTVIEW_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/inc/videolistwidget.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,347 @@
+/*
+* 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
+*
+*/
+
+
+#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 <mpxitemid.h>
+
+class VideoSortFilterProxyModel;
+class HbAction;
+class HbMenu;
+class QTimer;
+
+class QItemSelection;
+class VideoServices;
+
+/**
+ * Widget for displaying all videos, either using list- or grid view.
+ * Widget contains 2 widgets to be used for different orientation in the stacked layout.
+ *
+ * Depending on the orientation and it's change, corresponding view is set active.
+ *
+ */
+class VideoListWidget : public HbListView
+{
+ 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 parent parent of this widget
+ */
+ VideoListWidget(HbView *parent = 0);
+
+ /**
+ * Destructor.
+ *
+ */
+ virtual ~VideoListWidget();
+
+ /**
+ * Method creates colleciton wrapper, grid and list views,
+ * layout and activates correct view based on the current orientation
+ *
+ * @param model Model for this list view.
+ * @return int 0 initialization ok, < 0 if fails.
+ */
+ int initialize(VideoSortFilterProxyModel &model, VideoServices* videoServices = 0);
+
+ /**
+ * Method enables and displays current active view
+ *
+ * @return int 0 initialization ok, < 0 if fails.
+ */
+ int activate();
+
+ /**
+ * Method enables and displays current active view
+ *
+ * @return int 0 initialization ok, < 0 if fails.
+ */
+ int activate(VideoListWidget::TVideoListLevel role);
+
+ /**
+ * Method disables and hides current active view
+ *
+ */
+ void deactivate();
+
+ /**
+ * Used for resolving widget's current type
+ *
+ * @return TVideoListType current level.
+ */
+ TVideoListType getType();
+
+ /**
+ * returns widget's model
+ *
+ * @return VideoSortFilterProxyModel*
+ */
+ VideoSortFilterProxyModel& getModel();
+
+protected:
+
+ /**
+ * Called by the fw when some item is tapped. Method check that
+ * index is valid and calls open item for collectionwrapper to
+ * open media object throught collection.
+ *
+ * @param midelIndex, item's index
+ */
+ void emitActivated (const QModelIndex &modelIndex);
+
+signals:
+
+ /**
+ * Command signal.
+ *
+ * @param int command id
+ */
+ void command(int);
+
+ /**
+ * Signals collection view's state. Used to indicate
+ * view incase some collection item is opened
+ *
+ * @param true if opened, false if closed.
+ * @param optional name string
+ */
+ void collectionOpened(bool, const QString&);
+
+ /**
+ * signal is connected to service's itemSelected -slot
+ */
+ void fileUri(const QString&);
+
+protected slots:
+ /**
+ * Signaled by the fw during long press and indicating that popupmenu
+ * concerning particular item is to be opened.
+ * Saves current selected item's index to mCurrentIndex
+ */
+ void longPressGesture (const QPointF &point);
+
+private slots:
+
+ /**
+ * Signaled for item share.
+ *
+ */
+ void shareItemSlot();
+
+ /**
+ * Signaled for one item deletion.
+ *
+ */
+ void deleteItemSlot();
+
+ /**
+ * Signaled for item rename.
+ *
+ */
+ void renameSlot();
+
+ /**
+ * Signaled to play all items.
+ *
+ */
+ void playAllSlot();
+
+ /**
+ * Signaled to add an item into currently open collection.
+ *
+ */
+ void addItemSlot();
+
+ /**
+ * Signaled to add an item into a collection.
+ *
+ */
+ void addToCollectionSlot();
+
+ /**
+ * 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
+ *
+ */
+ void openDetailsSlot();
+
+ /**
+ * Signaled when the application has been lauched as a service and
+ * playback is initialized from context menu.
+ *
+ */
+ void playItemSlot();
+
+ /**
+ * Signaled when stepping back from collection in collection view
+ *
+ */
+ void back();
+
+ /**
+ * Signaled when view scrolling ends, initiates thumbnail fetching
+ * at index of first visible item.
+ *
+ */
+ void scrollingEndedSlot();
+
+ /**
+ * Signaled when view scroll position changes, initiates timer to
+ * fetch thumbnails at index of first visible item.
+ */
+ void scrollPositionChangedSlot(const QPointF &newPosition);
+
+ // 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
+ {
+ EActionShare = 1,
+ EActionDelete,
+ EActionDetails,
+ EACtionRemoveFromCollection,
+ EACtionAddToCollection,
+ EACtionRemoveCollection,
+ EActionAddVideos,
+ EActionRename,
+ EActionSetThumb,
+ EActionPlay
+ };
+
+ /**
+ * Method creates popup menu for list items.
+ *
+ */
+ void createContextMenu();
+
+ /**
+ * Method sets correct popup menu for specific list items.
+ *
+ */
+ void setContextMenu(bool isDefaultCollection);
+
+ /**
+ * Method connects signals needed by the widget
+ *
+ * @return int 0 if connect ok, < 0 if connect fails
+ */
+ int connectSignals();
+
+ /**
+ * Method disconnects signals needed by the widget
+ *
+ */
+ void disConnectSignals();
+
+private:
+
+ /**
+ * Provided model
+ * Not own.
+ */
+ VideoSortFilterProxyModel *mModel;
+
+ /**
+ * pointer to videoservices instance
+ */
+ VideoServices* mVideoServices;
+
+ /**
+ * map containing pointers to main menu actions
+ */
+ QMap<TContextActionIds, HbAction*> mContextMenuActions;
+
+ /**
+ * current level indicating content currently showing:
+ * category or videos
+ */
+ VideoListWidget::TVideoListLevel mCurrentLevel;
+
+ /**
+ * True if signals have been connected
+ */
+ bool mSignalsConnected;
+
+ /**
+ * True if details plugin is ready
+ */
+ bool mDetailsReady;
+
+ /**
+ * Boolean for knowing when the app was started as a service.
+ */
+ bool mIsService;
+
+ /**
+ * Secondary softkey action object
+ */
+ HbAction *mSecSkAction;
+
+ /**
+ * 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;
+
+ /**
+ * Timer used to report thumbnail fetches class index of
+ * first visible item when view is scrolling.
+ */
+ QTimer *mScrollPositionTimer;
+};
+
+#endif // VIDEOLISTWIDGET_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/src/videocollectionuiloader.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,72 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "videocollectionuiloader.h"
+#include "videolistview.h"
+#include "videolistselectiondialog.h"
+#include "videolistwidget.h"
+#include "videohintwidget.h"
+
+// ---------------------------------------------------------------------------
+// VideoCollectionUiLoader
+// ---------------------------------------------------------------------------
+//
+VideoCollectionUiLoader::VideoCollectionUiLoader() :
+ HbDocumentLoader()
+{
+}
+
+// ---------------------------------------------------------------------------
+// ~VideoCollectionUiLoader
+// ---------------------------------------------------------------------------
+//
+VideoCollectionUiLoader::~VideoCollectionUiLoader()
+{
+}
+
+// ---------------------------------------------------------------------------
+// createObject
+// ---------------------------------------------------------------------------
+//
+QObject* VideoCollectionUiLoader::createObject( const QString& type, const QString &name )
+{
+ QObject* object = 0;
+
+ if ( type == VideoListView::staticMetaObject.className() )
+ {
+ object = new VideoListView(this);
+ }
+ else if ( type == VideoListSelectionDialog::staticMetaObject.className() )
+ {
+ object = new VideoListSelectionDialog(this);
+ }
+ else if ( type == VideoListWidget::staticMetaObject.className() )
+ {
+ object = new VideoListWidget();
+ }
+ else if ( type == VideoHintWidget::staticMetaObject.className() )
+ {
+ object = new VideoHintWidget(this);
+ }
+ if ( object )
+ {
+ object->setObjectName( name );
+ return object;
+ }
+
+ return HbDocumentLoader::createObject( type, name );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/src/videocollectionviewplugin.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,168 @@
+/*
+* 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 implementation
+*
+*/
+
+// INCLUDE FILES
+#include <xqplugin.h>
+#include <hbaction.h>
+#include <hbapplication.h>
+#include <hbinstance.h>
+
+#include "videocollectionviewplugin.h"
+#include "videolistview.h"
+#include "videocollectionuiloader.h"
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+VideoCollectionViewPlugin::VideoCollectionViewPlugin()
+ : mUiLoader(0),
+ mView(0),
+ mActivated(false)
+{
+}
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+VideoCollectionViewPlugin::~VideoCollectionViewPlugin()
+{
+ destroyView();
+}
+
+// ---------------------------------------------------------------------------
+// Create view
+// ---------------------------------------------------------------------------
+//
+void VideoCollectionViewPlugin::createView()
+{
+ mActivated = false;
+ if ( !mView ) {
+
+ if(!mUiLoader)
+ {
+ mUiLoader = new VideoCollectionUiLoader();
+ }
+
+ mUiLoader->reset();
+
+ bool ok(false);
+
+ QList<QObject *> objects = mUiLoader->load(DOCML_VIDEOCOLLECTIONVIEW_FILE, &ok);
+
+ if (!ok)
+ {
+ return;
+ }
+
+ mView = mUiLoader->findObject<VideoListView>( DOCML_NAME_VIEW );
+
+ if(!mView)
+ {
+ // TODO: handle error: creating view
+ return;
+ }
+
+ if(!connect( mView, SIGNAL(command(int)), this, SIGNAL(command(int)) ) ) {
+ // TODO: handle error: connecting signal
+ delete mView;
+ mView = 0;
+ return;
+ }
+
+ mView->initializeView();
+
+ }
+}
+
+// ---------------------------------------------------------------------------
+// Destroy view
+// ---------------------------------------------------------------------------
+//
+void VideoCollectionViewPlugin::destroyView()
+{
+ deactivateView();
+ disconnect();
+
+ delete mView;
+ mView = 0;
+ delete mUiLoader;
+ mUiLoader = 0;
+}
+
+// ---------------------------------------------------------------------------
+// Activate view
+// ---------------------------------------------------------------------------
+//
+void VideoCollectionViewPlugin::activateView()
+{
+ if ( !mActivated ) {
+ HbMainWindow *wnd = mView->mainWindow();
+ if(wnd)
+ {
+ mView->activateView();
+ mActivated = true;
+ }
+ }
+}
+
+// ---------------------------------------------------------------------------
+// Deactivate view
+// ---------------------------------------------------------------------------
+//
+void VideoCollectionViewPlugin::deactivateView()
+{
+ if ( mActivated ) {
+ mView->deactivateView();
+ mActivated = false;
+ }
+}
+
+// ---------------------------------------------------------------------------
+// Get view
+// ---------------------------------------------------------------------------
+//
+QGraphicsWidget* VideoCollectionViewPlugin::getView()
+{
+ return mView;
+}
+
+// ---------------------------------------------------------------------------
+// Slot: Orientation change
+// // TODO: can be removed
+// ---------------------------------------------------------------------------
+//
+void VideoCollectionViewPlugin::orientationChange( Qt::Orientation /* orientation */ )
+{
+ // view handles orientation individually
+}
+
+// ---------------------------------------------------------------------------
+// Slot: back
+// ---------------------------------------------------------------------------
+//
+void VideoCollectionViewPlugin::back()
+{
+ if ( mActivated ) {
+ mView->back();
+ }
+}
+
+XQ_EXPORT_PLUGIN2( videocollectionview, VideoCollectionViewPlugin );
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/src/videocollectionviewutils.cpp Thu Apr 01 22:38:49 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: video collection view plugin's ui utils class
+*
+*/
+
+#include <hbdialog.h>
+#include <hbmessagebox.h>
+#include <centralrepository.h>
+
+#include "videocollectioncommon.h"
+#include "videocollectionviewutils.h"
+
+const int KVideoCollectionViewCenrepUid(0x2002BC63);
+const int KVideoCollectionViewCenrepServiceIconKey(0x2);
+const int KVideoCollectionViewCenrepServiceIconPressedKey(0x3);
+const int KVideoCollectionViewCenrepServiceUriKey(0x4);
+const int KVideoCollectionViewCenrepSortingRoleKey(0x5);
+const int KVideoCollectionViewCenrepSortingOrderKey(0x6);
+
+// ---------------------------------------------------------------------------
+// instance
+// ---------------------------------------------------------------------------
+//
+VideoCollectionViewUtils& VideoCollectionViewUtils::instance()
+{
+ static VideoCollectionViewUtils _popupInstance;
+ return _popupInstance;
+}
+
+// ---------------------------------------------------------------------------
+// VideoCollectionViewUtils
+// ---------------------------------------------------------------------------
+//
+VideoCollectionViewUtils::VideoCollectionViewUtils()
+{
+
+}
+
+// ---------------------------------------------------------------------------
+// ~VideoCollectionViewUtils
+// ---------------------------------------------------------------------------
+//
+VideoCollectionViewUtils::~VideoCollectionViewUtils()
+{
+
+}
+
+// ---------------------------------------------------------------------------
+// saveSortingValues
+// ---------------------------------------------------------------------------
+//
+int VideoCollectionViewUtils::saveSortingValues(int role, Qt::SortOrder order)
+{
+ int status = -1;
+ CRepository *cenRep = 0;
+ TRAP_IGNORE(cenRep = CRepository::NewL(TUid::Uid(KVideoCollectionViewCenrepUid)));
+ if(cenRep)
+ {
+ status = cenRep->Set(KVideoCollectionViewCenrepSortingRoleKey, static_cast<TInt>(role));
+ if(status == KErrNone)
+ {
+ status = cenRep->Set(KVideoCollectionViewCenrepSortingOrderKey, static_cast<TInt>(order));
+ }
+ delete cenRep;
+ }
+ return status;
+}
+
+// ---------------------------------------------------------------------------
+// loadSortingValues
+// ---------------------------------------------------------------------------
+//
+int VideoCollectionViewUtils::loadSortingValues(int& role, Qt::SortOrder& order)
+{
+ int status = -1;
+ CRepository *cenRep = 0;
+ TRAP_IGNORE(cenRep = CRepository::NewL(TUid::Uid(KVideoCollectionViewCenrepUid)));
+ if(cenRep)
+ {
+ TInt roleValue(KErrNotFound);
+ TInt orderValue(KErrNotFound);
+ status = cenRep->Get(KVideoCollectionViewCenrepSortingRoleKey, roleValue);
+ if(status == KErrNone)
+ {
+ status = cenRep->Get(KVideoCollectionViewCenrepSortingOrderKey, orderValue);
+ if(status == KErrNone)
+ {
+ role = roleValue;
+ order = static_cast<Qt::SortOrder>(orderValue);
+ }
+ }
+ delete cenRep;
+ }
+ return status;
+}
+
+// ---------------------------------------------------------------------------
+// getServiceIconStrings
+// ---------------------------------------------------------------------------
+//
+int VideoCollectionViewUtils::getServiceIconStrings(QString& icon,
+ QString& iconPressed)
+{
+ int status = -1;
+ CRepository *cenRep = 0;
+ TRAP_IGNORE(cenRep = CRepository::NewL(TUid::Uid(KVideoCollectionViewCenrepUid)));
+ if(cenRep)
+ {
+ TBuf<255> iconValue;
+ TBuf<255> pressedValue;
+ status = cenRep->Get(KVideoCollectionViewCenrepServiceIconKey, iconValue);
+ if(status == KErrNone)
+ {
+ status = cenRep->Get(KVideoCollectionViewCenrepServiceIconPressedKey, pressedValue);
+ if(status == KErrNone)
+ {
+ QString iconTemp((QChar*)iconValue.Ptr(),iconValue.Length());
+ QString pressedTemp((QChar*)pressedValue.Ptr(),pressedValue.Length());
+
+ icon = iconTemp;
+ iconPressed = pressedTemp;
+ }
+ }
+ delete cenRep;
+ }
+ return status;
+}
+
+// ---------------------------------------------------------------------------
+// getServiceUriString
+// ---------------------------------------------------------------------------
+//
+QString VideoCollectionViewUtils::getServiceUriString()
+{
+ QString uri;
+ CRepository *cenRep = 0;
+ TRAP_IGNORE(cenRep = CRepository::NewL(TUid::Uid(KVideoCollectionViewCenrepUid)));
+ if(cenRep)
+ {
+ TBuf<255> uriValue;
+ if(cenRep->Get(KVideoCollectionViewCenrepServiceIconKey, uriValue) == KErrNone)
+ {
+ QString uriTemp((QChar*)uriValue.Ptr(),uriValue.Length());
+ uri = uriTemp;
+ }
+ delete cenRep;
+ }
+ return uri;
+}
+
+// ---------------------------------------------------------------------------
+// showStatusMsgSlot
+// ---------------------------------------------------------------------------
+//
+void VideoCollectionViewUtils::showStatusMsgSlot(int statusCode, QVariant &additional)
+{
+ QString msg("");
+ 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)
+ {
+ 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;
+ }
+
+ if(msg.count() > 0)
+ {
+ if(error)
+ {
+ HbMessageBox::warning(msg);
+ }
+ else
+ {
+ HbMessageBox::information(msg);
+ }
+
+ }
+}
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/src/videohintwidget.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,161 @@
+/*
+* 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 <hbpushbutton.h>
+#include <hblabel.h>
+#include <qgraphicsitem.h>
+#include <hbinstance.h>
+
+#include "videohintwidget.h"
+#include "videocollectionuiloader.h"
+#include "videocollectionviewutils.h"
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+VideoHintWidget::VideoHintWidget(VideoCollectionUiLoader *uiLoader, QGraphicsItem *parent) :
+HbWidget(parent),
+mUiLoader(uiLoader),
+mServiceButton(0),
+mHintLabel(0),
+mServiceIcon(0),
+mCurrentLevel(AllVideos)
+{
+ // NOP
+}
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+VideoHintWidget::~VideoHintWidget()
+{
+ delete mServiceIcon;
+}
+
+// ---------------------------------------------------------------------------
+// initialize
+// ---------------------------------------------------------------------------
+//
+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);
+}
+
+// ---------------------------------------------------------------------------
+// setLevel
+// ---------------------------------------------------------------------------
+//
+void VideoHintWidget::setLevel(HintLevel level)
+{
+ mCurrentLevel = level;
+ if(isVisible()) {
+ updateUiComponents();
+ }
+}
+
+// ---------------------------------------------------------------------------
+// setVisible
+// ---------------------------------------------------------------------------
+//
+void VideoHintWidget::setVisible(bool visible)
+{
+ HbWidget::setVisible(visible);
+
+ if(visible) {
+ activate();
+ } else {
+ deactivate();
+ }
+}
+
+// ---------------------------------------------------------------------------
+// orientationChanged
+// ---------------------------------------------------------------------------
+//
+void VideoHintWidget::orientationChangedSlot(Qt::Orientation /*targetOrientation*/)
+{
+ updateUiComponents();
+}
+
+// ---------------------------------------------------------------------------
+// activate
+// ---------------------------------------------------------------------------
+//
+void VideoHintWidget::activate()
+{
+ if(mServiceIconString.isNull() || mServiceIconString.isEmpty() ||
+ mServiceIconPressedString.isNull() || 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);
+
+ updateUiComponents();
+}
+
+// ---------------------------------------------------------------------------
+// deactivate
+// ---------------------------------------------------------------------------
+//
+void VideoHintWidget::deactivate()
+{
+ disconnect(this, SLOT(orientationChangedSlot(Qt::Orientation)));
+
+ mServiceButton->setIcon(HbIcon());
+ if(mServiceIcon) {
+ delete mServiceIcon;
+ mServiceIcon = 0;
+ }
+}
+
+// ---------------------------------------------------------------------------
+// updateUiComponents
+// ---------------------------------------------------------------------------
+//
+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);
+ }
+}
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/src/videolistselectiondialog.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,293 @@
+/*
+* 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 selection dialog implementation
+*
+*/
+
+#include <QGraphicsItem>
+#include <hblabel.h>
+#include <hbcheckbox.h>
+#include <hbaction.h>
+#include <hbstackedwidget.h>
+#include <hbdeviceprofile.h>
+#include "videocollectionuiloader.h"
+#include "videolistwidget.h"
+#include "videosortfilterproxymodel.h"
+#include "videolistselectiondialog.h"
+
+// ---------------------------------------------------------------------------
+// VideoListSelectionDialog
+// ---------------------------------------------------------------------------
+//
+VideoListSelectionDialog::VideoListSelectionDialog(VideoCollectionUiLoader *uiLoader,
+ QGraphicsItem *parent) :
+HbDialog(parent),
+mUiLoader(uiLoader),
+mVideoList(0),
+mHeading(0),
+mItemCount(0),
+mCheckBox(0),
+mListContainer(0),
+mForcedCheck(false)
+{
+ setDismissPolicy(HbDialog::NoDismiss);
+ setTimeout(HbDialog::NoTimeout);
+}
+
+// ---------------------------------------------------------------------------
+// ~VideoListSelectionDialog
+// ---------------------------------------------------------------------------
+//
+VideoListSelectionDialog::~VideoListSelectionDialog()
+{
+ // NOP
+}
+
+// ---------------------------------------------------------------------------
+// getSelection
+// ---------------------------------------------------------------------------
+//
+const QItemSelection& VideoListSelectionDialog::getSelection() const
+{
+ return mSelection;
+}
+
+// ---------------------------------------------------------------------------
+// setContent
+// ---------------------------------------------------------------------------
+//
+void VideoListSelectionDialog::setContent(const QString &title, VideoListWidget *videoList)
+{
+ mSelection.clear();
+ if(!videoList || title.isEmpty())
+ {
+ mVideoList = 0;
+ return;
+ }
+
+ mVideoList = videoList;
+ if(!mHeading)
+ {
+ mHeading = mUiLoader->findWidget<HbLabel>(DOCML_NAME_DLG_HEADINGLBL);
+ }
+ mHeading->setPlainText(title);
+ 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));
+ }
+ primaryAction()->setDisabled(true);
+ if(!secondaryAction())
+ {
+ setSecondaryAction(new HbAction(tr("Cancel"), this));
+ }
+
+}
+
+// ---------------------------------------------------------------------------
+// exec
+// ---------------------------------------------------------------------------
+//
+HbAction* VideoListSelectionDialog::exec()
+{
+ mSelection.clear();
+ if(!mVideoList)
+ {
+ return 0;
+ }
+
+ // setup content of the popup
+ mVideoList->setSelectionMode(HbAbstractItemView::MultiSelection);
+
+ // 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);
+
+ if(!mListContainer)
+ {
+ mListContainer = mUiLoader->findWidget<HbStackedWidget>(DOCML_NAME_LIST_CONTAINER);
+ }
+ mListContainer->addWidget(mVideoList);
+
+ connectSignals();
+
+ // Launch popup syncronously
+ bool accepted = false;
+ 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);
+
+ mVideoList->setSelectionMode(HbAbstractItemView::NoSelection);
+
+ currentParentItem->setVisible(true);
+ mVideoList->setVisible(true);
+
+ if(!accepted)
+ {
+ mSelection.clear();
+ return secondaryAction();
+ }
+ return primaryAction();
+
+}
+
+// ---------------------------------------------------------------------------
+// markAllStateChanged
+// ---------------------------------------------------------------------------
+//
+void VideoListSelectionDialog::markAllStateChangedSlot(int state)
+{
+ if(!mVideoList)
+ {
+ return;
+ }
+
+ if(mForcedCheck)
+ {
+ return;
+ }
+ if( state == Qt::Checked)
+ {
+ mVideoList->selectAll();
+ }
+ else
+ {
+ mVideoList->clearSelection();
+ }
+}
+
+// ---------------------------------------------------------------------------
+// selectionChangedSlot
+// ---------------------------------------------------------------------------
+//
+void VideoListSelectionDialog::selectionChangedSlot(const QItemSelection &selected, const QItemSelection &deselected)
+{
+
+ if(!primaryAction())
+ {
+ return;
+ }
+ if(selected.indexes().count() > 0)
+ {
+ mSelection.merge(selected, QItemSelectionModel::Select);
+ }
+
+ if(deselected.indexes().count() > 0)
+ {
+ mSelection.merge(deselected, QItemSelectionModel::Deselect);
+ }
+
+ if(mSelection.indexes().count() > 0)
+ {
+ primaryAction()->setDisabled(false);
+ }
+ else
+ {
+ primaryAction()->setDisabled(true);
+ }
+
+ updateCounterSlot();
+}
+
+// ---------------------------------------------------------------------------
+// updateCounterSlot
+// ---------------------------------------------------------------------------
+//
+void VideoListSelectionDialog::updateCounterSlot()
+{
+ if(!mVideoList || !mItemCount)
+ {
+ return;
+ }
+ // orbit does not update HbLabel read from docml in case it isn't cleared first
+ int rowCount = mVideoList->getModel().rowCount();
+ int selectionCount = mSelection.indexes().count();
+ mItemCount->setPlainText(tr("%1/%2").arg(selectionCount).arg(rowCount));
+
+ mForcedCheck = true;
+ if(selectionCount == rowCount && rowCount > 0)
+ {
+ mCheckBox->setChecked(true);
+ }
+ else
+ {
+ mCheckBox->setChecked(false);
+ }
+ mForcedCheck = false;
+
+}
+
+// ---------------------------------------------------------------------------
+// connectSignals
+// ---------------------------------------------------------------------------
+//
+void VideoListSelectionDialog::connectSignals()
+{
+ // selection changes
+ connect(mVideoList->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()));
+
+ // mark all state changes
+ connect(mCheckBox, SIGNAL(stateChanged(int)), this, SLOT(markAllStateChangedSlot(int)));
+
+}
+
+// ---------------------------------------------------------------------------
+// disconnectSignals
+// ---------------------------------------------------------------------------
+//
+void VideoListSelectionDialog::disconnectSignals()
+{
+
+ disconnect(mVideoList->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()));
+
+ // mark all state changes
+ disconnect(mCheckBox, SIGNAL(stateChanged(int)), this, SLOT(markAllStateChangedSlot(int)));
+
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/src/videolistview.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,968 @@
+/*
+* 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 <xqserviceutil.h>
+#include <QActionGroup>
+#include <hbinstance.h>
+#include <hbmainwindow.h>
+#include <hblabel.h>
+#include <hbmessagebox.h>
+#include <hbstackedwidget.h>
+#include <hbstackedlayout.h>
+#include <hblistwidget.h>
+#include <hbtoolbar.h>
+#include <hbaction.h>
+#include <hbmenu.h>
+#include <hbgroupbox.h>
+#include <hbpushbutton.h>
+
+#include "videoservices.h"
+#include "videolistselectiondialog.h"
+#include "videocollectionviewutils.h"
+#include "videolistwidget.h"
+#include "videohintwidget.h"
+#include "videolistview.h"
+#include "videocollectioncommon.h"
+#include "videocollectionwrapper.h"
+#include "videosortfilterproxymodel.h"
+#include "videocollectionuiloader.h"
+
+// 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),
+mToolbarViewsActionGroup(0),
+mToolbarCollectionActionGroup(0),
+mSelectionDialog(0)
+{
+ // NOP
+}
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+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();
+
+ if(mVideoServices)
+ {
+ mVideoServices->decreaseReferenceCount();
+ mVideoServices = 0;
+ }
+
+ if(mWrapper)
+ {
+ mWrapper->decreaseReferenceCount();
+ mWrapper = 0;
+ }
+}
+
+// ---------------------------------------------------------------------------
+// initializeView()
+// ---------------------------------------------------------------------------
+//
+int VideoListView::initializeView()
+{
+ if(!mUiLoader)
+ {
+ return -1;
+ }
+
+ if (XQServiceUtil::isService() && !mVideoServices)
+ {
+ mIsService = true;
+
+ mVideoServices = VideoServices::instance();
+
+ if (!mVideoServices)
+ {
+ return -1;
+ }
+ else
+ {
+ 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);
+
+ mModel->doSorting(sortRole, sortOrder, false);
+
+ mOptionsMenu = mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU);
+
+ if(!mOptionsMenu)
+ {
+ 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)
+ {
+ cleanup();
+ return -1;
+ }
+
+ mSubLabel->setHeading(tr("Retrieving list.."));
+
+ mCollectionName = "";
+
+ return 0;
+}
+
+// ---------------------------------------------------------------------------
+// titleReadySlot()
+// ---------------------------------------------------------------------------
+//
+void VideoListView::titleReadySlot(const QString& title)
+{
+ setTitle(title);
+}
+
+// ---------------------------------------------------------------------------
+// activateView()
+// ---------------------------------------------------------------------------
+//
+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())))
+ {
+ // deactivate view so we get rid of dangling connections.
+ deactivateView();
+ 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;
+}
+
+// ---------------------------------------------------------------------------
+// modelReadySlot
+// ---------------------------------------------------------------------------
+//
+void VideoListView::modelReadySlot()
+{
+ mModelReady = true;
+ // since the reset signal arrives after
+ // layout changed, need to make sure that
+ // view is updated in case needed
+ layoutChangedSlot();
+}
+
+// ---------------------------------------------------------------------------
+// layoutChangedSlot
+// ---------------------------------------------------------------------------
+//
+void VideoListView::layoutChangedSlot()
+{
+ updateSubLabel();
+
+ if(mModelReady)
+ {
+ showHint();
+ }
+}
+
+// ---------------------------------------------------------------------------
+// deactivateView()
+// ---------------------------------------------------------------------------
+//
+void VideoListView::deactivateView()
+{
+ HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
+
+ disconnect(mainWnd, SIGNAL(aboutToChangeOrientation()),
+ this, SLOT(aboutToChangeOrientationSlot()));
+
+ disconnect(mainWnd, SIGNAL(orientationChanged(Qt::Orientation)),
+ this, SLOT(orientationChangedSlot(Qt::Orientation)));
+
+ disconnect(mWrapper, SIGNAL(asyncStatus(int, QVariant&)),
+ this, SLOT(handleAsyncStatusSlot(int, QVariant&)));
+
+ 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);
+
+ if(mVideoListWidget)
+ {
+ mVideoListWidget->deactivate();
+ }
+}
+
+// ---------------------------------------------------------------------------
+// back()
+// ---------------------------------------------------------------------------
+//
+void VideoListView::back()
+{
+ // NOP
+}
+
+// ---------------------------------------------------------------------------
+// cleanup()
+// ---------------------------------------------------------------------------
+//
+void VideoListView::cleanup()
+{
+ delete mToolbarViewsActionGroup;
+ mToolbarViewsActionGroup = 0;
+
+ 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;
+}
+
+// ---------------------------------------------------------------------------
+// createToolbar()
+// Creates toolbar, toolbar actions and toolbar icons
+// ---------------------------------------------------------------------------
+//
+int VideoListView::createToolbar()
+{
+ // Create actiongroup and add all actions to it. This ensures that only one is
+ // active at certain moment.
+
+ if(!mToolbarViewsActionGroup && !mToolbarCollectionActionGroup)
+ {
+ mToolbarViewsActionGroup = new QActionGroup(this);
+ mToolbarCollectionActionGroup = new QActionGroup(this);
+
+ if(!mToolbarViewsActionGroup || !mToolbarCollectionActionGroup)
+ {
+ delete mToolbarViewsActionGroup;
+ mToolbarViewsActionGroup = 0;
+
+ delete mToolbarCollectionActionGroup;
+ mToolbarCollectionActionGroup = 0;
+
+ return -1;
+ }
+
+ // create toolbar item actions
+
+ // All Videos tab
+ mToolbarActions[ETBActionAllVideos] = createAction(tr("All videos"), ":/images/qtg_mono_video_all.svg",
+ mToolbarViewsActionGroup, SLOT(openAllVideosViewSlot()));
+
+ // Collections tab
+ mToolbarActions[ETBActionCollections] = createAction(tr("Collections"), ":/images/qtg_mono_video_collection.svg",
+ mToolbarViewsActionGroup, SLOT(openCollectionViewSlot()));
+
+ if (!mIsService)
+ {
+ // Services tab
+ mToolbarActions[ETBActionServices] = createAction(tr("Services"), ":/images/qtg_mono_video_services.svg",
+ mToolbarViewsActionGroup, SLOT(openServicesViewSlot()));
+ // Add Videos tab
+ mToolbarActions[ETBActionAddVideos] = createAction(tr("Add videos"), ":/images/mono_video_addvideos.svg",
+ mToolbarCollectionActionGroup, SLOT(addVideosToCollectionSlot()));
+
+ // Remove Videos tab
+ mToolbarActions[ETBActionRemoveVideos] = createAction(tr("Remove videos"), ":/images/mono_video_removevideos.svg",
+ mToolbarCollectionActionGroup, SLOT(debugNotImplementedYet()));
+ }
+
+ // Sort by tab
+ mToolbarActions[ETBActionSortVideos] = createAction(tr("Sort by"), ":/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.
+
+ if( !bar
+ || !mToolbarActions[ETBActionAllVideos]
+ || !mToolbarActions[ETBActionCollections]
+ || !mToolbarActions[ETBActionSortVideos]
+ || (!mToolbarActions[ETBActionServices] && !mIsService)
+ || (!mToolbarActions[ETBActionAddVideos] && !mIsService)
+ || (!mToolbarActions[ETBActionRemoveVideos] && !mIsService))
+ {
+ delete mToolbarActions[ETBActionAllVideos];
+ delete mToolbarActions[ETBActionCollections];
+ delete mToolbarActions[ETBActionServices];
+ delete mToolbarActions[ETBActionAddVideos];
+ delete mToolbarActions[ETBActionRemoveVideos];
+ delete mToolbarActions[ETBActionSortVideos];
+ return -1;
+ }
+
+ // Collection view actions are not checkable
+ mToolbarActions[ETBActionAllVideos]->setCheckable(true);
+ mToolbarActions[ETBActionCollections]->setCheckable(true);
+
+ if (!mIsService)
+ {
+ mToolbarActions[ETBActionServices]->setCheckable(true);
+ }
+
+ // Allvideos is checked at creation phase
+ mToolbarActions[ETBActionAllVideos]->setChecked(true);
+
+ bar->addActions(mToolbarViewsActionGroup->actions());
+ }
+
+ return 0;
+}
+
+// ---------------------------------------------------------------------------
+// createAction()
+// ---------------------------------------------------------------------------
+//
+HbAction* VideoListView::createAction(QString tooltip, QString icon,
+ QActionGroup* actionGroup, const char *slot)
+{
+ HbAction* action = new HbAction(actionGroup);
+ if(!action) {
+ return 0;
+ }
+
+ action->setToolTip(tooltip);
+ HbIcon hbIcon(icon);
+ action->setIcon(hbIcon);
+
+ if(!connect(action, SIGNAL(triggered()), this, slot)) {
+ // actiongroup deletion deletes this also.
+ // return 0 tells that there was a problem in creation to caller.
+ delete action;
+ return 0;
+ }
+
+ 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)
+ {
+ mVideoHintWidget->setVisible(show);
+ }
+ else if (mVideoHintWidget)
+ {
+ show = false;
+ mVideoHintWidget->setVisible(false);
+ }
+
+ if(show && mToolbarViewsActionGroup && mToolbarCollectionActionGroup)
+ {
+ if(!mIsService)
+ {
+ mToolbarActions[ETBActionRemoveVideos]->setEnabled(false);
+ }
+ mToolbarActions[ETBActionSortVideos]->setEnabled(false);
+ }
+ else
+ {
+ if(!mIsService)
+ {
+ if(mToolbarActions[ETBActionRemoveVideos]->isEnabled() == false)
+ {
+ mToolbarActions[ETBActionRemoveVideos]->setEnabled(true);
+ }
+ }
+ if(mToolbarActions[ETBActionSortVideos]->isEnabled() == false)
+ {
+ mToolbarActions[ETBActionSortVideos]->setEnabled(true);
+ }
+ }
+}
+
+// ---------------------------------------------------------------------------
+// updateSubLabel
+// ---------------------------------------------------------------------------
+//
+void VideoListView::updateSubLabel()
+{
+ //TODO: reduce unnecessary updates
+ if (mModel && mVideoListWidget)
+ {
+ int itemCount = mModel->rowCount();
+
+ VideoListWidget::TVideoListType type = mVideoListWidget->getType();
+ if (type == VideoListWidget::EAllVideos)
+ {
+ mSubLabel->setHeading(tr("%1 videos").arg(itemCount));
+ }
+ else if (type == VideoListWidget::ECollections)
+ {
+ mSubLabel->setHeading(tr("%1 collections").arg(itemCount));
+ }
+ else if (type == VideoListWidget::EDefaultColItems ||
+ type == VideoListWidget::EUserColItems)
+ {
+ mSubLabel->setHeading(tr("%1 (%2)").arg(mCollectionName).arg(itemCount));
+ }
+ }
+}
+
+// ---------------------------------------------------------------------------
+// openAllVideosViewSlot()
+// ---------------------------------------------------------------------------
+//
+void VideoListView::openAllVideosViewSlot()
+{
+ mModel->open(VideoListWidget::ELevelVideos);
+ mVideoListWidget->activate(VideoListWidget::ELevelVideos);
+ mVideoHintWidget->setLevel(VideoHintWidget::AllVideos);
+ updateSubLabel();
+}
+
+// ---------------------------------------------------------------------------
+// openCollectionViewSlot()
+// ---------------------------------------------------------------------------
+//
+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();
+}
+
+// ---------------------------------------------------------------------------
+// openservicesViewSlot()
+// ---------------------------------------------------------------------------
+//
+void VideoListView::openServicesViewSlot()
+{
+ debugNotImplementedYet();
+}
+
+// ---------------------------------------------------------------------------
+// startSorting()
+// ---------------------------------------------------------------------------
+//
+void VideoListView::startSorting()
+{
+ if(!mModel || !mOptionsMenu)
+ {
+ return;
+ }
+ // Check that action is sort by and it has a sub menu.
+ if(mOptionsMenu->activeAction() != mMenuActions[EActionSortBy] || !mOptionsMenu->activeAction()->menu())
+ {
+ return;
+ }
+
+ int role = mSortingRoles[mOptionsMenu->activeAction()->menu()->activeAction()];
+
+ Qt::SortOrder order(Qt::AscendingOrder);
+
+ if(mModel->sortRole() == role && mModel->sortOrder() == Qt::AscendingOrder)
+ {
+ order = Qt::DescendingOrder;
+ }
+
+ mModel->doSorting(role, order);
+
+ mUiUtils.saveSortingValues(role, order);
+}
+
+// -------------------------------------------------------------------------------------------------
+// aboutToChangeOrientationSlot()
+// hide all items in the window during orientation change
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListView::aboutToChangeOrientationSlot()
+{
+ // this method is required for changing from to mediawall
+}
+
+// -------------------------------------------------------------------------------------------------
+// orientationChangedSlot()
+// orientation changed, items can be put back to visible after view has handled the change
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListView::orientationChangedSlot( Qt::Orientation orientation )
+{
+ // this method is required for changing from to mediawall
+
+ // in landscape we need to hide the title and the toolbar. (also required for the mediawall?)
+ // TODO: how about the feature where the toolbar comes visible if screen is tapped?
+ this->setItemVisible(Hb::AllItems, orientation == Qt::Vertical);
+}
+
+// -------------------------------------------------------------------------------------------------
+// deleteItemsSlot
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListView::deleteItemsSlot()
+{
+ if(!mModel)
+ {
+ return;
+ }
+ if(!mSelectionDialog)
+ {
+ 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();
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// createCollectionSlot
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListView::createCollectionSlot()
+{
+ debugNotImplementedYet();
+}
+
+// -------------------------------------------------------------------------------------------------
+// addVideosToCollectionSlot
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListView::addVideosToCollectionSlot()
+{
+ debugNotImplementedYet();
+}
+
+// -------------------------------------------------------------------------------------------------
+// aboutToShowMainMenuSlot
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListView::aboutToShowMainMenuSlot()
+{
+ if(!mModel || !mToolbarViewsActionGroup || !mToolbarCollectionActionGroup)
+ {
+ 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()))
+ {
+ // no items, no menu
+ return;
+ }
+
+ 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);
+
+ if (!mIsService)
+ {
+ mMenuActions[EActionAddToCollection]->setVisible(true);
+ mMenuActions[EActionDelete]->setVisible(true);
+ }
+ }
+ else if(mToolbarViewsActionGroup->checkedAction() == mToolbarActions[ETBActionCollections] &&
+ firstAction == mToolbarActions[ETBActionAllVideos] )
+ {
+ if (!mIsService)
+ {
+ mMenuActions[EActionNewCollection]->setVisible(true);
+ }
+ mMenuActions[EActionSortBy]->setVisible(true);
+ mMenuActions[EActionSortByName]->setVisible(true);
+ mMenuActions[EACtionSortByItemCount]->setVisible(true);
+ mMenuActions[EActionSortByLength]->setVisible(true);
+ }
+ else if(firstAction != mToolbarActions[ETBActionAllVideos])
+ {
+ //Add, Remove and Sort by will be launched from toolbar
+ if (!mIsService)
+ {
+ mMenuActions[EActionDelete]->setVisible(true);
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// handleAsyncStatusSlot
+// -------------------------------------------------------------------------------------------------
+//
+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);
+}
+
+// -------------------------------------------------------------------------------------------------
+// collectionOpenedSlot
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListView::collectionOpenedSlot(bool collectionOpened, const QString& collection)
+{
+ if(!mToolbarCollectionActionGroup || !mToolbarViewsActionGroup || !mToolbarActions.contains(ETBActionCollections))
+ {
+ return;
+ }
+
+ mCollectionName = collection;
+
+ HbToolBar* bar = toolBar();
+ bar->clearActions();
+
+ if (collectionOpened)
+ {
+ mToolbarActions[ETBActionCollections]->setChecked(false);
+ bar->addActions(mToolbarCollectionActionGroup->actions());
+ }
+ else
+ {
+ bar->addActions(mToolbarViewsActionGroup->actions());
+ mToolbarActions[ETBActionCollections]->setChecked(true);
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// openSortByMenuSlot
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListView::openSortByMenuSlot()
+{
+ if(!mModel)
+ {
+ 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()))
+ {
+ // no items, no menu
+ return;
+ }
+
+ mSortMenu->setVisible(true);
+ mMenuActions[EActionSortBy]->setVisible(true);
+ mMenuActions[EActionSortByDate]->setVisible(true);
+ mMenuActions[EActionSortByName]->setVisible(true);
+ mMenuActions[EActionSortBySize]->setVisible(true);
+
+ QPointF coords((size()/2).width(), (size()/3).height());
+ mSortMenu->exec(coords);
+}
+
+// Just for testing, remove this
+void VideoListView::debugNotImplementedYet()
+{
+ HbMessageBox::information(tr("Not implemented yet"));
+}
+
+// end of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/src/videolistwidget.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,627 @@
+/*
+* 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 <qtimer.h>
+#include <hbscrollbar.h>
+#include <xqserviceutil.h>
+#include <hbmenu.h>
+#include <hbaction.h>
+#include <hbinstance.h>
+#include <hbmainwindow.h>
+#include <hblistviewitem.h>
+#include <hbmessagebox.h>
+#include <vcxmyvideosdefs.h>
+
+#include "videoservices.h"
+#include "videothumbnaildata.h"
+#include "videosortfilterproxymodel.h"
+#include "videocollectioncommon.h"
+#include "mpxhbvideocommondefs.h"
+
+// Interval in ms to report the scroll position.
+const int SCROLL_POSITION_TIMER_TIMEOUT = 100;
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+VideoListWidget::VideoListWidget(HbView *parent) :
+HbListView(parent),
+mModel(0),
+mVideoServices(0),
+mCurrentLevel(VideoListWidget::ELevelVideos),
+mSignalsConnected(false),
+mDetailsReady(false),
+mIsService(false),
+mSecSkAction(0),
+mContextMenu(0),
+mLastOpenItemId(TMPXItemId::InvalidId()),
+mScrollPositionTimer(0)
+{
+ // NOP
+}
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+VideoListWidget::~VideoListWidget()
+{
+ delete mScrollPositionTimer;
+ mScrollPositionTimer = 0;
+ mContextMenuActions.clear();
+ disconnect();
+ delete mContextMenu;
+ mContextMenu = 0;
+ delete mSecSkAction;
+ mSecSkAction = 0;
+}
+
+// ---------------------------------------------------------------------------
+// initialize
+// ---------------------------------------------------------------------------
+//
+int VideoListWidget::initialize(VideoSortFilterProxyModel &model, VideoServices* videoServices)
+{
+ mModel = &model;
+
+ mVideoServices = videoServices;
+
+ if(mVideoServices)
+ {
+ 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);
+
+ mSecSkAction = new HbAction( Hb::BackAction );
+
+ if(!mSecSkAction)
+ {
+ return -1;
+ }
+ // initial setup for widget is hidden
+ setVisible(false);
+
+ mScrollPositionTimer = new QTimer();
+ mScrollPositionTimer->setSingleShot(true);
+
+ if (mIsService)
+ {
+ connect(this, SIGNAL(fileUri(const QString&)), mVideoServices, SLOT(itemSelected(const QString&)));
+ }
+
+ return 0;
+}
+
+// ---------------------------------------------------------------------------
+// activate
+// ---------------------------------------------------------------------------
+//
+int VideoListWidget::activate()
+{
+ return activate(mCurrentLevel);
+}
+
+// ---------------------------------------------------------------------------
+// activate
+// ---------------------------------------------------------------------------
+//
+int VideoListWidget::activate(VideoListWidget::TVideoListLevel level)
+{
+ mLastOpenItemId = TMPXItemId::InvalidId();
+ if(!mModel)
+ {
+ return -1;
+ }
+ mCurrentLevel = level;
+ setModel(mModel);
+ setVisible(true);
+
+ if(mContextMenu)
+ {
+ mContextMenu->setEnabled(true);
+ }
+
+ if ( connectSignals() < 0)
+ {
+ return -1;
+ }
+
+ // Enable thumbnail background fetching.
+ VideoThumbnailData &thumbnailData = VideoThumbnailData::instance();
+ thumbnailData.enableBackgroundFetching(true);
+
+ return 0;
+}
+
+// ---------------------------------------------------------------------------
+// deactivate
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::deactivate()
+{
+ if(mContextMenu)
+ {
+ mContextMenu->hide();
+ }
+ disConnectSignals();
+ // Free allocated memory for list thumbnails and disable background fetching.
+ VideoThumbnailData &thumbnailData = VideoThumbnailData::instance();
+ thumbnailData.enableBackgroundFetching(false);
+ thumbnailData.freeThumbnailData();
+}
+
+// ---------------------------------------------------------------------------
+// connectSignals
+// ---------------------------------------------------------------------------
+//
+int VideoListWidget::connectSignals()
+{
+
+ if (!mSignalsConnected)
+ {
+ if(!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()))
+ )
+ {
+ return -1;
+ }
+ mSignalsConnected = true;
+ }
+ return 0;
+}
+
+// ---------------------------------------------------------------------------
+// disConnectSignals
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::disConnectSignals()
+{
+ 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()));
+ mSignalsConnected = false;
+}
+
+// ---------------------------------------------------------------------------
+// shareItemSlot
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::shareItemSlot()
+{
+ debugNotImplementedYet();
+}
+
+// ---------------------------------------------------------------------------
+// deleteItemSlot
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::deleteItemSlot()
+{
+ if(!mModel)
+ {
+ return;
+ }
+
+ QVariant variant;
+ QModelIndex index = currentIndex();
+ variant = mModel->data(index, Qt::DisplayRole);
+
+ if (variant.isValid())
+ {
+ QString text = tr("Do you want to delete \"%1\"?").arg(
+ variant.toStringList().first());
+ if(HbMessageBox::question(text))
+ {
+ QModelIndexList list;
+ list.append(index);
+ mModel->deleteItems(list);
+
+ // exec filtering
+ mModel->invalidate();
+ }
+ }
+}
+
+// ---------------------------------------------------------------------------
+// createContextMenu
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::createContextMenu()
+{
+ if(mContextMenu)
+ {
+ return;
+ }
+ mContextMenu = new HbMenu();
+
+ if (mIsService)
+ {
+ mContextMenuActions[EActionPlay] = mContextMenu->addAction(tr("Play"), this, SLOT(playItemSlot()));
+ mContextMenuActions[EActionDetails] = mContextMenu->addAction(tr("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()));
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// setContextMenu
+// -------------------------------------------------------------------------------------------------
+//
+void VideoListWidget::setContextMenu(bool isDefaultCollection)
+{
+ if(!mContextMenu)
+ {
+ createContextMenu();
+ }
+ int menuActionCount = 0;
+ HbAction *action = 0;
+ foreach(action, mContextMenuActions.values())
+ {
+ if(action)
+ {
+ ++menuActionCount;
+ action->setVisible(false);
+ }
+ }
+ if(menuActionCount != mContextMenuActions.values().count() || mContextMenuActions.values().count() == 0)
+ {
+ // fatal error, some action(s) was not created before.
+ delete mContextMenu;
+ mContextMenu = 0;
+ mContextMenuActions.clear();
+ return;
+ }
+
+ HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
+
+ TVideoListType type = getType();
+
+ if(type == EAllVideos ||
+ type == EDefaultColItems)
+ {
+ if (!mIsService)
+ {
+ mContextMenuActions[EACtionAddToCollection]->setVisible(true);
+ mContextMenuActions[EActionShare]->setVisible(true);
+ mContextMenuActions[EActionDelete]->setVisible(true);
+ }
+ else
+ {
+ mContextMenuActions[EActionPlay]->setVisible(true);
+ }
+ mContextMenuActions[EActionDetails]->setVisible(true);
+ }
+ else if(type == ECollections)
+ {
+ if(!mIsService)
+ {
+ mContextMenuActions[EActionAddVideos]->setVisible(true);
+ mContextMenuActions[EActionRename]->setVisible(true);
+ mContextMenuActions[EActionSetThumb]->setVisible(true);
+ mContextMenuActions[EACtionRemoveCollection]->setVisible(true);
+ }
+ }
+ else if(type == EUserColItems)
+ {
+ if (!mIsService)
+ {
+ mContextMenuActions[EACtionRemoveFromCollection]->setVisible(true);
+ mContextMenuActions[EActionShare]->setVisible(true);
+ mContextMenuActions[EActionDelete]->setVisible(true);
+ }
+ else
+ {
+ mContextMenuActions[EActionPlay]->setVisible(true);
+ }
+ mContextMenuActions[EActionDetails]->setVisible(true);
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// 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
+// ---------------------------------------------------------------------------
+//
+VideoSortFilterProxyModel& VideoListWidget::getModel()
+{
+ return *mModel;
+}
+
+// ---------------------------------------------------------------------------
+// emitActivated
+// This slot is called by the fw when viewitem is activated
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::emitActivated (const QModelIndex &modelIndex)
+{
+ if(selectionMode() == HbAbstractItemView::MultiSelection)
+ {
+ // do nothing in case selection mode
+ return;
+ }
+
+ if (!mModel || !modelIndex.isValid())
+ {
+ return;
+ }
+ if (mCurrentLevel == ELevelCategory)
+ {
+ if (getType() == ECollections)
+ {
+ 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()));
+ }
+ }
+ }
+ if(mIsService && (mCurrentLevel == ELevelCategory) && (getType() != ECollections))
+ {
+ QVariant variant = mModel->data(modelIndex, VideoCollectionCommon::KeyFilePath);
+ if ( variant.isValid() )
+ {
+ QString itemPath = variant.value<QString>();
+ emit(fileUri(itemPath));
+ }
+ }
+ else
+ {
+ mModel->openItem(modelIndex);
+ }
+}
+
+// ---------------------------------------------------------------------------
+// longPressGesture
+// called by the fw when user long presses some item
+// ---------------------------------------------------------------------------
+//
+//
+void VideoListWidget::longPressGesture (const QPointF &point)
+{
+ if (!mDetailsReady)
+ {
+ emit command(MpxHbVideoCommon::LoadVideoDetailsView);
+ mDetailsReady = true;
+ }
+ if(selectionMode() == HbAbstractItemView::MultiSelection)
+ {
+ // do not activate context menu during selection mode
+ return;
+ }
+
+ 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))
+ {
+ 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);
+ }
+ }
+ HbListView::longPressGesture(point);
+}
+
+// ---------------------------------------------------------------------------
+// playItemSlot
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::playItemSlot()
+{
+ mModel->openItem(currentIndex());
+}
+
+// ---------------------------------------------------------------------------
+// openDetailsSlot
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::openDetailsSlot()
+{
+ if(mModel && mModel->fetchItemDetails(currentIndex()) == 0 )
+ {
+ emit command(MpxHbVideoCommon::ActivateVideoDetailsView);
+ }
+}
+// ---------------------------------------------------------------------------
+// renameSlot
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::renameSlot()
+{
+ debugNotImplementedYet();
+}
+
+
+// ---------------------------------------------------------------------------
+// addItemSlot
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::addItemSlot()
+{
+ debugNotImplementedYet();
+}
+
+// ---------------------------------------------------------------------------
+// addToCollectionSlot
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::addToCollectionSlot()
+{
+ debugNotImplementedYet();
+}
+
+
+// ---------------------------------------------------------------------------
+// playAllSlot
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::playAllSlot()
+{
+ debugNotImplementedYet();
+}
+
+// ---------------------------------------------------------------------------
+// back
+// ---------------------------------------------------------------------------
+//
+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();
+ }
+}
+
+// ---------------------------------------------------------------------------
+// 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);
+ }
+}
+
+// ---------------------------------------------------------------------------
+// scrollPositionChangedSlot
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::scrollPositionChangedSlot(const QPointF &newPosition)
+{
+ Q_UNUSED(newPosition);
+ if(mScrollPositionTimer && !mScrollPositionTimer->isActive())
+ mScrollPositionTimer->start(SCROLL_POSITION_TIMER_TIMEOUT);
+}
+
+// ---------------------------------------------------------------------------
+// debugNotImplementedYet
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::debugNotImplementedYet()
+{
+ HbMessageBox::information(tr("Not implemented yet"));
+}
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testcollectionview/stub/inc/videocollectionuiloader.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,95 @@
+/*
+* 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 _VIDEOCOLLECTIONUILOADER_H_
+#define _VIDEOCOLLECTIONUILOADER_H_
+
+// System includes
+#include <hbdocumentloader.h>
+
+// Constants
+static const char* DOCML_VIDEOCOLLECTIONVIEW_FILE = ":/layout/collectionview.docml";
+static const char* DOCML_NAME_VIEW = "view";
+
+// Videocollection View
+static const char* DOCML_NAME_VC_HEADINGBANNER = "vc:mBanner";
+static const char* DOCML_NAME_VC_VIDEOLISTWIDGET = "vc:mListWidget";
+static const char* DOCML_NAME_VC_VIDEOHINTWIDGET = "vc:mHintWidget";
+
+// Videocollection Options Menu
+static const char* DOCML_NAME_OPTIONS_MENU = "vc:mOptionsMenu";
+static const char* DOCML_NAME_SORT_MENU = "vc:mSortBy";
+
+static const char* DOCML_NAME_SORT_BY_DATE = "vc:mDate";
+static const char* DOCML_NAME_SORT_BY_NAME = "vc:mName";
+static const char* DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS = "vc:mNumberOfItems";
+static const char* DOCML_NAME_SORT_BY_TOTAL_LENGTH = "vc:mTotalLength";
+static const char* DOCML_NAME_SORT_BY_RATING = "vc:mRating";
+static const char* DOCML_NAME_SORT_BY_SIZE = "vc:mSize";
+
+static const char* DOCML_NAME_ADD_TO_COLLECTION = "vc:mAddtoCollection";
+static const char* DOCML_NAME_CREATE_COLLECTION = "vc:mCreateNewCollection";
+static const char* DOCML_NAME_DELETE_MULTIPLE = "vc:mDeleteMultiple";
+
+static const char* DOCML_NAME_PLAY_IN_QUEUE = "vc:mPlayInQueue";
+static const char* DOCML_NAME_PLAY_ALL_ITEMS = "vc:mPlayAllItems";
+
+// Videocollection hint widget
+static const char* DOCML_NAME_NOVIDEOS_LABEL = "vc:mNoVideosLabel";
+
+// Class declaration
+class VideoCollectionUiLoader : public HbDocumentLoader
+{
+
+public:
+
+ VideoCollectionUiLoader();
+
+ ~VideoCollectionUiLoader();
+
+ /**
+ * Returns the requested widget casted to correct type
+ *
+ * @param name Name of the widget
+ * @return Pointer to the widget
+ */
+ template<class T>
+ T* findWidget( QString name )
+ {
+ return qobject_cast<T*>( HbDocumentLoader::findWidget( name ) );
+ }
+
+ /**
+ * Returns the requested object casted to correct type
+ *
+ * @param name Name of the object
+ * @return Pointer to the object
+ */
+ template<class T>
+ T* findObject( QString name )
+ {
+ return qobject_cast<T*>( HbDocumentLoader::findObject( name ) );
+ }
+
+ static bool mFindFailure;
+
+private:
+
+ QObject *createObject( const QString& type, const QString &name );
+};
+
+#endif // _VIDEOCOLLECTIONUILOADER_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testcollectionview/stub/src/videocollectionuiloader.cpp Thu Apr 01 22:38:49 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:
+*
+*/
+
+#include <hblistview.h>
+#include "videocollectionuiloader.h"
+#include "videolistview.h"
+
+bool VideoCollectionUiLoader::mFindFailure(false);
+
+// ---------------------------------------------------------------------------
+// VideoCollectionUiLoader
+// ---------------------------------------------------------------------------
+//
+VideoCollectionUiLoader::VideoCollectionUiLoader() :
+ HbDocumentLoader()
+{
+}
+
+// ---------------------------------------------------------------------------
+// ~VideoCollectionUiLoader
+// ---------------------------------------------------------------------------
+//
+VideoCollectionUiLoader::~VideoCollectionUiLoader()
+{
+}
+
+// ---------------------------------------------------------------------------
+// createObject
+// ---------------------------------------------------------------------------
+//
+QObject* VideoCollectionUiLoader::createObject( const QString& type, const QString &name )
+{
+ QObject* object = 0;
+
+ if ( type == VideoListView::staticMetaObject.className() )
+ {
+ object = new VideoListView( this );
+ }
+ else if ( type == "VideoListWidget" )
+ {
+ object = new HbListView();
+ }
+ else if ( type == "VideoHintWidget" )
+ {
+ object = new HbWidget();
+ }
+ if ( object )
+ {
+ object->setObjectName( name );
+
+ if (mFindFailure)
+ {
+ delete object;
+ object = 0;
+ }
+ return object;
+ }
+
+ return HbDocumentLoader::createObject( type, name );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testcollectionview/testcollectionview.pro Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,55 @@
+#
+# 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 += . \
+ /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 \
+
+CONFIG += qtestlib \
+ Hb \
+ symbian_test
+
+LIBS += -lestor.dll \
+ -lfbscli.dll \
+ -lbitgdi.dll \
+ -lgdi.dll \
+ -lxqplugins.dll \
+ -lmpxviewframeworkqt.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
+
+RESOURCES += ../../data/videocollectionview.qrc
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/inc/testlistview.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,188 @@
+/**
+* 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 __TESTLISTVIEW_H__
+#define __TESTLISTVIEW_H__
+
+
+// INCLUDES
+#include <QtTest/QtTest>
+#include "hbmessagebox.h"
+
+class VideoListView;
+class VideoSortFilterProxyModel;
+class VideoCollectionWrapper;
+class VideoCollectionUiLoader;
+class VideoListWidget;
+
+class TestListView : public QObject
+{
+ Q_OBJECT
+
+ /**
+ * Will be called before each testfunction is executed.
+ */
+ void init(bool initTestView = true);
+
+ /**
+ * Returns amount of visible menu actions in the video list view.
+ */
+ int visibleMenuActions();
+
+ // Test functions for the test framework.
+
+private slots:
+
+ /**
+ * Will be called after every testfunction.
+ */
+ void cleanup();
+
+ /**
+ * Tests creating and deleting the view.
+ */
+ void testCreateDelete();
+
+ /**
+ * Tests initializeView.
+ */
+ void testInitializeView();
+
+ /**
+ * Tests creating menu of the view.
+ */
+ void testCreateListMenu();
+
+ /**
+ * Tests menus.
+ */
+ void testMenus();
+
+ /**
+ * Tests createAction.
+ */
+ void testCreateAction();
+
+ /**
+ * Tests activatView.
+ */
+ void testActivateView();
+
+ /**
+ * Tests deactivateView.
+ */
+ void testDeactivateView();
+
+ /**
+ * Tests back.
+ */
+ void testBack();
+
+ /**
+ * Tests modelReadySlot.
+ */
+ void testModelReadySlot();
+
+ /**
+ * Tests deleteItemsSlot.
+ */
+ void testDeleteItemsSlot();
+
+ /**
+ * Tests aboutToShowMainMenuSlot.
+ */
+ void testAboutToShowMainMenuSlot();
+
+ /**
+ * Tests openSortByMenuSlot
+ */
+ void testOpenSortByMenuSlot();
+
+ /**
+ * Tests handleStatusSlot.
+ */
+ void testHandleStatusSlot();
+
+ /**
+ * Tests openAllVideosViewSlot.
+ */
+ void testOpenAllVideosViewSlot();
+
+ /**
+ * Tests openCollectionViewSlot.
+ */
+ void testOpenCollectionViewSlot();
+
+ /**
+ * Tests openServicesViewSlot.
+ */
+ void testOpenServicesViewSlot();
+
+ /**
+ * Tests startSortingSlot.
+ */
+ void testStartSortingSlot();
+
+ /**
+ * Tests view when orientation changes.
+ */
+ void testOrientationSlots();
+
+ /**
+ * Tests collectionOpenedSlot.
+ */
+ void testCollectionOpenedSlot();
+
+ /**
+ * Tests updateSubLabel.
+ */
+ void testUpdateSubLabel();
+
+ /**
+ * Tests showHint
+ */
+ void testShowHint();
+
+signals:
+
+ // Signals needed in tests.
+ void testSignal();
+
+ void testSignal(int);
+
+ void testLayoutChangedSignal();
+
+ void testCollectionOpenedSignal(bool, const QString&);
+
+ void testStatusSignal(int, QVariant&);
+
+private:
+
+ VideoCollectionUiLoader* mUiLoader;
+
+ VideoListView* mTestView;
+
+ VideoListWidget* mListWidget;
+
+ VideoCollectionWrapper* mWrapper;
+};
+
+
+#endif // __TESTCOLLECTIONVIEW_H__
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/src/testlistview.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,1313 @@
+/**
+* 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 VideoListView
+*
+*/
+
+#include <QtTest/QtTest>
+#include <QMap>
+#include <hbapplication.h>
+#include <hbinstance.h>
+#include <qactiongroup.h>
+#include <hbmenu.h>
+#include <hbtoolbar.h>
+#include <hbaction.h>
+#include <videocollectioncommon.h>
+#include <hbstackedwidget.h>
+#include <hbgroupbox.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"
+
+#define private public
+#include "videolistview.h"
+#undef private
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ HbApplication app(argc, argv);
+ HbMainWindow window;
+
+ 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);
+
+ return res;
+}
+
+// ---------------------------------------------------------------------------
+// init
+// ---------------------------------------------------------------------------
+//
+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);
+
+ mListWidget = mUiLoader->findWidget<VideoListWidget>(DOCML_NAME_VC_VIDEOLISTWIDGET);
+
+ 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);
+}
+
+// ---------------------------------------------------------------------------
+// cleanup
+// ---------------------------------------------------------------------------
+//
+void TestListView::cleanup()
+{
+ delete mTestView;
+ mTestView = 0;
+ if(mWrapper)
+ {
+ mWrapper->decreaseReferenceCount();
+ QCOMPARE(mWrapper->mReferenceCount, 0);
+ }
+
+ disconnect();
+}
+
+// ---------------------------------------------------------------------------
+// visibleMenuActions
+// ---------------------------------------------------------------------------
+//
+int TestListView::visibleMenuActions()
+{
+ int visibleActions(0);
+ VideoListView::TViewActionIds key;
+ HbAction *action(0);
+ foreach(key,mTestView->mMenuActions.keys())
+ {
+ action = dynamic_cast<HbAction*>(mTestView->mMenuActions[key]);
+ if(action && action->isVisible())
+ visibleActions++;
+ }
+ return visibleActions;
+}
+
+// ---------------------------------------------------------------------------
+// testCreateDelete
+// ---------------------------------------------------------------------------
+//
+void TestListView::testCreateDelete()
+{
+ mWrapper = 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 );
+
+ delete mTestView;
+ mTestView = 0;
+}
+
+// ---------------------------------------------------------------------------
+// Slot: test initialize view
+// ---------------------------------------------------------------------------
+//
+void TestListView::testInitializeView()
+{
+ init(false);
+ // Test videolist widget creation failure.
+ VideoListWidget::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 );
+ QVERIFY( mTestView->mIsService == false );
+
+ cleanup();
+
+ // Test widget creation succeed.
+ init(false);
+ VideoCollectionViewUtils::mSortRole = Qt::DisplayRole;
+ VideoCollectionViewUtils::mSortOrder = Qt::DescendingOrder;
+ QVERIFY( mTestView->initializeView() == 0 );
+ // Verify
+ QVERIFY( mTestView->mVideoListWidget != 0 );
+ QVERIFY( mTestView->mVideoHintWidget != 0 );
+ QCOMPARE( VideoListWidget::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 );
+ QVERIFY( mTestView->mVideoServices == 0 );
+ QVERIFY( mTestView->mIsService == false );
+ cleanup();
+ cleanup();
+
+ // Test command signal.
+ init(true);
+ connect( this, SIGNAL(testSignal(int)), mTestView->mVideoListWidget, SIGNAL(command(int)) );
+ QSignalSpy spy(mTestView, SIGNAL(command(int)));
+ emit testSignal(5);
+ QCOMPARE( spy.count(), 1 );
+ QList<QVariant> arguments = spy.takeFirst();
+ QCOMPARE( arguments.at(0).toInt(), 5 );
+ disconnect();
+ cleanup();
+
+ init(true);
+ VideoListWidget* list = mTestView->mVideoListWidget;
+ VideoHintWidget* hint = mTestView->mVideoHintWidget;
+ QPointer<QActionGroup> toolbar = mTestView->mToolbarViewsActionGroup;
+ QPointer<QActionGroup> toolbar2 = mTestView->mToolbarCollectionActionGroup;
+
+ // Test calling initializeView again.
+ QVERIFY( mTestView->initializeView() == 0 );
+
+ QVERIFY( toolbar != 0 );
+ QVERIFY( toolbar2 != 0 );
+ QVERIFY( mTestView->mVideoListWidget == list );
+ QVERIFY( mTestView->mVideoHintWidget == hint );
+ QVERIFY( mTestView->mToolbarViewsActionGroup == toolbar );
+ QVERIFY( mTestView->mToolbarCollectionActionGroup == toolbar2 );
+
+ // Test view deletion.
+ cleanup();
+ QVERIFY( toolbar == 0 );
+ QVERIFY( toolbar2 == 0 );
+
+ // Test get model failure.
+ init(false);
+ QVERIFY(mTestView);
+ VideoCollectionWrapper::mGetModelFails = true;
+ QVERIFY( mTestView->initializeView() < 0 );
+ QVERIFY( mTestView->mVideoListWidget == 0 );
+ QVERIFY( mTestView->mVideoHintWidget == 0 );
+ QVERIFY( mTestView->mToolbarViewsActionGroup == 0 );
+ QVERIFY( mTestView->mToolbarCollectionActionGroup == 0 );
+ cleanup();
+
+ // Test model open failure.
+ init(false);
+ QVERIFY(mTestView);
+ VideoSortFilterProxyModel::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;
+ QVERIFY( mTestView->initializeView() == 0 );
+ QCOMPARE( VideoSortFilterProxyModel::mSortRole, (int)VideoCollectionCommon::KeyDateTime );
+ QCOMPARE( VideoSortFilterProxyModel::mSortOrder, Qt::AscendingOrder );
+ QVERIFY( VideoSortFilterProxyModel::mSortAsync == false );
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: test create menu
+// ---------------------------------------------------------------------------
+//
+void TestListView::testCreateListMenu()
+{
+ init(false);
+ VideoListWidget::mInitializeReturnValue = -1;
+ QVERIFY( mTestView->initializeView() < 0 );
+ HbMenu* menu = mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU);
+ QVERIFY( menu );
+ QCOMPARE( menu->actions().count(), 4 );
+
+ cleanup();
+
+ init(false);
+ VideoListWidget::mInitializeReturnValue = 0;
+ QVERIFY( mTestView->initializeView() == 0 );
+ menu = mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU);
+ QVERIFY( menu );
+ QCOMPARE( menu->actions().count(), 4 );
+
+ HbAction* sortAction = dynamic_cast<HbAction*>(menu->actions().at(3));
+ QVERIFY( sortAction );
+ menu = mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU);
+ QVERIFY(menu != 0);
+ QVERIFY( menu->actions().count() == 4 );
+
+ QVERIFY( mTestView->mMenuActions.count() == 9 );
+ QVERIFY( mTestView->mSortingRoles.count() == 5 );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testMenus
+// ---------------------------------------------------------------------------
+//
+void TestListView::testMenus()
+{
+ init();
+
+ HbAction* action;
+ QList<QAction*> tbActions = mTestView->toolBar()->actions();
+ QList<QAction*> tbGroupActions;
+ QList<QAction*> tbGroupActions2;
+
+ // All videos is open for default, verify.
+ QVERIFY(mTestView->mToolbarViewsActionGroup != 0);
+ QVERIFY(mTestView->mToolbarCollectionActionGroup != 0);
+ tbGroupActions = mTestView->mToolbarViewsActionGroup->actions();
+ tbGroupActions2 = mTestView->mToolbarCollectionActionGroup->actions();
+ QVERIFY(mTestView->mToolbarActions.count() == 6);
+ QVERIFY(tbActions.count() == 3);
+ QVERIFY(tbGroupActions.count() == 3);
+ QVERIFY(tbGroupActions2.count() == 3);
+ QVERIFY( tbGroupActions.at(0)->isChecked() ); // First is checked.
+ // visible menu items remains constant after init until
+ // aboutToShowMainMenuSlot is called
+ QVERIFY(visibleMenuActions() == 9);
+ // Verify checkable and visible toolbar actions.
+ HbAction* allVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionAllVideos];
+ HbAction* collectionsAction = mTestView->mToolbarActions[VideoListView::ETBActionCollections];
+ HbAction* servicesAction = mTestView->mToolbarActions[VideoListView::ETBActionServices];
+ HbAction* addVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionAddVideos];
+ HbAction* removeVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionRemoveVideos];
+ HbAction* sortVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionSortVideos];
+ QVERIFY( allVideosAction != 0 && allVideosAction->isCheckable() && allVideosAction->isVisible() &&
+ tbActions.at(0) == tbGroupActions.at(0));
+ QVERIFY( collectionsAction != 0 && collectionsAction->isCheckable() && collectionsAction->isVisible() &&
+ tbActions.at(1) == tbGroupActions.at(1));
+ QVERIFY( servicesAction != 0 && servicesAction->isCheckable() && servicesAction->isVisible() &&
+ tbActions.at(2) == tbGroupActions.at(2));
+ QVERIFY( addVideosAction != 0 && !addVideosAction->isCheckable() &&
+ tbActions.at(0) != tbGroupActions2.at(0));
+ QVERIFY( removeVideosAction != 0 && !removeVideosAction->isCheckable() &&
+ tbActions.at(1) != tbGroupActions2.at(1));
+ QVERIFY( sortVideosAction != 0 && !sortVideosAction->isCheckable() &&
+ tbActions.at(2) != tbGroupActions2.at(2));
+
+ // Open collections.
+ action = dynamic_cast<HbAction*>(tbGroupActions.at(1));
+ QVERIFY(action);
+ action->setChecked(false);
+ action->trigger();
+
+ // Verify.
+ QVERIFY(mTestView->mToolbarViewsActionGroup);
+ tbGroupActions = mTestView->mToolbarViewsActionGroup->actions();
+ QVERIFY(mTestView->mToolbarActions.count() == 6);
+ QVERIFY(tbGroupActions.count() == 3);
+ QVERIFY(tbGroupActions2.count() == 3);
+ QVERIFY( tbGroupActions.at(1)->isChecked() ); // 2nd is checked.
+ // visible menu items remains constant after init until
+ // aboutToShowMainMenuSlot is called
+ QVERIFY(visibleMenuActions() == 9);
+ // Verify checkable and visible toolbar actions.
+ allVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionAllVideos];
+ collectionsAction = mTestView->mToolbarActions[VideoListView::ETBActionCollections];
+ servicesAction = mTestView->mToolbarActions[VideoListView::ETBActionServices];
+ addVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionAddVideos];
+ removeVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionRemoveVideos];
+ sortVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionSortVideos];
+ QVERIFY( allVideosAction != 0 && allVideosAction->isCheckable() && allVideosAction->isVisible() &&
+ tbActions.at(0) == tbGroupActions.at(0));
+ QVERIFY( collectionsAction != 0 && collectionsAction->isCheckable() && collectionsAction->isVisible() &&
+ tbActions.at(1) == tbGroupActions.at(1));
+ QVERIFY( servicesAction != 0 && servicesAction->isCheckable() && servicesAction->isVisible() &&
+ tbActions.at(2) == tbGroupActions.at(2));
+ QVERIFY( addVideosAction != 0 && !addVideosAction->isCheckable() &&
+ tbActions.at(0) != tbGroupActions2.at(0));
+ QVERIFY( removeVideosAction != 0 && !removeVideosAction->isCheckable() &&
+ tbActions.at(1) != tbGroupActions2.at(1));
+ QVERIFY( sortVideosAction != 0 && !sortVideosAction->isCheckable() &&
+ tbActions.at(2) != tbGroupActions2.at(2));
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: test create toolbar
+// ---------------------------------------------------------------------------
+//
+void TestListView::testCreateAction()
+{
+ init();
+
+ QVERIFY(mTestView->mToolbarViewsActionGroup != 0);
+
+ QList<QAction*> actions = mTestView->mToolbarViewsActionGroup->actions();
+ actions.append(mTestView->mToolbarCollectionActionGroup->actions());
+ QVERIFY(actions.count() == 6);
+
+ QCOMPARE( mTestView->toolBar()->actions().count(), 3 );
+
+ 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();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: test activate view
+// ---------------------------------------------------------------------------
+//
+void TestListView::testActivateView()
+{
+ init();
+
+ VideoListWidget* list = mTestView->mVideoListWidget;
+ mTestView->mVideoListWidget = 0;
+
+ QCOMPARE( mTestView->activateView(), -1 );
+ QVERIFY( mTestView->mVideoListWidget->mActive == false );
+ QCOMPARE( mTestView->mVideoListWidget->mActivateCount, 0 );
+ QCOMPARE( mTestView->mVideoListWidget->mDeactivateCount, 0 );
+ QVERIFY( mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->isEnabled() == false );
+
+ mTestView->mVideoListWidget = list;
+
+ VideoListWidget::mActivateReturnValue = -1;
+
+ QCOMPARE( mTestView->activateView(), -1 );
+ QVERIFY( mTestView->mVideoListWidget->mActive == false );
+ QCOMPARE( mTestView->mVideoListWidget->mActivateCount, 1 );
+ QCOMPARE( mTestView->mVideoListWidget->mDeactivateCount, 1 );
+ QVERIFY( mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->isEnabled() == false );
+
+ VideoListWidget::mActivateReturnValue = 0;
+
+ QCOMPARE( mTestView->activateView(), 0 );
+ QVERIFY( mTestView->mVideoListWidget->mActive );
+ QCOMPARE( mTestView->mVideoListWidget->mActivateCount, 2 );
+ QCOMPARE( mTestView->mVideoListWidget->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( mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->isEnabled() );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: test deactivate view
+// ---------------------------------------------------------------------------
+//
+void TestListView::testDeactivateView()
+{
+ init();
+
+ VideoListWidget* list = mTestView->mVideoListWidget;
+ mTestView->mVideoListWidget = 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;
+
+ 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 );
+
+ VideoListWidget::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 );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testBack
+// ---------------------------------------------------------------------------
+//
+void TestListView::testBack()
+{
+ init();
+
+ mTestView->back();
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: test open all videos slot
+// ---------------------------------------------------------------------------
+//
+void TestListView::testOpenAllVideosViewSlot()
+{
+ init();
+
+ 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;
+
+ // 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 );
+
+ mTestView->activateView();
+
+ mTestView->mVideoListWidget->mActivateCount = 0;
+ mTestView->mVideoListWidget->mType = VideoListWidget::EAllVideos;
+ mTestView->mVideoListWidget->mCurrentLevel = VideoListWidget::ELevelCategory;
+ mTestView->mSubLabel->setHeading("invalid");
+ mTestView->mModel->mLevel = -1;
+
+ // 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 );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: test open collections view slot
+// ---------------------------------------------------------------------------
+//
+void TestListView::testOpenCollectionViewSlot()
+{
+ 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;
+
+ // 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 );
+
+ mTestView->activateView();
+
+ mTestView->mVideoListWidget->mActivateCount = 0;
+ mTestView->mVideoListWidget->mType = VideoListWidget::ECollections;
+ mTestView->mVideoListWidget->mCurrentLevel = VideoListWidget::ELevelVideos;
+ mTestView->mSubLabel->setHeading("invalid");
+ mTestView->mModel->mLevel = -1;
+
+ // 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 );
+
+ cleanup();
+}
+// ---------------------------------------------------------------------------
+// Slot: test open services view slot
+// ---------------------------------------------------------------------------
+//
+void TestListView::testOpenServicesViewSlot()
+{
+ init();
+
+ QList<QAction*> actions = mTestView->mToolbarViewsActionGroup->actions();
+ HbAction* action = static_cast<HbAction*>(actions.at(2));
+
+ // action wont emit if it's already checked.
+ action->setChecked(false);
+ action->trigger();
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testStartSorting
+// ---------------------------------------------------------------------------
+//
+void TestListView::testStartSortingSlot()
+{
+ HbAction *action(0);
+
+ // Active action is not sort by.
+ init(true);
+ action = mTestView->mMenuActions[VideoListView::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);
+ 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;
+ 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);
+
+ // Change the action back.
+ mTestView->mMenuActions[VideoListView::EActionSortBy] = sortByAction;
+
+ cleanup();
+
+ // View is not initialized.
+ init(false);
+ connect(this, SIGNAL(testSignal(int)), mTestView, SLOT(startSorting()));
+ emit testSignal(0);
+ QCOMPARE(VideoSortFilterProxyModel::mDoSortingCallCount, 0);
+ QCOMPARE(VideoSortFilterProxyModel::mSortRole, -1);
+ cleanup();
+
+ // Good case.
+ init();
+ action = mTestView->mMenuActions[VideoListView::EActionSortBy];
+ QVERIFY(action != 0);
+ mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->setActiveAction(action);
+ HbAction* sortAction = mTestView->mMenuActions[VideoListView::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);
+
+ // 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);
+
+ // 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);
+
+ // test that after changing the sort role, the order is also switched to ascending.
+ VideoSortFilterProxyModel::mSortOrder = Qt::DescendingOrder;
+ sortAction = mTestView->mMenuActions[VideoListView::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);
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: test orientation related slots
+// ---------------------------------------------------------------------------
+//
+void TestListView::testOrientationSlots()
+{
+ init();
+
+ HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
+ mainWnd->addView(mTestView);
+ mainWnd->setOrientation(Qt::Horizontal);
+ mainWnd->setOrientation(Qt::Vertical);
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testModelReadySlot
+// ---------------------------------------------------------------------------
+//
+void TestListView::testModelReadySlot()
+{
+ init();
+ mTestView->mModelReady = false;
+ connect( this, SIGNAL(testSignal()), mTestView, SLOT(modelReadySlot()) );
+ emit testSignal();
+ QVERIFY(mTestView->mModelReady);
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testDeleteItemsSlot
+// ---------------------------------------------------------------------------
+//
+void TestListView::testDeleteItemsSlot()
+{
+ init();
+ connect( this, SIGNAL(testSignal()), mTestView, SLOT(deleteItemsSlot()) );
+ ////////////
+ // no model
+ ////////////
+ VideoSortFilterProxyModel *tmpModel = mTestView->mModel;
+ mTestView->mModel = 0;
+ emit testSignal();
+ QVERIFY(VideoListSelectionDialog::mMultiSelectionLaunchCount == 0);
+ QVERIFY(VideoListSelectionDialog::mMultiSelectionItemSelectionCount == 0);
+ mTestView->mModel = tmpModel;
+
+ cleanup();
+ init();
+ connect( this, SIGNAL(testSignal()), mTestView, SLOT(deleteItemsSlot()) );
+
+ ////////////
+ // no selection dialog
+ ////////////
+ emit testSignal();
+ QVERIFY(VideoListSelectionDialog::mMultiSelectionLaunchCount == 1);
+ QVERIFY(VideoListSelectionDialog::mMultiSelectionItemSelectionCount == 0);
+
+ cleanup();
+ init();
+ connect( this, SIGNAL(testSignal()), mTestView, SLOT(deleteItemsSlot()) );
+
+ ////////////
+ // dialog loading fails
+ ////////////
+ VideoCollectionUiLoader::mFailDialogLoad = true;
+ emit testSignal();
+ QVERIFY(VideoListSelectionDialog::mMultiSelectionLaunchCount == 0);
+ QVERIFY(VideoListSelectionDialog::mMultiSelectionItemSelectionCount == 0);
+ VideoCollectionUiLoader::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();
+ connect( this, SIGNAL(testSignal()), mTestView, SLOT(deleteItemsSlot()) );
+
+ ////////////
+ // selection dialog exists
+ ////////////
+ emit testSignal();
+ QVERIFY(VideoListSelectionDialog::mMultiSelectionLaunchCount == 1);
+ QVERIFY(VideoListSelectionDialog::mMultiSelectionItemSelectionCount == 0);
+ emit testSignal();
+ QVERIFY(VideoListSelectionDialog::mMultiSelectionLaunchCount == 2);
+ QVERIFY(VideoListSelectionDialog::mMultiSelectionItemSelectionCount == 0);
+
+ cleanup();
+ init();
+ connect( this, SIGNAL(testSignal()), mTestView, SLOT(deleteItemsSlot()) );
+
+ ////////////
+ // exec returns primary key (just for the coverity's sake)
+ ////////////
+ VideoListSelectionDialog:: mExecReturnPrimary = true;
+ VideoListSelectionDialog::mSelectionCount = 5;
+ emit testSignal();
+ QVERIFY(VideoListSelectionDialog::mMultiSelectionLaunchCount == 1);
+ QVERIFY(VideoListSelectionDialog::mMultiSelectionItemSelectionCount == 5);
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testAboutToShowMainMenuSlot
+// ---------------------------------------------------------------------------
+//
+void TestListView::testAboutToShowMainMenuSlot()
+{
+ // All ok.
+ init();
+ mWrapper->getDataModel()->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();
+
+ HbAction *action(0);
+
+ // Collections is triggered from toolbar.
+ init();
+ mWrapper->getDataModel()->setRowCount(1);
+ action = mTestView->mToolbarActions[VideoListView::ETBActionCollections];
+ QVERIFY(action != 0);
+ action->setChecked(false);
+ action->trigger();
+ mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->show();
+ int visible = visibleMenuActions();
+ QCOMPARE(visible, 5);
+ cleanup();
+
+ // All videos is triggered from toolbar.
+ init();
+ mWrapper->getDataModel()->setRowCount(1);
+ action = mTestView->mToolbarActions[VideoListView::ETBActionAllVideos];
+ QVERIFY(action != 0);
+ action->setChecked(false);
+ action->trigger();
+ mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->show();
+ visible = visibleMenuActions();
+ QCOMPARE(visible, 6);
+ cleanup();
+
+ // Services is triggered from toolbar.
+ init();
+ mWrapper->getDataModel()->setRowCount(1);
+ action = mTestView->mToolbarActions[VideoListView::ETBActionServices];
+ QVERIFY(action != 0);
+ action->setChecked(false);
+ action->trigger();
+ mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->show();
+ visible = visibleMenuActions();
+ QCOMPARE(visible, 0);
+ cleanup();
+
+ // Add videos action is visible.
+ init();
+ mTestView->toolBar()->clearActions();
+ mTestView->toolBar()->addActions( mTestView->mToolbarCollectionActionGroup->actions() );
+
+ mWrapper->getDataModel()->setRowCount(1);
+ QVERIFY(action != 0);
+ mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->show();
+ visible = visibleMenuActions();
+ QCOMPARE(visible, 1);
+ cleanup();
+
+ // Menu action is null
+ init();
+ mWrapper->getDataModel()->setRowCount(1);
+ action = mTestView->mMenuActions.take(VideoListView::EActionSortBy);
+ delete action;
+ action = NULL;
+ mTestView->mMenuActions[VideoListView::EActionSortBy] = action;
+ mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->show();
+ visible = visibleMenuActions();
+ QCOMPARE(visible, 0);
+ cleanup();
+
+ // No menu actions.
+ init();
+ mWrapper->getDataModel()->setRowCount(1);
+ QMap<VideoListView::TViewActionIds, HbAction*> backupActions =
+ QMap<VideoListView::TViewActionIds, HbAction*>(mTestView->mMenuActions);
+ mTestView->mMenuActions.clear();
+ mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->show();
+ mTestView->mMenuActions.unite(backupActions);
+ cleanup();
+
+ // Model has no items.
+ init();
+ mWrapper->getDataModel()->setRowCount(0);
+ mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->show();
+ visible = visibleMenuActions();
+ QCOMPARE(visible, 0);
+ cleanup();
+
+ // Toolbar action group is null
+ init();
+ mWrapper->getDataModel()->setRowCount(1);
+ QActionGroup* actionGroup = mTestView->mToolbarViewsActionGroup;
+ mTestView->mToolbarViewsActionGroup = NULL;
+ mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->show();
+ mTestView->mToolbarViewsActionGroup = actionGroup;
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testOpenSortByMenuSlot
+// ---------------------------------------------------------------------------
+//
+void TestListView::testOpenSortByMenuSlot()
+{
+ DummyHbMenu *dummyMenu = new DummyHbMenu;
+ HbMenu *tmpMenu;
+
+ // All ok.
+ init();
+ tmpMenu = mTestView->mSortMenu;
+ mTestView->mSortMenu = dummyMenu;
+ connect( this, SIGNAL(testSignal(int)), mTestView, SLOT(openSortByMenuSlot()) );
+ mWrapper->getDataModel()->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;
+ connect( this, SIGNAL(testSignal(int)), mTestView, SLOT(openSortByMenuSlot()) );
+ mWrapper->getDataModel()->setRowCount(1);
+ mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->hide();
+ emit testSignal(0);
+ QCOMPARE(visibleMenuActions(), 0);
+ mTestView->mSortMenu = tmpMenu;
+ cleanup();
+
+ // no items
+ init();
+ tmpMenu = mTestView->mSortMenu;
+ mTestView->mSortMenu = dummyMenu;
+ connect( this, SIGNAL(testSignal(int)), mTestView, SLOT(openSortByMenuSlot()) );
+ mWrapper->getDataModel()->setRowCount(0);
+ mUiLoader->findWidget<HbMenu>(DOCML_NAME_OPTIONS_MENU)->hide();
+ emit testSignal(0);
+ QCOMPARE(visibleMenuActions(), 0);
+ mTestView->mSortMenu = tmpMenu;
+ cleanup();
+
+ delete dummyMenu;
+
+}
+
+// ---------------------------------------------------------------------------
+// testHandleErrorSlot
+// ---------------------------------------------------------------------------
+//
+void TestListView::testHandleStatusSlot()
+{
+ QVariant *variant = new QVariant();
+
+ // Unknown error code.
+ init();
+ connect(this, SIGNAL(testStatusSignal(int, QVariant&)), mTestView, SLOT(handleAsyncStatusSlot(int, QVariant&)));
+ emit testStatusSignal(0, *variant);
+ QVERIFY(VideoCollectionViewUtils::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);
+ 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);
+ 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);
+ cleanup();
+
+ // No model.
+ init(false);
+ connect(this, SIGNAL(testStatusSignal(int, QVariant&)), mTestView, SLOT(handleAsyncStatusSlot(int, QVariant&)));
+ emit testStatusSignal(1, *variant);
+ QVERIFY(VideoCollectionViewUtils::mLastError == 1);
+ cleanup();
+
+ delete variant;
+}
+
+// ---------------------------------------------------------------------------
+// testCollectionOpenedSlot
+// ---------------------------------------------------------------------------
+//
+void TestListView::testCollectionOpenedSlot()
+{
+ HbAction* removeVideosAction;
+ HbAction* allVideosAction;
+ HbAction* collectionsAction;
+ HbAction* servicesAction;
+ HbAction* addVideosAction;
+ HbAction* sortVideosAction;
+
+ QString testString;
+
+ // View is not initialized.
+ init(false);
+ connect(this, SIGNAL(testCollectionOpenedSignal(bool, const QString&)), mTestView, SLOT(collectionOpenedSlot(bool, const QString&)));
+ emit testCollectionOpenedSignal(false, testString);
+ cleanup();
+
+ // No toolbar actions.
+ init(true);
+ // Clear actions.
+ QMap<VideoListView::TViewActionIds, HbAction*> backupActions =
+ QMap<VideoListView::TViewActionIds, HbAction*>(mTestView->mToolbarActions);
+ mTestView->mToolbarActions.clear();
+ connect(this, SIGNAL(testCollectionOpenedSignal(bool, const QString&)), mTestView, SLOT(collectionOpenedSlot(bool, const QString&)));
+ emit testCollectionOpenedSignal(true, testString);
+ mTestView->mToolbarActions.unite(backupActions);
+ cleanup();
+
+ // One of the toolbar actions is null.
+ init();
+ removeVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionRemoveVideos];
+ mTestView->mToolbarActions[VideoListView::ETBActionRemoveVideos] = NULL;
+ connect(this, SIGNAL(testCollectionOpenedSignal(bool, const QString&)), mTestView, SLOT(collectionOpenedSlot(bool, const QString&)));
+ emit testCollectionOpenedSignal(true, testString);
+ // Verify checkable and visible toolbar actions.
+ mTestView->mToolbarActions[VideoListView::ETBActionRemoveVideos] = removeVideosAction;
+ allVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionAllVideos];
+ collectionsAction = mTestView->mToolbarActions[VideoListView::ETBActionCollections];
+ servicesAction = mTestView->mToolbarActions[VideoListView::ETBActionServices];
+ addVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionAddVideos];
+ sortVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionSortVideos];
+ // Remove videos is not checked because it was used as null action.
+ QCOMPARE( mTestView->mCollectionName, testString );
+ QCOMPARE( mTestView->toolBar()->actions().count(), 3 );
+ QVERIFY( allVideosAction != 0 && allVideosAction->isCheckable());
+ QVERIFY( collectionsAction != 0 && collectionsAction->isCheckable());
+ QVERIFY( servicesAction != 0 && servicesAction->isCheckable());
+ QVERIFY( addVideosAction != 0 && !addVideosAction->isCheckable() );
+ QVERIFY( sortVideosAction != 0 && !sortVideosAction->isCheckable() );
+ cleanup();
+
+
+ testString = "Test text string";
+
+ // Collection opened.
+ init();
+ connect(this, SIGNAL(testCollectionOpenedSignal(bool, const QString&)), mTestView, SLOT(collectionOpenedSlot(bool, const QString&)));
+ emit testCollectionOpenedSignal(true, testString);
+ // Verify checkable and visible toolbar actions.
+ allVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionAllVideos];
+ collectionsAction = mTestView->mToolbarActions[VideoListView::ETBActionCollections];
+ servicesAction = mTestView->mToolbarActions[VideoListView::ETBActionServices];
+ addVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionAddVideos];
+ removeVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionRemoveVideos];
+ sortVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionSortVideos];
+ QCOMPARE(mTestView->mCollectionName, testString);
+ QCOMPARE( mTestView->toolBar()->actions().count(), 3 );
+ QVERIFY( allVideosAction != 0 && allVideosAction->isCheckable());
+ QVERIFY( collectionsAction != 0 && collectionsAction->isCheckable());
+ QVERIFY( servicesAction != 0 && servicesAction->isCheckable());
+ QVERIFY( addVideosAction != 0 && !addVideosAction->isCheckable() );
+ QVERIFY( removeVideosAction != 0 && !removeVideosAction->isCheckable() );
+ QVERIFY( sortVideosAction != 0 && !sortVideosAction->isCheckable() );
+ cleanup();
+
+ testString = "Test text string 2";
+
+ // Collection not opened.
+ init();
+ connect(this, SIGNAL(testCollectionOpenedSignal(bool, const QString&)), mTestView, SLOT(collectionOpenedSlot(bool, const QString&)));
+ emit testCollectionOpenedSignal(false, testString);
+ // Verify checkable and visible toolbar actions.
+ allVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionAllVideos];
+ collectionsAction = mTestView->mToolbarActions[VideoListView::ETBActionCollections];
+ servicesAction = mTestView->mToolbarActions[VideoListView::ETBActionServices];
+ addVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionAddVideos];
+ removeVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionRemoveVideos];
+ sortVideosAction = mTestView->mToolbarActions[VideoListView::ETBActionSortVideos];
+ QCOMPARE(mTestView->mCollectionName, testString);
+ QCOMPARE( mTestView->toolBar()->actions().count(), 3 );
+ QVERIFY( allVideosAction != 0 && allVideosAction->isCheckable());
+ QVERIFY( collectionsAction != 0 && collectionsAction->isCheckable());
+ QVERIFY( servicesAction != 0 && servicesAction->isCheckable());
+ QVERIFY( addVideosAction != 0 && !addVideosAction->isCheckable() );
+ QVERIFY( removeVideosAction != 0 && !removeVideosAction->isCheckable() );
+ QVERIFY( sortVideosAction != 0 && !sortVideosAction->isCheckable() );
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testUpdateSubLabel
+// ---------------------------------------------------------------------------
+//
+void TestListView::testUpdateSubLabel()
+{
+ init(true);
+ 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;
+
+ emit testLayoutChangedSignal();
+
+ HbGroupBox* label = mUiLoader->findWidget<HbGroupBox>(DOCML_NAME_VC_HEADINGBANNER);
+
+ QString returnString = label->heading();
+ QString expectedString = "1 videos";
+
+ QCOMPARE(returnString, expectedString);
+
+ mTestView->mVideoListWidget->mType = VideoListWidget::EUnknown;
+
+ emit testLayoutChangedSignal();
+
+ returnString = label->heading();
+ expectedString = "1 videos";
+
+ QCOMPARE(returnString, expectedString);
+
+ mTestView->mVideoListWidget->mType = VideoListWidget::ECollections;
+
+ emit testLayoutChangedSignal();
+
+ returnString = label->heading();
+ expectedString = "1 collections";
+
+ QCOMPARE(returnString, expectedString);
+
+ mTestView->mVideoListWidget->mType = VideoListWidget::EUnknown;
+
+ emit testLayoutChangedSignal();
+
+ returnString = label->heading();
+ expectedString = "1 collections";
+
+ QCOMPARE(returnString, expectedString);
+
+ mTestView->mVideoListWidget->mType = VideoListWidget::EDefaultColItems;
+
+ emit testLayoutChangedSignal();
+
+ returnString = label->heading();
+ expectedString = " (1)";
+
+ QCOMPARE(returnString, expectedString);
+
+ mTestView->mVideoListWidget->mType = VideoListWidget::EUnknown;
+ expectedString = " (1)";
+
+ emit testLayoutChangedSignal();
+
+ returnString = label->heading();
+
+ QCOMPARE(returnString, expectedString);
+
+ mTestView->mVideoListWidget->mType = VideoListWidget::EUserColItems;
+
+ emit testCollectionOpenedSignal(true, QString("NAME"));
+ emit testLayoutChangedSignal();
+
+ returnString = label->heading();
+ expectedString = "NAME (1)";
+
+ 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);
+}
+
+// ---------------------------------------------------------------------------
+// testShowHint
+// ---------------------------------------------------------------------------
+//
+void TestListView::testShowHint()
+{
+ init(true);
+ connect(this, SIGNAL(testLayoutChangedSignal()), mTestView, SLOT(layoutChangedSlot()));
+ mWrapper->getDataModel()->setRowCount(1);
+
+ 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);
+
+ emit testLayoutChangedSignal();
+
+ QVERIFY(mTestView->mVideoHintWidget->isVisible());
+
+ VideoSortFilterProxyModel* model = mTestView->mModel;
+ mTestView->mModel = 0;
+ mTestView->mModelReady = true;
+
+ emit testLayoutChangedSignal();
+
+ QVERIFY(mTestView->mVideoHintWidget->isVisible() == false);
+
+ 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.
+ emit testLayoutChangedSignal();
+
+ mTestView->mVideoHintWidget = hint;
+ mTestView->mVideoHintWidget->setVisible(false);
+
+ emit testLayoutChangedSignal();
+
+ QVERIFY(mTestView->mVideoHintWidget->isVisible());
+
+ mWrapper->getDataModel()->setRowCount(1);
+ mTestView->mVideoHintWidget->setVisible(true);
+
+ emit testLayoutChangedSignal();
+
+ QVERIFY(mTestView->mVideoHintWidget->isVisible() == false);
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/inc/hbmessagebox.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* 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>
+
+class HbMessageBox;
+
+
+class HbMessageBox
+{
+
+public:
+
+ static bool question(QString text)
+ {
+ mLatestTxt = text;
+ return mQuestionReturnValue;
+ }
+
+ static void information(QString text)
+ {
+ mLatestTxt = text;
+ }
+
+ /**
+ * returned from question
+ */
+ static bool mQuestionReturnValue;
+
+ /**
+ * saved text
+ */
+ static QString mLatestTxt;
+
+};
+
+
+
+#endif // HBMESSAGEBOX_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/inc/videocollectionuiloader.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,106 @@
+/*
+* 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 _VIDEOCOLLECTIONUILOADER_H_
+#define _VIDEOCOLLECTIONUILOADER_H_
+
+// System includes
+#include <hbdocumentloader.h>
+
+// Constants
+static const char* DOCML_VIDEOCOLLECTIONVIEW_FILE = ":/layout/collectionview.docml";
+static const char* DOCML_NAME_VIEW = "view";
+
+// Videocollection View
+static const char* DOCML_NAME_VC_HEADINGBANNER = "vc:mBanner";
+static const char* DOCML_NAME_VC_VIDEOLISTWIDGET = "vc:mListWidget";
+static const char* DOCML_NAME_VC_VIDEOHINTWIDGET = "vc:mHintWidget";
+
+// Videocollection Options Menu
+static const char* DOCML_NAME_OPTIONS_MENU = "vc:mOptionsMenu";
+static const char* DOCML_NAME_SORT_MENU = "vc:mSortBy";
+
+static const char* DOCML_NAME_SORT_BY_DATE = "vc:mDate";
+static const char* DOCML_NAME_SORT_BY_NAME = "vc:mName";
+static const char* DOCML_NAME_SORT_BY_NUMBER_OF_ITEMS = "vc:mNumberOfItems";
+static const char* DOCML_NAME_SORT_BY_TOTAL_LENGTH = "vc:mTotalLength";
+static const char* DOCML_NAME_SORT_BY_RATING = "vc:mRating";
+static const char* DOCML_NAME_SORT_BY_SIZE = "vc:mSize";
+
+static const char* DOCML_NAME_ADD_TO_COLLECTION = "vc:mAddtoCollection";
+static const char* DOCML_NAME_CREATE_COLLECTION = "vc:mCreateNewCollection";
+static const char* DOCML_NAME_DELETE_MULTIPLE = "vc:mDeleteMultiple";
+
+static const char* DOCML_NAME_PLAY_IN_QUEUE = "vc:mPlayInQueue";
+static const char* DOCML_NAME_PLAY_ALL_ITEMS = "vc:mPlayAllItems";
+
+// Videocollection hint widget
+static const char* DOCML_NAME_HINT_BUTTON = "vc:mHintButton";
+static const char* DOCML_NAME_HINT_LABEL = "vc:mHintTextLabel";
+
+// 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_MARKALL = "mCheckMarkAll";
+static const char* DOCML_NAME_LBL_SELECTION = "mSelectionCount";
+static const char* DOCML_NAME_LIST_CONTAINER = "mListContainer";
+
+// Class declaration
+class VideoCollectionUiLoader : public HbDocumentLoader
+{
+
+public:
+
+ VideoCollectionUiLoader();
+
+ ~VideoCollectionUiLoader();
+
+ /**
+ * Returns the requested widget casted to correct type
+ *
+ * @param name Name of the widget
+ * @return Pointer to the widget
+ */
+ template<class T>
+ T* findWidget( QString name )
+ {
+ return qobject_cast<T*>( HbDocumentLoader::findWidget( name ) );
+ }
+
+ /**
+ * Returns the requested object casted to correct type
+ *
+ * @param name Name of the object
+ * @return Pointer to the object
+ */
+ template<class T>
+ T* findObject( QString name )
+ {
+ return qobject_cast<T*>( HbDocumentLoader::findObject( name ) );
+ }
+
+ static bool mFindFailure;
+
+ static bool mFailDialogLoad;
+
+private:
+
+ QObject *createObject( const QString& type, const QString &name );
+};
+
+#endif // _VIDEOCOLLECTIONUILOADER_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/inc/videocollectionviewutils.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,97 @@
+/*
+* 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 video collection view plugin's ui utils class
+*
+*/
+
+#ifndef __VIDEOCOLLECTIONVIEWUTILS_H__
+#define __VIDEOCOLLECTIONVIEWUTILS_H__
+
+#include <qobject.h>
+#include <QItemSelection>
+
+class HbPopupBase;
+class QItemSelection;
+class HbStackedWidget;
+
+class VideoCollectionViewUtils : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * 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 VideoCollectionViewUtils& instance();
+
+ /**
+ * Saves the sorting role and order to cenrep.
+ *
+ * @param role The sorting role.
+ * @param order The sorting order (e.g. ascending or descending).
+ * @return Zero if operation succeeded, less than zero in error cases.
+ */
+ int saveSortingValues(int role, Qt::SortOrder order);
+
+ /**
+ * Loads the sorting role and order from cenrep.
+ *
+ * @param role On return contains the sorting role.
+ * @param order On return contains the sorting order
+ * @return Zero if operation succeeded, less than zero in error cases.
+ */
+ int loadSortingValues(int& role, Qt::SortOrder& order);
+
+public slots:
+
+ /**
+ * Shows status msgs
+ *
+ * @param statusCode status code
+ * @param additional additional data gotten from the status
+ */
+ void showStatusMsgSlot(int statusCode, QVariant &additional);
+
+private:
+
+ /**
+ * disables copy-constructor and assingment operator
+ */
+ Q_DISABLE_COPY(VideoCollectionViewUtils)
+
+ /**
+ * constructor
+ */
+ VideoCollectionViewUtils();
+
+ /**
+ * destructor
+ */
+ virtual ~VideoCollectionViewUtils();
+
+
+public:
+ static int mLastError;
+ static bool mLoadSortingValuesFails;
+
+ static int mSortRole;
+ static Qt::SortOrder mSortOrder;
+};
+
+#endif //__VIDEOCOLLECTIONVIEWUTILS_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/inc/videocollectionwrapper.h Thu Apr 01 22:38:49 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: VideoCollectionWrapper dummy class definition
+*
+*/
+
+#ifndef __VIDEOCOLLECTIONWRAPPER_H__
+#define __VIDEOCOLLECTIONWRAPPER_H__
+
+
+// INCLUDES
+#include <QObject>
+
+
+// FORWARD DECLARATIONS
+class VideoSortFilterProxyModel;
+class DummyDataModel;
+
+class VideoCollectionWrapper : public QObject
+{
+ /**
+ * define to be able to use signals and slots
+ */
+ Q_OBJECT
+
+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();
+
+ /**
+ * Decreases the reference count, when count reaches zero cleanup is done.
+ *
+ */
+ void decreaseReferenceCount();
+
+
+ /**
+ * Opens a collection into all videos category, if not yet opened, and
+ * returns pointer to model
+ *
+ * @return address to model or NULL if fails.
+ */
+ VideoSortFilterProxyModel* open(int level);
+
+ /**
+ * Returns pointer to model
+ *
+ * @return address to model or NULL if fails.
+ */
+ VideoSortFilterProxyModel* getModel();
+
+ /**
+ * Method can be used by client to emit status signal
+ * indicating async operation status.
+ *
+ * @param statusCode code of error
+ *
+ * @param additional additional information for the code
+ */
+ void sendAsyncStatus(int statusCode, QVariant &additional);
+
+public: // Test functions:
+
+ /**
+ * Returns pointer to model with the data.
+ *
+ * @return address to model or NULL if fails.
+ */
+ DummyDataModel* getDataModel();
+
+signals:
+
+ /**
+ * Signal to be emitted in case of some error
+ *
+ * @param statusCode code of error
+ *
+ * @param additional additional information for the code
+ */
+ void asyncStatus(int statusCode, QVariant &additional);
+
+private:
+
+ /**
+ * Private contructor.
+ */
+ VideoCollectionWrapper();
+
+ /**
+ * Private destructor.
+ *
+ */
+ virtual ~VideoCollectionWrapper();
+
+ /**
+ * Creates model.
+ */
+ void createModel();
+
+ /**
+ * disables copy-constructor and assingment operator
+ */
+ Q_DISABLE_COPY(VideoCollectionWrapper)
+
+public:
+
+ VideoSortFilterProxyModel *mModel;
+ DummyDataModel *mDataModel;
+
+ static VideoCollectionWrapper *mInstance;
+
+ static int mReferenceCount;
+
+public:
+ static bool mOpenFails;
+ static bool mGetModelFails;
+};
+
+#endif // __VIDEOCOLLECTIONWRAPPER_H__
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/inc/videohintwidget.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,131 @@
+/*
+* 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 hint widget
+*
+*/
+
+
+#ifndef VIDEOHINTWIDGET_H
+#define VIDEOHINTWIDGET_H
+
+#include <hbwidget.h>
+
+class HbLabel;
+class VideoCollectionUiLoader;
+class QGraphicsItem;
+
+/**
+ * Widget for displaying no videos text and possible hint and button for user
+ * find where to download new videos.
+ */
+class VideoHintWidget : public HbWidget
+{
+ Q_OBJECT
+
+public:
+
+ enum HintLevel {
+ AllVideos,
+ Collection
+ };
+
+ /**
+ * Contructor.
+ *
+ * @param parent parent of this widget
+ */
+ VideoHintWidget(VideoCollectionUiLoader *uiLoader, QGraphicsItem *parent = 0);
+
+ /**
+ * Destructor.
+ *
+ */
+ ~VideoHintWidget();
+
+ /**
+ * Sets the level where the hint is correctly. Hint displays differently in
+ * for example collection level, than in allVideos level.
+ *
+ * @param level The current level.
+ */
+ void setLevel(HintLevel level);
+
+ /**
+ * Method creates colleciton wrapper, grid and list views,
+ * layout and activates correct view based on the current orientation
+ *
+ * @return int 0 initialization ok, < 0 if fails.
+ */
+ int initialize();
+
+ /**
+ * Method enables and displays current active view
+ *
+ * @return int 0 initialization ok, < 0 if fails.
+ */
+ int activate();
+
+ /**
+ * Method disables and hides current active view
+ *
+ */
+ void deactivate();
+
+ /**
+ * Orientation is about to be changed, method synchs
+ * both view's position to match.
+ *
+ */
+ void aboutToChangeOrientation();
+
+ /**
+ * Method activates correct view based on the given orientation.
+ *
+ */
+ void orientationChanged(Qt::Orientation orientation);
+
+signals:
+
+ /**
+ * Command signal.
+ *
+ * @param int command id
+ */
+ void command(int);
+
+private slots:
+
+ /**
+ * Connected to button pressed signal. Should open the currently
+ * configured service.
+ */
+ void buttonPressedSlot();
+
+private:
+
+ Q_DISABLE_COPY(VideoHintWidget)
+
+ /**
+ * Pointer to the XML UI (DocML) loader, not owned
+ */
+ VideoCollectionUiLoader *mUiLoader;
+
+ /**
+ * Hint label object
+ */
+ HbLabel *mHint;
+
+};
+
+#endif // VIDEOHINTWIDGET_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/inc/videolistselectiondialog.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,131 @@
+/*
+* 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: Vstub ideolist selection dialog
+*
+*/
+
+#ifndef VIDEOLISTSELECTIONDIALOG_H
+#define VIDEOLISTSELECTIONDIALOG_H
+
+#include <hbdialog.h>
+#include <qlist.h>
+#include <qitemselectionmodel.h>
+
+class QGraphicItem;
+class VideoListWidget;
+class VideoCollectionUiLoader;
+
+
+class VideoListSelectionDialog: public HbDialog
+{
+ /**
+ * definition required for emitting / connecting signals
+ */
+ Q_OBJECT
+
+ /**
+ * disable copy-constructor and assignment operator
+ */
+ Q_DISABLE_COPY(VideoListSelectionDialog)
+
+
+public:
+
+ /**
+ * Constructor
+ *
+ * @param uiLoader used to load UI components from docml
+ * @param parent item's parent component
+ */
+ VideoListSelectionDialog(VideoCollectionUiLoader *uiLoader, QGraphicsItem *parent=0);
+
+ /**
+ * Destructor
+ */
+ ~VideoListSelectionDialog();
+
+ /**
+ * Method setups provided title and videolist content widget.
+ * Prepares dialog for showing.
+ * 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.
+ */
+ void setContent(const QString &title, VideoListWidget *videoList);
+
+ /**
+ * 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;
+
+ /**
+ * Shows modal dialog build from the provided Videolistwidget.
+ *
+ * @return HbAction primary action if "OK" iis pressed
+ */
+ HbAction* exec();
+
+ /**
+ * returs primary action
+ */
+ HbAction* primaryAction();
+
+ /**
+ * returns secondary action
+ */
+ HbAction* secondaryAction();
+
+ /**
+ * selection
+ */
+ QItemSelection mSelection;
+
+ /**
+ * if true, exec returns primary action
+ */
+ static bool mExecReturnPrimary;
+
+ /**
+ * if selection count to return from getSelection
+ */
+ static int mSelectionCount;
+
+ /**
+ * exec call count
+ */
+ static int mMultiSelectionLaunchCount;
+
+ /**
+ *
+ */
+ static int mMultiSelectionItemSelectionCount;
+private:
+
+ /**
+ * primary action
+ */
+ HbAction *mPrimary;
+
+ /**
+ * secondary action
+ */
+ HbAction *mSecondary;
+};
+
+#endif //VIDEOLISTSELECTIONDIALOG_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/inc/videolistwidget.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,160 @@
+/*
+* 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
+*
+*/
+
+
+#ifndef VIDEOLISTWIDGET_H
+#define VIDEOLISTWIDGET_H
+
+#include <QGraphicsWidget>
+#include <QPixmap>
+#include <QModelIndex>
+#include <qmap.h>
+#include <qpoint.h>
+#include <hbview.h>
+#include <hblistview.h>
+
+class VideoSortFilterProxyModel;
+class HbAction;
+class HbMenu;
+class VideoServices;
+class QItemSelection;
+
+/**
+ * Widget for displaying all videos, either using list- or grid view.
+ * Widget contains 2 widgets to be used for different orientation in the stacked layout.
+ *
+ * Depending on the orientation and it's change, corresponding view is set active.
+ *
+ */
+class VideoListWidget : public HbListView
+{
+ 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 parent parent of this widget
+ */
+ VideoListWidget(HbView *parent = 0);
+
+ /**
+ * Destructor.
+ *
+ */
+ virtual ~VideoListWidget();
+
+ /**
+ * Method creates colleciton wrapper, grid and list views,
+ * layout and activates correct view based on the current orientation
+ *
+ * @param model Model for this list view.
+ * @return int 0 initialization ok, < 0 if fails.
+ */
+ int initialize(VideoSortFilterProxyModel &model, VideoServices* videoServices = 0);
+
+ /**
+ * Method enables and displays current active view
+ *
+ * @return int 0 initialization ok, < 0 if fails.
+ */
+ int activate();
+
+ /**
+ * Method enables and displays current active view
+ *
+ * @return int 0 initialization ok, < 0 if fails.
+ */
+ int activate(VideoListWidget::TVideoListLevel level);
+
+ /**
+ * Method disables and hides current active view
+ *
+ */
+ void deactivate();
+
+ /**
+ * Used for resolving widget's current level
+ *
+ * @return TVideoListType current level.
+ */
+ TVideoListType getType();
+
+ /**
+ * returns widget's model
+ *
+ * @return VideoSortFilterProxyModel*
+ */
+ VideoSortFilterProxyModel& getModel();
+
+signals:
+
+ /**
+ * Command signal.
+ *
+ * @param int command id
+ */
+ void command(int);
+
+ /**
+ * Signals collection view's state. Used to indicate
+ * view incase some collection item is opened
+ *
+ * @param true if opened, false if closed.
+ * @param optional name string
+ */
+ void collectionOpened(bool, const QString&);
+
+public:
+
+ VideoSortFilterProxyModel *mModel;
+
+ VideoListWidget::TVideoListLevel mCurrentLevel;
+
+ VideoListWidget::TVideoListType mType;
+
+ static int mInitializeCount;
+
+ static int mInitializeReturnValue;
+
+ static int mActivateCount;
+
+ static int mActivateReturnValue;
+
+ static bool mActive;
+
+ static int mDeactivateCount;
+
+};
+
+#endif // VIDEOLISTWIDGET_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/inc/videoservices.h Thu Apr 01 22:38:49 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: ?Description
+*
+*/
+
+#ifndef __VIDEOSERVICES_H__
+#define __VIDEOSERVICES_H__
+
+#include <QStringList>
+#include "videoserviceurifetch.h"
+
+//FORWARD CLASS DECLARATION
+class VideoServiceUriFetch;
+
+class VideoServices : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * 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 VideoServices *instance();
+
+ /**
+ * Decreases the reference count, when count reaches zero cleanup is done.
+ *
+ */
+ void decreaseReferenceCount();
+
+ enum TVideoService
+ {
+ ENoService,
+ EUriFetcher,
+ EPlayback
+ };
+
+ /**
+ * Returns service active status
+ *
+ * @return bool true if active, false if not active
+ *
+ */
+ VideoServices::TVideoService currentService();
+
+private:
+
+ /**
+ * Constructor
+ */
+ VideoServices();
+
+ /**
+ * Destructor.
+ */
+ virtual ~VideoServices();
+
+ void setCurrentService(VideoServices::TVideoService service);
+
+ Q_DISABLE_COPY(VideoServices)
+
+private:
+
+ /**
+ * Singleton instance.
+ */
+ static VideoServices* mInstance;
+
+ VideoServiceUriFetch* mServiceUriFetch;
+
+ VideoServices::TVideoService mCurrentService;
+
+ friend class VideoServiceUriFetch;
+
+public:
+
+ /**
+ * Reference count.
+ */
+ static int mReferenceCount;
+
+};
+
+#endif //__VIDEOSERVICES_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/inc/videoserviceurifetch.h Thu Apr 01 22:38:49 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: VideoServiceUriFetch class definition
+*
+*/
+
+#ifndef __VIDEOSERVICESURIFETCH_H__
+#define __VIDEOSERVICESURIFETCH_H__
+
+//INCLUDES
+#include <QStringList>
+
+// FORWARD DECLARATIONS
+class VideoServices;
+
+class VideoServiceUriFetch : public QObject
+{
+
+ /**
+ * define to be able to use signals and slots
+ */
+ Q_OBJECT
+
+public:
+
+ /**
+ * contructor
+ */
+ VideoServiceUriFetch( VideoServices *parent = 0 );
+
+ /**
+ * destructor
+ */
+ ~VideoServiceUriFetch();
+
+public slots: // for QTHighway to notify provider about request
+ /*
+ * Client can use this method launch video URI fetching
+ *
+ * @param title title to be set
+ *
+ */
+ void fetch(const QString& title);
+
+private:
+ VideoServices* mServiceApp;
+};
+
+#endif //__VIDEOSERVICESURIFETCH_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/inc/videosortfilterproxymodel.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,132 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Videolist sort filter proxy implementation
+*
+*/
+
+#ifndef VIDEOSORTFILTERPROXYMODEL_H
+#define VIDEOSORTFILTERPROXYMODEL_H
+
+#include <qsortfilterproxymodel.h>
+
+class VideoSortFilterProxyModel : public QSortFilterProxyModel
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * Contructor.
+ *
+ * @param parent parent of this widget
+ */
+ VideoSortFilterProxyModel(QObject *parent=0);
+
+ /**
+ * Destructor.
+ *
+ */
+ virtual ~VideoSortFilterProxyModel();
+
+public:
+
+ /**
+ * Opens a collection into all videos category, if not yet opened, and
+ * returns pointer to model
+ */
+ 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
+ */
+ int deleteItems(const QModelIndexList &indexList);
+
+ void reset();
+
+ /**
+ * Overridden, so that we can return the mSortRole parameter.
+ */
+ int sortRole() const;
+
+ /**
+ * Overridden, so that we can return the mSortOrder parameter.
+ */
+ Qt::SortOrder sortOrder() const;
+
+signals:
+
+ /**
+ * Emitted after sorting is done
+ *
+ */
+ void sortingReady();
+
+ /**
+ * emitted to indicate model readiness
+ */
+ void modelReady();
+
+protected: // from QSortFilterProxyModel
+
+ /**
+ * Compares items based in the role setted before sorting.
+ *
+ */
+ bool lessThan ( const QModelIndex & left, const QModelIndex & right ) const;
+
+ /**
+ * Filtering functionality. Called by the fw.
+ *
+ * @param source_row row to chexk
+ * @param source_parent row's parent
+ *
+ * @return bool row accepted(true) or not accepted(false)
+ */
+ bool filterAcceptsRow ( int source_row, const QModelIndex & source_parent ) const;
+
+
+private slots:
+
+ /**
+ * Timeout slot for zero timer. Stops timer and calls sort().
+ * After call is finished, emits sortingReady.
+ *
+ */
+ void processSorting();
+
+private:
+ QMap<int, QVariant> mData;
+ int mRowCount;
+
+public:
+ int mLevel;
+
+ static bool mOpenFails;
+ static int mSortRole;
+ static Qt::SortOrder mSortOrder;
+ static bool mSortAsync;
+ static bool mDeleteItemsFails;
+ static int mDoSortingCallCount;
+
+};
+
+#endif //VIDEOSORTFILTERPROXYMODEL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/inc/xqserviceutil.h Thu Apr 01 22:38:49 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 the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-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/videocollectionview/tsrc/testlistview/stub/inc/xqserviceutilxtra.h Thu Apr 01 22:38:49 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 the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-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/videocollectionview/tsrc/testlistview/stub/src/hbmessagebox.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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 "hbmessagebox.h"
+
+bool HbMessageBox::mQuestionReturnValue = false;
+
+QString HbMessageBox::mLatestTxt = "";
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/src/videocollectionuiloader.cpp Thu Apr 01 22:38:49 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:
+*
+*/
+
+#include "videocollectionuiloader.h"
+#include "videolistview.h"
+#include "videolistselectiondialog.h"
+#include "videolistwidget.h"
+#include "videohintwidget.h"
+
+bool VideoCollectionUiLoader::mFindFailure(false);
+bool VideoCollectionUiLoader::mFailDialogLoad(false);
+
+// ---------------------------------------------------------------------------
+// VideoCollectionUiLoader
+// ---------------------------------------------------------------------------
+//
+VideoCollectionUiLoader::VideoCollectionUiLoader() :
+ HbDocumentLoader()
+{
+}
+
+// ---------------------------------------------------------------------------
+// ~VideoCollectionUiLoader
+// ---------------------------------------------------------------------------
+//
+VideoCollectionUiLoader::~VideoCollectionUiLoader()
+{
+}
+
+// ---------------------------------------------------------------------------
+// createObject
+// ---------------------------------------------------------------------------
+//
+QObject* VideoCollectionUiLoader::createObject( const QString& type, const QString &name )
+{
+ QObject* object = 0;
+
+ if ( type == VideoListView::staticMetaObject.className() )
+ {
+ object = new VideoListView( this );
+ }
+ else if ( type == VideoListSelectionDialog::staticMetaObject.className() )
+ {
+ if(!mFailDialogLoad)
+ {
+ object = new VideoListSelectionDialog(this);
+
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ else if ( type == VideoListWidget::staticMetaObject.className() )
+ {
+ object = new VideoListWidget();
+ }
+ else if ( type == VideoHintWidget::staticMetaObject.className() )
+ {
+ object = new VideoHintWidget(this);
+ }
+ if ( object )
+ {
+ object->setObjectName( name );
+
+ if (mFindFailure)
+ {
+ delete object;
+ object = 0;
+ }
+ return object;
+ }
+
+ return HbDocumentLoader::createObject( type, name );
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/src/videocollectionviewutils.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: stub video collection view plugin's ui utils class
+*
+*/
+
+#include "videocollectionviewutils.h"
+#include <QItemSelection>
+#include "videocollectionwrapper.h"
+#include "videosortfilterproxymodel.h"
+#include "dummydatamodel.h"
+
+int VideoCollectionViewUtils::mLastError = -6666;
+bool VideoCollectionViewUtils::mLoadSortingValuesFails = false;
+int VideoCollectionViewUtils::mSortRole = -1;
+Qt::SortOrder VideoCollectionViewUtils::mSortOrder = Qt::AscendingOrder;
+
+// ---------------------------------------------------------------------------
+// instance
+// ---------------------------------------------------------------------------
+//
+VideoCollectionViewUtils& VideoCollectionViewUtils::instance()
+{
+ static VideoCollectionViewUtils _popupInstance;
+ return _popupInstance;
+}
+
+// ---------------------------------------------------------------------------
+// VideoCollectionViewUtils
+// ---------------------------------------------------------------------------
+//
+VideoCollectionViewUtils::VideoCollectionViewUtils()
+{
+}
+
+// ---------------------------------------------------------------------------
+// ~VideoCollectionViewUtils
+// ---------------------------------------------------------------------------
+//
+VideoCollectionViewUtils::~VideoCollectionViewUtils()
+{
+}
+
+// ---------------------------------------------------------------------------
+// showStatusMsgSlot
+// ---------------------------------------------------------------------------
+//
+void VideoCollectionViewUtils::showStatusMsgSlot(int statusCode, QVariant& /* additional */)
+{
+ mLastError = statusCode;
+}
+
+// ---------------------------------------------------------------------------
+// showErrorMsgSlot
+// ---------------------------------------------------------------------------
+//
+int VideoCollectionViewUtils::saveSortingValues(int role, Qt::SortOrder order)
+{
+ mSortRole = role;
+ mSortOrder = order;
+ return 0;
+}
+
+// ---------------------------------------------------------------------------
+// showErrorMsgSlot
+// ---------------------------------------------------------------------------
+//
+int VideoCollectionViewUtils::loadSortingValues(int& role, Qt::SortOrder& order)
+{
+ if(mLoadSortingValuesFails) {
+ return -1;
+ }
+
+ role = mSortRole;
+ order = mSortOrder;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/src/videohintwidget.cpp Thu Apr 01 22:38:49 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 "Eclipse Public License v1.0"
+* which accompanies 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 <hblabel.h>
+#include <qgraphicsitem.h>
+
+#include "videohintwidget.h"
+#include "videocollectionuiloader.h"
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+VideoHintWidget::VideoHintWidget(VideoCollectionUiLoader *uiLoader, QGraphicsItem *parent) :
+HbWidget(parent),
+mUiLoader(uiLoader),
+mHint(0)
+{
+ // NOP
+}
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+VideoHintWidget::~VideoHintWidget()
+{
+}
+
+// ---------------------------------------------------------------------------
+// initialize
+// ---------------------------------------------------------------------------
+//
+int VideoHintWidget::initialize()
+{
+ mHint = mUiLoader->findWidget<HbLabel>(DOCML_NAME_HINT_LABEL);
+ return 0;
+}
+
+// ---------------------------------------------------------------------------
+// activate
+// ---------------------------------------------------------------------------
+//
+int VideoHintWidget::activate()
+{
+ // TODO load graphics.
+ return 0;
+}
+
+// ---------------------------------------------------------------------------
+// deactivate
+// ---------------------------------------------------------------------------
+//
+void VideoHintWidget::deactivate()
+{
+ // TODO delete graphics (to save IVE memory).
+}
+
+
+// ---------------------------------------------------------------------------
+// deactivate
+// ---------------------------------------------------------------------------
+//
+void VideoHintWidget::setLevel(HintLevel level)
+{
+ // TODO delete graphics (to save IVE memory).
+}
+
+// ---------------------------------------------------------------------------
+// aboutToChangeOrientation
+// ---------------------------------------------------------------------------
+//
+void VideoHintWidget::aboutToChangeOrientation()
+{
+}
+
+// ---------------------------------------------------------------------------
+// orientationChanged
+// ---------------------------------------------------------------------------
+//
+void VideoHintWidget::orientationChanged( Qt::Orientation targetOrientation )
+{
+}
+
+// ---------------------------------------------------------------------------
+// orientationChanged
+// ---------------------------------------------------------------------------
+//
+void VideoHintWidget::buttonPressedSlot()
+{
+ // TODO implementation.
+}
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/src/videolistselectiondialog.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,133 @@
+/*
+* 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 videolist selection dialog implementation
+*
+*/
+
+#include <QGraphicsItem>
+#include <hblabel.h>
+#include <hbcheckbox.h>
+#include <hbaction.h>
+#include <hbstackedwidget.h>
+#include <hbdeviceprofile.h>
+#include "dummydatamodel.h"
+#include "videocollectionwrapper.h"
+#include "videocollectionuiloader.h"
+#include "videolistwidget.h"
+#include "videosortfilterproxymodel.h"
+#include "videolistselectiondialog.h"
+
+bool VideoListSelectionDialog::mExecReturnPrimary = false;
+
+int VideoListSelectionDialog::mSelectionCount = 0;
+
+int VideoListSelectionDialog::mMultiSelectionLaunchCount = 0;
+
+int VideoListSelectionDialog::mMultiSelectionItemSelectionCount = 0;
+
+
+// ---------------------------------------------------------------------------
+// VideoListSelectionDialog
+// ---------------------------------------------------------------------------
+//
+VideoListSelectionDialog::VideoListSelectionDialog(VideoCollectionUiLoader *uiLoader,
+ QGraphicsItem *parent) :
+HbDialog(parent)
+{
+ Q_UNUSED(uiLoader);
+ mPrimary = new HbAction();
+ mSecondary = new HbAction();
+}
+
+// ---------------------------------------------------------------------------
+// ~VideoListSelectionDialog
+// ---------------------------------------------------------------------------
+//
+VideoListSelectionDialog::~VideoListSelectionDialog()
+{
+ delete mPrimary;
+ delete mSecondary;
+}
+
+// ---------------------------------------------------------------------------
+// getSelection
+// ---------------------------------------------------------------------------
+//
+const QItemSelection& VideoListSelectionDialog::getSelection() const
+{
+ return mSelection;
+}
+
+// ---------------------------------------------------------------------------
+// setContent
+// ---------------------------------------------------------------------------
+//
+void VideoListSelectionDialog::setContent(const QString &title, VideoListWidget *videoList)
+{
+ Q_UNUSED(title);
+ Q_UNUSED(videoList);
+}
+
+// ---------------------------------------------------------------------------
+// primaryAction
+// ---------------------------------------------------------------------------
+//
+HbAction* VideoListSelectionDialog::primaryAction()
+{
+ return mPrimary;
+}
+
+// ---------------------------------------------------------------------------
+// secondaryAction
+// ---------------------------------------------------------------------------
+//
+HbAction* VideoListSelectionDialog::secondaryAction()
+{
+ return mSecondary;
+}
+
+// ---------------------------------------------------------------------------
+// exec
+// ---------------------------------------------------------------------------
+//
+HbAction* VideoListSelectionDialog::exec()
+{
+ VideoListSelectionDialog::mMultiSelectionLaunchCount++;
+ VideoCollectionWrapper *wrapper = VideoCollectionWrapper::instance();
+ wrapper->open(0);
+
+ if(wrapper)
+ {
+ for(int i=0; i<mSelectionCount; i++)
+ {
+ QModelIndex index = wrapper->getDataModel()->index(i, 0);
+ if(index.isValid())
+ {
+ mSelection.append(QItemSelectionRange(index));
+ }
+ }
+ }
+ VideoListSelectionDialog::mMultiSelectionItemSelectionCount = mSelection.indexes().count();
+ wrapper->decreaseReferenceCount();
+
+ if(!mExecReturnPrimary)
+ {
+ return secondaryAction();
+ }
+ return primaryAction();
+
+}
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/src/videolistwidget.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,110 @@
+/*
+* 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 "videoservices.h"
+
+#include "videosortfilterproxymodel.h"
+
+int VideoListWidget::mInitializeCount(0);
+int VideoListWidget::mInitializeReturnValue(0);
+int VideoListWidget::mActivateCount(0);
+int VideoListWidget::mActivateReturnValue(0);
+bool VideoListWidget::mActive(false);
+int VideoListWidget::mDeactivateCount(0);
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+VideoListWidget::VideoListWidget(HbView *parent) :
+HbListView(parent),
+mModel(0),
+mCurrentLevel(VideoListWidget::ELevelVideos),
+mType(VideoListWidget::EUnknown)
+{
+ // NOP
+}
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+VideoListWidget::~VideoListWidget()
+{
+}
+
+// ---------------------------------------------------------------------------
+// initialize
+// ---------------------------------------------------------------------------
+//
+int VideoListWidget::initialize(VideoSortFilterProxyModel &model, VideoServices* videoServices)
+{
+ mInitializeCount++;
+ mModel = &model;
+ return mInitializeReturnValue;
+}
+
+// ---------------------------------------------------------------------------
+// activate
+// ---------------------------------------------------------------------------
+//
+int VideoListWidget::activate()
+{
+ return activate(mCurrentLevel);
+}
+
+// ---------------------------------------------------------------------------
+// activate
+// ---------------------------------------------------------------------------
+//
+int VideoListWidget::activate(VideoListWidget::TVideoListLevel level)
+{
+ mActive = true;
+ mActivateCount++;
+ mCurrentLevel = level;
+ return mActivateReturnValue;
+}
+
+// ---------------------------------------------------------------------------
+// deactivate
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::deactivate()
+{
+ mActive = false;
+ mDeactivateCount++;
+}
+
+// -------------------------------------------------------------------------------------------------
+// getLevel
+// -------------------------------------------------------------------------------------------------
+//
+VideoListWidget::TVideoListType VideoListWidget::getType()
+{
+ return mType;
+}
+
+// ---------------------------------------------------------------------------
+// getModel
+// ---------------------------------------------------------------------------
+//
+VideoSortFilterProxyModel& VideoListWidget::getModel()
+{
+ return *mModel;
+}
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/src/videoservices.cpp Thu Apr 01 22:38:49 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: ?Description
+*
+*/
+
+#include <videoservices.h>
+#include <videoserviceurifetch.h>
+
+
+VideoServices *VideoServices::mInstance = 0;
+int VideoServices::mReferenceCount = 0;
+
+// -----------------------------------------------------------------------------
+// VideoServices::instance()
+// -----------------------------------------------------------------------------
+//
+VideoServices* VideoServices::instance()
+{
+ if(!mInstance)
+ {
+ mInstance = new VideoServices();
+ }
+ mInstance->mReferenceCount++;
+ return mInstance;
+}
+
+// -----------------------------------------------------------------------------
+// VideoServices::decreaseReferenceCount()
+// -----------------------------------------------------------------------------
+//
+void VideoServices::decreaseReferenceCount()
+{
+ if(mInstance)
+ {
+ if(--mInstance->mReferenceCount == 0)
+ {
+ delete mInstance;
+ mInstance = NULL;
+ }
+ }
+}
+
+
+// ----------------------------------------------------------------------------
+// VideoServices()
+// ----------------------------------------------------------------------------
+//
+VideoServices::VideoServices() :
+mCurrentService(VideoServices::ENoService)
+{
+ mServiceUriFetch = new VideoServiceUriFetch(this);
+}
+
+// ----------------------------------------------------------------------------
+// ~VideoServices()
+// ----------------------------------------------------------------------------
+//
+VideoServices::~VideoServices()
+{
+ delete mServiceUriFetch;
+}
+
+
+// ----------------------------------------------------------------------------
+// currentService()
+// ----------------------------------------------------------------------------
+//
+VideoServices::TVideoService VideoServices::currentService()
+{
+ return mCurrentService;
+}
+
+
+// ----------------------------------------------------------------------------
+// setCurrentService()
+// ----------------------------------------------------------------------------
+//
+void VideoServices::setCurrentService(VideoServices::TVideoService service)
+{
+ mCurrentService = service;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/src/videoserviceurifetch.cpp Thu Apr 01 22:38:49 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: ?Description
+*
+*/
+
+#include <videoservices.h>
+#include <videoserviceurifetch.h>
+
+
+// ----------------------------------------------------------------------------
+// VideoServiceUriFetch()
+// ----------------------------------------------------------------------------
+//
+VideoServiceUriFetch::VideoServiceUriFetch(VideoServices* parent)
+{
+ mServiceApp = parent;
+}
+
+// ----------------------------------------------------------------------------
+// ~VideoServiceUriFetch()
+// ----------------------------------------------------------------------------
+//
+VideoServiceUriFetch::~VideoServiceUriFetch()
+{
+
+}
+
+// ----------------------------------------------------------------------------
+// fetch()
+// ----------------------------------------------------------------------------
+//
+void VideoServiceUriFetch::fetch(const QString& title)
+{
+ mServiceApp->setCurrentService(VideoServices::EUriFetcher);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/src/videosortfilterproxymodel.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,149 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Videosortfilterproxymodel implementation
+*
+*/
+
+#include <qstringlist.h>
+#include <qdatetime.h>
+
+#include "videocollectioncommon.h"
+#include "videosortfilterproxymodel.h"
+
+int VideoSortFilterProxyModel::mSortRole = -1;
+Qt::SortOrder VideoSortFilterProxyModel::mSortOrder = Qt::AscendingOrder;
+bool VideoSortFilterProxyModel::mSortAsync = false;
+bool VideoSortFilterProxyModel::mDeleteItemsFails = false;
+int VideoSortFilterProxyModel::mDoSortingCallCount = 0;
+bool VideoSortFilterProxyModel::mOpenFails = false;
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::VideoSortFilterProxyModel
+// -----------------------------------------------------------------------------
+//
+VideoSortFilterProxyModel::VideoSortFilterProxyModel(QObject *parent) :
+ QSortFilterProxyModel(parent)
+{
+ reset();
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::~VideoSortFilterProxyModel
+// -----------------------------------------------------------------------------
+//
+VideoSortFilterProxyModel::~VideoSortFilterProxyModel()
+{
+ reset();
+ disconnect();
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::doSorting
+// -----------------------------------------------------------------------------
+//
+int VideoSortFilterProxyModel::open(int level)
+{
+ mLevel = level;
+ if(VideoSortFilterProxyModel::mOpenFails)
+ return -1;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::doSorting
+// -----------------------------------------------------------------------------
+//
+void VideoSortFilterProxyModel::doSorting(int role, Qt::SortOrder order, bool async)
+{
+ mDoSortingCallCount++;
+ mSortRole = role;
+ mSortOrder = order;
+ mSortAsync = async;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::deleteItems
+// -----------------------------------------------------------------------------
+//
+int VideoSortFilterProxyModel::deleteItems(const QModelIndexList &indexList)
+{
+ if( mDeleteItemsFails )
+ return -1;
+ else
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::sortRole
+// -----------------------------------------------------------------------------
+//
+int VideoSortFilterProxyModel::sortRole() const
+{
+ return mSortRole;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::sortOrder
+// -----------------------------------------------------------------------------
+//
+Qt::SortOrder VideoSortFilterProxyModel::sortOrder() const
+{
+ return mSortOrder;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::processSorting
+// -----------------------------------------------------------------------------
+//
+void VideoSortFilterProxyModel::processSorting()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::lessThan
+// -----------------------------------------------------------------------------
+//
+bool VideoSortFilterProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
+{
+ return false;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::filterAcceptsRow
+// -----------------------------------------------------------------------------
+//
+bool VideoSortFilterProxyModel::filterAcceptsRow (int source_row, const QModelIndex &source_parent) const
+{
+ return true;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::reset
+// -----------------------------------------------------------------------------
+//
+void VideoSortFilterProxyModel::reset()
+{
+ VideoSortFilterProxyModel::mSortRole = -1;
+ VideoSortFilterProxyModel::mSortOrder = Qt::AscendingOrder;
+ VideoSortFilterProxyModel::mDeleteItemsFails = false;
+ VideoSortFilterProxyModel::mDoSortingCallCount = 0;
+ VideoSortFilterProxyModel::mRowCount = 0;
+ mData.clear();
+}
+
+// end of file
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/stub/src/xqserviceutilxtra.cpp Thu Apr 01 22:38:49 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 the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include <stub/inc/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;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistview/testlistview.pro Thu Apr 01 22:38:49 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:
+#
+
+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
+
+CONFIG += qtestlib \
+ Hb \
+ symbian_test
+
+LIBS += -lestor.dll \
+ -lfbscli.dll \
+ -lbitgdi.dll \
+ -lgdi.dll \
+ -lxqplugins.dll \
+ -lmpxviewframeworkqt.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 \
+
+RESOURCES += ../../data/videocollectionview.qrc
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistwidget/inc/testlistwidget.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,193 @@
+/**
+* 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 __TESTLISTWIDGET_H__
+#define __TESTLISTWIDGET_H__
+
+
+// INCLUDES
+#include <QtTest/QtTest>
+
+class VideoListWidget;
+class DummyDataModel;
+class HbAbstractViewItem;
+class HbView;
+class VideoSortFilterProxyModel;
+class VideoCollectionWrapper;
+class HbMainWindow;
+class ListWidgetTester;
+class VideoServices;
+
+class TestListWidget : public QObject
+{
+ Q_OBJECT
+
+public:
+
+
+ // test functions for the test framework
+private slots:
+
+ /**
+ * will be called automaticallybefore each testfunction is executed.
+ *
+ */
+ void init();
+
+ /**
+ * will be called automaticallybefore after every testfunction.
+ *
+ */
+ void cleanup();
+
+
+ /**
+ * verifies initialize
+ */
+ void testInitialize();
+
+ /**
+ * verifies activate()
+ */
+ void testActivate();
+
+ /**
+ * verifies deactivate()
+ */
+ void testDeactivate();
+
+ /**
+ * verifies getType
+ */
+ void testGetType();
+
+ /**
+ * verifies getModel
+ */
+ void testGetModel();
+
+ /**
+ * verifies emitActivated
+ */
+ void testEmitActivated();
+
+ /**
+ * verifies longPressGesture
+ */
+ void testLongPressGesture();
+
+ /**
+ * verifies setContextMenu
+ */
+ void testSetContextMenu();
+
+ /**
+ * verifies shareItemSlot
+ */
+ void testShareItemSlot();
+
+ /**
+ * verifies deleteItemSlot
+ */
+ void testDeleteItemSlot();
+
+ /**
+ * verifies renameSlot
+ */
+ void testRenameSlot();
+
+ /**
+ * verifies playAllSlot
+ */
+ void testPlayAllSlot();
+
+ /**
+ * verifies addItemSlot
+ */
+ void testAddItemSlot();
+
+ /**
+ * verifies addToCollectionSlot()
+ */
+ void testAddToCollectionSlot();
+
+ /**
+ * verifies openDetailsSlot()
+ */
+ void testOpenDetailsSlot();
+
+ /**
+ * verifies back()
+ */
+ void testBack();
+
+ /**
+ * verifies scrollingEndedSlot();
+ */
+ void testScrollingEndedSlot();
+
+ /**
+ * verifies scrollPositionChangedSlot();
+ */
+ void testScrollPositionChangedSlot();
+
+signals:
+
+ /**
+ * test signal
+ */
+ void testSignal();
+
+ /**
+ * another test signal
+ */
+ 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;
+
+ /**
+ * dummy main wnd
+ */
+ HbMainWindow *mDummyMainWnd;
+
+};
+
+
+#endif // __TESTLISTWIDGET_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistwidget/src/testlistwidget.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,891 @@
+/**
+* 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 <QMap>
+#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 "testlistwidget.h"
+
+#define private public
+#include "videolistwidget.h"
+#undef private
+
+static const int CONTEXT_MENU_COUNT = 8;
+
+/**
+ * helper class to run protected member of the test object
+ */
+class ListWidgetTester : public VideoListWidget
+{
+public:
+ /**
+ * constructor
+ */
+ ListWidgetTester(HbView *parent) :
+ VideoListWidget(parent)
+ {
+
+ }
+
+ /**
+ * calls emitActivated
+ */
+ void callEmiteActivated(QModelIndex index)
+ {
+ VideoListWidget::emitActivated(index);
+ }
+
+ /**
+ * calls longPressGesture
+ */
+ void callLongPressGesture(const QPointF &point)
+ {
+ VideoListWidget::longPressGesture (point);
+ }
+};
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+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 = QTest::qExec(&tv, 3, pass);
+
+ return res;
+}
+
+// ---------------------------------------------------------------------------
+// init
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::init()
+{
+ mDummyMainWnd = new HbMainWindow;
+ mTempView = new HbView;
+ mDummyModel = new DummyDataModel();
+ mDummyProxyModel = new VideoSortFilterProxyModel();
+ mDummyProxyModel->setSourceModel(mDummyModel);
+
+ mTestWidget = new ListWidgetTester(mTempView);
+}
+
+// ---------------------------------------------------------------------------
+// cleanup
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::cleanup()
+{
+ delete mTestWidget;
+ mTestWidget = 0;
+
+ delete mDummyProxyModel;
+ mDummyProxyModel = 0;
+
+ delete mDummyModel;
+ mDummyModel = 0;
+
+ delete mTempView;
+ mTempView = 0;
+
+ delete mDummyMainWnd;
+ mDummyMainWnd = 0;
+
+ hbInstance->mWindowses.clear();
+}
+
+// ---------------------------------------------------------------------------
+// testInitialize
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testInitialize()
+{
+ // no prototype
+ HbListView::mReturnNullPrototype = true;
+ QVERIFY(mTestWidget->initialize(*mDummyProxyModel) == -1);
+ HbListView::mReturnNullPrototype = false;
+
+ // no scroll bar
+ HbListView::mVScrollBarIsNull = true;
+ QVERIFY(mTestWidget->initialize(*mDummyProxyModel) == -1);
+
+ // succeed case ( new operator cannot be stubbed)
+ HbListView::mVScrollBarIsNull = false;
+ HbListView::mReturnNullPrototype = false;
+ QVERIFY(mTestWidget->initialize(*mDummyProxyModel) == 0);
+ QCOMPARE(HbListView::mLatestrecycling, true);
+ QCOMPARE(HbListView::mLatestClamping, HbScrollArea::BounceBackClamping);
+ QCOMPARE(HbListView::mLatestScrolling, HbScrollArea::PanOrFlick);
+ QCOMPARE(HbListView::mLatestFrictionEnabled, true);
+ QCOMPARE(HbListView::mLatestUniformItemSizes, true);
+ QCOMPARE(HbListView::mLatestVisibility, false);
+ QCOMPARE(HbListView::mLatestEnableValue, false);
+ QCOMPARE(HbScrollBar::mInteractive, true);
+ QVERIFY(mTestWidget->mModel == mDummyProxyModel);
+ QVERIFY(mTestWidget->mVideoServices == 0);
+ QVERIFY(mTestWidget->mIsService == false);
+}
+
+// ---------------------------------------------------------------------------
+// testActivate
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testActivate()
+{
+ // no model: fails
+ VideoSortFilterProxyModel *nullModel = 0;
+ QVERIFY(mTestWidget->activate() == -1);
+ QCOMPARE(HbMenu::mEnabledSetted, false);
+ QCOMPARE(HbListView::mLatestVisibility, false);
+ QCOMPARE(HbListView::mLatestModel, nullModel);
+ QCOMPARE(VideoThumbnailData::mBackgroundThumbnailFetchingEnabled, 1);
+
+ // no context menu, model exist: succeeds
+ QVERIFY(mTestWidget->initialize(*mDummyProxyModel) == 0);
+ QVERIFY(mTestWidget->activate() == 0);
+ QCOMPARE(HbMenu::mEnabledSetted, false);
+ QCOMPARE(HbListView::mLatestVisibility, true);
+ QCOMPARE(HbListView::mLatestModel, mDummyProxyModel);
+ QCOMPARE(VideoThumbnailData::mBackgroundThumbnailFetchingEnabled, 1);
+
+ HbMenu::mEnabledSetted = true;
+ HbListView::mLatestVisibility = false;
+ HbListView::mLatestEnableValue = false;
+ HbListView::mLatestModel = 0;
+ VideoThumbnailData::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(HbListView::mLatestVisibility, true);
+ QCOMPARE(HbListView::mLatestModel, mDummyProxyModel);
+ QCOMPARE(VideoThumbnailData::mBackgroundThumbnailFetchingEnabled, 1);
+}
+
+// ---------------------------------------------------------------------------
+// testDeactivate
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testDeactivate()
+{
+ HbMenu::mEnabledSetted = false;
+ HbListView::mLatestVisibility = false;
+ HbListView::mLatestEnableValue = false;
+ HbListView::mLatestModel = 0;
+ VideoThumbnailData::mBackgroundThumbnailFetchingEnabled = 0;
+ VideoSortFilterProxyModel *nullModel = 0;
+
+ mTestWidget->activate();
+
+ // no context menu and activated without model
+ mTestWidget->deactivate();
+ QCOMPARE(HbListView::mLatestVisibility, false);
+ QCOMPARE(HbListView::mLatestModel, nullModel);
+ QCOMPARE(VideoThumbnailData::mBackgroundThumbnailFetchingEnabled, 0);
+
+ // context menu exists and activated with model
+ mTestWidget->mContextMenu = new HbMenu;
+ QVERIFY(mTestWidget->initialize(*mDummyProxyModel) == 0);
+ mTestWidget->activate();
+ mTestWidget->deactivate();
+ QCOMPARE(HbListView::mLatestVisibility, true);
+ QCOMPARE(HbListView::mLatestModel, mDummyProxyModel);
+ QCOMPARE(VideoThumbnailData::mBackgroundThumbnailFetchingEnabled, 0);
+
+}
+
+// ---------------------------------------------------------------------------
+// testGetLevel
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testGetType()
+{
+ 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);
+
+ // 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);
+
+
+
+}
+
+// ---------------------------------------------------------------------------
+// testGetModel
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testGetModel()
+{
+ QVERIFY(&(mTestWidget->getModel()) == 0);
+
+ HbListView::mVScrollBarIsNull = false;
+ HbListView::mReturnNullPrototype = false;
+ mTestWidget->initialize(*mDummyProxyModel);
+
+ QVERIFY(&(mTestWidget->getModel()) == mDummyProxyModel);
+}
+
+// ---------------------------------------------------------------------------
+// testEmitActivated
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testEmitActivated()
+{
+ QSignalSpy spysignal(mTestWidget, SIGNAL(collectionOpened(bool, const QString&)));
+ mTestWidget->initialize(*mDummyProxyModel);
+ 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));
+
+ QModelIndex fetchIndex = mDummyProxyModel->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());
+
+ // modelIndex is not valid
+ HbListView::mSelectionMode = HbAbstractItemView::NoSelection;
+ fetchIndex = QModelIndex();
+ mTestWidget->callEmiteActivated(fetchIndex);
+ QVERIFY(spysignal.count() == 0);
+ QVERIFY(mDummyMainWnd->mSoftKeyAction == 0);
+ QVERIFY(!VideoSortFilterProxyModel::mLastIndex.isValid());
+ QVERIFY(mTestWidget->mLastOpenItemId == TMPXItemId::InvalidId());
+
+ // current level is not ELevelCategory
+ fetchIndex = mDummyProxyModel->index(0, 0, QModelIndex());
+ mTestWidget->callEmiteActivated(fetchIndex);
+ QVERIFY(spysignal.count() == 0);
+ QVERIFY(VideoSortFilterProxyModel::mLastIndex.row() == 0);
+ QVERIFY(mTestWidget->mLastOpenItemId == TMPXItemId::InvalidId());
+ VideoSortFilterProxyModel::mLastIndex = QModelIndex();
+
+ // current level is ELevelCategory
+ mTestWidget->mCurrentLevel= VideoListWidget::ELevelCategory;
+ mTestWidget->mLastOpenItemId = TMPXItemId();
+
+ // -> 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();
+
+ // -> getType() == ECollections
+ mTestWidget->mLastOpenItemId = TMPXItemId::InvalidId();
+
+ // --> variant is not valid (invalid data at row index 1)
+ fetchIndex = mDummyProxyModel->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();
+
+ // --> variant is valid (correct data at index 0),5 collectionOpened -signal should be emitted
+ mDummyMainWnd->mSoftKeyAction = 0;
+ fetchIndex = mDummyProxyModel->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();
+
+ hbInstance->mWindowses.clear();
+}
+
+
+// ---------------------------------------------------------------------------
+// testLongPressGesture
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testLongPressGesture()
+{
+ QVariant data = QString("test");
+ // correct data to index 0
+ mDummyModel->setData( Qt::DisplayRole, data);
+ mDummyModel->setRowCount(1);
+
+ QPointF point(1,1);
+
+ QSignalSpy spysignal(mTestWidget, SIGNAL(command(int)));
+ mTestWidget->initialize(*mDummyProxyModel);
+ hbInstance->mWindowses.append(mDummyMainWnd);
+
+ HbListView::mSelectionMode = HbAbstractItemView::MultiSelection;
+ // mDetailsReady is false
+ mTestWidget->callLongPressGesture(point);
+ QVERIFY(spysignal.count() == 1);
+ QVERIFY(HbMenu::mExecPoint != point);
+ QVERIFY(HbListView::mLongPressedPoint != point);
+ spysignal.clear();
+
+ // multiselection is on
+ mTestWidget->callLongPressGesture(point);
+ QVERIFY(spysignal.count() == 0);
+ QVERIFY(HbMenu::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(HbListView::mLongPressedPoint == point);
+
+ // current index is valid
+ HbListView::mCurrentIndex = mDummyProxyModel->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(HbListView::mLongPressedPoint == point);
+ mTestWidget->mModel = tmp;
+
+ // mCurrentLevel != ELevelCategory
+ mTestWidget->mCurrentLevel = VideoListWidget::ELevelVideos;
+ mTestWidget->callLongPressGesture(point);
+ QVERIFY(spysignal.count() == 0);
+ QVERIFY(HbMenu::mExecPoint == point);
+ QVERIFY(HbListView::mLongPressedPoint == point);
+ HbMenu::mExecPoint = QPointF();
+
+ // mCurrentLevel == ELevelCategory
+ mTestWidget->mCurrentLevel = VideoListWidget::ELevelCategory;
+
+ // --> mpxId.iId2 != 1
+ TMPXItemId itemId;
+ itemId.iId2 = 0;
+ mDummyProxyModel->mItemIds.append(itemId);
+ mTestWidget->callLongPressGesture(point);
+ QVERIFY(spysignal.count() == 0);
+ QVERIFY(HbMenu::mExecPoint == point);
+ QVERIFY(HbListView::mLongPressedPoint == point);
+ HbMenu::mExecPoint = QPointF();
+ mDummyProxyModel->mItemIds.clear();
+
+ // --> mpxId.iId2 == 1
+ itemId.iId2 = 1;
+
+ // ---> mpxId.iId1 == KVcxMvcCategoryIdDownloads
+ itemId.iId1 = KVcxMvcCategoryIdDownloads;
+ mDummyProxyModel->mItemIds.append(itemId);
+ mTestWidget->callLongPressGesture(point);
+ QVERIFY(spysignal.count() == 0);
+ QVERIFY(HbMenu::mExecPoint == point);
+ QVERIFY(HbListView::mLongPressedPoint == point);
+ HbMenu::mExecPoint = QPointF();
+ mDummyProxyModel->mItemIds.clear();
+
+ // ---> mpxId.iId1 == KVcxMvcCategoryIdCaptured
+ itemId.iId1 = KVcxMvcCategoryIdCaptured;
+ mDummyProxyModel->mItemIds.append(itemId);
+ mTestWidget->callLongPressGesture(point);
+ QVERIFY(spysignal.count() == 0);
+ QVERIFY(HbMenu::mExecPoint == point);
+ QVERIFY(HbListView::mLongPressedPoint == point);
+ HbMenu::mExecPoint = QPointF();
+ mDummyProxyModel->mItemIds.clear();
+
+ // ---> mpxId.iId1 != KVcxMvcCategoryIdDownloads and mpxId.iId1 != KVcxMvcCategoryIdCaptured
+ itemId.iId1 = KVcxMvcCategoryIdAll;
+ mDummyProxyModel->mItemIds.append(itemId);
+ mTestWidget->callLongPressGesture(point);
+ QVERIFY(spysignal.count() == 0);
+ QVERIFY(HbMenu::mExecPoint == point);
+ QVERIFY(HbListView::mLongPressedPoint == point);
+ HbMenu::mExecPoint = QPointF();
+
+ // context menu setup fails, due invalid amount of correct actions
+ QMap<VideoListWidget::TContextActionIds, HbAction*>::iterator iter = mTestWidget->mContextMenuActions.begin();
+ iter++;
+ HbAction *nullAction = 0;
+ iter.value() = nullAction;
+ mTestWidget->callLongPressGesture(point);
+ QVERIFY(spysignal.count() == 0);
+ QVERIFY(HbMenu::mExecPoint != point);
+ QVERIFY(HbListView::mLongPressedPoint == point);
+
+}
+
+// ---------------------------------------------------------------------------
+// testSetContextMenu
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testSetContextMenu()
+{
+ mDummyProxyModel->mItemIds.clear();
+ mTestWidget->initialize(*mDummyProxyModel);
+ hbInstance->mWindowses.append(mDummyMainWnd);
+
+ TMPXItemId itemId;
+ QPointF point(1,1);
+ itemId.iId2 = 0;
+ mDummyProxyModel->mItemIds.append(itemId);
+
+ // no context menu
+ delete mTestWidget->mContextMenu;
+ mTestWidget->mContextMenu = 0;
+
+ // mCurrentLevel == ELevelVideos
+ int visibleCount = 0;
+ mTestWidget->mCurrentLevel = VideoListWidget::ELevelVideos;
+ mTestWidget->callLongPressGesture(point);
+
+ QMap<VideoListWidget::TContextActionIds, HbAction*>::iterator iter = mTestWidget->mContextMenuActions.begin();
+ QVERIFY(iter != mTestWidget->mContextMenuActions.end());
+
+ while(iter != mTestWidget->mContextMenuActions.end())
+ {
+ if(iter.value()->mVisible)
+ {
+ visibleCount++;
+ }
+ ++iter;
+ }
+ QVERIFY(visibleCount == 4);
+
+ // invalid amount of actions -> invalid items gets removed
+ HbAction *nullAction = 0;
+ iter = mTestWidget->mContextMenuActions.begin();
+ iter++;
+ iter.value() = nullAction;
+ mTestWidget->callLongPressGesture(point);
+ QVERIFY(!mTestWidget->mContextMenu);
+ QVERIFY(mTestWidget->mContextMenuActions.count() == 0);
+
+ // mCurrentLevel == ELevelCategory
+ mTestWidget->mCurrentLevel = VideoListWidget::ELevelCategory;
+ // --> getType returns ECollections
+ // ---> default collection flag is on
+ mTestWidget->callLongPressGesture(point);
+ iter = mTestWidget->mContextMenuActions.begin();
+ QVERIFY(iter != mTestWidget->mContextMenuActions.end());
+ visibleCount = 0;
+ while(iter != mTestWidget->mContextMenuActions.end())
+ {
+ if(iter.value()->mVisible)
+ {
+ visibleCount++;
+ }
+ ++iter;
+ }
+ QVERIFY(visibleCount == 0);
+
+ // ---> default collection flag is off
+ mDummyProxyModel->mItemIds.clear();
+ itemId.iId2 = 1;
+ itemId.iId1 = KVcxMvcCategoryIdAll;
+ mDummyProxyModel->mItemIds.append(itemId);
+ mTestWidget->callLongPressGesture(point);
+ iter = mTestWidget->mContextMenuActions.begin();
+ QVERIFY(iter != mTestWidget->mContextMenuActions.end());
+ visibleCount = 0;
+ while(iter != mTestWidget->mContextMenuActions.end())
+ {
+ if(iter.value()->mVisible)
+ {
+ visibleCount++;
+ }
+ ++iter;
+ }
+ QVERIFY(visibleCount == 4);
+
+ // --> getType returns EUserColItems
+ mTestWidget->mLastOpenItemId.iId2 = 0;
+ mTestWidget->callLongPressGesture(point);
+ iter = mTestWidget->mContextMenuActions.begin();
+ QVERIFY(iter != mTestWidget->mContextMenuActions.end());
+ visibleCount = 0;
+ while(iter != mTestWidget->mContextMenuActions.end())
+ {
+ if(iter.value()->mVisible)
+ {
+ visibleCount++;
+ }
+ ++iter;
+ }
+ QVERIFY(visibleCount == 4);
+
+ // --> getType returns EUnknow
+ mTestWidget->mCurrentLevel = (VideoListWidget::TVideoListLevel)0;
+ mTestWidget->callLongPressGesture(point);
+ iter = mTestWidget->mContextMenuActions.begin();
+ QVERIFY(iter != mTestWidget->mContextMenuActions.end());
+ visibleCount = 0;
+ while(iter != mTestWidget->mContextMenuActions.end())
+ {
+ if(iter.value()->mVisible)
+ {
+ visibleCount++;
+ }
+ ++iter;
+ }
+ QVERIFY(visibleCount == 0);
+}
+
+// ---------------------------------------------------------------------------
+// testShareItemSlot
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testShareItemSlot()
+{
+ // nothing to test yet
+ HbMessageBox::mLatestTxt = "";
+ mTestWidget->initialize(*mDummyProxyModel);
+ connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(shareItemSlot()));
+ emit testSignal();
+ QVERIFY(!HbMessageBox::mLatestTxt.isEmpty());
+ disconnect(this, SIGNAL(testSignal()), mTestWidget, SLOT(shareItemSlot()));
+
+}
+
+// ---------------------------------------------------------------------------
+// testDeleteItemSlot
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testDeleteItemSlot()
+{
+ HbMessageBox::mLatestTxt = "";
+ VideoSortFilterProxyModel::mLastIndex = QModelIndex();
+ mDummyModel->reset();
+ mTestWidget->initialize(*mDummyProxyModel);
+ 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();
+ 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();
+
+ // data fetched from item is invalid
+ mDummyModel->setRowCount(1);
+ mTestWidget->mCurrentIndex = mDummyProxyModel->index(0, 0, QModelIndex());
+ emit testSignal();
+ QVERIFY(mDummyModel->dataAccessCount() == 1);
+ QVERIFY(HbMessageBox::mLatestTxt.isEmpty());
+ QVERIFY(!VideoSortFilterProxyModel::mLastIndex.isValid());
+ mDummyModel->reset();
+
+ // data is valid
+ mDummyModel->setRowCount(1);
+ QVariant data = QString("test");
+ mDummyModel->setData( Qt::DisplayRole, data);
+ mTestWidget->mCurrentIndex = mDummyProxyModel->index(0, 0, QModelIndex());
+
+ // messagebox question returns false
+ HbMessageBox::mQuestionReturnValue = false;
+ emit testSignal();
+ QVERIFY(mDummyModel->dataAccessCount() == 1);
+ QVERIFY(!HbMessageBox::mLatestTxt.isEmpty());
+ QVERIFY(!VideoSortFilterProxyModel::mLastIndex.isValid());;
+ HbMessageBox::mLatestTxt = "";
+ mDummyModel->reset();
+ mDummyModel->setRowCount(1);
+ data = QString("test");
+ mDummyModel->setData( Qt::DisplayRole, data);
+
+ // messagebox question returns true
+ HbMessageBox::mQuestionReturnValue = true;
+ emit testSignal();
+ QVERIFY(mDummyModel->dataAccessCount() == 1);
+ QVERIFY(!HbMessageBox::mLatestTxt.isEmpty());
+ QVERIFY(VideoSortFilterProxyModel::mLastIndex.row() == 0);
+
+ disconnect(this, SIGNAL(testSignal()), mTestWidget, SLOT(deleteItemSlot()));
+}
+
+// ---------------------------------------------------------------------------
+// testRenameSlot
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testRenameSlot()
+{
+ // nothing to test yet
+ HbMessageBox::mLatestTxt = "";
+ mTestWidget->initialize(*mDummyProxyModel);
+ connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(renameSlot()));
+ emit testSignal();
+ QVERIFY(!HbMessageBox::mLatestTxt.isEmpty());
+ disconnect(this, SIGNAL(testSignal()), mTestWidget, SLOT(renameSlot()));
+}
+
+// ---------------------------------------------------------------------------
+// testPlayAllSlot
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testPlayAllSlot()
+{
+ // nothing to test yet
+ HbMessageBox::mLatestTxt = "";
+ mTestWidget->initialize(*mDummyProxyModel);
+ connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(playAllSlot()));
+ emit testSignal();
+ QVERIFY(!HbMessageBox::mLatestTxt.isEmpty());
+ disconnect(this, SIGNAL(testSignal()), mTestWidget, SLOT(playAllSlot()));
+}
+
+// ---------------------------------------------------------------------------
+// testAddItemSlot
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testAddItemSlot()
+{
+ // nothing to test yet
+ HbMessageBox::mLatestTxt = "";
+ mTestWidget->initialize(*mDummyProxyModel);
+ connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(addItemSlot()));
+ emit testSignal();
+ QVERIFY(!HbMessageBox::mLatestTxt.isEmpty());
+ disconnect(this, SIGNAL(testSignal()), mTestWidget, SLOT(addItemSlot()));
+}
+
+// ---------------------------------------------------------------------------
+// testAddToCollectionSlot
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testAddToCollectionSlot()
+{
+ // nothing to test yet
+ HbMessageBox::mLatestTxt = "";
+ mTestWidget->initialize(*mDummyProxyModel);
+ connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(addToCollectionSlot()));
+ emit testSignal();
+ QVERIFY(!HbMessageBox::mLatestTxt.isEmpty());
+ disconnect(this, SIGNAL(testSignal()), mTestWidget, SLOT(addToCollectionSlot()));
+}
+
+// ---------------------------------------------------------------------------
+// testOpenDetailsSlot
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testOpenDetailsSlot()
+{
+ QSignalSpy spysignal(mTestWidget, SIGNAL(command(int)));
+ HbMessageBox::mLatestTxt = "";
+ VideoSortFilterProxyModel::mLastIndex = QModelIndex();
+ mDummyModel->reset();
+ mTestWidget->initialize(*mDummyProxyModel);
+ connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(openDetailsSlot()));
+
+ // no model
+ VideoSortFilterProxyModel *tmp = mTestWidget->mModel;
+ mTestWidget->mModel = 0;
+ emit testSignal();
+ QVERIFY(spysignal.count() == 0);
+ QVERIFY(!VideoSortFilterProxyModel::mLastIndex.isValid());
+ mTestWidget->mModel = tmp;
+
+ // detail fetch fails
+ mDummyModel->setRowCount(1);
+ QVariant data = QString("test");
+ mDummyModel->setData( Qt::DisplayRole, data);
+ mTestWidget->mCurrentIndex = mDummyProxyModel->index(0, 0, QModelIndex());
+ VideoSortFilterProxyModel::mDetailsReturnValue = -1;
+
+ emit testSignal();
+ QVERIFY(spysignal.count() == 0);
+ QVERIFY(VideoSortFilterProxyModel::mLastIndex.row() == 0);
+
+ // detail fetch succeeds
+ VideoSortFilterProxyModel::mDetailsReturnValue = 0;
+ VideoSortFilterProxyModel::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);
+
+ disconnect(this, SIGNAL(testSignal()), mTestWidget, SLOT(openDetailsSlot()));
+}
+
+// ---------------------------------------------------------------------------
+// testBack
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testBack()
+{
+ QSignalSpy spysignal(mTestWidget, SIGNAL(collectionOpened(bool, const QString&)));
+ connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(back()));
+ // no model
+ hbInstance->mWindowses.append(mDummyMainWnd);
+ emit testSignal();
+ QVERIFY(spysignal.count() == 0);
+
+ // model exist
+ mTestWidget->initialize(*mDummyProxyModel);
+ emit testSignal();
+ QVERIFY(spysignal.count() == 1);
+ QVERIFY(spysignal.value(0).at(0).isValid());
+ QVERIFY(spysignal.value(0).at(0).toBool() == false);
+ QVERIFY(spysignal.value(0).at(1).isValid());
+ QVERIFY(spysignal.value(0).at(1).toString().isEmpty());
+
+ disconnect(this, SIGNAL(testSignal()), mTestWidget, SLOT(back()));
+}
+
+// ---------------------------------------------------------------------------
+// testScrollingEndedSlot
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testScrollingEndedSlot()
+{
+ mTestWidget->initialize(*mDummyProxyModel);
+ connect(this, SIGNAL(testSignal()), mTestWidget, SLOT(scrollingEndedSlot()));
+
+ // no visible items
+ HbListView::mVisibleItems.clear();
+ emit testSignal();
+ QVERIFY(VideoThumbnailData::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);
+ HbAbstractViewItem *item = 0;
+ for(int i = 0; i < count; ++i)
+ {
+ item = new HbAbstractViewItem();
+ item->mModelIndex = mDummyModel->index(i, 0, QModelIndex());
+ HbListView::mVisibleItems.append(item);
+ }
+
+ // Test
+ emit testSignal();
+ QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 1);
+ QVERIFY(!mTestWidget->mScrollPositionTimer->isActive());
+
+ // Test again when timer is null.
+ VideoThumbnailData::mStartBackgroundFetchingCallCount = 0;
+ QTimer *backup = mTestWidget->mScrollPositionTimer;
+ mTestWidget->mScrollPositionTimer = 0;
+ VideoThumbnailData::mStartFetchingThumbnailsThumbnailCount = 0;
+ emit testSignal();
+ QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 1);
+ mTestWidget->mScrollPositionTimer = backup;
+ backup = 0;
+
+ disconnect(this, SIGNAL(testSignal()), mTestWidget, SLOT(scrollingEndedSlot()));
+}
+
+// ---------------------------------------------------------------------------
+// testScrollingEndedSlot
+// ---------------------------------------------------------------------------
+//
+void TestListWidget::testScrollPositionChangedSlot()
+{
+ mTestWidget->initialize(*mDummyProxyModel);
+ const QPointF point;
+
+ connect(this, SIGNAL(testSignal(const QPointF&)), mTestWidget, SLOT(scrollPositionChangedSlot(const QPointF&)));
+
+ // Test
+ emit testSignal(point);
+
+ // Test again when timer is running.
+ mTestWidget->mScrollPositionTimer->start(1000*30);
+ emit testSignal(point);
+
+ // Test when timer is null.
+ QTimer *backup = mTestWidget->mScrollPositionTimer;
+ mTestWidget->mScrollPositionTimer = 0;
+ emit testSignal(point);
+ mTestWidget->mScrollPositionTimer = backup;
+ backup = 0;
+
+ disconnect(this, SIGNAL(testSignal(const QPointF&)), mTestWidget, SLOT(scrollPositionChangedSlot(const QPointF&)));
+}
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistwidget/stub/inc/dummydatamodel.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,145 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: DummyDataModel class definition*
+*/
+
+#ifndef __DUMMYDATAMODEL_H__
+#define __DUMMYDATAMODEL_H__
+
+
+// INCLUDES
+#include <QObject>
+#include <qabstractitemmodel.h>
+
+
+
+// FORWARD DECLARATIONS
+
+
+class DummyDataModel : public QAbstractItemModel
+{
+ /**
+ * define to be able to use signals and slots
+ */
+ Q_OBJECT
+
+ /**
+ * disable copy-constructor and assignment operator
+ */
+ Q_DISABLE_COPY(DummyDataModel)
+
+public:
+
+ /**
+ * Default constructor
+ */
+ DummyDataModel();
+
+ /**
+ * Destructor
+ */
+ ~DummyDataModel();
+
+ /**
+ * latest accessed index
+ */
+ QModelIndex lastIndex();
+
+ /**
+ * how many time data has qbeen queried
+ */
+ int dataAccessCount();
+
+ /**
+ * reset static members
+ */
+ void reset();
+
+ /**
+ * saves data
+ */
+ void setData(int role, QVariant data);
+
+ /**
+ * sets row count
+ */
+ void setRowCount(int count);
+
+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;
+
+ /**
+ * dummy impl
+ *
+ * @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;
+
+private:
+
+ /**
+ * data map
+ */
+ QMap<int, QVariant> mData;
+
+ /**
+ * last index
+ */
+ mutable QModelIndex mLastIndex;
+
+ /**
+ * data access count
+ */
+ mutable int mDataAccessCount;
+
+ /**
+ * row count
+ */
+ int mRowCount;
+
+};
+#endif // __DUMMYDATAMODEL_H__
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistwidget/stub/inc/hbaction.h Thu Apr 01 22:38:49 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 hbaction
+*
+*/
+
+#ifndef HBACTION_H
+#define HBACTION_H
+
+#include <QObject>
+#include <QString>
+#include <qpointer.h>
+#include "hbwidget.h"
+
+
+class HbAction : public HbWidget
+{
+ Q_OBJECT
+public:
+ /**
+ * Contructor.
+ */
+ HbAction( const QString &txt, QGraphicsItem *parent = 0) : mTxt(txt), HbWidget(0)
+ {
+ Q_UNUSED(parent);
+ initializeCount++;
+ };
+
+ /**
+ * Contructor.
+ */
+ HbAction( Hb::ActionTypes actType, QGraphicsItem *parent = 0) : mTxt(""), HbWidget(0)
+ {
+ Q_UNUSED(parent);
+ Q_UNUSED(actType);
+ initializeCount++;
+ };
+
+ /**
+ * destructor
+ */
+ virtual ~HbAction(){initializeCount--;}
+
+ /**
+ * sets mDisable;
+ */
+ void setDisabled(bool disable){mDisable = disable;}
+
+ /**
+ * sets mVisible;
+ */
+ void setVisible(bool visible){mVisible = visible;}
+
+ /**
+ * 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/videocollectionview/tsrc/testlistwidget/stub/inc/hbinstance.h Thu Apr 01 22:38:49 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"
+
+
+#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/videocollectionview/tsrc/testlistwidget/stub/inc/hblistview.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,308 @@
+/*
+* 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 "videosortfilterproxymodel.h"
+#include "hblistviewitem.h"
+#include "hbscrollbar.h"
+
+class HbScrollArea
+{
+public:
+ enum ClampingStyle
+ {
+ InvalidClamping,
+ BounceBackClamping
+ };
+ enum ScrollingStyle
+ {
+ InvalidScrolling,
+ PanOrFlick
+ };
+};
+
+class HbAbstractItemView
+{
+public:
+ enum SelectionMode
+ {
+ InvalidSelection,
+ MultiSelection,
+ NoSelection
+ };
+};
+
+class HbListView : public QObject
+{
+ 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 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;
+ }
+
+ /**
+ * 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;
+
+ /**
+ * 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/videocollectionview/tsrc/testlistwidget/stub/inc/hblistviewitem.h Thu Apr 01 22:38:49 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: stub HbListViewItem
+*
+*/
+
+#ifndef HBLISTVIEWITEM_H
+#define HBLISTVIEWITEM_H
+
+#include <QGraphicsItem>
+#include <QModelIndex>
+
+#include "hbwidget.h"
+
+class HbAbstractViewItem : public HbWidget
+{
+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/videocollectionview/tsrc/testlistwidget/stub/inc/hbmainwindow.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* 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 HbMainWindow : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * constructor
+ */
+ HbMainWindow(QWidget *parent = 0, Hb::WindowFlags windowFlags = Hb::WindowFlagNone) :
+ mSoftKeyAction(0)
+ {
+ Q_UNUSED(parent);
+ Q_UNUSED(windowFlags);
+ }
+
+ /**
+ * destructor
+ */
+ ~HbMainWindow(){};
+
+ /**
+ * dummy
+ */
+ void addSoftKeyAction(Hb::SoftKeyTypes type, HbAction *action)
+ {
+ Q_UNUSED(type);
+ mSoftKeyAction = action;
+ }
+
+ void removeSoftKeyAction(Hb::SoftKeyTypes type, HbAction *action)
+ {
+ Q_UNUSED(type);
+ if(mSoftKeyAction == action)
+ {
+ mSoftKeyAction = 0;
+ }
+ }
+
+ /**
+ * returns mSoftKeyAction
+ */
+ HbAction* softKeyAction(Hb::SoftKeyTypes type)
+ {
+ Q_UNUSED(type);
+ return mSoftKeyAction;
+ }
+
+ /**
+ * value to return from softKeyAction
+ */
+ HbAction *mSoftKeyAction;
+};
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistwidget/stub/inc/hbmenu.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,120 @@
+/*
+* 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 hbmenu
+*
+*/
+
+
+#ifndef HBMENU_H
+#define HBMENU_H
+
+
+#include <QGraphicsWidget>
+#include <QPointF>
+#include <QMap>
+#include <QList>
+#include "hbaction.h"
+
+class HbMenu : public QGraphicsWidget
+{
+
+public:
+
+ /**
+ * constructor
+ */
+ HbMenu(QGraphicsItem *parent = 0)
+ {
+ Q_UNUSED(parent);
+ }
+
+ /**
+ * destructor
+ */
+ virtual ~HbMenu()
+ {
+ QMap<QString, HbAction*>::const_iterator iter = mActions.constBegin();
+ while(iter != mActions.constEnd())
+ {
+ delete *iter;
+ iter++;
+ }
+ mActions.clear();
+ };
+
+ /**
+ * dummy method
+ */
+ void setEnabled(bool value)
+ {
+ mEnabledSetted = value;
+ }
+
+ /**
+ * dummy impl
+ */
+ void exec(QPointF point)
+ {
+ mExecPoint = point;
+ }
+
+ /**
+ * dummy impl
+ */
+ HbAction* 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;
+ }
+
+ /**
+ * dummy impl
+ */
+ QList<HbAction*> actions()
+ {
+ if(mReturnEmptyActionList)
+ {
+ return QList<HbAction*>();
+ }
+ return mActions.values();
+ }
+
+
+ QMap<QString, HbAction*> mActions;
+
+ /**
+ * is enable setted
+ */
+ static bool mEnabledSetted;
+
+ /**
+ * should we return empty actionlist
+ */
+ static bool mReturnEmptyActionList;
+
+ /**
+ * point provided from exec
+ */
+ static QPointF mExecPoint;
+
+};
+#endif // HBMENU_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistwidget/stub/inc/hbmessagebox.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* 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>
+
+class HbMessageBox;
+
+
+class HbMessageBox
+{
+
+public:
+
+ static bool question(QString text)
+ {
+ mLatestTxt = text;
+ return mQuestionReturnValue;
+ }
+
+ static void information(QString text)
+ {
+ mLatestTxt = text;
+ }
+
+ /**
+ * returned from question
+ */
+ static bool mQuestionReturnValue;
+
+ /**
+ * saved text
+ */
+ static QString mLatestTxt;
+
+};
+
+
+
+#endif // HBMESSAGEBOX_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistwidget/stub/inc/hbscrollbar.h Thu Apr 01 22:38:49 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/videocollectionview/tsrc/testlistwidget/stub/inc/hbview.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* 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>
+
+class HbView : public QGraphicsWidget
+{
+ Q_OBJECT
+
+
+public:
+
+ HbView(QGraphicsItem *parent = 0)
+ {
+ Q_UNUSED(parent);
+ }
+ virtual ~HbView(){}
+
+
+};
+
+#endif // HBVIEW_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistwidget/stub/inc/hbwidget.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: stub hbwidget
+*
+*/
+
+#ifndef HBWIDGET_H
+#define HBWIDGET_H
+#include <QGraphicsWidget>
+
+namespace Hb
+{
+ enum WindowFlags
+ {
+ WindowFlagNone
+ };
+
+ enum ActionTypes
+ {
+ InvalidAction,
+ BackAction
+ };
+
+ enum SoftKeyTypes
+ {
+ InvalidKayType,
+ SecondarySoftKey
+ };
+
+}
+
+ /**
+ * counter to make sure alloc dealloc match
+ */
+
+
+class HbWidget : public QGraphicsWidget
+{
+ Q_OBJECT
+public:
+ HbWidget(QGraphicsItem *parent = 0) : QGraphicsWidget(parent){initializeCount++;}
+
+ virtual ~HbWidget(){initializeCount--;}
+
+ static int initializeCount;
+
+
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistwidget/stub/inc/videoservices.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,104 @@
+/*
+* 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: ?Description
+*
+*/
+
+#ifndef __VIDEOSERVICES_H__
+#define __VIDEOSERVICES_H__
+
+#include <QStringList>
+#include "videoserviceurifetch.h"
+
+//FORWARD CLASS DECLARATION
+class VideoServiceUriFetch;
+
+class VideoServices : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * 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 VideoServices *instance();
+
+ /**
+ * Decreases the reference count, when count reaches zero cleanup is done.
+ *
+ */
+ void decreaseReferenceCount();
+
+ enum TVideoService
+ {
+ ENoService,
+ EUriFetcher,
+ EPlayback
+ };
+
+ /**
+ * Returns service active status
+ *
+ * @return bool true if active, false if not active
+ *
+ */
+ VideoServices::TVideoService currentService();
+
+private:
+
+ /**
+ * Constructor
+ */
+ VideoServices();
+
+ /**
+ * Destructor.
+ */
+ virtual ~VideoServices();
+
+ void setCurrentService(VideoServices::TVideoService service);
+
+ Q_DISABLE_COPY(VideoServices)
+
+public slots:
+ void itemSelected(const QString& item);
+
+private:
+
+ /**
+ * Singleton instance.
+ */
+ static VideoServices* mInstance;
+
+ VideoServiceUriFetch* mServiceUriFetch;
+
+ VideoServices::TVideoService mCurrentService;
+
+ friend class VideoServiceUriFetch;
+
+public:
+
+ /**
+ * Reference count.
+ */
+ static int mReferenceCount;
+
+};
+
+#endif //__VIDEOSERVICES_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistwidget/stub/inc/videoserviceurifetch.h Thu Apr 01 22:38:49 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: VideoServiceUriFetch class definition
+*
+*/
+
+#ifndef __VIDEOSERVICESURIFETCH_H__
+#define __VIDEOSERVICESURIFETCH_H__
+
+//INCLUDES
+#include <QStringList>
+
+// FORWARD DECLARATIONS
+class VideoServices;
+
+class VideoServiceUriFetch : public QObject
+{
+
+ /**
+ * define to be able to use signals and slots
+ */
+ Q_OBJECT
+
+public:
+
+ /**
+ * contructor
+ */
+ VideoServiceUriFetch( VideoServices *parent = 0 );
+
+ /**
+ * destructor
+ */
+ ~VideoServiceUriFetch();
+
+public slots: // for QTHighway to notify provider about request
+ /*
+ * Client can use this method launch video URI fetching
+ *
+ * @param title title to be set
+ *
+ */
+ void fetch(const QString& title);
+
+private:
+ VideoServices* mServiceApp;
+};
+
+#endif //__VIDEOSERVICESURIFETCH_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistwidget/stub/inc/videosortfilterproxymodel.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,144 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Videolist sort filter proxy stub implementation
+*
+*/
+
+#ifndef VIDEOSORTFILTERPROXYMODEL_H
+#define VIDEOSORTFILTERPROXYMODEL_H
+
+#include <qsortfilterproxymodel.h>
+#include <QList>
+#include <QModelIndex>
+#include <vcxmyvideosdefs.h>
+
+class VideoSortFilterProxyModel : public QSortFilterProxyModel
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * Contructor.
+ *
+ * @param parent parent of this widget
+ */
+ VideoSortFilterProxyModel(QObject *parent=0);
+
+ /**
+ * Destructor.
+ *
+ */
+ virtual ~VideoSortFilterProxyModel();
+
+public:
+
+ /**
+ * dummy impl
+ *
+ */
+ void doSorting(int sortingOrder);
+
+ /**
+ * dummy impl
+ */
+ int deleteItems(const QModelIndexList &indexList);
+
+ /**
+ * dummy impl
+ */
+ int openItem(const QModelIndex &index);
+
+ /**
+ * dummy impl
+ */
+ int fetchItemDetails(const QModelIndex &index);
+
+
+ /**
+ * dummy impl
+ *
+ */
+ TMPXItemId getMediaIdAtIndex(QModelIndex index);
+
+ /**
+ * Return to collection level
+ *
+ */
+ void back();
+
+ static void reset();
+
+
+signals:
+
+ /**
+ * dummy impl
+ */
+ void shortDetailsReady(int index);
+
+ /**
+ * dummy impl
+ */
+ void fullDetailsReady(int index);
+
+ /**
+ * dummy impl
+ */
+ void modelReady();
+
+protected: // from QSortFilterProxyModel
+
+ /**
+ * dummy impl
+ *
+ */
+ bool lessThan ( const QModelIndex & left, const QModelIndex & right ) const;
+
+private slots:
+
+ /**
+ * Timeout slot for zero timer. Stops timer and calls sort().
+ * After call is finished, emits sortingReady.
+ *
+ */
+ void processSorting();
+
+public:
+
+ /**
+ * list containing some mpx ids
+ */
+ static QList<TMPXItemId> mItemIds;
+
+ /**
+ * dummy
+ */
+ static int mSortOrder;
+
+ /**
+ * last accessed index
+ */
+ static QModelIndex mLastIndex;
+
+ /**
+ * details value
+ */
+ static int mDetailsReturnValue;
+
+};
+
+
+
+#endif //VIDEOSORTFILTERPROXYMODEL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistwidget/stub/inc/videothumbnaildata.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,123 @@
+/*
+* 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: CVideoThumbnailData class definition*
+*/
+
+#ifndef __VIDEOTHUMBNAILDATA_H__
+#define __VIDEOTHUMBNAILDATA_H__
+
+// INCLUDES
+#include <QObject>
+#include <QHash>
+#include <QPair>
+#include <QIcon>
+#include <QSet>
+
+// FORWARD DECLARATIONS
+
+class VideoThumbnailData : public QObject
+{
+ /**
+ * defined to be able to use signals and slots
+ */
+ Q_OBJECT
+
+ /**
+ * disable copy-constructor and assignment operator
+ */
+ Q_DISABLE_COPY(VideoThumbnailData)
+
+public: // Constructor
+
+ /*
+ * Thumbnail fetch priorities
+ */
+ enum VideoThumbnailPriority
+ {
+ VideoThumbnailPriorityBackground = 2000,
+ VideoThumbnailPriorityLow = 5000,
+ VideoThumbnailPriorityMedium = 10000,
+ VideoThumbnailPriorityHigh = 2000
+ };
+
+ /**
+ * Returns singleton instance for this class.
+ *
+ * @return The singleton instance.
+ *
+ */
+ 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);
+
+ /**
+ * Enables or disables thumbnail background fetching. Default is enabled.
+ *
+ * @param enable true enables and false disables thumbnail background fetching.
+ */
+ void enableBackgroundFetching(bool enable);
+
+ /**
+ * Frees allocated data for thumbnails and cancels ongoing fetches.
+ */
+ void freeThumbnailData();
+
+private:
+
+ /**
+ * Default constructor
+ */
+ VideoThumbnailData();
+
+ /**
+ * Destructor
+ */
+ ~VideoThumbnailData();
+
+public:
+ static int mStartFetchingThumbnailsCallCount;
+ static int mStartFetchingThumbnailsThumbnailCount;
+ static int mInstanceCallCount;
+ static int mFreeThumbnailDataCallCount;
+ static int mBackgroundThumbnailFetchingEnabled;
+ static int mStartBackgroundFetchingCallCount;
+
+private: // data
+
+
+};
+#endif // __VIDEOTHUMBNAILDATA_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistwidget/stub/inc/xqserviceutil.h Thu Apr 01 22:38:49 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 the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef XQSERVICEUTIL_H
+#define XQSERVICEUTIL_H
+
+namespace XQServiceUtil
+{
+ void toBackground(bool value);
+ bool isEmbedded();
+ bool isService();
+}
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistwidget/stub/src/dummydatamodel.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,315 @@
+/*
+* 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: DummyDataModel class implementation
+*
+*/
+// INCLUDE FILES
+#include "dummydatamodel.h"
+#include "videocollectioncommon.h"
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// -----------------------------------------------------------------------------
+// DummyDataModel::DummyDataModel()
+// -----------------------------------------------------------------------------
+//
+DummyDataModel::DummyDataModel()
+{
+ reset();
+}
+
+// -----------------------------------------------------------------------------
+// DummyDataModel::~DummyDataModel()
+// -----------------------------------------------------------------------------
+//
+DummyDataModel::~DummyDataModel()
+{
+ reset();
+}
+
+// -----------------------------------------------------------------------------
+// DummyDataModel::lastIndex()
+// -----------------------------------------------------------------------------
+//
+QModelIndex DummyDataModel::lastIndex()
+{
+ return mLastIndex;
+}
+
+// -----------------------------------------------------------------------------
+// DummyDataModel::dataAccessCount()
+// -----------------------------------------------------------------------------
+//
+int DummyDataModel::dataAccessCount()
+{
+ return mDataAccessCount;
+}
+
+// -----------------------------------------------------------------------------
+// DummyDataModel::reset()
+// -----------------------------------------------------------------------------
+//
+void DummyDataModel::reset()
+{
+ mLastIndex = QModelIndex();
+ mDataAccessCount = 0;
+ mRowCount = 0;
+ mData.clear();
+}
+
+// -----------------------------------------------------------------------------
+// DummyDataModel::setData()
+// -----------------------------------------------------------------------------
+//
+void DummyDataModel::setData(int role, QVariant data)
+{
+ mData.insert(role, data);
+}
+
+// -----------------------------------------------------------------------------
+// DummyDataModel::setRowCount()
+// -----------------------------------------------------------------------------
+//
+void DummyDataModel::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();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// DummyDataModel::rowCount()
+// -----------------------------------------------------------------------------
+//
+int DummyDataModel::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;
+}
+
+// -----------------------------------------------------------------------------
+// DummyDataModel::itemData()
+// -----------------------------------------------------------------------------
+//
+QMap<int, QVariant> DummyDataModel::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));
+ itemData.insert(VideoCollectionCommon::KeyFilePath, data(index, VideoCollectionCommon::KeyFilePath));
+ }
+ return itemData;
+
+}
+// -----------------------------------------------------------------------------
+// DummyDataModel::data()
+// -----------------------------------------------------------------------------
+//
+QVariant DummyDataModel::data(const QModelIndex & index, int role) const
+{
+ QVariant returnValue = QVariant();
+ mLastIndex = index;
+ mDataAccessCount++;
+ if (index.isValid() && index.row() < mRowCount)
+ {
+ returnValue = mData.value(role);
+ }
+
+ return returnValue;
+}
+
+// -----------------------------------------------------------------------------
+// DummyDataModel::columnCount()
+// -----------------------------------------------------------------------------
+//
+int DummyDataModel::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;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// DummyDataModel::index()
+// -----------------------------------------------------------------------------
+//
+QModelIndex DummyDataModel::index(int row, int column, const QModelIndex & /*parent*/) const
+{
+ return createIndex(row, column);
+}
+
+// -----------------------------------------------------------------------------
+// DummyDataModel::parent()
+// -----------------------------------------------------------------------------
+//
+QModelIndex DummyDataModel::parent(const QModelIndex & /*index*/) const
+{
+ return QModelIndex();
+}
+
+
+
+
+/*
+// -----------------------------------------------------------------------------
+// DummyDataModel::prepareDetailRow()
+// -----------------------------------------------------------------------------
+//
+const QString DummyDataModel::prepareDetailRow( int index ) const
+{
+ // TODO: - metadata?
+ // - download -status?
+
+ const QString secondLineSeparator = ", ";
+
+ const QString lengthStr = prepareLengthString(index);
+
+ const QString sizeStr = prepareSizeString(index);
+
+ QString detailRow("");
+
+ if( lengthStr.count() > 0 )
+ {
+ detailRow = lengthStr;
+ }
+
+ if( sizeStr.count() > 0 )
+ {
+ if( detailRow.count() > 0)
+ {
+ detailRow += secondLineSeparator;
+ }
+ detailRow += sizeStr;
+ }
+ return detailRow;
+}
+
+// -----------------------------------------------------------------------------
+// DummyDataModel::prepareSizeString()
+// -----------------------------------------------------------------------------
+//
+const QString DummyDataModel::prepareSizeString( int index ) const
+{
+ 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(!mVideoList)
+ {
+ return sizeStr;
+ }
+
+ uint size = mVideoList->getVideoSizeFromIndex(index);
+
+ if ( size > 0 )
+ {
+ uint dispSize = 0;
+
+ if ( size >= videoSizeGB )
+ {
+ dispSize = size + videoSizeHalfGB;
+ dispSize /= videoSizeGB;
+ sizeStr = QString(QString::number(dispSize)+ tr(" GB"));
+ }
+ else if ( size >= videoSizeMB )
+ {
+ dispSize = size + videoSizeHalfMB;
+ dispSize /= videoSizeMB;
+ sizeStr = QString(QString::number(dispSize)+ tr(" MB"));
+ }
+ else
+ {
+ dispSize = size + videoSizeHalfKB;
+ dispSize /= videoSizeKB;
+ sizeStr = QString(QString::number(dispSize)+ tr(" kB"));
+ }
+ }
+ return sizeStr;
+}
+
+// -----------------------------------------------------------------------------
+// DummyDataModel::prepareLengthString()
+// -----------------------------------------------------------------------------
+//
+const QString DummyDataModel::prepareLengthString( int index ) const
+{
+ const int secondsInMinute( 60 );
+ const int secondsInHour( 3600 );
+ QString lengthStr("");
+ if(!mVideoList)
+ {
+ return lengthStr;
+ }
+ uint total = static_cast<uint>(mVideoList->getVideodurationFromIndex(index));
+
+ // TODO: simplify this!
+
+ if ( total > 0 )
+ {
+ uint hours = total / secondsInHour;
+ uint minutes = total / secondsInMinute % secondsInMinute;
+ uint seconds = total % secondsInMinute;
+
+ if ( hours > 0 )
+ {
+ lengthStr = QString(QString::number(hours)+ tr(" hours "));
+ lengthStr += QString(QString::number(minutes)+ tr(" minutes"));
+ }
+
+ else if ( minutes > 0 )
+ {
+ lengthStr = QString(QString::number(minutes)+ tr(" minutes "));
+ lengthStr += QString(QString::number(seconds)+ tr(" seconds"));
+ }
+ else
+ {
+ lengthStr = QString(QString::number(seconds)+ tr(" seconds"));
+ }
+ }
+ return lengthStr;
+
+}
+*/
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistwidget/stub/src/hbaction.cpp Thu Apr 01 22:38:49 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/videocollectionview/tsrc/testlistwidget/stub/src/hblistview.cpp Thu Apr 01 22:38:49 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/videocollectionview/tsrc/testlistwidget/stub/src/hblistviewItem.cpp Thu Apr 01 22:38:49 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/videocollectionview/tsrc/testlistwidget/stub/src/hbmenu.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,29 @@
+/*
+* 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 "hbmenu.h"
+
+bool HbMenu::mEnabledSetted = false;
+
+bool HbMenu::mReturnEmptyActionList = false;
+
+QPointF HbMenu::mExecPoint = QPointF();
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistwidget/stub/src/hbmessagebox.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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 "hbmessagebox.h"
+
+bool HbMessageBox::mQuestionReturnValue = false;
+
+QString HbMessageBox::mLatestTxt = "";
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistwidget/stub/src/hbscrollbar.cpp Thu Apr 01 22:38:49 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/videocollectionview/tsrc/testlistwidget/stub/src/hbwidget.cpp Thu Apr 01 22:38:49 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/videocollectionview/tsrc/testlistwidget/stub/src/videoservices.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,102 @@
+/*
+* 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: ?Description
+*
+*/
+
+#include <videoservices.h>
+#include <videoserviceurifetch.h>
+
+
+VideoServices *VideoServices::mInstance = 0;
+int VideoServices::mReferenceCount = 0;
+
+// -----------------------------------------------------------------------------
+// VideoServices::instance()
+// -----------------------------------------------------------------------------
+//
+VideoServices* VideoServices::instance()
+{
+ if(!mInstance)
+ {
+ mInstance = new VideoServices();
+ }
+ mInstance->mReferenceCount++;
+ return mInstance;
+}
+
+// -----------------------------------------------------------------------------
+// VideoServices::decreaseReferenceCount()
+// -----------------------------------------------------------------------------
+//
+void VideoServices::decreaseReferenceCount()
+{
+ if(mInstance)
+ {
+ if(--mInstance->mReferenceCount == 0)
+ {
+ delete mInstance;
+ mInstance = NULL;
+ }
+ }
+}
+
+
+// ----------------------------------------------------------------------------
+// VideoServices()
+// ----------------------------------------------------------------------------
+//
+VideoServices::VideoServices() :
+mCurrentService(VideoServices::ENoService)
+{
+ mServiceUriFetch = new VideoServiceUriFetch(this);
+}
+
+// ----------------------------------------------------------------------------
+// ~VideoServices()
+// ----------------------------------------------------------------------------
+//
+VideoServices::~VideoServices()
+{
+ delete mServiceUriFetch;
+}
+
+
+// ----------------------------------------------------------------------------
+// currentService()
+// ----------------------------------------------------------------------------
+//
+VideoServices::TVideoService VideoServices::currentService()
+{
+ return mCurrentService;
+}
+
+
+// ----------------------------------------------------------------------------
+// setCurrentService()
+// ----------------------------------------------------------------------------
+//
+void VideoServices::setCurrentService(VideoServices::TVideoService service)
+{
+ mCurrentService = service;
+}
+
+// ----------------------------------------------------------------------------
+// itemSelected()
+// ----------------------------------------------------------------------------
+//
+void VideoServices::itemSelected(const QString& item)
+{
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistwidget/stub/src/videoserviceurifetch.cpp Thu Apr 01 22:38:49 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: ?Description
+*
+*/
+
+#include <videoservices.h>
+#include <videoserviceurifetch.h>
+
+
+// ----------------------------------------------------------------------------
+// VideoServiceUriFetch()
+// ----------------------------------------------------------------------------
+//
+VideoServiceUriFetch::VideoServiceUriFetch(VideoServices* parent)
+{
+ mServiceApp = parent;
+}
+
+// ----------------------------------------------------------------------------
+// ~VideoServiceUriFetch()
+// ----------------------------------------------------------------------------
+//
+VideoServiceUriFetch::~VideoServiceUriFetch()
+{
+
+}
+
+// ----------------------------------------------------------------------------
+// fetch()
+// ----------------------------------------------------------------------------
+//
+void VideoServiceUriFetch::fetch(const QString& title)
+{
+ mServiceApp->setCurrentService(VideoServices::EUriFetcher);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistwidget/stub/src/videosortfilterproxymodel.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,165 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Videolist sort filter proxy stub implementation
+*
+*/
+
+#include <qstringlist.h>
+#include <qdatetime.h>
+
+
+#include "videocollectioncommon.h"
+#include "videosortfilterproxymodel.h"
+
+QList<TMPXItemId> VideoSortFilterProxyModel::mItemIds = QList<TMPXItemId>();
+int VideoSortFilterProxyModel::mSortOrder(-1);
+QModelIndex VideoSortFilterProxyModel::mLastIndex(QModelIndex());
+int VideoSortFilterProxyModel::mDetailsReturnValue(0);
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::VideoSortFilterProxyModel
+// -----------------------------------------------------------------------------
+//
+VideoSortFilterProxyModel::VideoSortFilterProxyModel(QObject *parent) :
+ QSortFilterProxyModel(parent)
+{
+ reset();
+ mItemIds.clear();
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::~VideoSortFilterProxyModel
+// -----------------------------------------------------------------------------
+//
+VideoSortFilterProxyModel::~VideoSortFilterProxyModel()
+{
+ disconnect();
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::doSorting
+// -----------------------------------------------------------------------------
+//
+void VideoSortFilterProxyModel::doSorting(int sortingOrder)
+{
+ mSortOrder = sortingOrder;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::deleteItems
+// -----------------------------------------------------------------------------
+//
+int VideoSortFilterProxyModel::deleteItems(const QModelIndexList &indexList)
+{
+ if(indexList.count() > 0)
+ {
+ mLastIndex = indexList.at(0);
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::openItem
+// -----------------------------------------------------------------------------
+//
+int VideoSortFilterProxyModel::openItem(const QModelIndex &index)
+{
+ mLastIndex = index;
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::fetchItemDetails
+// -----------------------------------------------------------------------------
+//
+int VideoSortFilterProxyModel::fetchItemDetails(const QModelIndex &index)
+{
+ mLastIndex = index;
+ return mDetailsReturnValue;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::processSorting
+// -----------------------------------------------------------------------------
+//
+void VideoSortFilterProxyModel::processSorting()
+{
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::lessThan
+// -----------------------------------------------------------------------------
+//
+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
+
+ int sRole = sortRole();
+ QVariant leftData = sourceModel()->data(left, sRole);
+ QVariant rightData = sourceModel()->data(right, sRole);
+
+ if(!leftData.isValid() || !rightData.isValid())
+ {
+ return false;
+ }
+ if(sRole == Qt::DisplayRole)
+ {
+ QString left = leftData.toStringList().at(0);
+ QString right = rightData.toStringList().at(0);
+ return QString::localeAwareCompare(left, right) < 0;
+ }
+ else if(sRole == VideoCollectionCommon::KeySizeValue)
+ {
+ quint32 left = leftData.toUInt();
+ quint32 right = rightData.toUInt();
+ return left < right;
+ }
+ else if(sRole == VideoCollectionCommon::KeyDateTime)
+ {
+ QDate left = leftData.toDate();
+ QDate right = rightData.toDate();
+ return left < right;
+ }
+ return false;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::getMediaIdAtIndex
+// -----------------------------------------------------------------------------
+//
+TMPXItemId VideoSortFilterProxyModel::getMediaIdAtIndex(QModelIndex index)
+{
+ if(index.row() >= 0 && index.row() < mItemIds.count())
+ {
+ return mItemIds[index.row()];
+ }
+ return TMPXItemId::InvalidId();
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::back
+// -----------------------------------------------------------------------------
+//
+void VideoSortFilterProxyModel::back()
+{
+}
+
+void VideoSortFilterProxyModel::reset()
+{
+ mSortOrder = -1;
+}
+
+// end of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistwidget/stub/src/videothumbnaildata.cpp Thu Apr 01 22:38:49 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: CVideoThumbnailData class implementation
+*
+*/
+
+// INCLUDE FILES
+#include <QDebug>
+#include <QPixmap>
+#include <QTimer>
+#include <mpxmediageneraldefs.h>
+#include <thumbnailmanager_qt.h>
+
+#include "videothumbnaildata.h"
+
+int VideoThumbnailData::mStartFetchingThumbnailsCallCount = 0;
+int VideoThumbnailData::mStartFetchingThumbnailsThumbnailCount = 0;
+int VideoThumbnailData::mInstanceCallCount = 0;
+int VideoThumbnailData::mBackgroundThumbnailFetchingEnabled = true;
+int VideoThumbnailData::mFreeThumbnailDataCallCount = 0;
+int VideoThumbnailData::mStartBackgroundFetchingCallCount = 0;
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailData::instance()
+// -----------------------------------------------------------------------------
+//
+VideoThumbnailData &VideoThumbnailData::instance()
+{
+ mInstanceCallCount++;
+ static VideoThumbnailData _thumbnailData;
+ return _thumbnailData;
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailData::VideoThumbnailData()
+// -----------------------------------------------------------------------------
+//
+VideoThumbnailData::VideoThumbnailData()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailData::~VideoThumbnailData()
+// -----------------------------------------------------------------------------
+//
+VideoThumbnailData::~VideoThumbnailData()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// 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)
+{
+ mStartBackgroundFetchingCallCount++;
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailData::enableBackgroundFetching()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailData::enableBackgroundFetching(bool enable)
+{
+ mBackgroundThumbnailFetchingEnabled = enable;
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailData::freeThumbnailData()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailData::freeThumbnailData()
+{
+ mFreeThumbnailDataCallCount++;
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistwidget/stub/src/xqserviceutil.cpp Thu Apr 01 22:38:49 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 the License "Symbian Foundation License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "xqserviceutil.h"
+
+void XQServiceUtil::toBackground( bool value )
+{
+}
+
+bool XQServiceUtil::isEmbedded()
+{
+ return false;
+}
+
+bool XQServiceUtil::isService()
+{
+ return false;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testlistwidget/testlistwidget.pro Thu Apr 01 22:38:49 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:
+#
+
+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 \
+ ../../../../inc \
+
+CONFIG += qtestlib \
+ symbian_test
+
+LIBS += -lestor.dll \
+ -lfbscli.dll \
+ -lbitgdi.dll \
+ -lgdi.dll \
+ -lvideocollectionwrapper.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
+
+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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testvideocollectionviewutils/inc/testvideocollectionviewutils.h Thu Apr 01 22:38:49 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: tester for methods in VideoCollectionViewUtils
+*
+*/
+
+#ifndef __TESTVIDEOCOLLECTIONVIEWUTILS_H__
+#define __TESTVIDEOCOLLECTIONVIEWUTILS_H__
+
+
+// INCLUDES
+#include <QtTest/QtTest>
+#include "hbmessagebox.h"
+
+
+class VideoCollectionWrapper;
+
+class TestVideoVideoCollectionViewUtils : public QObject
+{
+ Q_OBJECT
+
+ // test functions for the test framework
+private slots:
+
+ /**
+ * will be called before each testfunction is executed.
+ *
+ */
+ void init();
+
+ /**
+ * will be called after every testfunction.
+ *
+ */
+ void cleanup();
+
+ /**
+ * verifies showErrorMsgSlot
+ */
+ void testShowErrorMsgSlot();
+
+ /**
+ * verifies saveSortingValues
+ */
+ void testSaveSortingValues();
+
+ /**
+ * verifies loadSortingValues
+ */
+ void testLoadSortingValues();
+
+};
+
+
+#endif // __TESTVIDEOCOLLECTIONVIEWUTILS_H__
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testvideocollectionviewutils/src/testvideocollectionviewutils.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,242 @@
+/**
+* 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 VideoCollectionViewUtils
+*
+*/
+
+#include <qapplication.h>
+#include "stub/inc/centralrepository.h"
+#include "testvideocollectionviewutils.h"
+#include "hblabel.h"
+#include "hbaction.h"
+#include "videocollectioncommon.h"
+#include "centralrepository.h"
+#define private public
+#include "videocollectionviewutils.h"
+#undef private
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+ 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);
+
+ return res;
+}
+
+// ---------------------------------------------------------------------------
+// init
+// ---------------------------------------------------------------------------
+//
+void TestVideoVideoCollectionViewUtils::init()
+{
+
+}
+
+// ---------------------------------------------------------------------------
+// cleanup
+// ---------------------------------------------------------------------------
+//
+void TestVideoVideoCollectionViewUtils::cleanup()
+{
+
+}
+
+// ---------------------------------------------------------------------------
+// testShowErrorMsgSlot
+// ---------------------------------------------------------------------------
+//
+void TestVideoVideoCollectionViewUtils::testShowErrorMsgSlot()
+{
+ VideoCollectionViewUtils &testObject(VideoCollectionViewUtils::instance());
+ QVariant additional;
+ QString txt = "__test__";
+ additional = txt;
+ HbMessageBox::mWarningCallCount = 0;
+ HbMessageBox::mInformationCallCount = 0;
+
+ // status: VideoCollectionCommon::statusSingleDeleteFail
+ testObject.showStatusMsgSlot(VideoCollectionCommon::statusSingleDeleteFail, additional);
+ QVERIFY(HbMessageBox::mWarningCallCount == 1);
+ QVERIFY(HbMessageBox::mInformationCallCount == 0);
+ HbMessageBox::mWarningCallCount = 0;
+ HbMessageBox::mInformationCallCount = 0;
+ additional = QVariant();
+
+ // - invalid additional
+ testObject.showStatusMsgSlot(VideoCollectionCommon::statusSingleDeleteFail, additional);
+ QVERIFY(HbMessageBox::mWarningCallCount == 0);
+ QVERIFY(HbMessageBox::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;
+ 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;
+ additional = QVariant();
+
+ // -> invalid additional
+ testObject.showStatusMsgSlot(VideoCollectionCommon::statusMultipleDeleteSucceed, additional);
+ QVERIFY(HbMessageBox::mWarningCallCount == 0);
+ QVERIFY(HbMessageBox::mInformationCallCount == 0);
+
+ // status: invalid
+ testObject.showStatusMsgSlot(VideoCollectionCommon::statusMultipleDeleteSucceed + 1, additional);
+ QVERIFY(HbMessageBox::mWarningCallCount == 0);
+ QVERIFY(HbMessageBox::mInformationCallCount == 0);
+
+
+/*
+
+ QString txt = "__test__";
+ // error code 0, no additional
+ testObject.showErrorMsgSlot(0, additional);
+ QVERIFY(!HbMessageBox::staticInstance);
+
+ // error code 0, additional
+ additional = txt;
+ testObject.showErrorMsgSlot(0, additional);
+ QVERIFY(!HbMessageBox::staticInstance);
+
+ // error code VideoCollectionCommon::errorCollectionSingleDelete, no additional
+ additional.clear();
+ testObject.showErrorMsgSlot(VideoCollectionCommon::errorCollectionSingleDelete, additional);
+ QVERIFY(!HbMessageBox::staticInstance);
+
+ // error code VideoCollectionCommon::errorCollectionSingleDelete, additional
+ additional = txt;
+ testObject.showErrorMsgSlot(VideoCollectionCommon::errorCollectionSingleDelete, additional);
+ QVERIFY(HbMessageBox::staticInstance);
+ QVERIFY(HbMessageBox::staticInstance->mType == HbMessageBox::MessageTypeWarning);
+ QVERIFY(!HbMessageBox::staticInstance->mBGFaded);
+ QVERIFY(!HbMessageBox::staticInstance->mModal);
+ QVERIFY(HbMessageBox::staticInstance->mText.count() > 0);
+ QVERIFY(HbMessageBox::staticInstance->mText.contains(txt));
+ QVERIFY(HbMessageBox::staticInstance->mAttribute == Qt::WA_DeleteOnClose);
+ delete HbMessageBox::staticInstance;
+ HbMessageBox::staticInstance = 0;
+
+ // error code VideoCollectionCommon::errorCollectionMultipleDelete, no additional
+ additional.clear();
+ testObject.showErrorMsgSlot(VideoCollectionCommon::errorCollectionMultipleDelete, additional);
+ QVERIFY(HbMessageBox::staticInstance);
+ QVERIFY(HbMessageBox::staticInstance->mType == HbMessageBox::MessageTypeWarning);
+ QVERIFY(!HbMessageBox::staticInstance->mBGFaded);
+ QVERIFY(!HbMessageBox::staticInstance->mModal);
+ QVERIFY(HbMessageBox::staticInstance->mText.count() > 0);
+ QVERIFY(!HbMessageBox::staticInstance->mText.contains(txt));
+ QVERIFY(HbMessageBox::staticInstance->mAttribute == Qt::WA_DeleteOnClose);
+ delete HbMessageBox::staticInstance;
+ HbMessageBox::staticInstance = 0;
+
+ // error code VideoCollectionCommon::errorCollectionMultipleDelete, additional
+ additional = txt;
+ testObject.showErrorMsgSlot(VideoCollectionCommon::errorCollectionMultipleDelete, additional);
+ QVERIFY(HbMessageBox::staticInstance);
+ QVERIFY(HbMessageBox::staticInstance->mType == HbMessageBox::MessageTypeWarning);
+ QVERIFY(!HbMessageBox::staticInstance->mBGFaded);
+ QVERIFY(!HbMessageBox::staticInstance->mModal);
+ QVERIFY(HbMessageBox::staticInstance->mText.count() > 0);
+ QVERIFY(!HbMessageBox::staticInstance->mText.contains(txt));
+ QVERIFY(HbMessageBox::staticInstance->mAttribute == Qt::WA_DeleteOnClose);
+ delete HbMessageBox::staticInstance;
+*/
+}
+
+// -----------------------------------------------------------------------------
+// testSaveSortingValues
+// -----------------------------------------------------------------------------
+//
+void TestVideoVideoCollectionViewUtils::testSaveSortingValues()
+{
+ VideoCollectionViewUtils &testObject(VideoCollectionViewUtils::instance());
+ CRepository::setNewLLeave(true);
+ int sortRole = VideoCollectionCommon::KeyDateTime;
+ Qt::SortOrder sortOrder = Qt::AscendingOrder;
+
+ QVERIFY(testObject.saveSortingValues(sortRole, sortOrder) < 0);
+ CRepository::setNewLLeave(false);
+
+ CRepository::setSetFail(0);
+ QVERIFY(testObject.saveSortingValues(sortRole, sortOrder) < 0);
+
+ CRepository::setSetFail(1);
+ QVERIFY(testObject.saveSortingValues(sortRole, sortOrder) < 0);
+
+ CRepository::setSetFail(255);
+ QVERIFY(testObject.saveSortingValues(sortRole, sortOrder) == 0);
+ QCOMPARE(CRepository::getRoleValue(), sortRole);
+ QCOMPARE(CRepository::getOrderValue(), (int)sortOrder);
+}
+
+// -----------------------------------------------------------------------------
+// testLoadSortingValues
+// -----------------------------------------------------------------------------
+//
+void TestVideoVideoCollectionViewUtils::testLoadSortingValues()
+{
+ VideoCollectionViewUtils &testObject(VideoCollectionViewUtils::instance());
+ CRepository::setNewLLeave(true);
+ CRepository::setRoleValue(Qt::DisplayRole);
+ CRepository::setOrderValue(Qt::DescendingOrder);
+
+ int sortRole(-1);
+ Qt::SortOrder sortOrder(Qt::AscendingOrder);
+
+ QVERIFY(testObject.loadSortingValues(sortRole, sortOrder) < 0);
+ QCOMPARE(sortRole, -1);
+ QCOMPARE(sortOrder, Qt::AscendingOrder);
+
+ CRepository::setNewLLeave(false);
+ CRepository::setGetFail(0);
+ QVERIFY(testObject.loadSortingValues(sortRole, sortOrder) < 0);
+ QCOMPARE(sortRole, -1);
+ QCOMPARE(sortOrder, Qt::AscendingOrder);
+
+ CRepository::setGetFail(1);
+ QVERIFY(testObject.loadSortingValues(sortRole, sortOrder) < 0);
+ QCOMPARE(sortRole, -1);
+ QCOMPARE(sortOrder, Qt::AscendingOrder);
+
+ CRepository::setGetFail(255);
+ QVERIFY(testObject.loadSortingValues(sortRole, sortOrder) == 0);
+ QCOMPARE(sortRole, (int)Qt::DisplayRole);
+ QCOMPARE(sortOrder, Qt::DescendingOrder);
+}
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testvideocollectionviewutils/stub/inc/centralrepository.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,95 @@
+/*
+* 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();
+
+ /**
+ * sets gSettedRoleValue;
+ */
+ static void setRoleValue(int value);
+
+ /**
+ * sets gSettedOrderValue;
+ */
+ static void setOrderValue(int 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);
+
+private:
+
+};
+
+#endif // __CENTRALREPOSITORY_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testvideocollectionviewutils/stub/inc/hbmessagebox.h Thu Apr 01 22:38:49 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 HBMESSAGEBOX_H
+#define HBMESSAGEBOX_H
+
+#include <QString>
+
+class HbMessageBox;
+
+
+class HbMessageBox
+{
+
+public:
+
+ static bool question(QString text)
+ {
+ mLatestTxt = text;
+ return mQuestionReturnValue;
+ }
+
+ static void information(QString text)
+ {
+ mInformationCallCount++;
+ mLatestTxt = text;
+ }
+
+ static void warning(QString text)
+ {
+ mWarningCallCount++;
+ mLatestTxt = text;
+ }
+
+ /**
+ * returned from question
+ */
+ static bool mQuestionReturnValue;
+
+ /**
+ * saved text
+ */
+ static QString mLatestTxt;
+
+ static int mWarningCallCount;
+
+ static int mInformationCallCount;
+};
+
+#endif // HBMESSAGEBOX_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testvideocollectionviewutils/stub/src/centralrepository.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,185 @@
+/*
+* 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 "stub/inc/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;
+
+// -----------------------------------------------------------------------------
+// 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;
+}
+
+// -----------------------------------------------------------------------------
+// setRoleValue
+// -----------------------------------------------------------------------------
+//
+void CRepository::setRoleValue(int value)
+{
+ gSettedRoleValue = value;
+}
+
+// -----------------------------------------------------------------------------
+// setOrderValue
+// -----------------------------------------------------------------------------
+//
+void CRepository::setOrderValue(int value)
+{
+ gSettedOrderValue = 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;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testvideocollectionviewutils/stub/src/hbdialog.cpp Thu Apr 01 22:38:49 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 HbDialog
+*
+*/
+#include <QGraphicsWidget>
+
+#include "hbaction.h"
+#include "hblabel.h"
+#include "HbDialog.h"
+
+HbDialog *HbDialog::currentInstance = 0;
+
+bool HbDialog::execReturnPrimary = true;
+
+bool HbDialog::primaryReturnNull = 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;
+}
+
+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/videocollectionview/tsrc/testvideocollectionviewutils/stub/src/hbmessagebox.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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 "hbmessagebox.h"
+
+bool HbMessageBox::mQuestionReturnValue = false;
+
+QString HbMessageBox::mLatestTxt = "";
+
+int HbMessageBox::mWarningCallCount = 0;
+
+int HbMessageBox::mInformationCallCount = 0;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testvideocollectionviewutils/testvideocollectionviewutils.pro Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,55 @@
+# #####################################################################
+# Automatically generated by qmake (2.01a) Tue 5. May 13:25:42 2009
+# #####################################################################
+TEMPLATE = app
+TARGET =
+DEPENDPATH += . \
+ inc \
+ src \
+ stub\inc \
+ stub\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
+
+CONFIG += qtestlib \
+ symbian_test
+
+LIBS += -lestor.dll \
+ -lfbscli.dll \
+ -lbitgdi.dll \
+ -lgdi.dll
+
+# 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
+
+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 \
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/inc/testvideolistselectiondialog.h Thu Apr 01 22:38:49 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: tester for methods in VideoListSelectionDialog
+*
+*/
+
+#ifndef __TESTVIDEOLISTSELECTIONDIALOG_H__
+#define __TESTVIDEOLISTSELECTIONDIALOG_H__
+
+
+// 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:
+
+ /**
+ * will be called before each testfunction is executed.
+ *
+ */
+ void init();
+
+ /**
+ * 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();
+
+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;
+};
+
+
+#endif // __TESTVIDEOCOLLECTIONVIEWUTILS_H__
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/src/testvideolistselectiondialog.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,450 @@
+/**
+* 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 VideoListSelectionDialog
+*
+*/
+#include "testvideolistselectiondialog.h"
+#include <qapplication.h>
+#include "hbaction.h"
+#include "videocollectionuiloader.h"
+#include "videolistwidget.h"
+#include "dummydatamodel.h"
+#include "videosortfilterproxymodel.h"
+
+#define private public
+#include "videolistselectiondialog.h"
+#undef private
+
+const int DEFAULT_ROW_COUNT = 10;
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ QApplication app(argc, argv);
+
+ 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);
+
+ return res;
+}
+
+// ---------------------------------------------------------------------------
+// init
+// ---------------------------------------------------------------------------
+//
+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);
+
+}
+
+// ---------------------------------------------------------------------------
+// cleanup
+// ---------------------------------------------------------------------------
+//
+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
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/stub/inc/dummydatamodel.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,110 @@
+/*
+* 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: DummyDataModel class definition*
+*/
+
+#ifndef __DUMMYDATAMODEL_H__
+#define __DUMMYDATAMODEL_H__
+
+
+// INCLUDES
+#include <QObject>
+#include <qabstractitemmodel.h>
+
+
+// FORWARD DECLARATIONS
+
+
+class DummyDataModel : public QAbstractItemModel
+{
+ /**
+ * define to be able to use signals and slots
+ */
+ Q_OBJECT
+
+ /**
+ * disable copy-constructor and assignment operator
+ */
+ Q_DISABLE_COPY(DummyDataModel)
+
+public:
+
+ /**
+ * Default constructor
+ */
+ DummyDataModel();
+
+ /**
+ * Destructor
+ */
+ ~DummyDataModel();
+
+ /**
+ * sets provided row count:
+ * if count given is larger that existing count, rows are inserted
+ * if count given is smaller than existing count, rows are removed
+ */
+ void setRowCount(int count);
+
+public: // from QAbstractItemModel
+
+ /**
+ * Returns row count
+ */
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+
+ /**
+ * Dummy implementation
+ */
+ 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;
+
+private:
+
+ /**
+ * dummy data
+ */
+ QMap<int, QVariant> mData;
+
+ /**
+ * row count
+ */
+ int mRowCount;
+
+};
+#endif // __DUMMYDATAMODEL_H__
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/stub/inc/hbabstractitemview.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* 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
+ {
+ NoSelection,
+ MultiSelection
+ };
+
+ HbAbstractItemView(QGraphicsWidget *parent = 0) : HbWidget(parent){}
+
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/stub/inc/hbaction.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: stub hbaction for testing video liste selection dialog
+*
+*/
+
+#ifndef HBACTION_H
+#define HBACTION_H
+
+#include <QObject>
+#include <QString>
+#include <qpointer.h>
+#include "hbwidget.h"
+#include "hbdialog.h"
+
+class HbAction : public HbWidget
+{
+ Q_OBJECT
+public:
+ /**
+ * Contructor.
+ */
+ HbAction( const QString &txt, QGraphicsItem *parent = 0) : mTxt(txt), HbWidget(0) {initializeCount++;};
+
+ /**
+ * destructor
+ */
+ virtual ~HbAction(){initializeCount--;}
+
+ /**
+ * sets mDisable;
+ */
+ void setDisabled(bool disable){mDisable = disable;}
+
+ /**
+ * dummy member
+ */
+ bool mDisable;
+
+ /**
+ * text setted
+ */
+ QString mTxt;
+
+ /**
+ * counter to make sure alloc dealloc match
+ */
+ static int initializeCount;
+
+signals:
+ void triggered();
+
+
+
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/stub/inc/hbcheckbox.h Thu Apr 01 22:38:49 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/videocollectionview/tsrc/testvideolistselectiondialog/stub/inc/hbdeviceprofile.h Thu Apr 01 22:38:49 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/videocollectionview/tsrc/testvideolistselectiondialog/stub/inc/hbdialog.h Thu Apr 01 22:38:49 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
+{
+
+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/videocollectionview/tsrc/testvideolistselectiondialog/stub/inc/hblabel.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* 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 list selection dialog
+*
+*/
+
+#ifndef HBLABEL_H
+#define HBLABEL_H
+
+#include <QGraphicsWidget>
+#include <QString>
+#include "hbwidget.h"
+
+class HbLabel : public HbWidget
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * Contructor.
+ */
+ HbLabel(QGraphicsItem *parent = 0) : HbWidget(parent), mPlainTxt(""){initializeCount++;}
+
+ /**
+ * Contructor.
+ */
+ HbLabel(const QString &txt, QGraphicsItem *parent = 0) : HbWidget(parent), mPlainTxt(txt) {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();
+
+ /**
+ * text setted
+ */
+ QString mPlainTxt;
+
+ /**
+ * alinment setted
+ */
+ Qt::AlignmentFlag mAlignment;
+
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/stub/inc/hbstackedwidget.h Thu Apr 01 22:38:49 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/videocollectionview/tsrc/testvideolistselectiondialog/stub/inc/hbview.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,29 @@
+/*
+* 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 hbview
+*
+*/
+
+#ifndef HBVIEW_H
+#define HBVIEW_H
+
+#include "hbwidget.h"
+
+class HbView : public HbWidget
+{
+public:
+ HbView(QGraphicsItem *parent = 0) : HbWidget(parent) {};
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/stub/inc/hbwidget.h Thu Apr 01 22:38:49 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>
+
+ /**
+ * counter to make sure alloc dealloc match
+ */
+
+
+class HbWidget : public QGraphicsWidget
+{
+ Q_OBJECT
+public:
+ HbWidget(QGraphicsItem *parent = 0) : QGraphicsWidget(parent){initializeCount++;}
+
+ virtual ~HbWidget(){initializeCount--;}
+
+ static int initializeCount;
+
+
+
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/stub/inc/videocollectionuiloader.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,107 @@
+/*
+* 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 videocollection ui loader for testing video list selection dialog
+*
+*/
+#ifndef _VIDEOCOLLECTIONUILOADER_H_
+#define _VIDEOCOLLECTIONUILOADER_H_
+
+#include <QString>
+#include "hblabel.h"
+#include "hbcheckbox.h"
+#include "hbstackedwidget.h"
+
+static const char* DOCML_NAME_DLG_HEADINGLBL = "mHeadingLabel";
+static const char* DOCML_NAME_MARKALL = "mCheckMarkAll";
+static const char* DOCML_NAME_LBL_SELECTION = "mSelectionCount";
+static const char* DOCML_NAME_LIST_CONTAINER = "mListContainer";
+
+class VideoCollectionUiLoader
+{
+
+public:
+
+ VideoCollectionUiLoader();
+
+ ~VideoCollectionUiLoader();
+
+ /**
+ * Returns the requested widget casted to correct type
+ *
+ * @param name Name of the widget
+ * @return Pointer to the widget
+ */
+ template<class T>
+ T* findWidget( QString name )
+ {
+ T *object = 0;
+ if(name == DOCML_NAME_DLG_HEADINGLBL)
+ {
+ if(!mHeadingLabel)
+ {
+ mHeadingLabel = new HbLabel();
+ }
+ object = qobject_cast<T*>(mHeadingLabel);
+ }
+ if(name == DOCML_NAME_MARKALL)
+ {
+ if(!mCheckMarkAll)
+ {
+ mCheckMarkAll = new HbCheckBox();
+ }
+ object = qobject_cast<T*>(mCheckMarkAll);
+ }
+ if(name == DOCML_NAME_LBL_SELECTION)
+ {
+ if(!mSelectionCount)
+ {
+ mSelectionCount = new HbLabel();
+ }
+ object = qobject_cast<T*>(mSelectionCount);
+ }
+ if(name == DOCML_NAME_LIST_CONTAINER)
+ {
+ if(!mListContainer)
+ {
+ mListContainer = new HbStackedWidget();
+ }
+ object = qobject_cast<T*>(mListContainer);
+ }
+ return object;
+ }
+
+ /**
+ * mHeadingLabel
+ */
+ HbLabel *mHeadingLabel;
+
+ /**
+ * mSelectionCount
+ */
+ HbLabel *mSelectionCount;
+
+ /**
+ * mCheckMarkAll
+ */
+ HbCheckBox *mCheckMarkAll;
+
+ /**
+ * mListContainer
+ */
+ HbStackedWidget *mListContainer;
+
+
+};
+
+#endif // _VIDEOCOLLECTIONUILOADER_H_
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/stub/inc/videocollectionwrapper.h Thu Apr 01 22:38:49 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 VideoCollectionWrapper class for testing multiple selection dialog
+*
+*/
+
+#ifndef __VIDEOCOLLECTIONWRAPPER_H__
+#define __VIDEOCOLLECTIONWRAPPER_H__
+
+
+// INCLUDES
+#include <QObject>
+#include <qabstractitemmodel.h>
+#include "videosortfilterproxymodel.h"
+
+// class declaration required for static instance
+class VideoCollectionWrapper;
+
+static VideoCollectionWrapper *mInstance = 0;
+
+class VideoCollectionWrapper : public QObject
+{
+ /**
+ * define to be able to use signals and slots
+ */
+ Q_OBJECT
+
+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()
+ {
+ if(!mInstance)
+ {
+ mInstance = new VideoCollectionWrapper();
+ }
+ if(!mInstance->mReturnNull)
+ {
+ mInstance->mReferenceCount++;
+ return mInstance;
+ }
+ return 0;
+ }
+
+ void decreaseReferenceCount()
+ {
+ if(mInstance)
+ {
+ if(--mInstance->mReferenceCount == 0)
+ {
+ delete mInstance;
+ mInstance = NULL;
+ }
+ }
+ }
+
+ /**
+ * Returns pointer to model
+ *
+ * @return address to model or NULL if fails.
+ */
+ VideoSortFilterProxyModel* getModel()
+ {
+ return mModel;
+ }
+
+
+ void setModel(VideoSortFilterProxyModel *model)
+ {
+ mModel = model;
+ }
+
+
+ /**
+ * counter for succeed instance calls
+ */
+ int mReferenceCount;
+
+ /**
+ * if true, returns null from instance(), does not increate reference count
+ */
+ bool mReturnNull;
+
+private:
+
+ /**
+ * Private contructor.
+ */
+ VideoCollectionWrapper() : mReferenceCount(0), mReturnNull(false){};
+
+ /**
+ * Private destructor.
+ *
+ */
+ virtual ~VideoCollectionWrapper(){};
+
+ /**
+ * disables copy-constructor and assingment operator
+ */
+ Q_DISABLE_COPY(VideoCollectionWrapper)
+
+
+ VideoSortFilterProxyModel* mModel;
+
+};
+
+#endif // __VIDEOCOLLECTIONWRAPPER_H__
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/stub/inc/videolistwidget.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,210 @@
+/*
+* 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 videolistwidget for testing video list selection dialog
+*
+*/
+
+#ifndef VIDEOLISTWIDGET_H
+#define VIDEOLISTWIDGET_H
+
+#include <QObject>
+#include <QItemSelection>
+#include <QGraphicsWidget>
+#include <QGraphicsLayoutItem>
+#include <QGraphicsItem>
+#include "hbview.h"
+#include "hbabstractitemview.h"
+
+class QGraphicsLayoutItem;
+class VideoSortFilterProxyModel;
+
+/**
+ * dummy class inherited from QGraphicsItem needed
+ * as parent item for videolistwidget
+ */
+class DummyGraphicsItem : public QGraphicsItem
+{
+public:
+
+ virtual QRectF boundingRect() const {return QRectF();}
+
+ virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0)
+ {
+ Q_UNUSED(painter);
+ Q_UNUSED(option);
+ Q_UNUSED(widget);
+ }
+
+};
+
+
+/**
+ * dummy class inherited from QGraphicsLayoutItem needed
+ * as parent layout item for videolistwidget
+ */
+class DummyGraphicsLayoutItem : public QGraphicsLayoutItem
+{
+public:
+
+ virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint = QSizeF()) const
+ {
+ Q_UNUSED(which);
+ Q_UNUSED(constraint);
+ return QSizeF();
+ }
+
+};
+
+/**
+ * dummy selection model, just needed for signal connecting
+ */
+class DummySelectionModel : public QObject
+{
+ Q_OBJECT
+public:
+ DummySelectionModel(){}
+ ~DummySelectionModel(){}
+signals:
+ void selectionChanged (const QItemSelection&, const QItemSelection&);
+};
+
+
+class VideoListWidget : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * Contructor.
+ *
+ * @param parent parent of this widget
+ */
+ VideoListWidget(VideoSortFilterProxyModel &model);
+
+ /**
+ * Destructor.
+ *
+ */
+ virtual ~VideoListWidget();
+
+ /**
+ * returns model
+ */
+ VideoSortFilterProxyModel& getModel();
+
+ /**
+ * dummy implementation
+ */
+ QGraphicsLayoutItem* parentLayoutItem();
+
+ /**
+ * dummy implementation
+ */
+ QGraphicsItem* parentItem();
+
+ /**
+ * dummy implementation
+ */
+ void setParentItem(QGraphicsItem *currentParentItem);
+
+ /**
+ * dummy implementation
+ */
+ void setParentLayoutItem(QGraphicsLayoutItem *currenParentLayout);
+
+ /**
+ * dummy
+ */
+ void setVisible(bool how);
+
+ /**
+ * dummy
+ */
+ void setSelectionMode(HbAbstractItemView::SelectionMode mode);
+
+ /**
+ * returns mDummySelectionModel
+ */
+ DummySelectionModel* selectionModel();
+
+signals:
+
+ /**
+ * selection changed
+ */
+ void selectionChanged (const QItemSelection&, const QItemSelection&);
+
+public slots:
+
+ /**
+ * sets all items selected
+ */
+ void selectAll();
+
+ /**
+ * clears selection
+ */
+ void clearSelection();
+
+
+public:
+
+ /**
+ * model
+ */
+ VideoSortFilterProxyModel &mModel;
+
+ /**
+ * dummy selection model for emitting selectionChanged
+ */
+ DummySelectionModel *mDummySelectionModel;
+
+ /**
+ * counter for startselectionmode calls
+ */
+ int mStartSelModeStartedCount;
+
+ /**
+ * counter for end selection mode calls
+ */
+ int mEndSelModelStartedCount;
+
+ /**
+ * visibility
+ */
+ bool mVisibility;
+
+ /**
+ * selection mode
+ */
+ HbAbstractItemView::SelectionMode mSelectionMode;
+
+ /**
+ * "parent" item
+ */
+ QGraphicsItem *mParentItem;
+
+ /**
+ * "parent" layout
+ */
+ QGraphicsLayoutItem *mParentLayout;
+
+ /**
+ * selection
+ */
+ QItemSelection mInitiallySelected;
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/stub/inc/videosortfilterproxymodel.h Thu Apr 01 22:38:49 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: dummy videosortfilterproxymodel definition for
+* VideoListSelectionDialog unit tests
+*
+*/
+
+#ifndef VIDEOSORTFILTERPROXYMODEL_H
+#define VIDEOSORTFILTERPROXYMODEL_H
+
+#include <qsortfilterproxymodel.h>
+
+class VideoSortFilterProxyModel : public QSortFilterProxyModel
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * Contructor.
+ *
+ * @param parent parent of this widget
+ */
+ VideoSortFilterProxyModel(QObject *parent=0);
+
+ /**
+ * Destructor.
+ *
+ */
+ virtual ~VideoSortFilterProxyModel();
+
+};
+
+
+
+#endif //VIDEOSORTFILTERPROXYMODEL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/stub/src/dummydatamodel.cpp Thu Apr 01 22:38:49 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: DummyDataModel class implementation
+*
+*/
+// INCLUDE FILES
+#include "dummydatamodel.h"
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// -----------------------------------------------------------------------------
+// DummyDataModel::DummyDataModel()
+// -----------------------------------------------------------------------------
+//
+DummyDataModel::DummyDataModel() :
+mRowCount(0)
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// DummyDataModel::~DummyDataModel()
+// -----------------------------------------------------------------------------
+//
+DummyDataModel::~DummyDataModel()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// DummyDataModel::setRowCount()
+// -----------------------------------------------------------------------------
+//
+void DummyDataModel::setRowCount(int count)
+{
+ if ( count == mRowCount ) return;
+
+ if ( count > mRowCount ) {
+ beginInsertRows(QModelIndex(), mRowCount, count - 1);
+ mRowCount = count;
+ endInsertRows();
+ } else {
+ beginRemoveRows(QModelIndex(), count, mRowCount - 1);
+ mRowCount = count;
+ endRemoveRows();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// DummyDataModel::rowCount()
+// -----------------------------------------------------------------------------
+//
+int DummyDataModel::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;
+}
+
+// -----------------------------------------------------------------------------
+// DummyDataModel::itemData()
+// -----------------------------------------------------------------------------
+//
+QMap<int, QVariant> DummyDataModel::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;
+
+}
+// -----------------------------------------------------------------------------
+// DummyDataModel::data()
+// -----------------------------------------------------------------------------
+//
+QVariant DummyDataModel::data(const QModelIndex & index, int role) const
+{
+ QVariant returnValue = QVariant();
+
+ return returnValue;
+}
+
+// -----------------------------------------------------------------------------
+// DummyDataModel::columnCount()
+// -----------------------------------------------------------------------------
+//
+int DummyDataModel::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;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// DummyDataModel::index()
+// -----------------------------------------------------------------------------
+//
+QModelIndex DummyDataModel::index(int row, int column, const QModelIndex & /*parent*/) const
+{
+ return createIndex(row, column);
+}
+
+// -----------------------------------------------------------------------------
+// DummyDataModel::parent()
+// -----------------------------------------------------------------------------
+//
+QModelIndex DummyDataModel::parent(const QModelIndex & /*index*/) const
+{
+ return QModelIndex();
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/stub/src/hbaction.cpp Thu Apr 01 22:38:49 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/videocollectionview/tsrc/testvideolistselectiondialog/stub/src/hbcheckbox.cpp Thu Apr 01 22:38:49 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/videocollectionview/tsrc/testvideolistselectiondialog/stub/src/hbdialog.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,131 @@
+/*
+* 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/videocollectionview/tsrc/testvideolistselectiondialog/stub/src/hblabel.cpp Thu Apr 01 22:38:49 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/videocollectionview/tsrc/testvideolistselectiondialog/stub/src/hbstackedwidget.cpp Thu Apr 01 22:38:49 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/videocollectionview/tsrc/testvideolistselectiondialog/stub/src/hbwidget.cpp Thu Apr 01 22:38:49 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/videocollectionview/tsrc/testvideolistselectiondialog/stub/src/videocollectionuiloader.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,37 @@
+/*
+* 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 videocollection ui loader for testing video list selection dialog
+*
+*/
+
+
+#include "videocollectionuiloader.h"
+
+
+VideoCollectionUiLoader::VideoCollectionUiLoader() :
+mHeadingLabel(0),
+mSelectionCount(0),
+mCheckMarkAll(0),
+mListContainer(0)
+{
+
+}
+
+VideoCollectionUiLoader::~VideoCollectionUiLoader()
+{
+ delete mHeadingLabel;
+ delete mSelectionCount;
+ delete mCheckMarkAll;
+ delete mListContainer;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/stub/src/videolistwidget.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,149 @@
+/*
+* 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 videolistwidget
+*
+*/
+
+#include "videosortfilterproxymodel.h"
+#include "videolistwidget.h"
+
+// ---------------------------------------------------------------------------
+// VideoListWidget
+// ---------------------------------------------------------------------------
+//
+VideoListWidget::VideoListWidget(VideoSortFilterProxyModel &model) :
+mModel(model),
+mDummySelectionModel(0),
+mStartSelModeStartedCount(0),
+mEndSelModelStartedCount(0),
+mParentItem(0),
+mParentLayout(0),
+mVisibility(false),
+mSelectionMode(HbAbstractItemView::NoSelection)
+{
+ mDummySelectionModel = new DummySelectionModel();
+ mParentItem = new DummyGraphicsItem();
+ mParentLayout = new DummyGraphicsLayoutItem();
+ mInitiallySelected.clear();
+}
+
+// ---------------------------------------------------------------------------
+// ~VideoListWidget
+// ---------------------------------------------------------------------------
+//
+VideoListWidget::~VideoListWidget()
+{
+ delete mParentItem;
+ delete mParentLayout;
+}
+
+// ---------------------------------------------------------------------------
+// getModel
+// ---------------------------------------------------------------------------
+//
+VideoSortFilterProxyModel& VideoListWidget::getModel()
+{
+ return mModel;
+}
+
+// ---------------------------------------------------------------------------
+// selectAll
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::selectAll()
+{
+ mInitiallySelected.select( mModel.index(0,0), mModel.index(mModel.rowCount() - 1, 0 ));
+}
+
+// ---------------------------------------------------------------------------
+// clearSelection
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::clearSelection()
+{
+ mInitiallySelected.clear();
+}
+
+// ---------------------------------------------------------------------------
+// parentLayoutItem
+// ---------------------------------------------------------------------------
+//
+QGraphicsLayoutItem* VideoListWidget::parentLayoutItem()
+{
+ return mParentLayout;
+}
+
+// ---------------------------------------------------------------------------
+// parentItem
+// ---------------------------------------------------------------------------
+//
+QGraphicsItem* VideoListWidget::parentItem()
+{
+ return mParentItem;
+}
+
+// ---------------------------------------------------------------------------
+// setParentItem
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::setParentItem(QGraphicsItem *currentParentItem)
+{
+ mParentItem = currentParentItem;
+}
+
+// ---------------------------------------------------------------------------
+// setParentLayoutItem
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::setParentLayoutItem(QGraphicsLayoutItem *currenParentLayout)
+{
+ mParentLayout = currenParentLayout;
+}
+
+// ---------------------------------------------------------------------------
+// setVisible
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::setVisible(bool how)
+{
+ mVisibility = how;
+}
+
+// ---------------------------------------------------------------------------
+// setSelectionMode
+// ---------------------------------------------------------------------------
+//
+void VideoListWidget::setSelectionMode(HbAbstractItemView::SelectionMode mode)
+{
+ if(mode == HbAbstractItemView::MultiSelection)
+ {
+ mStartSelModeStartedCount++;
+ }
+ else if(mode == HbAbstractItemView::NoSelection)
+ {
+ mEndSelModelStartedCount++;
+ }
+ mSelectionMode = mode;
+}
+
+// ---------------------------------------------------------------------------
+// selectionModel
+// ---------------------------------------------------------------------------
+//
+DummySelectionModel* VideoListWidget::selectionModel()
+{
+ return mDummySelectionModel;
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/stub/src/videosortfilterproxymodel.cpp Thu Apr 01 22:38:49 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: dummy videosortfilterproxymodel implementation for
+* VideoListSelectionDialog unit tests
+*
+*/
+
+#include <qstringlist.h>
+#include <qdatetime.h>
+
+#include "videocollectioncommon.h"
+#include "videosortfilterproxymodel.h"
+
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::VideoSortFilterProxyModel
+// -----------------------------------------------------------------------------
+//
+VideoSortFilterProxyModel::VideoSortFilterProxyModel(QObject *parent) :
+ QSortFilterProxyModel(parent)
+{
+ reset();
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::~VideoSortFilterProxyModel
+// -----------------------------------------------------------------------------
+//
+VideoSortFilterProxyModel::~VideoSortFilterProxyModel()
+{
+ disconnect();
+}
+
+// end of file
+
+
+
+
+
+
+
+
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/tsrc/testvideolistselectiondialog/testvideolistselectiondialog.pro Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,67 @@
+# #####################################################################
+# Automatically generated by qmake (2.01a) Tue 5. May 13:25:42 2009
+# #####################################################################
+TEMPLATE = app
+TARGET =
+DEPENDPATH += . \
+ inc \
+ src \
+ stub\inc \
+ stub\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
+
+CONFIG += qtestlib \
+ 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
+
+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 \
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionview/videocollectionview.pro Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,83 @@
+#
+# 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 = lib
+CONFIG += hb \
+ qt \
+ ecomplugin
+
+TARGET =
+symbian: {
+ TARGET.UID2 = 0x10009D8D
+ TARGET.UID3 = 0x200211FB
+ BLD_INF_RULES.prj_exports += "rom/videocollectionview.iby CORE_APP_LAYER_IBY_EXPORT_PATH(videocollectionview.iby)"
+
+ TARGET.CAPABILITY = ALL -TCB -DRM
+
+ # to enable resource access from Qt
+ TARGET.EPOCALLOWDLLDATA = 1
+}
+
+# mpx view plugin definitions:
+# plugin interface name
+SERVICE.INTERFACE_NAME = org.nokia.mmdt.QViewPlugin/1.0
+
+# opaque data for resolving the correct plugin
+SERVICE.CONFIGURATION = "<t>0x200211FC</t><p></p><i>EMPXViewPluginPriorityNormal</i><f>0x00000001</f>"
+
+DEPENDPATH += .
+INCLUDEPATH += . \
+ ./inc
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE \
+ /epoc32/include/mw/hb/hbtools \
+ /epoc32/include/mw
+
+INCLUDEPATH += ../videocollectionwrapper/inc \
+ ../../videoplayerapp/videoplayerengine/inc \
+ ../../videoplayerapp/inc \
+ ../inc \
+ ../../inc \
+
+# Input
+HEADERS += inc/videocollectionviewplugin.h \
+ inc/videolistview.h \
+ inc/videolistwidget.h \
+ inc/videohintwidget.h \
+ inc/videocollectionviewutils.h \
+ inc/videocollectionuiloader.h \
+ inc/videolistselectiondialog.h
+
+SOURCES += src/videocollectionviewplugin.cpp \
+ src/videolistview.cpp \
+ src/videolistwidget.cpp \
+ src/videohintwidget.cpp \
+ src/videocollectionviewutils.cpp \
+ src/videocollectionuiloader.cpp \
+ src/videolistselectiondialog.cpp
+
+RESOURCES += data/videocollectionview.qrc
+
+LIBS += -lmpxviewframeworkqt.dll \
+ -lvideocollectionwrapper.dll \
+ -lcentralrepository.dll \
+ -lxqserviceutil.dll \
+ -lvideoplayerengine.dll
+
+# Seems to be no way to get these on top of file
+mmpBlock = "$${LITERAL_HASH}include <platform_paths.hrh>" \
+ "$${LITERAL_HASH}include <data_caging_paths.hrh>" \
+ "$${LITERAL_HASH}include <bldvariant.hrh>"
+MMP_RULES += mmpBlock
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/data/icons/pri_large_video.svg Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+ <!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
+]>
+<svg version="1.1"
+ xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
+ x="0px" y="0px" width="98px" height="98px" viewBox="0 0 98 98" enable-background="new 0 0 98 98" xml:space="preserve">
+<defs>
+</defs>
+<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="48.9995" y1="19" x2="48.9995" y2="79.0015">
+ <stop offset="0" style="stop-color:#757575"/>
+ <stop offset="0.2424" style="stop-color:#000000"/>
+ <stop offset="0.8606" style="stop-color:#000000"/>
+ <stop offset="1" style="stop-color:#363636"/>
+</linearGradient>
+<path fill="url(#SVGID_1_)" d="M84.5,19h-71c-1.105,0-2,0.896-2,2v56.001c0,1.105,0.895,2,2,2h71c1.104,0,2-0.895,2-2V21
+ C86.5,19.896,85.603,19,84.5,19z M20.5,75.001c0,0.551-0.451,1-1,1h-4c-0.551,0-1-0.449-1-1v-2c0-0.549,0.449-1,1-1h4
+ c0.549,0,1,0.451,1,1V75.001z M20.5,25c0,0.551-0.451,1-1,1h-4c-0.551,0-1-0.449-1-1v-2c0-0.549,0.449-1,1-1h4c0.549,0,1,0.451,1,1
+ V25z M29.5,75.001c0,0.551-0.451,1-1,1h-4c-0.551,0-1-0.449-1-1v-2c0-0.549,0.449-1,1-1h4c0.549,0,1,0.451,1,1V75.001z M29.5,25
+ c0,0.551-0.451,1-1,1h-4c-0.551,0-1-0.449-1-1v-2c0-0.549,0.449-1,1-1h4c0.549,0,1,0.451,1,1V25z M38.5,75.001c0,0.551-0.451,1-1,1
+ h-4c-0.55,0-1-0.449-1-1v-2c0-0.549,0.449-1,1-1h4c0.549,0,1,0.451,1,1V75.001z M38.5,25c0,0.551-0.451,1-1,1h-4
+ c-0.55,0-1-0.449-1-1v-2c0-0.549,0.449-1,1-1h4c0.549,0,1,0.451,1,1V25z M47.5,75.001c0,0.551-0.451,1-1,1h-4c-0.551,0-1-0.449-1-1
+ v-2c0-0.549,0.449-1,1-1h4c0.549,0,1,0.451,1,1V75.001z M47.5,25c0,0.551-0.451,1-1,1h-4c-0.551,0-1-0.449-1-1v-2
+ c0-0.549,0.449-1,1-1h4c0.549,0,1,0.451,1,1V25z M56.5,75.001c0,0.551-0.451,1-1,1h-4c-0.551,0-1-0.449-1-1v-2c0-0.549,0.449-1,1-1
+ h4c0.549,0,1,0.451,1,1V75.001z M56.5,25c0,0.551-0.451,1-1,1h-4c-0.551,0-1-0.449-1-1v-2c0-0.549,0.449-1,1-1h4
+ c0.549,0,1,0.451,1,1V25z M65.5,75.001c0,0.551-0.451,1-1,1h-4c-0.551,0-1-0.449-1-1v-2c0-0.549,0.449-1,1-1h4c0.549,0,1,0.451,1,1
+ V75.001z M65.5,25c0,0.551-0.451,1-1,1h-4c-0.551,0-1-0.449-1-1v-2c0-0.549,0.449-1,1-1h4c0.549,0,1,0.451,1,1V25z M74.5,75.001
+ c0,0.551-0.451,1-1,1h-4c-0.551,0-1-0.449-1-1v-2c0-0.549,0.449-1,1-1h4c0.549,0,1,0.451,1,1V75.001z M74.5,25c0,0.551-0.451,1-1,1
+ h-4c-0.551,0-1-0.449-1-1v-2c0-0.549,0.449-1,1-1h4c0.549,0,1,0.451,1,1V25z M83.5,75.001c0,0.551-0.451,1-1,1h-4
+ c-0.551,0-1-0.449-1-1v-2c0-0.549,0.449-1,1-1h4c0.549,0,1,0.451,1,1V75.001z M83.5,25c0,0.551-0.451,1-1,1h-4c-0.551,0-1-0.449-1-1
+ v-2c0-0.549,0.449-1,1-1h4c0.549,0,1,0.451,1,1V25z"/>
+<path opacity="0.55" fill="#FFFFFF" d="M84.5,19h-71c-1.105,0-2,0.896-2,2v1c0-1.104,0.895-2,2-2h71c1.104,0,2,0.896,2,2v-1
+ C86.5,19.896,85.603,19,84.5,19z"/>
+<path opacity="0.1" fill="#FFFFFF" d="M13.5,79.001h71c1.104,0,2-0.895,2-2v-1c0,1.105-0.896,2-2,2h-71c-1.105,0-2-0.895-2-2v1
+ C11.5,78.106,12.395,79.001,13.5,79.001z"/>
+<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="48.9995" y1="29.1592" x2="48.9995" y2="69.1606">
+ <stop offset="0" style="stop-color:#000000"/>
+ <stop offset="0.5" style="stop-color:#666666"/>
+ <stop offset="1" style="stop-color:#000000"/>
+</linearGradient>
+<rect x="11.5" y="29" fill="url(#SVGID_2_)" width="75" height="40.001"/>
+<linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="49" y1="69.001" x2="49" y2="29.0005">
+ <stop offset="0" style="stop-color:#36B5FF"/>
+ <stop offset="1" style="stop-color:#1B66D8"/>
+</linearGradient>
+<path fill="url(#SVGID_3_)" d="M83.5,67.001c0,1.1-0.9,2-2,2h-65c-1.1,0-2-0.9-2-2V31c0-1.1,0.9-2,2-2h65c1.1,0,2,0.9,2,2V67.001z"
+ />
+<path opacity="0.5" fill="#FFFFFF" d="M81.5,67.001h-65c-1.1,0-2,0.1-2-1l0,0c0,1.1,0.9,2,2,2h65c1.1,0,2-0.9,2-2l0,0
+ C83.5,67.101,82.599,67.001,81.5,67.001z"/>
+<linearGradient id="SVGID_4_" gradientUnits="userSpaceOnUse" x1="48.9995" y1="29" x2="48.9995" y2="69.1607">
+ <stop offset="0" style="stop-color:#000000"/>
+ <stop offset="1" style="stop-color:#404040"/>
+</linearGradient>
+<path fill="url(#SVGID_4_)" d="M81.5,30c0.551,0,1,0.449,1,1v36.001c0,0.553-0.449,1-1,1h-65c-0.551,0-1-0.447-1-1V31
+ c0-0.551,0.449-1,1-1H81.5 M81.5,29h-65c-1.1,0-2,0.9-2,2v36.001c0,1.1,0.9,2,2,2h65c1.1,0,2-0.9,2-2V31
+ C83.5,29.9,82.599,29,81.5,29L81.5,29z"/>
+<path opacity="0.2" fill="#FFFFFF" d="M81.5,41.001V33c0-1.104-0.896-2-2-2h-61c-1.105,0-2,0.896-2,2v13.001L81.5,41.001z"/>
+<rect fill="none" width="98" height="98.001"/>
+</svg>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/data/icons/pri_large_video_collection.svg Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+ <!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
+]>
+<svg version="1.1"
+ xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
+ x="0px" y="0px" width="98px" height="98px" viewBox="0 0 98 98" enable-background="new 0 0 98 98" xml:space="preserve">
+<defs>
+</defs>
+<path fill="#F1F1F2" d="M84.183,15.504H21.608c-0.975,0-1.764,0.79-1.764,1.763v49.354c0,0.975,0.789,1.763,1.764,1.763h62.574
+ c0.974,0,1.764-0.788,1.764-1.763V17.267C85.946,16.294,85.156,15.504,84.183,15.504z"/>
+<path opacity="0.4" fill="#FFFFFF" enable-background="new " d="M84.476,66.77H21.021V60.6h63.455V66.77z M84.476,22.703H21.021
+ v-6.17h63.455V22.703z"/>
+<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="52.8955" y1="15.5039" x2="52.8955" y2="68.3843">
+ <stop offset="0" style="stop-color:#757575"/>
+ <stop offset="0.2424" style="stop-color:#000000"/>
+ <stop offset="0.8606" style="stop-color:#000000"/>
+ <stop offset="1" style="stop-color:#363636"/>
+</linearGradient>
+<path fill="url(#SVGID_1_)" d="M84.183,15.504H21.608c-0.975,0-1.764,0.79-1.764,1.763v49.354c0,0.975,0.789,1.763,1.764,1.763
+ h62.574c0.974,0,1.764-0.788,1.764-1.763V17.267C85.946,16.294,85.156,15.504,84.183,15.504z M27.777,64.858
+ c0,0.486-0.397,0.882-0.881,0.882H23.37c-0.484,0-0.881-0.396-0.881-0.882v-1.762c0-0.484,0.396-0.882,0.881-0.882h3.526
+ c0.483,0,0.881,0.397,0.881,0.882V64.858z M27.777,20.792c0,0.485-0.397,0.881-0.881,0.881H23.37c-0.484,0-0.881-0.396-0.881-0.881
+ v-1.763c0-0.484,0.396-0.882,0.881-0.882h3.526c0.483,0,0.881,0.397,0.881,0.882V20.792z M35.709,64.858
+ c0,0.486-0.397,0.882-0.882,0.882h-3.524c-0.485,0-0.882-0.396-0.882-0.882v-1.762c0-0.484,0.396-0.882,0.882-0.882h3.524
+ c0.484,0,0.882,0.397,0.882,0.882V64.858z M35.709,20.792c0,0.485-0.397,0.881-0.882,0.881h-3.524c-0.485,0-0.882-0.396-0.882-0.881
+ v-1.763c0-0.484,0.396-0.882,0.882-0.882h3.524c0.484,0,0.882,0.397,0.882,0.882V20.792z M43.642,64.858
+ c0,0.486-0.397,0.882-0.881,0.882h-3.525c-0.486,0-0.883-0.396-0.883-0.882v-1.762c0-0.484,0.396-0.882,0.883-0.882h3.525
+ c0.483,0,0.881,0.397,0.881,0.882V64.858z M43.642,20.792c0,0.485-0.397,0.881-0.881,0.881h-3.525c-0.486,0-0.883-0.396-0.883-0.881
+ v-1.763c0-0.484,0.396-0.882,0.883-0.882h3.525c0.483,0,0.881,0.397,0.881,0.882V20.792z M51.573,64.858
+ c0,0.486-0.398,0.882-0.881,0.882h-3.525c-0.486,0-0.881-0.396-0.881-0.882v-1.762c0-0.484,0.395-0.882,0.881-0.882h3.525
+ c0.482,0,0.881,0.397,0.881,0.882V64.858z M51.573,20.792c0,0.485-0.398,0.881-0.881,0.881h-3.525c-0.486,0-0.881-0.396-0.881-0.881
+ v-1.763c0-0.484,0.395-0.882,0.881-0.882h3.525c0.482,0,0.881,0.397,0.881,0.882V20.792z M59.505,64.858
+ c0,0.486-0.397,0.882-0.88,0.882h-3.526c-0.484,0-0.881-0.396-0.881-0.882v-1.762c0-0.484,0.396-0.882,0.881-0.882h3.526
+ c0.482,0,0.88,0.397,0.88,0.882V64.858z M59.505,20.792c0,0.485-0.397,0.881-0.88,0.881h-3.526c-0.484,0-0.881-0.396-0.881-0.881
+ v-1.763c0-0.484,0.396-0.882,0.881-0.882h3.526c0.482,0,0.88,0.397,0.88,0.882V20.792z M67.438,64.858
+ c0,0.486-0.398,0.882-0.883,0.882H63.03c-0.484,0-0.882-0.396-0.882-0.882v-1.762c0-0.484,0.397-0.882,0.882-0.882h3.525
+ c0.484,0,0.883,0.397,0.883,0.882V64.858z M67.438,20.792c0,0.485-0.398,0.881-0.883,0.881H63.03c-0.484,0-0.882-0.396-0.882-0.881
+ v-1.763c0-0.484,0.397-0.882,0.882-0.882h3.525c0.484,0,0.883,0.397,0.883,0.882V20.792z M75.37,64.858
+ c0,0.486-0.397,0.882-0.882,0.882h-3.524c-0.486,0-0.883-0.396-0.883-0.882v-1.762c0-0.484,0.396-0.882,0.883-0.882h3.524
+ c0.484,0,0.882,0.397,0.882,0.882V64.858z M75.37,20.792c0,0.485-0.397,0.881-0.882,0.881h-3.524c-0.486,0-0.883-0.396-0.883-0.881
+ v-1.763c0-0.484,0.396-0.882,0.883-0.882h3.524c0.484,0,0.882,0.397,0.882,0.882V20.792z M83.302,64.858
+ c0,0.486-0.398,0.882-0.882,0.882h-3.525c-0.485,0-0.881-0.396-0.881-0.882v-1.762c0-0.484,0.396-0.882,0.881-0.882h3.525
+ c0.483,0,0.882,0.397,0.882,0.882V64.858z M83.302,20.792c0,0.485-0.398,0.881-0.882,0.881h-3.525c-0.485,0-0.881-0.396-0.881-0.881
+ v-1.763c0-0.484,0.396-0.882,0.881-0.882h3.525c0.483,0,0.882,0.397,0.882,0.882V20.792z"/>
+<path opacity="0.55" fill="#FFFFFF" d="M84.183,15.504H21.608c-0.975,0-1.764,0.79-1.764,1.763v0.881
+ c0-0.972,0.789-1.762,1.764-1.762h62.574c0.974,0,1.764,0.79,1.764,1.762v-0.881C85.946,16.294,85.156,15.504,84.183,15.504z"/>
+<path opacity="0.1" fill="#FFFFFF" d="M21.608,68.384h62.574c0.974,0,1.764-0.788,1.764-1.763V65.74c0,0.974-0.79,1.763-1.764,1.763
+ H21.608c-0.975,0-1.764-0.789-1.764-1.763v0.881C19.845,67.596,20.634,68.384,21.608,68.384z"/>
+<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="52.8955" y1="24.4585" x2="52.8955" y2="59.7119">
+ <stop offset="0" style="stop-color:#000000"/>
+ <stop offset="0.5" style="stop-color:#666666"/>
+ <stop offset="1" style="stop-color:#000000"/>
+</linearGradient>
+<rect x="19.845" y="24.318" fill="url(#SVGID_2_)" width="66.102" height="35.253"/>
+<linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="52.8955" y1="59.5713" x2="52.8955" y2="24.3188">
+ <stop offset="0" style="stop-color:#36B5FF"/>
+ <stop offset="1" style="stop-color:#1B66D8"/>
+</linearGradient>
+<path fill="url(#SVGID_3_)" d="M83.302,57.809c0,0.969-0.794,1.763-1.764,1.763H24.253c-0.971,0-1.764-0.794-1.764-1.763V26.08
+ c0-0.97,0.793-1.762,1.764-1.762h57.285c0.97,0,1.764,0.792,1.764,1.762V57.809z"/>
+<path opacity="0.5" fill="#FFFFFF" d="M81.538,57.809H24.253c-0.971,0-1.764,0.088-1.764-0.881l0,0c0,0.969,0.793,1.762,1.764,1.762
+ h57.285c0.97,0,1.764-0.793,1.764-1.762l0,0C83.302,57.896,82.508,57.809,81.538,57.809z"/>
+<linearGradient id="SVGID_4_" gradientUnits="userSpaceOnUse" x1="52.8955" y1="24.3184" x2="52.8955" y2="59.7121">
+ <stop offset="0" style="stop-color:#000000"/>
+ <stop offset="1" style="stop-color:#404040"/>
+</linearGradient>
+<path fill="url(#SVGID_4_)" d="M81.538,25.198c0.486,0,0.882,0.397,0.882,0.882v31.729c0,0.486-0.396,0.881-0.882,0.881H24.253
+ c-0.486,0-0.883-0.395-0.883-0.881V26.08c0-0.484,0.396-0.882,0.883-0.882H81.538 M81.538,24.318H24.253
+ c-0.971,0-1.764,0.792-1.764,1.762v31.729c0,0.969,0.793,1.763,1.764,1.763h57.285c0.97,0,1.764-0.794,1.764-1.763V26.08
+ C83.302,25.11,82.508,24.318,81.538,24.318L81.538,24.318z"/>
+<polygon fill="#FFFFFF" points="47.133,33.532 63.129,41.574 47.133,50.796 "/>
+<linearGradient id="SVGID_5_" gradientUnits="userSpaceOnUse" x1="54.5928" y1="37.9297" x2="54.5928" y2="50.2224">
+ <stop offset="0" style="stop-color:#FFFFFF"/>
+ <stop offset="1" style="stop-color:#CFCFCF"/>
+</linearGradient>
+<polygon fill="url(#SVGID_5_)" points="47.133,32.414 62.052,41.044 47.133,49.678 "/>
+<path opacity="0.2" fill="#FFFFFF" d="M81.538,34.894v-7.05c0-0.975-0.789-1.764-1.762-1.764H26.015
+ c-0.975,0-1.762,0.789-1.762,1.764V39.3L81.538,34.894z"/>
+<path opacity="0.15" d="M76.392,27.853H19.845v31.719v6.169v0.881c0,0.975,0.789,1.763,1.764,1.763h58.309V31.379
+ C79.917,29.434,78.335,27.853,76.392,27.853z"/>
+<path opacity="0.3" d="M76.392,28.734H19.845v30.837v6.169v0.881c0,0.975,0.789,1.763,1.764,1.763h57.427V31.379
+ C79.035,29.92,77.85,28.734,76.392,28.734z"/>
+<path fill="#F1F1F2" d="M76.392,29.616H13.816c-0.976,0-1.763,0.789-1.763,1.763v49.355c0,0.974,0.787,1.762,1.763,1.762h62.575
+ c0.973,0,1.763-0.788,1.763-1.762V31.379C78.154,30.405,77.364,29.616,76.392,29.616z"/>
+<path opacity="0.4" fill="#FFFFFF" enable-background="new " d="M76.685,80.881H13.228v-6.168h63.457V80.881z M76.685,36.814
+ H13.228v-6.169h63.457V36.814z"/>
+<linearGradient id="SVGID_6_" gradientUnits="userSpaceOnUse" x1="45.104" y1="29.6162" x2="45.104" y2="82.4966">
+ <stop offset="0" style="stop-color:#757575"/>
+ <stop offset="0.2424" style="stop-color:#000000"/>
+ <stop offset="0.8606" style="stop-color:#000000"/>
+ <stop offset="1" style="stop-color:#363636"/>
+</linearGradient>
+<path fill="url(#SVGID_6_)" d="M76.392,29.616H13.816c-0.976,0-1.763,0.789-1.763,1.763v49.355c0,0.974,0.787,1.762,1.763,1.762
+ h62.575c0.973,0,1.763-0.788,1.763-1.762V31.379C78.154,30.405,77.364,29.616,76.392,29.616z M19.985,78.971
+ c0,0.485-0.397,0.882-0.881,0.882h-3.525c-0.484,0-0.882-0.396-0.882-0.882v-1.763c0-0.484,0.397-0.881,0.882-0.881h3.525
+ c0.483,0,0.881,0.396,0.881,0.881V78.971z M19.985,34.903c0,0.486-0.397,0.882-0.881,0.882h-3.525c-0.484,0-0.882-0.396-0.882-0.882
+ v-1.762c0-0.484,0.397-0.882,0.882-0.882h3.525c0.483,0,0.881,0.397,0.881,0.882V34.903z M27.917,78.971
+ c0,0.485-0.397,0.882-0.881,0.882h-3.525c-0.485,0-0.882-0.396-0.882-0.882v-1.763c0-0.484,0.396-0.881,0.882-0.881h3.525
+ c0.483,0,0.881,0.396,0.881,0.881V78.971z M27.917,34.903c0,0.486-0.397,0.882-0.881,0.882h-3.525c-0.485,0-0.882-0.396-0.882-0.882
+ v-1.762c0-0.484,0.396-0.882,0.882-0.882h3.525c0.483,0,0.881,0.397,0.881,0.882V34.903z M35.85,78.971
+ c0,0.485-0.398,0.882-0.881,0.882h-3.525c-0.485,0-0.881-0.396-0.881-0.882v-1.763c0-0.484,0.396-0.881,0.881-0.881h3.525
+ c0.482,0,0.881,0.396,0.881,0.881V78.971z M35.85,34.903c0,0.486-0.398,0.882-0.881,0.882h-3.525c-0.485,0-0.881-0.396-0.881-0.882
+ v-1.762c0-0.484,0.396-0.882,0.881-0.882h3.525c0.482,0,0.881,0.397,0.881,0.882V34.903z M43.782,78.971
+ c0,0.485-0.397,0.882-0.883,0.882h-3.524c-0.485,0-0.881-0.396-0.881-0.882v-1.763c0-0.484,0.396-0.881,0.881-0.881h3.524
+ c0.485,0,0.883,0.396,0.883,0.881V78.971z M43.782,34.903c0,0.486-0.397,0.882-0.883,0.882h-3.524c-0.485,0-0.881-0.396-0.881-0.882
+ v-1.762c0-0.484,0.396-0.882,0.881-0.882h3.524c0.485,0,0.883,0.397,0.883,0.882V34.903z M51.714,78.971
+ c0,0.485-0.398,0.882-0.882,0.882h-3.525c-0.484,0-0.88-0.396-0.88-0.882v-1.763c0-0.484,0.396-0.881,0.88-0.881h3.525
+ c0.483,0,0.882,0.396,0.882,0.881V78.971z M51.714,34.903c0,0.486-0.398,0.882-0.882,0.882h-3.525c-0.484,0-0.88-0.396-0.88-0.882
+ v-1.762c0-0.484,0.396-0.882,0.88-0.882h3.525c0.483,0,0.882,0.397,0.882,0.882V34.903z M59.646,78.971
+ c0,0.485-0.396,0.882-0.881,0.882h-3.525c-0.485,0-0.882-0.396-0.882-0.882v-1.763c0-0.484,0.396-0.881,0.882-0.881h3.525
+ c0.484,0,0.881,0.396,0.881,0.881V78.971z M59.646,34.903c0,0.486-0.396,0.882-0.881,0.882h-3.525c-0.485,0-0.882-0.396-0.882-0.882
+ v-1.762c0-0.484,0.396-0.882,0.882-0.882h3.525c0.484,0,0.881,0.397,0.881,0.882V34.903z M67.578,78.971
+ c0,0.485-0.397,0.882-0.882,0.882h-3.524c-0.485,0-0.882-0.396-0.882-0.882v-1.763c0-0.484,0.396-0.881,0.882-0.881h3.524
+ c0.484,0,0.882,0.396,0.882,0.881V78.971z M67.578,34.903c0,0.486-0.397,0.882-0.882,0.882h-3.524c-0.485,0-0.882-0.396-0.882-0.882
+ v-1.762c0-0.484,0.396-0.882,0.882-0.882h3.524c0.484,0,0.882,0.397,0.882,0.882V34.903z M75.511,78.971
+ c0,0.485-0.398,0.882-0.881,0.882h-3.526c-0.486,0-0.882-0.396-0.882-0.882v-1.763c0-0.484,0.396-0.881,0.882-0.881h3.526
+ c0.482,0,0.881,0.396,0.881,0.881V78.971z M75.511,34.903c0,0.486-0.398,0.882-0.881,0.882h-3.526c-0.486,0-0.882-0.396-0.882-0.882
+ v-1.762c0-0.484,0.396-0.882,0.882-0.882h3.526c0.482,0,0.881,0.397,0.881,0.882V34.903z"/>
+<path opacity="0.55" fill="#FFFFFF" d="M76.392,29.616H13.816c-0.976,0-1.763,0.789-1.763,1.763v0.881
+ c0-0.973,0.787-1.763,1.763-1.763h62.575c0.973,0,1.763,0.79,1.763,1.763v-0.881C78.154,30.405,77.364,29.616,76.392,29.616z"/>
+<path opacity="0.1" fill="#FFFFFF" d="M13.816,82.496h62.575c0.973,0,1.763-0.788,1.763-1.762v-0.882
+ c0,0.974-0.79,1.762-1.763,1.762H13.816c-0.976,0-1.763-0.788-1.763-1.762v0.882C12.054,81.708,12.841,82.496,13.816,82.496z"/>
+<linearGradient id="SVGID_7_" gradientUnits="userSpaceOnUse" x1="45.104" y1="38.5688" x2="45.104" y2="73.8223">
+ <stop offset="0" style="stop-color:#000000"/>
+ <stop offset="0.5" style="stop-color:#666666"/>
+ <stop offset="1" style="stop-color:#000000"/>
+</linearGradient>
+<rect x="12.054" y="38.429" fill="url(#SVGID_7_)" width="66.101" height="35.253"/>
+<linearGradient id="SVGID_8_" gradientUnits="userSpaceOnUse" x1="45.104" y1="72.3418" x2="45.104" y2="38.852">
+ <stop offset="0" style="stop-color:#AFED23"/>
+ <stop offset="0.8121" style="stop-color:#358C0C"/>
+ <stop offset="1" style="stop-color:#67AD1A"/>
+</linearGradient>
+<path fill="url(#SVGID_8_)" d="M75.511,71.92c0,0.97-0.794,1.762-1.764,1.762H16.461c-0.97,0-1.764-0.792-1.764-1.762V40.191
+ c0-0.969,0.794-1.763,1.764-1.763h57.286c0.97,0,1.764,0.794,1.764,1.763V71.92z"/>
+<path opacity="0.5" fill="#FFFFFF" d="M73.747,71.92H16.461c-0.97,0-1.764,0.088-1.764-0.882l0,0c0,0.97,0.794,1.764,1.764,1.764
+ h57.286c0.97,0,1.764-0.794,1.764-1.764l0,0C75.511,72.008,74.717,71.92,73.747,71.92z"/>
+<linearGradient id="SVGID_9_" gradientUnits="userSpaceOnUse" x1="45.104" y1="38.4287" x2="45.104" y2="73.8224">
+ <stop offset="0" style="stop-color:#000000"/>
+ <stop offset="1" style="stop-color:#404040"/>
+</linearGradient>
+<path fill="url(#SVGID_9_)" d="M73.747,39.311c0.485,0,0.883,0.396,0.883,0.881V71.92c0,0.487-0.397,0.882-0.883,0.882H16.461
+ c-0.486,0-0.882-0.395-0.882-0.882V40.191c0-0.485,0.396-0.881,0.882-0.881H73.747 M73.747,38.429H16.461
+ c-0.97,0-1.764,0.794-1.764,1.763V71.92c0,0.97,0.794,1.762,1.764,1.762h57.286c0.97,0,1.764-0.792,1.764-1.762V40.191
+ C75.511,39.223,74.717,38.429,73.747,38.429L73.747,38.429z"/>
+<polygon fill="#FFFFFF" points="39.34,47.643 55.337,55.687 39.34,64.907 "/>
+<linearGradient id="SVGID_10_" gradientUnits="userSpaceOnUse" x1="46.7993" y1="52.042" x2="46.7993" y2="64.335">
+ <stop offset="0" style="stop-color:#FFFFFF"/>
+ <stop offset="1" style="stop-color:#CFCFCF"/>
+</linearGradient>
+<polygon fill="url(#SVGID_10_)" points="39.34,46.526 54.26,55.155 39.34,63.79 "/>
+<path opacity="0.2" fill="#FFFFFF" d="M73.747,49.005v-7.051c0-0.972-0.79-1.763-1.764-1.763H18.223
+ c-0.974,0-1.762,0.791-1.762,1.763v11.458L73.747,49.005z"/>
+<rect fill="none" width="98" height="98"/>
+</svg>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/data/videocollectionwrapper.qrc Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,6 @@
+<RCC>
+ <qresource prefix="/icons" >
+ <file alias="default_thumbnail_video.svg" >icons/pri_large_video.svg</file>
+ <file alias="default_thumbnail_collection.svg" >icons/pri_large_video_collection.svg</file>
+ </qresource>
+</RCC>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/inc/videocollectionclient.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,285 @@
+/*
+* 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: 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();
+
+ /**
+ * Initializes object and allocates members
+ *
+ * @return 0 if ok, < 0 in case of error
+ */
+ int initialize();
+
+public:
+
+ /**
+ * Collection level app browsed to
+ */
+ enum TCollectionLevels
+ {
+ ELevelInvalid = -1,
+ ELevelCategory = 2,
+ ELevelVideos = 3
+ };
+
+ /**
+ * Collection opening status
+ */
+ enum TCollectionOpenStatus
+ {
+ ECollectionNotOpen = 0,
+ ECollectionOpening,
+ ECollectionOpened
+ };
+
+
+
+ /**
+ * Connects videodata signals to provided object
+ * If method fails, client should deallocate it's
+ * VideoDataSignalReceiver object to make sure thee are
+ * no unused signal connections.
+ *
+ * @param aVideoModelObserver Observer.
+ *
+ * @return int -1 in case of failure
+ */
+ int connectCollectionSignalReceiver(
+ VideoDataSignalReceiver *signalReceiver);
+
+ /**
+ * Returns the current level of collection.
+ *
+ * @return some type of TCollectionLevels or -1 in case of error
+ */
+ int getCollectionLevel();
+
+ /**
+ * Returns the current category
+ *
+ * @return int
+ */
+ void getCategoryIds(int& id, int& type);
+
+ /**
+ * Returns reference to collection open status. Client can use
+ * this to get and change the status
+ *
+ * @return some type of TCollectionLevels or -1 in case of error
+ */
+ int getOpenStatus();
+
+ /**
+ * Sets open status, if given status is ECollectionOpened calls
+ * startOpenCurrentState to start collection into current state.
+ *
+ */
+ void setOpenStatus(int status);
+
+ /**
+ * Starts opening of collection to the all videos category
+ *
+ * @return 0 startup ok
+ */
+ int startOpenCollection(int level);
+
+ /**
+ * Calls open to collection to get current
+ * state to be opened.
+ *
+ * @return 0 startup ok
+ */
+ int startOpenCurrentState();
+
+ /**
+ * calls collection to deleteFile(s) mpx media object defined by the given ids
+ *
+ * @param mediaIds pointerr to the list of items to be removed
+ * @return 0 if ok
+ */
+ int deleteVideos(QList<TMPXItemId> *mediaIds);
+
+ /**
+ * calls collection to open video object defined by the given id
+ *
+ * @param aMediaId id of the item
+ * @return KErrNone if ok
+ */
+ int openVideo(TMPXItemId &mediaId);
+
+ /**
+ * calls collection to go back to collection level
+ *
+ */
+ int back();
+
+ /**
+ * Fetches MPX Media object based on MPX ID. Object can be requested later
+ * with method GetLatestFetchedMpxMediaL(). Note, there is no indication
+ * when the object becomes available.
+ *
+ * @param aMpxId MPX ID.
+ *
+ * @return 0 media fetchingstarted ok
+ */
+ int fetchMpxMediaByMpxId(TMPXItemId &aMpxId);
+
+ /**
+ * Gets all details for the selected MPX Media object.
+ * Result will be returned in CVideoCollectionListener::HandleCollectionMediaL().
+ *
+ * @param aMediaId meida id of the item (TMPXItemId.iId1)
+ *
+ * @return 0 if detail fetching started ok
+ */
+ int getVideoDetails(TMPXItemId& aMediaId);
+
+ /**
+ * Creates a new collection (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.
+ */
+ int addNewCollection(QString name, QString thumbnail, QList<TMPXItemId> mediaIds);
+
+private:
+
+ /**
+ * Private implementation to handle leaving code of collection opening.
+ *
+ */
+ void startOpenCollectionL(int level);
+
+ /**
+ * Private implementation to handle leaving code of video deletion.
+ *
+ * @param mediaIds list of ides to remove
+ */
+ void deleteVideosL(QList<TMPXItemId> &mediaIds);
+
+ /**
+ * Private implementation to handle leaving code of video opening.
+ *
+ * @param videoId id of the video to open
+ */
+ void openVideoL(TMPXItemId &videoId);
+
+ /**
+ * Private implementation to handle leaving code of collection opening.
+ *
+ * @param id id of the collection to open
+ */
+ void openCategoryL(TMPXItemId &id);
+
+ /**
+ * Private implementation to handle leaving code of collection back stepping.
+ *
+ */
+ void backL();
+
+ /**
+ * Private implementation to handle leaving code while starting to get video
+ * details
+ *
+ * @param videoId id of the video to get details from
+ */
+ void getVideoDetailsL(TMPXItemId &videoId);
+
+ /**
+ * Creates a new collection (album).
+ *
+ * @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.
+ */
+ void addNewCollectionL(QString name, QString thumbnail, QList<TMPXItemId> mediaIds);
+
+ /**
+ * Private implementation to handle leaving code while starting to fetch video
+ * object from collection
+ *
+ * @param mpxId mpxif for the video object to fetch from collection
+ */
+ void fetchMpxMediaByMpxIdL(TMPXItemId &mpxId);
+
+private:
+
+
+ /**
+ * Pointer to MPX Collection utility.
+ * Own.
+ */
+ MMPXCollectionUtility* mCollectionUtility;
+
+ /**
+ * Variable for storing My Videos collection opening status.
+ */
+ int mCollectionOpenStatus;
+
+ /**
+ * Collectionlistener
+ */
+ VideoCollectionListener *mCollectionListener;
+
+ /**
+ * Variable for storing opened My Videos category and album ids.
+ */
+ TMPXItemId mOpenCategoryAlbum;
+
+ /**
+ * Variable for storing My Videos collection path level.
+ */
+ TCollectionLevels mCollectionPathLevel;
+ };
+
+#endif // __VIDEOCOLLECTIONCLIENT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/inc/videocollectionlistener.h Thu Apr 01 22:38:49 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: VideoCollectionListener class definition*
+*/
+
+#ifndef __VIDEOCOLLECTIONLISTENER_H
+#define __VIDEOCOLLECTIONLISTENER_H
+
+// INCLUDES
+#include <QObject>
+#include <mpxcollectionobserver.h>
+
+
+// FORWARD DECLARATIONS
+class VideoCollectionClient;
+class VideoCollectionUtils;
+
+
+// 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);
+
+ /**
+ * Destructor.
+ */
+ virtual ~VideoCollectionListener();
+
+ /**
+ * Sets provided value for mNewArrayRequest
+ */
+ void setRequestNewMediaArray(bool request = true );
+
+signals:
+
+ /**
+ * Emitted when new video list is available.
+ *
+ * If client needs to maintains media-array, it should create
+ * a copy from provided array pointer
+ *
+ * @param pointer to new media array, ownership is NOT transferred
+ */
+ void newVideoList(CMPXMediaArray*);
+
+ /**
+ * Emitted from HandleOpenL when mNewArrayRequest is false.
+ * In this case we moght have not got all videos from previous
+ * HandleOpenL so we need to provide this list to client for it to
+ * check wether there are some new videos to be appended
+ *
+ * @param pointer to appendable media array, ownership is NOT transferred
+ */
+ void videoListAppended(CMPXMediaArray*);
+
+ /**
+ * Emitted when a single video item has fetched.
+ *
+ * @param pointer to Video item. Ownership is NOT transferred
+ */
+ void newVideoAvailable(CMPXMedia*);
+
+ /**
+ * Emitted when received an avent about externally removed video.
+ *
+ * @param video id
+ */
+ void videoDeleted(TMPXItemId);
+
+ /**
+ * Emitted when multiple video deletion command is completed.
+ *
+ * @param int contains count of overall deleted items
+ * @param media-array containing possible failed medias. Ownership is NOT transferred
+ */
+ void videoDeleteCompleted(int, QList<TMPXItemId>*);
+
+ /**
+ * Emitted when all details for a video have been fetched.
+ *
+ * @param id of video whose details have bee fetched.
+ */
+ void videoDetailsCompleted(TMPXItemId);
+
+private: // From MMPXCollectionObserver
+
+ /**
+ * Handle extended media properties
+ *
+ * not implemented here
+ *
+ * @param aMedia media
+ * @param aError error code
+ */
+ void HandleCollectionMediaL( const CMPXMedia& aMedia, TInt aError );
+
+ /**
+ * Handles the collection entries being opened. Typically called
+ * when client has Open()'d a folder.
+ * Uses mNewArrayRequest flag to indicate wether newVideoList or
+ * videoArrayAppended is emitted. If flag value is true, newVideolist
+ * is emitted and flag value is setted false. This is because only one
+ * newVideoList signal alloved per content request.
+ *
+ * @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 );
+
+ /**
+ * Handles the item being opened. Typically called
+ * when client has Open()'d an item. Client typically responds by
+ * 'playing' the item via the playlist.
+ *
+ * Not implemented here.
+ *
+ * @param aPlaylist collection playlist
+ * @param aError error code
+ */
+ void HandleOpenL( const CMPXCollectionPlaylist& aPlaylist, TInt aError );
+
+ /**
+ * Handle completion of a asynchronous command
+ *
+ * @param aCommandResult result of the command, NULL if error
+ * @param aError error code
+ */
+ void HandleCommandComplete( CMPXCommand* aCommandResult, TInt aError );
+
+ /**
+ * Handle collection message
+ * NOTE: only one of HandleCollectionMessage callback can be implemented
+ *
+ * @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 );
+
+private:
+
+ /**
+ * Default constructor should not be used
+ */
+ VideoCollectionListener();
+
+ /**
+ * called by the HandleCollectionMessage(), in case message received
+ * contains array -based data.
+ *
+ * @param aMessage
+ */
+ void handleMyVideosMessageArray(CMPXMessage *aMessage);
+
+ /**
+ * redirects the actual messagehandling based on given myVideosMsgId.
+ * Messages to handle contains KVcxCommandIdMyVideos as their
+ * general message id
+ *
+ * @param myVideosMsgId message id parsed by the caller
+ * @param aMessage
+ */
+ void handleMyVideosMPXMessage(int &myVideosMsgId, CMPXMessage *aMessage);
+
+ /**
+ * messages that do fall into KVcxCommandIdMyVideos, are passed here
+ * to be treated as "common" mpx messages.
+ *
+ * @param myVideosMsgId message id parsed by the caller
+ * @param aMessage
+ */
+ void handleMPXMessage(TMPXMessageId &mpxMsgId, CMPXMessage *aMessage);
+
+ /**
+ * Handles general MPX message (TMPXMessageId == KMPXMessageGeneral)
+ * In here we handle only the collection opening case: when collection
+ * informs it has opened and browsed to all videos category, we need to
+ * open collection to it's current state in order to get video list.
+ *
+ * @param aMessage collection message.
+ */
+ void handleGeneralMPXMessage(CMPXMessage* aMessage);
+
+ /**
+ * Handles item changed message.
+ *
+ * @param aMessage collection message.
+ */
+ void handleMyVideosItemsChanged( CMPXMessage* aMessage);
+
+ /**
+ * Handles delete related message.
+ *
+ * @param aMessage collection message.
+ */
+ void handleMyVideosDeleteMessage(CMPXMessage* aMessage);
+
+ /**
+ * Handles response message when MPX Media object requested.
+ *
+ * @param aMessage collection message.
+ */
+ void handleGetMediasByMpxIdResp(CMPXMessage* aMessage);
+
+ /**
+ * Handles response message when video details requested.
+ *
+ * @param aMessage collection message.
+ */
+ void handleGetVideoDetailsResp(CMPXMessage* aMessage);
+
+
+private:
+
+ /**
+ * Reference to collection client
+ */
+ VideoCollectionClient &mCollectionClient;
+
+ /**
+ * 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;
+
+ };
+
+#endif // __VIDEOCOLLECTIONLISTENER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/inc/videocollectionutils.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,155 @@
+/*
+* 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 definition*
+*/
+
+#ifndef __VIDEOCOLLECTIONUTILS_H__
+#define __VIDEOCOLLECTIONUTILS_H__
+
+
+// INCLUDES
+#include <QObject>
+#include <QString>
+#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 size string from the given value.
+ *
+ * @param size Size value in bytes
+ * @return Size as string (for example "450 kB").
+ */
+ QString prepareSizeString(quint32 size);
+
+
+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/inc/videocollectionwrapper.h Thu Apr 01 22:38:49 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: VideoCollectionWrapper class definition
+*
+*/
+
+#ifndef __VIDEOCOLLECTIONWRAPPER_H__
+#define __VIDEOCOLLECTIONWRAPPER_H__
+
+
+// INCLUDES
+#include <QObject>
+#include <qabstractitemmodel.h>
+#include "videocollectionexport.h"
+
+// FORWARD DECLARATIONS
+class VideoCollectionWrapperPrivate;
+class VideoSortFilterProxyModel;
+
+
+/**
+ * Class is used as an interface of the video collection QT wrapper.
+ *
+ * Singleton instance is deleted when it's not used anymore by clients. At instantion time
+ * reference count is incremented. Client must call decreaseReferenceCount when it doesn't
+ * need the instance anymore. When reference count is 0 the instance is destroyed.
+ *
+ * * Usage:
+ * @code
+ * #include "videocollectionwrapper.h"
+ * #include "videosortfilterproxymodel.h"
+ *
+ * ...
+ * ////
+ * // Getting the instances
+ * ////
+ * VideoCollectionWrapper *wrapper = VideoCollectionWrapper::instance();
+ *
+ * VideoSortFilterProxyModel *model = wrapper->getModel();
+ * ...
+ * ////
+ * // Opening collection and start fetching video item data
+ * ////
+ * if(model)
+ * {
+ * mModel->open(VideoListWidget::ELevelVideos);
+ * }
+ * // see model documentation for the open funtionality
+ *
+ * /////
+ * // Instance is not used anymore.
+ * // Wrapper owns the model, so client should not deallocate it
+ * /////
+ * wrapper->decreaseReferenceCount();
+ * wrapper = 0; // Don't use before new instantion.
+ *
+ * @endcode
+ *
+ */
+class VIDEOCOLLECTION_DLL_EXPORT VideoCollectionWrapper : public QObject
+{
+ /**
+ * define to be able to use signals and slots
+ */
+ Q_OBJECT
+
+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();
+
+ /**
+ * Decreases the reference count, when count reaches zero cleanup is done.
+ *
+ */
+ void decreaseReferenceCount();
+
+ /**
+ * Returns pointer to model
+ *
+ * @return address to model or NULL if fails.
+ */
+ VideoSortFilterProxyModel* getModel();
+
+ /**
+ * Method can be used by client to emit status signal
+ * containing status code from particular async status.
+ *
+ * @param statusCode code of status
+ *
+ * @param additional additional information for the code
+ */
+ void sendAsyncStatus(int statusCode, QVariant &additional);
+
+signals:
+
+ /**
+ * Signal that can be emitted by the wrapper to indicate status
+ * of some async operation.
+ *
+ * See videocollectioncommon.h for codes
+ *
+ * @param status code of status
+ *
+ * @param additional additional information for the code
+ */
+ void asyncStatus(int statusCode, QVariant &additional);
+
+private:
+
+ /**
+ * Private contructor.
+ */
+ VideoCollectionWrapper();
+
+ /**
+ * Private destructor.
+ *
+ */
+ virtual ~VideoCollectionWrapper();
+
+ /**
+ * disables copy-constructor and assingment operator
+ */
+ Q_DISABLE_COPY(VideoCollectionWrapper)
+
+private:
+
+ /**
+ * d -pointer for actual implementation
+ */
+ VideoCollectionWrapperPrivate *d;
+
+ /**
+ * Reference count.
+ */
+ int mReferenceCount;
+
+ /**
+ * Singleton instance.
+ */
+ static VideoCollectionWrapper* mInstance;
+};
+
+#endif // __VIDEOCOLLECTIONWRAPPER_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/inc/videodatasignalreceiver.h Thu Apr 01 22:38:49 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: Signal receiver interface for video data changes.*
+*/
+
+
+
+#ifndef __VIDEOMODELOBSERVER_H
+#define __VIDEOMODELOBSERVER_H
+
+// INCLUDES
+#include <QObject>
+#include <mpxcollectionmessagedefs.h>
+#include <mpxitemid.h>
+#include <Qlist>
+
+// FORWARD DECLARATIONS
+class CMPXMediaArray;
+class CMPXMedia;
+
+
+// CLASS DECLARATION
+
+/**
+ * Observer interface for video data changes.
+ *
+ * @lib vcxnsmyvideos.lib
+ */
+class VideoDataSignalReceiver : public QObject
+{
+ Q_OBJECT
+
+public slots:
+
+ /**
+ * Signaled when a list of videos is available.
+ * Ownership of array is not transferred.
+ *
+ * @param aVideoList List of videos
+ */
+ virtual void newVideoListSlot( CMPXMediaArray* aVideoList ) = 0;
+
+ /**
+ * Signaled when a list of videos is appended from collection.
+ * Ownership of array is not transferred.
+ *
+ * @param videoList List of videos
+ */
+ virtual void appendVideoListSlot( CMPXMediaArray* videoList ) = 0;
+
+
+ /**
+ * Signaled when a single video item has fetched.
+ * Ownership of video is transferred.
+ *
+ * @param aVideo Video item.
+ */
+ virtual void newVideoAvailableSlot( CMPXMedia* aVideo ) = 0;
+
+ /**
+ * Signaled when received an avent about externally removed video.
+ *
+ * @param videoId video id
+ */
+ virtual void videoDeletedSlot( TMPXItemId videoId ) = 0;
+
+ /**
+ * Signaled when multiple video deletion command is completed.
+ *
+ * @param overallCount count of ALL videos in this delete procedure
+ * @param failedMediaIds media-array containing possible failed medias
+ */
+ virtual void videoDeleteCompletedSlot( int overallCount, 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;
+};
+
+#endif // __VIDEOMODELOBSERVER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/inc/videolistdatamodel_p.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,358 @@
+/*
+* 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: VideoListDataModelPrivate class definition*
+*/
+
+#ifndef __VIDEOLISTDATAMODEL_P_H__
+#define __VIDEOLISTDATAMODEL_P_H__
+
+
+// INCLUDES
+#include <QObject>
+#include <qicon.h>
+#include <qdatetime.h>
+#include <qset.h>
+#include <qabstractitemmodel.h>
+#include <e32const.h>
+#include <mpxitemid.h>
+#include "videodatasignalreceiver.h"
+#include "videodatacontainer.h"
+
+// FORWARD DECLARATIONS
+class VideoListDataModel;
+class CMPXMediaArray;
+class VideoThumbnailData;
+
+class VideoListDataModelPrivate : public VideoDataSignalReceiver
+{
+ /**
+ * define to be able to use signals and slots
+ */
+ Q_OBJECT
+
+ /**
+ * disable copy-constructor and assignment operator
+ */
+ Q_DISABLE_COPY(VideoListDataModelPrivate)
+
+public: // Constructor
+
+ /**
+ * Default constructor
+ */
+ VideoListDataModelPrivate(VideoListDataModel *model);
+
+ /**
+ * Destructor
+ */
+ ~VideoListDataModelPrivate();
+
+ /**
+ * Method initializes class members:
+ * Creates thumbnail data -object and connect it's signals.
+ *
+ * - VideoThumbnailData: thumbnailsFetched
+ * ---> VideoListData: thumbnailsFetchedSlot
+ *
+ * @return int, 0 if ok.
+ */
+ int initialize();
+
+signals:
+
+ /**
+ * This signal is emitted, when data to some video item changes.
+ * Like for example new thumbnail is fetched.
+ *
+ * @param startIndex
+ * @param endIndex
+ *
+ */
+ void dataChanged(const QModelIndex &startIndex, const QModelIndex &endIndex);
+
+ /**
+ * This signal is emitted, collection notifies details for item has been
+ * fetched
+ *
+ * @param rowindex
+ *
+ */
+ void videoDetailsReady(int rowIndex);
+
+private slots:
+
+ /**
+ * This slot is connected to VideoThumbnailData::thumbnailsFetched -signal
+ * to get notified when thumbnail(s) for some particular item(s) is ready.
+ *
+ * The indexes of the items are checked and videoDataChanged signal is emitted.
+ *
+ * @param mediaIds: media ids of the items
+ *
+ */
+ void thumbnailsFetchedSlot(QList<TMPXItemId> mediaIds);
+
+private slots: //slots from VideoDataSignalReceiver
+
+ /**
+ * Signaled by the collection client when there is new video list available.
+ * Method emits videosInserted -signal.
+ *
+ * @param newVideoList: new list of videos
+ *
+ */
+ void newVideoListSlot(CMPXMediaArray *newVideoList);
+
+ /**
+ * Signaled by the collection client when there are new videos appended
+ * into the existing videolist.
+ * Checks if medias at provided array does not exist at the existing
+ * array and appends them if they do not.
+ *
+ * @param videoList: list of videos provided for appending
+ */
+ void appendVideoListSlot(CMPXMediaArray* videoList);
+
+ /**
+ * Signaled by the collection client when new videodata is fetched.
+ * Given object is inserted into correct position in the
+ * media array and videosInserted -signal is emitted
+ *
+ * @param aVideo data of the new video.
+ */
+ void newVideoAvailableSlot(CMPXMedia *newVideo);
+
+ /**
+ * Signaled by the collection client when
+ * video removal has detected.
+ *
+ * @param videoId id of the removed video
+ */
+ void videoDeletedSlot(TMPXItemId videoId);
+
+ /**
+ * Signaled by the collection client video deletion request
+ * has completed
+ *
+ * @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);
+
+ /**
+ * Signaled by the collection client when video details fetching
+ * has completed.
+ *
+ */
+ void videoDetailsCompletedSlot(TMPXItemId videoId);
+
+public: // services
+
+ /**
+ * Returns video count
+ *
+ * @return int count of videos
+ */
+ int getVideoCount();
+
+ /**
+ * Returns the MPX media item id (TMPXItemId.id1)
+ * from the given index.
+ *
+ * @param index: item position where client wants the id from
+ *
+ * @return TMPXItemId item id or invalid TMPXItemId if id not found at that index
+ */
+ TMPXItemId getMediaIdFromIndex(int index) const;
+
+ /**
+ * Returns name of the video from the given index.
+ * If there is no item at that index, empty string is returned.
+ *
+ * @param index: item position where client wants the name from
+ *
+ * @return QString name of the item
+ */
+ const QString getVideoNameFromIndex(int index) const;
+
+ /**
+ * Returns the thumbnail of the item from given index.
+ * If there is no item at that index or thumbnail is not yet fetched,
+ * default thumbnail is returned.
+ *
+ * @param index: item position where client wants the tn from
+ *
+ * @return QIcon thumbnail of the item
+ */
+ const QIcon* getVideoThumbnailFromIndex(int index) const;
+
+ /**
+ * Returns the size of the video from given index.
+ * If there is no item at that index, 0 is returned
+ *
+ * @param index: item position where client wants the size from
+ *
+ * @return guint32 size in bytes
+ */
+ quint32 getVideoSizeFromIndex(int index) const;
+
+ /**
+ * Returns the age profile of the video from given index
+ * If there is no item at that index, 0 is returned
+ *
+ * @param index: item position where client wants the size from
+ *
+ * @return quint32 age profile in bytes
+ */
+ quint32 getVideoAgeProfileFromIndex(int index) const;
+
+ /**
+ * Returns the duration of the video from given index.
+ * If there is no item at that index, 0 is returned
+ *
+ * @param index: item position where client wants the duration from
+ *
+ * @return guint32 duration
+ */
+ quint32 getVideodurationFromIndex(int index) const;
+
+ /**
+ * Returns the creation/download date of the video.
+ *
+ * @param index: item position where client wants the date from.
+ *
+ * @return QDate date
+ */
+ QDateTime getVideoDateFromIndex(int index) const;
+
+ /**
+ * Returns the metadata for the video.
+ *
+ * @param index: item position where client wants the data from.
+ *
+ * @return QMap map of the QVariants that hold the data. Keys defined
+ * in VideoCollectionCommon
+ */
+ QMap<QString, QVariant> getMetaDataFromIndex(int index) const;
+
+ /**
+ * Returns video status
+ *
+ * @param index: item position where client wants the status from.
+ *
+ * @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
+ *
+ */
+ QList<TMPXItemId> markVideosRemoved(const QModelIndexList &itemIndexes);
+
+ /**
+ * Removes provided ids from the remove -list
+ *
+ * @param itemIds ids of the items to be removed
+ */
+ void unMarkVideosRemoved(QList<TMPXItemId> &itemIds);
+
+ /**
+ * Returns the file path of the video.
+ *
+ * @param index: item position where client wants the file path from.
+ */
+ const QString getFilePathFromIndex(int index) const;
+
+ /**
+ * Returns the file path of the video.
+ *
+ * @param mediaId: id for the item
+ */
+ const QString getFilePathForId(TMPXItemId mediaId) const;
+
+private: // private methods
+
+ /**
+ * private default constructor definition
+ */
+ VideoListDataModelPrivate();
+
+ /**
+ * Method clears map containing media objects
+ */
+ void clearVideoData();
+
+ /**
+ * Method used to parse media id from given object.
+ * Id id data is not available or given object is null.
+ * method returns -1.
+ * The id is CMPXMedia's TMPXItemId.iId1
+ *
+ * @param media: where to get id from
+ *
+ * @return TMPXItemId: id of the item
+ */
+ TMPXItemId getMediaId(const CMPXMedia *media ) const;
+
+ /**
+ * Leaving helper method for appending data from media array into
+ * data container for reducing amount of TRAPs.
+ *
+ * Leaves if CMPXMedia object creation fails.
+ *
+ * @param videoArray array from where to take data
+ * @param startIndex startindex from where start appending.
+ *
+ */
+ void appendDataToContainerL(CMPXMediaArray *videoArray, unsigned int startIndex = 0);
+
+private:
+
+ /**
+ * Pointer to the public class
+ * Not own.
+ */
+ VideoListDataModel *q_ptr;
+
+ /**
+ * media object container
+ */
+ VideoDataContainer mMediaData;
+
+ /**
+ * set containing item(s)' ids whose, removal
+ * is underway.
+ */
+ QSet<TMPXItemId> mItemsUnderDeletion;
+
+ /**
+ * Thumbnail handler object.
+ */
+ VideoThumbnailData &mVideoThumbnailData;
+
+ /**
+ * Object is initialized.
+ */
+ bool mInitialized;
+
+};
+
+#endif // __VIDEOLISTDATAMODEL_P_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/inc/videosortfilterproxymodel.h Thu Apr 01 22:38:49 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: Videolist sort filter proxy implementation
+*
+*/
+
+#ifndef VIDEOSORTFILTERPROXYMODEL_H
+#define VIDEOSORTFILTERPROXYMODEL_H
+
+#include <qsortfilterproxymodel.h>
+#include <e32const.h>
+#include <mpxitemid.h>
+#include "videocollectionexport.h"
+
+class QTimer;
+class VideoListDataModel;
+class VideoCollectionClient;
+
+class VIDEOCOLLECTION_DLL_EXPORT VideoSortFilterProxyModel : public QSortFilterProxyModel
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * Contructor.
+ *
+ * @param parent parent of this widget
+ * @param client Collection client pointer to use.
+ */
+ VideoSortFilterProxyModel(QObject *parent=0);
+
+ /**
+ * Destructor.
+ *
+ */
+ virtual ~VideoSortFilterProxyModel();
+
+ /**
+ * Initializes model, calls initialize to source model, and sets
+ * the given sourceModel as source model for this proxy model.
+ *
+ * @param collection mpx video collectionobject
+ * @param sourceModel the source model
+ *
+ * @return int: 0 if everything ok
+ */
+ int initialize(VideoListDataModel *sourceModel);
+
+public:
+
+ /**
+ * First call opens the collection at the defined level. Subsequent calls only change the level.
+ * This starts populating the model data from the MyVideos collection plugin.
+ *
+ * @param level The level where the collection is opened.
+ * @return 0 if opening was successful, negative if not.
+ */
+ int open(int level);
+
+ /**
+ * Starts sorting. If async parameter is defined as true uses idle timer:
+ * starts timer with zero interval. When system has time to run timer sort()
+ * -method is called. If async is false, then the sort() -method is called
+ * immediatelly.
+ *
+ * @param sortingRole The role that sorting is done by.
+ * @param sortingOrder The sorting order, e.g. ascending or descending.
+ * @param async Defines if the sorting is done asyncronously or not. Default
+ * is true.
+ */
+ void doSorting(int sortingRole, Qt::SortOrder order, bool async = true);
+
+ /**
+ * 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);
+
+ /**
+ * Return to collection level
+ *
+ */
+ int back();
+
+ /**
+ * Starts fetching full details for the defined item.
+ *
+ * @param index index of the item from where to get details from
+ * @return int 0 succeeds, < 0 if detail fetching startup does not succeed.
+ */
+ int fetchItemDetails(const QModelIndex &index);
+
+ /**
+ * Method checks that model exists and asks for mpx id from
+ * given object.
+ *
+ * @param index index of the item in UI.
+ * @return TMPXItemId mpx id if succeeds TMPXItemId::InvalidId() in case of error
+ *
+ */
+ TMPXItemId getMediaIdAtIndex(const QModelIndex &index);
+
+ /**
+ * Method checks that model exists and asks for file path from
+ * given object.
+ *
+ * @param mediaId id of the item.
+ * @return QString file path if succeeds, empty string in case of error.
+ *
+ */
+ QString getMediaFilePathForId(TMPXItemId mediaId);
+
+ /**
+ * Adds a collection (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.
+ */
+ int addNewCollection(QString name, QString thumbnail, QList<TMPXItemId> mediaIds);
+
+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);
+
+ /**
+ * Signal to be emitted after all details are being fetched.
+ *
+ * @param index, index of the item
+ */
+ void fullDetailsReady(int index);
+
+ /**
+ * Signals that the model is ready, ie. that all data has been
+ * loaded from myvideoscollection.
+ */
+ void modelReady();
+
+protected: // from QSortFilterProxyModel
+
+ /**
+ * Compares items based in the role setted before sorting.
+ *
+ */
+ bool lessThan ( const QModelIndex & left, const QModelIndex & right ) const;
+
+ /**
+ * Filtering functionality. Called by the fw.
+ *
+ * @param source_row row to chexk
+ * @param source_parent row's parent
+ *
+ * @return bool row accepted(true) or not accepted(false)
+ */
+ bool filterAcceptsRow ( int source_row, const QModelIndex & source_parent ) const;
+
+private slots:
+
+ /**
+ * Timeout slot for zero timer. Stops timer and calls sort().
+ * After call is finished, emits sortingReady.
+ *
+ */
+ void processSorting();
+
+private:
+
+ /**
+ * Pointer to the actual model.
+ * Not owned.
+ */
+ VideoListDataModel *mModel;
+
+ /**
+ * Collection client.
+ * Not owned.
+ */
+ VideoCollectionClient *mCollectionClient;
+
+ /**
+ * Currently open level.
+ */
+ int mLevel;
+
+ /**
+ * Timer object. Owned.
+ */
+ QTimer *mIdleSortTimer;
+
+ /**
+ * sort role to be setted after idle timer time outs for sorting to be able to be executed
+ */
+ int mWantedSortRole;
+
+ /**
+ * sort order (ascending or descending).
+ */
+ Qt::SortOrder mWantedSortOrder;
+
+};
+
+#endif //VIDEOSORTFILTERPROXYMODEL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/inc/videothumbnaildata.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,161 @@
+/*
+* 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 singleton class definition
+*/
+
+#ifndef __VIDEOTHUMBNAILDATA_H__
+#define __VIDEOTHUMBNAILDATA_H__
+
+// INCLUDES
+#include <QObject>
+#include <QHash>
+#include <QPair>
+#include <QIcon>
+#include <QSet>
+#include <QPointer>
+#include <mpxitemid.h>
+
+#include "videocollectionexport.h"
+
+// FORWARD DECLARATIONS
+class VideoThumbnailDataPrivate;
+
+// CLASS DECLARATIONS
+
+class VIDEOCOLLECTION_DLL_EXPORT VideoThumbnailData : public QObject
+{
+ /**
+ * Defined to be able to use signals and slots.
+ */
+ Q_OBJECT
+
+ /**
+ * disable copy-constructor and assignment operator
+ */
+ Q_DISABLE_COPY(VideoThumbnailData)
+
+public:
+
+ /*
+ * Thumbnail fetch priorities.
+ */
+ enum VideoThumbnailPriority
+ {
+ VideoThumbnailPriorityLow = 2000,
+ VideoThumbnailPriorityMedium = 3000,
+ VideoThumbnailPriorityHigh = 5000
+ };
+
+ /**
+ * Returns singleton instance for this class.
+ *
+ * @return The singleton instance.
+ *
+ */
+ 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.
+ *
+ * @param mediaId id for media whose thumbnail is to be removed
+ *
+ * @return bool: true if item removed correctly, false if not.
+ *
+ */
+ bool removeThumbnail(TMPXItemId mediaId);
+
+ /**
+ * Method returns a pointer to video's thumbnail.
+ *
+ * If thumbnail fetching is ongoing or not yet started, pointer to default
+ * thumbnail is returned.
+ *
+ * @param mediaId media id for which to get thumbnail
+ * @param tnData reference to thumbnail data where data is occupied
+ *
+ * @return QIcon* thumbnail pointer
+ *
+ */
+ const QIcon* getThumbnail(TMPXItemId mediaId);
+
+ /**
+ * Starts background thumbnail fetching.
+ *
+ * @param fetchIndex index where to start the background thumbnail fetching.
+ *
+ */
+ void startBackgroundFetching(int fetchIndex);
+
+ /**
+ * Enables or disables thumbnail background fetching. Default is enabled.
+ *
+ * @param enable true enables and false disables thumbnail background fetching.
+ */
+ void enableBackgroundFetching(bool enable);
+
+ /**
+ * Frees allocated data for thumbnails and cancels ongoing fetches.
+ *
+ */
+ void freeThumbnailData();
+
+signals:
+
+ /**
+ * This signal is emitted from thumbnailReadySlot, when
+ *
+ * @param mediaIds: media ids of the videos whose thumbnail is ready.
+ *
+ */
+ void thumbnailsFetched(QList<TMPXItemId> mediaIds);
+
+private:
+
+ /**
+ * Default constructor
+ */
+ VideoThumbnailData();
+
+ /**
+ * Destructor
+ */
+ ~VideoThumbnailData();
+
+ /**
+ * Private implementation.
+ */
+ QPointer<VideoThumbnailDataPrivate> const d_ptr;
+};
+
+#endif // __VIDEOTHUMBNAILDATA_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/inc/videothumbnaildata_p.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,336 @@
+/*
+* 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: VideoThumbnailDataPrivate class definition
+*
+*/
+
+#ifndef __VIDEOTHUMBNAILDATAPRIVATE_H__
+#define __VIDEOTHUMBNAILDATAPRIVATE_H__
+
+// INCLUDES
+#include <QObject>
+#include <QPointer>
+#include <QCache>
+#include <QIcon>
+#include <QSet>
+#include <QList>
+#include <e32const.h>
+#include <mpxitemid.h>
+
+// FORWARD DECLARATIONS
+class ThumbnailManager;
+class VideoCollectionWrapper;
+class VideoSortFilterProxyModel;
+class QModelIndex;
+class QTimer;
+
+class VideoThumbnailDataPrivate : public QObject
+{
+ /**
+ * defined to be able to use signals and slots
+ */
+ Q_OBJECT
+
+public:
+
+
+ /**
+ * Default constructor
+ */
+ VideoThumbnailDataPrivate();
+
+ /**
+ * Destructor
+ */
+ 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
+ * is returned.
+ *
+ * @param mediaId media id for which to get thumbnail
+ * @param tnData reference to thumbnail data where data is ocpied
+ *
+ * @return QIcon* thumbnail pointer
+ *
+ */
+ const QIcon* getThumbnail(TMPXItemId mediaId);
+
+ /**
+ * Method removes thumbnail data from the local repository.
+ *
+ * @param mediaId id for media whose thumbnail is to be removed
+ *
+ * @return bool: true if item removed correctly, false if not.
+ *
+ */
+ bool removeThumbnail(TMPXItemId mediaId);
+
+ /**
+ * Starts background thumbnail fetching from the given fetch index.
+ *
+ * @param fetchIndex index where to start the background thumbnail fetching.
+ */
+ void startBackgroundFetching(int fetchIndex);
+
+ /**
+ * Enables or disables thumbnail background fetching.
+ *
+ * @param enable true enables and false disables thumbnail background fetching.
+ */
+ void enableBackgroundFetching(bool enable);
+
+ /**
+ * Frees allocated data for thumbnails and cancels ongoing fetches.
+ */
+ void freeThumbnailData();
+
+protected:
+
+ /**
+ * Method creates member objects and connects signals.
+ *
+ * @return int 0 initialization ok, -1 initialization failed
+ *
+ */
+ int initialize();
+
+ /**
+ * Cleanup internal data. This must be called before UI environment is destroyed.
+ */
+ void cleanup();
+
+ /**
+ * Connects the signals.
+ *
+ * @return int 0 connecting ok, -1 connecting failed.
+ */
+ int connectSignals();
+
+ /**
+ * Disconnects the signals.
+ *
+ */
+ void disconnectSignals();
+
+ /**
+ * Appends indexes in the source model to the list between start and end.
+ *
+ * @param indexes list of indexes
+ * @param startIndex start index
+ * @param endIndex end index
+ */
+ void getModelIndexes(QList<QModelIndex> &indexes, int startIndex, int endIndex);
+
+ /**
+ * Method returns default thumbnail data.
+ *
+ * @param mediaId media id for which to get thumbnail
+ *
+ * @return QIcon: reference to default thumbnail data
+ *
+ */
+ 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();
+
+signals:
+
+ /**
+ * This signal is emitted from thumbnailReadySlot, when
+ *
+ * @param mediaIds: media ids of the videos whose thumbnail is ready.
+ *
+ */
+ void thumbnailsFetched(QList<TMPXItemId> mediaIds);
+
+private slots:
+
+ /**
+ * Thumbnail manager signals this slot when thumbnail is ready
+ * for some item.
+ *
+ * @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);
+
+ /**
+ * VideoSortFilterProxyModel signals this slot when the layout of items in the model have
+ * 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);
+
+ /**
+ * Fetches thumbnails around of mCurrentFetchIndex in batches of THUMBNAIL_BACKGROUND_FETCH_AMOUNT.
+ * The fetch index is set by startFetchingThumbnails which also resets
+ * mCurrentBackgroundFetchCount. Maximum of THUMBNAIL_MAX_BACKGROUND_FETCH thumbnails are
+ * fetched between the count resets.
+ *
+ */
+ void doBackgroundFetching();
+
+ /**
+ * Signaled when UI environment is about to be destroyed. Thumbnails must be cleaned before that.
+ *
+ */
+ void aboutToQuitSlot();
+
+ /**
+ * Emits thumbnailReady signals for list of thumbnails.
+ *
+ */
+ void reportThumbnailsReadySlot();
+
+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;
+
+ /**
+ * 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;
+
+ /**
+ * Default thumbnail for a video.
+ */
+ QIcon *mDefaultTnVideo;
+
+ /**
+ * Default thumbnail for a category.
+ */
+ QIcon *mDefaultTnCategory;
+
+ /**
+ * Wrapper to collection.
+ */
+ VideoCollectionWrapper *mCollectionWrapper;
+
+ /**
+ * Model containing the media, not owned.
+ */
+ QPointer<VideoSortFilterProxyModel> mModel;
+
+ /**
+ * Current index for background thumbnail fetching.
+ */
+ int mCurrentFetchIndex;
+
+ /**
+ * Current count of background thumbnails fetched around the fetch index.
+ */
+ int mCurrentBackgroundFetchCount;
+
+ /**
+ * Timer for background fetching.
+ */
+ QTimer *mBgFetchTimer;
+
+ /**
+ * Timer for thumbnail ready signaling.
+ */
+ QTimer *mTbnReportTimer;
+
+ /**
+ * List of media ids for thumbnails that are ready.
+ */
+ QList<TMPXItemId> mReadyThumbnailMediaIds;
+
+ /**
+ * Flag for signal connections.
+ */
+ bool mSignalsConnected;
+
+ /**
+ * Indicates if background thumbnail fetching is enabled.
+ */
+ bool mBackgroundFetchingEnabled;
+};
+
+#endif // __VIDEOTHUMBNAILDATAPRIVATE_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/src/videocollectionclient.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,591 @@
+/*
+* 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: VideoCollectionClient class implementation
+*
+*/
+
+// INCLUDE FILES
+#include <QObject>
+#include <centralrepository.h>
+#include <mpxcollectionutility.h>
+#include <mpxcollectionpath.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxmessage2.h>
+#include <mpxcollectionmessagedefs.h>
+#include <mpxcollectionmessage.h>
+#include <mpxmessagecontainerdefs.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxcommandgeneraldefs.h>
+#include <mpxcollectioncommanddefs.h>
+#include <vcxmyvideosuids.h>
+
+#include "videodatasignalreceiver.h"
+#include "videocollectionclient.h"
+#include "videocollectionlistener.h"
+
+// -----------------------------------------------------------------------------
+// VideoCollectionClient()
+// -----------------------------------------------------------------------------
+//
+VideoCollectionClient::VideoCollectionClient() :
+mCollectionUtility(0),
+mCollectionOpenStatus(ECollectionNotOpen),
+mCollectionListener(0),
+mOpenCategoryAlbum(0,9),
+mCollectionPathLevel(VideoCollectionClient::ELevelInvalid)
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// initialize()
+// -----------------------------------------------------------------------------
+//
+int VideoCollectionClient::initialize()
+{
+ if(mCollectionUtility && mCollectionListener)
+ {
+ // already initialized
+ return 0;
+ }
+ if(!mCollectionListener)
+ {
+ mCollectionListener = new VideoCollectionListener(*this);
+ if(!mCollectionListener)
+ {
+ return -1;
+ }
+ }
+ if(!mCollectionUtility)
+ {
+ TRAPD( error, mCollectionUtility = MMPXCollectionUtility::NewL( mCollectionListener, KMcModeDefault ) );
+ if(error)
+ {
+ delete mCollectionListener;
+ mCollectionListener = 0;
+ return error;
+ }
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// ~VideoCollectionClient()
+// -----------------------------------------------------------------------------
+//
+VideoCollectionClient::~VideoCollectionClient()
+{
+ if (mCollectionUtility)
+ {
+ // closing deallocates collection utility pointer
+ mCollectionUtility->Close();
+ }
+ 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)
+{
+ id = mOpenCategoryAlbum.iId1; //unique id
+ type = mOpenCategoryAlbum.iId2; //category or album
+}
+
+// ---------------------------------------------------------------------------
+// getCollectionLevel
+// ---------------------------------------------------------------------------
+//
+int VideoCollectionClient::getCollectionLevel()
+{
+ return mCollectionPathLevel;
+}
+
+// ---------------------------------------------------------------------------
+// getOpenStatus
+// ---------------------------------------------------------------------------
+//
+int VideoCollectionClient::getOpenStatus()
+{
+ return mCollectionOpenStatus;
+}
+
+// ---------------------------------------------------------------------------
+// setOpenStatus
+// ---------------------------------------------------------------------------
+//
+void VideoCollectionClient::setOpenStatus(int status)
+{
+ mCollectionOpenStatus = status;
+ if(mCollectionOpenStatus == ECollectionOpened)
+ {
+ startOpenCurrentState();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// startOpenCollection
+// -----------------------------------------------------------------------------
+//
+int VideoCollectionClient::startOpenCollection(int level)
+{
+ if(!mCollectionUtility)
+ {
+ return -1;
+ }
+
+ if((mCollectionOpenStatus == ECollectionOpening) && (getCollectionLevel() == level))
+ {
+ // allready opening/opened
+ return 0;
+ }
+ mCollectionOpenStatus = ECollectionNotOpen;
+ TRAPD(error, startOpenCollectionL(level));
+ return error;
+}
+
+// -----------------------------------------------------------------------------
+// startOpenCurrentState
+// -----------------------------------------------------------------------------
+//
+int VideoCollectionClient::startOpenCurrentState()
+{
+ int error = -1;
+ if(mCollectionUtility && mCollectionOpenStatus == ECollectionOpened)
+ {
+ TRAP(error, mCollectionUtility->Collection().OpenL());
+ }
+ return error;
+}
+
+// -----------------------------------------------------------------------------
+// deleteFile
+// -----------------------------------------------------------------------------
+int VideoCollectionClient::deleteVideos(QList<TMPXItemId> *mediaIds)
+{
+ if(!mCollectionUtility || !mediaIds)
+ {
+ return -1;
+ }
+ TRAPD(error, deleteVideosL(*mediaIds));
+ return error;
+}
+
+// -----------------------------------------------------------------------------
+// openMedia
+// -----------------------------------------------------------------------------
+//
+int VideoCollectionClient::openVideo(TMPXItemId &mediaId)
+{
+ if(!mCollectionUtility)
+ {
+ return -1;
+ }
+
+ TInt error;
+ if (getCollectionLevel() == VideoCollectionClient::ELevelVideos)
+ {
+ TRAP(error, openVideoL(mediaId));
+ }
+ else
+ {
+ TRAP(error, openCategoryL(mediaId));
+ }
+ return error;
+}
+
+// -----------------------------------------------------------------------------
+// back
+// -----------------------------------------------------------------------------
+//
+int VideoCollectionClient::back()
+{
+ if(!mCollectionUtility)
+ {
+ return -1;
+ }
+ TRAPD(error, backL());
+ return error;
+}
+
+// -----------------------------------------------------------------------------
+// fetchMpxMediaByMpxId
+// -----------------------------------------------------------------------------
+//
+int VideoCollectionClient::fetchMpxMediaByMpxId(TMPXItemId &mpxId)
+{
+ if(!mCollectionUtility)
+ {
+ return -1;
+ }
+
+ TRAPD(error, fetchMpxMediaByMpxIdL(mpxId));
+ return error;
+}
+
+// -----------------------------------------------------------------------------
+// getVideoDetails
+// -----------------------------------------------------------------------------
+//
+int VideoCollectionClient::getVideoDetails(TMPXItemId &mediaId)
+{
+ if(!mCollectionUtility)
+ {
+ return -1;
+ }
+
+ TRAPD(error, getVideoDetailsL(mediaId));
+
+ return error;
+}
+
+// -----------------------------------------------------------------------------
+// addNewCollection
+// -----------------------------------------------------------------------------
+//
+int VideoCollectionClient::addNewCollection(QString name, QString thumbnail, QList<TMPXItemId> mediaIds)
+{
+ if(!mCollectionUtility)
+ {
+ return -1;
+ }
+
+ TRAPD(error, addNewCollectionL(name, thumbnail, mediaIds));
+
+ return error;
+}
+
+// -----------------------------------------------------------------------------
+// startOpenCollectionL
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionClient::startOpenCollectionL(int level)
+{
+ if(!mCollectionUtility)
+ {
+ User::Leave(KErrGeneral);
+ }
+ CMPXCollectionPath* collectionPath = CMPXCollectionPath::NewL();
+ CleanupStack::PushL( collectionPath );
+
+ collectionPath->AppendL( KVcxUidMyVideosMpxCollection );
+ if (level == VideoCollectionClient::ELevelVideos)
+ {
+ collectionPath->AppendL( KVcxMvcCategoryIdAll );
+
+ mOpenCategoryAlbum.iId1 = KVcxMvcCategoryIdAll;
+ mOpenCategoryAlbum.iId2 = 1;
+
+ mCollectionPathLevel = VideoCollectionClient::ELevelVideos;
+ }
+ else
+ {
+ mOpenCategoryAlbum.iId1 = 0;
+ mOpenCategoryAlbum.iId2 = 9;
+
+ mCollectionPathLevel = VideoCollectionClient::ELevelCategory;
+ }
+ mCollectionUtility->Collection().OpenL( *collectionPath );
+ CleanupStack::PopAndDestroy( collectionPath );
+ mCollectionListener->setRequestNewMediaArray(true);
+ mCollectionOpenStatus = ECollectionOpening;
+}
+
+
+// -----------------------------------------------------------------------------
+// deleteVideosL
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionClient::deleteVideosL(QList<TMPXItemId> &mediaIds)
+{
+ if(!mCollectionUtility || mediaIds.count() == 0)
+ {
+ User::Leave(KErrGeneral);
+ }
+ CMPXMediaArray* mediasToDelete = CMPXMediaArray::NewL();
+ CleanupStack::PushL( mediasToDelete );
+
+ CMPXMedia* media = NULL;
+
+ TMPXItemId currentId;
+ foreach(currentId, mediaIds)
+ {
+ media = CMPXMedia::NewL();
+ CleanupStack::PushL( media );
+ media->SetTObjectValueL( KMPXMediaGeneralId, currentId );
+ mediasToDelete->AppendL( *media );
+ CleanupStack::PopAndDestroy( media );
+ }
+
+ CMPXCommand* cmd = CMPXMedia::NewL();
+ CleanupStack::PushL( cmd );
+
+ cmd->SetTObjectValueL( KMPXCommandGeneralId, KVcxCommandIdMyVideos );
+ cmd->SetTObjectValueL( KVcxMediaMyVideosCommandId, KVcxCommandMyVideosDelete );
+ cmd->SetTObjectValueL( KMPXCommandGeneralDoSync, EFalse );
+ cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId,
+ TUid::Uid( KVcxUidMyVideosMpxCollection ) );
+ cmd->SetCObjectValueL( KMPXMediaArrayContents, mediasToDelete );
+
+ mCollectionUtility->Collection().CommandL( *cmd );
+
+ CleanupStack::PopAndDestroy( cmd );
+ CleanupStack::PopAndDestroy( mediasToDelete );
+}
+
+// -----------------------------------------------------------------------------
+// openVideoL
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionClient::openVideoL(TMPXItemId &videoId)
+{
+ if(!mCollectionUtility)
+ {
+ User::Leave(KErrGeneral);
+ }
+ CMPXCollectionPath* path = CMPXCollectionPath::NewL();
+ CleanupStack::PushL( path );
+ path->AppendL( KVcxUidMyVideosMpxCollection );
+ path->AppendL( KVcxMvcCategoryIdAll );
+ path->AppendL( TMPXItemId( videoId, 0 ) );
+ path->SelectL( TMPXItemId( videoId, 0 ) );
+
+ mCollectionUtility->Collection().OpenL( *path );
+ CleanupStack::PopAndDestroy( path );
+}
+
+// -----------------------------------------------------------------------------
+// openCategoryL
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionClient::openCategoryL(TMPXItemId &id)
+{
+ if(!mCollectionUtility)
+ {
+ User::Leave(KErrGeneral);
+ }
+ CMPXCollectionPath* collectionPath = CMPXCollectionPath::NewL();
+ CleanupStack::PushL( collectionPath );
+
+ collectionPath->AppendL( KVcxUidMyVideosMpxCollection );
+ collectionPath->AppendL( id );
+ mCollectionUtility->Collection().OpenL( *collectionPath );
+ CleanupStack::PopAndDestroy( collectionPath );
+ mCollectionListener->setRequestNewMediaArray(true);
+
+ mOpenCategoryAlbum.iId1 = id;
+ mOpenCategoryAlbum.iId2 = 1;
+
+ mCollectionPathLevel = VideoCollectionClient::ELevelVideos;
+
+ mCollectionOpenStatus = ECollectionOpening;
+}
+
+// -----------------------------------------------------------------------------
+// backL
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionClient::backL()
+{
+ if(!mCollectionUtility)
+ {
+ User::Leave(KErrGeneral);
+ }
+
+ if (getCollectionLevel() > 2 )
+ {
+ mCollectionUtility->Collection().BackL();
+ mCollectionOpenStatus = ECollectionOpening;
+ mCollectionListener->setRequestNewMediaArray(true);
+ mOpenCategoryAlbum.iId1 = 0;
+ mOpenCategoryAlbum.iId2 = 9;
+
+ mCollectionPathLevel = VideoCollectionClient::ELevelCategory;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// getVideoDetailsL
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionClient::getVideoDetailsL(TMPXItemId &videoId)
+{
+ if(!mCollectionUtility)
+ {
+ User::Leave(KErrGeneral);
+ }
+ CMPXCommand* cmd = CMPXCommand::NewL();
+ CleanupStack::PushL( cmd );
+
+ cmd->SetTObjectValueL( KMPXCommandGeneralId, KVcxCommandIdMyVideos );
+ cmd->SetTObjectValueL( KVcxMediaMyVideosCommandId, KVcxCommandMyVideosGetMediaFullDetailsByMpxId );
+ cmd->SetTObjectValueL( KMPXMediaGeneralId, videoId );
+ mCollectionUtility->Collection().CommandL( *cmd );
+
+ CleanupStack::PopAndDestroy( cmd );
+}
+
+// -----------------------------------------------------------------------------
+// addNewCollectionL
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionClient::addNewCollectionL(QString name, QString thumbnail, QList<TMPXItemId> mediaIds)
+{
+ if(!mCollectionUtility)
+ {
+ User::Leave(KErrGeneral);
+ }
+
+ CMPXCommand* cmd = CMPXCommand::NewL();
+ CleanupStack::PushL( cmd );
+
+ 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 );
+
+ 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 );
+ }
+}
+
+// -----------------------------------------------------------------------------
+// fetchMpxMediaByMpxIdL
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionClient::fetchMpxMediaByMpxIdL(TMPXItemId &aMpxId)
+{
+ if(!mCollectionUtility)
+ {
+ User::Leave(KErrGeneral);
+ }
+
+ CMPXCommand* cmd = CMPXCommand::NewL();
+ CleanupStack::PushL( cmd );
+ cmd->SetTObjectValueL( KMPXCommandGeneralId, KVcxCommandIdMyVideos );
+ cmd->SetTObjectValueL( KVcxMediaMyVideosCommandId, KVcxCommandMyVideosGetMediasByMpxId );
+ cmd->SetTObjectValueL( KMPXCommandGeneralCollectionId,
+ TUid::Uid( KVcxUidMyVideosMpxCollection ) );
+
+ CMPXMediaArray* idMediaArray = CMPXMediaArray::NewL();
+ CleanupStack::PushL( idMediaArray );
+ CMPXMedia* media = CMPXMedia::NewL();
+ CleanupStack::PushL( media );
+ media->SetTObjectValueL( KMPXMessageMediaGeneralId, aMpxId );
+ idMediaArray->AppendL( *media );
+ cmd->SetCObjectValueL<CMPXMediaArray>( KMPXMediaArrayContents, idMediaArray );
+ cmd->SetTObjectValueL( KMPXMediaArrayCount, idMediaArray->Count() );
+ mCollectionUtility->Collection().CommandL( *cmd );
+
+ CleanupStack::PopAndDestroy( media );
+ CleanupStack::PopAndDestroy( idMediaArray );
+ CleanupStack::PopAndDestroy( cmd );
+}
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/src/videocollectionlistener.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,499 @@
+/*
+* 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: VideoCollectionClient class implementation
+*
+*/
+
+// INCLUDE FILES
+
+#include <mpxmediageneraldefs.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxmessage2.h>
+#include <mpxcollectionmessagedefs.h>
+#include <mpxcollectionmessage.h>
+#include <mpxmessagecontainerdefs.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxcommandgeneraldefs.h>
+#include <mpxcollectioncommanddefs.h>
+#include <vcxmyvideosdefs.h>
+#include <vcxmyvideosuids.h>
+
+#include "videocollectionlistener.h"
+#include "videocollectionclient.h"
+#include "videocollectionutils.h"
+
+// -----------------------------------------------------------------------------
+// VideoCollectionListener
+// -----------------------------------------------------------------------------
+//
+VideoCollectionListener::VideoCollectionListener(VideoCollectionClient &collectionClient) :
+mCollectionClient(collectionClient),
+mVideoUtils(VideoCollectionUtils::instance()),
+mNewArrayRequest(true)
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// ~VideoCollectionListener
+// -----------------------------------------------------------------------------
+//
+VideoCollectionListener::~VideoCollectionListener()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// HandleCollectionMediaL
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionListener::HandleCollectionMediaL(
+ const CMPXMedia& /*aMedia*/,
+ TInt /*aError*/)
+{
+ // NOP
+}
+
+// -----------------------------------------------------------------------------
+// setRequestNewMediaArray
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionListener::setRequestNewMediaArray(bool request)
+{
+ mNewArrayRequest = request;
+}
+
+
+// -----------------------------------------------------------------------------
+// HandleOpenL
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionListener::HandleOpenL(
+ const CMPXMedia& aEntries,
+ TInt /*aIndex*/,
+ TBool /*aComplete*/,
+ TInt aError)
+{
+ if(aError != KErrNone)
+ {
+ return;
+ }
+
+ int level = mCollectionClient.getCollectionLevel();
+
+ if((level != VideoCollectionClient::ELevelVideos) &&
+ (level != VideoCollectionClient::ELevelCategory))
+ {
+ 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)
+ {
+ 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;
+ }
+ else
+ {
+ emit videoListAppended(array);
+ }
+ }
+
+// -----------------------------------------------------------------------------
+// HandleOpenL
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionListener::HandleOpenL(
+ const CMPXCollectionPlaylist& /*aPlaylist*/,
+ TInt /*aError*/)
+{
+ // NOP
+}
+
+// -----------------------------------------------------------------------------
+// HandleCommandComplete
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionListener::HandleCommandComplete(
+ CMPXCommand* aCommandResult,
+ TInt aError)
+{
+ if(aError != KErrNone || !aCommandResult)
+ {
+ return;
+ }
+ int commandId = -1;
+
+ if(mVideoUtils.mediaValue<int>(aCommandResult, KVcxMediaMyVideosCommandId, commandId))
+ {
+ if(commandId == KVcxCommandMyVideosGetMediaFullDetailsByMpxId)
+ {
+ handleGetVideoDetailsResp(aCommandResult);
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+// HandleCollectionMessage
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionListener::HandleCollectionMessage(
+ CMPXMessage* aMessage,
+ TInt aError )
+{
+ if(aError)
+ {
+ return;
+ }
+
+ TMPXMessageId mainMessageId;
+ if(!mVideoUtils.mediaValue<TMPXMessageId>(aMessage, KMPXMessageGeneralId, mainMessageId))
+ {
+ return;
+ }
+
+ if(mCollectionClient.getOpenStatus() == VideoCollectionClient::ECollectionOpened )
+ {
+ // after colletion has been opened we handle messages from our collection plugin only
+ TUid collectionUid;
+ bool status = mVideoUtils.mediaValue<TUid>(aMessage, KMPXMessageCollectionId, collectionUid);
+ if(!status || collectionUid.iUid != KVcxUidMyVideosMpxCollection)
+ {
+ return;
+ }
+ }
+ else
+ {
+ // before opening we're just excepting general messages
+ if(mainMessageId == KMPXMessageGeneral)
+ {
+ handleGeneralMPXMessage(aMessage);
+ }
+ return;
+ }
+
+ if( mainMessageId == KVcxCommandIdMyVideos)
+ {
+ int myVideosMainMsgId = -1;
+
+ if(!mVideoUtils.mediaValue<int>(aMessage, KVcxMediaMyVideosCommandId, myVideosMainMsgId ))
+ {
+ return;
+ }
+
+ if ( myVideosMainMsgId == KVcxMessageMyVideosMessageArray )
+ {
+ handleMyVideosMessageArray(aMessage);
+ }
+ else
+ {
+ handleMyVideosMPXMessage(myVideosMainMsgId, aMessage);
+ }
+ }
+ else
+ {
+ handleMPXMessage(mainMessageId, aMessage);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// handleMyVideosMessageArray
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionListener::handleMyVideosMessageArray(CMPXMessage *aMessage)
+{
+ CMPXMessageArray* messageArray = NULL;
+
+ messageArray = mVideoUtils.mediaValuePtr<CMPXMessageArray>(aMessage, KMPXMessageArrayContents);
+ if(!messageArray)
+ {
+ return;
+ }
+
+ int count = messageArray->Count();
+ int myVideosMsgId;
+ TMPXMessageId mpxMessageId;
+
+ CMPXMessage *singleMessage;
+ for ( int i = 0; i < count; ++i )
+ {
+ singleMessage = (*messageArray)[i];
+ if(mVideoUtils.mediaValue<int>(singleMessage, KVcxMediaMyVideosCommandId, myVideosMsgId))
+ {
+ handleMyVideosMPXMessage(myVideosMsgId, singleMessage);
+ }
+ else if(mVideoUtils.mediaValue<TMPXMessageId>(
+ singleMessage, KMPXMessageGeneralId, mpxMessageId))
+ {
+ handleMPXMessage(mpxMessageId, singleMessage);
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+// handleMyVideosMPXMessage
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionListener::handleMyVideosMPXMessage(int &myVideosMsgId, CMPXMessage *aMessage)
+{
+ switch (myVideosMsgId)
+ {
+ case KVcxMessageMyVideosGetMediasByMpxIdResp:
+ handleGetMediasByMpxIdResp(aMessage);
+ break;
+ case KVcxMessageMyVideosDeleteResp:
+ handleMyVideosDeleteMessage(aMessage);
+ break;
+ case KVcxMessageMyVideosDeleteStarted:
+ break;
+ case KVcxMessageMyVideosListComplete:
+ mCollectionClient.startOpenCurrentState();
+ break;
+ case KVcxMessageMyVideosItemsAppended:
+ mCollectionClient.startOpenCurrentState();
+ break;
+ case KVcxMessageMyVideosMoveOrCopyStarted:
+ break;
+ case KVcxMessageMyVideosMoveResp:
+ break;
+ case KVcxMessageMyVideosCopyResp:
+ break;
+ default:
+ break;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// handleCommonMPXMessage
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionListener::handleMPXMessage(TMPXMessageId &mpxMessageId, CMPXMessage *aMessage)
+{
+ switch(mpxMessageId)
+ {
+ case KMPXMessageGeneral:
+ handleGeneralMPXMessage(aMessage);
+ break;
+ case KMPXMessageIdItemChanged:
+ handleMyVideosItemsChanged(aMessage);
+ break;
+ default:
+ break;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// handleGeneralMPXMessage
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionListener::handleGeneralMPXMessage(CMPXMessage* aMessage)
+{
+ if(mCollectionClient.getOpenStatus() != VideoCollectionClient::ECollectionOpening)
+ {
+ return;
+ }
+ int event = 0;
+ if(!mVideoUtils.mediaValue<int>(aMessage, KMPXMessageGeneralEvent, event))
+ {
+ return;
+ }
+
+ int data = 0;
+ if(!mVideoUtils.mediaValue<int>(aMessage, KMPXMessageGeneralData, data))
+ {
+ return;
+ }
+
+ if( event == TMPXCollectionMessage::EPathChanged &&
+ data == EMcContainerOpened )
+ {
+ mCollectionClient.setOpenStatus(VideoCollectionClient::ECollectionOpened);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// handleMyVideosItemsChanged
+// -----------------------------------------------------------------------------
+//
+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))
+ {
+ return;
+ }
+ TMPXItemId eventData;
+ if(!mVideoUtils.mediaValue<TMPXItemId>(aMessage,KMPXMessageMediaGeneralId, eventData))
+ {
+ return;
+ }
+
+ switch(eventType)
+ {
+ case EMPXItemDeleted:
+ emit videoDeleted(eventData);
+ break;
+ case EMPXItemInserted:
+ if(eventData.iId2 < 2)
+ {
+ 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);
+ }
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// handleMyVideosDeleteMessage
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionListener::handleMyVideosDeleteMessage(CMPXMessage* aMessage)
+ {
+
+ CMPXMediaArray *messageArray =
+ mVideoUtils.mediaValuePtr<CMPXMediaArray>(aMessage, 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 videos 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 deletion was succefull
+ if(mVideoUtils.mediaValue<int>(item, KVcxMediaMyVideosInt32Value, failedFlag))
+ {
+ if (failedFlag)
+ {
+ failedIds.append(itemId);
+ }
+ failedFlag = 0;
+ }
+ }
+ emit videoDeleteCompleted(count, &failedIds);
+}
+
+// -----------------------------------------------------------------------------
+// handleGetMediasByMpxIdResp
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionListener::handleGetMediasByMpxIdResp(CMPXMessage* aMessage)
+{
+
+ CMPXMediaArray* array =
+ mVideoUtils.mediaValuePtr<CMPXMediaArray>(aMessage, KMPXMediaArrayContents);
+ if(!array || array->Count() < 1)
+ {
+ return;
+ }
+ emit newVideoAvailable((*array)[0]);
+}
+
+// -----------------------------------------------------------------------------
+// handleGetVideoDetailsResp
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionListener::handleGetVideoDetailsResp(CMPXMessage* aMessage)
+{
+ CMPXMedia *item = mVideoUtils.mediaValuePtr<CMPXMedia>(aMessage,KMPXCommandColAddMedia);
+ if(!item)
+ {
+ return;
+ }
+ TMPXItemId itemId;
+ if( !mVideoUtils.mediaValue<TMPXItemId>(item, KMPXMediaGeneralId, itemId))
+ {
+ return;
+ }
+ emit videoDetailsCompleted(itemId);
+}
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/src/videocollectionwrapper.cpp Thu Apr 01 22:38:49 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: VideoCollectionWrapper class implementation
+*
+*/
+
+// INCLUDE FILES
+#include <qabstractitemmodel.h>
+#include <QDebug>
+#include "videocollectionwrapper.h"
+#include "videocollectionwrapper_p.h"
+#include "videosortfilterproxymodel.h"
+
+VideoCollectionWrapper *VideoCollectionWrapper::mInstance = 0;
+
+// -----------------------------------------------------------------------------
+// VideoCollectionWrapper::CVideoCollectionWrapper()
+// -----------------------------------------------------------------------------
+//
+VideoCollectionWrapper *VideoCollectionWrapper::instance()
+{
+ if(!mInstance)
+ {
+ mInstance = new VideoCollectionWrapper();
+ }
+ mInstance->mReferenceCount++;
+ return mInstance;
+}
+
+// -----------------------------------------------------------------------------
+// VideoCollectionWrapper::cleanup()
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionWrapper::decreaseReferenceCount()
+{
+ if(mInstance)
+ {
+ if(--mInstance->mReferenceCount == 0)
+ {
+ delete mInstance;
+ mInstance = NULL;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+// VideoCollectionWrapper::VideoCollectionWrapper()
+// -----------------------------------------------------------------------------
+//
+VideoCollectionWrapper::VideoCollectionWrapper() :
+ d( new VideoCollectionWrapperPrivate ),
+ mReferenceCount(0)
+{
+ qDebug() << "CVideoCollectionWrapper::CVideoCollectionWrapper(): Constructing singleton";
+}
+
+// -----------------------------------------------------------------------------
+// CVideoCollectionWrapper::~CVideoCollectionWrapper()
+// -----------------------------------------------------------------------------
+//
+VideoCollectionWrapper::~VideoCollectionWrapper()
+{
+ delete d;
+ d = 0;
+}
+
+// -----------------------------------------------------------------------------
+// CVideoCollectionWrapper::getModel()
+// -----------------------------------------------------------------------------
+//
+VideoSortFilterProxyModel* VideoCollectionWrapper::getModel()
+{
+ if(d)
+ {
+ return d->getModel();
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// VideoCollectionWrapper::sendAsyncStatus()
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionWrapper::sendAsyncStatus(int statusCode, QVariant &additional)
+{
+ emit asyncStatus(statusCode, additional);
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/src/videolistdatamodel_p.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,610 @@
+/*
+* 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: VideoListDataModelPrivate class implementation
+*
+*/
+
+// INCLUDE FILES
+
+#include <mpxmediageneraldefs.h>
+#include <thumbnailmanager_qt.h>
+#include <mpxmediaarray.h>
+#include <mpxmedia.h>
+#include <qvariant.h>
+
+#include "videolistdatamodel.h"
+#include "videocollectionwrapper.h"
+#include "videolistdatamodel_p.h"
+#include "videothumbnaildata.h"
+#include "vcxmyvideosdefs.h"
+#include "videocollectionutils.h"
+#include "videocollectioncommon.h"
+
+/**
+ * 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);
+}
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// -----------------------------------------------------------------------------
+// VideoListDataModelPrivate
+// -----------------------------------------------------------------------------
+//
+VideoListDataModelPrivate::VideoListDataModelPrivate(VideoListDataModel *model) :
+q_ptr(model),
+mVideoThumbnailData(VideoThumbnailData::instance()),
+mInitialized(false)
+{
+}
+
+// -----------------------------------------------------------------------------
+// ~VideoListDataModelPrivate
+// -----------------------------------------------------------------------------
+//
+VideoListDataModelPrivate::~VideoListDataModelPrivate()
+{
+ mMediaData.clear();
+}
+
+// -----------------------------------------------------------------------------
+// initialize
+// -----------------------------------------------------------------------------
+//
+int VideoListDataModelPrivate::initialize()
+{
+ if(mInitialized)
+ {
+ return 0;
+ }
+ if(!connect( &mVideoThumbnailData, SIGNAL(thumbnailsFetched( QList<TMPXItemId> )),
+ this, SLOT(thumbnailsFetchedSlot( QList<TMPXItemId> ))))
+ {
+ return -1;
+ }
+
+ mInitialized = true;
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// getVideoCount
+// -----------------------------------------------------------------------------
+//
+int VideoListDataModelPrivate::getVideoCount()
+{
+ return mMediaData.count();
+}
+
+// -----------------------------------------------------------------------------
+// getMediaIdFromIndex
+// -----------------------------------------------------------------------------
+//
+TMPXItemId VideoListDataModelPrivate::getMediaIdFromIndex( int index ) const
+{
+ return mMediaData.idFromIndex(index);
+}
+
+// -----------------------------------------------------------------------------
+// getVideoNameFromIndex
+// -----------------------------------------------------------------------------
+//
+const QString VideoListDataModelPrivate::getVideoNameFromIndex( int index ) const
+{
+ QString txt;
+ CMPXMedia* media = mMediaData.fromIndex(index);
+ VideoCollectionUtils::instance().mediaValue<QString>(media, KMPXMediaGeneralTitle, txt );
+ return txt;
+}
+
+// -----------------------------------------------------------------------------
+// getVideoThumbnailFromIndex
+// -----------------------------------------------------------------------------
+//
+const QIcon* VideoListDataModelPrivate::getVideoThumbnailFromIndex( int index ) const
+{
+ return mVideoThumbnailData.getThumbnail( mMediaData.idFromIndex(index) );
+}
+
+// -----------------------------------------------------------------------------
+// getVideoSizeFromIndex
+// -----------------------------------------------------------------------------
+//
+quint32 VideoListDataModelPrivate::getVideoSizeFromIndex( int index ) const
+{
+ quint32 size(0);
+ CMPXMedia *media = mMediaData.fromIndex(index);
+ VideoCollectionUtils::instance().mediaValue<quint32>(media, KMPXMediaGeneralSize, size );
+ return size;
+}
+
+// -----------------------------------------------------------------------------
+// getVideoAgeProfileFromIndex
+// ---------------------------------------------------------------------------
+//
+quint32 VideoListDataModelPrivate::getVideoAgeProfileFromIndex( int index ) const
+{
+ quint32 ageProfile(0);
+ CMPXMedia *media = mMediaData.fromIndex(index);
+ VideoCollectionUtils::instance().mediaValue<quint32>(media, KVcxMediaMyVideosAgeProfile, ageProfile );
+ return ageProfile;
+}
+
+// -----------------------------------------------------------------------------
+// getVideodurationFromIndex
+// -----------------------------------------------------------------------------
+//
+quint32 VideoListDataModelPrivate::getVideodurationFromIndex( int index ) const
+{
+ quint32 returnDuration(0);
+ float duration(0);
+ CMPXMedia *media = mMediaData.fromIndex(index);
+ VideoCollectionUtils::instance().mediaValue<float>(media, KVcxMediaMyVideosDuration, duration );
+ returnDuration = static_cast<quint32>(duration);
+ return returnDuration;
+}
+
+// -----------------------------------------------------------------------------
+// getVideoDateFromIndex
+// -----------------------------------------------------------------------------
+//
+QDateTime VideoListDataModelPrivate::getVideoDateFromIndex( int index ) const
+{
+ QDateTime date;
+ quint64 dateTimeValue;
+ if(!VideoCollectionUtils::instance().mediaValue<quint64>(mMediaData.fromIndex(index), KMPXMediaGeneralDate, dateTimeValue))
+ {
+ return date;
+ }
+ TDateTime temp = TTime( dateTimeValue ).DateTime();
+ date = QDateTime(QDate(temp.Year(), temp.Month()+1, temp.Day()+1),
+ QTime(temp.Hour(), temp.Minute(), temp.Second(), temp.MicroSecond()));
+ return date;
+}
+
+// -----------------------------------------------------------------------------
+// getMetaDataFromIndex
+// -----------------------------------------------------------------------------
+//
+QMap<QString, QVariant> VideoListDataModelPrivate::getMetaDataFromIndex(int index) const
+{
+ using namespace VideoCollectionCommon;
+ QMap<QString, QVariant> map;
+ CMPXMedia *media = mMediaData.fromIndex(index);
+ if(!media) {
+ return map;
+ }
+
+ // MetaKeyDate
+ QDateTime date = getVideoDateFromIndex(index);
+ if(date.isValid()) {
+ map[MetaKeyDate] = date.date();
+ }
+
+ // MetaKeyDurationString
+ quint32 dur = getVideodurationFromIndex(index);
+ QString duration = VideoCollectionUtils::instance().prepareLengthString(dur);
+ if(!duration.isNull() && !duration.isEmpty()) {
+ map[MetaKeyDurationString] = duration;
+ }
+
+ // MetaKeySizeString
+ quint32 s = getVideoSizeFromIndex(index);
+ QString size = VideoCollectionUtils::instance().prepareSizeString(s);
+ if(!size.isNull() && !size.isEmpty()) {
+ map[MetaKeySizeString] = size;
+ }
+
+ // MetaKeyStarRating
+ quint8 rating = 0;
+ if(VideoCollectionUtils::instance().mediaValue<quint8>(media, KVcxMediaMyVideosRating, rating))
+ {
+ map[MetaKeyStarRating] = rating;
+ }
+
+ // MetaKeyDRMInfo
+
+ // MetaKeyServiceURL
+
+ // MetaKeyDescription
+ QString desc;
+ if(VideoCollectionUtils::instance().mediaValue<QString>(media, KMPXMediaGeneralComment, desc)) {
+ map[MetaKeyDescription] = desc;
+ }
+
+ // MetaKeyModifiedDate
+ quint64 dateTimeValue;
+ if(VideoCollectionUtils::instance().mediaValue<quint64>(media, KVcxMediaMyVideosModifiedDate, dateTimeValue)) {
+ TDateTime temp = TTime( dateTimeValue ).DateTime();
+ QDateTime date = QDateTime(QDate(temp.Year(), temp.Month()+1, temp.Day()),
+ QTime(temp.Hour(), temp.Minute(), temp.Second(), temp.MicroSecond()));
+ map[MetaKeyModifiedDate] = date.date();
+ }
+
+ // MetaKeyShotLocation
+
+ // MetaKeyAuthor
+ QString author;
+ if(VideoCollectionUtils::instance().mediaValue<QString>(media, KVcxMediaMyVideosAuthor, author)) {
+ map[MetaKeyAuthor] = author;
+ }
+
+ // MetaKeyCopyright
+ QString copyright;
+ if(VideoCollectionUtils::instance().mediaValue<QString>(media, KMPXMediaGeneralCopyright, copyright)) {
+ map[MetaKeyCopyright] = copyright;
+ }
+
+ // MetaKeyAudioType
+
+ // MetaKeyLanguageString
+ QString language;
+ if(VideoCollectionUtils::instance().mediaValue<QString>(media, KVcxMediaMyVideosAudioLanguage, language)) {
+ map[MetaKeyLanguageString] = language;
+ }
+
+ // MetaKeyKeywords
+
+ // MetaKeyVideoResolutionString
+
+ // MetaKeyBitRate
+
+ // MetaKeyFormat
+ QString format;
+ if(VideoCollectionUtils::instance().mediaValue<QString>(media, KMPXMediaGeneralMimeType, format)) {
+ map[MetaKeyFormat] = format;
+ }
+
+ return map;
+}
+
+// -----------------------------------------------------------------------------
+// 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)
+{
+ 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;
+}
+
+// -----------------------------------------------------------------------------
+// unMarkVideosRemoved
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModelPrivate::unMarkVideosRemoved(QList<TMPXItemId> &itemIds)
+{
+ QList<TMPXItemId>::const_iterator iter = itemIds.constBegin();
+ while(iter != itemIds.constEnd())
+ {
+ mItemsUnderDeletion.remove(*iter);
+ iter++;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// getFilePathFromIndex
+// -----------------------------------------------------------------------------
+//
+const QString VideoListDataModelPrivate::getFilePathFromIndex(int index) const
+{
+ QString filePath;
+ VideoCollectionUtils::instance().mediaValue<QString>(mMediaData.fromIndex(index),
+ KMPXMediaGeneralUri, filePath );
+ return filePath;
+}
+
+// -----------------------------------------------------------------------------
+// getFilePathForId
+// -----------------------------------------------------------------------------
+//
+const QString VideoListDataModelPrivate::getFilePathForId(TMPXItemId mediaId) const
+{
+ QString filePath;
+ int index = mMediaData.indexOfId(mediaId);
+ VideoCollectionUtils::instance().mediaValue<QString>(mMediaData.fromIndex(index),
+ KMPXMediaGeneralUri, filePath );
+ return filePath;
+}
+
+// -----------------------------------------------------------------------------
+// getMediaId
+// -----------------------------------------------------------------------------
+//
+TMPXItemId VideoListDataModelPrivate::getMediaId(const CMPXMedia *media ) const
+{
+ TMPXItemId mediaId = TMPXItemId::InvalidId();
+
+ VideoCollectionUtils::instance().mediaValue<TMPXItemId>(media, KMPXMediaGeneralId, mediaId );
+
+ return mediaId;
+}
+
+// -----------------------------------------------------------------------------
+// appendDataToContainerL
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModelPrivate::appendDataToContainerL(CMPXMediaArray *videoArray, unsigned int startIndex)
+{
+ if(!videoArray || startIndex >= videoArray->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;
+ 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)
+ {
+ newMedia = CMPXMedia::NewL(*(videoArray->AtL(i)));
+ mMediaData.append(newMedia);
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+// thumbnailsFetchedSlot
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModelPrivate::thumbnailsFetchedSlot(QList<TMPXItemId> mediaIds)
+{
+ // TODO: find way to optimize dataChanged events
+
+ TMPXItemId id;
+ QModelIndex rowIndex;
+
+ while(!mediaIds.isEmpty())
+ {
+ id = mediaIds.takeFirst();
+ rowIndex = q_ptr->index(mMediaData.indexOfId(id), 0);
+ if(rowIndex.isValid())
+ {
+ emit dataChanged( rowIndex, rowIndex);
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+// newVideoListSlot
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModelPrivate::newVideoListSlot( CMPXMediaArray *newVideoList )
+{
+ if( !newVideoList )
+ {
+ 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);
+
+ TRAP_IGNORE(appendDataToContainerL(newVideoList));
+
+ q_ptr->endInsertRows();
+ emit q_ptr->modelReady();
+}
+
+// -----------------------------------------------------------------------------
+// appendVideoListSlot
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModelPrivate::appendVideoListSlot(CMPXMediaArray* videoList)
+{
+ if(!videoList)
+ {
+ return;
+ }
+ if(videoList->Count() == 0 || videoList->Count() <= mMediaData.count())
+ {
+ // nothing to append or count matches, no changes -> nothing to append
+ return;
+ }
+
+ // array gotten is in same order as existing data from the start,
+ // so we only need to go throught the appendding array from the index
+ // at position where first new items is excepted to exists.
+ int startIndex = mMediaData.count();
+
+ q_ptr->beginInsertRows(QModelIndex(), startIndex, videoList->Count() - 1);
+
+ TRAP_IGNORE(appendDataToContainerL(videoList, startIndex));
+
+ q_ptr->endInsertRows();
+}
+
+// -----------------------------------------------------------------------------
+// newVideoAvailable
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModelPrivate::newVideoAvailableSlot(CMPXMedia *newVideo)
+{
+ if(!newVideo )
+ {
+ return;
+ }
+
+ // try to get id of the video, if not found consider invalid clip
+ TMPXItemId mediaId = getMediaId(newVideo);
+ if( mediaId == TMPXItemId::InvalidId())
+ {
+ return;
+ }
+
+ // 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));
+
+ q_ptr->beginInsertRows(QModelIndex(), mMediaData.count(), mMediaData.count());
+
+ mMediaData.append(videoToAppend);
+
+ q_ptr->endInsertRows();
+
+}
+
+// -----------------------------------------------------------------------------
+// videoDeleted
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModelPrivate::videoDeletedSlot(TMPXItemId videoId)
+{
+ int index = -1;
+
+ if(mItemsUnderDeletion.contains(videoId))
+ {
+ 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();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// videoDeleteCompleted
+// -----------------------------------------------------------------------------
+//
+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)
+ {
+ 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))
+ {
+ // 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);
+
+ }
+ else
+ {
+ data = failedCount;
+ wrapper->sendAsyncStatus(VideoCollectionCommon::statusMultipleDeleteFail, data);
+ }
+ wrapper->decreaseReferenceCount();
+ wrapper = 0;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// VideoDetailsCompleted
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModelPrivate::videoDetailsCompletedSlot(TMPXItemId videoId)
+{
+ int index = mMediaData.indexOfId(videoId);
+ if(index >= 0)
+ {
+ emit videoDetailsReady(index);
+ }
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/src/videosortfilterproxymodel.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,359 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Videosortfilterproxymodel implementation
+*
+*/
+
+#include <qstringlist.h>
+#include <qtimer.h>
+#include <qdatetime.h>
+
+#include "videothumbnaildata.h"
+#include "videocollectioncommon.h"
+#include "videosortfilterproxymodel.h"
+#include "videolistdatamodel.h"
+#include "videocollectionclient.h"
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::VideoSortFilterProxyModel
+// -----------------------------------------------------------------------------
+//
+VideoSortFilterProxyModel::VideoSortFilterProxyModel(QObject *parent) :
+ QSortFilterProxyModel(parent),
+ mModel(0),
+ mCollectionClient(0),
+ mLevel(-1),
+ mIdleSortTimer(0),
+ mWantedSortRole(VideoCollectionCommon::KeyDateTime)
+{
+ // NOP
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::~VideoSortFilterProxyModel
+// -----------------------------------------------------------------------------
+//
+VideoSortFilterProxyModel::~VideoSortFilterProxyModel()
+{
+ delete mCollectionClient;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::initialize
+// -----------------------------------------------------------------------------
+//
+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()))) {
+ return -1;
+ }
+
+ 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;
+ }
+ }
+
+ mModel = sourceModel;
+ setSourceModel(sourceModel);
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::open
+// -----------------------------------------------------------------------------
+//
+int VideoSortFilterProxyModel::open(int level)
+{
+ if(mLevel != level) {
+ mLevel = level;
+ return mCollectionClient->startOpenCollection(level);
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::doSorting
+// -----------------------------------------------------------------------------
+//
+void VideoSortFilterProxyModel::doSorting(int sortingRole, Qt::SortOrder order,
+ bool async)
+{
+ if((sortingRole != Qt::DisplayRole) &&
+ (sortingRole != VideoCollectionCommon::KeySizeValue) &&
+ (sortingRole != VideoCollectionCommon::KeyDateTime))
+ {
+ // default sorting order is by date
+ mWantedSortRole = VideoCollectionCommon::KeyDateTime;
+ }
+ else
+ {
+ mWantedSortRole = sortingRole;
+ }
+
+ mWantedSortOrder = order;
+
+ if(async)
+ {
+ if(mIdleSortTimer)
+ {
+ if(mIdleSortTimer->isActive())
+ {
+ mIdleSortTimer->stop();
+ }
+ }
+ else
+ {
+ mIdleSortTimer = new QTimer(this);
+ connect(mIdleSortTimer, SIGNAL(timeout()), this, SLOT(processSorting()));
+ }
+ mIdleSortTimer->start(0);
+ } else {
+ processSorting();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::deleteItems
+// -----------------------------------------------------------------------------
+//
+int VideoSortFilterProxyModel::deleteItems(const QModelIndexList &indexList)
+{
+ if(mModel)
+ {
+ QModelIndexList mappedList;
+ for(int i = 0; i < indexList.count(); ++i)
+ {
+ mappedList.append(mapToSource(indexList.at(i)));
+ }
+
+ if(mModel->removeRows(mappedList))
+ {
+ // Start fetching thumbnails at start of the model.
+ VideoThumbnailData::instance().startBackgroundFetching(0);
+
+ return 0;
+ }
+ }
+ return -1;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::openItem
+// -----------------------------------------------------------------------------
+//
+int VideoSortFilterProxyModel::openItem(const QModelIndex &index)
+{
+ // getMediaIdAtIndex maps index to source
+ TMPXItemId mpxId1 = getMediaIdAtIndex(index);
+ if(mpxId1 != TMPXItemId::InvalidId() && mCollectionClient)
+ {
+ return mCollectionClient->openVideo(mpxId1);
+ }
+ return -1;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::back
+// -----------------------------------------------------------------------------
+//
+int VideoSortFilterProxyModel::back()
+{
+ if(mCollectionClient)
+ {
+ return mCollectionClient->back();
+ }
+ return -1;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::fetchItemDetails
+// -----------------------------------------------------------------------------
+//
+int VideoSortFilterProxyModel::fetchItemDetails(const QModelIndex &index)
+{
+ // no need to map index beforehand, because
+ // getMediaIdAtIndex maps it
+ TMPXItemId mpxId1 = getMediaIdAtIndex(index);
+ if(mpxId1 != TMPXItemId::InvalidId() && mCollectionClient)
+ {
+ 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());
+ return 0;
+ }
+ }
+ return -1;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::processSorting
+// -----------------------------------------------------------------------------
+//
+void VideoSortFilterProxyModel::processSorting()
+{
+ if(mIdleSortTimer)
+ {
+ mIdleSortTimer->stop();
+ }
+
+ if(sortRole() != mWantedSortRole)
+ {
+ setSortRole(mWantedSortRole);
+ }
+
+ if(sortColumn() == -1 || sortOrder() != mWantedSortOrder)
+ {
+ // if sorting column is not yet setted, it indicates
+ // that we've setted the sorting order for the first time
+ // and sorting has not yet been done. After we have called sort once,
+ // the sort columnt gets updated and following sorts gets executed
+ // by setSortRole -call as long as role changes.
+
+ // Another case is when we need to change the sort order, as there is
+ // no other way of setting the sort order than calling sort().
+ sort(0, mWantedSortOrder);
+ }
+
+ // Start fetching thumbnails at start of the model.
+ VideoThumbnailData::instance().startBackgroundFetching(0);
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::lessThan
+// -----------------------------------------------------------------------------
+//
+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
+
+ int sRole = sortRole();
+ QVariant leftData = sourceModel()->data(left, sRole);
+ QVariant rightData = sourceModel()->data(right, sRole);
+
+ if(!leftData.isValid() || !rightData.isValid())
+ {
+ return false;
+ }
+ if(sRole == Qt::DisplayRole)
+ {
+ QString leftString = leftData.toStringList().first().toUpper();
+ QString rightString = rightData.toStringList().first().toUpper();
+ return QString::localeAwareCompare(leftString, rightString) < 0;
+ }
+ else if(sRole == VideoCollectionCommon::KeySizeValue)
+ {
+ quint32 leftSize = leftData.toUInt();
+ quint32 rightSize = rightData.toUInt();
+ return leftSize < rightSize;
+ }
+ else if(sRole == VideoCollectionCommon::KeyDateTime)
+ {
+ QDateTime leftDateTime = leftData.toDateTime();
+ QDateTime rightDateTime = rightData.toDateTime();
+ // datetime sorting role has inverted sorting order compared to other roles
+ return rightDateTime < leftDateTime;
+ }
+ return false;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::filterAcceptsRow
+// -----------------------------------------------------------------------------
+//
+bool VideoSortFilterProxyModel::filterAcceptsRow (int source_row, const QModelIndex &source_parent) const
+{
+ if(!sourceModel())
+ return false;
+
+ QModelIndex index = sourceModel()->index(source_row, 0, source_parent);
+ if(index.isValid())
+ {
+ QVariant data = sourceModel()->data(index, VideoCollectionCommon::KeyStatus);
+ if(data.isValid() && data.toInt() == VideoCollectionCommon::StatusDeleted)
+ {
+ return false;
+ }
+ return true;
+ }
+ return false;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::getMediaIdAtIndex()
+// -----------------------------------------------------------------------------
+//
+TMPXItemId VideoSortFilterProxyModel::getMediaIdAtIndex(const QModelIndex &index)
+{
+ QModelIndex sourceIndex = mapToSource(index);
+ TMPXItemId mpxId = TMPXItemId::InvalidId();
+ if(mModel && sourceIndex.isValid())
+ {
+ mpxId = mModel->mediaIdAtIndex(sourceIndex.row());
+ }
+ return mpxId;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::getMediaFilePathForId()
+// -----------------------------------------------------------------------------
+//
+QString VideoSortFilterProxyModel::getMediaFilePathForId(TMPXItemId mediaId)
+{
+ QString filePath;
+ if(mModel)
+ {
+ filePath = mModel->mediaFilePathForId(mediaId);
+ }
+ return filePath;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::addNewCollection()
+// -----------------------------------------------------------------------------
+//
+int VideoSortFilterProxyModel::addNewCollection(QString name, QString thumbnail, QList<TMPXItemId> mediaIds)
+{
+ int error = -1;
+ if(mCollectionClient) {
+ error = mCollectionClient->addNewCollection(name, thumbnail, mediaIds);
+ }
+ return error;
+}
+
+// end of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/src/videothumbnaildata.cpp Thu Apr 01 22:38:49 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: VideoThumbnailData class implementation
+*
+*/
+
+// INCLUDE FILES
+#include "videothumbnaildata.h"
+#include "videothumbnaildata_p.h"
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailData::VideoThumbnailData()
+// -----------------------------------------------------------------------------
+//
+VideoThumbnailData &VideoThumbnailData::instance()
+{
+ static VideoThumbnailData _thumbnailData;
+ return _thumbnailData;
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailData::VideoThumbnailData()
+// -----------------------------------------------------------------------------
+//
+VideoThumbnailData::VideoThumbnailData() :
+d_ptr(new VideoThumbnailDataPrivate())
+{
+ connect(d_ptr, SIGNAL(thumbnailsFetched(QList<TMPXItemId>)),
+ this, SIGNAL(thumbnailsFetched(QList<TMPXItemId>)));
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailData::~VideoThumbnailData()
+// -----------------------------------------------------------------------------
+//
+VideoThumbnailData::~VideoThumbnailData()
+{
+ disconnect(d_ptr, SIGNAL(thumbnailsFetched(QList<TMPXItemId>)),
+ this, SIGNAL(thumbnailsFetched(QList<TMPXItemId>)));
+ delete d_ptr;
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailData::startFetchingThumbnail()
+// -----------------------------------------------------------------------------
+//
+int VideoThumbnailData::startFetchingThumbnail(int mediaId, int priority)
+{
+ return d_ptr->startFetchingThumbnail(mediaId, priority);
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailData::removeThumbnail()
+// -----------------------------------------------------------------------------
+//
+bool VideoThumbnailData::removeThumbnail(TMPXItemId mediaId)
+{
+ return d_ptr->removeThumbnail(mediaId);
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailData::getThumbnail()
+// -----------------------------------------------------------------------------
+//
+const QIcon* VideoThumbnailData::getThumbnail(TMPXItemId mediaId)
+{
+ return d_ptr->getThumbnail(mediaId);
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailData::startBackgroundFetching()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailData::startBackgroundFetching(int fetchIndex)
+{
+ d_ptr->startBackgroundFetching(fetchIndex);
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailData::enableBackgroundFetching()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailData::enableBackgroundFetching(bool enable)
+{
+ d_ptr->enableBackgroundFetching(enable);
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailData::freeThumbnailData()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailData::freeThumbnailData()
+{
+ d_ptr->freeThumbnailData();
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/src/videothumbnaildata_p.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,572 @@
+/*
+* 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: VideoThumbnailDataPrivate class implementation
+*
+*/
+
+// INCLUDE FILES
+#include <QApplication>
+#include <QPixmap>
+#include <QTimer>
+#include <mpxmediageneraldefs.h>
+#include <thumbnailmanager_qt.h>
+
+#include "videothumbnaildata_p.h"
+#include "videocollectionwrapper.h"
+#include "videosortfilterproxymodel.h"
+
+// Maximum thumbnails kept in memory.
+const int THUMBNAIL_CACHE_SIZE = 60;
+// Maximum of thumbnail fetches done at one background fetch round.
+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;
+// Priority for background thumbnail fetches.
+const int BACKGROUND_FETCH_PRIORITY = 3000;
+
+/**
+ * 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);
+}
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataPrivate::VideoThumbnailDataPrivate()
+// -----------------------------------------------------------------------------
+//
+VideoThumbnailDataPrivate::VideoThumbnailDataPrivate() :
+ mThumbnailManager(0),
+ mDefaultTnVideo(0),
+ mDefaultTnCategory(0),
+ mCollectionWrapper(VideoCollectionWrapper::instance()),
+ mModel(0),
+ mCurrentFetchIndex(0),
+ mCurrentBackgroundFetchCount(0),
+ mBgFetchTimer(0),
+ mTbnReportTimer(0),
+ mSignalsConnected(false),
+ mBackgroundFetchingEnabled(true)
+{
+ initialize();
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataPrivate::~VideoThumbnailDataPrivate()
+// -----------------------------------------------------------------------------
+//
+VideoThumbnailDataPrivate::~VideoThumbnailDataPrivate()
+{
+ cleanup();
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataPrivate::initialize()
+// -----------------------------------------------------------------------------
+//
+int VideoThumbnailDataPrivate::initialize()
+{
+ mThumbnailData.setMaxCost(THUMBNAIL_CACHE_SIZE);
+
+ if(!mCollectionWrapper)
+ {
+ return -1;
+ }
+
+ if(!mThumbnailManager)
+ {
+ mThumbnailManager = new ThumbnailManager();
+ mThumbnailManager->setThumbnailSize( ThumbnailManager::ThumbnailMedium );
+ mThumbnailManager->setQualityPreference( ThumbnailManager::OptimizeForPerformance );
+ }
+
+ mModel = mCollectionWrapper->getModel();
+ if(!mModel)
+ {
+ cleanup();
+ return -1;
+ }
+
+ if(!mBgFetchTimer)
+ {
+ mBgFetchTimer = new QTimer();
+ }
+
+ if(!mTbnReportTimer)
+ {
+ mTbnReportTimer = new QTimer();
+ }
+
+ if(connectSignals() < 0)
+ {
+ cleanup();
+ return -1;
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataPrivate::cleanup()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailDataPrivate::cleanup()
+{
+ if(mCollectionWrapper)
+ {
+ mCollectionWrapper->decreaseReferenceCount();
+ mCollectionWrapper = 0;
+ }
+
+ disconnectSignals();
+
+ freeThumbnailData();
+
+ if(mTbnReportTimer)
+ {
+ mTbnReportTimer->stop();
+ delete mTbnReportTimer;
+ mTbnReportTimer = 0;
+ }
+
+ if(mBgFetchTimer)
+ {
+ mBgFetchTimer->stop();
+ delete mBgFetchTimer;
+ mBgFetchTimer = 0;
+ }
+
+ delete mThumbnailManager;
+ mThumbnailManager = 0;
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataPrivate::disconnectSignals()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailDataPrivate::disconnectSignals()
+{
+ 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)));
+ disconnect(mBgFetchTimer, SIGNAL(timeout()), this, SLOT(doBackgroundFetching()));
+ disconnect(mTbnReportTimer, SIGNAL(timeout()), this, SLOT(reportThumbnailsReadySlot()));
+ }
+ mSignalsConnected = false;
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataPrivate::connectSignals()
+// -----------------------------------------------------------------------------
+//
+int VideoThumbnailDataPrivate::connectSignals()
+{
+ 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))) ||
+ !connect(mBgFetchTimer, SIGNAL(timeout()), this, SLOT(doBackgroundFetching())) ||
+ !connect(mTbnReportTimer, SIGNAL(timeout()), this, SLOT(reportThumbnailsReadySlot())))
+ {
+ return -1;
+ }
+
+ QApplication *app = qApp;
+ if(!connect(app, SIGNAL(aboutToQuit()), this, SLOT(aboutToQuitSlot())))
+ {
+ return -1;
+ }
+
+ mSignalsConnected = true;
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataPrivate::getThumbnail()
+// -----------------------------------------------------------------------------
+//
+const QIcon* VideoThumbnailDataPrivate::getThumbnail(TMPXItemId mediaId)
+{
+ const QIcon *thumbnail = mThumbnailData[mediaId];
+ if(!thumbnail)
+ {
+ return defaultThumbnail(mediaId);
+ }
+ return thumbnail;
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataPrivate::startFetchingThumbnails()
+// -----------------------------------------------------------------------------
+//
+int VideoThumbnailDataPrivate::startFetchingThumbnails(const QList<QModelIndex> &indexes, int priority)
+{
+ if(!mModel || !mThumbnailManager)
+ {
+ return -1;
+ }
+ if(indexes.count() == 0)
+ {
+ 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();
+
+ // Fetch the thumbnails in ascending priority.
+
+ int startPriority = fetchCountBefore + priority + indexes.count();
+
+ for(int i = 0; i < indexes.count(); i++)
+ {
+ startFetchingThumbnail(mModel->getMediaIdAtIndex(indexes[i]), startPriority-i);
+ }
+
+ return mFetchList.count() - fetchCountBefore;
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataPrivate::startFetchingThumbnail()
+// -----------------------------------------------------------------------------
+//
+int VideoThumbnailDataPrivate::startFetchingThumbnail(TMPXItemId mediaId, int priority)
+{
+ if(!mModel || !mThumbnailManager)
+ {
+ return -1;
+ }
+ if(mFetchList.count() >= THUMBNAIL_MAX_SIMULTANEOUS_FETCHES)
+ {
+ return -1;
+ }
+
+ // Check that it's not fetched before.
+ if(mThumbnailData.contains(mediaId))
+ {
+ return 0;
+ }
+
+ QString fileName = mModel->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
+ if(fileName.length() > 0)
+ {
+ tnId = mThumbnailManager->getThumbnail(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;
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataPrivate::doBackgroundFetching()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailDataPrivate::doBackgroundFetching()
+{
+ if(!mModel)
+ {
+ return;
+ }
+
+ if(mCurrentBackgroundFetchCount >= THUMBNAIL_CACHE_SIZE)
+ {
+ return;
+ }
+
+ int maxIndex = mModel->rowCount();
+ if(maxIndex == 0)
+ {
+ return;
+ }
+
+ // Delta to UI index where fetch has been done already.
+ int currentDelta = mCurrentBackgroundFetchCount/2;
+
+ // How many will be fetched.
+ const int fetchAmount = THUMBNAIL_BACKGROUND_FETCH_AMOUNT/2;
+
+ QList<QModelIndex> indexes;
+
+ // Items before the current fetch index.
+ int startIndex = mCurrentFetchIndex-currentDelta-fetchAmount;
+ int endIndex = mCurrentFetchIndex-currentDelta;
+ getModelIndexes(indexes, startIndex, endIndex);
+
+ // Items after the current fetch index.
+ startIndex = mCurrentFetchIndex+currentDelta;
+ endIndex = mCurrentFetchIndex+currentDelta+fetchAmount;
+ getModelIndexes(indexes, startIndex, endIndex);
+
+ mCurrentBackgroundFetchCount += THUMBNAIL_BACKGROUND_FETCH_AMOUNT;
+
+ int fetchesStarted = startFetchingThumbnails(indexes, BACKGROUND_FETCH_PRIORITY);
+
+ // No thumbnails to fetch, start again.
+ if(fetchesStarted == 0)
+ {
+ continueBackgroundFetch();
+ }
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataPrivate::getModelIndexes()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailDataPrivate::getModelIndexes(QList<QModelIndex> &indexes, int startIndex, int endIndex)
+{
+ QModelIndex index;
+ for(int i = startIndex; i < endIndex; i++)
+ {
+ if(i >= 0)
+ {
+ index = mModel->index(i, 0);
+ if(index.isValid())
+ {
+ indexes.append(index);
+ }
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataPrivate::thumbnailReadySlot()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailDataPrivate::thumbnailReadySlot(QPixmap tnData, void *internal , int id, 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)
+ {
+ mediaId = *(static_cast<TMPXItemId*>(internal));
+ delete internal;
+ }
+ else
+ {
+ return;
+ }
+
+ if(!error && !tnData.isNull())
+ {
+ mThumbnailData.insert(mediaId, new QIcon(tnData));
+
+ // Gather list of media ids and emit thumbnailReady signals in larger set
+ // when timer goes off.
+ if(mTbnReportTimer && !mTbnReportTimer->isActive())
+ {
+ mTbnReportTimer->setSingleShot(true);
+ mTbnReportTimer->start(THUMBNAIL_READY_SIGNAL_TIMEOUT);
+ }
+
+ // Save the media id for the signal.
+ mReadyThumbnailMediaIds.append(mediaId);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataPrivate::reportThumbnailsReadySlot()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailDataPrivate::reportThumbnailsReadySlot()
+{
+ emit thumbnailsFetched(mReadyThumbnailMediaIds);
+ mReadyThumbnailMediaIds.clear();
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataPrivate::layoutChangedSlot()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailDataPrivate::layoutChangedSlot()
+{
+ startBackgroundFetching(mCurrentFetchIndex);
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataPrivate::rowsInsertedSlot()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailDataPrivate::rowsInsertedSlot(const QModelIndex & /* parent */, int /* start */, int /* end */)
+{
+ startBackgroundFetching(mCurrentFetchIndex);
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataPrivate::defaultThumbnail()
+// -----------------------------------------------------------------------------
+//
+const QIcon* VideoThumbnailDataPrivate::defaultThumbnail(TMPXItemId mediaId)
+{
+ // Is thumbnail for a video or a category.
+ if(mediaId.iId2 == 0)
+ {
+ if(!mDefaultTnVideo)
+ mDefaultTnVideo = new QIcon(":/icons/default_thumbnail_video.svg");
+ return mDefaultTnVideo;
+ }
+ else
+ {
+ if(!mDefaultTnCategory)
+ mDefaultTnCategory = new QIcon(":/icons/default_thumbnail_collection.svg");
+ return mDefaultTnCategory;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataPrivate::removeThumbnail()
+// -----------------------------------------------------------------------------
+//
+bool VideoThumbnailDataPrivate::removeThumbnail(TMPXItemId mediaId)
+{
+ return mThumbnailData.remove(mediaId);
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataPrivate::enableBackgroundFetching()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailDataPrivate::enableBackgroundFetching(bool enable)
+{
+ mBackgroundFetchingEnabled = enable;
+ startBackgroundFetching(0);
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataPrivate::freeThumbnailData()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailDataPrivate::freeThumbnailData()
+{
+ // Stop timers.
+ if(mBgFetchTimer)
+ mBgFetchTimer->stop();
+
+ if(mTbnReportTimer)
+ mTbnReportTimer->stop();
+
+ // Clear data.
+ mFetchList.clear();
+ mReadyThumbnailMediaIds.clear();
+ mThumbnailData.clear();
+
+ delete mDefaultTnVideo;
+ mDefaultTnVideo = 0;
+
+ delete mDefaultTnCategory;
+ mDefaultTnCategory = 0;
+}
+
+// -----------------------------------------------------------------------------
+// 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)
+{
+ if(!mBackgroundFetchingEnabled)
+ return;
+
+ mCurrentFetchIndex = fetchIndex;
+ mCurrentBackgroundFetchCount = 0;
+ doBackgroundFetching();
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataPrivate::continueBackgroundFetch()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailDataPrivate::continueBackgroundFetch()
+{
+ if(!mBackgroundFetchingEnabled)
+ return;
+
+ if(mBgFetchTimer)
+ {
+ mBgFetchTimer->stop();
+ mBgFetchTimer->setSingleShot(true);
+ mBgFetchTimer->start(THUMBNAIL_BACKGROUND_TIMEOUT);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataPrivate::aboutToQuitSlot()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailDataPrivate::aboutToQuitSlot()
+{
+ cleanup();
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionclient/inc/testvideocollectionclient.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,183 @@
+
+/**
+* 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 CVideoCollectionClient
+*
+*/
+
+#ifndef __TESTVIDEOCOLLECTIONCLIENT_H__
+#define __TESTVIDEOCOLLECTIONCLIENT_H__
+
+
+// INCLUDES
+#include <QtTest/QtTest>
+
+#include "stub/inc/mpxmedia.h"
+#include "stub/inc/mpxmediaarray.h"
+#include "stub/inc/mpxattribute.h"
+#include "stub/inc/mpxcollectionpath.h"
+#include "stub/inc/mpxcollectionutility.h"
+
+#include <mpxcollectionframeworkdefs.h>
+
+
+class VideoCollectionClient;
+
+class TestVideoCollectionClient : public QObject
+{
+ Q_OBJECT
+
+ // test functions for the test framework
+private slots:
+
+
+ /**
+ * will be called before each testfunction is executed.
+ *
+ */
+ void init();
+
+ /**
+ * will be called after every testfunction.
+ *
+ */
+ void cleanup();
+
+ /**
+ * initialization while collectionutility exists allready
+ *
+ */
+ void testInitializeCollUtilityExists();
+
+ /**
+ * initialization collection listener exists
+ *
+ */
+ void testInitializeCollListenerExist();
+
+ /**
+ * initialization and collection utility creation fails
+ *
+ */
+ void testInitializeUtilCreateFail();
+
+ /**
+ * succeeded initialization test
+ *
+ */
+ void testInitializeSucceed();
+
+ /**
+ * verifies connectCollectionSignalReceiver -call
+ *
+ */
+ void testConnectCollectionSignalReceiver();
+
+ /**
+ * verifies collectionLevel -call
+ *
+ */
+ void testCollectionLevel();
+
+ /**
+ * verifies getOpenStatus -call
+ *
+ */
+ void testGetOpenStatus();
+
+ /**
+ * verifies setOpenStatus -call
+ *
+ */
+ void testSetOpenStatus();
+
+ /**
+ * verifies startOpenCollection -call
+ *
+ */
+ void testStartOpenCollection();
+
+ /**
+ * verifies startOpenCurrentState -call
+ *
+ */
+ void testStartOpenCurrentState();
+
+
+ /**
+ * verifies deleteVideos -call
+ *
+ */
+ void testDeleteVideos();
+
+
+ /**
+ * verifies openVideo -call
+ *
+ */
+ void testOpenCategory();
+
+ /**
+ * verifies openVideo -call
+ *
+ */
+ void testOpenVideo();
+
+ /**
+ * verifies fetchMpxMediaByMpxId -call
+ *
+ */
+ void testFetchMpxMediaByMpxId();
+
+ /**
+ * verifies getVideoDetails -call
+ *
+ */
+ void testGetVideoDetails();
+
+ /**
+ * Data for the testAddNewCollection test.
+ */
+ void testAddNewCollection_data();
+
+ /**
+ * verifies addNewCollection -call.
+ */
+ void testAddNewCollection();
+
+ /**
+ * verifies back -call
+ *
+ */
+ void testBack();
+
+
+private:
+
+ /**
+ * testobject
+ */
+ VideoCollectionClient* mTestObject;
+
+};
+
+
+
+
+#endif // __TESTVIDEOCOLLECTIONWRAPPER_H__
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionclient/src/testvideocollectionclient.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,569 @@
+
+/**
+* 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 CVideoCollectionWrapperPrivate
+*
+*/
+
+
+// INCLUDES
+
+#include "testvideocollectionclient.h"
+#include "videocollectioncommon.h"
+#include "stub/inc/videocollectionlistener.h"
+
+#define private public
+#include "videocollectionclient.h"
+#undef private
+
+#include "stub/inc/stubcollectionsignalclasses.h"
+
+Q_DECLARE_METATYPE(QList<int>)
+
+// -----------------------------------------------------------------------------
+// main
+// -----------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ 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);
+
+ return res;
+}
+
+Q_DECLARE_METATYPE(QList<TMPXItemId>)
+
+// -----------------------------------------------------------------------------
+// init
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionClient::init()
+{
+ mTestObject = new VideoCollectionClient();
+}
+
+// -----------------------------------------------------------------------------
+// cleanup
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionClient::cleanup()
+{
+ delete mTestObject;
+ mTestObject = 0;
+}
+
+// -----------------------------------------------------------------------------
+// testInitializeCollUtilityExists
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionClient::testInitializeCollUtilityExists()
+{
+ MMPXCollectionUtility *tmpUtility = new MMPXCollectionUtility();
+ mTestObject->mCollectionUtility = tmpUtility;
+ QVERIFY(mTestObject->initialize() == 0);
+ QVERIFY(mTestObject->mCollectionUtility != 0);
+ QVERIFY(mTestObject->mCollectionListener != 0);
+}
+
+// -----------------------------------------------------------------------------
+// testInitializeCollUtilityExists
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionClient::testInitializeCollListenerExist()
+{
+ VideoCollectionListener *tmpListener = new VideoCollectionListener(*mTestObject);
+ mTestObject->mCollectionListener = tmpListener;
+ QVERIFY(mTestObject->initialize() == 0);
+ QVERIFY(mTestObject->mCollectionUtility != 0);
+ QVERIFY(mTestObject->mCollectionListener != 0);
+}
+
+// -----------------------------------------------------------------------------
+// testInitializeCollUtilityExists
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionClient::testInitializeUtilCreateFail()
+{
+ MMPXCollectionUtility::setNewLLeave(true);
+ QVERIFY(mTestObject->initialize() < 0);
+ QVERIFY(mTestObject->mCollectionUtility == 0);
+ QVERIFY(mTestObject->mCollectionListener == 0);
+ MMPXCollectionUtility::setNewLLeave(false);
+}
+
+// -----------------------------------------------------------------------------
+// testInitializeCollUtilityExists
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionClient::testInitializeSucceed()
+{
+ MMPXCollectionUtility::setNewLLeave(false);
+ QVERIFY(mTestObject->initialize() == 0);
+ // none exists
+ QVERIFY(mTestObject->initialize() == 0);
+ QVERIFY(mTestObject->mCollectionUtility != 0);
+ QVERIFY(mTestObject->mCollectionListener != 0);
+
+ // both items exists
+ QVERIFY(mTestObject->initialize() == 0);
+ QVERIFY(mTestObject->mCollectionUtility != 0);
+ QVERIFY(mTestObject->mCollectionListener != 0);
+
+ MMPXCollectionUtility::resetCloseCounter();
+ QPointer<VideoCollectionListener> listener = mTestObject->mCollectionListener;
+
+ cleanup();
+
+ 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
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionClient::testCollectionLevel()
+{
+ // no collection utility
+ QVERIFY(mTestObject->getCollectionLevel() == -1);
+
+ QVERIFY(mTestObject->initialize() == 0);
+
+ // path level not setted
+ QVERIFY(mTestObject->getCollectionLevel() == -1);
+
+ // succeeds
+ mTestObject->mCollectionPathLevel = VideoCollectionClient::ELevelCategory;
+ QVERIFY(mTestObject->getCollectionLevel() == VideoCollectionClient::ELevelCategory);
+}
+
+// -----------------------------------------------------------------------------
+// testInitializeCollUtilityExists
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionClient::testGetOpenStatus()
+{
+ QVERIFY(mTestObject->getOpenStatus() == VideoCollectionClient::ECollectionNotOpen);
+
+ mTestObject->setOpenStatus(100);
+
+ QVERIFY(mTestObject->getOpenStatus() == 100);
+}
+
+// -----------------------------------------------------------------------------
+// testInitializeCollUtilityExists
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionClient::testSetOpenStatus()
+{
+ mTestObject->setOpenStatus(VideoCollectionClient::ECollectionNotOpen);
+ QVERIFY(mTestObject->getOpenStatus() == VideoCollectionClient::ECollectionNotOpen);
+
+ mTestObject->setOpenStatus(VideoCollectionClient::ECollectionOpened);
+ QVERIFY(mTestObject->getOpenStatus() == VideoCollectionClient::ECollectionOpened);
+
+ mTestObject->setOpenStatus(100);
+ QVERIFY(mTestObject->getOpenStatus() == 100);
+
+}
+
+// -----------------------------------------------------------------------------
+// testInitializeCollUtilityExists
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionClient::testStartOpenCollection()
+{
+ // no collection utility
+ QVERIFY(mTestObject->startOpenCollection(VideoCollectionClient::ELevelVideos) == -1);
+
+ QVERIFY(mTestObject->startOpenCollection(VideoCollectionClient::ELevelCategory) == -1);
+
+ QVERIFY(mTestObject->initialize() == 0);
+ // open status setted allready
+ mTestObject->setOpenStatus(VideoCollectionClient::ECollectionOpening);
+ QVERIFY(mTestObject->startOpenCollection(VideoCollectionClient::ELevelVideos) == 0);
+ mTestObject->setOpenStatus(VideoCollectionClient::ECollectionOpened);
+ QVERIFY(mTestObject->startOpenCollection(VideoCollectionClient::ELevelVideos) == 0);
+
+ mTestObject->setOpenStatus(VideoCollectionClient::ECollectionOpening);
+ QVERIFY(mTestObject->startOpenCollection(VideoCollectionClient::ELevelCategory) == 0);
+ mTestObject->setOpenStatus(VideoCollectionClient::ECollectionOpened);
+ QVERIFY(mTestObject->startOpenCollection(VideoCollectionClient::ELevelCategory) == 0);
+
+ // open status and level setted allready
+ mTestObject->setOpenStatus(VideoCollectionClient::ECollectionOpening);
+ mTestObject->mCollectionPathLevel = VideoCollectionClient::ELevelVideos;
+ QVERIFY(mTestObject->startOpenCollection(VideoCollectionClient::ELevelVideos) == 0);
+ mTestObject->setOpenStatus(VideoCollectionClient::ECollectionOpened);
+ QVERIFY(mTestObject->startOpenCollection(VideoCollectionClient::ELevelVideos) == 0);
+
+ mTestObject->mCollectionPathLevel = VideoCollectionClient::ELevelCategory;
+ mTestObject->setOpenStatus(VideoCollectionClient::ECollectionOpening);
+ QVERIFY(mTestObject->startOpenCollection(VideoCollectionClient::ELevelCategory) == 0);
+ mTestObject->setOpenStatus(VideoCollectionClient::ECollectionOpened);
+ QVERIFY(mTestObject->startOpenCollection(VideoCollectionClient::ELevelCategory) == 0);
+
+ mTestObject->setOpenStatus(VideoCollectionClient::ECollectionNotOpen);
+ // startOpenCollectionL -leaves
+ MMPXCollection::setOpenLPathLeave(true);
+ QVERIFY(mTestObject->startOpenCollection(VideoCollectionClient::ELevelVideos) < 0);
+
+ QVERIFY(mTestObject->startOpenCollection(VideoCollectionClient::ELevelCategory) < 0);
+
+ MMPXCollection::setOpenLPathLeave(false);
+ QVERIFY(mTestObject->startOpenCollection(VideoCollectionClient::ELevelVideos) == 0);
+ QVERIFY(mTestObject->getOpenStatus() == VideoCollectionClient::ECollectionOpening);
+ int id = 0;
+ int type = 0;
+ mTestObject->getCategoryIds(id, type);
+ QVERIFY(id == KVcxMvcCategoryIdAll);
+ QVERIFY(type == 1);
+
+ mTestObject->setOpenStatus(VideoCollectionClient::ECollectionOpened);
+ QVERIFY(mTestObject->startOpenCollection(VideoCollectionClient::ELevelCategory) == 0);
+ QVERIFY(mTestObject->getOpenStatus() == VideoCollectionClient::ECollectionOpening);
+ mTestObject->getCategoryIds(id, type);
+ QVERIFY(id == 0);
+ QVERIFY(type == 9);
+
+ mTestObject->setOpenStatus(VideoCollectionClient::ECollectionOpened);
+ QVERIFY(mTestObject->startOpenCollection(VideoCollectionClient::ELevelVideos) == 0);
+ QVERIFY(mTestObject->getOpenStatus() == VideoCollectionClient::ECollectionOpening);
+
+}
+
+// -----------------------------------------------------------------------------
+// testStartOpenCurrentState
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionClient::testStartOpenCurrentState()
+{
+ // no collection utility
+ QVERIFY(mTestObject->startOpenCurrentState() == -1);
+ mTestObject->setOpenStatus(VideoCollectionClient::ECollectionNotOpen);
+ QVERIFY(mTestObject->startOpenCurrentState() == -1);
+
+ // collection not opened
+ QVERIFY(mTestObject->initialize() == 0);
+ QVERIFY(mTestObject->startOpenCurrentState() == -1);
+
+ // OpenL -leaves
+ mTestObject->setOpenStatus(VideoCollectionClient::ECollectionOpened);
+ MMPXCollection::setOpenLLeave(true);
+ QVERIFY(mTestObject->startOpenCurrentState() < 0);
+
+ // succeed
+ MMPXCollection::setOpenLLeave(false);
+ QVERIFY(mTestObject->startOpenCurrentState() == 0);
+
+}
+
+// -----------------------------------------------------------------------------
+// testDeleteVideos
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionClient::testDeleteVideos()
+{
+ // no collection utility
+ QVERIFY(mTestObject->deleteVideos(0) == -1);
+ QList<TMPXItemId> ids;
+ QVERIFY(mTestObject->deleteVideos(&ids) == -1);
+
+ QVERIFY(mTestObject->initialize() == 0);
+ // empty list
+ QVERIFY(mTestObject->deleteVideos(&ids) < 0);
+
+ // one item
+ ids.append(TMPXItemId(1,0));
+ MMPXCollection::setCommandLLeave(true);
+ QVERIFY(mTestObject->deleteVideos(&ids) < 0);
+ MMPXCollection::setCommandLLeave(false);
+ QVERIFY(mTestObject->deleteVideos(&ids) == 0);
+
+ // more than one
+ ids.append(TMPXItemId(2,0));
+ ids.append(TMPXItemId(3,0));
+ MMPXCollection::setCommandLLeave(true);
+ QVERIFY(mTestObject->deleteVideos(&ids) < 0);
+ MMPXCollection::setCommandLLeave(false);
+ QVERIFY(mTestObject->deleteVideos(&ids) == 0);
+
+}
+
+// -----------------------------------------------------------------------------
+// testOpenCategory
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionClient::testOpenCategory()
+{
+ TMPXItemId id(0,0);
+ // no collection utility
+ QVERIFY(mTestObject->openVideo(id) == -1);
+
+ // collection exists
+ QVERIFY(mTestObject->initialize() == 0);
+
+ MMPXCollection::setOpenLPathLeave(true);
+ QVERIFY(mTestObject->openVideo(id)< 0);
+
+ MMPXCollection::setOpenLPathLeave(false);
+
+
+ mTestObject->mCollectionPathLevel = VideoCollectionClient::ELevelCategory;
+ QVERIFY(mTestObject->openVideo(id) == 0);
+
+}
+
+// -----------------------------------------------------------------------------
+// testOpenVideo
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionClient::testOpenVideo()
+{
+ TMPXItemId id(0,0);
+ // no collection utility
+ QVERIFY(mTestObject->openVideo(id) == -1);
+
+ // collection exists
+ QVERIFY(mTestObject->initialize() == 0);
+ mTestObject->mCollectionPathLevel = VideoCollectionClient::ELevelVideos;
+ MMPXCollection::setOpenLPathLeave(true);
+ QVERIFY(mTestObject->openVideo(id)< 0);
+ MMPXCollection::setOpenLPathLeave(false);
+
+ QVERIFY(mTestObject->openVideo(id) == 0);
+}
+
+// -----------------------------------------------------------------------------
+// testFetchMpxMediaByMpxId
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionClient::testFetchMpxMediaByMpxId()
+{
+ // no collection utility
+ TMPXItemId id;
+ QVERIFY(mTestObject->fetchMpxMediaByMpxId(id) == -1);
+
+ // collection exists
+ QVERIFY(mTestObject->initialize() == 0);
+
+ MMPXCollection::setCommandLLeave(true);
+ QVERIFY(mTestObject->fetchMpxMediaByMpxId(id) < 0);
+
+ MMPXCollection::setCommandLLeave(false);
+ QVERIFY(mTestObject->fetchMpxMediaByMpxId(id) == 0);
+
+}
+
+// -----------------------------------------------------------------------------
+// testGetVideoDetails
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionClient::testGetVideoDetails()
+{
+ // no collection utility
+ TMPXItemId id(0,0);
+ QVERIFY(mTestObject->getVideoDetails(id) == -1);
+
+ // collection exists
+ QVERIFY(mTestObject->initialize() == 0);
+
+ MMPXCollection::setCommandLLeave(true);
+ QVERIFY(mTestObject->getVideoDetails(id) < 0);
+
+ MMPXCollection::setCommandLLeave(false);
+ QVERIFY(mTestObject->getVideoDetails(id) == 0);
+
+}
+
+// -----------------------------------------------------------------------------
+// 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
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionClient::testAddNewCollection()
+{
+
+ QFETCH(QString, name);
+ QFETCH(QString, thumb);
+ QFETCH(QList<TMPXItemId>, ids);
+
+ QCOMPARE(mTestObject->addNewCollection(name, thumb, ids), -1);
+
+ mTestObject->initialize();
+
+ QCOMPARE(mTestObject->addNewCollection(name, thumb, ids), 0);
+
+ // TODO needs proper verification after the method has been fully implemented.
+}
+
+// -----------------------------------------------------------------------------
+// testBack
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionClient::testBack()
+{
+
+ CMPXCollectionPath::setLevel(3);
+ // not initialized
+ QVERIFY(mTestObject->back() == -1);
+
+ QVERIFY(mTestObject->initialize() == 0);
+ mTestObject->mCollectionPathLevel = VideoCollectionClient::ELevelVideos;
+ MMPXCollection::setBackLLeave(true);
+ QVERIFY(mTestObject->back()< 0);
+ MMPXCollection::setBackLLeave(false);
+ QVERIFY(mTestObject->back() == 0);
+
+ mTestObject->mCollectionPathLevel = VideoCollectionClient::ELevelCategory;
+ QVERIFY(mTestObject->back() == 0);
+}
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionclient/stub/inc/stubcollectionsignalclasses.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,373 @@
+/**
+* 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/src/stubcollectionsignalclasses.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,163 @@
+/**
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: stub 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/testvideocollectionclient.pro Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,56 @@
+# #####################################################################
+# Automatically generated by qmake (2.01a) Tue 5. May 13:25:42 2009
+# #####################################################################
+TEMPLATE = app
+TARGET =
+DEPENDPATH += . \
+ inc \
+ src \
+ stub/src \
+ stub/inc
+
+CONFIG += qtestlib \
+ Hb \
+ symbian_test
+
+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
+
+LIBS += -lflogger.dll \
+ -lestor.dll \
+ -lfbscli.dll \
+ -lbitgdi.dll \
+ -lgdi.dll
+
+# Input
+HEADERS += inc/testvideocollectionclient.h \
+ stub/inc/mpxcollectionutility.h \
+ stub/inc/mpxcollectionpath.h \
+ stub/inc/mpxmedia.h \
+ stub/inc/mpxmediaarray.h \
+ stub/inc/mpxattribute.h \
+ stub/inc/stubcollectionsignalclasses.h \
+ stub/inc/videocollectionlistener.h \
+ ../../inc/videodatasignalreceiver.h \
+ ../../inc/videocollectionclient.h
+
+SOURCES += src/testvideocollectionclient.cpp \
+ stub/src/mpxcollectionutility.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/src/testvideocollectionlistener.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,1085 @@
+
+/**
+* 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
+*
+*/
+
+
+// INCLUDES
+#include <e32cmn.h>
+#include <mpxmediacontainerdefs.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmessagecontainerdefs.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxcollectioncommanddefs.h>
+#include <mpxcollectionmessage.h>
+#include <vcxmyvideosdefs.h>
+#include <vcxmyvideosuids.h>
+#include "testvideocollectionlistener.h"
+#include "mediaobjectfactory.h"
+#include "stub/inc/stubsignalreceiver.h"
+#include "stub/inc/stubcollection.h"
+
+#include "videocollectionutils.h"
+
+#define private public
+#include "videocollectionlistener.h"
+#undef private
+
+
+// -----------------------------------------------------------------------------
+// main
+// -----------------------------------------------------------------------------
+//
+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);
+
+ return res;
+}
+
+// -----------------------------------------------------------------------------
+// initTestCase
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionListener::initTestCase()
+{
+ mMediaFactory = new MediaObjectFactory();
+}
+
+// -----------------------------------------------------------------------------
+// init
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionListener::init()
+{
+ mStubCollectionClient = new VideoCollectionClient();
+
+ mTestObject = new VideoCollectionListener(*mStubCollectionClient);
+
+ 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)));
+}
+
+// -----------------------------------------------------------------------------
+// cleanup
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionListener::cleanup()
+{
+ delete mTestObject;
+ mTestObject = 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;
+}
+
+// -----------------------------------------------------------------------------
+// cleanupTestCase
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionListener::cleanupTestCase()
+{
+ delete mMediaFactory;
+}
+
+// -----------------------------------------------------------------------------
+// testHandleCollectionMediaL
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionListener::testHandleCollectionMediaLFunc()
+{
+ StubSignalReceiver receiver;
+ QVERIFY(connectSignals(&receiver));
+ // nothing to test here, because
+ // currently HandleCollectionMediaL is empty implementation required
+ // by the inheritance of MMPXCollectionObserver.
+ User::Heap().__DbgMarkStart();
+
+ CMPXMedia *media = NULL;
+ TRAP_IGNORE(media = CMPXMedia::NewL());
+ mStubCollection->callHandleCollectionMediaLFunc(*media, 0);
+ delete media;
+
+ QVERIFY(!hasSignalsEmitted());
+ QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
+ QVERIFY(receiver.getLatestPointerAddr() == 0);
+
+ int remHeap = User::Heap().__DbgMarkEnd(0);
+ QVERIFY(remHeap == 0);
+}
+
+// -----------------------------------------------------------------------------
+// testHandleOpenLMediaFunc
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionListener::testHandleOpenLMediaFunc()
+{
+ StubSignalReceiver receiver;
+ QVERIFY(connectSignals(&receiver));
+
+ User::Heap().__DbgMarkStart();
+
+ mStubCollectionClient->setCollectionLevel(VideoCollectionClient::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);
+
+ // 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);
+
+ // 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);
+
+ // signal emitting: correct media-array passed
+ CMPXMediaArray *array = mMediaFactory->newMediaArray();
+
+ // 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);
+
+ // 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);
+
+ mStubCollectionClient->setCollectionLevel(VideoCollectionClient::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);
+ mStubCollection->callHandleOpenLFunc(*media, 0, true, 0 );
+
+ QVERIFY(receiver.getLatestPointerAddr() != 0);
+ QVERIFY(mSpyNewVideoList->count() == 2);
+ QVERIFY(mSpyVideoListAppended->count() == 0);
+
+ mStubCollection->callHandleOpenLFunc(*media, 0, true, 0 );
+
+ QVERIFY(receiver.getLatestPointerAddr() != 0);
+ QVERIFY(mSpyNewVideoList->count() == 2);
+ QVERIFY(mSpyVideoListAppended->count() == 1);
+
+
+ CMPXMediaArray *gottenArray = static_cast<CMPXMediaArray*>(receiver.getLatestPointerAddr());
+ QVERIFY(gottenArray->Count() == 3);
+
+ TMPXItemId 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);
+
+ delete array;
+ delete media;
+ mSpyNewVideoList->clear();
+ mSpyVideoListAppended->clear();
+ QVERIFY(!hasSignalsEmitted());
+ QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
+
+ int remHeap = User::Heap().__DbgMarkEnd(0);
+ QVERIFY(remHeap == 0);
+}
+
+// -----------------------------------------------------------------------------
+// testHandleOpenLPlaylistFunc
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionListener::testHandleOpenLPlaylistFunc()
+{
+ StubSignalReceiver receiver;
+ QVERIFY(connectSignals(&receiver));
+
+ // nothing to test here, because
+ // currently HandleCollectionMediaL is empty implementation required
+ // by the inheritance of MMPXCollectionObserver.
+ User::Heap().__DbgMarkStart();
+ CMPXCollectionPlaylist *plList = 0;
+
+ mStubCollection->callHandleOpenLFunc(*plList, 0);
+
+ QVERIFY(!hasSignalsEmitted());
+ QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
+ QVERIFY(receiver.getLatestPointerAddr() == 0);
+
+ int remHeap = User::Heap().__DbgMarkEnd(0);
+ QVERIFY(remHeap == 0);
+}
+
+// -----------------------------------------------------------------------------
+// testHandleCommandComplete
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionListener::testHandleCommandComplete()
+{
+ StubSignalReceiver receiver;
+ QVERIFY(connectSignals(&receiver));
+
+ User::Heap().__DbgMarkStart();
+
+ CMPXCommand *pCommand = mMediaFactory->newMedia(0);
+
+ // error != KErrNone
+ mStubCollection->callHandleCommandComplete(pCommand, -2);
+ QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
+ QVERIFY(mSpyVideoDetailsCompleted->count() == 0);
+
+ // command == NULL
+ mStubCollection->callHandleCommandComplete(0, 0);
+ QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
+ QVERIFY(mSpyVideoDetailsCompleted->count() == 0);
+
+ // null command + error != KErrNone
+ mStubCollection->callHandleCommandComplete(0, -2);
+ QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
+ QVERIFY(mSpyVideoDetailsCompleted->count() == 0);
+
+ // command without id
+ delete pCommand;
+ pCommand = mMediaFactory->newMedia();
+ mStubCollection->callHandleCommandComplete(pCommand, 0);
+ QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
+ QVERIFY(mSpyVideoDetailsCompleted->count() == 0);
+
+ // no command attribute
+ delete pCommand;
+ pCommand = mMediaFactory->newMedia(0);
+ mStubCollection->callHandleCommandComplete(pCommand, 0);
+ QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
+ QVERIFY(mSpyVideoDetailsCompleted->count() == 0);
+
+ // 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);
+
+ // 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);
+
+ // NOTE! we cannot test with item without KMPXMediaGeneralId, because after creation CMPXMedia
+ // always contain default value
+
+ // correct item
+ CMPXMedia *subMedia = mMediaFactory->newMedia(10);
+ mMediaFactory->putValuePtr<CMPXMedia>(pCommand, KMPXCommandColAddMedia, subMedia);
+ mStubCollection->callHandleCommandComplete(pCommand, 0);
+ QVERIFY(receiver.getLatestItemId().iId1 == 10);
+ QVERIFY(mSpyVideoDetailsCompleted->count() == 1);
+ delete subMedia;
+ delete pCommand;
+ mSpyVideoDetailsCompleted->clear();
+
+ QVERIFY(!hasSignalsEmitted());
+ QVERIFY(receiver.getLatestPointerAddr() == 0);
+
+ int remHeap = User::Heap().__DbgMarkEnd(0);
+ QVERIFY(remHeap == 0);
+}
+
+// -----------------------------------------------------------------------------
+// testCollectionMessageError
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionListener::testCollectionMessageError()
+{
+ StubSignalReceiver receiver;
+ QVERIFY(connectSignals(&receiver));
+
+ User::Heap().__DbgMarkStart();
+
+ CMPXMessage *message = mMediaFactory->newMedia(0);
+
+ // correct message, error != KErrNone
+ mStubCollection->callHandleCollectionMessage(message, -1);
+ QVERIFY(mStubCollectionClient->getOpenStatus() == -1);
+
+ // message does not contain KMPXMessageGeneralId
+ mStubCollection->callHandleCollectionMessage(message, 0);
+ QVERIFY(mStubCollectionClient->getOpenStatus() == -1);
+
+ delete message;
+
+ // empty message
+ 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);
+
+ int remHeap = User::Heap().__DbgMarkEnd(0);
+ QVERIFY(remHeap == 0);
+}
+
+// -----------------------------------------------------------------------------
+// testCollectionMessageNotOpened
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionListener::testCollectionMessageNotOpened()
+{
+ StubSignalReceiver receiver;
+ QVERIFY(connectSignals(&receiver));
+
+ User::Heap().__DbgMarkStart();
+ mStubCollectionClient->setOpenStatus( VideoCollectionClient::ECollectionOpening);
+
+ // collection not opened, empty message
+ mStubCollection->callHandleCollectionMessage(0, 0);
+ QVERIFY(mStubCollectionClient->getOpenStatus() == VideoCollectionClient::ECollectionOpening);
+
+ // collection not opened, no msg id
+ CMPXMessage *message = mMediaFactory->newMedia(0);
+ mStubCollection->callHandleCollectionMessage(message, 0);
+ QVERIFY(mStubCollectionClient->getOpenStatus() == VideoCollectionClient::ECollectionOpening);
+
+ TMPXMessageId msgId = 1;
+ mMediaFactory->putTValue<TMPXMessageId>(message, KMPXMessageGeneralId, msgId);
+
+ // collection not opened, invalid msg id
+ mStubCollection->callHandleCollectionMessage(message, 0);
+ QVERIFY(mStubCollectionClient->getOpenStatus() == VideoCollectionClient::ECollectionOpening);
+
+ msgId = KMPXMessageGeneral;
+ mMediaFactory->putTValue<TMPXMessageId>(message, KMPXMessageGeneralId, msgId);
+
+ // collection not opened, correct msg id, missing all details
+ mStubCollection->callHandleCollectionMessage(message, 0);
+ QVERIFY(mStubCollectionClient->getOpenStatus() == VideoCollectionClient::ECollectionOpening);
+
+ int value = -1;
+ mMediaFactory->putTValue<int>(message, KMPXMessageGeneralEvent, value);
+
+ // collection not opened, correct msg id, missing KMPXMessageGeneralData
+ mStubCollection->callHandleCollectionMessage(message, 0);
+ QVERIFY(mStubCollectionClient->getOpenStatus() == VideoCollectionClient::ECollectionOpening);
+
+ delete message;
+ message = mMediaFactory->newMedia(0);
+ mMediaFactory->putTValue<TMPXMessageId>(message, KMPXMessageGeneralId, msgId);
+ mMediaFactory->putTValue<int>(message, KMPXMessageGeneralData, value);
+
+ // collection not opened, correct msg id, missing KMPXMessageGeneralEvent
+ mStubCollection->callHandleCollectionMessage(message, 0);
+ QVERIFY(mStubCollectionClient->getOpenStatus() == VideoCollectionClient::ECollectionOpening);
+
+ mMediaFactory->putTValue<int>(message, KMPXMessageGeneralEvent, value);
+
+ // collection not opened, correct msg id, invalid detail values
+ mStubCollection->callHandleCollectionMessage(message, 0);
+ QVERIFY(mStubCollectionClient->getOpenStatus() == VideoCollectionClient::ECollectionOpening);
+
+ value = EMcContainerOpened;
+ mMediaFactory->putTValue<int>(message, KMPXMessageGeneralData, value);
+
+ // collection not opened, correct msg id, invalid KMPXMessageGeneralEvent value
+ mStubCollection->callHandleCollectionMessage(message, 0);
+ QVERIFY(mStubCollectionClient->getOpenStatus() == VideoCollectionClient::ECollectionOpening);
+
+ value = -1;
+ mMediaFactory->putTValue<int>(message, KMPXMessageGeneralData, value);
+ value = TMPXCollectionMessage::EPathChanged;
+ mMediaFactory->putTValue<int>(message, KMPXMessageGeneralEvent, value);
+
+ // collection not opened, correct msg id, invalid KMPXMessageGeneralData value
+ mStubCollection->callHandleCollectionMessage(message, 0);
+ QVERIFY(mStubCollectionClient->getOpenStatus() == VideoCollectionClient::ECollectionOpening);
+
+ value = EMcContainerOpened;
+ mMediaFactory->putTValue<int>(message, KMPXMessageGeneralData, value);
+ mStubCollectionClient->setOpenStatus(-1);
+ // correct message, open status != CVideoCollectionClient::ECollectionOpening
+ mStubCollection->callHandleCollectionMessage(message, 0);
+ QVERIFY(mStubCollectionClient->getOpenStatus() == -1);
+
+ mStubCollectionClient->setOpenStatus(VideoCollectionClient::ECollectionOpening);
+ // correct message, open status == CVideoCollectionClient::ECollectionOpening
+ 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);
+
+ delete message;
+
+ int remHeap = User::Heap().__DbgMarkEnd(0);
+ QVERIFY(remHeap == 0);
+}
+
+// -----------------------------------------------------------------------------
+// testCollectionMessageMyVidCommandId
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionListener::testCollectionMessageMyVidCommandId()
+{
+ StubSignalReceiver receiver;
+ QVERIFY(connectSignals(&receiver));
+
+ User::Heap().__DbgMarkStart();
+
+ mStubCollectionClient->setOpenStatus(VideoCollectionClient::ECollectionOpened);
+ CMPXMessage *message = mMediaFactory->newMedia(0);
+ TMPXMessageId msgId = KVcxCommandIdMyVideos;
+ mMediaFactory->putTValue<TMPXMessageId>(message, KMPXMessageGeneralId, msgId);
+
+ // KMPXMessageCollectionId != KVcxUidMyVideosMpxCollection
+ mStubCollection->callHandleCollectionMessage(message, 0);
+
+ TUid uid = {KVcxUidMyVideosMpxCollection};
+ mMediaFactory->putTValue<TUid>(message, KMPXMessageCollectionId, uid);
+
+ // does not contain KVcxMediaMyVideosCommandId
+ mStubCollection->callHandleCollectionMessage(message, 0);
+
+ int value = KVcxMessageMyVideosMessageArray + 1;
+ mMediaFactory->putTValue<int>( message, KVcxMediaMyVideosCommandId, value);
+
+ // non KVcxMessageMyVideosMessageArray, invalid value
+ // (this is tested throughoutly in testCollectionMessageNonMyVidMsgArray)
+ mStubCollection->callHandleCollectionMessage(message, 0);
+
+ value = KVcxMessageMyVideosMessageArray;
+ mMediaFactory->putTValue<int>( message, KVcxMediaMyVideosCommandId, value);
+ CMPXMediaArray *nullArray = 0;
+ mMediaFactory->putValuePtr<CMPXMediaArray>(message, KMPXMediaArrayContents, nullArray);
+ // KVcxMessageMyVideosMessageArray, but no contents.
+ // (this is tested throughoutly in testCollectionMessageMyVidMsgArray)
+ 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);
+
+ int remHeap = User::Heap().__DbgMarkEnd(0);
+ QVERIFY(remHeap == 0);
+
+}
+
+// -----------------------------------------------------------------------------
+// testHandleMyVideosMessageArray
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionListener::testHandleMyVideosMessageArray()
+{
+ StubSignalReceiver receiver;
+ QVERIFY(connectSignals(&receiver));
+
+ User::Heap().__DbgMarkStart();
+
+ mStubCollectionClient->setOpenStatus(VideoCollectionClient::ECollectionOpened);
+ CMPXMessage *message = mMediaFactory->newMedia(0);
+ TMPXMessageId msgId = KVcxCommandIdMyVideos;
+ mMediaFactory->putTValue<TMPXMessageId>(message, KMPXMessageGeneralId, msgId);
+ TUid uid = {KVcxUidMyVideosMpxCollection};
+ mMediaFactory->putTValue<TUid>(message, KMPXMessageCollectionId, uid);
+ int value = KVcxMessageMyVideosMessageArray;
+ mMediaFactory->putTValue<int>( message, KVcxMediaMyVideosCommandId, value);
+
+ // no message array
+ mStubCollection->callHandleCollectionMessage(message, 0);
+
+ // CMPXMedia *subMedia = mMediaFactory->newMedia(0);
+ // mMediaFactory->putValuePtr<CMPXMedia>( message, KMPXMessageArrayContents, subMedia);
+ //////////////////
+ // NOTE
+ // We cannot test case where message containsCMPXMedia instead of CMPXMessageArray.
+ // collection fw does not support type check of pointers. Whatever pointer we have it is supported as long as
+ // it is saved into message with correct attribute.
+ //
+ // this kind of situation causes crash in application because we cannot validate type.
+
+ // mStubCollection->callHandleCollectionMessage(message, 0);
+ // delete subMedia;
+ CMPXMediaArray *array = mMediaFactory->newMediaArray();
+ mMediaFactory->putValuePtr<CMPXMediaArray>( message, KMPXMessageArrayContents, array);
+
+ // empty message array
+ mStubCollection->callHandleCollectionMessage(message, 0);
+
+ mMediaFactory->putArrayContent(array, mMediaFactory->newMedia(1));
+ mMediaFactory->putArrayContent(array, mMediaFactory->newMedia(2));
+ mMediaFactory->putArrayContent(array, mMediaFactory->newMedia(3));
+ mMediaFactory->putArrayContent(array, mMediaFactory->newMedia(4));
+
+ // message array containing invalid ( == empty) items
+ mStubCollection->callHandleCollectionMessage(message, 0);
+
+ delete array;
+ array = mMediaFactory->newMediaArray();
+ CMPXMedia *media = 0;
+
+ value = 0;
+ media = mMediaFactory->newMedia(1);
+ mMediaFactory->putTValue<int>(media, KVcxMediaMyVideosCommandId, value );
+ mMediaFactory->putArrayContent(array, media);
+ value = -1;
+ media = mMediaFactory->newMedia(2);
+ mMediaFactory->putTValue<int>(media, KVcxMediaMyVideosCommandId, value );
+ mMediaFactory->putArrayContent(array, media);
+ value = -2;
+ media = mMediaFactory->newMedia(3);
+ mMediaFactory->putTValue<int>(media, KVcxMediaMyVideosCommandId, value );
+ mMediaFactory->putArrayContent(array, media);
+
+ mMediaFactory->putValuePtr<CMPXMediaArray>( message, KMPXMessageArrayContents, array);
+
+ // message array containing KVcxMediaMyVideosCommandId -typed items
+ mStubCollection->callHandleCollectionMessage(message, 0);
+
+ delete array;
+ array = mMediaFactory->newMediaArray();
+ TMPXMessageId valueid = 1;
+ media = mMediaFactory->newMedia(1);
+ mMediaFactory->putTValue<TMPXMessageId>(media, KMPXMessageGeneralId, valueid );
+ mMediaFactory->putArrayContent(array, media);
+ valueid = 2;
+ media = mMediaFactory->newMedia(2);
+ mMediaFactory->putTValue<TMPXMessageId>(media, KMPXMessageGeneralId, valueid );
+ mMediaFactory->putArrayContent(array, media);
+ valueid = 3;
+ media = mMediaFactory->newMedia(3);
+ mMediaFactory->putTValue<TMPXMessageId>(media, KMPXMessageGeneralId, valueid );
+ mMediaFactory->putArrayContent(array, media);
+
+ mMediaFactory->putValuePtr<CMPXMediaArray>( message, KMPXMessageArrayContents, array);
+
+ // message array containing KMPXMessageGeneralId -typed items
+ mStubCollection->callHandleCollectionMessage(message, 0);
+
+ delete array;
+ array = mMediaFactory->newMediaArray();
+ valueid = 0;
+ media = mMediaFactory->newMedia(1);
+ mMediaFactory->putTValue<TMPXMessageId>(media, KMPXMessageGeneralId, valueid );
+ mMediaFactory->putArrayContent(array, media);
+ value = 1;
+ media = mMediaFactory->newMedia(2);
+ mMediaFactory->putTValue<TMPXMessageId>(media, KVcxMediaMyVideosCommandId, valueid );
+ mMediaFactory->putArrayContent(array, media);
+ valueid = 2;
+ media = mMediaFactory->newMedia(3);
+ mMediaFactory->putTValue<TMPXMessageId>(media, KMPXMessageGeneralId, valueid );
+ mMediaFactory->putArrayContent(array, media);
+
+ mMediaFactory->putValuePtr<CMPXMediaArray>( message, KMPXMessageArrayContents, array);
+
+ // message array contains both KVcxMediaMyVideosCommandId and KMPXMessageGeneralId typed items
+ 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);
+
+ int remHeap = User::Heap().__DbgMarkEnd(0);
+ QVERIFY(remHeap == 0);
+}
+
+// -----------------------------------------------------------------------------
+// testHandleMyVideosMPXMessage
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionListener::testHandleMyVideosMPXMessage()
+{
+ // tests all other my videos msg ids than KVcxMessageMyVideosDeleteResp.
+ // it is tested in testMyVideosDeleteMsgArray
+
+ StubSignalReceiver receiver;
+ QVERIFY(connectSignals(&receiver));
+
+ User::Heap().__DbgMarkStart();
+
+ mStubCollectionClient->setOpenStatus(VideoCollectionClient::ECollectionOpened);
+ CMPXMessage *message = mMediaFactory->newMedia(0);
+ TMPXMessageId msgId = KVcxCommandIdMyVideos;
+ mMediaFactory->putTValue<TMPXMessageId>(message, KMPXMessageGeneralId, msgId);
+ TUid uid = {KVcxUidMyVideosMpxCollection};
+ mMediaFactory->putTValue<TUid>(message, KMPXMessageCollectionId, uid);
+
+ // msg ids, that should not cause any additional funtionality (verified at the end of the method)
+ int value = KVcxMessageMyVideosDeleteStarted;
+ mMediaFactory->putTValue<int>( message, KVcxMediaMyVideosCommandId, value);
+ mStubCollection->callHandleCollectionMessage(message, 0);
+
+ value = KVcxMessageMyVideosMoveOrCopyStarted;
+ mMediaFactory->putTValue<int>( message, KVcxMediaMyVideosCommandId, value);
+ mStubCollection->callHandleCollectionMessage(message, 0);
+
+ value = KVcxMessageMyVideosMoveResp;
+ mMediaFactory->putTValue<int>( message, KVcxMediaMyVideosCommandId, value);
+ mStubCollection->callHandleCollectionMessage(message, 0);
+
+ value = KVcxMessageMyVideosCopyResp;
+ mMediaFactory->putTValue<int>( message, KVcxMediaMyVideosCommandId, value);
+ mStubCollection->callHandleCollectionMessage(message, 0);
+
+ // Handling of KVcxMessageMyVideosItemsAppended
+ VideoCollectionClient::mStartOpenCurrentStateCallCount = 0;
+ value = KVcxMessageMyVideosItemsAppended;
+ mMediaFactory->putTValue<int>( message, KVcxMediaMyVideosCommandId, value);
+ mStubCollection->callHandleCollectionMessage(message, 0);
+ QCOMPARE(VideoCollectionClient::mStartOpenCurrentStateCallCount, 1);
+
+ // Handling of // Handling of KVcxMessageMyVideosItemsAppended
+ VideoCollectionClient::mStartOpenCurrentStateCallCount = 0;
+ value = KVcxMessageMyVideosListComplete;
+ mMediaFactory->putTValue<int>( message, KVcxMediaMyVideosCommandId, value);
+ mStubCollection->callHandleCollectionMessage(message, 0);
+ QCOMPARE(VideoCollectionClient::mStartOpenCurrentStateCallCount, 1);
+
+ //////
+ // KVcxMessageMyVideosGetMediasByMpxIdResp
+ value = KVcxMessageMyVideosGetMediasByMpxIdResp;
+ mMediaFactory->putTValue<int>( message, KVcxMediaMyVideosCommandId, value);
+
+ // no contents
+ mStubCollection->callHandleCollectionMessage(message, 0);
+ QVERIFY(mSpyNewVideoAvailable->count() == 0);
+ QVERIFY(receiver.getLatestPointerAddr() == 0);
+ QVERIFY(receiver.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);
+
+ 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());
+ int fetchedId = -1;
+ VideoCollectionUtils::instance().mediaValue<int>(fetched, KMPXMediaGeneralId, fetchedId );
+ QVERIFY(fetchedId == 10);
+
+ mSpyNewVideoAvailable->clear();
+ 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);
+}
+
+// -----------------------------------------------------------------------------
+// testCollectionMessageNonMyVidMsgArray
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionListener::testMyVideosDeleteMsgArray()
+{
+ StubSignalReceiver receiver;
+ QVERIFY(connectSignals(&receiver));
+
+ User::Heap().__DbgMarkStart();
+
+ mStubCollectionClient->setOpenStatus(VideoCollectionClient::ECollectionOpened);
+ CMPXMessage *message = mMediaFactory->newMedia(0);
+ TMPXMessageId msgId = KVcxCommandIdMyVideos;
+ mMediaFactory->putTValue<TMPXMessageId>(message, KMPXMessageGeneralId, msgId);
+ TUid uid = {KVcxUidMyVideosMpxCollection};
+ mMediaFactory->putTValue<TUid>(message, KMPXMessageCollectionId, uid);
+
+ int value = KVcxMessageMyVideosDeleteResp;
+ mMediaFactory->putTValue<int>( message, KVcxMediaMyVideosCommandId, value);
+
+ // null array mSpyVideoDeleteCompleted->count()
+ mStubCollection->callHandleCollectionMessage(message, 0);
+ QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
+ QVERIFY(receiver.getLatestPointerAddr() == 0);
+ QVERIFY(receiver.getLatestIntegerData() == -1);
+ QVERIFY(mSpyVideoDeleteCompleted->count() == 0);
+
+ // 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);
+
+ // item(s) does not contain KVcxMediaMyVideosInt32Value
+ mMediaFactory->putArrayContent( array, mMediaFactory->newMedia(1));
+ mMediaFactory->putArrayContent( array, mMediaFactory->newMedia(2));
+ mMediaFactory->putArrayContent( array, mMediaFactory->newMedia(3));
+ 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();
+
+ delete array;
+ array = mMediaFactory->newMediaArray();
+ mMediaFactory->putValuePtr<CMPXMediaArray>( message, KMPXMediaArrayContents, array);
+
+ // item(s) containing KVcxMediaMyVideosInt32Value -values, both incorrect (1) and correct (3)
+ CMPXMedia *media = 0;
+ mMediaFactory->putArrayContent( array, mMediaFactory->newMedia(1));
+
+ media = mMediaFactory->newMedia(2);
+ value = 1;
+ mMediaFactory->putTValue<int>( media, KVcxMediaMyVideosInt32Value, value);
+ mMediaFactory->putArrayContent( array, media);
+
+ media = mMediaFactory->newMedia(3);
+ value = 1;
+ mMediaFactory->putTValue<int>( media, KVcxMediaMyVideosInt32Value, value);
+ mMediaFactory->putArrayContent( array, media);
+
+ media = mMediaFactory->newMedia(4);
+ value = 0;
+ mMediaFactory->putTValue<int>( media, KVcxMediaMyVideosInt32Value, value);
+ mMediaFactory->putArrayContent( array, media);
+
+ media = mMediaFactory->newMedia(5);
+ value = 1;
+ mMediaFactory->putTValue<int>( media, KVcxMediaMyVideosInt32Value, value);
+ mMediaFactory->putArrayContent( array, media);
+
+ 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();
+ delete array;
+ delete message;
+
+ QVERIFY(!hasSignalsEmitted());
+
+ int remHeap = User::Heap().__DbgMarkEnd(0);
+ QVERIFY(remHeap == 0);
+}
+
+// -----------------------------------------------------------------------------
+// testCollectionMessageNonMyVidCommandId
+// -----------------------------------------------------------------------------
+//
+void TestVideoCollectionListener::testHandleMPXMessage()
+{
+ StubSignalReceiver receiver;
+ QVERIFY(connectSignals(&receiver));
+
+ User::Heap().__DbgMarkStart();
+
+ mStubCollectionClient->setOpenStatus(VideoCollectionClient::ECollectionOpened);
+ CMPXMessage *message = mMediaFactory->newMedia(0);
+ TMPXMessageId msgId = KMPXMessageGeneral;
+ mMediaFactory->putTValue<TMPXMessageId>(message, KMPXMessageGeneralId, msgId);
+ TUid uid = {KVcxUidMyVideosMpxCollection};
+ mMediaFactory->putTValue<TUid>(message, KMPXMessageCollectionId, uid);
+
+ // 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());
+
+
+ // invalid
+ msgId = KMPXMessageIdItemChanged + 1;
+ mStubCollection->callHandleCollectionMessage(message, 0);
+ QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
+ QVERIFY(receiver.getLatestPointerAddr() == 0);
+ QVERIFY(!hasSignalsEmitted());
+
+ // KMPXMessageIdItemChanged with no content
+ mStubCollectionClient->setCollectionLevel(VideoCollectionClient::ELevelVideos);
+ msgId = KMPXMessageIdItemChanged;
+ mMediaFactory->putTValue<TMPXMessageId>(message, KMPXMessageGeneralId, msgId);
+ mStubCollection->callHandleCollectionMessage(message, 0);
+ QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
+ QVERIFY(receiver.getLatestPointerAddr() == 0);
+ QVERIFY(!hasSignalsEmitted());
+
+ // KMPXMessageIdItemChanged with level != CVideoCollectionClient::ELevelVideos
+ mStubCollectionClient->setCollectionLevel(VideoCollectionClient::ELevelVideos - 1);
+ mStubCollection->callHandleCollectionMessage(message, 0);
+ QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
+ QVERIFY(receiver.getLatestPointerAddr() == 0);
+ QVERIFY(!hasSignalsEmitted());
+
+ // KMPXMessageIdItemChanged with existing, not handled event type with missing KMPXMessageMediaGeneralId
+ mStubCollectionClient->setCollectionLevel(VideoCollectionClient::ELevelVideos);
+ TMPXChangeEventType eventType = EMPXItemModified;
+ mMediaFactory->putTValue<TMPXChangeEventType>(message, KMPXMessageChangeEventType, eventType);
+ mStubCollection->callHandleCollectionMessage(message, 0);
+ QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
+ QVERIFY(receiver.getLatestPointerAddr() == 0);
+ QVERIFY(!hasSignalsEmitted());
+
+ // KMPXMessageIdItemChanged with existing, not handled event type
+ TMPXItemId eventId;
+ eventId.iId1 = 10;
+ mMediaFactory->putTValue<TMPXItemId>(message, KMPXMessageMediaGeneralId, eventId);
+ mStubCollection->callHandleCollectionMessage(message, 0);
+ QVERIFY(receiver.getLatestItemId() == TMPXItemId::InvalidId());
+ QVERIFY(receiver.getLatestPointerAddr() == 0);
+ QVERIFY(!hasSignalsEmitted());
+
+ // KMPXMessageIdItemChanged with EMPXItemDeleted event type
+ eventType = EMPXItemDeleted;
+ mMediaFactory->putTValue<TMPXChangeEventType>(message, KMPXMessageChangeEventType, eventType);
+ mStubCollection->callHandleCollectionMessage(message, 0);
+ QVERIFY(receiver.getLatestItemId().iId1 == 10);
+ QVERIFY(receiver.getLatestPointerAddr() == 0);
+ QVERIFY(mSpyVideoDeleted->count() == 1);
+ mSpyVideoDeleted->clear();
+ QVERIFY(!hasSignalsEmitted());
+
+ receiver.resetLatestItems();
+ // KMPXMessageIdItemChanged with EMPXItemInserted event type with no correct id2
+ 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);
+ // mpx id should have not changed into 10
+ QVERIFY(mStubCollectionClient->getLatestMPXId() == 0);
+ QVERIFY(!hasSignalsEmitted());
+
+ // 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(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());
+ int fetchedId = -1;
+ VideoCollectionUtils::instance().mediaValue<int>(gotten, KMPXMediaGeneralId, fetchedId );
+ QVERIFY(fetchedId == 11);
+ mSpyNewVideoAvailable->clear();
+ QVERIFY(!hasSignalsEmitted());
+
+ delete media;
+ delete message;
+ 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/stubsignalreceiver.h Thu Apr 01 22:38:49 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 signal receiver for testing VideoCollectionListener
+*
+*/
+
+#ifndef __CSTUBSIGNALRECEIVER_H__
+#define __CSTUBSIGNALRECEIVER_H__
+
+#include <QObject>
+#include <mpxcollectionmessagedefs.h>
+#include <mpxitemid.h>
+#include <mpxmediaarray.h>
+#include <mpxmedia.h>
+#include <Qlist>
+
+
+class StubSignalReceiver : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * contructor
+ */
+ StubSignalReceiver();
+
+ /**
+ * destructor
+ */
+ virtual ~StubSignalReceiver();
+
+ /**
+ * clears all members
+ */
+ void resetLatestItems();
+
+ /**
+ * return mLatestPtr
+ */
+ void* getLatestPointerAddr();
+
+ /**
+ * return mLatestItemId
+ */
+ TMPXItemId getLatestItemId();
+
+ /**
+ * return mLatesListData
+ */
+ QList<TMPXItemId>& getLatestListData();
+
+ /**
+ * return mLatestInteger
+ */
+ int getLatestIntegerData();
+
+public slots:
+
+ /**
+ * Saves provided address to mLatestPtr
+ */
+ void newVideoListSlot(CMPXMediaArray* aVideoList);
+
+ /**
+ * Saves provided address to mLatestPtr
+ */
+ void videoListAppendedSlot(CMPXMediaArray* aVideoList);
+
+ /**
+ * Saves provided address to mLatestPtr
+ */
+ void newVideoAvailableSlot(CMPXMedia* aVideo);
+
+ /**
+ * Saves provided integer to mLatestInt
+ */
+ void videoDeletedSlot(TMPXItemId videoId);
+
+ /**
+ * copies provided list data to mLatesListData
+ */
+ void videoDeleteCompletedSlot(int count, QList<TMPXItemId> *failedMediaIds);
+
+ /**
+ * Saves provided integer to mLatestInt
+ */
+ void videoDetailsCompletedSlot(TMPXItemId videoId);
+
+private:
+ /**
+ * Contains address of latest pointer passed to object
+ */
+ void *mLatestPtr;
+
+ /**
+ * contains latest integer value sent
+ */
+ int mLatestInteger;
+
+ /**
+ * contains value if the latest integer passed to object
+ */
+ TMPXItemId mLatestItemId;
+
+ /**
+ * contains contents of list received from signal
+ */
+ QList<TMPXItemId> mLatesListData;
+};
+
+#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionlistener/stub/src/stubsignalreceiver.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,154 @@
+/**
+* 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 signal receiver for testing CVideoCollectionListener
+*
+*/
+
+#include "stubsignalreceiver.h"
+
+// -----------------------------------------------------------------------------
+// StubSignalReceiver
+// -----------------------------------------------------------------------------
+//
+StubSignalReceiver::StubSignalReceiver() :
+mLatestPtr(0),
+mLatestItemId(TMPXItemId::InvalidId()),
+mLatestInteger(-1)
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// ~StubSignalReceiver
+// -----------------------------------------------------------------------------
+//
+StubSignalReceiver::~StubSignalReceiver()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// resetLatestItems
+// -----------------------------------------------------------------------------
+//
+void StubSignalReceiver::resetLatestItems()
+{
+ mLatestPtr = 0;
+ mLatestItemId = TMPXItemId::InvalidId();
+ mLatesListData.clear();
+ mLatestInteger = -1;
+}
+
+// -----------------------------------------------------------------------------
+// getLatestPointerAddr
+// -----------------------------------------------------------------------------
+//
+void* StubSignalReceiver::getLatestPointerAddr()
+{
+ return mLatestPtr;
+}
+
+// -----------------------------------------------------------------------------
+// getLatestInt
+// -----------------------------------------------------------------------------
+//
+TMPXItemId StubSignalReceiver::getLatestItemId()
+{
+ return mLatestItemId;
+}
+
+// -----------------------------------------------------------------------------
+// getLatestListData
+// -----------------------------------------------------------------------------
+//
+QList<TMPXItemId>& StubSignalReceiver::getLatestListData()
+{
+ return mLatesListData;
+}
+
+// -----------------------------------------------------------------------------
+// getLatestListData
+// -----------------------------------------------------------------------------
+//
+int StubSignalReceiver::getLatestIntegerData()
+{
+ return mLatestInteger;
+}
+
+// -----------------------------------------------------------------------------
+// newVideoListSlot
+// -----------------------------------------------------------------------------
+//
+void StubSignalReceiver::newVideoListSlot(CMPXMediaArray* aVideoList)
+{
+ mLatestPtr = aVideoList;
+}
+
+// -----------------------------------------------------------------------------
+// videoListAppendedSlot
+// -----------------------------------------------------------------------------
+//
+void StubSignalReceiver::videoListAppendedSlot(CMPXMediaArray* aVideoList)
+{
+ mLatestPtr = aVideoList;
+}
+
+
+// -----------------------------------------------------------------------------
+// newVideoAvailableSlot
+// -----------------------------------------------------------------------------
+//
+void StubSignalReceiver::newVideoAvailableSlot(CMPXMedia* aVideo)
+{
+ mLatestPtr = aVideo;
+}
+
+// -----------------------------------------------------------------------------
+// videoDeletedSlot
+// -----------------------------------------------------------------------------
+//
+void StubSignalReceiver::videoDeletedSlot(TMPXItemId videoId)
+{
+ mLatestItemId = videoId;
+}
+
+// -----------------------------------------------------------------------------
+// videoDeleteCompletedSlot
+// -----------------------------------------------------------------------------
+//
+void StubSignalReceiver::videoDeleteCompletedSlot(int count, QList<TMPXItemId> *failedMediaIds)
+{
+ mLatestInteger = count;
+ mLatestPtr = failedMediaIds;
+
+ if(!failedMediaIds)
+ {
+ return;
+ }
+ mLatesListData.clear();
+ TMPXItemId data = 0;
+ foreach(data, (*failedMediaIds))
+ {
+ mLatesListData.append(data);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// videoDetailsCompletedSlot
+// -----------------------------------------------------------------------------
+//
+void StubSignalReceiver::videoDetailsCompletedSlot(TMPXItemId videoId)
+{
+ mLatestItemId = videoId;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionlistener/testvideocollectionlistener.pro Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,48 @@
+# #####################################################################
+# Automatically generated by qmake (2.01a) Tue 5. May 13:25:42 2009
+# #####################################################################
+TEMPLATE = app
+TARGET =
+DEPENDPATH += . \
+ inc \
+ src \
+ stub/src \
+ stub/inc
+CONFIG += qtestlib \
+ Hb \
+ symbian_test
+
+INCLUDEPATH += . \
+ inc \
+ stub/inc \
+ ../../../inc \
+ /epoc32/include/domain \
+ /epoc32/include/domain/middleware \
+ /epoc32/include/domain/applications \
+ /epoc32/include/osextensions \
+ /epoc32/include/middleware \
+ /epoc32/include/osextensions/stdapis/stlport
+
+LIBS += -lflogger.dll \
+ -lestor.dll \
+ -lfbscli.dll \
+ -lbitgdi.dll \
+ -lgdi.dll \
+ -lmpxcommon.dll
+
+# Input
+HEADERS += inc/testvideocollectionlistener.h \
+ inc/mediaobjectfactory.h \
+ stub/inc/stubcollection.h \
+ stub/inc/videocollectionclient.h \
+ stub/inc/stubsignalreceiver.h \
+ ../../inc/videocollectionutils.h \
+ ../../inc/videocollectionlistener.h
+
+SOURCES += src/testvideocollectionlistener.cpp \
+ src/mediaobjectfactory.cpp \
+ stub/src/stubcollection.cpp \
+ stub/src/videocollectionclient.cpp \
+ stub/src/stubsignalreceiver.cpp \
+ ../../src/videocollectionutils.cpp \
+ ../../src/videocollectionlistener.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/stub/inc/videocollectionclient.h Thu Apr 01 22:38:49 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: 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/videosortfilterproxymodel.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,153 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: stub Videosortfilterproxymodel for VideoCollectionWrapperPrivate unit tests
+*
+*/
+
+#ifndef VIDEOSORTFILTERPROXYMODEL_H
+#define VIDEOSORTFILTERPROXYMODEL_H
+
+#include <qsortfilterproxymodel.h>
+
+class QTimer;
+class VideoListDataModel;
+class VideoCollectionClient;
+
+class VideoSortFilterProxyModel : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * Contructor.
+ *
+ * @param parent parent of this widget
+ * @param client Collection client pointer to use.
+ */
+ VideoSortFilterProxyModel(QObject *parent=0);
+
+ /**
+ * Destructor.
+ *
+ */
+ virtual ~VideoSortFilterProxyModel();
+
+ /**
+ * Initializes model, calls initialize to source model, and sets
+ * the given sourceModel as source model for this proxy model.
+ *
+ * @param collection mpx video collectionobject
+ * @param sourceModel the source model
+ *
+ * @return int: 0 if everything ok
+ */
+ int initialize(VideoListDataModel *sourceModel);
+
+public:
+
+ /**
+ * First call opens the collection at the defined level. Subsequent calls only change the level.
+ * This starts populating the model data from the MyVideos collection plugin.
+ *
+ * @param level The level where the collection is opened.
+ * @return 0 if opening was successful, negative if not.
+ */
+ int open(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
+ *
+ * @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.
+ * Not owned.
+ */
+ VideoListDataModel *mModel;
+
+ /**
+ * Currently open level.
+ */
+ int mLevel;
+
+ /**
+ * sort role
+ */
+ int mWantedSortRole;
+
+ /**
+ * sort order
+ */
+ Qt::SortOrder mWantedSortOrder;
+
+};
+
+
+
+#endif //VIDEOSORTFILTERPROXYMODEL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/stub/src/videocollectionclient.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,154 @@
+/*
+* 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/videosortfilterproxymodel.cpp Thu Apr 01 22:38:49 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 Videosortfilterproxymodel for VideoCollectionWrapperPrivate unit tests
+*
+*/
+
+#include <qstringlist.h>
+#include <qtimer.h>
+#include <qdatetime.h>
+
+#include "videocollectioncommon.h"
+#include "videosortfilterproxymodel.h"
+#include "videolistdatamodel.h"
+#include "videocollectionclient.h"
+
+bool gInitFails = false;
+
+bool gFetchMediaIDFails = false;
+
+bool gFailDeleteFile = false;
+
+// -----------------------------------------------------------------------------
+// setInitFailure
+// -----------------------------------------------------------------------------
+//
+void VideoSortFilterProxyModel::setInitFailure(bool fails)
+{
+ gInitFails = fails;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::VideoSortFilterProxyModel
+// -----------------------------------------------------------------------------
+//
+VideoSortFilterProxyModel::VideoSortFilterProxyModel(QObject *parent) :
+ QObject(parent),
+ mModel(0),
+ mLevel(-1),
+ mWantedSortRole(VideoCollectionCommon::KeyDateTime)
+{
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::~VideoSortFilterProxyModel
+// -----------------------------------------------------------------------------
+//
+VideoSortFilterProxyModel::~VideoSortFilterProxyModel()
+{
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::initialize
+// -----------------------------------------------------------------------------
+//
+int VideoSortFilterProxyModel::initialize(VideoListDataModel *sourceModel)
+{
+ 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideocollectionwrapper_p/testvideocollectionwrapper_p.pro Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,37 @@
+######################################################################
+# Automatically generated by qmake (2.01a) Tue 5. May 13:25:42 2009
+######################################################################
+
+TEMPLATE = app
+TARGET =
+DEPENDPATH += . inc src stub/src stub/inc
+
+INCLUDEPATH += . \
+ ../../../inc \
+ /epoc32/include/domain \
+ /epoc32/include/domain/middleware \
+ /epoc32/include/domain/applications \
+ /epoc32/include/osextensions \
+ /epoc32/include/middleware \
+ /epoc32/include/osextensions/stdapis/stlport
+
+
+CONFIG += qtestlib \
+ Hb \
+ symbian_test
+
+LIBS += -lmpxcommon.dll -lmpxcollectionutility.dll -lflogger.dll -lestor.dll \
+ -lthumbnailmanagerqt.dll -lfbscli.dll -lbitgdi.dll -lgdi.dll
+
+# Input
+HEADERS += inc/testvideocollectionwrapper_p.h \
+ stub/inc/videocollectionclient.h \
+ stub/inc/videosortfilterproxymodel.h \
+ stub/inc/videolistdatamodel.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/testvideodatacontainer.pro Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,37 @@
+######################################################################
+# 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 += ../../inc/videocollectionutils.h \
+ ../../inc/videodatacontainer.h \
+ inc/testvideodatacontainer.h \
+ inc/mediaobjectfactory.h
+
+
+SOURCES += ../../src/videocollectionutils.cpp \
+ ../../src/videodatacontainer.cpp \
+ src/testvideodatacontainer.cpp \
+ src/mediaobjectfactory.cpp \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel/data/qgn_prop_mtv_prog_clip.svg Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="100%" height="100%" viewBox="0 0 57 49">
+<g>
+<rect fill="none" width="57" height="49"/>
+<g>
+<g>
+<polygon points="46.238,43.598 4.997,43.598 4.997,10.992 46.228,10.994 "/>
+<g>
+<polygon fill="#B2B2B2" points="44.428,17.543 44.428,41.768 6.791,41.768 6.791,36.24 "/>
+<polygon fill="#D9D9D9" points="44.369,17.854 44.369,12.662 6.846,12.662 6.846,36.552 "/>
+<polygon fill="#8A8A8A" points="44.369,12.055 44.369,41.688 6.813,41.688 6.813,42.395 45.077,42.395 45.077,12.055 "/>
+<polygon fill="#F5F5F5" points="44.369,12.055 6.138,12.055 6.138,42.395 6.846,42.395 6.846,12.76 44.369,12.76 "/>
+<rect x="18.815" y="37.402" fill="#595959" width="2.897" height="2.875"/>
+<polygon points="21.758,36.75 18.172,36.75 18.172,40.322 18.881,40.322 18.881,37.456 21.758,37.456 "/>
+<polygon fill="#F5F5F5" points="21.713,36.75 21.713,40.277 18.172,40.277 18.172,40.982 22.42,40.982 22.42,36.75 "/>
+<rect x="29.445" y="37.402" fill="#595959" width="2.889" height="2.875"/>
+<polygon points="32.367,36.75 28.793,36.75 28.793,40.313 29.5,40.313 29.5,37.456 32.367,37.456 "/>
+<polygon fill="#F5F5F5" points="32.334,36.75 32.334,40.277 28.793,40.277 28.793,40.982 33.042,40.982 33.042,36.75 "/>
+<rect x="40.055" y="37.391" fill="#595959" width="2.898" height="2.887"/>
+<polygon points="42.996,36.75 39.412,36.75 39.412,40.322 40.12,40.322 40.12,37.456 42.996,37.456 "/>
+<polygon fill="#F5F5F5" points="42.953,36.75 42.953,40.277 39.412,40.277 39.412,40.982 43.66,40.982 43.66,36.75 "/>
+<rect x="8.195" y="37.402" fill="#595959" width="2.899" height="2.875"/>
+<polygon points="11.126,36.75 7.554,36.75 7.554,40.313 8.262,40.313 8.262,37.456 11.126,37.456 "/>
+<polygon fill="#F5F5F5" points="11.095,36.75 11.095,40.277 7.554,40.277 7.554,40.982 11.803,40.982 11.803,36.75 "/>
+<rect x="18.826" y="14.13" fill="#595959" width="2.887" height="2.864"/>
+<polygon points="21.747,13.467 18.172,13.467 18.172,17.027 18.881,17.027 18.881,14.172 21.747,14.172 "/>
+<polygon fill="#F5F5F5" points="21.713,13.467 21.713,16.994 18.172,16.994 18.172,17.699 22.42,17.699 22.42,13.467 "/>
+<rect x="29.435" y="14.106" fill="#595959" width="2.899" height="2.888"/>
+<polygon points="32.367,13.467 28.793,13.467 28.793,17.039 29.5,17.039 29.5,14.172 32.367,14.172 "/>
+<polygon fill="#F5F5F5" points="32.334,13.467 32.334,16.994 28.793,16.994 28.793,17.699 33.042,17.699 33.042,13.467 "/>
+<rect x="40.076" y="14.106" fill="#595959" width="2.877" height="2.888"/>
+<polygon points="42.986,13.467 39.412,13.467 39.412,17.039 40.12,17.039 40.12,14.172 42.986,14.172 "/>
+<polygon fill="#F5F5F5" points="42.953,13.467 42.953,16.994 39.412,16.994 39.412,17.699 43.66,17.699 43.66,13.467 "/>
+<rect x="8.195" y="14.118" fill="#595959" width="2.899" height="2.876"/>
+<polygon points="11.126,13.467 7.554,13.467 7.554,17.039 8.262,17.039 8.262,14.172 11.126,14.172 "/>
+<polygon fill="#F5F5F5" points="11.095,13.467 11.095,16.994 7.554,16.994 7.554,17.699 11.803,17.699 11.803,13.467 "/>
+</g>
+</g>
+<g>
+<polygon fill="#00395D" points="30.344,34.621 25.454,32.046 20.558,34.617 21.494,29.17 17.537,25.309 23.008,24.515 25.456,19.559 27.901,24.516 33.371,25.314 29.412,29.17 "/>
+<polygon fill="#2882C8" points="22.55,31.879 22.972,29.424 23.105,28.645 22.542,28.096 20.76,26.357 23.223,25.999 24.004,25.886 24.353,25.178 25.455,22.947 26.557,25.18 26.905,25.888 27.684,26.001 30.146,26.359 28.365,28.096 27.8,28.645 27.933,29.422 28.354,31.877 26.154,30.719 25.455,30.351 24.757,30.719 22.55,31.879 "/>
+</g>
+</g>
+</g>
+</svg>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel/data/testvideolistdatamodel.qrc Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/icons" >
+ <file alias="default_thumbnail.svg" >qgn_prop_mtv_prog_clip.svg</file>
+ </qresource>
+</RCC>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel/stub/inc/videolistdatamodel_p.h Thu Apr 01 22:38:49 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: stubclass of videolistdata for testing VideoListDataModel class methods*
+*/
+
+
+#ifndef __VIDEOLISTDATA_H__
+#define __VIDEOLISTDATA_H__
+
+
+// INCLUDES
+#include <QObject>
+#include <QDate>
+#include <QIcon>
+#include <QSet>
+#include <qabstractitemmodel.h>
+#include "videodatasignalreceiver.h"
+
+
+// FORWARD DECLARATIONS
+class CMPXMediaArray;
+class VideoThumbnailData;
+
+
+class VideoListDataModel;
+class CMPXMediaArray;
+
+class VideoListDataModelPrivate : public VideoDataSignalReceiver
+{
+ /**
+ * define to be able to use signals and slots
+ */
+ Q_OBJECT
+
+ /**
+ * disable copy-constructor and assignment operator
+ */
+ Q_DISABLE_COPY(VideoListDataModelPrivate)
+
+public:
+
+ /**
+ * Default constructor
+ */
+ VideoListDataModelPrivate(VideoListDataModel *model);
+
+ /**
+ * Destructor
+ */
+ ~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
+ *
+ * @return int 0 or -1
+ */
+ int initialize();
+
+
+signals:
+
+ /**
+ * Not emitted from here but had to be defined in order to
+ * get stub into use to testable object
+ */
+ void dataChanged(const QModelIndex &startIndex, const QModelIndex &endIndex);
+
+ /**
+ * Not emitted from here but had to be defined in order to
+ * get stub into use to testable object
+ */
+ void videoDetailsReady(int index);
+
+
+public: // services
+
+ /**
+ * return count of mMediaArray
+ *
+ * @rerurn int
+ */
+ int getVideoCount();
+
+ /**
+ * return video id of the item at given index
+ *
+ * @param index
+ * @return int
+ */
+ int getMediaIdFromIndex(int index) const;
+
+ /**
+ * return video path of the item with given media id
+ *
+ * @param mediaId
+ * @return int
+ */
+ const QString getFilePathForId(TMPXItemId mediaId) const;
+
+ /**
+ * return name of the item at given index
+ *
+ * @param index
+ * @return QString
+ */
+ const QString getVideoNameFromIndex( int index ) const;
+
+ /**
+ * return default tn always
+ *
+ * @param index
+ * @return QIcon
+ */
+ const QIcon* getVideoThumbnailFromIndex( int index ) const;
+
+ /**
+ * return video size of the item at given index
+ *
+ * @param index
+ * @return quint32
+ */
+ quint32 getVideoSizeFromIndex( int index ) const;
+
+ /**
+ * return video age profile of the item at given index
+ *
+ * @param index
+ * @return quint32
+ */
+ quint32 getVideoAgeProfileFromIndex( int index ) const;
+
+ /**
+ * return video duration of the item at given index
+ *
+ * @param index
+ * @return quint32
+ */
+ quint32 getVideodurationFromIndex( int index ) const;
+
+ /**
+ * return video creation datetime of the item at given index
+ *
+ * @param index
+ * @return QDateTime
+ */
+ QDateTime getVideoDateFromIndex( int index ) const;
+
+ /**
+ * Returns the metadata for the video.
+ *
+ * @param index: item position where client wants the date from.
+ * @return QMap map of the QVariants that hold the data. Keys defined
+ * in VideoCollectionCommon
+ */
+ QMap<QString, QVariant> getMetaDataFromIndex(int index) const;
+
+ /**
+ * Returns video status
+ *
+ * @param index: item position where client wants the date from.
+ *
+ * @return int status code
+ */
+ int getVideoStatusFromIndex(int index) const;
+
+ /**
+ * marks video to be removed: it's id and index are saved to
+ * mItemsUnderDeletion
+ *
+ * @param indexes: indexes of videos to be removes
+ *
+ */
+ QList<TMPXItemId> markVideosRemoved(const QModelIndexList &indexes);
+
+ /**
+ * Removes provided ids from the remove -list
+ *
+ * @param itemIds ids of the items to be removed
+ */
+ void unMarkVideosRemoved(QList<TMPXItemId> &itemIds);
+
+ /**
+ * Returns the file path of the video.
+ *
+ * @param index: item position where client wants the file path from.
+ */
+ const QString getFilePathFromIndex(int index) const;
+
+private: // private methods
+
+ /**
+ * return id of given item
+ *
+ * @param CMPXMedia
+ * @return TMPXItemId
+ */
+ TMPXItemId getMediaId(const CMPXMedia *media ) const;
+
+ /**
+ * return item from given index of given item
+ *
+ * @param index
+ * @return CMPXMedia
+ */
+ CMPXMedia* getMediaFromIndex( int index ) const;
+
+ /**
+ * return index of item of given id
+ *
+ * @param mediaId
+ * @return int
+ */
+ int indexOfMediaId(TMPXItemId mediaId) const;
+
+
+public slots:
+
+ /**
+ * ssaves given list to mMediaArray
+ *
+ * @param aVideoList: video list
+ *
+ */
+ void newVideoListSlot(CMPXMediaArray* aVideoList);
+
+ /**
+ * not used in stub
+ *
+ */
+ void appendVideoListSlot(CMPXMediaArray * videoList);
+
+ /**
+ * not used in stub
+ *
+ */
+ void newVideoAvailableSlot(CMPXMedia* aVideo);
+
+ /**
+ * not used in stub
+ *
+ */
+ void videoDeletedSlot(TMPXItemId videoId);
+
+ /**
+ * used to clear mItemsUnderDeletion for this stub
+ *
+ */
+ void videoDeleteCompletedSlot(int overallCount,QList<TMPXItemId> *failedMediaIds);
+
+ /**
+ * not used in stub
+ *
+ */
+ void videoDetailsCompletedSlot(TMPXItemId videoId);
+
+private:
+
+ /**
+ * Pointer to the public class
+ * Not own.
+ */
+ VideoListDataModel *q_ptr;
+
+ /**
+ * pointer to shared-array of medias
+ */
+ CMPXMediaArray *mMediaArray;
+
+ /**
+ * default icon
+ */
+ QIcon mIcon;
+
+ /**
+ * marked as removed -map
+ */
+ QSet<TMPXItemId> mItemsUnderDeletion;
+
+};
+#endif // __VIDEOLISTDATA_H__
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel/stub/src/videolistdatamodel_p.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,472 @@
+/*
+* 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 videolistdata for testing VideoListDataModel class methods*
+*/
+// INCLUDE FILES
+
+#include <mpxmediageneraldefs.h>
+#include <thumbnailmanager_qt.h>
+#include <mpxmediaarray.h>
+#include <mpxmedia.h>
+#include <qvariant.h>
+
+#include "videolistdatamodel.h"
+#include "videocollectionutils.h"
+#include "videolistdatamodel_p.h"
+#include "videothumbnaildata.h"
+#include "vcxmyvideosdefs.h"
+#include "videocollectioncommon.h"
+
+inline uint qHash(TMPXItemId key)
+{
+ QPair<uint, uint> keyPair(key.iId1, key.iId2);
+
+ return qHash(keyPair);
+}
+
+// helper funtion to parse QString -data from media
+template<class T>
+bool mediaValue(const CMPXMedia *media, const TMPXAttributeData& attribute, QString& result)
+{
+ bool status = false;
+ if( media && media->IsSupported(attribute))
+ {
+ HBufC* valueText = NULL;
+ TRAPD(error, valueText = media->ValueText( attribute ).AllocL() );
+ if (error == KErrNone && 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;
+}
+
+
+/**
+ * init failure flag
+ */
+bool gFailInit = 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;
+
+/////
+// static helpers
+// -----------------------------------------------------------------------------
+// overrideSizeValue
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModelPrivate::overrideSizeValue(bool override, quint32 value)
+{
+ gOverrideSize = override;
+ gSize = value;
+}
+
+// -----------------------------------------------------------------------------
+// overrideDurationValue
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModelPrivate::overrideDurationValue(bool override, float value)
+{
+ gOverrideDuration = override;
+ gDuration = value;
+}
+
+// -----------------------------------------------------------------------------
+// setInitFailureStatus
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModelPrivate::setInitFailureStatus(bool fail)
+{
+ gFailInit = fail;
+}
+
+// -----------------------------------------------------------------------------
+// setGetVideoCountFailAfterNCall
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModelPrivate::setGetVideoCountFailAfterNCall(int counter)
+{
+ gGetVideoCountFail = counter;
+}
+
+// -----------------------------------------------------------------------------
+// CVideoListData
+// -----------------------------------------------------------------------------
+//
+VideoListDataModelPrivate::VideoListDataModelPrivate(VideoListDataModel *model) :
+q_ptr(model),
+mMediaArray(0)
+{
+ mIcon = QIcon(":/icons/default_thumbnail.svg");
+}
+
+// -----------------------------------------------------------------------------
+// ~VideoListDataModelPrivate
+// -----------------------------------------------------------------------------
+//
+VideoListDataModelPrivate::~VideoListDataModelPrivate()
+{
+}
+
+// -----------------------------------------------------------------------------
+// initialize
+// -----------------------------------------------------------------------------
+//
+int VideoListDataModelPrivate::initialize()
+{
+ if(gFailInit)
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// getVideoCount
+// -----------------------------------------------------------------------------
+//
+int VideoListDataModelPrivate::getVideoCount()
+{
+ int count = 0;
+ if(mMediaArray)
+ {
+ count = mMediaArray->Count();
+ }
+ gGetVideoCountFail--;
+ if(gGetVideoCountFail == 0)
+ {
+ return 0;
+ }
+ return count;
+}
+
+// -----------------------------------------------------------------------------
+// getVideoNameFromIndex
+// -----------------------------------------------------------------------------
+//
+const QString VideoListDataModelPrivate::getVideoNameFromIndex( int index ) const
+{
+ QString txt = "";
+ CMPXMedia* media = getMediaFromIndex(index);
+
+ mediaValue<QString>(media, KMPXMediaGeneralTitle, txt );
+ return txt;
+}
+
+// -----------------------------------------------------------------------------
+// getVideoThumbnailFromIndex
+// -----------------------------------------------------------------------------
+//
+const QIcon* VideoListDataModelPrivate::getVideoThumbnailFromIndex( int index ) const
+{
+ Q_UNUSED(index);
+
+ return &mIcon;
+}
+
+// -----------------------------------------------------------------------------
+// getVideoSizeFromIndex
+// -----------------------------------------------------------------------------
+//
+quint32 VideoListDataModelPrivate::getVideoSizeFromIndex( int index ) const
+{
+ if(gOverrideSize)
+ {
+ return gSize;
+ }
+ quint32 size(0);
+ CMPXMedia *media = getMediaFromIndex(index);
+ if(media && media->IsSupported( KMPXMediaGeneralSize ))
+ {
+ size = *( media->Value<quint32>( KMPXMediaGeneralSize ) ); // In bytes
+ }
+ return size;
+}
+
+// -----------------------------------------------------------------------------
+// getVideodurationFromIndex
+// -----------------------------------------------------------------------------
+//
+quint32 VideoListDataModelPrivate::getVideodurationFromIndex( int index ) const
+{
+ if(gOverrideDuration)
+ {
+ return gDuration;
+ }
+ quint32 returnDuration(0);
+ float duration(0);
+ CMPXMedia *media = getMediaFromIndex(index);
+ if(media && media->IsSupported( KMPXMediaGeneralDuration ))
+ {
+ duration = *( media->Value<float>( KMPXMediaGeneralDuration ) );
+ }
+ returnDuration = static_cast<quint32>(duration);
+ return returnDuration;
+}
+
+// -----------------------------------------------------------------------------
+// getVideoDateFromIndex
+// -----------------------------------------------------------------------------
+//
+QDateTime VideoListDataModelPrivate::getVideoDateFromIndex( int index ) const
+{
+ QDateTime date;
+ CMPXMedia *media = getMediaFromIndex(index);
+ if(media && media->IsSupported(KMPXMediaGeneralDate)) {
+
+ TInt64 temp = *(media->Value<TInt64>(KMPXMediaGeneralDate));
+ TDateTime tempDate = TTime(temp).DateTime();
+ date = QDateTime(QDate(tempDate.Year(), tempDate.Month()+1, tempDate.Day()+1),
+ QTime(tempDate.Hour(), tempDate.Minute(), tempDate.Second(), tempDate.MicroSecond()));
+ }
+ return date;
+}
+
+// -----------------------------------------------------------------------------
+// getMetaDataFromIndex
+// -----------------------------------------------------------------------------
+//
+QMap<QString, QVariant> VideoListDataModelPrivate::getMetaDataFromIndex(int /*index*/) const
+{
+ QMap<QString, QVariant> map;
+
+ // no need to actually populate the map with real like data, as the datamodel
+ // is not responsible in anyway what data the actual map contains. So here we
+ // only need to make sure that the map received in test has been gotten by
+ // calling this function.
+ map["metadata"] = QString("metadata");
+
+ return map;
+}
+
+// -----------------------------------------------------------------------------
+// getMediaIdFromIndex
+// -----------------------------------------------------------------------------
+//
+int VideoListDataModelPrivate::getMediaIdFromIndex( int index ) const
+{
+ return getMediaId( getMediaFromIndex(index) );
+}
+
+// -----------------------------------------------------------------------------
+// getFilePathForId
+// -----------------------------------------------------------------------------
+//
+const QString VideoListDataModelPrivate::getFilePathForId( TMPXItemId mediaId ) const
+{
+ return getFilePathFromIndex( indexOfMediaId(mediaId) );
+}
+
+// -----------------------------------------------------------------------------
+// getVideoStatusFromIndex
+// -----------------------------------------------------------------------------
+//
+int VideoListDataModelPrivate::getVideoStatusFromIndex(int index) const
+{
+ int status = 0;
+ if(mItemsUnderDeletion.contains(getMediaIdFromIndex(index)))
+ {
+ status = VideoCollectionCommon::StatusDeleted;
+ }
+ return status;
+}
+
+
+// -----------------------------------------------------------------------------
+// markVideoRemoved
+// -----------------------------------------------------------------------------
+//
+QList<TMPXItemId> VideoListDataModelPrivate::markVideosRemoved(const QModelIndexList &indexes)
+{
+ mItemsUnderDeletion.clear();
+ QList<TMPXItemId> idList;
+ if(!mMediaArray)
+ {
+ return idList;
+ }
+
+ TMPXItemId id;
+ QModelIndex index;
+ foreach(index, indexes)
+ {
+ id = getMediaIdFromIndex(index.row());
+ if(id != TMPXItemId::InvalidId())
+ {
+ mItemsUnderDeletion.insert(id);
+ idList.append(id);
+ }
+ }
+ return idList;
+}
+
+// -----------------------------------------------------------------------------
+// unMarkVideosRemoved
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModelPrivate::unMarkVideosRemoved(QList<TMPXItemId> &itemIds)
+{
+ TMPXItemId id;
+ foreach(id, itemIds)
+ {
+ mItemsUnderDeletion.remove(id);
+ }
+}
+
+// -----------------------------------------------------------------------------
+// getFilePathFromIndex
+// -----------------------------------------------------------------------------
+//
+const QString VideoListDataModelPrivate::getFilePathFromIndex(int index) const
+{
+ QString filePath;
+ VideoCollectionUtils::instance().mediaValue<QString>(getMediaFromIndex(index),
+ KMPXMediaGeneralUri, filePath );
+ return filePath;
+}
+
+// -----------------------------------------------------------------------------
+// getMediaFromIndex
+// -----------------------------------------------------------------------------
+//
+CMPXMedia* VideoListDataModelPrivate::getMediaFromIndex( int index ) const
+{
+ CMPXMedia *media = NULL;
+ if( mMediaArray && index >= 0 && index < mMediaArray->Count() )
+ {
+ media = (*mMediaArray)[index];
+ }
+ return media;
+}
+
+// -----------------------------------------------------------------------------
+// getMediaId
+// -----------------------------------------------------------------------------
+//
+TMPXItemId VideoListDataModelPrivate::getMediaId(const CMPXMedia *media ) const
+{
+ TMPXItemId mediaId = TMPXItemId::InvalidId();
+ if( media && media->IsSupported( KMPXMediaGeneralId ) )
+ {
+ TRAPD(err, mediaId = media->ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+ }
+ return mediaId;
+}
+
+// -----------------------------------------------------------------------------
+// indexOfMediaId
+// -----------------------------------------------------------------------------
+//
+int VideoListDataModelPrivate::indexOfMediaId(TMPXItemId mediaId) const
+{
+ int index = -1;
+ if( !mMediaArray )
+ {
+ // nothing to look for
+ return index;
+ }
+ const CMPXMedia* media = NULL;
+ int count = mMediaArray->Count();
+ for(int i = 0; i < count; ++i)
+ {
+ media = getMediaFromIndex(i);
+ if(media )
+ {
+ TMPXItemId itemId = getMediaId(media);
+ if( mediaId == itemId)
+ {
+ index = i;
+ break;
+ }
+ media = NULL;
+ }
+ }
+ return index;
+}
+
+// -----------------------------------------------------------------------------
+// newVideoList
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModelPrivate::newVideoListSlot( CMPXMediaArray* aVideoList )
+{
+ mMediaArray = aVideoList;
+}
+
+// -----------------------------------------------------------------------------
+// appendVideoListSlot
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModelPrivate::appendVideoListSlot(CMPXMediaArray* /*aVideo*/)
+{
+ // NOP
+}
+
+// -----------------------------------------------------------------------------
+// newVideoAvailable
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModelPrivate::newVideoAvailableSlot(CMPXMedia* /*aVideo*/)
+{
+ // NOP
+}
+
+// -----------------------------------------------------------------------------
+// videoDeleted
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModelPrivate::videoDeletedSlot(TMPXItemId /*videoId*/)
+{
+ // NOP
+}
+
+// -----------------------------------------------------------------------------
+// videoDeleteCompleted
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModelPrivate::videoDeleteCompletedSlot(int overallCount, QList<TMPXItemId> */*failedMediaIds*/)
+{
+ mItemsUnderDeletion.clear();
+}
+
+// -----------------------------------------------------------------------------
+// videoDetailsCompleted
+// -----------------------------------------------------------------------------
+//
+void VideoListDataModelPrivate::videoDetailsCompletedSlot(TMPXItemId /*videoId*/)
+{
+ // NOP
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel/testvideomodel.pro Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,47 @@
+######################################################################
+# Automatically generated by qmake (2.01a) Tue 5. May 13:25:42 2009
+######################################################################
+
+TEMPLATE = app
+TARGET =
+DEPENDPATH += . inc src /stub/inc /stub/src
+
+INCLUDEPATH += . \
+ ../../../inc \
+ stub/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 -lestor.dll \
+ -lthumbnailmanagerqt.dll -lfbscli.dll -lbitgdi.dll -lgdi.dll
+
+# Input
+HEADERS += ../../inc/videolistdatamodel.h \
+ ../../inc/videodatasignalreceiver.h \
+ ../../inc/videocollectionutils.h \
+ inc/testvideolistdatamodel.h \
+ inc/mediaobjectfactory.h \
+ stub/inc/videolistdatamodel_p.h \
+ stub/inc/videocollectionclient.h \
+
+
+
+SOURCES += ../../src/videolistdatamodel.cpp \
+ ../../src/videocollectionutils.cpp \
+ src/testvideolistdatamodel.cpp \
+ src/mediaobjectfactory.cpp \
+ stub/src/videolistdatamodel_p.cpp \
+ stub/src/videocollectionclient.cpp \
+
+
+RESOURCES += data/testvideolistdatamodel.qrc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel_p/inc/testvideomodel_p.h Thu Apr 01 22:38:49 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:
+*
+*/
+
+
+
+#ifndef __TESTVIDEOMODEL_P_H__
+#define __TESTVIDEOMODEL_P_H__
+
+
+// INCLUDES
+#include <QtTest/QtTest>
+#include <QList>
+#include "videocollectionwrapper.h"
+#include <e32const.h>
+#include <mpxitemid.h>
+
+class MediaObjectFactory;
+class CMPXMedia;
+class CMPXMediaArray;
+class VideoListDataModelPrivate;
+class VideoListDataModel;
+
+class TestVideoModel_p: public QObject
+{
+ Q_OBJECT
+
+signals:
+
+ /**
+ * emitted to test thumbnailFetchedSlot
+ */
+ void signalThumbnailsFetched(QList<TMPXItemId>);
+
+ /**
+ * emitted to pass new media-array into testable object and
+ * to test newVideoListSlot
+ */
+ void signalNewVideoList(CMPXMediaArray*);
+
+ /**
+ * emitted to pass more medias using media-array into testable object and
+ * to test appendVideoListSlot
+ */
+ void signalAppendVideoList(CMPXMediaArray*);
+
+ /**
+ * emitted to test newVideoAvailableSlot
+ */
+ void signalNewVideoAvailable(CMPXMedia*);
+
+ /**
+ * emitted to get deleteVideoSlot to be called.
+ */
+ void signalDeleteVideo(TMPXItemId);
+
+ /**
+ * emitted to get videoDeleteCompletedSlot to be called.
+ */
+ void signalDeleteCompleted(int, QList<TMPXItemId>*);
+
+ /**
+ * emitted to get videoDetailsCompletedSlot to be called.
+ */
+ void signalVideoDetailsCompleted(TMPXItemId);
+
+ // 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 initialize.
+ *
+ */
+ void testInitialize();
+
+ /**
+ * verifies getVideoCount
+ */
+ void testItemCount();
+
+ /**
+ * verifies getMediaIdFromIndex
+ */
+ void testGetMediaIdFromIndex();
+
+ /**
+ * verifies getVideoNameFromIndex
+ */
+ void testGetVideoNameFromIndex();
+
+ /**
+ * verifies getVideoThumbnailFromIndex
+ */
+ void testGetVideoThumbnailFromIndex();
+
+ /**
+ * verifies getVideoSizeFromIndex
+ */
+ void testGetVideoSizeFromIndex();
+
+ /**
+ * verifies getVideoAgeProfileFromIndex
+ */
+ void testGetVideoAgeProfileFromIndex();
+
+ /**
+ * verifies getVideodurationFromIndex
+ */
+ void testGetVideodurationFromIndex();
+
+ /**
+ * verifies getVideoDateFromIndex
+ */
+ void testGetVideoDateFromIndex();
+
+ /**
+ * verifies getMetaDataFromIndex
+ */
+ void testGetMetaDataFromIndex();
+
+ /**
+ * verifies getFilePathFromIndex
+ */
+ void testGetFilePathFromIndex();
+
+ /**
+ * verifies getFilePathForId
+ */
+ void testGetFilePathForId();
+
+ /**
+ * verifies markVideoRemoved and getVideoStatusFromIndex
+ */
+ void testVideoStatus();
+
+ /**
+ * verifies thumbnailsFetchedSlot
+ */
+ void testThumbnailsFetchedSlot();
+
+ /**
+ * verifies newVideoListSlot
+ */
+ void testNewVideoListSlot();
+
+ /**
+ * verifies appendVideoListSlot
+ */
+ void testAppendVideoListSlot();
+
+ /**
+ * verifies newVideoAvailableSlot
+ */
+ void testNewVideoAvailableSlot();
+
+ /**
+ * verifies videoDeletedSlot
+ */
+ void testVideoDeletedSlot();
+
+ /**
+ * verifies videoDeleteCompletedSlot
+ */
+ void testVideoDeleteCompletedSlot();
+
+ /**
+ * verifies videoDetailsCompletedSlot
+ */
+ void testVideoDetailsCompletedSlot();
+
+ /**
+ * verifies getVideoCount when fetching collections
+ */
+ void testCollectionItemCount();
+
+ /**
+ * verifies getMediaIdFromIndex when fetching collections
+ */
+ void testGetCollectionIdFromIndex();
+
+private:
+
+ /**
+ * object under test
+ */
+ VideoListDataModelPrivate *mTestObject;
+
+ /**
+ * CMPXMedia -object factory.
+ */
+ MediaObjectFactory *mMediaFactory;
+
+ /**
+ * stubmodel, used to create QModelIndeces
+ */
+ VideoListDataModel *mStubModel;
+};
+
+
+#endif // __TESTVIDEOMODEL_P_H__
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel_p/src/testvideomodel_p.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,1256 @@
+/*
+* 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 <mpxmediageneraldefs.h>
+#include <mpxmediaarray.h>
+#include <mpxmedia.h>
+#include <vcxmyvideosdefs.h>
+#include <qabstractitemmodel.h>
+#include "videocollectionutils.h"
+#include "videothumbnaildata.h"
+#include "videolistdatamodel.h"
+#include "testvideomodel_p.h"
+#include "mediaobjectfactory.h"
+#include "videocollectioncommon.h"
+#include "videocollectionutils.h"
+
+#define private public
+#include "videolistdatamodel_p.h"
+#undef private
+
+const int MEDIA_COUNT = 10;
+
+inline uint qHash(TMPXItemId key)
+{
+ QPair<uint, uint> keyPair(key.iId1, key.iId2);
+
+ return qHash(keyPair);
+}
+
+
+int main(int argc, char *argv[])
+{
+ Q_UNUSED(argc);
+
+ 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);
+
+ return res;
+}
+
+// -----------------------------------------------------------------------------
+// initTestCase
+// -----------------------------------------------------------------------------
+//
+void TestVideoModel_p::initTestCase()
+{
+ mTestObject = 0;
+ mMediaFactory = new MediaObjectFactory();
+
+ mStubModel = new VideoListDataModel();
+}
+
+// -----------------------------------------------------------------------------
+// init
+// -----------------------------------------------------------------------------
+//
+void TestVideoModel_p::init()
+{
+ qRegisterMetaType<QModelIndex>("QModelIndex");
+ mTestObject = new VideoListDataModelPrivate(mStubModel);
+ QVERIFY(mTestObject);
+ VideoCollectionUtils::mPrepareLengthStringReturnValue = "test duration";
+ VideoCollectionUtils::mPrepareSizeStringReturnValue = "test size";
+}
+
+// -----------------------------------------------------------------------------
+// cleanup
+// -----------------------------------------------------------------------------
+//
+void TestVideoModel_p::cleanup()
+{
+ if(mTestObject)
+ {
+ delete mTestObject;
+ mTestObject = 0;
+ }
+}
+
+// -----------------------------------------------------------------------------
+// cleanupTestCase
+// -----------------------------------------------------------------------------
+//
+void TestVideoModel_p::cleanupTestCase()
+{
+ delete mMediaFactory;
+ delete mStubModel;
+}
+
+// -----------------------------------------------------------------------------
+// testInitTNFails
+// -----------------------------------------------------------------------------
+//
+void TestVideoModel_p::testInitialize()
+{
+ // Succeeds.
+ QVERIFY(mTestObject->initialize() == 0);
+
+ // Initialize already called.
+ QVERIFY(mTestObject->initialize() == 0);
+}
+
+// -----------------------------------------------------------------------------
+// testItemCount
+// -----------------------------------------------------------------------------
+//
+void TestVideoModel_p::testItemCount()
+{
+ QVERIFY(mTestObject->getVideoCount() == 0);
+
+ QVERIFY(connect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*))));
+
+ mMediaFactory->removeArray();
+ mMediaFactory->createMediaItems(MEDIA_COUNT);
+ emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
+
+ QVERIFY( mTestObject->getVideoCount() == MEDIA_COUNT);
+
+ disconnect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*)));
+}
+
+// -----------------------------------------------------------------------------
+// testGetMediaIdFromIndex
+// -----------------------------------------------------------------------------
+//
+void TestVideoModel_p::testGetMediaIdFromIndex()
+{
+ QVERIFY(mTestObject->getMediaIdFromIndex(0) == -1);
+ QVERIFY(mTestObject->getMediaIdFromIndex(-1) == -1);
+
+ mMediaFactory->removeArray();
+ QVERIFY(connect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*))));
+ mMediaFactory->createMediaItems(MEDIA_COUNT);
+ emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
+
+ QVERIFY(mTestObject->getMediaIdFromIndex(-1) == -1);
+
+ QVERIFY(mTestObject->getMediaIdFromIndex(MEDIA_COUNT) == -1);
+
+ QVERIFY(mTestObject->getMediaIdFromIndex(0) == 0);
+
+ QVERIFY(mTestObject->getMediaIdFromIndex(MEDIA_COUNT - 1) == MEDIA_COUNT - 1);
+
+ // no data
+ mMediaFactory->removeArray();
+ mMediaFactory->createMediaItems(MEDIA_COUNT, MediaDataNone);
+ emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
+
+ QVERIFY(mTestObject->getMediaIdFromIndex(-1) == -1);
+
+ QVERIFY(mTestObject->getMediaIdFromIndex(MEDIA_COUNT) == -1);
+
+ QVERIFY(mTestObject->getMediaIdFromIndex(0) == -1);
+
+ QVERIFY(mTestObject->getMediaIdFromIndex(MEDIA_COUNT - 1) == - 1);
+
+
+ disconnect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*)));
+}
+
+// -----------------------------------------------------------------------------
+// testGetVideoNameFromIndex
+// -----------------------------------------------------------------------------
+//
+void TestVideoModel_p::testGetVideoNameFromIndex()
+{
+ QString expectedName = "";
+
+ QVERIFY(mTestObject->getVideoNameFromIndex(0) == expectedName);
+ QVERIFY(mTestObject->getVideoNameFromIndex(-1) == expectedName);
+
+ mMediaFactory->removeArray();
+ QVERIFY(connect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*))));
+ mMediaFactory->createMediaItems(MEDIA_COUNT);
+ emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
+
+ QVERIFY(mTestObject->getVideoNameFromIndex(-1) == expectedName);
+
+ QVERIFY(mTestObject->getVideoNameFromIndex(MEDIA_COUNT) == expectedName);
+
+ expectedName = gQTMediaNamePrefix + "0";
+ QVERIFY(mTestObject->getVideoNameFromIndex(0) == expectedName);
+
+ expectedName = gQTMediaNamePrefix + QString::number(MEDIA_COUNT - 1);
+ QVERIFY(mTestObject->getVideoNameFromIndex(MEDIA_COUNT - 1) == expectedName);
+
+ // no data
+ expectedName = "";
+ mMediaFactory->removeArray();
+ mMediaFactory->createMediaItems(MEDIA_COUNT, MediaDataId);
+ emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
+
+ QVERIFY(mTestObject->getVideoNameFromIndex(-1) == expectedName);
+
+ QVERIFY(mTestObject->getVideoNameFromIndex(MEDIA_COUNT) == expectedName);
+
+ QVERIFY(mTestObject->getVideoNameFromIndex(0) == expectedName);
+
+ QVERIFY(mTestObject->getVideoNameFromIndex(MEDIA_COUNT - 1) == expectedName);
+
+ disconnect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*)));
+}
+
+// -----------------------------------------------------------------------------
+// testGetVideoThumbnailFromIndex
+// -----------------------------------------------------------------------------
+//
+void TestVideoModel_p::testGetVideoThumbnailFromIndex()
+{
+ // TODO:
+ // no thumbnail data
+ QVERIFY(mTestObject->getVideoThumbnailFromIndex(0) == 0);
+
+ mMediaFactory->removeArray();
+ QVERIFY(connect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*))));
+ mMediaFactory->createMediaItems(MEDIA_COUNT);
+ emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
+
+ QVERIFY(mTestObject->initialize() == 0);
+
+ // invalid indexes
+ QVERIFY(mTestObject->getVideoThumbnailFromIndex(-1) == 0);
+
+ QVERIFY(mTestObject->getVideoThumbnailFromIndex(MEDIA_COUNT) == 0);
+
+ // correct indexes
+ QVERIFY(mTestObject->getVideoThumbnailFromIndex(0) != 0);
+ QVERIFY(mTestObject->getVideoThumbnailFromIndex(MEDIA_COUNT/2) != 0);
+ QVERIFY(mTestObject->getVideoThumbnailFromIndex(MEDIA_COUNT - 1) != 0);
+
+ disconnect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*)));
+}
+
+// -----------------------------------------------------------------------------
+// testGetVideoSizeFromIndex
+// -----------------------------------------------------------------------------
+//
+void TestVideoModel_p::testGetVideoSizeFromIndex()
+{
+ QVERIFY(mTestObject->getVideoSizeFromIndex(0) == 0);
+ QVERIFY(mTestObject->getVideoSizeFromIndex(-1) == 0);
+
+ mMediaFactory->removeArray();
+ QVERIFY(connect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*))));
+ mMediaFactory->createMediaItems(MEDIA_COUNT);
+ emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
+
+ QVERIFY(mTestObject->getVideoSizeFromIndex(-1) == 0);
+
+ QVERIFY(mTestObject->getVideoSizeFromIndex(MEDIA_COUNT) == 0);
+
+ QVERIFY(mTestObject->getVideoSizeFromIndex(0) == 1);
+
+ QVERIFY(mTestObject->getVideoSizeFromIndex(MEDIA_COUNT - 1) == MEDIA_COUNT);
+
+ // data does not exist
+ mMediaFactory->removeArray();
+ mMediaFactory->createMediaItems(MEDIA_COUNT, MediaDataId);
+ emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
+
+ QVERIFY(mTestObject->getVideoSizeFromIndex(-1) == 0);
+
+ QVERIFY(mTestObject->getVideoSizeFromIndex(MEDIA_COUNT) == 0);
+
+ QVERIFY(mTestObject->getVideoSizeFromIndex(0) == 0);
+
+ QVERIFY(mTestObject->getVideoSizeFromIndex(MEDIA_COUNT - 1) == 0);
+
+ disconnect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*)));
+}
+
+// -----------------------------------------------------------------------------
+// testGetVideoAgeProfileFromIndex
+// -----------------------------------------------------------------------------
+//
+void TestVideoModel_p::testGetVideoAgeProfileFromIndex()
+{
+ QVERIFY(mTestObject->getVideoAgeProfileFromIndex(0) == 0);
+ QVERIFY(mTestObject->getVideoAgeProfileFromIndex(-1) == 0);
+
+ mMediaFactory->removeArray();
+ QVERIFY(connect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*))));
+ mMediaFactory->createMediaItems(MEDIA_COUNT);
+ emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
+
+ QVERIFY(mTestObject->getVideoAgeProfileFromIndex(-1) == 0);
+
+ QVERIFY(mTestObject->getVideoAgeProfileFromIndex(MEDIA_COUNT) == 0);
+
+ quint32 excepted = (0%5) + 1;
+
+ QVERIFY(mTestObject->getVideoAgeProfileFromIndex(0) == excepted);
+
+ excepted = ((MEDIA_COUNT - 1)%5) + 1;
+ QVERIFY(mTestObject->getVideoAgeProfileFromIndex(MEDIA_COUNT - 1) == excepted);
+
+ // data does not exist
+ mMediaFactory->removeArray();
+ mMediaFactory->createMediaItems(MEDIA_COUNT, MediaDataId);
+ emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
+
+ QVERIFY(mTestObject->getVideoAgeProfileFromIndex(-1) == 0);
+
+ QVERIFY(mTestObject->getVideoAgeProfileFromIndex(MEDIA_COUNT) == 0);
+
+ QVERIFY(mTestObject->getVideoAgeProfileFromIndex(0) == 0);
+
+ QVERIFY(mTestObject->getVideoAgeProfileFromIndex(MEDIA_COUNT - 1) == 0);
+
+ disconnect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*)));
+}
+
+// -----------------------------------------------------------------------------
+// testGetVideodurationFromIndex
+// -----------------------------------------------------------------------------
+//
+void TestVideoModel_p::testGetVideodurationFromIndex()
+{
+ QVERIFY(mTestObject->getVideodurationFromIndex(0) == 0);
+ QVERIFY(mTestObject->getVideodurationFromIndex(-1) == 0);
+
+ mMediaFactory->removeArray();
+ QVERIFY(connect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*))));
+ mMediaFactory->createMediaItems(MEDIA_COUNT);
+ emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
+
+ QVERIFY(mTestObject->getVideodurationFromIndex(-1) == 0);
+
+ QVERIFY(mTestObject->getVideodurationFromIndex(MEDIA_COUNT) == 0);
+
+ QVERIFY(mTestObject->getVideodurationFromIndex(0) == 1);
+
+ QVERIFY(mTestObject->getVideodurationFromIndex(MEDIA_COUNT - 1) == MEDIA_COUNT );
+
+ // data does not exist
+ mMediaFactory->removeArray();
+ mMediaFactory->createMediaItems(MEDIA_COUNT, MediaDataId);
+ emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
+
+ QVERIFY(mTestObject->getVideodurationFromIndex(-1) == 0);
+
+ QVERIFY(mTestObject->getVideodurationFromIndex(MEDIA_COUNT) == 0);
+
+ QVERIFY(mTestObject->getVideodurationFromIndex(0) == 0);
+
+ QVERIFY(mTestObject->getVideodurationFromIndex(MEDIA_COUNT - 1) == 0);
+
+ disconnect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*)));
+}
+
+// -----------------------------------------------------------------------------
+// testGetVideoDateFromIndex
+// -----------------------------------------------------------------------------
+//
+void TestVideoModel_p::testGetVideoDateFromIndex()
+{
+ QDateTime excepted;
+ QVERIFY(mTestObject->getVideoDateFromIndex(0) == excepted);
+ QVERIFY(mTestObject->getVideoDateFromIndex(-1) == excepted);
+
+ // test when data exists
+ mMediaFactory->removeArray();
+ QVERIFY(connect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*))));
+ mMediaFactory->createMediaItems(MEDIA_COUNT);
+ emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
+
+ QVERIFY(mTestObject->getVideoDateFromIndex(-1) == excepted);
+
+ QVERIFY(mTestObject->getVideoDateFromIndex(MEDIA_COUNT) == excepted);
+
+ excepted = QDateTime(QDate(2009, 1, 1), QTime(1,1,1,1));
+
+ QCOMPARE(mTestObject->getVideoDateFromIndex(0), excepted);
+
+ excepted = QDateTime(QDate(2009, MEDIA_COUNT, MEDIA_COUNT), QTime(MEDIA_COUNT,MEDIA_COUNT,MEDIA_COUNT,MEDIA_COUNT));
+
+ QCOMPARE(mTestObject->getVideoDateFromIndex(MEDIA_COUNT - 1), excepted);
+
+ // data does not exist
+ mMediaFactory->removeArray();
+ mMediaFactory->createMediaItems(MEDIA_COUNT, MediaDataId);
+ emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
+
+ excepted = QDateTime();
+ QVERIFY(mTestObject->getVideoDateFromIndex(-1) == excepted);
+ QVERIFY(mTestObject->getVideoDateFromIndex(MEDIA_COUNT) == excepted);
+ QVERIFY(mTestObject->getVideoDateFromIndex(0) == excepted);
+ QVERIFY(mTestObject->getVideoDateFromIndex(MEDIA_COUNT - 1) == excepted);
+ disconnect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*)));
+}
+
+// -----------------------------------------------------------------------------
+// testGetMetaDataFromIndex
+// -----------------------------------------------------------------------------
+//
+void TestVideoModel_p::testGetMetaDataFromIndex()
+{
+ using namespace VideoCollectionCommon;
+ QMap<QString, QVariant> map = mTestObject->getMetaDataFromIndex(0);
+ QVERIFY(map.isEmpty());
+ map = mTestObject->getMetaDataFromIndex(-1);
+ QVERIFY(map.isEmpty());
+
+ mMediaFactory->removeArray();
+ QVERIFY(connect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*))));
+ mMediaFactory->createMediaItems(MEDIA_COUNT);
+ emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
+
+ map = mTestObject->getMetaDataFromIndex(-1);
+ QVERIFY(map.isEmpty());
+
+ map = mTestObject->getMetaDataFromIndex(-1);
+ QVERIFY(map.isEmpty());
+
+ map = mTestObject->getMetaDataFromIndex(0);
+
+ QVERIFY(map.contains(MetaKeyDate));
+ QVERIFY(map.contains(MetaKeyDurationString));
+ QVERIFY(map.contains(MetaKeySizeString));
+ QVERIFY(map.contains(MetaKeyStarRating));
+ QVERIFY(map.contains(MetaKeyDescription));
+ QVERIFY(map.contains(MetaKeyModifiedDate));
+ QVERIFY(map.contains(MetaKeyAuthor));
+ QVERIFY(map.contains(MetaKeyCopyright));
+ QVERIFY(map.contains(MetaKeyLanguageString));
+ QVERIFY(map.contains(MetaKeyFormat));
+
+ // one or several of these will fail, when rest of the metadata is implemented.
+ QVERIFY(map.contains(MetaKeyDRMInfo) == false);
+ QVERIFY(map.contains(MetaKeyServiceURL) == false);
+ QVERIFY(map.contains(MetaKeyShotLocation) == false);
+ QVERIFY(map.contains(MetaKeyAudioType) == false);
+ QVERIFY(map.contains(MetaKeyKeywords) == false);
+ QVERIFY(map.contains(MetaKeyVideoResolutionString) == false);
+ QVERIFY(map.contains(MetaKeyBitRate) == false);
+
+ QCOMPARE(map[MetaKeyDate].toDate(), QDate(2009, 1, 1));
+ QVERIFY(map[MetaKeyDurationString].toString().isEmpty() == false);
+ QVERIFY(map[MetaKeySizeString].toString().isEmpty() == false);
+ QCOMPARE(map[MetaKeyStarRating].toUInt(), (uint)1);
+ QCOMPARE(map[MetaKeyDescription].toString(), gQTMediaDescPrefix + "0");
+ QCOMPARE(map[MetaKeyModifiedDate].toDate(), QDate::currentDate().addDays(2));
+ QCOMPARE(map[MetaKeyAuthor].toString(), gQTMediaAuthorPrefix + "0");
+ QCOMPARE(map[MetaKeyCopyright].toString(), gQTMediaCopyrightPrefix + "0");
+ QCOMPARE(map[MetaKeyLanguageString].toString(), gQTMediaLanguagePrefix + "0");
+ QCOMPARE(map[MetaKeyFormat].toString(), gQTMediaFormatPrefix + "0");
+
+ // data does not exist
+ mMediaFactory->removeArray();
+ mMediaFactory->createMediaItems(MEDIA_COUNT, MediaDataId);
+ emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
+ VideoCollectionUtils::mPrepareLengthStringReturnValue = "";
+ VideoCollectionUtils::mPrepareSizeStringReturnValue = "";
+
+ map = mTestObject->getMetaDataFromIndex(-1);
+ QVERIFY(map.isEmpty());
+
+ map = mTestObject->getMetaDataFromIndex(MEDIA_COUNT);
+ QVERIFY(map.isEmpty());
+
+ map = mTestObject->getMetaDataFromIndex(0);
+ QCOMPARE(map.count(), 0);
+
+ map = mTestObject->getMetaDataFromIndex(MEDIA_COUNT - 1);
+ QCOMPARE(map.count(), 0);
+
+ disconnect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*)));
+}
+
+// -----------------------------------------------------------------------------
+// testGetFilePathFromIndex
+// -----------------------------------------------------------------------------
+//
+void TestVideoModel_p::testGetFilePathFromIndex()
+{
+ QString path = mTestObject->getFilePathFromIndex(0);
+ QVERIFY(path.isNull());
+ path = mTestObject->getFilePathFromIndex(-1);
+ QVERIFY(path.isNull());
+
+ mMediaFactory->removeArray();
+ QVERIFY(connect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*))));
+ mMediaFactory->createMediaItems(MEDIA_COUNT);
+ emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
+
+ path = mTestObject->getFilePathFromIndex(-1);
+ QVERIFY(path.isNull());
+
+ path = mTestObject->getFilePathFromIndex(0);
+ QCOMPARE(path, gQTMediaPathPrefix + "0");
+
+ // data does not exist
+ mMediaFactory->removeArray();
+ mMediaFactory->createMediaItems(MEDIA_COUNT, MediaDataId);
+ emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
+
+ path = mTestObject->getFilePathFromIndex(0);
+ QVERIFY(path.isNull());
+
+ disconnect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*)));
+}
+
+// -----------------------------------------------------------------------------
+// testGetFilePathForId
+// -----------------------------------------------------------------------------
+//
+void TestVideoModel_p::testGetFilePathForId()
+{
+ QString path = mTestObject->getFilePathForId(TMPXItemId(0,0));
+ QVERIFY(path.isNull());
+ path = mTestObject->getFilePathForId(TMPXItemId::InvalidId());
+ QVERIFY(path.isNull());
+
+ mMediaFactory->removeArray();
+ QVERIFY(connect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*))));
+ mMediaFactory->createMediaItems(MEDIA_COUNT);
+ emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
+
+ path = mTestObject->getFilePathForId(TMPXItemId::InvalidId());
+ QVERIFY(path.isNull());
+
+ path = mTestObject->getFilePathForId(TMPXItemId(0,0));
+ QCOMPARE(path, gQTMediaPathPrefix + "0");
+
+ // data does not exist
+ mMediaFactory->removeArray();
+ mMediaFactory->createMediaItems(MEDIA_COUNT, MediaDataId);
+ emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
+
+ path = mTestObject->getFilePathForId(TMPXItemId(0,0));
+ QVERIFY(path.isNull());
+
+ 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
+// -----------------------------------------------------------------------------
+//
+void TestVideoModel_p::testThumbnailsFetchedSlot()
+{
+ QVERIFY(connect(this, SIGNAL(signalThumbnailsFetched(QList<TMPXItemId>)), mTestObject, SLOT(thumbnailsFetchedSlot(QList<TMPXItemId>))));
+
+ QSignalSpy spysignal(mTestObject, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)));
+ mMediaFactory->removeArray();
+
+ QList<TMPXItemId> mediaIds;
+
+ // test no videos
+ mediaIds.append(TMPXItemId(0, 0));
+ emit signalThumbnailsFetched(mediaIds);
+ QVERIFY(spysignal.count() == 0);
+ mediaIds.clear();
+
+ QVERIFY(connect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*))));
+ mMediaFactory->createMediaItems(MEDIA_COUNT);
+ emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
+
+ // test invalid ids
+ mediaIds.append(TMPXItemId::InvalidId());
+ emit signalThumbnailsFetched(mediaIds);
+ QVERIFY(spysignal.count() == 0);
+ spysignal.clear();
+ mediaIds.clear();
+ mediaIds.append(TMPXItemId(MEDIA_COUNT, 0));
+ emit signalThumbnailsFetched(mediaIds);
+ QVERIFY(spysignal.count() == 0);
+ mediaIds.clear();
+ mediaIds.append(TMPXItemId(MEDIA_COUNT + 1, 0));
+ emit signalThumbnailsFetched(mediaIds);
+ QVERIFY(spysignal.count() == 0);
+ mediaIds.clear();
+
+ // test correct ids
+ mediaIds.append(TMPXItemId(0, 0));
+ emit signalThumbnailsFetched(mediaIds);
+ QVERIFY(spysignal.count() == 1);
+ QVERIFY(spysignal.value(0).at(0).toInt() == 0);
+ spysignal.clear();
+ mediaIds.clear();
+ mediaIds.append(TMPXItemId(1, 0));
+ emit signalThumbnailsFetched(mediaIds);
+ QVERIFY(spysignal.count() == 1);
+ spysignal.clear();
+ mediaIds.clear();
+
+ mediaIds.append(TMPXItemId(MEDIA_COUNT/2, 0));
+ emit signalThumbnailsFetched(mediaIds);
+ QVERIFY(spysignal.count() == 1);
+
+ disconnect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*)));
+ disconnect(this, SIGNAL(signalThumbnailsFetched(QList<TMPXItemId>)), mTestObject, SLOT(thumbnailsFetchedSlot(QList<TMPXItemId>)));
+}
+
+// -----------------------------------------------------------------------------
+// testNewVideoListSlot
+// -----------------------------------------------------------------------------
+//
+void TestVideoModel_p::testNewVideoListSlot()
+{
+ QVERIFY(mTestObject->initialize() == 0);
+
+ 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)));
+ QSignalSpy spyModelReady(mStubModel, SIGNAL(modelReady()));
+
+ mMediaFactory->removeArray();
+ mMediaFactory->createMediaItems(MEDIA_COUNT);
+ // 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);
+ QCOMPARE(spyModelReady.count(), 1);
+ spyRowsAboutToInsert.clear();
+ spyRowsInserted.clear();
+ spyRowsAboutToRemove.clear();
+ spyRowsRemoved.clear();
+ spyModelReady.clear();
+
+ 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);
+ QCOMPARE(spyModelReady.count(), 0);
+
+
+ // 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);
+ QCOMPARE(spyModelReady.count(), 1);
+ spyRowsAboutToInsert.clear();
+ spyRowsInserted.clear();
+ spyRowsAboutToRemove.clear();
+ spyRowsRemoved.clear();
+ spyModelReady.clear();
+
+ // 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);
+ QCOMPARE(spyModelReady.count(), 1);
+ spyRowsAboutToInsert.clear();
+ spyRowsInserted.clear();
+ spyRowsAboutToRemove.clear();
+ spyRowsRemoved.clear();
+ spyModelReady.clear();
+
+ disconnect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*)));
+}
+
+// -----------------------------------------------------------------------------
+// testAppendVideoListSlot
+// -----------------------------------------------------------------------------
+//
+void TestVideoModel_p::testAppendVideoListSlot()
+{
+ QVERIFY(mTestObject->initialize() == 0);
+
+ 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)));
+
+ // append null
+ emit signalAppendVideoList(0);
+ QVERIFY(spyRowsAboutToInsert.count() == 0);
+ QVERIFY(spyRowsInserted.count() == 0);
+ QVERIFY(mTestObject->getVideoCount() == 0);
+
+ // append empty videolist
+ mMediaFactory->removeArray();
+ mMediaFactory->createMediaItems(0);
+ emit signalAppendVideoList(mMediaFactory->copyOfMediaArray());
+ QVERIFY(spyRowsAboutToInsert.count() == 0);
+ QVERIFY(spyRowsInserted.count() == 0);
+ QVERIFY(mTestObject->getVideoCount() == 0);
+
+ // send 10 videos
+ mMediaFactory->createMediaItems(10);
+ emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
+ spyRowsAboutToInsert.clear();
+ spyRowsInserted.clear();
+
+ // append videolist containing less than existing
+ mMediaFactory->removeArray();
+ mMediaFactory->createMediaItems(3);
+ emit signalAppendVideoList(mMediaFactory->copyOfMediaArray());
+ QVERIFY(spyRowsAboutToInsert.count() == 0);
+ QVERIFY(spyRowsInserted.count() == 0);
+ QVERIFY(mTestObject->getVideoCount() == 10);
+
+ // reset data
+ mTestObject->mMediaData.clear();
+
+ // append items with invalid ids:
+ // signals emitted, but items are really not appended
+ mMediaFactory->removeArray();
+ mMediaFactory->createMediaItems(3, MediaDataNone);
+ emit signalAppendVideoList(mMediaFactory->copyOfMediaArray());
+ QVERIFY(spyRowsAboutToInsert.count() == 1);
+ QVERIFY(spyRowsInserted.count() == 1);
+ QVERIFY(mTestObject->getVideoCount() == 0);
+ spyRowsAboutToInsert.clear();
+ spyRowsInserted.clear();
+
+ // append items with iId2 == 1 && iId1 != KVcxMvcCategoryIdDownloads (==1) && iId1 != KVcxMvcCategoryIdCaptured (== 3)
+ mMediaFactory->removeArray();
+ mMediaFactory->createMediaItems(0);
+ 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(mTestObject->getVideoCount() == 0);
+ spyRowsAboutToInsert.clear();
+ spyRowsInserted.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(mTestObject->getVideoCount() == 3);
+ spyRowsAboutToInsert.clear();
+ spyRowsInserted.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(mTestObject->getVideoCount() == 10);
+ spyRowsAboutToInsert.clear();
+ spyRowsInserted.clear();
+
+ disconnect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*)));
+ disconnect(this, SIGNAL(signalAppendVideoList(CMPXMediaArray*)), mTestObject, SLOT(appendVideoListSlot(CMPXMediaArray*)));
+}
+
+// -----------------------------------------------------------------------------
+// testNewVideoAvailableSlot
+// -----------------------------------------------------------------------------
+//
+void TestVideoModel_p::testNewVideoAvailableSlot()
+{
+ QVERIFY(mTestObject->initialize() == 0);
+
+ QSignalSpy spyRowsAboutToInsert(mStubModel, SIGNAL(rowsAboutToBeInserted (const QModelIndex& , int, int)));
+ QSignalSpy spyRowsInserted(mStubModel, SIGNAL(rowsInserted (const QModelIndex& , int, int)));
+
+ QVERIFY(connect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*))));
+ QVERIFY(connect(this, SIGNAL(signalNewVideoAvailable(CMPXMedia*)), mTestObject, SLOT(newVideoAvailableSlot(CMPXMedia*))));
+
+ CMPXMedia *media = mMediaFactory->getMedia(MEDIA_COUNT + 100);
+ // no media array
+ 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(mTestObject->getVideoCount() == 1);
+ delete media;
+ media = 0;
+ spyRowsAboutToInsert.clear();
+ spyRowsInserted.clear();
+
+ // null pointer provided
+ emit signalNewVideoAvailable(media);
+ QVERIFY(spyRowsAboutToInsert.count() == 0);
+ QVERIFY(spyRowsInserted.count() == 0);
+ QVERIFY(mTestObject->getVideoCount() == 1);
+
+ // invalid item
+ media = mMediaFactory->getMedia(MEDIA_COUNT + 100, MediaDataNone);
+ emit signalNewVideoAvailable(media);
+ QVERIFY(spyRowsAboutToInsert.count() == 0);
+ QVERIFY(spyRowsInserted.count() == 0);
+ QVERIFY(mTestObject->getVideoCount() == 1);
+ delete media;
+ media = 0;
+
+ delete mTestObject;
+ mTestObject = new VideoListDataModelPrivate(mStubModel);
+ QVERIFY(mTestObject->initialize() == 0);
+ QVERIFY(connect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*))));
+ QVERIFY(connect(this, SIGNAL(signalNewVideoAvailable(CMPXMedia*)), mTestObject, SLOT(newVideoAvailableSlot(CMPXMedia*))));
+
+ mMediaFactory->removeArray();
+ mMediaFactory->createMediaItems(MEDIA_COUNT);
+ emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
+ spyRowsAboutToInsert.clear();
+ spyRowsInserted.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(mTestObject->getVideoCount() == MEDIA_COUNT + 1);
+
+ disconnect(this, SIGNAL(signalNewVideoAvailable(CMPXMedia*)), mTestObject, SLOT(newVideoAvailableSlot(CMPXMedia*)));
+ disconnect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*)));
+}
+
+// -----------------------------------------------------------------------------
+// testVideoDeletedSlot
+// -----------------------------------------------------------------------------
+//
+void TestVideoModel_p::testVideoDeletedSlot()
+{
+ mMediaFactory->removeArray();
+
+ 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)));
+
+ // 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);
+
+
+ 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();
+
+ 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();
+
+ 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();
+
+ // 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);
+
+ // 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)));
+ 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->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);
+
+ emit signalDeleteCompleted(0, 0);
+ QVERIFY(spysignal.count() == 0);
+ QVERIFY(VideoCollectionWrapper::mLatestStatusCode == -1);
+ QVERIFY(!VideoCollectionWrapper::mLatestAdditional.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();
+
+ // 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);
+ QVERIFY(spysignal.count() == 1);
+ 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());
+
+
+ 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)));
+
+ // no videos
+ emit signalVideoDetailsCompleted(TMPXItemId(0,0));
+ QVERIFY(spysignal.count() == 0);
+
+ mMediaFactory->createMediaItems(MEDIA_COUNT);
+ emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
+
+ // invalid id
+ emit signalVideoDetailsCompleted(TMPXItemId::InvalidId());
+ QVERIFY(spysignal.count() == 0);
+ emit signalVideoDetailsCompleted(MEDIA_COUNT);
+ QVERIFY(spysignal.count() == 0);
+
+ // correct ids
+ emit signalVideoDetailsCompleted(TMPXItemId(0,0));
+ QVERIFY(spysignal.count() == 1);
+ QVERIFY(spysignal.value(0).at(0).toInt() == 0);
+ 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)));
+}
+
+// -----------------------------------------------------------------------------
+// testCollectionItemCount
+// -----------------------------------------------------------------------------
+//
+void TestVideoModel_p::testCollectionItemCount()
+{
+ QVERIFY(mTestObject->getVideoCount() == 0);
+
+ QVERIFY(connect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*))));
+
+ mMediaFactory->removeArray();
+ mMediaFactory->createCollectionItems();
+ emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
+
+ QVERIFY( mTestObject->getVideoCount() == 2);
+
+ disconnect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*)));
+}
+
+// -----------------------------------------------------------------------------
+// testGetCollectionIdFromIndex
+// -----------------------------------------------------------------------------
+//
+void TestVideoModel_p::testGetCollectionIdFromIndex()
+{
+ QVERIFY(mTestObject->getMediaIdFromIndex(0) == -1);
+ QVERIFY(mTestObject->getMediaIdFromIndex(-1) == -1);
+
+ mMediaFactory->removeArray();
+ QVERIFY(connect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*))));
+ mMediaFactory->createCollectionItems();
+ emit signalNewVideoList(mMediaFactory->copyOfMediaArray());
+
+ QVERIFY(mTestObject->getMediaIdFromIndex(-1) == TMPXItemId::InvalidId());
+
+ QVERIFY(mTestObject->getMediaIdFromIndex(0) == TMPXItemId(KVcxMvcCategoryIdDownloads, 1));
+
+ QVERIFY(mTestObject->getMediaIdFromIndex(1) == TMPXItemId(KVcxMvcCategoryIdCaptured, 1));
+
+ disconnect(this, SIGNAL(signalNewVideoList(CMPXMediaArray*)), mTestObject, SLOT(newVideoListSlot(CMPXMediaArray*)));
+}
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel_p/stub/inc/videocollectionutils.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,158 @@
+/*
+* 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 <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 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_p/stub/inc/videocollectionwrapper.h Thu Apr 01 22:38:49 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: 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();
+
+ /**
+ * Decreases the reference count, when count reaches zero cleanup is done.
+ *
+ */
+ void decreaseReferenceCount();
+
+ /**
+ * 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();
+
+public:
+
+ static VideoCollectionWrapper *mInstance;
+
+ static int mReferenceCount;
+};
+
+#endif // __VIDEOCOLLECTIONWRAPPER_H__
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel_p/stub/inc/videodatacontainer.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,125 @@
+/*
+* 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 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;
+
+private: // data
+
+ /**
+ * list of media ids used to fetch item thought index.
+ */
+ QList<TMPXItemId> mMediaIds;
+
+ /**
+ * lookup hash for fetching correct item based on id.
+ * Multihash needed in stub to be able to make sure appending
+ * works ok
+ * Key: item id
+ * value: pair, where first is item index and second is item data
+ */
+ QMultiHash<TMPXItemId, QPair<int, CMPXMedia*> > mMediaData;
+
+};
+
+#endif // __VIDEODATACONTAINER_H__
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel_p/stub/inc/videothumbnaildata.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,168 @@
+/*
+* 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: CVideoThumbnailData stub -class definition for unit testing CVideoListData*
+*/
+
+#ifndef __VIDEOTHUMBNAILDATA_H__
+#define __VIDEOTHUMBNAILDATA_H__
+
+
+// INCLUDES
+#include <QObject>
+#include <QMap>
+#include <QPair>
+#include <QIcon>
+#include <QList>
+#include <e32const.h>
+#include <mpxitemid.h>
+
+// FORWARD DECLARATIONS
+
+
+class VideoThumbnailData : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ /*
+ * Thumbnail fetch priorities
+ */
+ enum VideoThumbnailPriority
+ {
+ VideoThumbnailPriorityLow = 2000,
+ VideoThumbnailPriorityMedium = 3000,
+ VideoThumbnailPriorityHigh = 5000
+ };
+
+ /**
+ * Returns singleton instance for this class.
+ *
+ * @return The singleton instance.
+ *
+ */
+ static VideoThumbnailData &instance();
+
+ /**
+ * stub:
+ * increases gStartFetchingCounter by the count of indexes.
+ * return -1 if gFailFetchTn is true
+ * return 0 if gFailFetchTn is false
+ */
+ int startFetchingThumbnails(const QList<int> &indexes, VideoThumbnailPriority priority, bool setFetchIndex = true);
+
+ /**
+ * stub:
+ * increases gStartFetchingCounter by one
+ * return -1 if gFailFetchTn is true
+ * return 0 if gFailFetchTn is false
+ *
+ */
+ int startFetchingThumbnail(int mediaId, int priority);
+
+ /**
+ *
+ *
+ *
+ */
+ const QIcon* getThumbnail( TMPXItemId mediaId );
+
+ /**
+ * stub:
+ * return -1 if gFailRemoveTn is true
+ * return 0 if gFailRemoveTn is false
+ *
+ */
+ int removeThumbnail( TMPXItemId mediaId );
+
+ /**
+ *
+ *
+ */
+ const QIcon* defaultThumbnail();
+
+private:
+
+ /**
+ * stub:
+ * return -1 if gFailInitilize is true
+ * return 0 if gFailInitilize is false
+ *
+ */
+ int initialize();
+
+ /**
+ * Default constructor
+ */
+ VideoThumbnailData();
+
+ /**
+ * Destructor
+ */
+ ~VideoThumbnailData();
+
+public:
+
+ // Testing methods.
+
+ /**
+ * sets gFailInitilize
+ */
+ static void setInitializationFail(bool fail);
+
+ /**
+ * zeroes gStartFetchingCounter
+ */
+ static void resetStartFetchingCount();
+
+ /**
+ * returns gStartFetchingCounter
+ */
+ static int getStartFetchingCount();
+
+ /**
+ * zeroes gRemoveCounter
+ */
+ static void resetRemoveCount();
+
+ /**
+ * returns gRemoveCounter
+ */
+ static int getRemoveCount();
+
+signals:
+
+ /**
+ * This signal is emitted from thumbnailReadySlot, when
+ * thumbnail generatio nis ready from the tn manager.
+ *
+ * Media id for the video is passed along with the signal.
+ *
+ *
+ * @param mediaId: id of the video whose thumbnail is ready.
+ *
+ */
+ void thumbnailsFetched( QList<TMPXItemId> mediaId );
+
+private:
+
+ /**
+ * empty icon
+ */
+ QIcon emptyIcon;
+
+};
+#endif // __VIDEOTHUMBNAILDATA_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel_p/stub/src/videocollectionwrapper.cpp Thu Apr 01 22:38:49 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: stub CVideoCollectionWrapper class for unitesting CVideoListData
+*
+*/
+
+// INCLUDE FILES
+
+#include "videocollectionwrapper.h"
+
+int VideoCollectionWrapper::mLatestStatusCode = -1;
+
+QVariant VideoCollectionWrapper::mLatestAdditional = QVariant();
+
+int VideoCollectionWrapper::mReferenceCount = 0;
+VideoCollectionWrapper *VideoCollectionWrapper::mInstance = 0;
+
+// -----------------------------------------------------------------------------
+// CVideoCollectionWrapper::CVideoCollectionWrapper()
+// -----------------------------------------------------------------------------
+//
+VideoCollectionWrapper *VideoCollectionWrapper::instance()
+{
+ if(!mInstance)
+ {
+ mInstance = new VideoCollectionWrapper();
+ }
+ mInstance->mReferenceCount++;
+ return mInstance;
+}
+
+// -----------------------------------------------------------------------------
+// CVideoCollectionWrapper::cleanup()
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionWrapper::decreaseReferenceCount()
+{
+ if(mInstance)
+ {
+ if(--mInstance->mReferenceCount == 0)
+ {
+ delete mInstance;
+ mInstance = NULL;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+// 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_p/stub/src/videodatacontainer.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,166 @@
+/*
+* 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 VideoListData class declaration*
+*/
+
+#include <mpxmediageneraldefs.h>
+#include <mpxmedia.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();
+}
+
+// -----------------------------------------------------------------------------
+// clear
+// -----------------------------------------------------------------------------
+//
+void VideoDataContainer::clear()
+{
+ QMultiHash<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)
+{
+ QMultiHash<TMPXItemId, QPair<int, CMPXMedia*> >::iterator removeIter = mMediaData.find(id);
+ if(removeIter == mMediaData.end())
+ {
+ return;
+ }
+ QMultiHash<TMPXItemId, QPair<int, CMPXMedia*> >::iterator hashIter;
+ mMediaIds.removeAt(removeIter->first);
+ // sync item indexes whose ids exist in id- list after
+ // recently removoved.
+ int count = mMediaIds.count();
+ for(int i = removeIter->first; i < count; ++i)
+ {
+ hashIter = mMediaData.find(mMediaIds[i]);
+ if(hashIter != mMediaData.end())
+ {
+ hashIter->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;
+ }
+ // just append item even there are duplicates
+ mMediaIds.append(mediaId);
+ mMediaData.insert(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
+{
+ QMultiHash<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();
+}
+
+// end of gile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel_p/stub/src/videothumbnaildata.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,171 @@
+/*
+* 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: CVideoThumbnailData class implementation
+*
+*/
+// INCLUDE FILES
+#include <QPixmap>
+#include <mpxmediageneraldefs.h>
+
+#include "..\inc\videothumbnaildata.h"
+
+bool gFailInitilize = false;
+bool gFailFetchTn = false;
+bool gFailRemoveTn = false;
+int gStartFetchingCounter = 0;
+int gRemoveCounter = 0;
+
+// static helper methods
+// -----------------------------------------------------------------------------
+// setInitializationFail
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailData::setInitializationFail(bool fail)
+{
+ gFailInitilize = fail;
+}
+
+// -----------------------------------------------------------------------------
+// resetStartFetchingCount
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailData::resetStartFetchingCount()
+{
+ gStartFetchingCounter = 0;
+}
+
+// -----------------------------------------------------------------------------
+// getStartFetchingCount
+// -----------------------------------------------------------------------------
+//
+int VideoThumbnailData::getStartFetchingCount()
+{
+ return gStartFetchingCounter;
+}
+
+// -----------------------------------------------------------------------------
+// resetRemoveCount
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailData::resetRemoveCount()
+{
+ gRemoveCounter = 0;
+}
+
+// -----------------------------------------------------------------------------
+// getRemoveCount
+// -----------------------------------------------------------------------------
+//
+int VideoThumbnailData::getRemoveCount()
+{
+ return gRemoveCounter;
+}
+
+// Stub methods.
+
+// -----------------------------------------------------------------------------
+// CVideoThumbnailData::instance()
+// -----------------------------------------------------------------------------
+//
+VideoThumbnailData &VideoThumbnailData::instance()
+{
+ static VideoThumbnailData _thumbnailData;
+ return _thumbnailData;
+}
+
+// -----------------------------------------------------------------------------
+// CVideoThumbnailData::CVideoThumbnailData()
+// -----------------------------------------------------------------------------
+//
+VideoThumbnailData::VideoThumbnailData()
+{
+}
+
+// -----------------------------------------------------------------------------
+// CVideoThumbnailData::~CVideoThumbnailData()
+// -----------------------------------------------------------------------------
+//
+VideoThumbnailData::~VideoThumbnailData()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// CVideoThumbnailData::initialize()
+// -----------------------------------------------------------------------------
+//
+int VideoThumbnailData::initialize()
+{
+ if(gFailInitilize)
+ {
+ return -1;
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// CVideoThumbnailData::getThumbnail()
+// -----------------------------------------------------------------------------
+//
+const QIcon* VideoThumbnailData::getThumbnail( TMPXItemId mediaId )
+{
+ if(mediaId == TMPXItemId::InvalidId())
+ {
+ return 0;
+ }
+ return &emptyIcon;
+}
+
+// -----------------------------------------------------------------------------
+// CVideoThumbnailData::startFetchingThumbnail()
+// -----------------------------------------------------------------------------
+//
+int VideoThumbnailData::startFetchingThumbnail( int mediaId, int priority )
+{
+ gStartFetchingCounter++;
+ if(gFailFetchTn)
+ {
+ return -1;
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// CVideoThumbnailData::defaultThumbnail()
+// -----------------------------------------------------------------------------
+//
+const QIcon* VideoThumbnailData::defaultThumbnail()
+{
+ // TODO
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// CVideoThumbnailData::removeThumbnail()
+// -----------------------------------------------------------------------------
+//
+int VideoThumbnailData::removeThumbnail( TMPXItemId mediaId )
+{
+ gRemoveCounter++;
+ if(gFailRemoveTn)
+ {
+ return -1;
+ }
+ // TODO: do we need to do something with the tn wrapper as well?
+ return 1;
+
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideomodel_p/testvideomodel_p.pro Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,44 @@
+######################################################################
+# 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/videolistdatamodel.h \
+ stub/inc/videocollectionwrapper.h \
+ stub/inc/videocollectionutils.h \
+ stub/inc/videodatacontainer.h \
+ ../../inc/videodatasignalreceiver.h \
+ ../../inc/videolistdatamodel_p.h \
+ inc/testvideomodel_p.h \
+ inc/mediaobjectfactory.h \
+ stub/inc/videothumbnaildata.h \
+
+SOURCES += stub/src/videocollectionwrapper.cpp \
+ stub/src/videocollectionutils.cpp \
+ stub/src/videodatacontainer.cpp \
+ ../../src/videolistdatamodel_p.cpp \
+ src/testvideomodel_p.cpp \
+ src/mediaobjectfactory.cpp \
+ stub/src/videothumbnaildata.cpp \
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/inc/testvideosortfilterproxymodel.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,241 @@
+/**
+* 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 __TESTVIDEOSORTFILTERPROXYMODEL_H__
+#define __TESTVIDEOSORTFILTERPROXYMODEL_H__
+
+
+// INCLUDES
+#include <QtTest/QtTest>
+
+class VideoListDataModel;
+class FilterProxyTester;
+class VideoCollectionClient;
+
+class TestVideoSortFilterProxyModel : public QObject
+{
+ Q_OBJECT
+
+ // test functions for the test framework
+
+private slots:
+
+ /**
+ * will be called before each testfunction is executed.
+ *
+ */
+ void init();
+
+ /**
+ * will be called after every testfunction.
+ *
+ */
+ void cleanup();
+
+ /**
+ * Test initialize with valid data.
+ */
+ void testInitialize();
+
+ /**
+ * 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.
+ */
+ void testSecondInitialize();
+
+ /**
+ * Test second call to initialize when model init fails.
+ */
+ void testSecondInitializeModelInitFail();
+
+ /**
+ * Test open.
+ */
+ void testOpen();
+
+ /**
+ * Test deleteItems with valid data.
+ */
+ void testDeleteItems();
+
+ /**
+ * Test deleteItems with NULL model.
+ */
+ void testDeleteItemsModelNull();
+
+ /**
+ * Test deleteItems when removeRows fails.
+ */
+ void testDeleteItemsRemoveRowsFail();
+
+ /**
+ * Test openItem with valid data.
+ */
+ void testOpenItem();
+
+ /**
+ * Test openItem when getMediaId fails.
+ */
+ void testOpenItemGetMediaIdFail();
+
+ /**
+ * Test openItem when model is NULL.
+ */
+ void testOpenItemModelNull();
+
+ /**
+ * Test openItem when openVideo fails.
+ */
+ void testOpenItemOpenVideoFails();
+
+ /**
+ * Test back with valid data.
+ */
+ void testBack();
+
+ /**
+ * Test back when videocollectionclient is null.
+ */
+ void testBackClientNull();
+
+ /**
+ * Test fetchItemDetails with valid data.
+ */
+ void testFetchItemDetails();
+
+ /**
+ * Test fetchItemDetails when getMediaId fails.
+ */
+ void testFetchItemDetailsGetMediaIdFail();
+
+ /**
+ * Test fetchItemDetails when getVideoDetails fails.
+ */
+ void testFetchItemDetailsGetVideoDetailsFails();
+
+ /**
+ * Test lessThan when initialize has not been called.
+ */
+ void testLessThanProxyModelNotInitialized();
+
+ /**
+ * Calls sure lessThan with Qt::DisplayRole setted on
+ * tests that return values are correct for presetted items
+ */
+ void testLessThanName();
+
+ /**
+ * Calls sure lessThan with VideoCollectionCommon::KeySizeValue setted on
+ * tests that return values are correct for presetted items
+ */
+ void testLessThanSize();
+
+ /**
+ * Calls sure lessThan with VideoCollectionCommon::KeyDate setted on
+ * tests that return values are correct for presetted items
+ */
+ void testLessThanDateTime();
+
+ /**
+ * Calls sure lessThan with invalid role,
+ * same indexes and for invalid data
+ * tests that return values are correct for presetted items
+ */
+ void testLessThanInvalid();
+
+ /**
+ * Calls doSorting.
+ * tests that sorting is done only once
+ */
+ void testDoSorting();
+
+ /**
+ * Test filterAcceptsRow when initialize has not been called.
+ */
+ void testFilterAcceptsRowProxyModelNotInitialized();
+
+ /**
+ * Calls filterAcceptsRow.
+ * Tests that return values are correct with items with varying statuses.
+ *
+ */
+ void testFilterAcceptsRow();
+
+ /**
+ * Test getMediaFilePathForId.
+ */
+ void testGetMediaFilePathForId();
+
+ /**
+ * Tests calling addNewCollection when initialize has not been called.
+ */
+ void testAddNewCollectionNoCollectionClient();
+
+ /**
+ * Tests calling addNewCollection where collection client returns 0.
+ */
+ void testAddNewCollectionSucceed();
+
+ /**
+ * Tests calling addNewCollection where collection client returns -1.
+ */
+ void testAddNewCollectionFail();
+
+public slots:
+
+ int testShortDetailsReadySlot(int index);
+
+private:
+
+ /**
+ * stub videolist model
+ */
+ VideoListDataModel *mStubModel;
+
+ /**
+ * stub CVideoCollectionClient.
+ */
+ VideoCollectionClient *mCollectionClient;
+
+ /**
+ * tester object inherited from the actual test object
+ * implemented to be able to call protected objects
+ */
+ FilterProxyTester *mTestObject;
+};
+
+
+#endif // __TESTVIDEOSORTFILTERPROXYMODEL_H__
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/src/testvideosortfilterproxymodel.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,1151 @@
+/**
+* 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 <QModelIndex>
+#include <QModelIndexList>
+#include <hbapplication.h>
+
+#include "videocollectioncommon.h"
+#include "testvideosortfilterproxymodel.h"
+#include "filterproxytester.h"
+#include "videolistdatamodel.h"
+#include "videocollectionclient.h"
+#include "videocollectioncommon.h"
+#include "videothumbnaildata.h"
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ HbApplication app(argc, argv);
+
+ 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);
+
+ return res;
+}
+
+
+// ---------------------------------------------------------------------------
+// init
+// ---------------------------------------------------------------------------
+//
+void TestVideoSortFilterProxyModel::init()
+{
+ VideoListDataModel::mInitFails = false;
+ VideoListDataModel::mRemoveRowsFails = false;
+ VideoListDataModel::mGetMediaIdAtIndexFails = false;
+ VideoCollectionClient::mFailMediaPlayback = false;
+ VideoCollectionClient::mFailMediaDetails = false;
+ VideoCollectionClient::mFailInit = false;
+ VideoCollectionClient::mFailAddNewCollection = false;
+ VideoCollectionClient::mSortOrderSetCount = 0;
+ VideoCollectionClient::mAddNewCollectionName = QString();
+ VideoCollectionClient::mAddNewCollectionThumb = QString();
+ VideoCollectionClient::mAddNewCollectionIds = QList<TMPXItemId>();
+ VideoThumbnailData::mStartBackgroundFetchingCallCount = 0;
+
+ mTestObject = new FilterProxyTester();
+ QVERIFY(mTestObject);
+
+ mStubModel = new VideoListDataModel();
+ QVERIFY(mStubModel);
+
+ mCollectionClient = new VideoCollectionClient();
+ QVERIFY(mCollectionClient);
+}
+
+// ---------------------------------------------------------------------------
+// cleanup
+// ---------------------------------------------------------------------------
+//
+void TestVideoSortFilterProxyModel::cleanup()
+{
+ delete mCollectionClient;
+ mCollectionClient = 0;
+
+ delete mStubModel;
+ mStubModel = 0;
+
+ delete mTestObject;
+ mTestObject = 0;
+}
+
+// ---------------------------------------------------------------------------
+// testInitialize
+// ---------------------------------------------------------------------------
+//
+void TestVideoSortFilterProxyModel::testInitialize()
+{
+ QVERIFY(mTestObject->initialize(mStubModel) == 0);
+}
+
+// ---------------------------------------------------------------------------
+// testInitializeSignalConnectFail
+// ---------------------------------------------------------------------------
+//
+void TestVideoSortFilterProxyModel::testInitializeSignalConnectFail()
+{
+ QVERIFY(mTestObject->initialize(NULL) == -1);
+}
+
+// ---------------------------------------------------------------------------
+// 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
+// ---------------------------------------------------------------------------
+//
+void TestVideoSortFilterProxyModel::testSecondInitialize()
+{
+ QVERIFY(mTestObject->initialize(mStubModel) == 0);
+ QVERIFY(mTestObject->initialize(mStubModel) == 0);
+}
+
+// ---------------------------------------------------------------------------
+// testSecondInitializeModelInitFail
+// ---------------------------------------------------------------------------
+//
+void TestVideoSortFilterProxyModel::testSecondInitializeModelInitFail()
+{
+ QVERIFY(mTestObject->initialize(mStubModel) == 0);
+ VideoListDataModel::mInitFails = true;
+ QVERIFY(mTestObject->initialize(mStubModel) == -1);
+}
+
+// ---------------------------------------------------------------------------
+// testOpen
+// ---------------------------------------------------------------------------
+//
+void TestVideoSortFilterProxyModel::testOpen()
+{
+ // First open.
+ QVERIFY(mTestObject->open(1) == 0);
+ // Open again with same level.
+ QVERIFY(mTestObject->open(1) == 0);
+ // Fail open.
+ VideoCollectionClient::mFailStartOpen = true;
+ QVERIFY(mTestObject->open(20) == -1);
+}
+
+// ---------------------------------------------------------------------------
+// testDeleteItems
+// ---------------------------------------------------------------------------
+//
+void TestVideoSortFilterProxyModel::testDeleteItems()
+{
+ 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(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(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);
+ // need to wait for awhile to make sure zero-counter gets
+ // processing time.
+ QTest::qWait(500);
+ QVERIFY(mTestObject->sortRole() == Qt::DisplayRole);
+
+ QModelIndexList list;
+ QModelIndex index;
+ for(int i = 0; i < 5; ++i)
+ {
+ index = mTestObject->index(i,0);
+ 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);
+}
+
+// ---------------------------------------------------------------------------
+// testDeleteItemsModelNull
+// ---------------------------------------------------------------------------
+//
+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);
+}
+
+// ---------------------------------------------------------------------------
+// testDeleteItemsRemoveRowsFail
+// ---------------------------------------------------------------------------
+//
+void TestVideoSortFilterProxyModel::testDeleteItemsRemoveRowsFail()
+{
+ VideoListDataModel::mRemoveRowsFails = true;
+
+ 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
+// ---------------------------------------------------------------------------
+//
+void TestVideoSortFilterProxyModel::testOpenItemGetMediaIdFail()
+{
+ VideoListDataModel::mGetMediaIdAtIndexFails = true;
+
+ mStubModel->appendData("Test");
+ mStubModel->setUsedRowCount(1);
+ QVERIFY(mTestObject->initialize(mStubModel) == 0);
+ QModelIndex index = mTestObject->index(0, 0);
+
+ User::Heap().__DbgMarkStart();
+
+ QVERIFY(mTestObject->openItem(index) == -1);
+
+ int remHeap = User::Heap().__DbgMarkEnd(0);
+ QVERIFY(remHeap == 0);
+}
+
+// ---------------------------------------------------------------------------
+// testOpenItemModelNull
+// ---------------------------------------------------------------------------
+//
+void TestVideoSortFilterProxyModel::testOpenItemModelNull()
+{
+ 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);
+}
+// ---------------------------------------------------------------------------
+// testOpenItemOpenVideoFails
+// ---------------------------------------------------------------------------
+//
+void TestVideoSortFilterProxyModel::testOpenItemOpenVideoFails()
+{
+ VideoCollectionClient::mFailMediaPlayback = true;
+
+ mStubModel->appendData("Test");
+ mStubModel->setUsedRowCount(1);
+ QVERIFY(mTestObject->initialize(mStubModel) == 0);
+
+ QModelIndex index = mTestObject->index(0, 0);
+ User::Heap().__DbgMarkStart();
+
+ QVERIFY(mTestObject->openItem(index) == -1);
+
+ int remHeap = User::Heap().__DbgMarkEnd(0);
+ QVERIFY(remHeap == 0);
+}
+
+// ---------------------------------------------------------------------------
+// testBack
+// ---------------------------------------------------------------------------
+//
+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);
+}
+
+// ---------------------------------------------------------------------------
+// testBack
+// ---------------------------------------------------------------------------
+//
+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);
+}
+
+// ---------------------------------------------------------------------------
+// testFetchItemDetails
+// ---------------------------------------------------------------------------
+//
+void TestVideoSortFilterProxyModel::testFetchItemDetails()
+{
+ mStubModel->appendData("Test");
+ mStubModel->setUsedRowCount(1);
+ QVERIFY(mTestObject->initialize(mStubModel) == 0);
+
+ QSignalSpy fetchSpy(mTestObject, SIGNAL(shortDetailsReady(int)));
+
+ QModelIndex index = mTestObject->index(0, 0);
+
+ QList<QVariant> arguments;
+
+ User::Heap().__DbgMarkStart();
+ QVERIFY(mTestObject->fetchItemDetails(index) == 0);
+
+ QVERIFY(fetchSpy.count() == 1);
+ arguments = fetchSpy.takeFirst();
+ QVERIFY(arguments.at(0).toInt() == 0);
+ arguments.clear();
+ fetchSpy.clear();
+
+ int remHeap = User::Heap().__DbgMarkEnd(0);
+ QVERIFY(remHeap == 0);
+}
+
+// ---------------------------------------------------------------------------
+// testFetchItemDetails
+// ---------------------------------------------------------------------------
+//
+void TestVideoSortFilterProxyModel::testFetchItemDetailsGetMediaIdFail()
+{
+ VideoListDataModel::mGetMediaIdAtIndexFails = true;
+
+ mStubModel->appendData("Test");
+ mStubModel->setUsedRowCount(1);
+ QVERIFY(mTestObject->initialize(mStubModel) == 0);
+
+ QSignalSpy fetchSpy(mTestObject, SIGNAL(shortDetailsReady(int)));
+
+ 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);
+}
+
+// ---------------------------------------------------------------------------
+// testFetchItemDetails
+// ---------------------------------------------------------------------------
+//
+void TestVideoSortFilterProxyModel::testFetchItemDetailsGetVideoDetailsFails()
+{
+ VideoCollectionClient::mFailMediaDetails = true;
+
+ mStubModel->appendData("Test");
+ mStubModel->setUsedRowCount(1);
+ QVERIFY(mTestObject->initialize(mStubModel) == 0);
+
+ QSignalSpy fetchSpy(mTestObject, SIGNAL(shortDetailsReady(int)));
+ 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()
+{
+ 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);
+
+ 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);
+
+ QVERIFY(!mTestObject->callLessThan(left, right));
+
+ left = mStubModel->index(1,0);
+ right = mStubModel->index(2,0);
+
+ QVERIFY(!mTestObject->callLessThan(left, right));
+
+ left = mStubModel->index(2,0);
+ right = mStubModel->index(3,0);
+
+ QVERIFY(!mTestObject->callLessThan(left, right));
+
+ left = mStubModel->index(3,0);
+ right = mStubModel->index(4,0);
+ QVERIFY(!mTestObject->callLessThan(left, right));
+
+ left = mStubModel->index(4,0);
+ 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);
+
+ // case sensitive check
+ name1 = "cc";
+ name2 = "CC";
+ name3 = "cC";
+ name4 = "aa";
+ name5 = "Aa";
+ QString name6 = "2Aa";
+ QString name7 = "1Aa";
+ QString name8 = "1cc";
+
+ 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
+ mStubModel->appendData(name4); // to index 3, position can be 3 or 4
+ mStubModel->appendData(name5); // to index 4, position can be 3 or 4
+ mStubModel->appendData(name6); // to index 5, position is 2
+ 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"
+
+ QVERIFY(!mTestObject->callLessThan(left, right));
+
+ left = mStubModel->index(1,0); // "CC"
+ right = mStubModel->index(2,0); // "cC"
+
+ QVERIFY(!mTestObject->callLessThan(left, right));
+
+ left = mStubModel->index(2,0); // "cC"
+ right = mStubModel->index(3,0); // "aa"
+
+ QVERIFY(!mTestObject->callLessThan(left, right));
+
+ left = mStubModel->index(3,0); // "aa"
+ right = mStubModel->index(2,0); // "cC"
+
+ QVERIFY(mTestObject->callLessThan(left, right));
+
+ left = mStubModel->index(3,0); // "aa"
+ right = mStubModel->index(4,0); // "Aa"
+ QVERIFY(!mTestObject->callLessThan(left, right));
+
+ left = mStubModel->index(4,0); // "Aa"
+ right = mStubModel->index(5,0); // "2Aa"
+
+ QVERIFY(!mTestObject->callLessThan(left, right));
+
+ left = mStubModel->index(5,0); // "2Aa"
+ right = mStubModel->index(6,0); // "1Aa"
+ QVERIFY(!mTestObject->callLessThan(left, right));
+
+ left = mStubModel->index(6,0); // "1Aa"
+ right = mStubModel->index(7,0); // "1cc"
+ QVERIFY(mTestObject->callLessThan(left, right));
+
+ left = mStubModel->index(5,0); // "2Aa"
+ right = mStubModel->index(7,0); // "1cc"
+ QVERIFY(!mTestObject->callLessThan(left, right));
+
+ 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);
+
+}
+
+// ---------------------------------------------------------------------------
+// testLessThanSize
+// ---------------------------------------------------------------------------
+//
+void TestVideoSortFilterProxyModel::testLessThanSize()
+{
+ QVERIFY(mTestObject->initialize(mStubModel) == 0);
+
+ quint32 size1 = 300;
+ quint32 size2 = 200;
+ quint32 size3 = 100;
+ quint32 size4 = 99;
+ quint32 size5 = 99;
+
+ mStubModel->appendData(size1); // to index 0
+ mStubModel->appendData(size2); // to index 1
+ 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);
+
+ QVERIFY(!mTestObject->callLessThan(left, right));
+
+ left = mStubModel->index(1,0);
+ right = mStubModel->index(2,0);
+
+ QVERIFY(!mTestObject->callLessThan(left, right));
+
+ left = mStubModel->index(2,0);
+ right = mStubModel->index(3,0);
+
+ QVERIFY(!mTestObject->callLessThan(left, right));
+
+ left = mStubModel->index(3,0);
+ right = mStubModel->index(4,0);
+
+ QVERIFY(!mTestObject->callLessThan(left, right));
+
+ left = mStubModel->index(4,0);
+ right = mStubModel->index(0,0);
+
+ QVERIFY(mTestObject->callLessThan(left, right));
+
+ int remHeap = User::Heap().__DbgMarkEnd(0);
+ QVERIFY(remHeap == 0);
+}
+
+// ---------------------------------------------------------------------------
+// testLessThanDate
+// ---------------------------------------------------------------------------
+//
+void TestVideoSortFilterProxyModel::testLessThanDateTime()
+{
+ QVERIFY(mTestObject->initialize(mStubModel) == 0);
+
+ QDateTime date1(QDate(2010, 11, 5), QTime(0,0));
+ QDateTime date2(QDate(2009, 9, 5), QTime(0,0));
+ QDateTime date3(QDate(2009, 9, 4), QTime(0,0));
+ QDateTime date4(QDate(2008, 9, 6), QTime(0,0));
+ QDateTime date5(QDate(2008, 9, 6), QTime(0,0));
+
+ mStubModel->appendData(date1); // to index 0
+ mStubModel->appendData(date2); // to index 1
+ 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);
+
+ QVERIFY(mTestObject->callLessThan(left, right));
+
+ left = mStubModel->index(1,0);
+ right = mStubModel->index(2,0);
+
+ QVERIFY(mTestObject->callLessThan(left, right));
+
+ left = mStubModel->index(2,0);
+ right = mStubModel->index(3,0);
+
+ QVERIFY(mTestObject->callLessThan(left, right));
+
+ left = mStubModel->index(3,0);
+ right = mStubModel->index(4,0);
+
+ QVERIFY(!mTestObject->callLessThan(left, right));
+
+ left = mStubModel->index(4,0);
+ right = mStubModel->index(0,0);
+
+ QVERIFY(!mTestObject->callLessThan(left, right));
+
+ int remHeap = User::Heap().__DbgMarkEnd(0);
+ QVERIFY(remHeap == 0);
+}
+
+// ---------------------------------------------------------------------------
+// testLessThanInvalid
+// ---------------------------------------------------------------------------
+//
+void TestVideoSortFilterProxyModel::testLessThanInvalid()
+{
+ QVERIFY(mTestObject->initialize(mStubModel) == 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";
+ QString name2 = "bb";
+ QString name3 = "aa";
+
+
+ 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);
+
+ // 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();
+ left = mStubModel->index(0,0);
+ right = QModelIndex();
+
+ QVERIFY(!mTestObject->callLessThan(left, right));
+ remHeap = User::Heap().__DbgMarkEnd(0);
+ QVERIFY(remHeap == 0);
+
+ // both invalid
+ mTestObject->setSortRole(Qt::DisplayRole);
+ User::Heap().__DbgMarkStart();
+ left = QModelIndex();
+ right = QModelIndex();
+
+ QVERIFY(!mTestObject->callLessThan(left, right));
+ remHeap = User::Heap().__DbgMarkEnd(0);
+ QVERIFY(remHeap == 0);
+
+ // both same index, use size
+ quint32 size1 = 99;
+
+ mStubModel->appendData(size1); // to index 0
+
+ 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);
+
+}
+
+// ---------------------------------------------------------------------------
+// testDoSorting
+// ---------------------------------------------------------------------------
+//
+void TestVideoSortFilterProxyModel::testDoSorting()
+{
+ QWARN("Waiting for resolving of potential memory leak in QSortFilterProxy before adding heap allocation checks here");
+
+ QVERIFY(mTestObject->initialize(mStubModel) == 0);
+
+ // these signals are emitted during sorting procedure from the fw
+ QSignalSpy spyAboutToChange(mTestObject, SIGNAL(layoutAboutToBeChanged()));
+ QSignalSpy spyChanged(mTestObject, SIGNAL(layoutChanged()));
+
+ QString name1 = "cc";
+ QString name2 = "bb";
+ QString name3 = "aa";
+ QString name4 = "11";
+ QString name5 = "11";
+ QDateTime date1(QDate(2010, 11, 5), QTime(0,0));
+ QDateTime date2(QDate(2009, 9, 5), QTime(0,0));
+ QDateTime date3(QDate(2009, 9, 4), QTime(0,0));
+ QDateTime date4(QDate(2008, 9, 6), QTime(0,0));
+ QDateTime date5(QDate(2008, 9, 6), QTime(0,0));
+ quint32 size1 = 300;
+ quint32 size2 = 200;
+ quint32 size3 = 100;
+ quint32 size4 = 99;
+ quint32 size5 = 99;
+
+ 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->appendData(date1); // to index 0
+ mStubModel->appendData(date2); // to index 1
+ mStubModel->appendData(date3); // to index 2
+ mStubModel->appendData(date4); // to index 3
+ mStubModel->appendData(date5); // to index 4
+
+ mStubModel->appendData(size1); // to index 0
+ mStubModel->appendData(size2); // to index 1
+ mStubModel->appendData(size3); // to index 2
+ mStubModel->appendData(size4); // to index 3
+ mStubModel->appendData(size5); // to index 4
+
+ mStubModel->setUsedRowCount(5);
+
+ // User::Heap().__DbgMarkStart();
+
+ // first sort call, includes timer creation and setup
+ VideoThumbnailData::mStartBackgroundFetchingCallCount = 0;
+ mTestObject->doSorting(Qt::DisplayRole, Qt::AscendingOrder);
+ // need to wait for awhile to make sure zero-counter gets
+ // processing time.
+ QTest::qWait(500);
+ QCOMPARE(spyAboutToChange.count(), 1);
+ QCOMPARE(spyChanged.count(), 1);
+ QCOMPARE(mTestObject->sortRole(), (int)Qt::DisplayRole);
+ QCOMPARE(mTestObject->sortOrder(), Qt::AscendingOrder);
+ QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 1);
+
+ // reset spys
+ spyAboutToChange.clear();
+ spyChanged.clear();
+
+ // second sort call, should use same timer appropriately
+ VideoThumbnailData::mStartBackgroundFetchingCallCount = 0;
+ mTestObject->doSorting(Qt::DisplayRole, Qt::DescendingOrder);
+ QTest::qWait(500);
+ QCOMPARE(spyAboutToChange.count(), 1);
+ QCOMPARE(spyChanged.count(), 1);
+ QCOMPARE(mTestObject->sortRole(), (int)Qt::DisplayRole);
+ QCOMPARE(mTestObject->sortOrder(), Qt::DescendingOrder);
+ QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 1);
+
+ // reset spys
+ spyAboutToChange.clear();
+ spyChanged.clear();
+
+ // double call without first letting timer to timeout
+ VideoThumbnailData::mStartBackgroundFetchingCallCount = 0;
+ mTestObject->doSorting(Qt::DisplayRole, Qt::DescendingOrder);
+ mTestObject->doSorting(Qt::DisplayRole, Qt::AscendingOrder);
+ QTest::qWait(500);
+ QCOMPARE(spyAboutToChange.count(), 1);
+ QCOMPARE(spyChanged.count(), 1);
+ QCOMPARE(mTestObject->sortRole(), (int)Qt::DisplayRole);
+ QCOMPARE(mTestObject->sortOrder(), Qt::AscendingOrder);
+ QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 1);
+
+ spyAboutToChange.clear();
+ spyChanged.clear();
+
+ // syncronous call checks
+ VideoThumbnailData::mStartBackgroundFetchingCallCount = 0;
+ mTestObject->doSorting(Qt::DisplayRole, Qt::DescendingOrder, false);
+ QCOMPARE(spyAboutToChange.count(), 1);
+ QCOMPARE(spyChanged.count(), 1);
+ QCOMPARE(mTestObject->sortRole(), (int)Qt::DisplayRole);
+ QCOMPARE(mTestObject->sortOrder(), Qt::DescendingOrder);
+ QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 1);
+
+ spyAboutToChange.clear();
+ spyChanged.clear();
+
+ VideoThumbnailData::mStartBackgroundFetchingCallCount = 0;
+ mTestObject->doSorting(Qt::DisplayRole, Qt::AscendingOrder, false);
+ QCOMPARE(spyAboutToChange.count(), 1);
+ QCOMPARE(spyChanged.count(), 1);
+ QCOMPARE(mTestObject->sortRole(), (int)Qt::DisplayRole);
+ QCOMPARE(mTestObject->sortOrder(), Qt::AscendingOrder);
+ QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 1);
+
+ spyAboutToChange.clear();
+ spyChanged.clear();
+
+ // check that layout signals are not send if the sorting values don't change.
+ VideoThumbnailData::mStartBackgroundFetchingCallCount = 0;
+ mTestObject->doSorting(Qt::DisplayRole, Qt::AscendingOrder);
+ QCOMPARE(spyAboutToChange.count(), 0);
+ QCOMPARE(spyChanged.count(), 0);
+ QCOMPARE(mTestObject->sortRole(), (int)Qt::DisplayRole);
+ QCOMPARE(mTestObject->sortOrder(), Qt::AscendingOrder);
+ QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 0);
+
+ spyAboutToChange.clear();
+ spyChanged.clear();
+
+ // date role check
+ VideoThumbnailData::mStartBackgroundFetchingCallCount = 0;
+ mTestObject->doSorting(VideoCollectionCommon::KeyDateTime, Qt::AscendingOrder);
+ QTest::qWait(500);
+ int count = spyAboutToChange.count();
+ QCOMPARE(spyAboutToChange.count(), 1);
+ QCOMPARE(spyChanged.count(), 1);
+ QCOMPARE(mTestObject->sortRole(), (int)VideoCollectionCommon::KeyDateTime);
+ QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 1);
+
+ spyAboutToChange.clear();
+ spyChanged.clear();
+
+ // size role check
+ VideoThumbnailData::mStartBackgroundFetchingCallCount = 0;
+ mTestObject->doSorting(VideoCollectionCommon::KeySizeValue, Qt::AscendingOrder);
+ QTest::qWait(500);
+ QCOMPARE(spyAboutToChange.count(), 1);
+ QCOMPARE(spyChanged.count(), 1);
+ QCOMPARE(mTestObject->sortRole(), (int)VideoCollectionCommon::KeySizeValue);
+ QVERIFY(VideoThumbnailData::mStartBackgroundFetchingCallCount == 1);
+
+ spyAboutToChange.clear();
+ spyChanged.clear();
+
+ // invalid role call, sorting should be set to date
+ VideoThumbnailData::mStartBackgroundFetchingCallCount = 0;
+ mTestObject->doSorting(Qt::DisplayRole - 100, Qt::AscendingOrder);
+ QTest::qWait(500);
+ QCOMPARE(spyAboutToChange.count(), 1);
+ QCOMPARE(spyChanged.count(), 1);
+ QCOMPARE(mTestObject->sortRole(), (int)VideoCollectionCommon::KeyDateTime);
+ 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);
+}
+
+// ---------------------------------------------------------------------------
+// testFilterAcceptsRow
+// ---------------------------------------------------------------------------
+//
+void TestVideoSortFilterProxyModel::testFilterAcceptsRow()
+{
+ QModelIndex index = QModelIndex(); // index can be anything, test model doesn't use it.
+
+ // Not initialized.
+ QVERIFY(mTestObject->callFilterAcceptsRow(0, index) == false);
+
+ QVERIFY(mTestObject->initialize(mStubModel) == 0);
+
+ // Test invalid row.
+ QVERIFY(mTestObject->callFilterAcceptsRow(-1, index) == false);
+
+ // Model data has no status role.
+ mStubModel->appendData("test");
+ mStubModel->setUsedRowCount(1);
+ 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);
+}
+
+// ---------------------------------------------------------------------------
+// testGetMediaFilePathForId
+// ---------------------------------------------------------------------------
+//
+void TestVideoSortFilterProxyModel::testGetMediaFilePathForId()
+{
+ // Not initialized.
+ VideoListDataModel::mMediaFilePathReturnValue = "testfile";
+ QVERIFY(mTestObject->getMediaFilePathForId(TMPXItemId(0,0)) == "");
+
+ // Ok case.
+ QVERIFY(mTestObject->initialize(mStubModel) == 0);
+ VideoListDataModel::mMediaFilePathReturnValue = "testfile";
+ QVERIFY(mTestObject->getMediaFilePathForId(TMPXItemId(0,0)) == "testfile");
+}
+
+// ---------------------------------------------------------------------------
+// testAddNewCollectionNoCollectionClient
+// ---------------------------------------------------------------------------
+//
+void TestVideoSortFilterProxyModel::testAddNewCollectionNoCollectionClient()
+{
+ QString name("testname");
+ QString thumb("testthumb");
+ QList<TMPXItemId> ids;
+
+ QCOMPARE(mTestObject->addNewCollection(name, thumb, ids), -1);
+ QVERIFY(VideoCollectionClient::mAddNewCollectionName != name);
+}
+
+// ---------------------------------------------------------------------------
+// testAddNewCollectionSucceed
+// ---------------------------------------------------------------------------
+//
+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);
+
+ QCOMPARE(mTestObject->addNewCollection(name, thumb, ids), 0);
+ QCOMPARE(VideoCollectionClient::mAddNewCollectionName, name);
+ QCOMPARE(VideoCollectionClient::mAddNewCollectionThumb, thumb);
+ QCOMPARE(VideoCollectionClient::mAddNewCollectionIds, ids);
+}
+
+// ---------------------------------------------------------------------------
+// testAddNewCollectionFail
+// ---------------------------------------------------------------------------
+//
+void TestVideoSortFilterProxyModel::testAddNewCollectionFail()
+{
+ QString name("testname");
+ QString thumb("testthumb");
+ QList<TMPXItemId> ids;
+ ids.append(TMPXItemId(5,0));
+ ids.append(TMPXItemId(9,0));
+
+ mTestObject->initialize(mStubModel);
+
+ VideoCollectionClient::mFailAddNewCollection = true;
+
+ QCOMPARE(mTestObject->addNewCollection(name, thumb, ids), -1);
+
+ // this makes sure that the collection client has been called.
+ QCOMPARE(VideoCollectionClient::mAddNewCollectionName, name);
+ QCOMPARE(VideoCollectionClient::mAddNewCollectionThumb, thumb);
+ QCOMPARE(VideoCollectionClient::mAddNewCollectionIds, ids);
+}
+
+// ---------------------------------------------------------------------------
+// testShortDetailsReadySlot
+// ---------------------------------------------------------------------------
+//
+int TestVideoSortFilterProxyModel::testShortDetailsReadySlot(int index)
+{
+ return 1;
+}
+
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/stub/inc/filterproxytester.h Thu Apr 01 22:38:49 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: Helper class to test protected members from videocollectionsortfilterproxy
+*
+*/
+
+#ifndef __FILTERLISTPROXY_TESTER_H
+#define __FILTERLISTPROXY_TESTER_H
+
+#include <QObject>
+
+#include "videosortfilterproxymodel.h"
+
+
+class FilterProxyTester : public VideoSortFilterProxyModel
+{
+
+ Q_OBJECT
+
+public: // Constructors and destructor
+
+ /**
+ * Constructor
+ *
+ */
+ FilterProxyTester(QObject *parent=0);
+
+ /**
+ * destructor
+ *
+ */
+ virtual ~FilterProxyTester();
+
+public: // helper methods for test
+
+ /**
+ * Helper method to call protected lessThan
+ *
+ */
+ bool callLessThan( const QModelIndex & left, const QModelIndex & right ) const;
+
+ /**
+ * Helper methor to call protected filterAcceptsRow.
+ *
+ */
+ bool callFilterAcceptsRow( int source_row, const QModelIndex & source_parent ) const;
+
+ /**
+ * For setting CVideoCollectionClient pointer
+ *
+ */
+ int setClient(VideoCollectionClient *collectionClient);
+
+ /**
+ * For getting CVideoCollectionClient pointer
+ *
+ */
+ VideoCollectionClient* getClient();
+
+};
+
+#endif // __FILTERLISTPROXY_TESTER_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/stub/inc/videocollectionclient.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,161 @@
+
+/**
+* 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 videocollectionsortfilterproxy unit tests
+*
+*/
+
+#ifndef __VIDEOCOLLECTIONCLIENT_H
+#define __VIDEOCOLLECTIONCLIENT_H
+
+//#include <mpxmedia.h>
+#include <vcxmyvideosdefs.h>
+#include <qstring.h>
+#include <qlist.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);
+
+ /**
+ * @return int
+ */
+ int addNewCollection(QString name, QString thumbnail, QList<TMPXItemId> mediaIds);
+
+ /**
+ * 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();
+
+ /**
+ * calls collection to go back to collection level
+ *
+ */
+ int back();
+
+public:
+ static bool mFailInit;
+ static bool mFailStartOpen;
+ static bool mFailMediaPlayback;
+ static bool mFailMediaDetails;
+ static bool mFailSetSort;
+ static bool mFailAddNewCollection;
+ static TVcxMyVideosSortingOrder mSettedSortOrder;
+ static int mSortOrderSetCount;
+ static QString mAddNewCollectionName;
+ static QString mAddNewCollectionThumb;
+ static QList<TMPXItemId> mAddNewCollectionIds;
+
+private:
+
+ /**
+ * static instance from this class
+ */
+ static VideoCollectionClient *testInstance;
+};
+
+#endif // __VIDEOCOLLECTIONCLIENT_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/stub/inc/videolistdatamodel.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,249 @@
+
+/**
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Stub collection client to be used when unit testing videocollectionsortfilterproxy
+*
+*/
+
+#ifndef __STUB_VIDEOLISTDATAMODELFORPROXY_H
+#define __STUB_VIDEOLISTDATAMODELFORPROXY_H
+
+#include <QObject>
+#include <QList>
+#include <QString>
+#include <qabstractitemmodel.h>
+#include <qdatetime.h>
+#include "videocollectioncommon.h"
+
+// CVideoListDataModel::Data returns valid variant when used this and name exists for the row.
+const int INVALID_ROLE_FOR_SORTING = VideoCollectionCommon::KeyStatus+10;
+
+class VideoCollectionClient;
+
+
+class VideoListDataModel : public QAbstractItemModel
+{
+
+ Q_OBJECT
+
+public: // Constructors and destructor
+
+ /**
+ * Constructor
+ *
+ */
+ VideoListDataModel(QObject *parent = NULL);
+
+ /**
+ * destructor
+ *
+ */
+ virtual ~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
+ *
+ * @paran collection mpx video collectionobject
+ *
+ * @return int: 0 if everything ok
+ */
+ int initialize( VideoCollectionClient* collection);
+
+ /**
+ * 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.
+ */
+ int mediaIdAtIndex(int index) const;
+
+ /**
+ * 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(int 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);
+
+public: // from QAbstractItemModel
+
+ /**
+ * Returns mRowCount value
+ *
+ * @param parent - not used
+ *
+ * @return int
+ */
+ int rowCount(const QModelIndex &parent = QModelIndex()) const;
+
+ /**
+ * Method does nothing in this stub
+ *
+ * @param index - not used
+ *
+ * @return QMap empty map
+ */
+ QMap<int, QVariant> itemData(const QModelIndex &index) const;
+
+ /**
+ * Returns item value based on the role defined:
+ * Qt::DisplayRole: from mNames -list
+ * VideoCollectionCommon::KeySizeValue: from mSizes -list
+ * VideoCollectionCommon::KeyDate: from mDates -list
+ *
+ * @param index - item index to return
+ * @parema role - role indicating wanted value
+ *
+ * @return QVariant
+ */
+ QVariant data(const QModelIndex & index, int role = Qt::DisplayRole) const;
+
+ /**
+ * Returns 0 always.
+ *
+ * @param parent - not used
+ *
+ * @return int
+ */
+ int columnCount(const QModelIndex & parent = QModelIndex()) const;
+
+ /**
+ * Calls QAbstractItemModel::createIndex to return appropriate QModelIndex
+ *
+ * @param row - row index
+ * @param column - col index
+ * @param parent - not used
+ *
+ * @return QModelIndex
+ */
+ QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const;
+
+ /**
+ * returns invalid QModelIndex
+ *
+ * @return QModelIndex
+ */
+ QModelIndex parent(const QModelIndex & index) const;
+
+
+public: // helper methods for test
+
+ /**
+ * sets given value tomRowCount
+ *
+ * @param count - value to set
+ */
+ void setUsedRowCount(int count);
+
+ /**
+ * appends given string to mNames
+ *
+ * @param data - value to append to list
+ */
+ void appendData(QString data);
+
+ /**
+ * appends given uint to mSizes
+ *
+ * @param data - value to append to list
+ */
+ void appendData(uint data);
+
+ /**
+ * appends given QDate to mDates
+ *
+ * @param data - value to append to list
+ */
+ void appendData(QDateTime data);
+
+ /**
+ * Appends given status to mStatuses.
+ *
+ * @param status - value to append to list.
+ */
+ void appendStatus(int status);
+
+signals:
+
+ /**
+ * 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
+ */
+ void fullVideoDetailsReady(int index);
+
+ /**
+ * Signals that the model is ready, ie. loaded all data from
+ * myvideocollection.
+ */
+ void modelReady();
+
+public:
+
+ static bool mInitFails;
+ static bool mRemoveRowsFails;
+ static bool mGetMediaIdAtIndexFails;
+ static QString mMediaFilePathReturnValue;
+
+ static int mLastDeletedIndexRow;
+
+private:
+
+ /**
+ * Setted count of rows. Not necessary match the actual count.
+ */
+ int mRowCount;
+
+ /**
+ * List of strings when fetching Qt::DisplayRole
+ */
+ QList<QString> mNames;
+
+ /**
+ * List of uints when fetching VideoCollectionCommon::KeySizeValue
+ */
+ QList<uint> mSizes;
+
+ /**
+ * List of QDates when fetching VideoCollectionCommon::KeyDate
+ */
+ QList<QDateTime> mDates;
+
+ /**
+ * List of statuses when fetching VideoCollectionCommon::KeyStatus
+ */
+ QList<int> mStatuses;
+
+};
+
+#endif // __STUB_VIDEOLISTDATAMODELFORPROXY_H
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/stub/inc/videothumbnaildata.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,123 @@
+/*
+* 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: CVideoThumbnailData class definition*
+*/
+
+#ifndef __VIDEOTHUMBNAILDATA_H__
+#define __VIDEOTHUMBNAILDATA_H__
+
+// INCLUDES
+#include <QObject>
+#include <QHash>
+#include <QPair>
+#include <QIcon>
+#include <QSet>
+
+// FORWARD DECLARATIONS
+
+class VideoThumbnailData : public QObject
+{
+ /**
+ * defined to be able to use signals and slots
+ */
+ Q_OBJECT
+
+ /**
+ * disable copy-constructor and assignment operator
+ */
+ Q_DISABLE_COPY(VideoThumbnailData)
+
+public: // Constructor
+
+ /*
+ * Thumbnail fetch priorities
+ */
+ enum VideoThumbnailPriority
+ {
+ VideoThumbnailPriorityBackground = 2000,
+ VideoThumbnailPriorityLow = 5000,
+ VideoThumbnailPriorityMedium = 10000,
+ VideoThumbnailPriorityHigh = 2000
+ };
+
+ /**
+ * Returns singleton instance for this class.
+ *
+ * @return The singleton instance.
+ *
+ */
+ 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);
+
+ /**
+ * Enables or disables thumbnail background fetching. Default is enabled.
+ *
+ * @param enable true enables and false disables thumbnail background fetching.
+ */
+ void enableBackgroundFetching(bool enable);
+
+ /**
+ * Frees allocated data for thumbnails and cancels ongoing fetches.
+ */
+ void freeThumbnailData();
+
+private:
+
+ /**
+ * Default constructor
+ */
+ VideoThumbnailData();
+
+ /**
+ * Destructor
+ */
+ ~VideoThumbnailData();
+
+public:
+ static int mStartFetchingThumbnailsCallCount;
+ static int mStartFetchingThumbnailsThumbnailCount;
+ static int mInstanceCallCount;
+ static int mFreeThumbnailDataCallCount;
+ static int mBackgroundThumbnailFetchingEnabled;
+ static int mStartBackgroundFetchingCallCount;
+
+private: // data
+
+
+};
+#endif // __VIDEOTHUMBNAILDATA_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/stub/src/filterproxytester.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,85 @@
+
+/**
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Helper class to test protected members from videocollectionsortfilterproxy
+*
+*/
+
+// INCLUDES
+#define private public
+#include "videosortfilterproxymodel.h"
+#undef private
+
+#include "filterproxytester.h"
+
+// ---------------------------------------------------------------------------
+// FilterProxyTester
+// ---------------------------------------------------------------------------
+//
+FilterProxyTester::FilterProxyTester(QObject *parent) :
+VideoSortFilterProxyModel(parent)
+{
+ // NOP
+}
+
+// ---------------------------------------------------------------------------
+// ~FilterProxyTester
+// ---------------------------------------------------------------------------
+//
+FilterProxyTester::~FilterProxyTester()
+{
+ // NOP
+}
+
+// ---------------------------------------------------------------------------
+// callLessThan
+// ---------------------------------------------------------------------------
+//
+bool FilterProxyTester::callLessThan( const QModelIndex & left, const QModelIndex & right ) const
+{
+ return VideoSortFilterProxyModel::lessThan(left, right);
+}
+
+// ---------------------------------------------------------------------------
+// callLessThan
+// ---------------------------------------------------------------------------
+//
+bool FilterProxyTester::callFilterAcceptsRow( int source_row, const QModelIndex & source_parent ) const
+{
+ return VideoSortFilterProxyModel::filterAcceptsRow(source_row, source_parent);
+}
+
+// ---------------------------------------------------------------------------
+// setClient
+// ---------------------------------------------------------------------------
+//
+int FilterProxyTester::setClient(VideoCollectionClient *collectionClient)
+{
+ VideoSortFilterProxyModel::mCollectionClient = collectionClient;
+ return 0;
+}
+
+// ---------------------------------------------------------------------------
+// getClient
+// ---------------------------------------------------------------------------
+//
+VideoCollectionClient* FilterProxyTester::getClient()
+{
+ return VideoSortFilterProxyModel::mCollectionClient;
+}
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/stub/src/videocollectionclient.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,129 @@
+/*
+* 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 collection client to be used when unit testing videocollectionsortfilterproxy
+*/
+
+
+
+// INCLUDE FILES>
+#include <mpxmediaarray.h>
+#include "stub/inc/videocollectionclient.h"
+
+VideoCollectionClient* VideoCollectionClient::testInstance = 0;
+
+bool VideoCollectionClient::mFailInit = false;
+bool VideoCollectionClient::mFailStartOpen = false;
+bool VideoCollectionClient::mFailMediaPlayback = false;
+bool VideoCollectionClient::mFailMediaDetails = false;
+bool VideoCollectionClient::mFailSetSort = false;
+bool VideoCollectionClient::mFailAddNewCollection = false;
+TVcxMyVideosSortingOrder VideoCollectionClient::mSettedSortOrder = EVcxMyVideosSortingNone;
+int VideoCollectionClient::mSortOrderSetCount = 0;
+QString VideoCollectionClient::mAddNewCollectionName = QString();
+QString VideoCollectionClient::mAddNewCollectionThumb = QString();
+QList<TMPXItemId> VideoCollectionClient::mAddNewCollectionIds = QList<TMPXItemId>();
+
+// -----------------------------------------------------------------------------
+// VideoCollectionClient
+// -----------------------------------------------------------------------------
+//
+VideoCollectionClient::VideoCollectionClient()
+{
+ testInstance = this;
+}
+
+// -----------------------------------------------------------------------------
+// ~CVideoCollectionClient
+// -----------------------------------------------------------------------------
+//
+VideoCollectionClient::~VideoCollectionClient()
+{
+}
+
+// -----------------------------------------------------------------------------
+// initialize
+// -----------------------------------------------------------------------------
+//
+int VideoCollectionClient::initialize()
+{
+ if(mFailInit)
+ {
+ return -1;
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// startOpenCollection
+// -----------------------------------------------------------------------------
+//
+int VideoCollectionClient::startOpenCollection(int level)
+{
+ if(mFailStartOpen)
+ {
+ return -1;
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// openVideo
+// -----------------------------------------------------------------------------
+//
+int VideoCollectionClient::openVideo(int /*mpxId1*/)
+{
+ if(mFailMediaPlayback)
+ {
+ return -1;
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// deleteFile
+// -----------------------------------------------------------------------------
+//
+int VideoCollectionClient::getVideoDetails(int /*mpxId1*/)
+{
+ if(mFailMediaDetails)
+ {
+ return -1;
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// addNewCollection
+// -----------------------------------------------------------------------------
+//
+int VideoCollectionClient::addNewCollection(QString name, QString thumbnail, QList<TMPXItemId> mediaIds)
+{
+ mAddNewCollectionName = name;
+ mAddNewCollectionThumb = thumbnail;
+ mAddNewCollectionIds = mediaIds;
+ if(mFailAddNewCollection) {
+ return -1;
+ }
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// back
+// -----------------------------------------------------------------------------
+//
+int VideoCollectionClient::back()
+{
+ return 0;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/stub/src/videothumbnaildata.cpp Thu Apr 01 22:38:49 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: CVideoThumbnailData class implementation
+*
+*/
+
+// INCLUDE FILES
+#include <QDebug>
+#include <QPixmap>
+#include <QTimer>
+#include <mpxmediageneraldefs.h>
+#include <thumbnailmanager_qt.h>
+
+#include "videothumbnaildata.h"
+
+int VideoThumbnailData::mStartFetchingThumbnailsCallCount = 0;
+int VideoThumbnailData::mStartFetchingThumbnailsThumbnailCount = 0;
+int VideoThumbnailData::mInstanceCallCount = 0;
+int VideoThumbnailData::mBackgroundThumbnailFetchingEnabled = true;
+int VideoThumbnailData::mFreeThumbnailDataCallCount = 0;
+int VideoThumbnailData::mStartBackgroundFetchingCallCount = 0;
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailData::instance()
+// -----------------------------------------------------------------------------
+//
+VideoThumbnailData &VideoThumbnailData::instance()
+{
+ mInstanceCallCount++;
+ static VideoThumbnailData _thumbnailData;
+ return _thumbnailData;
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailData::VideoThumbnailData()
+// -----------------------------------------------------------------------------
+//
+VideoThumbnailData::VideoThumbnailData()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailData::~VideoThumbnailData()
+// -----------------------------------------------------------------------------
+//
+VideoThumbnailData::~VideoThumbnailData()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// 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)
+{
+ mStartBackgroundFetchingCallCount++;
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailData::enableBackgroundFetching()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailData::enableBackgroundFetching(bool enable)
+{
+ mBackgroundThumbnailFetchingEnabled = enable;
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailData::freeThumbnailData()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailData::freeThumbnailData()
+{
+ mFreeThumbnailDataCallCount++;
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideosortfilterproxymodel/testvideosortfilterproxymodel.pro Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,42 @@
+# #####################################################################
+# Automatically generated by qmake (2.01a) Tue 5. May 13:25:42 2009
+# #####################################################################
+TEMPLATE = app
+TARGET =
+DEFINES += BUILD_VIDEOCOLLECTION_DLL
+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 \
+ ../../../inc
+
+CONFIG += qtestlib \
+ Hb \
+ symbian_test
+
+LIBS += -lestor.dll \
+ -lfbscli.dll \
+ -lbitgdi.dll \
+ -lgdi.dll
+
+# Input
+HEADERS += inc/testvideosortfilterproxymodel.h \
+ stub/inc/filterproxytester.h \
+ stub/inc/videolistdatamodel.h \
+ stub/inc/videocollectionclient.h \
+ stub/inc/videothumbnaildata.h \
+ ../../inc/videosortfilterproxymodel.h \
+ ../../../inc/videocollectionexport.h
+
+SOURCES += src/testvideosortfilterproxymodel.cpp \
+ stub/src/filterproxytester.cpp \
+ stub/src/videolistdatamodel.cpp \
+ stub/src/videocollectionclient.cpp \
+ stub/src/videothumbnaildata.cpp \
+ ../../src/videosortfilterproxymodel.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata/inc/testvideothumbnaildata.h Thu Apr 01 22:38:49 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: Unit test for methods in VideoThumbnailData
+*
+*/
+
+#ifndef __TESTVIDEOTHUMBNAILDATA_H__
+#define __TESTVIDEOTHUMBNAILDATA_H__
+
+// INCLUDES
+#include <QtTest/QtTest>
+
+// FORWARD DECLARATIONS
+
+class TestVideoThumbnailData : public QObject
+{
+ Q_OBJECT
+
+ void init();
+
+ void cleanup();
+
+ bool checkThumbnailReadyCount(QSignalSpy *spy, int count);
+
+ // test functions for the test framework
+private slots:
+ void testInstance();
+ void testStartFetchingThumbnail();
+ void testRemoveThumbnail();
+ void testGetThumbnail();
+ void testEnableBackgroundFetching();
+ void testFreeThumbnailData();
+ void testStartBackgroundFetching();
+
+signals:
+
+private:
+
+};
+
+#endif // __TESTVIDEOTHUMBNAILDATA_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata/src/testvideothumbnaildata.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,160 @@
+/**
+* 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 VideoThumbnailDataPrivate
+*
+*/
+
+// INCLUDES
+#include <hbapplication.h>
+#include <hbinstance.h>
+#include <qicon.h>
+#include <qpair.h>
+#include <qpointer.h>
+#include <qlist.h>
+#include <qvariant.h>
+#include "qmetatype.h"
+
+#include "testvideothumbnaildata.h"
+#include "stub/inc/videothumbnaildata_p.h"
+
+#include "e32std.h"
+
+#define private public
+#define protected public
+#include "videothumbnaildata.h"
+#undef private
+#undef protected
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ HbApplication app(argc, argv);
+ HbMainWindow window;
+
+ 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);
+
+ return res;
+}
+
+// ---------------------------------------------------------------------------
+// init
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailData::init()
+{
+ VideoThumbnailDataPrivate::mConstructCallCount = 0;
+ VideoThumbnailDataPrivate::mDestructCallCount = 0;
+ VideoThumbnailDataPrivate::mStartFetchingThumbnailsCallCount = 0;
+ VideoThumbnailDataPrivate::mStartFetchingThumbnailCallCount = 0;
+ VideoThumbnailDataPrivate::mGetThumbnailCallCount = 0;
+ VideoThumbnailDataPrivate::mRemoveThumbnailCallCount = 0;
+ VideoThumbnailDataPrivate::mStartBackgroundFetchingCallCount = 0;
+}
+
+// ---------------------------------------------------------------------------
+// testInstance
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailData::testInstance()
+{
+ VideoThumbnailData &instance = VideoThumbnailData::instance();
+ 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
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailData::testRemoveThumbnail()
+{
+ VideoThumbnailData &instance = VideoThumbnailData::instance();
+ QCOMPARE(VideoThumbnailDataPrivate::mConstructCallCount, 1);
+ QVERIFY(instance.removeThumbnail(0) == true);
+ QCOMPARE(VideoThumbnailDataPrivate::mRemoveThumbnailCallCount, 1);
+}
+
+// ---------------------------------------------------------------------------
+// testGetThumbnail
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailData::testGetThumbnail()
+{
+ VideoThumbnailData &instance = VideoThumbnailData::instance();
+ QCOMPARE(VideoThumbnailDataPrivate::mConstructCallCount, 1);
+ QVERIFY(instance.getThumbnail(0) == 0);
+ QCOMPARE(VideoThumbnailDataPrivate::mGetThumbnailCallCount, 1);
+}
+
+// ---------------------------------------------------------------------------
+// testEnableBackgroundFetching
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailData::testEnableBackgroundFetching()
+{
+ VideoThumbnailData &instance = VideoThumbnailData::instance();
+ QCOMPARE(VideoThumbnailDataPrivate::mConstructCallCount, 1);
+ instance.enableBackgroundFetching(false);
+ QVERIFY(VideoThumbnailDataPrivate::mBackgroundThumbnailFetchingEnabled == false);
+ instance.enableBackgroundFetching(true);
+ QVERIFY(VideoThumbnailDataPrivate::mBackgroundThumbnailFetchingEnabled == true);
+}
+
+// ---------------------------------------------------------------------------
+// testFreeThumbnailData
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailData::testFreeThumbnailData()
+{
+ VideoThumbnailData &instance = VideoThumbnailData::instance();
+ QCOMPARE(VideoThumbnailDataPrivate::mConstructCallCount, 1);
+ instance.freeThumbnailData();
+ QCOMPARE(VideoThumbnailDataPrivate::mFreeThumbnailDataCallCount, 1);
+}
+
+// ---------------------------------------------------------------------------
+// testFreeThumbnailData
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailData::testStartBackgroundFetching()
+{
+ VideoThumbnailData &instance = VideoThumbnailData::instance();
+ QCOMPARE(VideoThumbnailDataPrivate::mConstructCallCount, 1);
+ instance.startBackgroundFetching(0);
+ QCOMPARE(VideoThumbnailDataPrivate::mStartBackgroundFetchingCallCount, 1);
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata/stub/inc/videothumbnaildata_p.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,153 @@
+/*
+* 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 class for VideoThumbnailDataPrivate
+*/
+
+#ifndef __VIDEOTHUMBNAILDATAPRIVATE_H__
+#define __VIDEOTHUMBNAILDATAPRIVATE_H__
+
+// INCLUDES
+#include <QObject>
+#include <QPointer>
+#include <QCache>
+#include <QIcon>
+#include <QSet>
+#include <QList>
+#include <e32const.h>
+#include <mpxitemid.h>
+
+// FORWARD DECLARATIONS
+
+class VideoThumbnailDataPrivate : public QObject
+{
+ /**
+ * defined to be able to use signals and slots
+ */
+ Q_OBJECT
+
+public:
+
+
+ /**
+ * Default constructor
+ */
+ VideoThumbnailDataPrivate();
+
+ /**
+ * Destructor
+ */
+ 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.
+ *
+ * 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, 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
+ * is returned.
+ *
+ * @param mediaId media id for which to get thumbnail
+ * @param tnData reference to thumbnail data where data is ocpied
+ *
+ * @return QIcon* thumbnail pointer
+ *
+ */
+ const QIcon* getThumbnail( TMPXItemId mediaId );
+
+ /**
+ * Method removes thumbnail data from the local repository.
+ *
+ * @param mediaId id for media whose thumbnail is to be removed
+ *
+ * @return bool: true if item removed correctly, false if not.
+ *
+ */
+ bool removeThumbnail( TMPXItemId mediaId );
+
+ /**
+ * Enables or disables thumbnail background fetching. Default is enabled.
+ *
+ * @param enable true enables and false disables thumbnail background fetching.
+ */
+ void enableBackgroundFetching(bool enable);
+
+ /**
+ * Frees allocated data for thumbnails and cancels ongoing fetches.
+ */
+ void freeThumbnailData();
+
+ /**
+ * Starts background thumbnail fetching from the given fetch index.
+ *
+ * @param fetchIndex index where to start the background thumbnail fetching.
+ */
+ void startBackgroundFetching(int fetchIndex);
+
+signals:
+
+ /**
+ * This signal is emitted from thumbnailReadySlot, when
+ *
+ * @param mediaIds: media ids of the videos whose thumbnail is ready.
+ *
+ */
+ void thumbnailsFetched(QList<TMPXItemId> mediaIds);
+
+public: // Data
+
+ static int mConstructCallCount;
+ static int mDestructCallCount;
+ static int mStartFetchingThumbnailsCallCount;
+ static int mStartFetchingThumbnailCallCount;
+ static int mGetThumbnailCallCount;
+ static int mRemoveThumbnailCallCount;
+ static int mFreeThumbnailDataCallCount;
+ static int mBackgroundThumbnailFetchingEnabled;
+ static int mStartBackgroundFetchingCallCount;
+};
+
+#endif // __VIDEOTHUMBNAILDATAPRIVATE_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata/stub/src/videothumbnaildata_p.cpp Thu Apr 01 22:38:49 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: VideoThumbnailDataPrivate class implementation
+*
+*/
+
+// INCLUDE FILES
+#include <QApplication>
+#include <QPixmap>
+#include <QTimer>
+#include <mpxmediageneraldefs.h>
+
+#include "videothumbnaildata_p.h"
+
+int VideoThumbnailDataPrivate::mConstructCallCount = 0;
+int VideoThumbnailDataPrivate::mDestructCallCount = 0;
+int VideoThumbnailDataPrivate::mStartFetchingThumbnailsCallCount = 0;
+int VideoThumbnailDataPrivate::mStartFetchingThumbnailCallCount = 0;
+int VideoThumbnailDataPrivate::mGetThumbnailCallCount = 0;
+int VideoThumbnailDataPrivate::mRemoveThumbnailCallCount = 0;
+int VideoThumbnailDataPrivate::mBackgroundThumbnailFetchingEnabled = true;
+int VideoThumbnailDataPrivate::mFreeThumbnailDataCallCount = 0;
+int VideoThumbnailDataPrivate::mStartBackgroundFetchingCallCount = 0;
+
+// ================= MEMBER FUNCTIONS =======================
+//
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataPrivate::VideoThumbnailDataPrivate()
+// -----------------------------------------------------------------------------
+//
+VideoThumbnailDataPrivate::VideoThumbnailDataPrivate()
+{
+ mConstructCallCount++;
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataPrivate::~VideoThumbnailDataPrivate()
+// -----------------------------------------------------------------------------
+//
+VideoThumbnailDataPrivate::~VideoThumbnailDataPrivate()
+{
+ mDestructCallCount++;
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataPrivate::getThumbnail()
+// -----------------------------------------------------------------------------
+//
+const QIcon* VideoThumbnailDataPrivate::getThumbnail( TMPXItemId /*mediaId*/ )
+{
+ mGetThumbnailCallCount++;
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataPrivate::startFetchingThumbnails()
+// -----------------------------------------------------------------------------
+//
+int VideoThumbnailDataPrivate::startFetchingThumbnails(const QList<int> &/*indexes*/, int /*priority*/)
+{
+ mStartFetchingThumbnailsCallCount++;
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataPrivate::startFetchingThumbnail()
+// -----------------------------------------------------------------------------
+//
+int VideoThumbnailDataPrivate::startFetchingThumbnail(TMPXItemId /*mediaId*/, int /*priority*/)
+{
+ VideoThumbnailDataPrivate::mStartFetchingThumbnailCallCount++;
+ return 0;
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataPrivate::removeThumbnail()
+// -----------------------------------------------------------------------------
+//
+bool VideoThumbnailDataPrivate::removeThumbnail(TMPXItemId /*mediaId*/)
+{
+ VideoThumbnailDataPrivate::mRemoveThumbnailCallCount++;
+ return true;
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataPrivate::enableBackgroundFetching()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailDataPrivate::enableBackgroundFetching(bool enable)
+{
+ mBackgroundThumbnailFetchingEnabled = enable;
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailData::freeThumbnailData()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailDataPrivate::freeThumbnailData()
+{
+ mFreeThumbnailDataCallCount++;
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailData::startBackgroundFetching()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailDataPrivate::startBackgroundFetching(int fetchIndex)
+{
+ mStartBackgroundFetchingCallCount++;
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata/testvideothumbnaildata.pro Thu Apr 01 22:38:49 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
+
+RESOURCES += data/testvideothumbnaildata.qrc
+
+# Input
+HEADERS += inc/testvideothumbnaildata.h \
+ stub/inc/videothumbnaildata_p.h \
+ ../../inc/videothumbnaildata.h \
+ ../../../inc/videocollectionexport.h
+
+SOURCES += src/testvideothumbnaildata.cpp \
+ stub/src/videothumbnaildata_p.cpp \
+ ../../src/videothumbnaildata.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/data/icons/qgn_prop_mtv_prog_clip.svg Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd">
+<svg baseProfile="tiny" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="100%" height="100%" viewBox="0 0 57 49">
+<g>
+<rect fill="none" width="57" height="49"/>
+<g>
+<g>
+<polygon points="46.238,43.598 4.997,43.598 4.997,10.992 46.228,10.994 "/>
+<g>
+<polygon fill="#B2B2B2" points="44.428,17.543 44.428,41.768 6.791,41.768 6.791,36.24 "/>
+<polygon fill="#D9D9D9" points="44.369,17.854 44.369,12.662 6.846,12.662 6.846,36.552 "/>
+<polygon fill="#8A8A8A" points="44.369,12.055 44.369,41.688 6.813,41.688 6.813,42.395 45.077,42.395 45.077,12.055 "/>
+<polygon fill="#F5F5F5" points="44.369,12.055 6.138,12.055 6.138,42.395 6.846,42.395 6.846,12.76 44.369,12.76 "/>
+<rect x="18.815" y="37.402" fill="#595959" width="2.897" height="2.875"/>
+<polygon points="21.758,36.75 18.172,36.75 18.172,40.322 18.881,40.322 18.881,37.456 21.758,37.456 "/>
+<polygon fill="#F5F5F5" points="21.713,36.75 21.713,40.277 18.172,40.277 18.172,40.982 22.42,40.982 22.42,36.75 "/>
+<rect x="29.445" y="37.402" fill="#595959" width="2.889" height="2.875"/>
+<polygon points="32.367,36.75 28.793,36.75 28.793,40.313 29.5,40.313 29.5,37.456 32.367,37.456 "/>
+<polygon fill="#F5F5F5" points="32.334,36.75 32.334,40.277 28.793,40.277 28.793,40.982 33.042,40.982 33.042,36.75 "/>
+<rect x="40.055" y="37.391" fill="#595959" width="2.898" height="2.887"/>
+<polygon points="42.996,36.75 39.412,36.75 39.412,40.322 40.12,40.322 40.12,37.456 42.996,37.456 "/>
+<polygon fill="#F5F5F5" points="42.953,36.75 42.953,40.277 39.412,40.277 39.412,40.982 43.66,40.982 43.66,36.75 "/>
+<rect x="8.195" y="37.402" fill="#595959" width="2.899" height="2.875"/>
+<polygon points="11.126,36.75 7.554,36.75 7.554,40.313 8.262,40.313 8.262,37.456 11.126,37.456 "/>
+<polygon fill="#F5F5F5" points="11.095,36.75 11.095,40.277 7.554,40.277 7.554,40.982 11.803,40.982 11.803,36.75 "/>
+<rect x="18.826" y="14.13" fill="#595959" width="2.887" height="2.864"/>
+<polygon points="21.747,13.467 18.172,13.467 18.172,17.027 18.881,17.027 18.881,14.172 21.747,14.172 "/>
+<polygon fill="#F5F5F5" points="21.713,13.467 21.713,16.994 18.172,16.994 18.172,17.699 22.42,17.699 22.42,13.467 "/>
+<rect x="29.435" y="14.106" fill="#595959" width="2.899" height="2.888"/>
+<polygon points="32.367,13.467 28.793,13.467 28.793,17.039 29.5,17.039 29.5,14.172 32.367,14.172 "/>
+<polygon fill="#F5F5F5" points="32.334,13.467 32.334,16.994 28.793,16.994 28.793,17.699 33.042,17.699 33.042,13.467 "/>
+<rect x="40.076" y="14.106" fill="#595959" width="2.877" height="2.888"/>
+<polygon points="42.986,13.467 39.412,13.467 39.412,17.039 40.12,17.039 40.12,14.172 42.986,14.172 "/>
+<polygon fill="#F5F5F5" points="42.953,13.467 42.953,16.994 39.412,16.994 39.412,17.699 43.66,17.699 43.66,13.467 "/>
+<rect x="8.195" y="14.118" fill="#595959" width="2.899" height="2.876"/>
+<polygon points="11.126,13.467 7.554,13.467 7.554,17.039 8.262,17.039 8.262,14.172 11.126,14.172 "/>
+<polygon fill="#F5F5F5" points="11.095,13.467 11.095,16.994 7.554,16.994 7.554,17.699 11.803,17.699 11.803,13.467 "/>
+</g>
+</g>
+<g>
+<polygon fill="#00395D" points="30.344,34.621 25.454,32.046 20.558,34.617 21.494,29.17 17.537,25.309 23.008,24.515 25.456,19.559 27.901,24.516 33.371,25.314 29.412,29.17 "/>
+<polygon fill="#2882C8" points="22.55,31.879 22.972,29.424 23.105,28.645 22.542,28.096 20.76,26.357 23.223,25.999 24.004,25.886 24.353,25.178 25.455,22.947 26.557,25.18 26.905,25.888 27.684,26.001 30.146,26.359 28.365,28.096 27.8,28.645 27.933,29.422 28.354,31.877 26.154,30.719 25.455,30.351 24.757,30.719 22.55,31.879 "/>
+</g>
+</g>
+</g>
+</svg>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/data/testvideothumbnaildata_p.qrc Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,7 @@
+<RCC>
+ <qresource prefix="/icons" >
+ <file alias="default_thumbnail.svg" >icons/qgn_prop_mtv_prog_clip.svg</file>
+ <file alias="default_thumbnail_video.svg" >icons/qgn_prop_mtv_prog_clip.svg</file>
+ <file alias="default_thumbnail_collection.svg" >icons/qgn_prop_mtv_prog_clip.svg</file>
+ </qresource>
+</RCC>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/inc/testvideothumbnaildata_p.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,73 @@
+/**
+* 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 VideoThumbnailData
+*
+*/
+
+#ifndef __TESTVIDEOTHUMBNAILDATA_P_H__
+#define __TESTVIDEOTHUMBNAILDATA_P_H__
+
+// INCLUDES
+#include <QtTest/QtTest>
+
+// FORWARD DECLARATIONS
+class VideoThumbnailDataTester;
+class VideoSortFilterProxyModel;
+class VideoCollectionWrapper;
+class QSignalSpy;
+
+class TestVideoThumbnailData_p : public QObject
+{
+ Q_OBJECT
+
+ void init();
+
+ void cleanup();
+
+ bool checkThumbnailReadyCount(QSignalSpy *spy, int count);
+
+ // test functions for the test framework
+private slots:
+
+ void testDestructor();
+ void testInitialize();
+ void testGetThumbnail();
+ void testStartFetchingThumbnail();
+ void testStartFetchingThumbnails();
+ void testDoBackgroundFetching();
+ void testThumbnailReadySlot();
+ void testDefaultThumbnail();
+ void testRemoveThumbnail();
+ void testLayoutChangedSlot();
+ void testRowsInsertedSlot();
+ void testRemoveFromFetchList();
+ void testStartBackgroundFetching();
+ void testEnableBackgroundFetching();
+ void testFreeThumbnailData();
+
+signals:
+ void testSignal();
+
+private:
+
+ VideoThumbnailDataTester *mTestObject;
+ VideoSortFilterProxyModel *mModel;
+
+public:
+ VideoCollectionWrapper *mWrapper;
+};
+
+#endif // __TESTVIDEOTHUMBNAILDATA_P_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/inc/videothumbnaildatatester.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,144 @@
+/**
+* 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 VideoThumbnailData
+*
+*/
+
+#ifndef _VIDEOTHUMBNAILDATATESTER_H_
+#define _VIDEOTHUMBNAILDATATESTER_H_
+
+// INCLUDES
+#include <QObject>
+#include "videothumbnaildata_p.h"
+
+class VideoThumbnailDataTester : public VideoThumbnailDataPrivate
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * Default constructor
+ */
+ VideoThumbnailDataTester();
+
+ /**
+ * Destructor
+ */
+ virtual ~VideoThumbnailDataTester();
+
+ //
+ // Test methods for VideoThumbnailData's signals.
+ //
+
+ /**
+ * Emits doBackgroundFetching signal to itself.
+ */
+ void emitDoBackgroundFetching();
+
+ /**
+ * Emits reportThumbnailsReadySignal to itself.
+ */
+ void emitReportThumbnailsReady();
+
+ /**
+ * Emits layoutChanged signal to itself.
+ */
+ void emitLayoutChanged();
+
+ /**
+ * Emits rowsInserted signal to itself.
+ *
+ * @param parent parent
+ * @param start start index
+ * @param end end index
+ */
+ void emitRowsInserted(const QModelIndex & parent, int start, int end);
+
+ //
+ // Test methods for VideoThumbnailData's methods.
+ //
+
+ /**
+ * Calls CVideoThumbnailDataPrivate::removeFromFetchList
+ *
+ * @param tnId id of thumbnail to be removed.
+ */
+ void removeFromFetchList(int tnId);
+
+ /**
+ * Calls CVideoThumbnailDataPrivate::initialize
+ */
+ void initialize();
+
+ /**
+ * Calls CVideoThumbnailDataPrivate::cleanup
+ */
+ void cleanup();
+
+ /**
+ * Calls CVideoThumbnailDataPrivate::connectSignals
+ */
+ void connectSignals();
+
+ /**
+ * Calls CVideoThumbnailDataPrivate::disconnectSignals
+ */
+ void disconnectSignals();
+
+ /**
+ * Calls CVideoThumbnailDataPrivate::defaultThumbnail
+ */
+ const QIcon* defaultThumbnail(TMPXItemId mediaId);
+
+ /**
+ * Calls CVideoThumbnailDataPrivate::startBackgroundFetching
+ */
+ void startBackgroundFetching(int fetchIndex);
+
+ /**
+ * Calls CVideoThumbnailDataPrivate::continueBackgroundFetch
+ */
+ void continueBackgroundFetch();
+
+signals:
+
+ /**
+ * Signal.
+ */
+ void doBackgroundFetchingSignal();
+
+ /**
+ * Signal.
+ */
+ void layoutChangedSignal();
+
+ /**
+ * Signal.
+ */
+ void rowsInsertedSignal(const QModelIndex & parent, int start, int end);
+
+ /**
+ * Signal.
+ */
+ void reportThumbnailsReadySignal();
+
+private:
+
+};
+
+#endif // _VIDEOTHUMBNAILDATATESTER_H_
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/src/testvideothumbnaildata_p.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,1001 @@
+/**
+* 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 VideoThumbnailDataPrivate
+*
+*/
+
+// INCLUDES
+#include <hbapplication.h>
+#include <hbinstance.h>
+#include <qicon.h>
+#include <qpair.h>
+#include <qpointer.h>
+#include <qlist.h>
+#include <qvariant.h>
+#include "qmetatype.h"
+
+#include "testvideothumbnaildata_p.h"
+#include "thumbnailmanager_qt.h"
+#include "videosortfilterproxymodel.h"
+#include "videocollectionwrapper.h"
+
+#include "e32std.h"
+
+#define private public
+#define protected public
+#include "videothumbnaildatatester.h"
+#undef private
+#undef protected
+
+#include "videothumbnaildata_p.h"
+
+const int TB_PRIORITY = 1000;
+
+// following constants are copied from videothumbnaildata.cpp
+// Maximum thumbnails kept in memory.
+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;
+// Priority for background thumbnail fetches.
+const int BACKGROUND_FETCH_PRIORITY = 3000;
+
+Q_DECLARE_METATYPE(QList<TMPXItemId>)
+
+/**
+ * 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[])
+{
+ HbApplication app(argc, argv);
+ HbMainWindow window;
+
+ 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);
+
+ return res;
+}
+
+// ---------------------------------------------------------------------------
+// init
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailData_p::init()
+{
+ VideoCollectionWrapper::mReferenceCount = 0;
+
+ if(!mWrapper)
+ mWrapper = VideoCollectionWrapper::instance();
+ mModel = new VideoSortFilterProxyModel();
+ mWrapper->setModel(mModel);
+ mTestObject = new VideoThumbnailDataTester();
+ mTestObject->initialize();
+ ThumbnailManager::mGetThumbFails = false;
+ VideoSortFilterProxyModel::mReturnInvalidIndexes = false;
+ VideoSortFilterProxyModel::mRowCountCallCount = 0;
+ qRegisterMetaType<QList<TMPXItemId> >("QList<TMPXItemId>");
+}
+
+// ---------------------------------------------------------------------------
+// cleanup
+// ---------------------------------------------------------------------------
+//
+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);
+}
+
+// ---------------------------------------------------------------------------
+// checkThumbnailReadyCount
+// ---------------------------------------------------------------------------
+//
+bool TestVideoThumbnailData_p::checkThumbnailReadyCount(QSignalSpy *spy, int count)
+{
+ if(!mTestObject || !spy)
+ {
+ qWarning("TestVideoThumbnailData_p::checkThumbnailReadyCount: error, mTestObject = %d, spy = %d", mTestObject, spy);
+ return false;
+ }
+ mTestObject->emitReportThumbnailsReady();
+ if(spy->count() != 1)
+ {
+ qWarning("TestVideoThumbnailData_p::checkThumbnailReadyCount: error, spy->count() is %d, 1 was expected.", spy->count());
+ return false;
+ }
+ QList<TMPXItemId> mediaIds = qvariant_cast<QList<TMPXItemId> >(spy->at(0).at(0));
+ return mediaIds.count() == count;
+}
+
+// ---------------------------------------------------------------------------
+// testDestructor
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailData_p::testDestructor()
+{
+ 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 );
+}
+
+// ---------------------------------------------------------------------------
+// testInitialize
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailData_p::testInitialize()
+{
+ // Wrapper return null model
+ if(!mWrapper)
+ mWrapper = VideoCollectionWrapper::instance();
+ mWrapper->setModel(0);
+
+ mTestObject = new VideoThumbnailDataTester();
+ QVERIFY(mTestObject->mThumbnailManager == 0);
+ QVERIFY(mTestObject->mModel == 0);
+ QVERIFY(mTestObject->mModel == 0);
+ QVERIFY(mTestObject->mBgFetchTimer == 0);
+ cleanup();
+
+ mTestObject = new VideoThumbnailDataTester();
+ mTestObject->disconnectSignals();
+ delete mTestObject->mBgFetchTimer;
+ mTestObject->mBgFetchTimer = 0;
+ delete mTestObject->mThumbnailManager;
+ mTestObject->mThumbnailManager = 0;
+ mTestObject->mModel = 0;
+ __UHEAP_FAILNEXT(3);
+ mTestObject->initialize();
+ QVERIFY(mTestObject->mThumbnailManager == 0);
+ QVERIFY(mTestObject->mModel == 0);
+ QVERIFY(mTestObject->mBgFetchTimer == 0);
+ cleanup();
+
+ init();
+ mTestObject->initialize();
+ mTestObject->initialize();
+ QVERIFY(mTestObject->mThumbnailManager != 0);
+ QVERIFY(mTestObject->mModel != 0);
+ QVERIFY(mTestObject->mBgFetchTimer != 0);
+ QCOMPARE( mTestObject->mThumbnailManager->mThumbSize, ThumbnailManager::ThumbnailMedium );
+ QCOMPARE( mTestObject->mThumbnailManager->mQuality, ThumbnailManager::OptimizeForPerformance );
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testGetThumbnail
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailData_p::testGetThumbnail()
+{
+
+ int mediaid(50);
+ QPixmap pixmap(100,100);
+ pixmap.fill(Qt::blue);
+
+ init();
+
+ mTestObject->mThumbnailData.insert(TMPXItemId(mediaid, 0), new QIcon(pixmap));
+ QCOMPARE( *(mTestObject->getThumbnail(TMPXItemId(mediaid, 0))), *(mTestObject->mThumbnailData[TMPXItemId(mediaid, 0)]) );
+ QVERIFY( mTestObject->getThumbnail(TMPXItemId(mediaid+100, 0)) == mTestObject->mDefaultTnVideo );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testStartFetchingThumbnail
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailData_p::testStartFetchingThumbnail()
+{
+ QSignalSpy* spy = 0;
+ ThumbnailManager::TnRequest req;
+
+ // Tests when mModel is null.
+ init();
+ VideoSortFilterProxyModel* backupProxyModel = mTestObject->mModel;
+ mTestObject->mModel = 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;
+ cleanup();
+
+ // Tests when mThumbnailManager is null.
+ init();
+ ThumbnailManager* backupTnMgr = mTestObject->mThumbnailManager;
+ mTestObject->mThumbnailManager = 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;
+ cleanup();
+
+ // Thumbnail has been already fetched.
+ init();
+ spy = new QSignalSpy(mTestObject, SIGNAL(thumbnailsFetched(QList<TMPXItemId>)));
+ 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);
+ delete spy;
+ cleanup();
+
+ // Thumbnail fetch request to tn manager fails.
+ init();
+ ThumbnailManager::mGetThumbFails = true;
+ mTestObject->mModel->appendData("testfile");
+ 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(), 0);
+ delete spy;
+ cleanup();
+
+ // Filename is empty.
+ init();
+ ThumbnailManager::mGetThumbFails = true;
+ mTestObject->mModel->appendData("");
+ 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(), 0);
+ delete spy;
+ cleanup();
+
+ // Filename is null.
+ init();
+ ThumbnailManager::mGetThumbFails = true;
+ mTestObject->mModel->appendData(QString());
+ 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(), 0);
+ delete spy;
+ cleanup();
+
+ // Good case.
+ init();
+ QString fileName("video.mp4");
+ mTestObject->mModel->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];
+ QVERIFY(req.name == fileName);
+ QCOMPARE(req.priority, TB_PRIORITY);
+ delete spy;
+ cleanup();
+
+ // Already fetching same thumbnail.
+ init();
+ mTestObject->mModel->appendData(fileName);
+ ThumbnailManager::mRequests[1] = ThumbnailManager::TnRequest("test1", 0, -1, false);
+ 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(), 1);
+ req = ThumbnailManager::mRequests[1];
+ QVERIFY(req.name == fileName);
+ QCOMPARE(req.priority, TB_PRIORITY);
+ delete spy;
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testStartFetchingThumbnails
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailData_p::testStartFetchingThumbnails()
+{
+ ThumbnailManager::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;
+
+ 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;
+ QVERIFY(mTestObject->mCurrentFetchIndex == 0);
+ cleanup();
+
+ // Tests when mThumbnailManager 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()));
+ 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;
+ QVERIFY(mTestObject->mCurrentFetchIndex == 0);
+ cleanup();
+
+ // Tests when parameter array indexes is empty.
+ init();
+ indexes.clear();
+ spy = new QSignalSpy(mTestObject, SIGNAL(thumbnailsFetched(QList<TMPXItemId>)));
+ QCOMPARE(mTestObject->startFetchingThumbnails(indexes,
+ BACKGROUND_FETCH_PRIORITY), 0);
+ QVERIFY(checkThumbnailReadyCount(spy, 0));
+ delete spy;
+ QCOMPARE(mTestObject->mFetchList.count(), 0);
+ QVERIFY(mTestObject->mCurrentFetchIndex == 0);
+ cleanup();
+
+ // Already fetching some thumbnails.
+ init();
+ QString fileName("video.mp4");
+ mTestObject->mModel->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()));
+ 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);
+
+ req = ThumbnailManager::mRequests[50];
+ QVERIFY(req.name == "test1");
+ QCOMPARE(req.priority, -1);
+
+ req = ThumbnailManager::mRequests[40];
+ QVERIFY(req.name == "test2");
+ QCOMPARE(req.priority, -1);
+
+ req = ThumbnailManager::mRequests[30];
+ QVERIFY(req.name == "test3");
+ QCOMPARE(req.priority, -1);
+
+ req = ThumbnailManager::mRequests[3];
+ QVERIFY(req.name == fileName);
+ QCOMPARE(req.priority, static_cast<int>(BACKGROUND_FETCH_PRIORITY) + 4);
+
+ ThumbnailManager::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");
+ 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()));
+ 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);
+
+ req = ThumbnailManager::mRequests[0];
+ QVERIFY(req.name == "file3");
+ QCOMPARE(req.priority, static_cast<int>(BACKGROUND_FETCH_PRIORITY) + 3);
+
+ req = ThumbnailManager::mRequests[1];
+ QVERIFY(req.name == "file4");
+ QCOMPARE(req.priority, static_cast<int>(BACKGROUND_FETCH_PRIORITY) + 3 - 1);
+
+ req = ThumbnailManager::mRequests[2];
+ QVERIFY(req.name == "file5");
+ QCOMPARE(req.priority, static_cast<int>(BACKGROUND_FETCH_PRIORITY) + 3 - 2);
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testDoBackgroundFetching
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailData_p::testDoBackgroundFetching()
+{
+ ThumbnailManager::TnRequest req;
+ QSignalSpy* spy = 0;
+
+ // Tests when mModel is null.
+ init();
+ VideoSortFilterProxyModel* backupProxyModel = mTestObject->mModel;
+ mTestObject->mModel = 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;
+ QVERIFY(mTestObject->mCurrentFetchIndex == 0);
+ QCOMPARE(VideoSortFilterProxyModel::mRowCountCallCount, 0);
+ cleanup();
+
+ // Tests when mThumbnailManager is null.
+ init();
+ ThumbnailManager* backupTnMgr = mTestObject->mThumbnailManager;
+ mTestObject->mThumbnailManager = 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;
+ 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));
+ }
+ spy = new QSignalSpy(mTestObject, SIGNAL(thumbnailsFetched(QList<TMPXItemId>)));
+ mTestObject->emitDoBackgroundFetching();
+ QVERIFY(checkThumbnailReadyCount(spy, 0));
+ QCOMPARE(mTestObject->mFetchList.count(), THUMBNAIL_BACKGROUND_FETCH_AMOUNT/2);
+ int previousPriority = -1;
+ for(int i = 0; i < THUMBNAIL_BACKGROUND_FETCH_AMOUNT/2; i++)
+ {
+ req = ThumbnailManager::mRequests[i];
+ QVERIFY(req.name == "file" + QString::number(i));
+ if(previousPriority != -1)
+ {
+ QVERIFY(previousPriority > req.priority);
+ }
+ previousPriority = req.priority;
+ QVERIFY(previousPriority != -1);
+ }
+ QVERIFY(mTestObject->mCurrentFetchIndex == 0);
+ QVERIFY(mTestObject->mCurrentBackgroundFetchCount == THUMBNAIL_BACKGROUND_FETCH_AMOUNT);
+ QVERIFY(mTestObject->mBgFetchTimer->isActive() == false);
+
+ // Continue fetching.
+ spy->clear();
+ mTestObject->emitDoBackgroundFetching();
+ QVERIFY(checkThumbnailReadyCount(spy, 0));
+ // Now all thumbnails are being fetched.
+ QCOMPARE(mTestObject->mFetchList.count(), THUMBNAIL_BACKGROUND_FETCH_AMOUNT);
+ for(int i = 0; i < THUMBNAIL_BACKGROUND_FETCH_AMOUNT/2; i++)
+ {
+ req = ThumbnailManager::mRequests[i];
+ QVERIFY(req.name == "file" + QString::number(i));
+
+ req = ThumbnailManager::mRequests[i+5];
+ QVERIFY(req.name == "file" + QString::number(i+5));
+ }
+
+ QVERIFY(mTestObject->mCurrentFetchIndex == 0);
+ QVERIFY(mTestObject->mCurrentBackgroundFetchCount == THUMBNAIL_BACKGROUND_FETCH_AMOUNT * 2);
+ QVERIFY(mTestObject->mBgFetchTimer->isActive() == false);
+
+ delete spy;
+ cleanup();
+
+ // THUMBNAIL_BACKGROUND_FETCH_AMOUNT items in model and fetch index negative
+ init();
+ for(int i = 0; i < THUMBNAIL_BACKGROUND_FETCH_AMOUNT; i++)
+ {
+ mTestObject->mModel->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);
+ QVERIFY(mTestObject->mCurrentFetchIndex == THUMBNAIL_BACKGROUND_FETCH_AMOUNT/2*-1);
+ QVERIFY(mTestObject->mBgFetchTimer->isActive() == true);
+ cleanup();
+
+ // THUMBNAIL_BACKGROUND_FETCH_AMOUNT*2 items in model and fetch index at end
+ init();
+ for(int i = 0; i < THUMBNAIL_BACKGROUND_FETCH_AMOUNT*2; i++)
+ {
+ mTestObject->mModel->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);
+ QVERIFY(mTestObject->mCurrentFetchIndex == THUMBNAIL_BACKGROUND_FETCH_AMOUNT*2);
+ QVERIFY(mTestObject->mBgFetchTimer->isActive() == false);
+ cleanup();
+
+ // THUMBNAIL_BACKGROUND_FETCH_AMOUNT items in model and fetch index over the end
+ init();
+ for(int i = 0; i < THUMBNAIL_BACKGROUND_FETCH_AMOUNT; i++)
+ {
+ mTestObject->mModel->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);
+ QVERIFY(mTestObject->mCurrentFetchIndex == THUMBNAIL_BACKGROUND_FETCH_AMOUNT + THUMBNAIL_BACKGROUND_FETCH_AMOUNT/2);
+ QVERIFY(mTestObject->mBgFetchTimer->isActive() == true);
+ cleanup();
+
+ // no items and fetch index -5
+ init();
+ spy = new QSignalSpy(mTestObject, SIGNAL(thumbnailsFetched(QList<TMPXItemId>)));
+ mTestObject->mCurrentFetchIndex = -5;
+ mTestObject->emitDoBackgroundFetching();
+ QVERIFY(checkThumbnailReadyCount(spy, 0));
+ delete spy;
+ QCOMPARE(mTestObject->mFetchList.count(), 0);
+ QVERIFY(mTestObject->mCurrentFetchIndex == -5);
+ QVERIFY(mTestObject->mBgFetchTimer->isActive() == false);
+ cleanup();
+
+ // Model returns invalid indexes.
+ init();
+ for(int i = 0; i < THUMBNAIL_BACKGROUND_FETCH_AMOUNT; i++)
+ {
+ mTestObject->mModel->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);
+ 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();
+}
+
+// ---------------------------------------------------------------------------
+// testThumbnailReadySlot
+// ---------------------------------------------------------------------------
+//
+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;
+ cleanup();
+
+ ThumbnailManager::mRequests.clear();
+ ulong heapCellPtr = User::Heap().__DbgMarkEnd(0);
+ //QCOMPARE( heapCellPtr, (ulong)0 );
+
+ // Test null thumbnail data.
+
+ 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));
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testDefaultThumbnail
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailData_p::testDefaultThumbnail()
+{
+ init();
+
+ QVERIFY( mTestObject->mDefaultTnVideo == 0 );
+ QVERIFY( mTestObject->mDefaultTnCategory == 0 );
+
+ // Tn for video
+ const QIcon* tn = mTestObject->defaultThumbnail(TMPXItemId(1, 0));
+ QVERIFY( tn != 0 );
+ QVERIFY( tn->isNull() == false );
+ QCOMPARE( tn->cacheKey(), mTestObject->mDefaultTnVideo->cacheKey() );
+
+ // Tn for category
+ const QIcon* tn2 = mTestObject->defaultThumbnail(TMPXItemId(0, 1));
+ QVERIFY( tn2 != 0 );
+ QVERIFY( tn2->isNull() == false );
+ QCOMPARE( tn2->cacheKey(), mTestObject->mDefaultTnCategory->cacheKey() );
+
+ QVERIFY(tn2->cacheKey() != tn->cacheKey());
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testRemoveThumbnail
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailData_p::testRemoveThumbnail()
+{
+ init();
+
+ TMPXItemId id1(1, 0);
+ TMPXItemId id2(2, 0);
+ TMPXItemId id3(3, 0);
+ TMPXItemId id4(4, 0);
+
+ mTestObject->mThumbnailData.insert(id2, new QIcon());
+ mTestObject->mThumbnailData.insert(id3, new QIcon());
+
+ QCOMPARE( mTestObject->removeThumbnail(id1), 0 );
+ QCOMPARE( mTestObject->removeThumbnail(id2), 1 );
+ QCOMPARE( mTestObject->removeThumbnail(id3), 1 );
+ QCOMPARE( mTestObject->removeThumbnail(id4), 0 );
+
+ QVERIFY( mTestObject->mThumbnailData.contains(id2) == false );
+ QVERIFY( mTestObject->mThumbnailData.contains(id3) == false );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testLayoutChangedSlot
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailData_p::testLayoutChangedSlot()
+{
+ // Empty list.
+ init();
+ mTestObject->emitLayoutChanged();
+ QVERIFY(mTestObject->mCurrentFetchIndex == 0);
+ QCOMPARE(mTestObject->mFetchList.count(), 0);
+ QVERIFY(mTestObject->mCurrentBackgroundFetchCount == 0);
+ QVERIFY(mTestObject->mBgFetchTimer->isActive() == false);
+ 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->emitLayoutChanged();
+ 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();
+}
+
+// ---------------------------------------------------------------------------
+// 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
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailData_p::testStartBackgroundFetching()
+{
+ init();
+
+ // Bg fetch enabled
+ mTestObject->mBackgroundFetchingEnabled = true;
+ mTestObject->mCurrentFetchIndex = -5;
+ mTestObject->startBackgroundFetching(10);
+ QVERIFY(mTestObject->mCurrentFetchIndex == 10);
+
+ // Bg fetch disabled
+ mTestObject->mBackgroundFetchingEnabled = false;
+ mTestObject->mCurrentFetchIndex = -5;
+ mTestObject->startBackgroundFetching(10);
+ QVERIFY(mTestObject->mCurrentFetchIndex == -5);
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testEnableBackgroundFetching
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailData_p::testEnableBackgroundFetching()
+{
+ init();
+
+ // Default
+ QVERIFY(mTestObject->mBackgroundFetchingEnabled == true);
+
+ // Disable
+ mTestObject->mCurrentFetchIndex = -1;
+ mTestObject->enableBackgroundFetching(false);
+ QVERIFY(mTestObject->mBackgroundFetchingEnabled == false);
+ QCOMPARE(mTestObject->mCurrentFetchIndex, -1);
+
+ mTestObject->mBgFetchTimer->setSingleShot(false);
+ mTestObject->continueBackgroundFetch();
+ QVERIFY(mTestObject->mBgFetchTimer->isSingleShot() == false);
+
+ // Enabled
+ mTestObject->mCurrentFetchIndex = -1;
+
+ mTestObject->enableBackgroundFetching(true);
+ QVERIFY(mTestObject->mBackgroundFetchingEnabled == true);
+ QCOMPARE(mTestObject->mCurrentFetchIndex, 0);
+
+ mTestObject->mBgFetchTimer->setSingleShot(false);
+ mTestObject->continueBackgroundFetch();
+ QVERIFY(mTestObject->mBgFetchTimer->isSingleShot() == true);
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// testFreeThumbnailData
+// ---------------------------------------------------------------------------
+//
+void TestVideoThumbnailData_p::testFreeThumbnailData()
+{
+ init();
+
+ QVERIFY( mTestObject->getThumbnail(TMPXItemId(1, 0)) == mTestObject->mDefaultTnVideo );
+ QVERIFY( mTestObject->getThumbnail(TMPXItemId(0, 1)) == mTestObject->mDefaultTnCategory );
+ mTestObject->freeThumbnailData();
+
+ QVERIFY(!mTestObject->mBgFetchTimer->isActive());
+ QVERIFY(!mTestObject->mTbnReportTimer->isActive());
+ QCOMPARE(mTestObject->mFetchList.count(), 0);
+ QCOMPARE(mTestObject->mReadyThumbnailMediaIds.count(), 0);
+ QCOMPARE(mTestObject->mThumbnailData.count(), 0);
+
+ QVERIFY(mTestObject->mDefaultTnVideo == 0);
+ QVERIFY(mTestObject->mDefaultTnVideo == 0);
+
+ // Call again.
+ mTestObject->freeThumbnailData();
+
+ cleanup();
+}
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/src/videothumbnaildatatester.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,158 @@
+/**
+* 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 VideoThumbnailData
+*
+*/
+
+// INCLUDES
+#define private public
+#include "videothumbnaildata_p.h"
+#undef private
+
+#include "videothumbnaildatatester.h"
+
+// -----------------------------------------------------------------------------
+// VideoTnDataTester::VideoTnDataTester()
+// -----------------------------------------------------------------------------
+//
+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(reportThumbnailsReadySignal()), this, SLOT(reportThumbnailsReadySlot()));
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataTester::~VideoThumbnailDataTester()
+// -----------------------------------------------------------------------------
+//
+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(reportThumbnailsReadySignal()), this, SLOT(reportThumbnailsReadySlot()));
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataTester::emitDoBackgroundFetching()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailDataTester::emitDoBackgroundFetching()
+{
+ emit doBackgroundFetchingSignal();
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataTester::emitDoBackgroundFetching()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailDataTester::emitReportThumbnailsReady()
+{
+ emit reportThumbnailsReadySignal();
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataTester::emitLayoutChanged()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailDataTester::emitLayoutChanged()
+{
+ emit layoutChangedSignal();
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataTester::emitRowsInserted()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailDataTester::emitRowsInserted(const QModelIndex & parent, int start, int end)
+{
+ emit rowsInsertedSignal(parent, start, end);
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataTester::removeFromFetchList()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailDataTester::removeFromFetchList(int tnId)
+{
+ VideoThumbnailDataPrivate::removeFromFetchList(tnId);
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataTester::initialize()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailDataTester::initialize()
+{
+ VideoThumbnailDataPrivate::initialize();
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataTester::cleanup()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailDataTester::cleanup()
+{
+ VideoThumbnailDataPrivate::cleanup();
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataTester::connectSignals()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailDataTester::connectSignals()
+{
+ VideoThumbnailDataPrivate::connectSignals();
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataTester::disconnectSignals()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailDataTester::disconnectSignals()
+{
+ VideoThumbnailDataPrivate::disconnectSignals();
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataTester::defaultThumbnail()
+// -----------------------------------------------------------------------------
+//
+const QIcon* VideoThumbnailDataTester::defaultThumbnail(TMPXItemId mediaId)
+{
+ return VideoThumbnailDataPrivate::defaultThumbnail(mediaId);
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataTester::startBackgroundFetching()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailDataTester::startBackgroundFetching(int fetchIndex)
+{
+ VideoThumbnailDataPrivate::startBackgroundFetching(fetchIndex);
+}
+
+// -----------------------------------------------------------------------------
+// VideoThumbnailDataTester::continueBackgroundFetch()
+// -----------------------------------------------------------------------------
+//
+void VideoThumbnailDataTester::continueBackgroundFetch()
+{
+ VideoThumbnailDataPrivate::continueBackgroundFetch();
+}
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/stub/inc/thumbnailmanager_qt.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,377 @@
+/*
+* 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/stub/inc/videocollectionwrapper.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,102 @@
+/*
+* 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: CVideoCollectionWrapper dummy class definition
+*
+*/
+
+#ifndef __VIDEOCOLLECTIONWRAPPER_H__
+#define __VIDEOCOLLECTIONWRAPPER_H__
+
+
+// INCLUDES
+#include <QObject>
+
+
+// FORWARD DECLARATIONS
+class VideoSortFilterProxyModel;
+
+
+class VideoCollectionWrapper : public QObject
+{
+ /**
+ * define to be able to use signals and slots
+ */
+ Q_OBJECT
+
+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();
+
+ /**
+ * Decreases the reference count, when count reaches zero cleanup is done.
+ *
+ */
+ void decreaseReferenceCount();
+
+ /**
+ * Returns pointer to model
+ *
+ * @return address to model or NULL if fails.
+ */
+ VideoSortFilterProxyModel* getModel();
+
+/* Additional functions needed for testing purposes */
+
+ void reset();
+
+ void setModel(VideoSortFilterProxyModel* model);
+
+signals:
+
+private:
+
+ /**
+ * Private contructor.
+ */
+ VideoCollectionWrapper();
+
+ /**
+ * Private destructor.
+ *
+ */
+ virtual ~VideoCollectionWrapper();
+
+ /**
+ * disables copy-constructor and assingment operator
+ */
+ Q_DISABLE_COPY(VideoCollectionWrapper)
+
+private:
+
+ VideoSortFilterProxyModel* mModel;
+
+public:
+
+ static VideoCollectionWrapper *mInstance;
+
+ static int mReferenceCount;
+};
+
+#endif // __VIDEOCOLLECTIONWRAPPER_H__
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/stub/inc/videosortfilterproxymodel.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,116 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Videolist sort filter proxy stub implementation
+*
+*/
+
+#ifndef VIDEOSORTFILTERPROXYMODEL_H
+#define VIDEOSORTFILTERPROXYMODEL_H
+
+#include <qsortfilterproxymodel.h>
+#include <QString>
+#include <QList>
+#include <mpxitemid.h>
+
+class VideoSortFilterProxyModel : public QSortFilterProxyModel
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * Contructor.
+ *
+ * @param parent parent of this widget
+ */
+ VideoSortFilterProxyModel(QObject *parent=0);
+
+ /**
+ * Destructor.
+ *
+ */
+ virtual ~VideoSortFilterProxyModel();
+
+public:
+
+ /**
+ * Method checks that model exists and asks for mpx id from
+ * given object.
+ *
+ * @param index index of the item.
+ * @return int mpx id if succeeds, -1 in case of error
+ *
+ */
+ TMPXItemId getMediaIdAtIndex(QModelIndex index);
+
+ /**
+ * Returns filepath.
+ *
+ * @param mediaId id for the item, only iId1 is used.
+ * @returns file path for the item.
+ */
+ QString getMediaFilePathForId(TMPXItemId mediaId);
+
+ /**
+ * Return to collection level
+ *
+ */
+ void back();
+
+public: // Simplified data access.
+ /**
+ * Return count of filenames.
+ *
+ */
+ int rowCount(const QModelIndex & parent = QModelIndex()) const;
+
+ /**
+ * Return specified index.
+ *
+ */
+ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
+
+ /**
+ * Returns copy of the given index.
+ *
+ */
+ QModelIndex mapToSource(const QModelIndex &proxyIndex) const;
+
+public: // Test helper methods.
+
+ static void reset();
+
+ void appendData(QString fileName);
+
+protected: // from QSortFilterProxyModel
+
+ /**
+ * Compares items based in the role setted before sorting.
+ *
+ */
+ bool lessThan ( const QModelIndex & left, const QModelIndex & right ) const;
+
+public:
+
+ // Incremented at rowCount calls.
+ static int mRowCountCallCount;
+
+ // If true index() returns invalid indexes.
+ static bool mReturnInvalidIndexes;
+
+ // Model items.
+ QList<QString> mFileNames;
+};
+
+#endif //VIDEOSORTFILTERPROXYMODEL_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/stub/src/thumbnailmanager_qt.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,165 @@
+/*
+* 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);
+ }
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/stub/src/videocollectionwrapper.cpp Thu Apr 01 22:38:49 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: CVideoCollectionWrapper dummy class implementation
+*
+*/
+
+// INCLUDE FILES
+#include <qabstractitemmodel.h>
+#include <QDebug>
+#include <QtTest/QtTest>
+#include "videocollectionwrapper.h"
+
+int VideoCollectionWrapper::mReferenceCount = 0;
+VideoCollectionWrapper *VideoCollectionWrapper::mInstance = 0;
+
+// -----------------------------------------------------------------------------
+// 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;
+ }
+ }
+}
+
+// -----------------------------------------------------------------------------
+// VideoCollectionWrapper::VideoCollectionWrapper()
+// -----------------------------------------------------------------------------
+//
+VideoCollectionWrapper::VideoCollectionWrapper() :
+mModel(0)
+{
+}
+
+// -----------------------------------------------------------------------------
+// VideoCollectionWrapper::~VideoCollectionWrapper()
+// -----------------------------------------------------------------------------
+//
+VideoCollectionWrapper::~VideoCollectionWrapper()
+{
+}
+
+// -----------------------------------------------------------------------------
+// VideoCollectionWrapper::open()
+// -----------------------------------------------------------------------------
+//
+VideoSortFilterProxyModel* VideoCollectionWrapper::getModel()
+{
+ return mModel;
+}
+
+// -----------------------------------------------------------------------------
+// VideoCollectionWrapper::reset()
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionWrapper::reset()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// VideoCollectionWrapper::setModel()
+// -----------------------------------------------------------------------------
+//
+void VideoCollectionWrapper::setModel(VideoSortFilterProxyModel* model)
+{
+ mModel = model;
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/stub/src/videosortfilterproxymodel.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,135 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Videolist sort filter proxy stub implementation
+*
+*/
+
+#include <qstringlist.h>
+#include <qdatetime.h>
+
+#include "videocollectioncommon.h"
+#include "videosortfilterproxymodel.h"
+
+int VideoSortFilterProxyModel::mRowCountCallCount = 0;
+bool VideoSortFilterProxyModel::mReturnInvalidIndexes = false;
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::VideoSortFilterProxyModel
+// -----------------------------------------------------------------------------
+//
+VideoSortFilterProxyModel::VideoSortFilterProxyModel(QObject *parent) :
+ QSortFilterProxyModel(parent)
+{
+ reset();
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::~VideoSortFilterProxyModel
+// -----------------------------------------------------------------------------
+//
+VideoSortFilterProxyModel::~VideoSortFilterProxyModel()
+{
+ disconnect();
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::lessThan
+// -----------------------------------------------------------------------------
+//
+bool VideoSortFilterProxyModel::lessThan(const QModelIndex &left, const QModelIndex &right) const
+{
+ return false;
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::getMediaIdAtIndex
+// -----------------------------------------------------------------------------
+//
+TMPXItemId VideoSortFilterProxyModel::getMediaIdAtIndex(QModelIndex index)
+{
+ return TMPXItemId(index.row(), 0);
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::getMediaFilePathForId()
+// -----------------------------------------------------------------------------
+//
+QString VideoSortFilterProxyModel::getMediaFilePathForId(TMPXItemId mediaId)
+{
+ if(mediaId.iId1 >= 0 && mediaId.iId1 < mFileNames.count())
+ {
+ return mFileNames.at(mediaId.iId1);
+ }
+ return "";
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::back
+// -----------------------------------------------------------------------------
+//
+void VideoSortFilterProxyModel::back()
+{
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::reset
+// -----------------------------------------------------------------------------
+//
+void VideoSortFilterProxyModel::reset()
+{
+
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::appendData
+// -----------------------------------------------------------------------------
+//
+void VideoSortFilterProxyModel::appendData(QString fileName)
+{
+ mFileNames.append(fileName);
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::rowCount
+// -----------------------------------------------------------------------------
+//
+int VideoSortFilterProxyModel::rowCount(const QModelIndex &parent) const
+{
+ VideoSortFilterProxyModel::mRowCountCallCount++;
+ return mFileNames.count();
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::index
+// -----------------------------------------------------------------------------
+//
+QModelIndex VideoSortFilterProxyModel::index(int row, int column, const QModelIndex &parent) const
+{
+ if(mReturnInvalidIndexes)
+ return QModelIndex();
+ else
+ return QModelIndex(createIndex(row, column));
+}
+
+// -----------------------------------------------------------------------------
+// VideoSortFilterProxyModel::mapToSource
+// -----------------------------------------------------------------------------
+//
+QModelIndex VideoSortFilterProxyModel::mapToSource(const QModelIndex &proxyIndex) const
+{
+ return QModelIndex(proxyIndex);
+}
+
+// end of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videocollectionwrapper/tsrc/testvideothumbnaildata_p/testvideothumbnaildata_p.pro Thu Apr 01 22:38:49 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:
+#
+
+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
+
+RESOURCES += data/testvideothumbnaildata_p.qrc
+
+# Input
+HEADERS += inc/testvideothumbnaildata_p.h \
+ inc/videothumbnaildatatester.h \
+ stub/inc/thumbnailmanager_qt.h \
+ stub/inc/videocollectionwrapper.h \
+ stub/inc/videosortfilterproxymodel.h \
+ ../../inc/videothumbnaildata_p.h \
+ ../../../inc/videocollectionexport.h
+
+SOURCES += src/testvideothumbnaildata_p.cpp \
+ src/videothumbnaildatatester.cpp \
+ stub/src/thumbnailmanager_qt.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/videocollectionwrapper.pro Thu Apr 01 22:38:49 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:
+#
+
+TEMPLATE = lib
+TARGET =
+symbian: {
+ TARGET.UID2 = 0x1000008D
+ TARGET.UID3 = 0x200211FD
+ BLD_INF_RULES.prj_exports += "rom/videocollectionwrapper.iby CORE_APP_LAYER_IBY_EXPORT_PATH(videocollectionwrapper.iby)"
+ MMP_RULES += "DEFFILE videocollectionwrapper.def"
+ TARGET.CAPABILITY = CAP_GENERAL_DLL
+ TARGET.EPOCALLOWDLLDATA = 1
+}
+CONFIG += hb qt dll
+DEFINES += BUILD_VIDEOCOLLECTION_DLL
+
+DEPENDPATH += . inc src
+
+INCLUDEPATH += .
+
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
+INCLUDEPATH += $$OS_LAYER_STDCPP_SYSTEMINCLUDE
+
+INCLUDEPATH += ../inc \
+ /epoc32/include/mw/hb/hbtools
+
+# Input
+HEADERS += inc/videodatasignalreceiver.h \
+ inc/videocollectionclient.h \
+ inc/videocollectionlistener.h \
+ inc/videocollectionwrapper.h \
+ inc/videocollectionwrapper_p.h \
+ inc/videolistdatamodel.h \
+ inc/videolistdatamodel_p.h \
+ inc/videothumbnaildata.h \
+ inc/videothumbnaildata_p.h \
+ inc/videocollectionutils.h \
+ inc/videosortfilterproxymodel.h \
+ inc/videodatacontainer.h \
+ ../inc/videocollectionexport.h
+
+SOURCES += src/videocollectionclient.cpp \
+ src/videocollectionlistener.cpp \
+ src/videocollectionwrapper.cpp \
+ src/videocollectionwrapper_p.cpp \
+ src/videolistdatamodel.cpp \
+ src/videolistdatamodel_p.cpp \
+ src/videothumbnaildata.cpp \
+ src/videothumbnaildata_p.cpp \
+ src/videocollectionutils.cpp \
+ src/videosortfilterproxymodel.cpp \
+ src/videodatacontainer.cpp
+
+LIBS += -lmpxcommon.dll \
+ -lmpxcollectionutility.dll \
+ -lthumbnailmanagerqt.dll \
+ -lestor.dll \
+ -lcentralrepository.dll
+
+RESOURCES += data/videocollectionwrapper.qrc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videofiledetailsview/data/pri_large_video.svg Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [
+ <!ENTITY ns_flows "http://ns.adobe.com/Flows/1.0/">
+]>
+<svg version="1.1"
+ xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:a="http://ns.adobe.com/AdobeSVGViewerExtensions/3.0/"
+ x="0px" y="0px" width="98px" height="98px" viewBox="0 0 98 98" enable-background="new 0 0 98 98" xml:space="preserve">
+<defs>
+</defs>
+<linearGradient id="SVGID_1_" gradientUnits="userSpaceOnUse" x1="48.9995" y1="19" x2="48.9995" y2="79.0015">
+ <stop offset="0" style="stop-color:#757575"/>
+ <stop offset="0.2424" style="stop-color:#000000"/>
+ <stop offset="0.8606" style="stop-color:#000000"/>
+ <stop offset="1" style="stop-color:#363636"/>
+</linearGradient>
+<path fill="url(#SVGID_1_)" d="M84.5,19h-71c-1.105,0-2,0.896-2,2v56.001c0,1.105,0.895,2,2,2h71c1.104,0,2-0.895,2-2V21
+ C86.5,19.896,85.603,19,84.5,19z M20.5,75.001c0,0.551-0.451,1-1,1h-4c-0.551,0-1-0.449-1-1v-2c0-0.549,0.449-1,1-1h4
+ c0.549,0,1,0.451,1,1V75.001z M20.5,25c0,0.551-0.451,1-1,1h-4c-0.551,0-1-0.449-1-1v-2c0-0.549,0.449-1,1-1h4c0.549,0,1,0.451,1,1
+ V25z M29.5,75.001c0,0.551-0.451,1-1,1h-4c-0.551,0-1-0.449-1-1v-2c0-0.549,0.449-1,1-1h4c0.549,0,1,0.451,1,1V75.001z M29.5,25
+ c0,0.551-0.451,1-1,1h-4c-0.551,0-1-0.449-1-1v-2c0-0.549,0.449-1,1-1h4c0.549,0,1,0.451,1,1V25z M38.5,75.001c0,0.551-0.451,1-1,1
+ h-4c-0.55,0-1-0.449-1-1v-2c0-0.549,0.449-1,1-1h4c0.549,0,1,0.451,1,1V75.001z M38.5,25c0,0.551-0.451,1-1,1h-4
+ c-0.55,0-1-0.449-1-1v-2c0-0.549,0.449-1,1-1h4c0.549,0,1,0.451,1,1V25z M47.5,75.001c0,0.551-0.451,1-1,1h-4c-0.551,0-1-0.449-1-1
+ v-2c0-0.549,0.449-1,1-1h4c0.549,0,1,0.451,1,1V75.001z M47.5,25c0,0.551-0.451,1-1,1h-4c-0.551,0-1-0.449-1-1v-2
+ c0-0.549,0.449-1,1-1h4c0.549,0,1,0.451,1,1V25z M56.5,75.001c0,0.551-0.451,1-1,1h-4c-0.551,0-1-0.449-1-1v-2c0-0.549,0.449-1,1-1
+ h4c0.549,0,1,0.451,1,1V75.001z M56.5,25c0,0.551-0.451,1-1,1h-4c-0.551,0-1-0.449-1-1v-2c0-0.549,0.449-1,1-1h4
+ c0.549,0,1,0.451,1,1V25z M65.5,75.001c0,0.551-0.451,1-1,1h-4c-0.551,0-1-0.449-1-1v-2c0-0.549,0.449-1,1-1h4c0.549,0,1,0.451,1,1
+ V75.001z M65.5,25c0,0.551-0.451,1-1,1h-4c-0.551,0-1-0.449-1-1v-2c0-0.549,0.449-1,1-1h4c0.549,0,1,0.451,1,1V25z M74.5,75.001
+ c0,0.551-0.451,1-1,1h-4c-0.551,0-1-0.449-1-1v-2c0-0.549,0.449-1,1-1h4c0.549,0,1,0.451,1,1V75.001z M74.5,25c0,0.551-0.451,1-1,1
+ h-4c-0.551,0-1-0.449-1-1v-2c0-0.549,0.449-1,1-1h4c0.549,0,1,0.451,1,1V25z M83.5,75.001c0,0.551-0.451,1-1,1h-4
+ c-0.551,0-1-0.449-1-1v-2c0-0.549,0.449-1,1-1h4c0.549,0,1,0.451,1,1V75.001z M83.5,25c0,0.551-0.451,1-1,1h-4c-0.551,0-1-0.449-1-1
+ v-2c0-0.549,0.449-1,1-1h4c0.549,0,1,0.451,1,1V25z"/>
+<path opacity="0.55" fill="#FFFFFF" d="M84.5,19h-71c-1.105,0-2,0.896-2,2v1c0-1.104,0.895-2,2-2h71c1.104,0,2,0.896,2,2v-1
+ C86.5,19.896,85.603,19,84.5,19z"/>
+<path opacity="0.1" fill="#FFFFFF" d="M13.5,79.001h71c1.104,0,2-0.895,2-2v-1c0,1.105-0.896,2-2,2h-71c-1.105,0-2-0.895-2-2v1
+ C11.5,78.106,12.395,79.001,13.5,79.001z"/>
+<linearGradient id="SVGID_2_" gradientUnits="userSpaceOnUse" x1="48.9995" y1="29.1592" x2="48.9995" y2="69.1606">
+ <stop offset="0" style="stop-color:#000000"/>
+ <stop offset="0.5" style="stop-color:#666666"/>
+ <stop offset="1" style="stop-color:#000000"/>
+</linearGradient>
+<rect x="11.5" y="29" fill="url(#SVGID_2_)" width="75" height="40.001"/>
+<linearGradient id="SVGID_3_" gradientUnits="userSpaceOnUse" x1="49" y1="69.001" x2="49" y2="29.0005">
+ <stop offset="0" style="stop-color:#36B5FF"/>
+ <stop offset="1" style="stop-color:#1B66D8"/>
+</linearGradient>
+<path fill="url(#SVGID_3_)" d="M83.5,67.001c0,1.1-0.9,2-2,2h-65c-1.1,0-2-0.9-2-2V31c0-1.1,0.9-2,2-2h65c1.1,0,2,0.9,2,2V67.001z"
+ />
+<path opacity="0.5" fill="#FFFFFF" d="M81.5,67.001h-65c-1.1,0-2,0.1-2-1l0,0c0,1.1,0.9,2,2,2h65c1.1,0,2-0.9,2-2l0,0
+ C83.5,67.101,82.599,67.001,81.5,67.001z"/>
+<linearGradient id="SVGID_4_" gradientUnits="userSpaceOnUse" x1="48.9995" y1="29" x2="48.9995" y2="69.1607">
+ <stop offset="0" style="stop-color:#000000"/>
+ <stop offset="1" style="stop-color:#404040"/>
+</linearGradient>
+<path fill="url(#SVGID_4_)" d="M81.5,30c0.551,0,1,0.449,1,1v36.001c0,0.553-0.449,1-1,1h-65c-0.551,0-1-0.447-1-1V31
+ c0-0.551,0.449-1,1-1H81.5 M81.5,29h-65c-1.1,0-2,0.9-2,2v36.001c0,1.1,0.9,2,2,2h65c1.1,0,2-0.9,2-2V31
+ C83.5,29.9,82.599,29,81.5,29L81.5,29z"/>
+<path opacity="0.2" fill="#FFFFFF" d="M81.5,41.001V33c0-1.104-0.896-2-2-2h-61c-1.105,0-2,0.896-2,2v13.001L81.5,41.001z"/>
+<rect fill="none" width="98" height="98.001"/>
+</svg>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videofiledetailsview/data/videofiledetails.qrc Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,9 @@
+<RCC>
+ <qresource prefix="/xml" >
+ <file alias="videofiledetails.docml">videofiledetails.xml</file>
+ </qresource>
+ <qresource prefix="/gfx" >
+ <file alias="play.png">play.png</file>
+ <file alias="pri_large_video.svg">pri_large_video.svg</file>
+ </qresource>
+</RCC>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videofiledetailsview/data/videofiledetails.xml Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,378 @@
+<?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"/>
+ </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"/>
+ </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">
+ <real name="z" value="2"/>
+ <sizehint height="199" type="PREFERRED" width="320"/>
+ </widget>
+ <real name="z" value="1"/>
+ <sizehint height="250" type="PREFERRED" width="320"/>
+ <layout orientation="Vertical" type="linear">
+ <linearitem itemname="mBtnPlay"/>
+ <linearitem itemname="mRatingSlider"/>
+ </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>
+ </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>
+ <layout orientation="Vertical" type="linear">
+ <linearitem itemname="mBtnPlay"/>
+ <linearitem itemname="container"/>
+ </layout>
+ </widget>
+ <widget name="mContent" role="HbView:widget" type="HbWidget">
+ <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"/>
+ </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"/>
+ </layout>
+ </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>
+ <layout orientation="Vertical" type="linear">
+ <linearitem itemname="mBtnPlay"/>
+ <linearitem itemname="container"/>
+ </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>
+ </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">
+ <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/videofiledetailsviewplugin.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,305 @@
+/*
+* 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: VideoFileDetailsViewPlugin class definition
+*
+*/
+
+#ifndef VIDEOFILEDETAILSPLUGIN_H
+#define VIDEOFILEDETAILSPLUGIN_H
+
+
+// INCLUDES
+#include <qobject>
+#include <mpxviewpluginqt.h>
+#include <hbdocumentloader.h>
+#include <qpixmap.h>
+
+class VideoSortFilterProxyModel;
+class QModelIndex;
+class HbAction;
+class HbMarqueeItem;
+class ThumbnailManager;
+class VideoServices;
+class VideoCollectionWrapper;
+
+class VideoFileDetailsViewPlugin : public MpxViewPlugin
+ {
+
+ Q_OBJECT
+
+public: // Constructor / destructor
+
+ /**
+ * 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
+ *
+ * @return QGraphicsWidget*
+ */
+ QGraphicsWidget* getView();
+
+signals:
+ /**
+ * Command signal, plugin user shoulf connect this in case it wants
+ * to receive commands emitted from the view.
+ *
+ * @param command id
+ */
+ void command( int );
+
+ /**
+ * Signals the URI of the current video to VideoServices
+ *
+ * @param URI of the video
+ */
+ void fileUri(const QString&);
+
+public slots: // from QViewPlugin
+
+ /**
+ * Plugin user can notify orientation changes by connecting into this slot
+ * ti it's signal. In normal cases, view handles orientation chages itself.
+ *
+ * @param orientation new orientation
+ */
+ void orientationChange( Qt::Orientation orientation );
+
+ /**
+ * Plugin user can notify oback button changes by connecting into this slot
+ *
+ */
+ void back();
+
+private slots:
+
+ /**
+ * Signaled when attach button is clicked, only when started as a service.
+ * Gets the URI of the current video
+ *
+ */
+ void getFileUri();
+
+
+ /**
+ * Signaled when short details are ready.
+ *
+ * @param index Index of the clip, needed when getting the data from model.
+ */
+ void shortDetailsReadySlot(int index);
+
+ /**
+ * Signaled when full details are ready.
+ *
+ * @param index Index of the clip, needed when getting the data from model.
+ */
+ void fullDetailsReadySlot(int index);
+
+ /**
+ * 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.
+ * If video to be removed is the one whose details
+ * 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
+ */
+ void handleErrorSlot(int errorCode, QVariant &additional);
+
+ /**
+ * Slot that is connected to thumbnailReady signal in tnwrapper, which
+ * signals when thumbnail loading has been completed.
+ *
+ * @param pixmap An object representing the resulting thumbnail.
+ * @param clientData Client data
+ * @param id Request ID for the operation
+ * @param errorCode error code
+ */
+ void thumbnailReadySlot(QPixmap pixmap, void * clientData, int id, int errorCode);
+
+private:
+
+ /**
+ * Pre-creates the view and thumbnailmanager.
+ *
+ */
+ void preCreateView();
+
+ /**
+ * Allocates view and rest of it's objects to be ready to
+ * be activated.
+ *
+ */
+ void finalizeCreateView();
+
+ /**
+ * Signaled for one item deletion.
+ *
+ */
+ void deleteItem(QModelIndex index);
+
+ /**
+ * Starts fetching the large thumbnail with tnwrapper.
+ */
+ void startFetchingThumbnail();
+
+ /**
+ * 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>
+ T* findWidget(QString name);
+
+ template<class T>
+ T* findObject(QString name);
+
+private:
+
+ /**
+ * Details view create status
+ */
+ enum TViewStatus
+ {
+ ENotCreated,
+ EPreCreated,
+ EFinalized
+ };
+
+ /**
+ * Document loader that holds the view object
+ */
+ HbDocumentLoader mView;
+
+ /**
+ * Pointer to the model that holds video details. Not owned.
+ */
+ VideoSortFilterProxyModel* mModel;
+
+ /**
+ * pointer to videoservices instance
+ */
+ VideoServices* mVideoServices;
+
+ /**
+ * Activated flag. Set as true when view is properly activated.
+ * If flag is false, no operations can be do to the view.
+ */
+ bool mActivated;
+
+ /**
+ * Boolean for knowing when the app was started as a service.
+ */
+ bool mIsService;
+
+ /**
+ * Details view create status,
+ * if ENotCreated, view has not been created,
+ * if EPreCreated, view has been pre created
+ * if EFinalized, view creation has been finalised
+ */
+ TViewStatus mCreated;
+
+ /**
+ * Index of the video clip in the model.
+ */
+ int mVideoIndex;
+
+ /**
+ * Defined action to be set to top right button, when view is activated
+ */
+ HbAction *mSecSkAction;
+
+ /**
+ * Title animation widget
+ */
+ HbMarqueeItem *mTitleAnim;
+
+ /**
+ * Thumbnail manager.
+ */
+ ThumbnailManager* mThumbnailManager;
+
+ /**
+ * Collection wrapper.
+ */
+ VideoCollectionWrapper *mCollectionWrapper;
+
+ };
+
+#endif // VIDEOFILEDETAILSPLUGIN_H
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videofiledetailsview/src/videofiledetailsviewplugin.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,675 @@
+/*
+* 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 implementation
+*
+*/
+
+// INCLUDE FILES
+#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 <cmath>
+#include <hbframedrawer.h>
+#include <thumbnailmanager_qt.h>
+#include "videocollectionclient.h"
+#include "videofiledetailsviewplugin.h"
+#include "videocollectioncommon.h"
+#include "mpxhbvideocommondefs.h"
+#include "videocollectionwrapper.h"
+#include "videosortfilterproxymodel.h"
+#include "videoservices.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_MENUACTION_DELETE = "mOptionsDelete";
+const char* const VIDEO_DETAILS_MENUACTION_SHARE = "mOptionsShare";
+
+const int VIDEO_DETAILS_DETAIL_AMOUNT = 6;
+
+// Just for testing, remove this
+void _DebugNotImplementedYet()
+{
+ HbMessageBox::information(QObject::tr("Not implemented yet"));
+}
+
+// ---------------------------------------------------------------------------
+// Constructor
+// ---------------------------------------------------------------------------
+//
+VideoFileDetailsViewPlugin::VideoFileDetailsViewPlugin()
+ : mModel(0),
+ mVideoServices(0),
+ mActivated(false),
+ mIsService(false),
+ mCreated(VideoFileDetailsViewPlugin::ENotCreated),
+ mVideoIndex(-1),
+ mSecSkAction(0),
+ mTitleAnim(0),
+ mThumbnailManager(0)
+{
+ mCollectionWrapper = VideoCollectionWrapper::instance();
+}
+
+// ---------------------------------------------------------------------------
+// Destructor
+// ---------------------------------------------------------------------------
+//
+VideoFileDetailsViewPlugin::~VideoFileDetailsViewPlugin()
+{
+ destroyView();
+}
+
+// ---------------------------------------------------------------------------
+// Create view
+// ---------------------------------------------------------------------------
+//
+void VideoFileDetailsViewPlugin::createView()
+{
+ if (VideoFileDetailsViewPlugin::EPreCreated == mCreated)
+ {
+ finalizeCreateView();
+ }
+ else if (VideoFileDetailsViewPlugin::ENotCreated == mCreated)
+ {
+ preCreateView();
+ }
+}
+
+// ---------------------------------------------------------------------------
+// preCreateView
+// ---------------------------------------------------------------------------
+//
+void VideoFileDetailsViewPlugin::preCreateView()
+{
+ mActivated = false;
+ mCreated = VideoFileDetailsViewPlugin::EPreCreated;
+
+ if (!mThumbnailManager)
+ {
+ mThumbnailManager = new ThumbnailManager();
+ }
+}
+// ---------------------------------------------------------------------------
+// finalizeCreateView
+// ---------------------------------------------------------------------------
+//
+void VideoFileDetailsViewPlugin::finalizeCreateView()
+{
+ mView.reset();
+ mActivated = false;
+ mCreated = VideoFileDetailsViewPlugin::EFinalized;
+ bool ok = false;
+ mView.load(VIDEO_DETAILS_DOCML, &ok);
+
+ if(mCollectionWrapper)
+ {
+ mModel = mCollectionWrapper->getModel();
+ }
+
+ if (!mModel)
+ {
+ qDebug() << "VideoFileDetailsViewPlugin::createView(): Unable to open collection wrapper. Cannot connect slots, aborting...";
+ // TODO need to throw exception instead?
+ return;
+ }
+
+ mIsService = XQServiceUtil::isService();
+
+ // no deallocation needed for this since
+ // stackedwidget takes ownership
+ mTitleAnim = new HbMarqueeItem;
+ mTitleAnim->setLoopCount(-1);
+
+ connect(mModel,
+ SIGNAL(shortDetailsReady(int)),
+ this, SLOT(shortDetailsReadySlot(int)));
+
+ connect(mModel,
+ SIGNAL(fullDetailsReady(int)),
+ this, SLOT(fullDetailsReadySlot(int)));
+
+ connect(mModel,
+ SIGNAL(rowsRemoved(const QModelIndex&, int, int)),
+ this, SLOT(rowsRemovedSlot(const QModelIndex&, int, int)));
+
+ HbPushButton* playBtn = findWidget<HbPushButton>(VIDEO_DETAILS_BUTTON_PLAY);
+ 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)),
+ this, SLOT(thumbnailReadySlot(QPixmap,void*,int,int)));
+}
+
+// ---------------------------------------------------------------------------
+// Destroy view
+// ---------------------------------------------------------------------------
+//
+void VideoFileDetailsViewPlugin::destroyView()
+{
+ if (mActivated)
+ {
+ deactivateView();
+ }
+
+ if(mVideoServices)
+ {
+ mVideoServices->decreaseReferenceCount();
+ mVideoServices = 0;
+ }
+
+ if(mCollectionWrapper)
+ {
+ mCollectionWrapper->decreaseReferenceCount();
+ mCollectionWrapper = 0;
+ }
+
+ delete mSecSkAction; mSecSkAction = 0;
+ delete mThumbnailManager; mThumbnailManager = 0;
+ disconnect();
+ mView.reset();
+}
+
+// ---------------------------------------------------------------------------
+// Activate view
+// ---------------------------------------------------------------------------
+//
+void VideoFileDetailsViewPlugin::activateView()
+{
+
+ if ( !mActivated && (VideoFileDetailsViewPlugin::EFinalized == mCreated))
+ {
+ HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
+ mainWnd->addSoftKeyAction( Hb::SecondarySoftKey, mSecSkAction );
+
+ 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");
+ }
+ }
+ else if ( orientation == Qt::Horizontal )
+ {
+ if (mIsService)
+ {
+ mView.load(VIDEO_DETAILS_DOCML, "landscape_fetch");
+ }
+ else
+ {
+ mView.load(VIDEO_DETAILS_DOCML, "landscape");
+ }
+ }
+
+ if (mIsService && !mVideoServices)
+ {
+ mVideoServices = VideoServices::instance();
+
+ if (!mVideoServices)
+ {
+ 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&)));
+ }
+ }
+
+ 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&)),
+ 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->adjustSize();
+
+ mActivated = true;
+ }
+}
+
+// ---------------------------------------------------------------------------
+// Deactivate view
+// ---------------------------------------------------------------------------
+//
+void VideoFileDetailsViewPlugin::deactivateView()
+{
+ if ( mActivated )
+ {
+ mVideoIndex = -1; // set video index as invalid.
+
+ HbMainWindow *mainWnd = hbInstance->allMainWindows().value(0);
+
+ disconnect(mainWnd->softKeyAction(Hb::SecondarySoftKey),
+ SIGNAL(triggered()), this, SLOT(back()));
+
+ disconnect(mainWnd, SIGNAL( orientationChanged( Qt::Orientation ) ),
+ this, SLOT( orientationChange( Qt::Orientation ) ));
+
+ 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());
+
+ if (mIsService)
+ {
+ HbPushButton* attachBtn = findWidget<HbPushButton>(VIDEO_DETAILS_BUTTON_ATTACH);
+ disconnect(attachBtn, SIGNAL(clicked(bool)), this, SLOT(getFileUri()));
+ disconnect(this, SIGNAL(fileUri(const QString&)), mVideoServices, SLOT(itemSelected(const QString&)));
+ }
+
+ }
+}
+
+// ---------------------------------------------------------------------------
+// Get view
+// ---------------------------------------------------------------------------
+//
+QGraphicsWidget* VideoFileDetailsViewPlugin::getView()
+{
+ return mView.findWidget(VIDEO_DETAILS_VIEW);
+}
+
+// ---------------------------------------------------------------------------
+// Slot: Orientation change
+// ---------------------------------------------------------------------------
+//
+void VideoFileDetailsViewPlugin::orientationChange( Qt::Orientation orientation )
+{
+ if ( orientation == Qt::Vertical )
+ {
+ if (mIsService)
+ {
+ mView.load(VIDEO_DETAILS_DOCML, "portrait_fetch");
+ }
+ else
+ {
+ 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");
+ }
+ }
+ mTitleAnim->adjustSize();
+ mTitleAnim->startAnimation();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: back
+// ---------------------------------------------------------------------------
+//
+void VideoFileDetailsViewPlugin::back()
+{
+ if ( mActivated )
+ {
+ emit command( MpxHbVideoCommon::ActivateCollectionView );
+ }
+}
+
+// ---------------------------------------------------------------------------
+// Slot: shortDetailsReadySlot
+// ---------------------------------------------------------------------------
+//
+void VideoFileDetailsViewPlugin::shortDetailsReadySlot(int index)
+{
+ // 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());
+ }
+
+ QModelIndex modelIndex = mModel->index(index, 0);
+
+ mVideoIndex = index;
+
+ // index assumed to come from source model, so data will be fetched from there
+ QVariant variant = mModel->sourceModel()->data(modelIndex, Qt::DisplayRole);
+
+ if (variant.isValid() && mTitleAnim)
+ {
+ mTitleAnim->setText(variant.toStringList().first());
+ }
+ startFetchingThumbnail();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: fullDetailsReadySlot
+// ---------------------------------------------------------------------------
+//
+void VideoFileDetailsViewPlugin::fullDetailsReadySlot(int index)
+{
+ 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);
+ QMap<QString, QVariant> metadata = variant.toMap();
+
+ 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()));
+
+ detailAmount++;
+ heightOfVisibleItems += detail->preferredHeight();
+ }
+ }
+
+ 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();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: getFileUri
+// ---------------------------------------------------------------------------
+//
+void VideoFileDetailsViewPlugin::getFileUri()
+{
+ if (mVideoIndex >= 0)
+ {
+ QVariant variant = mModel->data(mModel->index(mVideoIndex, 0), VideoCollectionCommon::KeyFilePath);
+ if ( variant.isValid() )
+ {
+ QString itemPath = variant.value<QString>();
+ emit(fileUri(itemPath));
+ }
+ }
+}
+
+// ---------------------------------------------------------------------------
+// Slot: startPlaybackSlot
+// ---------------------------------------------------------------------------
+//
+void VideoFileDetailsViewPlugin::startPlaybackSlot()
+{
+ if (mVideoIndex >= 0) {
+ mModel->openItem(mModel->index(mVideoIndex, 0));
+ }
+}
+
+// ---------------------------------------------------------------------------
+// Slot: sendVideo
+// ---------------------------------------------------------------------------
+//
+void VideoFileDetailsViewPlugin::sendVideoSlot()
+{
+ _DebugNotImplementedYet();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: deleteVideo
+// ---------------------------------------------------------------------------
+//
+void VideoFileDetailsViewPlugin::deleteVideoSlot()
+{
+ if (mVideoIndex > -1)
+ {
+ QModelIndex modelIndex = mModel->index(mVideoIndex, 0);
+ QVariant variant = mModel->data(modelIndex, Qt::DisplayRole);
+
+ if (variant.isValid()) {
+ QString text = tr("Do you want to delete \"%1\"?").arg(variant.toStringList().first());
+
+ if (HbMessageBox::question(text)){
+ deleteItem(modelIndex);
+ }
+ }
+ }
+}
+
+// ---------------------------------------------------------------------------
+// deleteItem
+// ---------------------------------------------------------------------------
+//
+void VideoFileDetailsViewPlugin::deleteItem(QModelIndex index)
+{
+ QModelIndexList list;
+ list.append(index);
+ mModel->deleteItems(list);
+}
+
+
+// ---------------------------------------------------------------------------
+// Slot: rowsRemovedSlot
+// ---------------------------------------------------------------------------
+//
+void VideoFileDetailsViewPlugin::rowsRemovedSlot(const QModelIndex& /*parent*/,
+ int first, int last)
+{
+ if(mActivated && mVideoIndex > -1 &&
+ (mVideoIndex >= first && mVideoIndex <= last))
+ {
+ // item is withing the group of removed items, deactivate view
+ emit command(MpxHbVideoCommon::ActivateCollectionView);
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// Slot: handleErrorSlot()
+// error signal received from collectionwrapper
+// -------------------------------------------------------------------------------------------------
+//
+void VideoFileDetailsViewPlugin::handleErrorSlot(int errorCode, QVariant &additional)
+{
+ QString msg("");
+ if(errorCode == VideoCollectionCommon::statusSingleDeleteFail)
+ {
+ QString format = tr("Unable to delete item %1. It is currently open.");
+ if(additional.isValid())
+ {
+ msg = format.arg(additional.toString());
+ }
+ }
+ if(msg.count() > 0)
+ {
+ // show msg box if there's something to show
+ HbMessageBox::warning(msg);
+ }
+}
+
+// ---------------------------------------------------------------------------
+// Slot: thumbnailReadySlot
+// ---------------------------------------------------------------------------
+//
+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());
+ QImage play(VIDEO_DETAILS_GFX_PLAY);
+
+ if (!errorCode) {
+
+ QImage sourceImage = pixmap.toImage();
+
+ 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(size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
+ }
+
+ 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,
+ play );
+ painter.setCompositionMode(QPainter::CompositionMode_Screen);
+ painter.drawImage(0, 0, sourceImage);
+ painter.end();
+
+ HbIcon compsedIcon(QPixmap::fromImage(resultImage));
+ playBtn->setIcon(compsedIcon);
+ }
+ else {
+ playBtn->setIcon(HbIcon(VIDEO_DETAILS_GFX_DEFAULT));
+ }
+}
+
+// ---------------------------------------------------------------------------
+// startFetchingThumbnail
+// ---------------------------------------------------------------------------
+//
+void VideoFileDetailsViewPlugin::startFetchingThumbnail()
+{
+ int tnId = -1;
+
+ if(mModel && mThumbnailManager) {
+ QVariant variant = mModel->data(mModel->index(mVideoIndex, 0), VideoCollectionCommon::KeyFilePath);
+ if(variant.isValid()) {
+ mThumbnailManager->setThumbnailSize(ThumbnailManager::ThumbnailLarge);
+ tnId = mThumbnailManager->getThumbnail(variant.toString(), 0, 5000);
+ }
+ } else {
+ qWarning() << "Tried to start fetching thumbnail when either mModel or mThumbnailManager is NULL!";
+ }
+
+ if(tnId == -1) {
+ // TODO set default thumbnail here
+ }
+}
+
+// ---------------------------------------------------------------------------
+// findWidget
+// ---------------------------------------------------------------------------
+//
+template<class T>
+T* VideoFileDetailsViewPlugin::findWidget(QString name)
+{
+ return qobject_cast<T *>(mView.findWidget(name));
+}
+
+// ---------------------------------------------------------------------------
+// findObject
+// ---------------------------------------------------------------------------
+//
+template<class T>
+T* VideoFileDetailsViewPlugin::findObject(QString name)
+{
+ return qobject_cast<T *>(mView.findObject(name));
+}
+
+XQ_EXPORT_PLUGIN2( videofiledetailsview, VideoFileDetailsViewPlugin );
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videofiledetailsview/tsrc/testplugin/src/testvideofiledetails.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,827 @@
+/*
+* 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 implementation
+*
+*/
+
+// INCLUDE FILES
+#include "hbmessagebox.h"
+
+#include <QtTest/QtTest>
+#include <qdebug.h>
+#include <hbinstance.h>
+#include <hbwidget.h>
+#include <hbpushbutton.h>
+#include <hblabel.h>
+#include <hbaction.h>
+#include <hbapplication.h>
+#include <hbscrollarea.h>
+#include <hbmarqueeitem.h>
+
+#include "hbmessagebox.h"
+#include "thumbnailmanager_qt.h"
+#include "videocollectioncommon.h"
+#include "mpxhbvideocommondefs.h"
+#include "videocollectionwrapper.h"
+#include "videosortfilterproxymodel.h"
+#include "testvideofiledetails.h"
+
+// trick to get access to protected/private members.
+#define private public
+#include "videofiledetailsviewplugin.h"
+#undef private
+
+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_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(dataChanged(const QModelIndex&, const QModelIndex&)),
+ mDummyModel, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)));
+
+ connect(this, SIGNAL(rowsRemoved(const QModelIndex&, int, int)),
+ mDummyModel, SIGNAL(rowsRemoved(const QModelIndex&, int, int)));
+
+ mWrapper->setModel(mDummyModel);
+}
+
+// ---------------------------------------------------------------------------
+// cleanupTestCase
+// ---------------------------------------------------------------------------
+//
+void TestVideoFileDetails::cleanupTestCase()
+{
+ disconnect(this, SIGNAL(shortDetailsReady(int)), mDummyModel, SIGNAL(shortDetailsReady(int)));
+ disconnect(this, SIGNAL(fullDetailsReady(int)),mDummyModel, SIGNAL(fullDetailsReady(int)));
+ disconnect(this, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)),
+ mDummyModel, SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)));
+ disconnect(this, SIGNAL(rowsRemoved(const QModelIndex&, int, int)),
+ mDummyModel, SIGNAL(rowsRemoved(const QModelIndex&, int, int)));
+ delete mDummyModel; mDummyModel = 0;
+ delete mPlugin; mPlugin = 0;
+ mWrapper->decreaseReferenceCount();
+ QCOMPARE(mWrapper->mReferenceCount, 0);
+}
+
+// ---------------------------------------------------------------------------
+// init before every test function
+// ---------------------------------------------------------------------------
+//
+void TestVideoFileDetails::init()
+{
+ mDummyModel->reset();
+
+ mPlugin = new VideoFileDetailsViewPlugin();
+ mPlugin->createView();
+ mPlugin->createView();
+ mCommandReceived = false;
+ mReceivedCommand = -1;
+ ThumbnailManager::mRequests.clear();
+}
+
+// ---------------------------------------------------------------------------
+// cleanup after every test function
+// ---------------------------------------------------------------------------
+//
+void TestVideoFileDetails::cleanup()
+{
+ if(mPlugin->getView()) {
+ hbInstance->allMainWindows().at(0)->removeView(mPlugin->getView());
+ }
+ mDummyModel->reset();
+ delete mPlugin; mPlugin = 0;
+}
+
+// ---------------------------------------------------------------------------
+// Helper function that activates view after init()
+// ---------------------------------------------------------------------------
+//
+void TestVideoFileDetails::activateView()
+{
+ hbInstance->allMainWindows().at(0)->addView(mPlugin->getView());
+ mPlugin->activateView();
+
+ // without this the xml loaded objects don't have the correct geometry.
+ mPlugin->getView()->setGeometry(hbInstance->allMainWindows().at(0)->rect());
+}
+
+// ---------------------------------------------------------------------------
+// Helper function that populates a qmap with dummy data.
+// ---------------------------------------------------------------------------
+//
+QMap<QString, QVariant> TestVideoFileDetails::createDummyMetadata(int ratingStartCount)
+{
+ using namespace VideoCollectionCommon;
+
+ QMap<QString, QVariant> map;
+
+ int detailCount = sizeof(VideoDetailLabelKeys) / sizeof(int);
+ QString txt;
+ for(int i = 0; i<detailCount; i++) {
+ txt = QString(VideoDetailLabelKeys[i]);
+ if(i%2 == 0)
+ {
+ map[VideoDetailLabelKeys[i]] = txt;
+ }
+ else
+ {
+ txt.append(QString("test test test test test test test test test test test test test test test test test test test"));
+ map[VideoDetailLabelKeys[i]] = txt;
+ }
+ }
+ if(ratingStartCount > -1)
+ {
+ map[MetaKeyStarRating] = ratingStartCount;
+ }
+ return map;
+}
+
+// ---------------------------------------------------------------------------
+// One round for the activate view test
+// ---------------------------------------------------------------------------
+//
+inline void TestVideoFileDetails::activateViewTestRound()
+ {
+ 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();
+
+ // verify that actions are currently disabled.
+ HbPushButton* playBtn = findWidget<HbPushButton>(TEST_VIDEO_DETAILS_BUTTON_PLAY);
+ HbAction* shareAction = findObject<HbAction>(TEST_VIDEO_DETAILS_MENUACTION_SHARE);
+ HbAction* deleteAction = findObject<HbAction>(TEST_VIDEO_DETAILS_MENUACTION_DELETE);
+
+ QVERIFY( playBtn != 0 );
+ QVERIFY( shareAction != 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( 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
+// ---------------------------------------------------------------------------
+//
+void TestVideoFileDetails::handleCommand(int command)
+{
+ mCommandReceived = true;
+ mReceivedCommand = command;
+}
+
+// ---------------------------------------------------------------------------
+// Slot: create view
+// ---------------------------------------------------------------------------
+//
+void TestVideoFileDetails::testCreateView()
+{
+ init();
+ // actual create view is done in the init.
+ QVERIFY( mPlugin->mModel == mDummyModel );
+ QVERIFY( mPlugin->mIsService == false);
+ QVERIFY( mPlugin->mVideoServices == 0);
+ // testing the special case where the model is null.
+ cleanup();
+ mWrapper->setModel(0);
+ init();
+ QVERIFY( mPlugin->mModel == 0 );
+ QVERIFY( mPlugin->mIsService == false);
+ QVERIFY( mPlugin->mVideoServices == 0);
+ // TODO if the plugin is changed to throw exception in case of null model,
+ // then it needs to be added here.
+
+ // restoring the proper model.
+ mWrapper->setModel(mDummyModel);
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: destroy view
+// ---------------------------------------------------------------------------
+//
+void TestVideoFileDetails::testDestroyView()
+{
+ init();
+ activateView();
+ mPlugin->destroyView();
+ QVERIFY( mPlugin->getView() == 0 );
+ // plugin is still alive
+ QVERIFY( mPlugin->viewPlugin() == mPlugin );
+ QVERIFY( mPlugin->mSecSkAction == 0 );
+ QVERIFY( mPlugin->mActivated == false );
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: activate view
+// ---------------------------------------------------------------------------
+//
+void TestVideoFileDetails::testActivateViewPortrait()
+{
+ hbInstance->allMainWindows().at(0)->setOrientation(Qt::Vertical);
+ activateViewTestRound();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: activate view
+// ---------------------------------------------------------------------------
+//
+void TestVideoFileDetails::testActivateViewLandscape()
+{
+ hbInstance->allMainWindows().at(0)->setOrientation(Qt::Horizontal);
+ activateViewTestRound();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: activate view
+// ---------------------------------------------------------------------------
+//
+void TestVideoFileDetails::testDeactivateView()
+{
+ init();
+ activateView();
+ mPlugin->deactivateView();
+ QVERIFY( mPlugin->mActivated == false );
+ QCOMPARE( mPlugin->mVideoIndex, -1 );
+ mPlugin->deactivateView();
+ QVERIFY( mPlugin->mActivated == false );
+ QCOMPARE( mPlugin->mVideoIndex, -1 );
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: data for orientation change test
+// ---------------------------------------------------------------------------
+//
+void TestVideoFileDetails::testOrientationChange_data()
+{
+ QTest::addColumn<int>("start");
+ QTest::addColumn<int>("switchTo");
+
+ QTest::newRow("from portrait to landscape")
+ << static_cast<int>(Qt::Vertical)
+ << static_cast<int>(Qt::Horizontal);
+ QTest::newRow("from landscape to portrait")
+ << static_cast<int>(Qt::Horizontal)
+ << static_cast<int>(Qt::Vertical);
+}
+
+// ---------------------------------------------------------------------------
+// Slot: test for the orientationChange slot
+// ---------------------------------------------------------------------------
+//
+void TestVideoFileDetails::testOrientationChange()
+{
+ QFETCH(int, start);
+ QFETCH(int, switchTo);
+
+ init();
+ hbInstance->allMainWindows().at(0)->setOrientation(static_cast<Qt::Orientation>(start));
+ activateView();
+
+ hbInstance->allMainWindows().at(0)->setOrientation(static_cast<Qt::Orientation>(switchTo));
+
+ // without this the view doesn't have the correct geometry.
+ mPlugin->getView()->setGeometry(hbInstance->allMainWindows().at(0)->rect());
+ // give fw some time to update content
+ QTest::qWait(100);
+
+ verifyOrientation();
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: test for the back slot
+// ---------------------------------------------------------------------------
+//
+void TestVideoFileDetails::testBack()
+{
+ init();
+ connect(this, SIGNAL(testSignal()), mPlugin, SLOT(back()));
+ connect(mPlugin, SIGNAL(command(int)), this, SLOT(handleCommand(int)));
+
+ emit testSignal();
+ QCOMPARE( mCommandReceived, false );
+ QCOMPARE( mReceivedCommand, -1 );
+
+ mPlugin->mSecSkAction->trigger();
+ QCOMPARE( mCommandReceived, false );
+ QCOMPARE( mReceivedCommand, -1 );
+
+ activateView();
+
+ emit testSignal();
+ QCOMPARE( mCommandReceived, true );
+ QCOMPARE( mReceivedCommand, static_cast<int>(MpxHbVideoCommon::ActivateCollectionView) );
+
+ mCommandReceived = false;
+ mReceivedCommand = -1;
+
+ mPlugin->mSecSkAction->trigger();
+ QCOMPARE( mCommandReceived, true );
+ QCOMPARE( mReceivedCommand, static_cast<int>(MpxHbVideoCommon::ActivateCollectionView) );
+
+ mCommandReceived = false;
+ mReceivedCommand = -1;
+
+ mPlugin->deactivateView();
+
+ emit testSignal();
+ QCOMPARE( mCommandReceived, false );
+ QCOMPARE( mReceivedCommand, -1 );
+
+ mPlugin->mSecSkAction->trigger();
+ QCOMPARE( mCommandReceived, false );
+ QCOMPARE( mReceivedCommand, -1 );
+
+ disconnect(mPlugin, SIGNAL(command(int)), this, SLOT(handleCommand(int)));
+ disconnect(this, SIGNAL(testSignal()), mPlugin, SLOT(back()));
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: test for the shortDetailsReadySlot
+// ---------------------------------------------------------------------------
+//
+void TestVideoFileDetails::testShortDetailsReadySlot()
+{
+ const int testIndex = 5;
+ QStringList display;
+ display.append("first row");
+ display.append("second row");
+ QString filepath("filepath");
+
+ // TODO need to add the default thumbnail checking.
+
+ init();
+ activateView();
+
+ // no data
+ emit shortDetailsReady(testIndex);
+
+ QCOMPARE( mPlugin->mVideoIndex, 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);
+
+ // no tn manager
+ ThumbnailManager *tmpTnManager = mPlugin->mThumbnailManager;
+ mPlugin->mThumbnailManager = 0;
+ emit shortDetailsReady(testIndex);
+ QCOMPARE( mPlugin->mVideoIndex, 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->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() );
+ }
+
+ QVERIFY( findWidget<HbPushButton>(TEST_VIDEO_DETAILS_BUTTON_PLAY)->icon().isNull() );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: test for the fullDetailsReadySlot
+// ---------------------------------------------------------------------------
+//
+void TestVideoFileDetails::testFullDetailsReadySlot()
+{
+ const int testIndex = 6;
+ 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());
+ }
+ }
+
+ 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);
+ HbAction* deleteAction = findObject<HbAction>(TEST_VIDEO_DETAILS_MENUACTION_DELETE);
+
+ QVERIFY( playBtn != 0 );
+ QVERIFY( shareAction != 0 );
+ QVERIFY( deleteAction != 0 );
+ QVERIFY( playBtn->isEnabled() );
+ QVERIFY( shareAction->isEnabled() );
+ QVERIFY( deleteAction->isEnabled() );
+
+ 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));
+ QVERIFY( detail != 0 );
+ QVERIFY( detail->text().contains(expected) );
+ }
+
+ // for coverity sake, retest without star-rating
+ mDummyModel->reset();
+ mDummyModel->setData(VideoCollectionCommon::KeyMetaData, createDummyMetadata(1) );
+ emit fullDetailsReady(testIndex);
+ 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));
+ QVERIFY( detail != 0 );
+ QVERIFY( detail->text().contains(expected) );
+ }
+ }
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: test for the testStartPlaybackSlot
+// ---------------------------------------------------------------------------
+//
+void TestVideoFileDetails::testStartPlaybackSlot()
+{
+ const int testIndex = 6;
+ mDummyModel->reset();
+ init();
+ activateView();
+
+ // 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();
+
+ QCOMPARE( mDummyModel->startPlaybackIndex(), -1 );
+
+ emit fullDetailsReady(testIndex);
+ mPlugin->mVideoIndex = testIndex;
+
+ playBtn->click();
+
+ QCOMPARE( mDummyModel->startPlaybackIndex(), testIndex );
+
+ // invalid index
+ mPlugin->mVideoIndex = -1;
+ playBtn->click();
+ // startplayback index has not changed since previous
+ QCOMPARE( mDummyModel->startPlaybackIndex(), testIndex );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: test for the sendVideoSlot
+// ---------------------------------------------------------------------------
+//
+void TestVideoFileDetails::testSendVideoSlot()
+{
+ // TODO add test after send video has been implemented.
+}
+
+// ---------------------------------------------------------------------------
+// Slot: test for the deleteVideoSlot
+// ---------------------------------------------------------------------------
+//
+void TestVideoFileDetails::testDeleteVideoSlot()
+{
+ mDummyModel->reset();
+ init();
+
+ HbAction* deleteAction = findObject<HbAction>(TEST_VIDEO_DETAILS_MENUACTION_DELETE);
+
+ QVERIFY( deleteAction != 0 );
+ deleteAction->trigger();
+ QCOMPARE( mDummyModel->dataAccessCount(), 0 );
+ mPlugin->mVideoIndex = 0;
+
+ mDummyModel->setDataReturnInvalid(true);
+ QModelIndex expected = mDummyModel->index(0, 0);
+ deleteAction->trigger();
+ QCOMPARE( mDummyModel->dataAccessCount(), 1 );
+ QVERIFY( mDummyModel->lastIndex() == expected );
+ QCOMPARE( mDummyModel->deleteFileIndex(), -1 ); // verify that no file was deleted.
+ mDummyModel->setDataReturnInvalid(false);
+
+ mPlugin->mVideoIndex = 0;
+ expected = mDummyModel->index(0, 0);
+ deleteAction->trigger();
+ QCOMPARE( mDummyModel->dataAccessCount(), 2 );
+ QVERIFY( mDummyModel->lastIndex() == expected );
+ QCOMPARE( mDummyModel->deleteFileIndex(), -1 ); // verify that no file was deleted.
+
+ QStringList display;
+ display.append("first row");
+ display.append("second row");
+ mDummyModel->setData(Qt::DisplayRole, display);
+
+ QString expectedText = tr("Do you want to delete \"%1\"?").arg(
+ display.at(0));
+
+ HbMessageBox::mQuestionReturnValue = true;
+ deleteAction->trigger();
+ QCOMPARE( mDummyModel->dataAccessCount(), 3 );
+ QVERIFY( mDummyModel->lastIndex() == expected );
+ QCOMPARE( mDummyModel->deleteFileIndex(), expected.row() );
+ QCOMPARE( HbMessageBox::mLatestTxt, expectedText );
+
+ HbMessageBox::mQuestionReturnValue = false;
+ deleteAction->trigger();
+ QCOMPARE( mDummyModel->dataAccessCount(), 4 );
+ QVERIFY( mDummyModel->lastIndex() == expected );
+ QCOMPARE( mDummyModel->deleteFileIndex(), expected.row() );
+ QCOMPARE( HbMessageBox::mLatestTxt, expectedText );
+
+
+ mDummyModel->reset();
+ HbMessageBox::mQuestionReturnValue = false;
+ deleteAction->trigger();
+ QCOMPARE( mDummyModel->dataAccessCount(), 1 );
+ QVERIFY( mDummyModel->lastIndex() == expected );
+ QCOMPARE( mDummyModel->deleteFileIndex(), -1 ); // verify that no file was deleted.
+ QCOMPARE( HbMessageBox::mLatestTxt, expectedText );
+
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: test for the testRowsRemovedSlot
+// ---------------------------------------------------------------------------
+//
+void TestVideoFileDetails::testRowsRemovedSlot()
+{
+ const int testIndex = 9;
+ init();
+ connect(mPlugin, SIGNAL(command(int)), this, SLOT(handleCommand(int)));
+
+ emit rowsRemoved(QModelIndex(), testIndex, testIndex);
+ QCOMPARE( mCommandReceived, false );
+ QCOMPARE( mReceivedCommand, -1 );
+
+ activateView();
+
+ emit rowsRemoved(QModelIndex(), testIndex, testIndex);
+ QCOMPARE( mCommandReceived, false );
+ QCOMPARE( mReceivedCommand, -1 );
+
+ emit fullDetailsReady(testIndex);
+ mPlugin->mVideoIndex = testIndex;
+
+ emit rowsRemoved(QModelIndex(), testIndex+1, testIndex-1);
+ QCOMPARE( mCommandReceived, false );
+ QCOMPARE( mReceivedCommand, -1 );
+
+ emit rowsRemoved(QModelIndex(), testIndex-3, testIndex-1);
+ QCOMPARE( mCommandReceived, false );
+ QCOMPARE( mReceivedCommand, -1 );
+
+ emit rowsRemoved(QModelIndex(), testIndex+1, testIndex+3);
+ QCOMPARE( mCommandReceived, false );
+ QCOMPARE( mReceivedCommand, -1 );
+
+ emit rowsRemoved(QModelIndex(), testIndex, testIndex);
+ QCOMPARE( mCommandReceived, true );
+ QCOMPARE( mReceivedCommand, static_cast<int>(MpxHbVideoCommon::ActivateCollectionView) );
+
+ disconnect(mPlugin, SIGNAL(command(int)), this, SLOT(handleCommand(int)));
+ cleanup();
+}
+
+// ---------------------------------------------------------------------------
+// Slot: testHandleErrorSlot test error messages
+// ---------------------------------------------------------------------------
+//
+void TestVideoFileDetails::testHandleErrorSlot()
+{
+ init();
+ connect(this, SIGNAL(testErrorSignal(int, QVariant&)), mPlugin, SLOT(handleErrorSlot(int, QVariant&)));
+
+ HbMessageBox::mLatestTxt = "";
+ QVariant additional = QVariant();
+ // invalid msg,
+ emit testErrorSignal( VideoCollectionCommon::statusMultipleDeleteFail + 1, additional);
+
+ QVERIFY(HbMessageBox::mLatestTxt.isEmpty());
+
+ // VideoCollectionCommon::statusSingleDeleteFail
+ // - without additional data
+ emit testErrorSignal( VideoCollectionCommon::statusSingleDeleteFail , additional);
+ QVERIFY(HbMessageBox::mLatestTxt.isEmpty());
+
+ // - with additional data
+ QString txt = "testdata";
+ additional = txt;
+ emit testErrorSignal( VideoCollectionCommon::statusSingleDeleteFail , additional);
+ QCOMPARE(HbMessageBox::mLatestTxt, QString("Unable to delete item %1. It is currently open.").arg(txt));
+
+ HbMessageBox::mLatestTxt = "";
+ // VideoCollectionCommon::statusMultipleDeleteFail
+ emit testErrorSignal( VideoCollectionCommon::statusMultipleDeleteFail , additional);
+ QVERIFY(HbMessageBox::mLatestTxt.isEmpty());
+
+ disconnect(this, SIGNAL(testErrorSignal(int, QVariant&)), mPlugin, SLOT(handleErrorSlot(int, QVariant&)));
+
+ cleanup();
+}
+
+
+// ---------------------------------------------------------------------------
+// Slot: test for the testThumbnailReadySlot
+// ---------------------------------------------------------------------------
+//
+void TestVideoFileDetails::testThumbnailReadySlot()
+{
+ int testIndex = 9;
+ QStringList display;
+ display.append("first row");
+ display.append("second row");
+ QString filepath("filepath");
+
+ init();
+ activateView();
+
+ mDummyModel->setData(Qt::DisplayRole, display);
+ mDummyModel->setData(VideoCollectionCommon::KeyFilePath, filepath);
+
+ emit shortDetailsReady(testIndex);
+
+ mPlugin->mThumbnailManager->mThumbnailReadyError = -1;
+ mPlugin->mThumbnailManager->emitThumbnailReady(0);
+
+ QVERIFY( findWidget<HbPushButton>(TEST_VIDEO_DETAILS_BUTTON_PLAY)->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 );
+
+ cleanup();
+}
+
+
+// ---------------------------------------------------------------------------
+// findWidget
+// ---------------------------------------------------------------------------
+//
+template<class T>
+T* TestVideoFileDetails::findWidget(QString name)
+{
+ return qobject_cast<T *>(mPlugin->mView.findWidget(name));
+}
+
+// ---------------------------------------------------------------------------
+// findObject
+// ---------------------------------------------------------------------------
+//
+template<class T>
+T* TestVideoFileDetails::findObject(QString name)
+{
+ return qobject_cast<T *>(mPlugin->mView.findObject(name));
+}
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ HbApplication app(argc, argv);
+ HbApplication::setKeypadNavigationEnabled(false);
+ HbMainWindow mainWindow;
+ mainWindow.show();
+
+ TestVideoFileDetails tc;
+
+ char *pass[3];
+ pass[0] = argv[0];
+ pass[1] = "-o";
+ pass[2] = "c:\\data\\testvideofiledetailsviewplugin.txt";
+
+ return QTest::qExec(&tc, 3, pass);
+}
+
+// end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videofiledetailsview/tsrc/testplugin/stub/inc/hbmessagebox.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* 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 HbMessageBox class declaration.
+*
+*/
+
+
+#ifndef HBMESSAGEBOX_H
+#define HBMESSAGEBOX_H
+
+#include <QString>
+
+
+class HbMessageBox
+{
+
+public:
+
+ /**
+ * saves provided text to mLatestTxt
+ * returns mQuestionReturnValue
+ */
+ static bool question(QString text)
+ {
+ mLatestTxt = text;
+ return mQuestionReturnValue;
+ }
+
+ /**
+ * saves provided text to mLatestTxt
+ */
+ static void warning(QString text)
+ {
+ mLatestTxt = text;
+ }
+
+ /**
+ * saves provided text to mLatestTxt
+ */
+ static void information(QString text)
+ {
+ mLatestTxt = text;
+ }
+
+ /**
+ * returned from question
+ */
+ static bool mQuestionReturnValue;
+
+ /**
+ * saved text
+ */
+ static QString mLatestTxt;
+
+};
+
+
+
+#endif // HBMESSAGEBOX_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videofiledetailsview/tsrc/testplugin/stub/inc/videoservices.h Thu Apr 01 22:38:49 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: ?Description
+*
+*/
+
+#ifndef __VIDEOSERVICES_H__
+#define __VIDEOSERVICES_H__
+
+#include <QStringList>
+#include "videoserviceurifetch.h"
+
+//FORWARD CLASS DECLARATION
+class VideoServiceUriFetch;
+
+class VideoServices : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * 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 VideoServices *instance();
+
+ /**
+ * Decreases the reference count, when count reaches zero cleanup is done.
+ *
+ */
+ void decreaseReferenceCount();
+
+ enum TVideoService
+ {
+ ENoService,
+ EUriFetcher,
+ EPlayback
+ };
+
+ /**
+ * Returns service active status
+ *
+ * @return bool true if active, false if not active
+ *
+ */
+ VideoServices::TVideoService currentService();
+
+private:
+
+ /**
+ * Constructor
+ */
+ VideoServices();
+
+ /**
+ * Destructor.
+ */
+ virtual ~VideoServices();
+
+ void setCurrentService(VideoServices::TVideoService service);
+
+ Q_DISABLE_COPY(VideoServices)
+
+private:
+
+ /**
+ * Singleton instance.
+ */
+ static VideoServices* mInstance;
+
+ VideoServiceUriFetch* mServiceUriFetch;
+
+ VideoServices::TVideoService mCurrentService;
+
+ friend class VideoServiceUriFetch;
+
+public:
+
+ /**
+ * Reference count.
+ */
+ static int mReferenceCount;
+
+};
+
+#endif //__VIDEOSERVICES_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videofiledetailsview/tsrc/testplugin/stub/inc/videoserviceurifetch.h Thu Apr 01 22:38:49 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: VideoServiceUriFetch class definition
+*
+*/
+
+#ifndef __VIDEOSERVICESURIFETCH_H__
+#define __VIDEOSERVICESURIFETCH_H__
+
+//INCLUDES
+#include <QStringList>
+
+// FORWARD DECLARATIONS
+class VideoServices;
+
+class VideoServiceUriFetch : public QObject
+{
+
+ /**
+ * define to be able to use signals and slots
+ */
+ Q_OBJECT
+
+public:
+
+ /**
+ * contructor
+ */
+ VideoServiceUriFetch( VideoServices *parent = 0 );
+
+ /**
+ * destructor
+ */
+ ~VideoServiceUriFetch();
+
+public slots: // for QTHighway to notify provider about request
+ /*
+ * Client can use this method launch video URI fetching
+ *
+ * @param title title to be set
+ *
+ */
+ void fetch(const QString& title);
+
+private:
+ VideoServices* mServiceApp;
+};
+
+#endif //__VIDEOSERVICESURIFETCH_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videofiledetailsview/tsrc/testplugin/stub/src/hbmessagebox.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,26 @@
+/*
+* 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 "hbmessagebox.h"
+
+bool HbMessageBox::mQuestionReturnValue = false;
+
+QString HbMessageBox::mLatestTxt = "";
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videofiledetailsview/tsrc/testplugin/stub/src/videoservices.cpp Thu Apr 01 22:38:49 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: ?Description
+*
+*/
+
+#include <videoservices.h>
+#include <videoserviceurifetch.h>
+
+
+VideoServices *VideoServices::mInstance = 0;
+int VideoServices::mReferenceCount = 0;
+
+// -----------------------------------------------------------------------------
+// VideoServices::instance()
+// -----------------------------------------------------------------------------
+//
+VideoServices* VideoServices::instance()
+{
+ if(!mInstance)
+ {
+ mInstance = new VideoServices();
+ }
+ mInstance->mReferenceCount++;
+ return mInstance;
+}
+
+// -----------------------------------------------------------------------------
+// VideoServices::decreaseReferenceCount()
+// -----------------------------------------------------------------------------
+//
+void VideoServices::decreaseReferenceCount()
+{
+ if(mInstance)
+ {
+ if(--mInstance->mReferenceCount == 0)
+ {
+ delete mInstance;
+ mInstance = NULL;
+ }
+ }
+}
+
+
+// ----------------------------------------------------------------------------
+// VideoServices()
+// ----------------------------------------------------------------------------
+//
+VideoServices::VideoServices() :
+mCurrentService(VideoServices::ENoService)
+{
+ mServiceUriFetch = new VideoServiceUriFetch(this);
+}
+
+// ----------------------------------------------------------------------------
+// ~VideoServices()
+// ----------------------------------------------------------------------------
+//
+VideoServices::~VideoServices()
+{
+ delete mServiceUriFetch;
+}
+
+
+// ----------------------------------------------------------------------------
+// currentService()
+// ----------------------------------------------------------------------------
+//
+VideoServices::TVideoService VideoServices::currentService()
+{
+ return mCurrentService;
+}
+
+
+// ----------------------------------------------------------------------------
+// setCurrentService()
+// ----------------------------------------------------------------------------
+//
+void VideoServices::setCurrentService(VideoServices::TVideoService service)
+{
+ mCurrentService = service;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videofiledetailsview/tsrc/testplugin/stub/src/videoserviceurifetch.cpp Thu Apr 01 22:38:49 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: ?Description
+*
+*/
+
+#include <videoservices.h>
+#include <videoserviceurifetch.h>
+
+
+// ----------------------------------------------------------------------------
+// VideoServiceUriFetch()
+// ----------------------------------------------------------------------------
+//
+VideoServiceUriFetch::VideoServiceUriFetch(VideoServices* parent)
+{
+ mServiceApp = parent;
+}
+
+// ----------------------------------------------------------------------------
+// ~VideoServiceUriFetch()
+// ----------------------------------------------------------------------------
+//
+VideoServiceUriFetch::~VideoServiceUriFetch()
+{
+
+}
+
+// ----------------------------------------------------------------------------
+// fetch()
+// ----------------------------------------------------------------------------
+//
+void VideoServiceUriFetch::fetch(const QString& title)
+{
+ mServiceApp->setCurrentService(VideoServices::EUriFetcher);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videofiledetailsview/tsrc/testplugin/testvideofiledetailsviewplugin.pro Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,75 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+TARGET = testvideofiledetailsviewplugin
+TEMPLATE = app
+
+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 \
+ ../../../inc \
+ ../../../videocollectionwrapper/inc
+
+
+CONFIG += qtestlib \
+ Hb \
+ symbian_test
+
+LIBS += -lestor.dll \
+ -lfbscli.dll \
+ -lbitgdi.dll \
+ -lgdi.dll \
+ -lxqplugins.dll \
+ -lmpxviewframeworkqt.dll \
+ -lxqserviceutil.dll \
+
+# Input
+HEADERS += inc/testvideofiledetails.h \
+ stub/inc/videocollectionwrapper.h \
+ stub/inc/videosortfilterproxymodel.h \
+ stub/inc/hbmessagebox.h \
+ stub/inc/thumbnailmanager_qt.h \
+ stub/inc/videoservices.h \
+ stub/inc/videoserviceurifetch.h \
+ ../../inc/videofiledetailsviewplugin.h
+
+SOURCES += src/testvideofiledetails.cpp \
+ stub/src/videocollectionwrapper.cpp \
+ stub/src/videosortfilterproxymodel.cpp \
+ stub/src/hbmessagebox.cpp \
+ stub/src/thumbnailmanager_qt.cpp \
+ stub/src/videoservices.cpp \
+ stub/src/videoserviceurifetch.cpp \
+ ../../src/videofiledetailsviewplugin.cpp
+
+RESOURCES += ../../data/videofiledetails.qrc
+TARGET.CAPABILITY = All \
+ -Tcb
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videocollection/videofiledetailsview/videofiledetailsview.pro Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,69 @@
+#
+# 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 = lib
+CONFIG += hb \
+ qt \
+ ecomplugin
+
+
+symbian: {
+ TARGET.UID2 = 0x10009D8D
+ TARGET.UID3 = 0x200211FF
+
+ BLD_INF_RULES.prj_exports += "rom/videofiledetailsview.iby CORE_APP_LAYER_IBY_EXPORT_PATH(videofiledetailsview.iby)"
+
+ TARGET.CAPABILITY = ALL -TCB -DRM
+
+ TARGET.EPOCALLOWDLLDATA = 1
+}
+
+# mpx view plugin definitions:
+# plugin interface name
+SERVICE.INTERFACE_NAME = org.nokia.mmdt.QViewPlugin/1.0
+
+# opaque data for resolving the correct plugin
+SERVICE.CONFIGURATION = "<t>0x20021200</t><p></p><i>EMPXViewPluginPriorityNormal</i><f>0x00000001</f>"
+
+DEPENDPATH += .
+
+INCLUDEPATH += .
+
+INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
+
+INCLUDEPATH += $$OS_LAYER_STDCPP_SYSTEMINCLUDE \
+ ../../videoplayerapp/videoplayerengine/inc \
+ ../../videoplayerapp/inc \
+ /epoc32/include/mw/hb/hbtools \
+ /epoc32/include/mw
+
+INCLUDEPATH += ../../inc \
+ ../inc \
+ ../videocollectionwrapper/inc
+
+# Input
+HEADERS += inc/videofiledetailsviewplugin.h \
+
+SOURCES += src/videofiledetailsviewplugin.cpp
+
+LIBS += -lmpxviewframeworkqt.dll \
+ -lvideocollectionwrapper.dll \
+ -lthumbnailmanagerqt.dll \
+ -lmediaclientvideodisplay.dll \
+ -lxqserviceutil.dll \
+ -lvideoplayerengine.dll
+
+RESOURCES += data/videofiledetails.qrc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/controlinc/mpxvideoplaybackfiledetailswidget.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* 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 QMPXVideoPlaybackFileDetailsWidget
+*
+*/
+
+// Version : %version: 5 %
+
+
+
+#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 initialize();
+
+ public:
+ void updateWithFileDetails( QMPXVideoPlaybackViewFileDetails* details );
+
+ private:
+ QString valueToReadableFormat( int value );
+
+ void makeTitleItem( QMPXVideoPlaybackViewFileDetails* details );
+ void makeSizeItem( QMPXVideoPlaybackViewFileDetails* details );
+ void makeBitRateItem( QMPXVideoPlaybackViewFileDetails* details );
+ void addItemToListWidget( QString item, QString text );
+
+ private:
+ QMPXVideoPlaybackControlsController *mController;
+ HbListWidget *mListWidget;
+ bool mFileDetailsUpdated;
+};
+
+#endif /*MPXVIDEOPLAYBACKFILEDETAILSWIDGET_H_*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/controlinc/mpxvideoplaybackstatuspanecontrol.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* 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 QMPXVideoPlaybackStatusPaneControl
+*
+*/
+
+// Version : %version: 8 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKSTATUSPANECONTROL_H_
+#define MPXVIDEOPLAYBACKSTATUSPANECONTROL_H_
+
+
+#include "mpxvideoplaybackfullscreencontrol.h"
+
+
+class HbLabel;
+class HbAction;
+class QMPXVideoPlaybackViewFileDetails;
+class QMPXVideoPlaybackControlsController;
+
+class QMPXVideoPlaybackStatusPaneControl : public QMPXVideoPlaybackFullScreenControl
+{
+ Q_OBJECT
+
+ public:
+ QMPXVideoPlaybackStatusPaneControl( QMPXVideoPlaybackControlsController* controller,
+ TMPXVideoPlaybackControls index,
+ HbWidget* widget,
+ TUint controlproperties );
+
+ virtual ~QMPXVideoPlaybackStatusPaneControl();
+
+ public:
+
+ /**
+ * Set visibility of each control
+ */
+ void setVisibility( TMPXPlaybackState aState );
+
+ /*
+ * Update the controls with the file details
+ */
+ void updateControlsWithFileDetails( QMPXVideoPlaybackViewFileDetails *details );
+
+ void setVisible( bool visible );
+
+ bool isVisible();
+
+ void setMenu( QMPXVideoPlaybackViewFileDetails* details );
+
+ void controlListUpdated( QMPXVideoPlaybackViewFileDetails* details );
+
+ private slots:
+ void handleAboutToShow();
+ void handleAboutToHide();
+ void openFullScreenView();
+
+ private:
+ bool mVisible;
+ HbAction *mActionBack;
+ HbLabel *mTitleLabel;
+};
+
+#endif /*MPXVIDEOPLAYBACKSTATUSPANECONTROL_H_*/
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackcontrolconfiguration.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,199 @@
+/*
+* 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 QMPXVideoPlaybackControlConfiguration
+*
+*/
+
+// Version : %version: da1mmcf#13 %
+
+
+
+// INCLUDE FILES
+
+#include <qgraphicswidget>
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackdocumentloader.h"
+#include "mpxvideoplaybackviewfiledetails.h"
+#include "mpxvideoplaybackcontrolconfiguration.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+
+
+// ================= 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);
+
+ QGraphicsWidget *widget =
+ mControlsController->layoutLoader()->findWidget( QString( "transparentWindow" ) );
+
+ switch ( event )
+ {
+ case EMPXControlCmdFullScreenViewOpened:
+ {
+ widget->setVisible( true );
+
+ deleteControlFromList( EMPXDetailsViewPlaybackWindow );
+ deleteControlFromList( EMPXFileDetailsWidget );
+ deleteControlFromList( EMPXIndicatorBitmap );
+
+ break;
+ }
+ case EMPXControlCmdDetailsViewOpened:
+ {
+ widget->setVisible( false );
+
+ deleteControlFromList( EMPXIndicatorBitmap );
+
+ addControlToList( EMPXDetailsViewPlaybackWindow );
+
+ addControlToList( EMPXFileDetailsWidget );
+
+ break;
+ }
+ case EMPXControlCmdTvOutConnected:
+ case EMPXControlCmdAudionOnlyViewOpened:
+ {
+ widget->setVisible( false );
+
+ deleteControlFromList( EMPXDetailsViewPlaybackWindow );
+
+ addControlToList( EMPXIndicatorBitmap );
+ addControlToList( EMPXFileDetailsWidget );
+
+ break;
+ }
+ case EMPXControlCmdTvOutDisconnected:
+ {
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+
+ emit controlListUpdated();
+}
+
+// -------------------------------------------------------------------------------------------------
+// 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()"));
+
+ addControlToList( EMPXButtonBar );
+ addControlToList( EMPXProgressBar );
+
+ if ( mControlsController->fileDetails()->mVideoEnabled )
+ {
+ QGraphicsWidget *widget =
+ mControlsController->layoutLoader()->findWidget( QString( "transparentWindow" ) );
+ widget->setVisible( true );
+ }
+
+ emit controlListUpdated();
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackcontrolscontroller.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,1333 @@
+/*
+* 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#25 %
+
+
+
+// INCLUDE FILES
+#include <coecntrl.h>
+#include <bautils.h>
+#include <barsread.h>
+#include <stringloader.h>
+#include <f32file.h>
+
+#include <qtimer>
+#include <qfileinfo>
+#include <thumbnailmanager_qt.h>
+
+#include <hblabel.h>
+#include <hbaction.h>
+#include <hbiconitem.h>
+#include <hbratingslider.h>
+#include <hbiconanimator.h>
+#include <hbtransparentwindow.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 "mpxvideoplaybackcontrolscontroller.h"
+#include "mpxvideoplaybackcontrolconfiguration.h"
+#include "mpxvideoplaybackdetailsplaybackwindow.h"
+
+
+// ================= MEMBER FUNCTIONS ==============================================================
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::QMPXVideoPlaybackControlsController()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackControlsController::QMPXVideoPlaybackControlsController(
+ HbVideoBasePlaybackView *view,
+ CMPXVideoViewWrapper *viewWrapper,
+ QMPXVideoPlaybackViewFileDetails *details )
+ : mView( view )
+ , mViewWrapper( viewWrapper )
+ , mFileDetails( details )
+ , mControlsPolicy( NULL )
+ , mControlsConfig( NULL )
+ , mControlsTimer( NULL )
+ , mLoader( NULL )
+ , mVolumeControl( NULL )
+ , mThumbnailManager( NULL )
+ , mViewTransitionIsGoingOn( false )
+ , mThumbNailState( EThumbNailEmpty )
+ , mState( EPbStateNotInitialised )
+ , mViewMode( EFullScreenView )
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::QMPXVideoPlaybackControlsController()"));
+
+ initializeController();
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::initializeController()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::initializeController()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::initializeController()"));
+
+ 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
+ //
+ bool ok = false;
+ mLoader = new QMPXVideoPlaybackDocumentLoader( this );
+ mLoader->load( KMPXPLAYBACKVIEW_XML, &ok );
+
+ if ( ok )
+ {
+ 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 );
+ }
+ else
+ {
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::initializeController()- can't find xml"));
+
+ //
+ // Can't find xml for layout. Delete mLoader
+ //
+ delete mLoader;
+ mLoader = NULL;
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::~QMPXVideoPlaybackControlsController"));
+
+ disconnect( mControlsConfig, SIGNAL( controlListUpdated() ), this, SLOT( controlsListUpdated() ) );
+
+ disconnect( mView, SIGNAL( tappedOnScreen() ), this, SLOT( handleTappedOnScreen() ) );
+ disconnect( mControlsTimer, SIGNAL( timeout() ), this, SLOT( hideAllControls() ) );
+
+ mView->setWidget( NULL );
+
+ mControls.clear();
+
+ if ( mControlsTimer )
+ {
+ delete mControlsTimer;
+ mControlsTimer = NULL;
+ }
+
+ if ( mControlsPolicy )
+ {
+ delete mControlsPolicy;
+ mControlsPolicy = NULL;
+ }
+
+ if ( mControlsConfig )
+ {
+ delete mControlsConfig;
+ mControlsConfig = NULL;
+ }
+
+ if ( mLoader )
+ {
+ delete mLoader;
+ mLoader = NULL;
+ }
+
+ if ( mThumbnailManager )
+ {
+ delete mThumbnailManager;
+ mThumbnailManager = 0;
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::addFileDetails()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::addFileDetails(
+ QMPXVideoPlaybackViewFileDetails* details )
+{
+ //
+ // If it is not local, hide the star rating
+ //
+ if ( details->mPlaybackMode != EMPXVideoLocal )
+ {
+ QString sectionName = "nonLocalPlayback";
+
+ bool ok = false;
+ mLoader->load( KMPXPLAYBACKVIEW_XML, sectionName, &ok );
+ }
+
+ mFileDetails = details;
+
+ mFileDetails->mRNFormat = realFormat( mFileDetails->mClipName );
+
+ mControlsConfig->updateControlsWithFileDetails();
+
+ //
+ // for audio-only clips and tv-out, default view is flip view
+ //
+ if ( ! details->mVideoEnabled )
+ {
+ changeViewMode( EAudioOnlyView, false );
+ }
+
+ if ( details->mTvOutConnected )
+ {
+ handleEvent( EMPXControlCmdTvOutConnected, details->mTvOutPlayAllowed );
+ }
+
+ //
+ // Dimmed the volume control if it is video only
+ //
+ if ( ! mFileDetails->mAudioEnabled )
+ {
+ mVolumeControl->setValue( 0 );
+ mVolumeControl->setEnabled( false );
+ }
+
+ //
+ // If title is not available, show clip name
+ //
+ QString title = mFileDetails->mTitle;
+
+ if ( title.count() == 0 )
+ {
+ QFileInfo fileInfo( mFileDetails->mClipName );
+ title = fileInfo.baseName ();
+ }
+
+ QGraphicsWidget *widget = mLoader->findWidget( QString( "title" ) );
+ HbLabel *titleLabel = qobject_cast<HbLabel*>( widget );
+ titleLabel->setPlainText( title );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleEvent
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleEvent(
+ TMPXVideoPlaybackControlCommandIds event, int value )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::handleEvent(%d)"), event);
+
+ switch ( event )
+ {
+ case EMPXControlCmdSetPosition:
+ {
+ MPX_DEBUG(_L(" [EMPXControlCmdSetPosition [%d]]"), value );
+
+ positionChanged( (qreal)value / (qreal)KPbMilliMultiplier);
+ break;
+ }
+ case EMPXControlCmdSetDuration:
+ {
+ MPX_DEBUG(_L(" [EMPXControlCmdSetDuration [%d]]"), value );
+
+ durationChanged( (qreal)value / (qreal)KPbMilliMultiplier );
+ break;
+ }
+ case EMPXControlCmdStateChanged:
+ {
+ MPX_DEBUG(_L(" [EMPXControlCmdStateChanged]"));
+
+ handleStateChange( (TMPXPlaybackState)value );
+ break;
+ }
+ case EMPXControlCmdSetVolume:
+ {
+ MPX_DEBUG(_L(" [EMPXControlCmdSetVolume [%d]]"), value );
+
+ volumeChanged( value );
+ break;
+ }
+ case EMPXControlCmdSetAspectRatio:
+ {
+ MPX_DEBUG(_L(" [EMPXControlCmdSetAspectRatio %d]"), value );
+
+ aspectRatioChanged( value );
+
+ break;
+ }
+ case EMPXControlCmdSetDownloadSize:
+ {
+ MPX_DEBUG(_L(" [EMPXControlCmdSetDownloadSize [%d]]"), value );
+ setDownloadSize( value );
+ break;
+ }
+ case EMPXControlCmdDownloadUpdated:
+ {
+ MPX_DEBUG(_L(" [EMPXControlCmdDownloadUpdated [%d]]"), value );
+ updateDownloadPosition( value );
+ break;
+ }
+ case EMPXControlCmdDownloadComplete:
+ {
+ MPX_DEBUG(_L(" [EMPXControlCmdDownloadComplete [%d]]"), value);
+ updateDownloadPosition( value );
+ break;
+ }
+ case EMPXControlCmdSetDownloadPaused:
+ case EMPXControlCmdClearDownloadPaused:
+ {
+ mControlsConfig->updateControlList( event );
+ break;
+ }
+ case EMPXControlCmdTvOutConnected:
+ {
+ MPX_DEBUG(_L(" [EMPXControlCmdTvOutConnected]"));
+
+ handleTvOutEvent( true, event, value );
+ break;
+ }
+ case EMPXControlCmdTvOutDisconnected:
+ {
+ MPX_DEBUG(_L(" [EMPXControlCmdTvOutDisConnected]"));
+
+ handleTvOutEvent( false, event, value );
+ break;
+ }
+ case EMPXControlCmdHandleErrors:
+ {
+ MPX_DEBUG(_L(" [EMPXControlCmdHandleErrors]"));
+
+ handleErrors();
+
+ break;
+ }
+ case EMPXControlCmdShowVolumeControls:
+ {
+ MPX_DEBUG(_L(" [EMPXControlCmdShowVolumeControls]"));
+
+ showVolumeControls();
+ break;
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleStateChange
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleStateChange( TMPXPlaybackState newState )
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::handleStateChange()"),
+ _L("new state = %d"), newState );
+
+ //
+ // Somehow EPbStatePlaying, EPbStatePaused gets called twice continously
+ //
+ if ( newState != mState )
+ {
+ mState = newState;
+
+ switch ( newState )
+ {
+ case EPbStateInitialised:
+ {
+ //
+ // remove branding control when the state is transitioned to Initialized
+ //
+ if ( mFileDetails->mPlaybackMode == EMPXVideoStreaming ||
+ mFileDetails->mPlaybackMode == EMPXVideoLiveStreaming )
+ {
+ mControlsConfig->updateControlList( EMPXControlCmdPluginInitialized );
+ }
+
+ break;
+ }
+ case EPbStatePlaying:
+ case EPbStateInitialising:
+ case EPbStateBuffering:
+ case EPbStatePaused:
+ case EPbStateNotInitialised:
+ {
+ updateState();
+
+ //
+ // Show all the controls
+ //
+ showControls();
+
+ break;
+ }
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::controlsListUpdated()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::controlsListUpdated()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::controlsListUpdated()"));
+
+ hideAllControls();
+
+ QList<TMPXVideoPlaybackControls>& updatedList = mControlsConfig->controlList();
+
+ QList<TMPXVideoPlaybackControls> myList = updatedList;
+
+ int controlCount = mControls.count();
+
+ int i = 0 ;
+ int index = KErrNotFound;
+
+
+ for ( int iCnt = 0 ; iCnt < controlCount ; iCnt++ )
+ {
+ index = myList.indexOf( mControls[i]->controlIndex() );
+
+ if ( index == KErrNotFound )
+ {
+ //
+ // Delete control since it doesn't exist in new list
+ //
+ mControls.removeAt( i );
+ }
+ else
+ {
+ //
+ // Control exists in new list.
+ // Update the policy property based on file details and view mode to the controls
+ //
+ TUint properties = 0;
+ mControlsPolicy->setControlProperties(
+ mControls[i]->controlIndex(), properties, mFileDetails, mViewMode );
+ mControls[i]->updateControlProperties( properties );
+
+ //
+ // Control exists in new list.
+ //
+ myList.removeAt( index );
+ i++;
+ }
+ }
+
+ //
+ // The updated list will contain added controls only
+ //
+ for ( int j = 0 ; j < myList.count() ; j++ )
+ {
+ appendControl( myList[j] );
+ }
+
+ for ( int i = 0 ; i < mControls.count() ; i++ )
+ {
+ mControls[i]->updateControlsWithFileDetails( mFileDetails );
+ }
+
+ showControls();
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::appendControl()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::appendControl( TMPXVideoPlaybackControls controlIndex )
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::appendControl()"),
+ _L("control index = %d"), controlIndex );
+
+ TUint properties = 0;
+
+ mControlsPolicy->setControlProperties( controlIndex, properties, mFileDetails, mViewMode );
+ QMPXVideoPlaybackFullScreenControl* control;
+
+ switch ( controlIndex )
+ {
+ case EMPXBufferingAnimation:
+ {
+ //
+ // Buffering animation icon
+ //
+ QGraphicsWidget *widget = mLoader->findWidget( QString( "bufferingIcon" ) );
+ HbLabel *bufferingAnim = qobject_cast<HbLabel*>( widget );
+ HbIconItem *iconItem = new HbIconItem( bufferingAnim->icon() );
+ iconItem->animator().startAnimation();
+
+ control = new QMPXVideoPlaybackFullScreenControl( this,
+ controlIndex,
+ bufferingAnim,
+ properties );
+ mControls.append( control );
+
+ break;
+ }
+ case EMPXStatusPane:
+ {
+ //
+ // Status key (signal + title + back key)
+ //
+ control = new QMPXVideoPlaybackStatusPaneControl( this,
+ controlIndex,
+ NULL,
+ properties );
+ mControls.append( control );
+
+ break;
+ }
+ case EMPXButtonBar:
+ {
+ //
+ // Button bar
+ //
+ QGraphicsWidget *widget = mLoader->findWidget( QString( "buttonBarLayout" ) );
+ QMPXVideoPlaybackButtonBar *buttonBar =
+ qobject_cast<QMPXVideoPlaybackButtonBar*>( widget );
+ buttonBar->initialize();
+
+ control = new QMPXVideoPlaybackFullScreenControl( this,
+ controlIndex,
+ buttonBar,
+ properties );
+ mControls.append( control );
+
+ break;
+ }
+ case EMPXProgressBar:
+ {
+ //
+ // Progress bar
+ //
+ QGraphicsWidget *widget = mLoader->findWidget( QString( "progressBarLayout" ) );
+ QMPXVideoPlaybackProgressBar *progressBar =
+ qobject_cast<QMPXVideoPlaybackProgressBar*>( widget );
+ progressBar->initialize();
+
+ control = new QMPXVideoPlaybackFullScreenControl( this,
+ controlIndex,
+ progressBar,
+ properties );
+
+ mControls.append( control );
+
+ break;
+ }
+ case EMPXFileDetailsWidget:
+ {
+ QGraphicsWidget *widget = mLoader->findWidget( QString( "fileDetailsLayout" ) );
+ QMPXVideoPlaybackFileDetailsWidget *fileDetails =
+ qobject_cast<QMPXVideoPlaybackFileDetailsWidget*>( widget );
+ fileDetails->initialize();
+
+ control = new QMPXVideoPlaybackFullScreenControl( this,
+ controlIndex,
+ fileDetails,
+ properties );
+
+ mControls.append( control );
+ break;
+ }
+ case EMPXIndicatorBitmap:
+ {
+ QGraphicsWidget *widget = mLoader->findWidget( QString( "bitmapLayout" ) );
+ HbWidget *bitmapWidget = qobject_cast<HbWidget*>( widget );
+
+ setDefaultBitmap();
+ control = new QMPXVideoPlaybackFullScreenControl( this,
+ controlIndex,
+ bitmapWidget,
+ properties );
+ mControls.append( control );
+
+ break;
+ }
+ case EMPXDetailsViewPlaybackWindow:
+ {
+ QGraphicsWidget *widget = mLoader->findWidget( QString( "detailsPlaybackWindow" ) );
+ QMPXVideoPlaybackDetailsPlaybackWindow *detailsPlaybackWindow =
+ qobject_cast<QMPXVideoPlaybackDetailsPlaybackWindow*>( widget );
+ detailsPlaybackWindow->initialize();
+
+ control = new QMPXVideoPlaybackFullScreenControl( this,
+ controlIndex,
+ detailsPlaybackWindow,
+ properties );
+ mControls.append( control );
+
+ break;
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleTappedOnScreen()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleTappedOnScreen()
+
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::handleTappedOnScreen()"));
+
+ //
+ // Toggle visibility only if the followings are true
+ // - TV-Out is not connected
+ // - Video is available
+ // - We are in playing or paused state
+ //
+ if ( ! isTvOutConnected() &&
+ mFileDetails->mVideoEnabled &&
+ ( mState == EPbStatePlaying || mState == EPbStatePaused ) )
+ {
+ if ( mViewMode == EFullScreenView )
+ {
+ if ( isVisible() )
+ {
+ //
+ // If the volume control is visible, hide it
+ //
+ if ( mVolumeControl->isVisible() )
+ {
+ mVolumeControl->setVisible( false );
+ }
+
+ hideAllControls();
+ }
+ else
+ {
+ showControls();
+ }
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::resetDisappearingTimers()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::resetDisappearingTimers( TMPXTimerAction timerAction )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::resetDisappearingTimers()"));
+
+ if ( mControlsTimer->isActive() )
+ {
+ mControlsTimer->stop();
+ }
+
+ //
+ // Do not start the time for DetailsView and AudioOnlyView
+ //
+ if ( timerAction == EMPXTimerReset &&
+ mState == EPbStatePlaying &&
+ mViewMode == EFullScreenView )
+ {
+ MPX_DEBUG(_L(" Starting Controls Timer"));
+
+ mControlsTimer->start();
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::hideAllControls()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::hideAllControls()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::hideControls()"));
+
+ resetDisappearingTimers( EMPXTimerCancel );
+
+ for ( int i = 0 ; i < mControls.count() ; i++ )
+ {
+ mControls[i]->setVisible( false );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::showControls()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::showControls()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::showControls()"));
+
+ resetDisappearingTimers( EMPXTimerReset );
+
+ if ( ! mViewTransitionIsGoingOn )
+ {
+ for ( int i = 0 ; i < mControls.count() ; i++ )
+ {
+ mControls[i]->setVisibility( mState );
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::isVisible()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackControlsController::isVisible()
+{
+ bool visible = EFalse;
+
+ for ( int i = 0 ; i < mControls.count() ; i++ )
+ {
+ if ( mControls[i]->controlIndex() == EMPXButtonBar )
+ {
+ if ( mControls[i]->isVisible() )
+ {
+ visible = ETrue;
+ }
+
+ break;
+ }
+ }
+
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::isVisible() [%d]"), visible);
+
+ return visible;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleCommand()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleCommand(
+ TMPXVideoPlaybackViewCommandIds command, int value )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::handleCommand(%d)"), command);
+
+ switch( command )
+ {
+ case EMPXPbvCmdSetPosition:
+ {
+ TRAP_IGNORE( mViewWrapper->SetPropertyL( EPbPropertyPosition,
+ value * KPbMilliMultiplier ) );
+ break;
+ }
+ case EMPXPbvCmdSetVolume:
+ {
+ TRAP_IGNORE( mViewWrapper->SetPropertyL( EPbPropertyVolume, value ) );
+ break;
+ }
+ default:
+ {
+ TRAP_IGNORE( mViewWrapper->HandleCommandL( command ) );
+ break;
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::volumeChanged()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::volumeChanged( int volume )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::volumeChanged() [%d]"), volume);
+
+ if ( mVolumeControl )
+ {
+ mVolumeControl->setValue( volume );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::showVolumeControls()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::showVolumeControls()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::showVolumeControls()"));
+
+ if ( mVolumeControl )
+ {
+ mVolumeControl->setVisible( true );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::durationChanged()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::durationChanged( int duration )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::durationChanged() [%d]"), duration);
+
+ for ( int i = 0 ; i < mControls.count() ; i++ )
+ {
+ if ( mControls[i]->durationChanged( duration ) )
+ {
+ break;
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::positionChanged()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::positionChanged( int position )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::positionChanged() [%d]"), position);
+
+ for ( int i = 0 ; i < mControls.count() ; i++ )
+ {
+ if ( mControls[i]->positionChanged( position ) )
+ {
+ break;
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::aspectRatioChanged()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::aspectRatioChanged( int aspectRatio )
+{
+ MPX_DEBUG(_L("CMPXVideoPlaybackControlsController::aspectRatioChanged() [%d]"), aspectRatio);
+
+ for ( int i = 0 ; i < mControls.count() ; i++ )
+ {
+ if ( mControls[i]->aspectRatioChanged( aspectRatio ) )
+ {
+ break;
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::updateState()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::updateState()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::updateState() [%d]"), mState);
+
+ for ( int i = 0 ; i < mControls.count() ; i++ )
+ {
+ mControls[i]->updateState( mState );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::realFormat()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackControlsController::realFormat( QString filename )
+{
+ bool realFormat = EFalse;
+
+ if ( !filename.isNull() && !filename.isEmpty() )
+ {
+ if ( mFileDetails->mPlaybackMode == EMPXVideoStreaming ||
+ mFileDetails->mPlaybackMode == EMPXVideoLiveStreaming )
+ {
+ TBufC<255> file(filename.utf16());
+ realFormat = realFormatForStreaming( file );
+ }
+ else
+ {
+ realFormat = realFormatForLocal();
+ }
+ }
+
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::realFormat() [%d]"), realFormat);
+
+ return realFormat;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::realFormatForStreaming()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackControlsController::realFormatForStreaming( const TDesC& des )
+{
+ bool realFormat = EFalse;
+ TParse filePath;
+
+ _LIT(KMPXRMEXT, ".R" );
+
+ int err = filePath.Set( des, NULL, NULL );
+
+ //
+ // It is valid to have a "\" character in a url, but parsing fails,
+ // switch these characters to "/" for the local string and try parsing again.
+ //
+ if ( err == KErrBadName )
+ {
+ int backsashPos = des.LocateF('\\');
+
+ if( backsashPos != KErrNotFound )
+ {
+ HBufC* fileName = NULL;
+
+ TRAP( err, fileName = des.AllocL() );
+
+ if ( err == KErrNone )
+ {
+ int count( fileName->Des().Length() );
+
+ for ( int j = backsashPos ; j < count; ++j )
+ {
+ if ( fileName->Des()[j]== '\\' )
+ {
+ fileName->Des()[j]='/';
+ }
+ }
+ err = filePath.Set( fileName->Des(), NULL, NULL );
+ }
+
+ if ( fileName )
+ {
+ delete fileName;
+ fileName = NULL;
+ }
+ }
+ }
+
+ if ( err == KErrNone )
+ {
+ //
+ // The requirement to support arguments with the extension in streaming links
+ // for-ex: /video.3gp?start=10&end=40 will have to supported
+ // as well. So just by doing p.Ext() would retrieve all the string
+ // after "." so by doing a Left(2) would retrieve only
+ // .3g or .rm and so on. This would help better
+ // interpret the extension and decide the branding accordingly
+ //
+ filePath.Set( filePath.NameAndExt(), NULL, NULL );
+ TPtrC extension = filePath.Ext().Left( 2 );
+
+ TBuf<2> buf;
+ buf.Format( extension );
+ buf.UpperCase();
+
+ // RealMedia Branding
+ if ( ! buf.Compare( KMPXRMEXT ) )
+ {
+ realFormat = ETrue;
+ }
+ }
+
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::realFormatForStreaming()[%d]"), realFormat);
+
+ return realFormat;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::realFormatForLocal()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackControlsController::realFormatForLocal()
+{
+ bool realFormat = false;
+
+ QString real( "real" );
+ QString rn( "rn" );
+
+ if ( mFileDetails->mMimeType.contains( real, Qt::CaseInsensitive ) ||
+ mFileDetails->mMimeType.contains( rn, Qt::CaseInsensitive ) )
+ {
+ realFormat = true;
+ }
+
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::realFormatForLocal() [%d]"), realFormat);
+
+ return realFormat;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::setDownloadSize()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::setDownloadSize( int size )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::setDownloadSize() [%d]"), size);
+
+ for ( int i = 0 ; i < mControls.count() ; i++ )
+ {
+ if ( mControls[i]->setDownloadSize( size ) )
+ {
+ break;
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::updateDownloadPosition()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::updateDownloadPosition( int size )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::updateDownloadPosition() [%d]"), size);
+
+ for ( int i = 0 ; i < mControls.count() ; i++ )
+ {
+ if ( mControls[i]->updateDownloadPosition( size ) )
+ {
+ break;
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleErrors
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleErrors()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackControlsController::handleErrors()"),
+ _L("mState = %d"), mState );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::isSoftKeyVisible()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackControlsController::isSoftKeyVisible( int /*value*/ )
+{
+ bool visible = EFalse;
+
+ for ( int i = 0 ; i < mControls.count() ; i++ )
+ {
+ if ( mControls[i]->controlIndex() == EMPXStatusPane )
+ {
+ if ( mControls[i]->isVisible() )
+ {
+ visible = ETrue;
+ }
+
+ break;
+ }
+ }
+
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::isSoftKeyVisible() [%d]"), visible);
+
+ return visible;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleTvOutEvent
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleTvOutEvent(
+ bool connected, TMPXVideoPlaybackControlCommandIds event, int value )
+{
+ Q_UNUSED( event );
+
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::handleTvOutEvent()"));
+
+ mFileDetails->mTvOutConnected = connected;
+
+ setDefaultBitmap();
+
+ if ( mFileDetails->mTvOutConnected )
+ {
+ generateThumbNail();
+ mFileDetails->mTvOutPlayAllowed = value;
+ }
+ else
+ {
+ mFileDetails->mTvOutPlayAllowed = ETrue;
+ }
+
+ //
+ // Change the view.
+ // If Tv-out is connected, go to AudioOnlyView.
+ // If not, go back to default view.
+ //
+ TPlaybackViewMode viewMode = EFullScreenView;
+
+ if ( mFileDetails->mTvOutConnected || ! mFileDetails->mVideoEnabled )
+ {
+ viewMode = EAudioOnlyView;
+ }
+
+ changeViewMode( viewMode, false );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::changeViewMode
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::changeViewMode(
+ TPlaybackViewMode viewMode, bool transitionEffect )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::changeViewMode()"));
+
+ if ( viewMode != mViewMode )
+ {
+ switch ( viewMode )
+ {
+ case EFullScreenView:
+ case EDetailsView:
+ {
+ if ( mFileDetails->mVideoEnabled && ! mFileDetails->mTvOutConnected )
+ {
+ mViewMode = viewMode;
+
+ //
+ // Hack to clean up the screen before transition. We may not need it in NGA env
+ //
+ hideAllControls();
+
+ updateVideoRect( transitionEffect );
+ }
+
+ break;
+ }
+ case EAudioOnlyView:
+ {
+ if ( ! mFileDetails->mVideoEnabled || mFileDetails->mTvOutConnected )
+ {
+ mViewMode = viewMode;
+
+ mControlsConfig->updateControlList( EMPXControlCmdAudionOnlyViewOpened );
+ }
+
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::updateVideoRectDone
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::updateVideoRectDone()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::updateVideoRectDone()"));
+
+ mViewTransitionIsGoingOn = false;
+
+ TMPXVideoPlaybackControlCommandIds event = EMPXControlCmdFullScreenViewOpened;
+
+ if ( mViewMode == EDetailsView )
+ {
+ event = EMPXControlCmdDetailsViewOpened;
+ }
+
+ mControlsConfig->updateControlList( event );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::skipToPreviousVideoItem
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::skipToPreviousVideoItem()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::skipToPreviousVideoItem()"));
+
+ handleCommand( EMPXPbvCmdPreviousListItem );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::skipToNextVideoItem
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::skipToNextVideoItem()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::skipToNextVideoItem()"));
+
+ handleCommand( EMPXPbvCmdNextListItem );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::updateVideoRect()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::updateVideoRect( bool transitionEffect )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::updateVideoRect()"));
+
+ if ( mFileDetails->mVideoEnabled && ! mFileDetails->mTvOutConnected )
+ {
+ mViewTransitionIsGoingOn = true;
+
+ QRectF rect;
+
+ if ( mViewMode == EDetailsView )
+ {
+ QGraphicsWidget *parent = mLoader->findWidget( QString( "detailsPlaybackWindow" ) );
+ QGraphicsWidget *child = mLoader->findWidget( QString( "small_transparentWindow" ) );
+
+ rect = parent->mapRectToScene( child->geometry() );
+ }
+ else if ( mViewMode == EFullScreenView )
+ {
+ QGraphicsWidget *widget = mLoader->findWidget( QString( "content" ) );
+ rect = widget->geometry();
+ }
+
+ mViewWrapper->UpdateVideoRect(
+ rect.x(), rect.y(), rect.width(), rect.height(), transitionEffect );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::setDefaultBitmap()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::setDefaultBitmap()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::setDefaultBitmap()"));
+
+ //
+ // set specific bitmaps for audio only and tv out cases
+ // If we already requested a thumbnail, we will set the thumbnail after we receive the thumbnail
+ //
+ if ( mLoader && mThumbNailState != EThumbNailRequsted )
+ {
+ QGraphicsWidget *tvOutBitmap = mLoader->findWidget( "tvOutBitmap" );
+ tvOutBitmap->setVisible( false );
+
+ QGraphicsWidget *realAudioOnlyBitmap = mLoader->findWidget( "realAudioOnlyBitmap" );
+ realAudioOnlyBitmap->setVisible( false );
+
+ QGraphicsWidget *partialAudioOnlyBitmap = mLoader->findWidget( "partialAudioOnlyBitmap" );
+ partialAudioOnlyBitmap->setVisible( false );
+
+ QGraphicsWidget *audioOnlyBitmap = mLoader->findWidget( "audioOnlyBitmap" );
+ audioOnlyBitmap->setVisible( false );
+
+ if ( mFileDetails->mTvOutConnected )
+ {
+ tvOutBitmap->setVisible( true );
+ }
+ else if ( mFileDetails->mRNFormat )
+ {
+ realAudioOnlyBitmap->setVisible( true );
+ }
+ else if ( mFileDetails->mPartialPlayback )
+ {
+ partialAudioOnlyBitmap->setVisible( true );
+ }
+ else
+ {
+ audioOnlyBitmap->setVisible( true );
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::generateThumbNail()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::generateThumbNail()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackControlsController::generateThumbNail()"));
+
+ //
+ // Generate thumbnail if it is local playback
+ //
+ if ( mFileDetails->mPlaybackMode == EMPXVideoLocal )
+ {
+ if ( mThumbNailState == EThumbNailEmpty )
+ {
+ mThumbnailManager = new ThumbnailManager(); ;
+
+ mThumbnailManager->setThumbnailSize( ThumbnailManager::ThumbnailLarge );
+ mThumbnailManager->setQualityPreference( ThumbnailManager::OptimizeForPerformance );
+
+ if ( connect( mThumbnailManager, SIGNAL( thumbnailReady( QPixmap , void * , int , int ) ),
+ this, SLOT( handleThumbnailReady( QPixmap , void * , int , int ) ) ) )
+ {
+ mThumbnailManager->getThumbnail( mFileDetails->mClipName );
+ mThumbNailState = EThumbNailRequsted;
+ }
+ }
+ }
+ else
+ {
+ mThumbNailState = EThumbNailNotAvailable;
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackControlsController::handleThumbnailReady()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackControlsController::handleThumbnailReady(
+ QPixmap tnData, void *internal , int id, int error )
+{
+ Q_UNUSED( internal );
+ Q_UNUSED( id );
+
+ if( ! error && mLoader )
+ {
+ QGraphicsWidget *tvOutBitmap = mLoader->findWidget( "tvOutBitmap" );
+ HbLabel *tvOutLabel = qobject_cast<HbLabel*>( tvOutBitmap );
+
+ QIcon *qicon = new QIcon( tnData );
+
+ HbIcon *hbIcon = new HbIcon( *qicon );
+ hbIcon->setSize( tvOutBitmap->size() );
+ tvOutLabel->setIcon( *hbIcon );
+
+ if ( qicon )
+ {
+ delete qicon;
+ }
+
+ if ( hbIcon )
+ {
+ delete hbIcon;
+ }
+
+ mThumbNailState = EThumbNailSet;
+ }
+ else
+ {
+ mThumbNailState = EThumbNailNotAvailable;
+ }
+
+ setDefaultBitmap();
+
+ disconnect( mThumbnailManager, SIGNAL( thumbnailReady( QPixmap , void * , int , int ) ),
+ this, SLOT( handleThumbnailReady( QPixmap , void * , int , int ) ) );
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackdetailsplaybackwindow.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,151 @@
+/*
+* 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: 8 %
+
+
+
+#include <qfileinfo>
+#include <qgraphicsscenemouseevent>
+
+#include <hblabel.h>
+#include <hbpushbutton.h>
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackdocumentloader.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()"));
+
+ QMPXVideoPlaybackDocumentLoader *loader = mController->layoutLoader();
+
+ //
+ // Don't need to initialize buttons once it gets initialized
+ //
+ if ( loader && ! mInitialized )
+ {
+ mInitialized = true;
+
+ QMPXVideoPlaybackViewFileDetails *details = mController->fileDetails();
+
+ //
+ // Connect signal and slot for play button
+ //
+ QGraphicsWidget *widget = loader->findWidget( QString( "detailsViewPlayButton" ) );
+ HbPushButton *playButton = qobject_cast<HbPushButton*>( widget );
+ playButton->setFlag( QGraphicsItem::ItemIsFocusable, false );
+
+ connect( playButton, SIGNAL( released() ), this, SLOT( playPause() ) );
+
+ QGraphicsItem *widget1 = playButton->primitive( HbStyle::P_PushButton_background );
+ widget1->setVisible( false );
+ }
+
+ updateState( mController->state() );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDetailsPlaybackWindow::updateState()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackDetailsPlaybackWindow::updateState( TMPXPlaybackState state )
+{
+ 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 );
+ break;
+ }
+ default:
+ {
+ widget->setVisible( false );
+ break;
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDetailsPlaybackWindow::playPause()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackDetailsPlaybackWindow::playPause()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackDetailsPlaybackWindow::playPause"));
+
+ mController->handleCommand( EMPXPbvCmdPlayPause );
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::event()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackDetailsPlaybackWindow::event( QEvent *event )
+{
+ bool consumed = false;
+
+ //
+ // 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 );
+ }
+
+ return consumed;
+}
+
+//End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackdocumentloader.cpp Thu Apr 01 22:38:49 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: Implementation of QMPXVideoPlaybackDocumentLoader
+*
+*/
+
+// Version : %version: 7 %
+
+
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackbuttonbar.h"
+#include "mpxvideoplaybackprogressbar.h"
+#include "mpxvideoplaybackdocumentloader.h"
+#include "mpxvideoplaybackfiledetailswidget.h"
+#include "mpxvideoplaybacknontouchvolumebar.h"
+#include "mpxvideoplaybackcontrolscontroller.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") );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackDocumentLoader::createObject()
+// -------------------------------------------------------------------------------------------------
+//
+QObject *QMPXVideoPlaybackDocumentLoader::createObject( const QString& type, const QString &name )
+{
+ QObject *object = NULL;
+
+ if ( name == "buttonBarLayout" )
+ {
+ object = new QMPXVideoPlaybackButtonBar( mController );
+ object->setObjectName( name );
+ }
+ else if ( name == "progressBarLayout" )
+ {
+ object = new QMPXVideoPlaybackProgressBar( mController );
+ object->setObjectName( name );
+ }
+ else if ( name == "fileDetailsLayout" )
+ {
+ object = new QMPXVideoPlaybackFileDetailsWidget( mController );
+ object->setObjectName( name );
+ }
+ else if ( name == "volumeSlider" )
+ {
+ object = new QMPXVideoPlaybackNonTouchVolumeBar();
+ object->setObjectName( name );
+ }
+ else if ( name == "detailsPlaybackWindow" )
+ {
+ object = new QMPXVideoPlaybackDetailsPlaybackWindow( mController );
+ object->setObjectName( name );
+ }
+ else
+ {
+ object = HbDocumentLoader::createObject( type, name );
+ }
+
+ return object;
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackfiledetailswidget.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,419 @@
+/*
+* 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 QMPXVideoPlaybackFileDetailsWidget
+*
+*/
+
+// Version : %version: 13 %
+
+
+
+#include <qfileinfo>
+#include <qgraphicslinearlayout>
+#include <qdatetime>
+#include <qdir>
+
+#include <hblistwidgetitem.h>
+#include <hbratingslider.h>
+#include <hblistwidget.h>
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackdocumentloader.h"
+#include "mpxvideoplaybackfiledetailswidget.h"
+#include "mpxvideoplaybackdocumentloader.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()"));
+
+ HbStyleLoader::unregisterFilePath( ":/hbvideoplaybackview/hblistwidget.css" );
+
+ if ( mListWidget )
+ {
+ delete mListWidget;
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFileDetailsWidget::initialize
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackFileDetailsWidget::initialize()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackFileDetailsWidget::initialize"));
+
+ updateWithFileDetails( mController->fileDetails() );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFileDetailsWidget::updateControlsWithFileDetails
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackFileDetailsWidget::updateWithFileDetails(
+ QMPXVideoPlaybackViewFileDetails* details )
+{
+ QMPXVideoPlaybackDocumentLoader *loader = mController->layoutLoader();
+
+ if ( loader )
+ {
+ //
+ // load fileDetails widget
+ //
+ QGraphicsWidget *widget = loader->findWidget( QString( "fileDetails" ) );
+
+ //
+ // cast fileDetails widget to HbListWidget
+ //
+ mListWidget = qobject_cast<HbListWidget*>( widget );
+
+ if ( ! mFileDetailsUpdated )
+ {
+ //
+ // load file details style sheet
+ //
+ bool ret = HbStyleLoader::registerFilePath( ":/hbvideoplaybackview/hblistwidget.css" );
+
+ mFileDetailsUpdated = true;
+
+ QFileInfo fileInfo( details->mClipName );
+
+ //
+ // Title
+ //
+ makeTitleItem( details );
+
+ //
+ // Description
+ //
+ addItemToListWidget( "Description", details->mDescription );
+
+ //
+ // Duration
+ //
+ if ( details->mPlaybackMode != EMPXVideoLiveStreaming && details->mDuration > 0 )
+ {
+ QString duration = QString("%1").arg(
+ valueToReadableFormat( (qreal)details->mDuration / (qreal)KPbMilliMultiplier ) );
+ addItemToListWidget( "Duration", duration );
+ }
+
+ //
+ // Date
+ //
+ if ( details->mPlaybackMode == EMPXVideoLocal ||
+ details->mPlaybackMode == EMPXVideoProgressiveDownload )
+ {
+ //
+ // Date created
+ //
+ QString date = QString("%1").arg( fileInfo.created().toString( KDATETIMEFORMAT ) );
+ addItemToListWidget( "Date", date );
+
+ //
+ // Date modified
+ //
+ QString modified = QString("%1").arg( fileInfo.lastModified().toString( KDATETIMEFORMAT ) );
+ addItemToListWidget( "Modified", modified );
+ }
+
+ //
+ // Location
+ //
+ addItemToListWidget( "Location", details->mLocation );
+
+ //
+ // Author
+ //
+ addItemToListWidget( "Author", details->mArtist );
+
+ //
+ // Copyright
+ //
+ addItemToListWidget( "Copyright", details->mCopyright );
+
+ //
+ // Language
+ //
+ addItemToListWidget( "Language", details->mLanguage );
+
+ //
+ // Keywords
+ //
+ addItemToListWidget( "Keywords", details->mKeywords );
+
+ //
+ // Size
+ //
+ makeSizeItem( details );
+
+ //
+ // Resolution
+ //
+ if ( details->mVideoEnabled )
+ {
+ QString resolution = QString("%1 x %2")
+ .arg( details->mVideoWidth ).arg( details->mVideoHeight );
+ addItemToListWidget( "Resolution", resolution );
+ }
+
+ //
+ // Format
+ //
+ addItemToListWidget( "Format", details->mMimeType );
+
+ //
+ // Bitrate
+ //
+ makeBitRateItem( details );
+
+ //
+ // Folder
+ //
+ if ( details->mPlaybackMode == EMPXVideoLocal ||
+ details->mPlaybackMode == EMPXVideoProgressiveDownload)
+ {
+ QString folder = fileInfo.dir().dirName();
+ addItemToListWidget( "Collection", folder );
+ }
+
+ }
+
+ //
+ // Set the rect size dynamically based on the view mode
+ //
+ QString sectionName;
+
+ if ( mController->viewMode() == EDetailsView )
+ {
+ sectionName = "detailsView";
+ }
+ else if ( mController->viewMode() == EAudioOnlyView )
+ {
+ if ( details->mPlaybackMode == EMPXVideoLocal )
+ {
+ sectionName = "audioOnlyViewWithLocalPlayback";
+ }
+ else
+ {
+ sectionName = "audioOnlyViewWithNonLocalPlayback";
+ }
+ }
+
+ bool ok = false;
+ loader->load( KMPXPLAYBACKVIEW_XML, sectionName, &ok );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFileDetailsWidget::valueToReadableFormat
+// -------------------------------------------------------------------------------------------------
+//
+QString QMPXVideoPlaybackFileDetailsWidget::valueToReadableFormat( int value )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackFileDetailsWidget::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( QString::number( hour ) ).append(" hr ");
+ }
+
+ if ( minutes > 0 )
+ {
+ str.append( time.toString( QString::number( minutes ) ).append(" min "));
+ }
+
+ if ( second > 0 )
+ {
+ str.append( time.toString( QString::number( second ) ).append(" sec "));
+ }
+
+ return str;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFileDetailsWidget::makeTitleItem
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackFileDetailsWidget::makeTitleItem( QMPXVideoPlaybackViewFileDetails* details )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackFileDetailsWidget::makeTitleItem()"));
+
+ //
+ // Title should be the first item in file details list
+ //
+ if ( mController->viewMode() == EAudioOnlyView )
+ {
+ //
+ // show the title for audio-only view
+ //
+ if ( mListWidget->count() == 0 || ! mListWidget->item( 0 )->text().contains( "Title", Qt::CaseInsensitive ) )
+ {
+ QString title = details->mTitle;
+
+ if ( title.count() == 0 )
+ {
+ //
+ // If title is not available, show clip name
+ //
+ QFileInfo fileInfo( details->mClipName );
+ title = fileInfo.baseName ();
+ }
+
+ //
+ // populate Title and its associated text
+ //
+ HbListWidgetItem* listWidgetItem = new HbListWidgetItem();
+ listWidgetItem->setText( "Title" );
+ listWidgetItem->setSecondaryText( title );
+ mListWidget->insertItem( 0, listWidgetItem );
+ }
+ }
+ else if ( mListWidget->count() &&
+ mListWidget->item( 0 )->text().contains( "Title", Qt::CaseInsensitive ) )
+ {
+ //
+ // title is displayed under the status pane for video clips,
+ // so hide the title for this details view
+ //
+ delete mListWidget->takeItem ( 0 );
+ }
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFileDetailsWidget::makeSizeItem
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackFileDetailsWidget::makeSizeItem( QMPXVideoPlaybackViewFileDetails* details )
+{
+ if ( details->mPlaybackMode == EMPXVideoLocal ||
+ details->mPlaybackMode == EMPXVideoProgressiveDownload )
+ {
+ QFileInfo fileInfo( details->mClipName );
+ float size = fileInfo.size();
+
+ if ( size > 0.0 )
+ {
+ QString scale(" KB");
+
+ if ( size > KILOBYTE )
+ {
+ size /= KILOBYTE;
+ }
+
+ if ( size > KILOBYTE )
+ {
+ size /= KILOBYTE;
+ scale = QString(" MB");
+ }
+
+ if ( size > KILOBYTE )
+ {
+ size /= KILOBYTE;
+ scale = QString(" GB");
+ }
+
+ int temp = size * 10;
+ size = (float)temp / 10;
+
+ QString text = QString("%1").arg( size );
+ text.append( scale );
+
+ addItemToListWidget( "Size", text );
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFileDetailsWidget::makeBitRateItem
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackFileDetailsWidget::makeBitRateItem( QMPXVideoPlaybackViewFileDetails* details )
+{
+ if ( details->mBitRate > 0 )
+ {
+ float bitrate = details->mBitRate;
+
+ QString scale(" Kbps");
+
+ if ( bitrate > KILOBYTE )
+ {
+ bitrate /= KILOBYTE;
+ }
+
+ if ( bitrate > KILOBYTE )
+ {
+ bitrate /= KILOBYTE;
+ scale = QString(" Mbps");
+ }
+
+ int temp = bitrate * 10;
+ bitrate = (float)temp / 10;
+
+ QString text = QString("%1").arg( bitrate );
+ text.append( scale );
+
+ addItemToListWidget( "Bitrate", text );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackFileDetailsWidget::addItemToListWidget
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackFileDetailsWidget::addItemToListWidget( QString item, QString text )
+{
+ if ( text.count() > 0 )
+ {
+ MPX_DEBUG(_L("QMPXVideoPlaybackFileDetailsWidget::addItemToListWidget( %s , %s )"), item.data(), text.data() );
+
+ HbListWidgetItem* listWidgetItem = new HbListWidgetItem();
+ listWidgetItem->setText( item );
+ listWidgetItem->setSecondaryText( text );
+
+ mListWidget->addItem( listWidgetItem );
+ }
+}
+
+//End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/controlsrc/mpxvideoplaybackstatuspanecontrol.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,246 @@
+/*
+* 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 QMPXVideoPlaybackStatusPaneControl
+*
+*/
+
+// Version : %version: 10 %
+
+
+#include <hbmenu.h>
+#include <hblabel.h>
+#include <hbaction.h>
+#include <hbinstance.h>
+
+#include <w32std.h>
+
+#include "mpxvideo_debug.h"
+#include "hbvideobaseplaybackview.h"
+#include "mpxvideoplaybackdocumentloader.h"
+#include "mpxvideoplaybackstatuspanecontrol.h"
+#include "mpxvideoplaybackcontrolscontroller.h"
+
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackStatusPaneControl::QMPXVideoPlaybackStatusPaneControl()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackStatusPaneControl::QMPXVideoPlaybackStatusPaneControl(
+ QMPXVideoPlaybackControlsController* controller,
+ TMPXVideoPlaybackControls index,
+ HbWidget* widget,
+ TUint controlproperties )
+ : QMPXVideoPlaybackFullScreenControl( controller, index, widget, controlproperties )
+ , mActionBack( NULL )
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackStatusPaneControl::QMPXVideoPlaybackStatusPaneControl()"));
+
+ mActionBack = new HbAction( Hb::BackAction );
+
+ //
+ // Press "back" key means going back to previous view if it's avaiable
+ //
+ connect( mActionBack, SIGNAL( triggered() ), mController->view(), SLOT( closePlaybackView() ) );
+ hbInstance->allMainWindows()[0]->addSoftKeyAction( Hb::SecondarySoftKey , mActionBack );
+
+ connect( mController->view()->menu(), SIGNAL( aboutToShow() ), this, SLOT( handleAboutToShow() ) );
+ connect( mController->view()->menu(), SIGNAL( aboutToHide() ), this, SLOT( handleAboutToHide() ) );
+
+ QGraphicsWidget *widget1 = mController->layoutLoader()->findWidget( QString( "title" ) );
+ mTitleLabel = qobject_cast<HbLabel*>( widget1 );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackStatusPaneControl::~QMPXVideoPlaybackStatusPaneControl()
+// -------------------------------------------------------------------------------------------------
+//
+QMPXVideoPlaybackStatusPaneControl::~QMPXVideoPlaybackStatusPaneControl()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackStatusPaneControl::QMPXVideoPlaybackStatusPaneControl"));
+
+ disconnect( mActionBack, SIGNAL( triggered() ), mController->view(), SLOT( closePlaybackView() ) );
+ disconnect( mActionBack, SIGNAL( triggered() ), this, SLOT( openFullScreenView() ) );
+ hbInstance->allMainWindows()[0]->removeSoftKeyAction( Hb::SecondarySoftKey , mActionBack );
+
+ disconnect( mController->view()->menu(), SIGNAL( aboutToShow() ), this, SLOT( handleAboutToShow() ) );
+ disconnect( mController->view()->menu(), SIGNAL( aboutToHide() ), this, SLOT( handleAboutToHide() ) );
+
+ mController->view()->menu()->close();
+
+ if ( mActionBack )
+ {
+ delete mActionBack;
+ mActionBack = NULL;
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackStatusPaneControl::setVisible()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackStatusPaneControl::setVisible( bool visible )
+{
+ mVisible = visible;
+
+ if ( mVisible )
+ {
+ mController->view()->showItems(
+ Hb::IndicatorItems | Hb::TitlePaneItem | Hb::SecondarySoftKeyItem | Hb::TitleBarItem );
+
+ if ( mController->viewMode() == EFullScreenView ||
+ mController->viewMode() == EDetailsView )
+ {
+ mTitleLabel->setVisible( true );
+ }
+ }
+ else
+ {
+ mController->view()->menu()->close();
+ mController->view()->hideItems( Hb::AllItems );
+
+ mTitleLabel->setVisible( false );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackStatusPaneControl::isVisible()
+// -------------------------------------------------------------------------------------------------
+//
+bool QMPXVideoPlaybackStatusPaneControl::isVisible()
+{
+ return mVisible;
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackStatusPaneControl::setVisibility()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackStatusPaneControl::setVisibility( TMPXPlaybackState state )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackStatusPaneControl::setVisibility()"));
+
+ switch( state )
+ {
+ case EPbStatePlaying:
+ case EPbStatePaused:
+ {
+ setMenu( mController->fileDetails() );
+ break;
+ }
+ case EPbStatePluginSeeking:
+ case EPbStateBuffering:
+ case EPbStateNotInitialised:
+ case EPbStateInitialising:
+ {
+ mController->view()->menu()->clearActions();
+ break;
+ }
+ }
+
+ QMPXVideoPlaybackFullScreenControl::setVisibility( state );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackStatusPaneControl::updateControlsWithFileDetails()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackStatusPaneControl::updateControlsWithFileDetails(
+ QMPXVideoPlaybackViewFileDetails* details )
+{
+ 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 )
+ {
+ 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() ) );
+ }
+
+ setMenu( details );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackStatusPaneControl::setMenu()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackStatusPaneControl::setMenu( QMPXVideoPlaybackViewFileDetails* details )
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackStatusPaneControl::setMenu()"));
+
+ //
+ // Set menu
+ //
+ mController->view()->menu()->clearActions();
+
+ if ( ! details->mTvOutConnected || ! details->mTvOutPlayAllowed )
+ {
+ if ( details->mVideoEnabled && mController->viewMode() != EDetailsView )
+ {
+ mController->view()->menu()->addAction( tr( "Subtitle" ) );
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackStatusPaneControl::handleAboutToShow()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackStatusPaneControl::handleAboutToShow()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackStatusPaneControl::handleAboutToShow()"));
+
+ mController->resetDisappearingTimers( EMPXTimerCancel );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackStatusPaneControl::handleAboutToHide()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackStatusPaneControl::handleAboutToHide()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackStatusPaneControl::handleAboutToHide()"));
+
+ mController->resetDisappearingTimers( EMPXTimerReset );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackStatusPaneControl::controlListUpdated()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackStatusPaneControl::controlListUpdated(
+ QMPXVideoPlaybackViewFileDetails* details )
+{
+ setMenu( details );
+}
+
+// -------------------------------------------------------------------------------------------------
+// QMPXVideoPlaybackStatusPaneControl::openFullScreenView()
+// -------------------------------------------------------------------------------------------------
+//
+void QMPXVideoPlaybackStatusPaneControl::openFullScreenView()
+{
+ MPX_DEBUG(_L("QMPXVideoPlaybackStatusPaneControl::openFullScreenView()"));
+
+ mController->changeViewMode( EFullScreenView );
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/inc/mpxvideoplaybackviewfiledetails.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* 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: MPX Video File Details (QT)
+*
+*/
+
+// Version : %version: 3 %
+
+
+
+
+#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/resources/hblistwidget.css Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,7 @@
+HbListViewItem::text-1{
+ color: white;
+}
+
+HbListViewItem::text-2{
+ color: white;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/resources/hbvideoplaybackview.docml Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,318 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<hbdocument version="0.8">
+ <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"/>
+ <sizehint height="50" type="PREFERRED" width="150"/>
+ <sizehint height="50" type="MINIMUM" width="120"/>
+ <bool name="visible" value="FALSE"/>
+ </widget>
+ <widget name="stretchButton" type="HbPushButton">
+ <icon iconName=":/hbvideoplaybackview/images/stretch.png" 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"/>
+ </widget>
+ <widget name="zoomButton" type="HbPushButton">
+ <icon iconName=":/hbvideoplaybackview/images/zoom.png" name="icon"/>
+ <real name="z" value="2"/>
+ <sizehint height="50" type="PREFERRED" width="150"/>
+ <sizehint height="50" type="MINIMUM" width="120"/>
+ </widget>
+ <real name="z" value="0"/>
+ <sizehint height="150" type="PREFERRED" width="150"/>
+ <sizehint height="52" type="MINIMUM" width="120"/>
+ <layout type="stacked">
+ <stackitem itemname="naturalButton"/>
+ <stackitem itemname="stretchButton"/>
+ <stackitem itemname="zoomButton"/>
+ </layout>
+ </widget>
+ <widget name="rwButton" type="HbPushButton">
+ <icon iconName=":/hbvideoplaybackview/images/previous.png" name="icon"/>
+ <sizehint height="50" type="PREFERRED" width="150"/>
+ <sizehint height="50" type="MINIMUM" width="120"/>
+ </widget>
+ <widget name="playPauseButtons" type="HbWidget">
+ <widget name="playButton" type="HbPushButton">
+ <icon iconName=":/hbvideoplaybackview/images/play.png" 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"/>
+ </widget>
+ <widget name="pauseButton" type="HbPushButton">
+ <icon iconName=":/hbvideoplaybackview/images/pause.png" name="icon"/>
+ <sizehint height="50" type="PREFERRED" width="150"/>
+ <sizehint height="50" type="MINIMUM" width="120"/>
+ </widget>
+ <real name="z" value="0"/>
+ <sizehint height="150" type="PREFERRED" width="150"/>
+ <sizehint height="52" type="MINIMUM" width="120"/>
+ <layout type="stacked">
+ <stackitem itemname="playButton"/>
+ <stackitem itemname="pauseButton"/>
+ </layout>
+ </widget>
+ <widget name="ffButton" type="HbPushButton">
+ <icon iconName=":/hbvideoplaybackview/images/next.png" name="icon"/>
+ <real name="z" value="7"/>
+ <sizehint height="50" type="PREFERRED" width="150"/>
+ <sizehint height="50" type="MINIMUM" width="120"/>
+ </widget>
+ <widget name="detailsButton" type="HbPushButton">
+ <icon iconName=":/hbvideoplaybackview/images/details.png" name="icon"/>
+ <sizehint height="50" type="PREFERRED" width="150"/>
+ <sizehint height="50" type="MINIMUM" width="120"/>
+ </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">
+ <linearitem itemname="aspectRatioButtons"/>
+ <linearitem itemname="rwButton"/>
+ <linearitem itemname="playPauseButtons"/>
+ <linearitem itemname="ffButton"/>
+ <linearitem itemname="detailsButton"/>
+ </layout>
+ </widget>
+ <widget name="progressBarLayout" type="HbWidget">
+ <widget name="positionLabel" type="HbLabel">
+ <enums name="alignment" value="AlignRight|AlignVCenter|AlignTrailing"/>
+ <real name="z" value="0"/>
+ <sizehint height="30" type="PREFERRED" width="30"/>
+ <string name="textColor" value="#0000ff"/>
+ </widget>
+ <widget name="progressSlider" type="HbProgressBar">
+ <integer name="progressValue" value="0"/>
+ <real name="z" value="1"/>
+ <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"/>
+ <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"/>
+ <bool name="visible" value="FALSE"/>
+ <layout orientation="Horizontal" type="linear">
+ <linearitem itemname="positionLabel"/>
+ <linearitem itemname="progressSlider"/>
+ <linearitem itemname="durationLabel"/>
+ </layout>
+ </widget>
+ <widget name="bufferingIcon" type="HbLabel">
+ <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
+ <icon iconName=":/hbvideoplaybackview/images/connecting_loading.gif" name="icon"/>
+ <real name="z" value="5"/>
+ <sizehint height="57" type="PREFERRED" width="63"/>
+ <bool name="visible" value="FALSE"/>
+ </widget>
+ <widget name="fileDetailsLayout" type="HbWidget">
+ <widget name="fileDetailsRatingSlider" type="HbRatingSlider">
+ <integer name="currentRating" value="3"/>
+ <sizehint height="30" type="PREFERRED" width="200"/>
+ <contentsmargins bottom="3" left="0" right="3" top="3"/>
+ </widget>
+ <widget name="fileDetails" type="HbListWidget"/>
+ <real name="z" value="2"/>
+ <sizehint height="193" type="PREFERRED" width="320"/>
+ <bool name="visible" value="FALSE"/>
+ <layout orientation="Vertical" type="linear">
+ <contentsmargins bottom="9px" left="9px" right="9px" top="9px"/>
+ <linearitem itemname="fileDetails"/>
+ <linearitem itemname="fileDetailsRatingSlider"/>
+ </layout>
+ </widget>
+ <widget name="volumeSlider" type="HbLabel">
+ <real name="z" value="3"/>
+ <sizehint height="179" type="PREFERRED" width="79"/>
+ <bool name="visible" value="FALSE"/>
+ </widget>
+ <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"/>
+ <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"/>
+ <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"/>
+ <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"/>
+ <bool name="visible" value="FALSE"/>
+ </widget>
+ <real name="z" value="1"/>
+ <sizepolicy horizontalPolicy="Preferred" horizontalStretch="0" verticalPolicy="Preferred" verticalStretch="0"/>
+ <sizehint height="193" type="PREFERRED" width="320"/>
+ <sizehint height="18" type="MINIMUM" width="18"/>
+ <sizehint height="16777215" type="MAXIMUM" width="16777215"/>
+ <bool name="visible" value="FALSE"/>
+ <layout type="stacked">
+ <stackitem itemname="audioOnlyBitmap"/>
+ <stackitem itemname="partialAudioOnlyBitmap"/>
+ <stackitem itemname="realAudioOnlyBitmap"/>
+ <stackitem itemname="tvOutBitmap"/>
+ </layout>
+ </widget>
+ <widget name="detailsPlaybackWindow" type="HbWidget">
+ <widget name="small_transparentWindow" type="HbTransparentWindow">
+ <widget name="detailsViewPlayButton" type="HbPushButton">
+ <icon iconName=":/hbvideoplaybackview/images/play.png" name="icon"/>
+ <real name="z" value="2"/>
+ <sizehint height="229" type="PREFERRED" width="320"/>
+ <contentsmargins bottom="80" left="120" right="120" top="80"/>
+ </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"/>
+ </layout>
+ </widget>
+ <widget name="starRatingSlider" type="HbRatingSlider">
+ <integer name="currentRating" value="3"/>
+ <real name="z" value="1"/>
+ <sizehint height="40" type="PREFERRED" width="320"/>
+ </widget>
+ <real name="z" value="4"/>
+ <sizehint height="160" type="PREFERRED" width="80"/>
+ <bool name="visible" value="FALSE"/>
+ <layout orientation="Vertical" type="linear">
+ <contentsmargins bottom="0px" left="0px" right="0px" top="0px"/>
+ <linearitem itemname="small_transparentWindow"/>
+ <linearitem itemname="starRatingSlider"/>
+ </layout>
+ </widget>
+ <widget name="title" type="HbLabel">
+ <enums name="alignment" value="AlignVCenter|AlignHCenter"/>
+ <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"/>
+ <bool name="visible" value="FALSE"/>
+ <layout type="anchor"/>
+ </widget>
+ <size height="360" name="size" width="640"/>
+ <real name="z" value="1"/>
+ <rect height="360" name="geometry" width="640" x="-140" y="140"/>
+ <sizehint height="524287" type="MAXIMUM" width="524287"/>
+ <layout type="anchor">
+ <anchoritem dst="buttonBarLayout" dstEdge="LEFT" spacing="0" src="" srcEdge="LEFT"/>
+ <anchoritem dst="buttonBarLayout" dstEdge="RIGHT" spacing="0" src="" srcEdge="RIGHT"/>
+ <anchoritem dst="buttonBarLayout" dstEdge="BOTTOM" spacing="0" src="" srcEdge="BOTTOM"/>
+ <anchoritem dst="progressBarLayout" dstEdge="LEFT" spacing="0" src="" srcEdge="LEFT"/>
+ <anchoritem dst="progressBarLayout" dstEdge="RIGHT" spacing="0" src="" srcEdge="RIGHT"/>
+ <anchoritem dst="progressBarLayout" dstEdge="BOTTOM" spacing="0" src="buttonBarLayout" srcEdge="TOP"/>
+ <anchoritem dst="bufferingIcon" dstEdge="CENTERH" spacing="0" src="" srcEdge="CENTERH"/>
+ <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="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="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"/>
+ <anchoritem dst="detailsPlaybackWindow" dstEdge="BOTTOM" spacing="0" src="" srcEdge="BOTTOM"/>
+ <anchoritem dst="transparentWindow" dstEdge="LEFT" spacing="0" src="" srcEdge="LEFT"/>
+ <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"/>
+ </layout>
+ </widget>
+ <section name="detailsView">
+ <widget name="fileDetailsRatingSlider" type="HbRatingSlider">
+ <sizehint height="0" type="PREFERRED" width="200"/>
+ <bool name="visible" value="FALSE"/>
+ </widget>
+ <widget name="fileDetailsLayout" type="HbWidget">
+ <sizehint height="262" type="PREFERRED" width="320"/>
+ </widget>
+ <widget name="content" type="HbWidget">
+ <layout type="anchor">
+ <anchoritem dst="fileDetailsLayout" dstEdge="TOP" spacing="0" src="title" srcEdge="BOTTOM"/>
+ <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="0" src="" srcEdge="BOTTOM"/>
+ </layout>
+ </widget>
+ </section>
+ <section name="audioOnlyViewWithLocalPlayback">
+ <widget name="fileDetailsRatingSlider" type="HbRatingSlider">
+ <sizehint height="30" type="PREFERRED" width="200"/>
+ <bool name="visible" value="TRUE"/>
+ </widget>
+ <widget name="fileDetailsLayout" type="HbWidget">
+ <sizehint height="179" 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="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"/>
+ </layout>
+ </widget>
+ </section>
+ <section name="audioOnlyViewWithNonLocalPlayback">
+ <widget name="fileDetailsRatingSlider" type="HbRatingSlider">
+ <sizehint height="0" type="PREFERRED" width="200"/>
+ <bool name="visible" value="FALSE"/>
+ </widget>
+ <widget name="fileDetailsLayout" type="HbWidget">
+ <sizehint height="179" 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="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"/>
+ </layout>
+ </widget>
+ </section>
+ <section name="nonLocalPlayback">
+ <widget name="starRatingSlider" type="HbRatingSlider">
+ <sizehint height="0" type="PREFERRED" width="320"/>
+ <bool name="visible" value="FALSE"/>
+ </widget>
+ </section>
+ <metadata activeUIState="Common ui state" display="QHD landscape" unit="px">
+ <resource location="hbvideoplaybackview.qrc"/>
+ <uistate name="Common ui state" sections="#common"/>
+ </metadata>
+</hbdocument>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/resources/hbvideoplaybackview.qrc Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,21 @@
+<?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/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>hbvideoplaybackview.docml</file>
+ <file>hblistwidget.css</file>
+ </qresource>
+</RCC>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testmpxvideoviewwrapper/stub/inc/mpxvideoplaybackviewfiledetails.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* 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: MPX Video File Details (QT)
+*
+*/
+
+// Version : %version: 3 %
+
+
+
+
+#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/testmpxvideoviewwrapper/stub/src/mpxvideoplaybackviewfiledetails.cpp Thu Apr 01 22:38:49 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: class for MPX Video File Details (Qt)
+*
+*/
+
+// Version : %version: 3 %
+
+
+
+//
+// INCLUDE FILES
+//
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackviewfiledetails.h"
+
+
+// ============================ MEMBER FUNCTIONS ===================================================
+
+QMPXVideoPlaybackViewFileDetails::QMPXVideoPlaybackViewFileDetails()
+{
+ clearFileDetails();
+}
+
+QMPXVideoPlaybackViewFileDetails::~QMPXVideoPlaybackViewFileDetails()
+{
+ clearFileDetails();
+}
+
+void
+QMPXVideoPlaybackViewFileDetails::clearFileDetails()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackViewFileDetails::ClearFileDetails()"));
+
+ mMimeType = tr("");
+ mTitle = tr("");
+ mArtist = tr("");
+ mDescription = tr("");
+ mLocation = tr("");
+ mCopyright = tr("");
+ mLanguage = tr("");
+ mKeywords = tr("");
+
+ mClipName = QString("testClip.3gp");
+
+ mPlaybackMode = EMPXVideoLocal;
+ mSeekable = false;
+ mPausableStream = false;
+ mAudioEnabled = true;
+ mVideoEnabled = false;
+ mPartialPlayback = false;
+ mRNFormat = false;
+
+ mDuration = 0;
+ mTvOutConnected = false;
+ mTvOutPlayAllowed = true;
+ mDrmProtected = false;
+ mMultiItemPlaylist = false;
+
+ mVideoHeight = 0;
+ mVideoWidth = 0;
+ mBitRate = 0;
+}
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testuserinputhandler/inc/testuserinputhandler.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,83 @@
+/**
+* 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 User Input Handler
+*
+*/
+
+#ifndef __TESTUSERINPUTHANDLER_H__
+#define __TESTUSERINPUTHANDLER_H__
+
+
+// INCLUDES
+#include <QtTest/QtTest>
+
+
+
+// forward declaration
+class CMPXVideoViewWrapper;
+class CMPXVideoPlaybackUserInputHandler;
+class HbVideoBasePlaybackView;
+
+
+class TestUserInputHandler : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ void init();
+
+ void cleanup();
+
+ void setup();
+
+
+ // test functions for the test framework
+private slots:
+
+ void testProcessMediaKeyPlay();
+
+ void testProcessMediaKeyPause();
+
+ void testProcessMediaKeyPlayPause();
+
+ void testProcessMediaKeyStop();
+
+ void testProcessMediaKeyForward();
+
+ void testProcessMediaKeyRewind();
+
+ void testProcessMediaKeyVolumeUp();
+
+ void testProcessMediaKeyVolumeDown();
+
+ void testHandleTVOutEventL();
+
+
+signals:
+
+private:
+ CMPXVideoPlaybackUserInputHandler* mUserInputHdlr;
+ HbVideoBasePlaybackView* mBaseVideoView;
+ CMPXVideoViewWrapper* mVideoViewWrapper;
+
+};
+
+
+#endif // __TESTUSERINPUTHANDLER_H__
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testuserinputhandler/src/testuserinputhandler.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,323 @@
+/**
+* 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 User Input Handler
+*
+*/
+
+#include <e32err.h>
+#include <w32std.h>
+#include <eikenv.h>
+
+#include <hbapplication.h>
+#include <hbinstance.h>
+#include <QDebug>
+
+#include "testuserinputhandler.h"
+#include "../stub/inc/mpxvideoviewwrapper.h"
+#include "../stub/inc/hbvideobaseplaybackview.h"
+
+#define private public
+#include "mpxvideoplaybackuserinputhandler.h"
+#undef private
+
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ HbApplication app(argc, argv);
+ HbMainWindow window;
+
+ TestUserInputHandler tv;
+
+ char *pass[3];
+ pass[0] = argv[0];
+ pass[1] = "-o";
+ pass[2] = "c:\\data\\TestUserInputHandler.txt";
+
+ int res = QTest::qExec(&tv, 3, pass);
+
+ return res;
+}
+
+
+// ---------------------------------------------------------------------------
+// init
+// ---------------------------------------------------------------------------
+//
+void TestUserInputHandler::init()
+{
+ mBaseVideoView = new HbVideoBasePlaybackView();
+ mVideoViewWrapper = CMPXVideoViewWrapper::NewL( mBaseVideoView );
+
+ mUserInputHdlr = CMPXVideoPlaybackUserInputHandler::NewL(mVideoViewWrapper, false);
+}
+
+// ---------------------------------------------------------------------------
+// cleanup
+// ---------------------------------------------------------------------------
+//
+void TestUserInputHandler::cleanup()
+{
+ delete mUserInputHdlr;
+ mUserInputHdlr = NULL;
+
+ delete mVideoViewWrapper;
+ mVideoViewWrapper = NULL;
+
+ delete mBaseVideoView;
+ mBaseVideoView = NULL;
+}
+
+// ---------------------------------------------------------------------------
+// setup
+// ---------------------------------------------------------------------------
+//
+void TestUserInputHandler::setup()
+{
+}
+
+void TestUserInputHandler::testProcessMediaKeyPlay()
+{
+ init();
+
+ mUserInputHdlr->iProcessingInputType = EMpxVideoNone;
+
+ mUserInputHdlr->ProcessMediaKey(ERemConCoreApiPlay, ERemConCoreApiButtonPress);
+ QVERIFY( mUserInputHdlr->iProcessingInputType == EMpxVideoMediaKeys );
+
+ // this event should be ignored as the 1st event is still being processed
+ mUserInputHdlr->ProcessMediaKey(ERemConCoreApiPause, ERemConCoreApiButtonPress);
+
+ // verify that "Play" is still being processed and not "Pause"
+ QVERIFY( mUserInputHdlr->iLastMediaKeyPressed == ERemConCoreApiPlay );
+
+ // send the release event for "Play"
+ mUserInputHdlr->ProcessMediaKey(ERemConCoreApiPlay, ERemConCoreApiButtonRelease);
+
+ // verify that no input is now being processed
+ QVERIFY( mUserInputHdlr->iProcessingInputType == EMpxVideoNone );
+
+ cleanup();
+}
+
+void TestUserInputHandler::testProcessMediaKeyPause()
+{
+ init();
+
+ mUserInputHdlr->iProcessingInputType = EMpxVideoNone;
+
+ // Issue Play
+ mUserInputHdlr->ProcessMediaKey(ERemConCoreApiPlay, ERemConCoreApiButtonPress);
+ mUserInputHdlr->ProcessMediaKey(ERemConCoreApiPlay, ERemConCoreApiButtonRelease);
+ QVERIFY( mUserInputHdlr->iProcessingInputType == EMpxVideoNone );
+
+ // Initiate Pause
+ mUserInputHdlr->ProcessMediaKey(ERemConCoreApiPause, ERemConCoreApiButtonPress);
+ QVERIFY( mUserInputHdlr->iProcessingInputType == EMpxVideoMediaKeys );
+ QVERIFY( mUserInputHdlr->iLastMediaKeyPressed == ERemConCoreApiPause );
+
+ mUserInputHdlr->ProcessMediaKey(ERemConCoreApiPause, ERemConCoreApiButtonRelease);
+ QVERIFY( mUserInputHdlr->iProcessingInputType == EMpxVideoNone );
+
+ cleanup();
+
+}
+
+void TestUserInputHandler::testProcessMediaKeyPlayPause()
+{
+ init();
+
+ mUserInputHdlr->iProcessingInputType = EMpxVideoNone;
+
+ mUserInputHdlr->ProcessMediaKey(ERemConCoreApiPausePlayFunction, ERemConCoreApiButtonClick);
+ QVERIFY( mUserInputHdlr->iProcessingInputType == EMpxVideoNone );
+
+ // set to background
+ mUserInputHdlr->iForeground = false;
+
+ mUserInputHdlr->iLastMediaKeyPressed = ENop;
+ // this event should be ignored as iForeground is false
+ mUserInputHdlr->ProcessMediaKey(ERemConCoreApiPausePlayFunction, ERemConCoreApiButtonPress);
+ QVERIFY( mUserInputHdlr->iLastMediaKeyPressed == ENop );
+ QVERIFY( mUserInputHdlr->iProcessingInputType == EMpxVideoNone );
+
+ cleanup();
+}
+
+void TestUserInputHandler::testProcessMediaKeyStop()
+{
+ init();
+
+ mUserInputHdlr->iProcessingInputType = EMpxVideoNone;
+
+ // Issue Play
+ mUserInputHdlr->ProcessMediaKey(ERemConCoreApiPlay, ERemConCoreApiButtonPress);
+ mUserInputHdlr->ProcessMediaKey(ERemConCoreApiPlay, ERemConCoreApiButtonRelease);
+ QVERIFY( mUserInputHdlr->iProcessingInputType == EMpxVideoNone );
+
+ // Stop
+ mUserInputHdlr->ProcessMediaKey(ERemConCoreApiStop, ERemConCoreApiButtonPress);
+ QVERIFY( mUserInputHdlr->iProcessingInputType == EMpxVideoMediaKeys );
+ QVERIFY( mUserInputHdlr->iLastMediaKeyPressed == ERemConCoreApiStop );
+
+ mUserInputHdlr->ProcessMediaKey(ERemConCoreApiStop, ERemConCoreApiButtonRelease);
+ QVERIFY( mUserInputHdlr->iProcessingInputType == EMpxVideoNone );
+
+ cleanup();
+}
+
+void TestUserInputHandler::testProcessMediaKeyForward()
+{
+ init();
+
+ mUserInputHdlr->iProcessingInputType = EMpxVideoNone;
+
+ // Issue Play
+ mUserInputHdlr->ProcessMediaKey(ERemConCoreApiPlay, ERemConCoreApiButtonPress);
+ mUserInputHdlr->ProcessMediaKey(ERemConCoreApiPlay, ERemConCoreApiButtonRelease);
+ QVERIFY( mUserInputHdlr->iProcessingInputType == EMpxVideoNone );
+
+ // Forward
+ mUserInputHdlr->ProcessMediaKey(ERemConCoreApiFastForward, ERemConCoreApiButtonPress);
+ QVERIFY( mUserInputHdlr->iProcessingInputType == EMpxVideoMediaKeys );
+ QVERIFY( mUserInputHdlr->iLastMediaKeyPressed == ERemConCoreApiFastForward );
+
+ mUserInputHdlr->ProcessMediaKey(ERemConCoreApiFastForward, ERemConCoreApiButtonRelease);
+ QVERIFY( mUserInputHdlr->iProcessingInputType == EMpxVideoNone );
+
+ cleanup();
+}
+
+void TestUserInputHandler::testProcessMediaKeyRewind()
+{
+ init();
+
+ mUserInputHdlr->iProcessingInputType = EMpxVideoNone;
+
+ // Issue Play
+ mUserInputHdlr->ProcessMediaKey(ERemConCoreApiPlay, ERemConCoreApiButtonPress);
+ mUserInputHdlr->ProcessMediaKey(ERemConCoreApiPlay, ERemConCoreApiButtonRelease);
+ QVERIFY( mUserInputHdlr->iProcessingInputType == EMpxVideoNone );
+
+ // Forward
+ mUserInputHdlr->ProcessMediaKey(ERemConCoreApiFastForward, ERemConCoreApiButtonPress);
+ QVERIFY( mUserInputHdlr->iProcessingInputType == EMpxVideoMediaKeys );
+ QVERIFY( mUserInputHdlr->iLastMediaKeyPressed == ERemConCoreApiFastForward );
+
+ mUserInputHdlr->ProcessMediaKey(ERemConCoreApiFastForward, ERemConCoreApiButtonRelease);
+ QVERIFY( mUserInputHdlr->iProcessingInputType == EMpxVideoNone );
+
+ // Rewind
+ mUserInputHdlr->ProcessMediaKey(ERemConCoreApiRewind, ERemConCoreApiButtonPress);
+ QVERIFY( mUserInputHdlr->iProcessingInputType == EMpxVideoMediaKeys );
+ QVERIFY( mUserInputHdlr->iLastMediaKeyPressed == ERemConCoreApiRewind );
+
+ mUserInputHdlr->ProcessMediaKey(ERemConCoreApiRewind, ERemConCoreApiButtonRelease);
+ QVERIFY( mUserInputHdlr->iProcessingInputType == EMpxVideoNone );
+
+ cleanup();
+}
+
+void TestUserInputHandler::testProcessMediaKeyVolumeUp()
+{
+ init();
+
+ mUserInputHdlr->iProcessingInputType = EMpxVideoNone;
+
+ // Issue Play
+ mUserInputHdlr->ProcessMediaKey(ERemConCoreApiPlay, ERemConCoreApiButtonPress);
+ mUserInputHdlr->ProcessMediaKey(ERemConCoreApiPlay, ERemConCoreApiButtonRelease);
+ QVERIFY( mUserInputHdlr->iProcessingInputType == EMpxVideoNone );
+
+ // Volume Up
+ mUserInputHdlr->ProcessMediaKey(ERemConCoreApiVolumeUp, ERemConCoreApiButtonPress);
+ QVERIFY( mUserInputHdlr->iProcessingInputType == EMpxVideoMediaKeys );
+ QVERIFY( mUserInputHdlr->iLastMediaKeyPressed == ERemConCoreApiVolumeUp );
+ QVERIFY( mUserInputHdlr->iVolumeRepeatTimer->IsActive() );
+ QVERIFY( mUserInputHdlr->iVolumeRepeatUp );
+
+ mUserInputHdlr->ProcessMediaKey(ERemConCoreApiVolumeUp, ERemConCoreApiButtonRelease);
+ QVERIFY( mUserInputHdlr->iProcessingInputType == EMpxVideoNone );
+ QVERIFY( ! mUserInputHdlr->iVolumeRepeatTimer->IsActive() );
+
+ cleanup();
+}
+
+void TestUserInputHandler::testProcessMediaKeyVolumeDown()
+{
+ init();
+
+ mUserInputHdlr->iProcessingInputType = EMpxVideoNone;
+
+ // Issue Play
+ mUserInputHdlr->ProcessMediaKey(ERemConCoreApiPlay, ERemConCoreApiButtonPress);
+ mUserInputHdlr->ProcessMediaKey(ERemConCoreApiPlay, ERemConCoreApiButtonRelease);
+ QVERIFY( mUserInputHdlr->iProcessingInputType == EMpxVideoNone );
+
+ // Volume Down
+ mUserInputHdlr->ProcessMediaKey(ERemConCoreApiVolumeDown, ERemConCoreApiButtonPress);
+ QVERIFY( mUserInputHdlr->iProcessingInputType == EMpxVideoMediaKeys );
+ QVERIFY( mUserInputHdlr->iLastMediaKeyPressed == ERemConCoreApiVolumeDown );
+ QVERIFY( mUserInputHdlr->iVolumeRepeatTimer->IsActive() );
+ QVERIFY( ! mUserInputHdlr->iVolumeRepeatUp );
+
+ mUserInputHdlr->ProcessMediaKey(ERemConCoreApiVolumeDown, ERemConCoreApiButtonRelease);
+ QVERIFY( mUserInputHdlr->iProcessingInputType == EMpxVideoNone );
+ QVERIFY( ! mUserInputHdlr->iVolumeRepeatTimer->IsActive() );
+
+ cleanup();
+}
+
+void TestUserInputHandler::testHandleTVOutEventL()
+{
+
+ ///////////////////////////////
+ // 1. HandleTVOutEventL(true)
+ ///////////////////////////////
+ init();
+
+ mUserInputHdlr->iDisplayTimeOut = 0;
+
+ mUserInputHdlr->HandleTVOutEventL(true);
+
+ QVERIFY( mUserInputHdlr->iDisplayTimeOut != 0 );
+ QVERIFY( mUserInputHdlr->iDisplayTimer->IsActive() );
+
+ cleanup();
+
+
+ ///////////////////////////////
+ // 2. HandleTVOutEventL(false)
+ ///////////////////////////////
+ init();
+
+ mUserInputHdlr->iDisplayTimeOut = 0;
+
+ mUserInputHdlr->HandleTVOutEventL(false);
+ QVERIFY( ! mUserInputHdlr->iDisplayTimer->IsActive() );
+
+ cleanup();
+
+}
+
+
+
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testuserinputhandler/stub/inc/centralrepository.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,34 @@
+// Copyright (c) 2004-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 declaration for central repository
+//
+
+#ifndef __CENTRALREPOSITORY_H__
+#define __CENTRALREPOSITORY_H__
+
+#include <e32base.h>
+
+
+class CRepository : public CBase
+ {
+public:
+
+ static CRepository* NewLC(TUid aRepositoryUid);
+
+ virtual ~CRepository();
+
+ TInt Get(TUint32 aKey, TInt& aValue);
+
+ };
+
+#endif // __CENTRALREPOSITORY_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testuserinputhandler/stub/inc/hal.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* 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 declaration for HAL
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#ifndef __HAL_H__
+#define __HAL_H__
+
+#include <e32base.h>
+#include <e32std.h>
+
+class HAL : public CBase
+ {
+
+public:
+
+ static TInt Get(TAttribute aAttribute, TInt& aValue);
+
+
+ static TInt Set(TAttribute aAttribute, TInt aValue);
+
+
+ };
+
+
+#endif
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testuserinputhandler/stub/inc/hbvideobaseplaybackview.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 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 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();
+
+ RWindow *getWindow();
+
+ virtual void doClosePlayer();
+
+ public:
+ int mCurrentError; // default = KErrNone
+ bool mViewActive;
+
+
+ public:
+ friend class CMPXVideoViewWrapper;
+
+};
+
+#endif // __HBVIDEOBASEPLAYBACKVIEW_H__
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testuserinputhandler/stub/inc/mpxvideoplaybackviewfiledetails.h Thu Apr 01 22:38:49 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: 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;
+
+ 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/testuserinputhandler/stub/inc/mpxvideoviewwrapper.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,88 @@
+/*
+* 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();
+
+ private:
+ CMPXVideoViewWrapper( HbVideoBasePlaybackView* aView );
+ void ConstructL();
+
+ void SetFileDetails(TBool aDefault);
+
+ public:
+ void HandleCommandL( TInt aCommand );
+
+ TBool IsLive();
+
+ TBool IsPlaylist();
+
+ TBool IsMultiItemPlaylist();
+
+ void RequestMediaL();
+
+ void CreateGeneralPlaybackCommandL( int aCmd );
+
+ void ActivateClosePlayerActiveObject();
+
+ void IssueVideoAppForegroundCmdL( TBool aForeground );
+
+ void UpdateVideoRectDone();
+
+
+ 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/testuserinputhandler/stub/src/centralrepository.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* 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 implementation for central repository
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+//
+// INCLUDE FILES
+//
+#include "centralrepository.h"
+
+
+CRepository* CRepository::NewLC( TUid aRepositoryUid )
+{
+ CRepository* self = new (ELeave) CRepository();
+
+ CleanupStack::PushL( self );
+
+ return self;
+}
+
+
+TInt CRepository::Get(TUint32 aKey, TInt& aValue)
+{
+ aValue = 10;
+ return KErrNone;
+}
+
+CRepository::~CRepository()
+{
+}
+
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testuserinputhandler/stub/src/hal.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,40 @@
+/*
+* 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 implementation for HAL
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+//
+// INCLUDE FILES
+//
+#include "hal.h"
+
+
+TInt HAL::Get(TAttribute /*aAttribute*/, TInt& aValue)
+{
+ aValue = 5;
+ return KErrNone;
+}
+
+TInt HAL::Set(TAttribute /*aAttribute*/, TInt /*aValue*/)
+{
+ return KErrNone;
+}
+
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testuserinputhandler/stub/src/hbvideobaseplaybackview.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,190 @@
+/*
+* 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: 1 %
+
+
+
+// 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 )
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// 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::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/testuserinputhandler/stub/src/mpxvideoplaybackviewfiledetails.cpp Thu Apr 01 22:38:49 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: class for MPX Video File Details (Qt)
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+//
+// INCLUDE FILES
+//
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackviewfiledetails.h"
+
+
+// ============================ MEMBER FUNCTIONS ===================================================
+
+QMPXVideoPlaybackViewFileDetails::QMPXVideoPlaybackViewFileDetails()
+{
+ clearFileDetails();
+}
+
+QMPXVideoPlaybackViewFileDetails::~QMPXVideoPlaybackViewFileDetails()
+{
+ clearFileDetails();
+}
+
+void
+QMPXVideoPlaybackViewFileDetails::clearFileDetails()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackViewFileDetails::ClearFileDetails()"));
+
+ mMimeType = tr("");
+ mTitle = tr("");
+ mArtist = tr("");
+ mClipName = QString("testClip.3gp");
+
+ mPlaybackMode = EMPXVideoLocal;
+ mSeekable = false;
+ mPausableStream = false;
+ mAudioEnabled = true;
+ mVideoEnabled = false;
+ mPartialPlayback = false;
+ mRNFormat = false;
+
+ mDuration = 0;
+ mTvOutConnected = false;
+ mTvOutPlayAllowed = true;
+ mDrmProtected = false;
+ mMultiItemPlaylist = false;
+
+ mVideoHeight = 0;
+ mVideoWidth = 0;
+ mBitRate = 0;
+}
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testuserinputhandler/stub/src/mpxvideoviewwrapper.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,230 @@
+/*
+* 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 base playback view
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+// Include Files
+
+#include "mpxvideoviewwrapper.h"
+#include "hbvideobaseplaybackview.h"
+#include "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::CreateGeneralPlaybackCommandL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::CreateGeneralPlaybackCommandL( int aCmd )
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// 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;
+
+ 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;
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::UpdateVideoRectDone()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::UpdateVideoRectDone()
+{
+}
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testuserinputhandler/testuserinputhandler.pro Thu Apr 01 22:38:49 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: Project file for building testuserinputhandler
+#
+#
+# Version : %version: 1 %
+
+TEMPLATE = app
+TARGET = testuserinputhandler
+CONFIG += qtestlib hb qt
+DEFINES += BUILD_VIDEOPLAYBACK_DLL
+
+DEPENDPATH += . \
+ inc \
+ src
+
+INCLUDEPATH += ../../../inc \
+ ../../../../inc \
+ ../../controlinc \
+
+
+LIBS += -lremconcoreapi.dll \
+ -lremconInterfacebase.dll
+
+
+# Input
+HEADERS += stub/inc/mpxvideoviewwrapper.h \
+ stub/inc/hbvideobaseplaybackview.h \
+ stub/inc/mpxvideoplaybackviewfiledetails.h \
+ stub/inc/hal.h \
+ stub/inc/centralrepository.h \
+ inc/testuserinputhandler.h \
+ ../../viewinc/mpxvideoplaybackuserinputhandler.h
+
+SOURCES += stub/src/mpxvideoviewwrapper.cpp \
+ stub/src/hbvideobaseplaybackview.cpp \
+ stub/src/mpxvideoplaybackviewfiledetails.cpp \
+ stub/src/hal.cpp \
+ stub/src/centralrepository.cpp \
+ src/testuserinputhandler.cpp \
+ ../../viewsrc/mpxvideoplaybackuserinputhandler.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideodisplayhandler/inc/testvideodisplayhandler.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,85 @@
+/**
+* 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 Video Display Handler
+*
+*/
+
+#ifndef __TESTVIDEODISPLAYHANDLER_H__
+#define __TESTVIDEODISPLAYHANDLER_H__
+
+
+// INCLUDES
+#include <QtTest/QtTest>
+
+// forward declaration
+class CMPXVideoPlaybackDisplayHandler;
+class MMPXPlaybackUtility;
+class HbVideoBasePlaybackView;
+class CMPXVideoViewWrapper;
+class QMPXVideoPlaybackViewFileDetails;
+
+
+class TestVideoDisplayHandler : 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:
+
+ // the order in which these testXX methods are declared is important
+ // changing this order will affect the test results
+ void testCreateDisplayWindowL();
+ void testRemoveDisplayWindow();
+ void testHandleSurfaceCreatedMessageL();
+ void testHandleSurfaceChangedMessageL();
+ void testHandleVideoRemovedMessageL();
+ void testSetAspectRatioL();
+ void testSetDefaultAspectRatioL();
+ void testUpdateVideoRectL();
+
+
+signals:
+
+private:
+ CMPXVideoPlaybackDisplayHandler* mDispHdlr;
+ MMPXPlaybackUtility* mPlaybackUtility;
+ HbVideoBasePlaybackView* mBaseVideoView;
+ CMPXVideoViewWrapper* mVideoViewWrapper;
+ QMPXVideoPlaybackViewFileDetails* mFileDetails;
+
+};
+
+
+#endif // __TESTVIDEODISPLAYHANDLER_H__
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideodisplayhandler/src/testvideodisplayhandler.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,257 @@
+/**
+* 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 Video Display Handler
+*
+*/
+
+#include <e32err.h>
+#include <w32std.h>
+#include <eikenv.h>
+
+#include <hbapplication.h>
+#include <hbinstance.h>
+#include <QDebug>
+
+#include <mpxplaybackutility.h>
+
+#include "testvideodisplayhandler.h"
+#include "../stub/inc/hbvideobaseplaybackview.h"
+#include "../stub/inc/mpxvideoplaybackviewfiledetails.h"
+#include "mpxvideoviewwrapper.h"
+
+#define private public
+#include "mpxvideoplaybackdisplayhandler.h"
+#undef private
+
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ HbApplication app(argc, argv);
+ HbMainWindow window;
+
+ TestVideoDisplayHandler tv;
+
+ char *pass[3];
+ pass[0] = argv[0];
+ pass[1] = "-o";
+ pass[2] = "c:\\data\\TestVideoDisplayHandler.txt";
+
+ int res = QTest::qExec(&tv, 3, pass);
+
+ return res;
+}
+
+
+// ---------------------------------------------------------------------------
+// init
+// ---------------------------------------------------------------------------
+//
+void TestVideoDisplayHandler::init()
+{
+ mPlaybackUtility = MMPXPlaybackUtility::UtilityL( KPbModeDefault );
+
+ mBaseVideoView = new HbVideoBasePlaybackView();
+ mVideoViewWrapper = CMPXVideoViewWrapper::NewL( mBaseVideoView );
+
+ mDispHdlr = CMPXVideoPlaybackDisplayHandler::NewL(mPlaybackUtility, mVideoViewWrapper);
+}
+
+// ---------------------------------------------------------------------------
+// cleanup
+// ---------------------------------------------------------------------------
+//
+void TestVideoDisplayHandler::cleanup()
+{
+ if ( mPlaybackUtility )
+ {
+ mPlaybackUtility->Close();
+ mPlaybackUtility = NULL;
+ }
+
+ delete mDispHdlr;
+ mDispHdlr = NULL;
+
+ delete mVideoViewWrapper;
+ mVideoViewWrapper = NULL;
+
+ delete mBaseVideoView;
+ mBaseVideoView = NULL;
+}
+
+// ---------------------------------------------------------------------------
+// setup
+// ---------------------------------------------------------------------------
+//
+void TestVideoDisplayHandler::setup()
+{
+ init();
+
+ RWindow *window = mBaseVideoView->getWindow();
+
+ TRect displayRect = TRect( window->Position().iX,
+ window->Position().iY,
+ window->Position().iX + window->Size().iWidth,
+ window->Position().iY + window->Size().iHeight );
+
+ mDispHdlr->CreateDisplayWindowL( CCoeEnv::Static()->WsSession(),
+ *(CCoeEnv::Static()->ScreenDevice()),
+ *window,
+ displayRect);
+
+ QCOMPARE( mDispHdlr->iWindowRect, displayRect);
+
+}
+
+
+void TestVideoDisplayHandler::testCreateDisplayWindowL()
+{
+ setup();
+
+ cleanup();
+}
+
+void TestVideoDisplayHandler::testRemoveDisplayWindow()
+{
+ setup();
+
+ mDispHdlr->RemoveDisplayWindow();
+
+ QVERIFY( mDispHdlr->iVideoContainer == NULL );
+
+ cleanup();
+}
+
+void TestVideoDisplayHandler::testHandleSurfaceCreatedMessageL()
+{
+ setup();
+
+ CMPXMessage* message = NULL;
+ TRAP_IGNORE
+ (
+ message = CMPXMessage::NewL();
+ message->SetTObjectValueL<TMPXVideoDisplayCommand>
+ ( KMPXMediaVideoDisplayCommand, EPbMsgVideoSurfaceCreated );
+ );
+
+ mDispHdlr->HandleVideoDisplayMessageL( message );
+
+ QVERIFY( ! mDispHdlr->iSurfaceId.IsNull() );
+
+ mDispHdlr->RemoveDisplayWindow();
+ cleanup();
+}
+
+void TestVideoDisplayHandler::testHandleSurfaceChangedMessageL()
+{
+ setup();
+
+ CMPXMessage* message = NULL;
+ TRAP_IGNORE
+ (
+ message = CMPXMessage::NewL();
+ message->SetTObjectValueL<TMPXVideoDisplayCommand>
+ ( KMPXMediaVideoDisplayCommand, EPbMsgVideoSurfaceChanged );
+ );
+
+ mDispHdlr->HandleVideoDisplayMessageL( message );
+
+ QVERIFY( ! mDispHdlr->iSurfaceId.IsNull() );
+
+ mDispHdlr->RemoveDisplayWindow();
+ cleanup();
+}
+
+void TestVideoDisplayHandler::testHandleVideoRemovedMessageL()
+{
+ setup();
+
+ CMPXMessage* message = NULL;
+ TRAP_IGNORE
+ (
+ message = CMPXMessage::NewL();
+ message->SetTObjectValueL<TMPXVideoDisplayCommand>
+ ( KMPXMediaVideoDisplayCommand, EPbMsgVideoSurfaceRemoved );
+ );
+
+ mDispHdlr->HandleVideoDisplayMessageL( message );
+
+ QVERIFY( mDispHdlr->iSurfaceId.IsNull() );
+
+ mDispHdlr->RemoveDisplayWindow();
+ cleanup();
+}
+
+void TestVideoDisplayHandler::testSetAspectRatioL()
+{
+ setup();
+
+ int aspectRatio = mDispHdlr->SetAspectRatioL( EPbCmdNaturalAspectRatio );
+
+ QVERIFY( aspectRatio == EMMFNatural );
+
+ mDispHdlr->RemoveDisplayWindow();
+ cleanup();
+}
+
+void TestVideoDisplayHandler::testSetDefaultAspectRatioL()
+{
+ setup();
+
+ mFileDetails = new QMPXVideoPlaybackViewFileDetails();
+ mFileDetails->mVideoHeight = 280;
+ mFileDetails->mVideoWidth = 600;
+
+ RWindow *window = mBaseVideoView->getWindow();
+
+ TRect displayRect = TRect( window->Position().iX,
+ window->Position().iY,
+ window->Position().iX + window->Size().iWidth,
+ window->Position().iY + window->Size().iHeight );
+
+ TReal displayAspectRatio = (TReal32)displayRect.Width() / (TReal32)displayRect.Height();
+
+ int aspectRatio = mDispHdlr->SetDefaultAspectRatioL( mFileDetails, displayAspectRatio );
+
+ QVERIFY( aspectRatio == EMMFZoom );
+
+ mDispHdlr->RemoveDisplayWindow();
+ cleanup();
+}
+
+void TestVideoDisplayHandler::testUpdateVideoRectL()
+{
+ setup();
+
+ RWindow *window = mBaseVideoView->getWindow();
+
+ TRect displayRect = TRect( 0, 0, 200, 300 );
+
+ mDispHdlr->UpdateVideoRectL( displayRect, false );
+
+ QCOMPARE( mDispHdlr->iWindowRect, displayRect);
+
+ mDispHdlr->RemoveDisplayWindow();
+ cleanup();
+}
+
+
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideodisplayhandler/stub/inc/alfcompositionutility.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,56 @@
+/*
+* 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 declaration for CAlfCompositionSource
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+// This file defines the API for .dll
+
+#ifndef __ALFCOMPOSITIONUTILITY_H__
+#define __ALFCOMPOSITIONUTILITY_H__
+
+// Include Files
+
+#include <e32base.h> // CBase
+#include <e32std.h> // TBuf
+
+
+class RWindow;
+
+
+// Class Definitions
+
+class CAlfCompositionSource : public CBase
+ {
+
+public:
+
+ static CAlfCompositionSource* NewL( RWindow& aClientWindow );
+
+ ~CAlfCompositionSource();
+
+ /**
+ * Enables / disables alpha on composition target
+ **/
+ TInt EnableAlpha( TBool aEnable = ETrue );
+
+ };
+
+#endif // #define __ALFCOMPOSITIONUTILITY_H__
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideodisplayhandler/stub/inc/hbvideobaseplaybackview.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 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 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();
+
+ RWindow *getWindow();
+
+ virtual void doClosePlayer();
+
+ public:
+ int mCurrentError; // default = KErrNone
+ bool mViewActive;
+
+
+ public:
+ friend class CMPXVideoViewWrapper;
+
+};
+
+#endif // __HBVIDEOBASEPLAYBACKVIEW_H__
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideodisplayhandler/stub/inc/mediaclientvideodisplay.h Thu Apr 01 22:38:49 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 declaration for CMediaClientVideoDisplay
+//
+
+
+#ifndef MEDIACLIENTVIDEODISPLAY_H
+#define MEDIACLIENTVIDEODISPLAY_H
+
+#include <w32std.h>
+#include <mmf/common/mmfvideosurfacecustomcommands.h>
+
+CMediaClientVideoDisplay : public CBase
+ {
+public:
+
+ static CMediaClientVideoDisplay* NewL(TInt aDisplayId);
+
+ ~CMediaClientVideoDisplay();
+
+ CMediaClientVideoDisplay();
+
+ void AddDisplayWindowL(const RWindowBase* aWindow, const TRect& aClipRect, const TRect& aCropRegion,
+ const TRect& aVideoExtent, TReal32 aScaleWidth, TReal32 aScaleHeight,
+ TVideoRotation aRotation, TAutoScaleType aAutoScaleType,
+ TInt aHorizPos, TInt aVertPos, RWindow* aWindow2);
+
+
+ void RemoveSurface();
+
+ TInt SurfaceCreated(const TSurfaceId& aSurfaceId, const TRect& aCropRect, TVideoAspectRatio aAspectRatio, const TRect& aCropRegion);
+
+ TInt SurfaceParametersChanged(const TSurfaceId& aSurfaceId, const TRect& aCropRect, TVideoAspectRatio aAspectRatio);
+
+ TInt RedrawWindows(const TRect& aCropRegion);
+
+ void SetVideoExtentL(const RWindowBase& aWindow, const TRect& aVideoExtent, const TRect& aCropRegion);
+
+ void SetAutoScaleL(TAutoScaleType aScaleType, TInt aHorizPos, TInt aVertPos, const TRect& aCropRegion);
+
+ };
+
+#endif // MEDIACLIENTVIDEODISPLAY_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideodisplayhandler/stub/inc/mpxvideocontainer.h Thu Apr 01 22:38:49 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:
+*
+*/
+
+// Version : %version: 1 %
+
+
+#ifndef CMPXVIDEOCONTAINER_H
+#define CMPXVIDEOCONTAINER_H
+
+#include <coecntrl.h>
+
+
+class CMPXVideoContainer : public CCoeControl
+{
+
+ public:
+ CMPXVideoContainer();
+ virtual ~CMPXVideoContainer();
+
+ void ConstructL();
+
+ protected:
+ void Draw(const TRect& aRect) const;
+};
+
+#endif // CMPXVIDEOCONTAINER_H
+
+// End of file
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideodisplayhandler/stub/inc/mpxvideoplaybackviewfiledetails.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* 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: MPX Video File Details (QT)
+*
+*/
+
+// Version : %version: 2 %
+
+
+
+
+#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/testvideodisplayhandler/stub/inc/mpxvideoviewwrapper.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,88 @@
+/*
+* 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();
+
+ private:
+ CMPXVideoViewWrapper( HbVideoBasePlaybackView* aView );
+ void ConstructL();
+
+ void SetFileDetails(TBool aDefault);
+
+ public:
+ void HandleCommandL( TInt aCommand );
+
+ TBool IsLive();
+
+ TBool IsPlaylist();
+
+ TBool IsMultiItemPlaylist();
+
+ void RequestMediaL();
+
+ void CreateGeneralPlaybackCommandL( int aCmd );
+
+ void ActivateClosePlayerActiveObject();
+
+ void IssueVideoAppForegroundCmdL( TBool aForeground );
+
+ void UpdateVideoRectDone();
+
+
+ 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/testvideodisplayhandler/stub/src/alfcompositionutility.cpp Thu Apr 01 22:38:49 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 implementation for CAlfCompositionSource
+*
+*/
+
+// Version : %version: 1 %
+
+// Include Files
+
+#include "alfcompositionutility.h"
+
+
+// -------------------------------------------------------------------------------------------------
+// CAlfCompositionSource::NewL()
+// -------------------------------------------------------------------------------------------------
+//
+CAlfCompositionSource* CAlfCompositionSource::NewL( RWindow& /*aClientWindow*/ )
+{
+ CAlfCompositionSource* self = new (ELeave) CAlfCompositionSource();
+
+ return self;
+}
+
+// -------------------------------------------------------------------------------------------------
+// CAlfCompositionSource::~CAlfCompositionSource()
+// -------------------------------------------------------------------------------------------------
+//
+CAlfCompositionSource::~CAlfCompositionSource()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// CAlfCompositionSource::EnableAlpha()
+// -------------------------------------------------------------------------------------------------
+//
+TInt CAlfCompositionSource::EnableAlpha(TBool /*aEnable*/)
+{
+ return KErrNone;
+}
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideodisplayhandler/stub/src/hbvideobaseplaybackview.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,190 @@
+/*
+* 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: 1 %
+
+
+
+// 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 )
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// 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::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/testvideodisplayhandler/stub/src/mediaclientvideodisplay.cpp Thu Apr 01 22:38:49 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: Stub implementation for CMediaClientVideoDisplay
+*
+*/
+
+// Version : %version: 1 %
+
+// Include Files
+
+#include "mediaclientvideodisplay.h"
+
+
+// -------------------------------------------------------------------------------------------------
+// CAlfCompositionSource::NewL()
+// -------------------------------------------------------------------------------------------------
+//
+CMediaClientVideoDisplay* CMediaClientVideoDisplay::NewL( TInt /*aDisplayId*/ )
+{
+ CMediaClientVideoDisplay* self = new (ELeave) CMediaClientVideoDisplay();
+
+ return self;
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMediaClientVideoDisplay::~CMediaClientVideoDisplay()
+// -------------------------------------------------------------------------------------------------
+//
+CMediaClientVideoDisplay::~CMediaClientVideoDisplay()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMediaClientVideoDisplay::CMediaClientVideoDisplay()
+// -------------------------------------------------------------------------------------------------
+//
+CMediaClientVideoDisplay::CMediaClientVideoDisplay()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMediaClientVideoDisplay::RemoveSurface()
+// -------------------------------------------------------------------------------------------------
+//
+void CMediaClientVideoDisplay::RemoveSurface()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMediaClientVideoDisplay::RemoveSurface()
+// -------------------------------------------------------------------------------------------------
+//
+void CMediaClientVideoDisplay::AddDisplayWindowL(const RWindowBase* /*aWindow*/,
+ const TRect& /*aClipRect*/,
+ const TRect& /*aCropRegion*/,
+ const TRect& /*aVideoExtent*/,
+ TReal32 /*aScaleWidth*/,
+ TReal32 /*aScaleHeight*/,
+ TVideoRotation /*aRotation*/,
+ TAutoScaleType /*aAutoScaleType*/,
+ TInt /*aHorizPos*/,
+ TInt /*aVertPos*/,
+ RWindow* /*aWindow2*/)
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMediaClientVideoDisplay::RemoveSurface()
+// -------------------------------------------------------------------------------------------------
+//
+TInt CMediaClientVideoDisplay::SurfaceCreated(const TSurfaceId& /*aSurfaceId*/,
+ const TRect& /*aCropRect*/,
+ TVideoAspectRatio /*aAspectRatio*/,
+ const TRect& /*aCropRegion*/)
+{
+ return KErrNone;
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// CMediaClientVideoDisplay::RemoveSurface()
+// -------------------------------------------------------------------------------------------------
+//
+TInt CMediaClientVideoDisplay::SurfaceParametersChanged(const TSurfaceId& /*aSurfaceId*/,
+ const TRect& /*aCropRect*/,
+ TVideoAspectRatio /*aAspectRatio*/)
+{
+ return KErrNone;
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// CMediaClientVideoDisplay::RemoveSurface()
+// -------------------------------------------------------------------------------------------------
+//
+TInt CMediaClientVideoDisplay::RedrawWindows(const TRect& /*aCropRegion*/)
+{
+ return KErrNone;
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// CMediaClientVideoDisplay::RemoveSurface()
+// -------------------------------------------------------------------------------------------------
+//
+void CMediaClientVideoDisplay::SetVideoExtentL(const RWindowBase& /*aWindow*/,
+ const TRect& /*aVideoExtent*/,
+ const TRect& /*aCropRegion*/)
+{
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// CMediaClientVideoDisplay::RemoveSurface()
+// -------------------------------------------------------------------------------------------------
+//
+void CMediaClientVideoDisplay::SetAutoScaleL(TAutoScaleType /*aScaleType*/,
+ TInt /*aHorizPos*/,
+ TInt /*aVertPos*/,
+ const TRect& /*aCropRegion*/)
+{
+}
+
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideodisplayhandler/stub/src/mpxvideocontainer.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* 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:
+*
+*/
+
+// Version : %version: 1 %
+
+
+
+#include "mpxvideocontainer.h"
+
+
+CMPXVideoContainer::CMPXVideoContainer()
+{
+}
+
+CMPXVideoContainer::~CMPXVideoContainer()
+{
+ CloseWindow();
+}
+
+void CMPXVideoContainer::ConstructL()
+{
+ CreateWindowL();
+ ActivateL();
+}
+
+void CMPXVideoContainer::Draw( const TRect& /*aRect*/ ) const
+{
+ CWindowGc& gc = SystemGc();
+ gc.SetPenStyle( CGraphicsContext::ENullPen );
+ gc.SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha );
+ gc.SetBrushColor( TRgb::Color16MA( 0 ) );
+ gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
+ gc.DrawRect( Rect() );
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideodisplayhandler/stub/src/mpxvideoplaybackviewfiledetails.cpp Thu Apr 01 22:38:49 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: class for MPX Video File Details (Qt)
+*
+*/
+
+// Version : %version: 2 %
+
+
+
+//
+// INCLUDE FILES
+//
+#include "mpxvideo_debug.h"
+#include "mpxvideoplaybackviewfiledetails.h"
+
+
+// ============================ MEMBER FUNCTIONS ===================================================
+
+QMPXVideoPlaybackViewFileDetails::QMPXVideoPlaybackViewFileDetails()
+{
+ clearFileDetails();
+}
+
+QMPXVideoPlaybackViewFileDetails::~QMPXVideoPlaybackViewFileDetails()
+{
+ clearFileDetails();
+}
+
+void
+QMPXVideoPlaybackViewFileDetails::clearFileDetails()
+{
+ MPX_ENTER_EXIT(_L("QMPXVideoPlaybackViewFileDetails::ClearFileDetails()"));
+
+ mMimeType = tr("");
+ mTitle = tr("");
+ mArtist = tr("");
+ mDescription = tr("");
+ mLocation = tr("");
+ mCopyright = tr("");
+ mLanguage = tr("");
+ mKeywords = tr("");
+
+ mClipName = QString("testClip.3gp");
+
+ mPlaybackMode = EMPXVideoLocal;
+ mSeekable = false;
+ mPausableStream = false;
+ mAudioEnabled = true;
+ mVideoEnabled = false;
+ mPartialPlayback = false;
+ mRNFormat = false;
+
+ mDuration = 0;
+ mTvOutConnected = false;
+ mTvOutPlayAllowed = true;
+ mDrmProtected = false;
+ mMultiItemPlaylist = false;
+
+ mVideoHeight = 0;
+ mVideoWidth = 0;
+ mBitRate = 0;
+}
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideodisplayhandler/stub/src/mpxvideoviewwrapper.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,256 @@
+/*
+* 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 base playback view
+*
+*/
+
+// Version : %version: 2 %
+
+
+
+// Include Files
+
+#include "mpxvideoviewwrapper.h"
+#include "hbvideobaseplaybackview.h"
+#include "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::CreateGeneralPlaybackCommandL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::CreateGeneralPlaybackCommandL( int aCmd )
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// 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;
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::UpdateVideoRectDone()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::UpdateVideoRectDone()
+{
+}
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideodisplayhandler/testvideodisplayhandler.pro Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,55 @@
+#
+# 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: Project file for building Videoplayer components
+#
+#
+# Version : %version: 1 %
+
+TEMPLATE = app
+TARGET = testvideodisplayhandler
+CONFIG += qtestlib hb qt
+DEFINES += BUILD_VIDEOPLAYBACK_DLL
+
+DEPENDPATH += . \
+ inc \
+ src
+
+INCLUDEPATH += ../../../inc \
+ ../../../../inc \
+ ../../controlinc \
+ $$MW_LAYER_SYSTEMINCLUDE
+
+LIBS += -lmpxplaybackutility.dll \
+ -lmpxcommon.dll \
+ -lestor.dll \
+ -lsysutil.dll
+
+# Input
+HEADERS += stub/inc/mpxvideoviewwrapper.h \
+ stub/inc/hbvideobaseplaybackview.h \
+ stub/inc/mpxvideoplaybackviewfiledetails.h \
+ stub/inc/mpxvideocontainer.h \
+ stub/inc/alfcompositionutility.h \
+ stub/inc/mediaclientvideodisplay.h \
+ inc/testvideodisplayhandler.h \
+ ../../viewinc/mpxvideoplaybackdisplayhandler.h
+
+SOURCES += stub/src/mpxvideoviewwrapper.cpp \
+ stub/src/hbvideobaseplaybackview.cpp \
+ stub/src/mpxvideoplaybackviewfiledetails.cpp \
+ stub/src/mpxvideocontainer.cpp \
+ stub/src/alfcompositionutility.cpp \
+ stub/src/mediaclientvideodisplay.cpp \
+ src/testvideodisplayhandler.cpp \
+ ../../viewsrc/mpxvideoplaybackdisplayhandler.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackview/inc/testvideoplaybackview.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,86 @@
+/**
+* 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 Video Playback View Plugin
+*
+*/
+
+#ifndef __TESTVIDEOPLAYBACKVIEW_H__
+#define __TESTVIDEOPLAYBACKVIEW_H__
+
+
+// INCLUDES
+#include <QtTest/QtTest>
+
+
+class HbVideoPlaybackView;
+
+class TestVideoPlaybackView : 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:
+
+ // the order in which these testXX methods are declared is important
+ // changing this order will affect the test results
+ void testHandleActivateView();
+ void testDisplayErrorMessage();
+ void testDisplayInfoMessage();
+ void testGetWindow();
+ void testIssuePlayCommand();
+ void testEvent();
+ void testClosePlaybackView();
+ void testMousePressEvent();
+ void testMouseReleaseEvent();
+ void testHandlePdlStateChange();
+ void testHandlePluginError();
+ void testHandleStoppedStatePrevView();
+ void testHandleStoppedStateNoPrevView();
+ void testHandleBackPrevView();
+ void testHandleBackNoPrevView();
+ void testHandleSoftkeyback();
+ void testHandleDeactivateView();
+ void testDoClosePlayer();
+
+signals:
+ void commandSignal(int);
+
+private:
+ HbVideoPlaybackView* mVideoView;
+
+};
+
+
+#endif // __TESTVIDEOPLAYBACKVIEW_H__
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackview/src/testvideoplaybackview.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,432 @@
+/**
+* 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 <e32err.h>
+#include <w32std.h>
+
+#include <mmf/common/mmferrors.h>
+#include <caf/caferr.h>
+
+#include <mpxvideoplaybackdefs.h>
+
+#include <hbapplication.h>
+#include <hbinstance.h>
+#include <qgraphicssceneevent>
+#include <QDebug>
+
+#include "mpxvideoplaybackviewfiledetails.h"
+
+#include "testvideoplaybackview.h"
+#include "mpxvideoviewwrapper.h"
+
+#define private public
+#define protected public
+#include "hbvideoplaybackview.h"
+#include "hbvideobaseplaybackview.h"
+#undef protected
+#undef private
+
+
+
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ HbApplication app(argc, argv);
+ HbMainWindow window;
+
+ TestVideoPlaybackView tv;
+
+ char *pass[3];
+ pass[0] = argv[0];
+ pass[1] = "-o";
+ pass[2] = "c:\\data\\TestVideoPlaybackView.txt";
+
+ int res = QTest::qExec(&tv, 3, pass);
+
+ return res;
+}
+
+
+// ---------------------------------------------------------------------------
+// init
+// ---------------------------------------------------------------------------
+//
+void TestVideoPlaybackView::init()
+{
+ mVideoView = new HbVideoPlaybackView();
+}
+
+// ---------------------------------------------------------------------------
+// cleanup
+// ---------------------------------------------------------------------------
+//
+void TestVideoPlaybackView::cleanup()
+{
+ delete mVideoView;
+ mVideoView = NULL;
+}
+
+// ---------------------------------------------------------------------------
+// setup
+// ---------------------------------------------------------------------------
+//
+void TestVideoPlaybackView::setup()
+{
+ init();
+ mVideoView->handleActivateView();
+}
+
+
+void TestVideoPlaybackView::testHandleActivateView()
+{
+ init();
+ mVideoView->handleActivateView();
+
+ QVERIFY( mVideoView->mVideoMpxWrapper->iMediaRequested == true );
+ QCOMPARE( mVideoView->mVideoMpxWrapper->iFileDetails->mBitRate, 16000 );
+ QCOMPARE( mVideoView->mVideoMpxWrapper->iFileDetails->mTitle, QString("Test Video Title") );
+
+ cleanup();
+}
+
+void TestVideoPlaybackView::testHandlePluginError()
+{ /*
+ setup();
+
+ mVideoView->handlePluginError( KErrGeneral );
+ QVERIFY( mVideoView->isEnabled() );
+ QVERIFY( ! mVideoView->isObscured() );
+
+ mVideoView->handlePluginError( KErrNotSupported );
+
+ mVideoView->handlePluginError( KErrArgument );
+
+ mVideoView->handlePluginError( KErrSessionClosed );
+
+ mVideoView->handlePluginError( KErrTimedOut );
+
+ mVideoView->handlePluginError( KErrNotFound );
+
+ mVideoView->handlePluginError( KErrMMNotEnoughBandwidth );
+
+ mVideoView->handlePluginError( KErrDisconnected );
+
+ mVideoView->handlePluginError( KMPXVideoPlayOver2GDuringVoiceCallError );
+
+ mVideoView->handlePluginError( KErrTimedOut );
+
+ mVideoView->handlePluginError( KErrCancel );
+
+ mVideoView->handlePluginError( KErrCANoPermission );
+
+ mVideoView->handlePluginError( KMPXVideoCallOngoingError );
+
+ mVideoView->handlePluginError( KMPXVideoTvOutPlaybackNotAllowed );
+
+ mVideoView->handlePluginError( KMPXVideoTvOutPlaybackNotAllowedClose );
+
+ cleanup();*/
+}
+
+void TestVideoPlaybackView::testDisplayErrorMessage()
+{
+ setup();
+
+ mVideoView->displayErrorMessage( "test error msg" );
+
+ QVERIFY( mVideoView->isEnabled() );
+ QVERIFY( ! mVideoView->isObscured() );
+
+ cleanup();
+}
+
+
+void TestVideoPlaybackView::testDisplayInfoMessage()
+{
+ setup();
+
+ mVideoView->displayInfoMessage( "test info msg" );
+
+ QVERIFY( mVideoView->isEnabled() );
+ QVERIFY( ! mVideoView->isObscured() );
+
+ cleanup();
+}
+
+
+void TestVideoPlaybackView::testGetWindow()
+{
+ setup();
+
+ QVERIFY( mVideoView->getWindow() != NULL );
+
+ cleanup();
+}
+
+
+void TestVideoPlaybackView::testIssuePlayCommand()
+{
+ setup();
+
+ mVideoView->issuePlayCommand();
+
+ //JAM remove
+ QVERIFY( mVideoView->isEnabled() );
+
+ cleanup();
+}
+
+void TestVideoPlaybackView::testEvent()
+{
+ setup();
+
+ //
+ // ensure default foreground is false
+ //
+ QCOMPARE( mVideoView->mVideoMpxWrapper->iForeground, 0 );
+
+ //
+ // declare foreground/background event
+ //
+ QEvent* windowActivate = new QEvent( QEvent::WindowActivate );
+ QEvent* windowDeactivate = new QEvent( QEvent::WindowDeactivate );
+
+ //
+ // verify the returned value (consumed) of HbVideoBasePlaybackView::event()
+ // for QEvent::WindowActivate is false
+ //
+ QVERIFY( ! mVideoView->event( windowActivate ) );
+
+ //
+ // verify view is in foreground
+ //
+ QCOMPARE( mVideoView->mVideoMpxWrapper->iForeground, 1 );
+
+ //
+ // verify the returned value (consumed) of HbVideoBasePlaybackView::event()
+ // for QEvent::WindowDeactivate is false
+ //
+ QVERIFY( ! mVideoView->event( windowDeactivate ) );
+
+ //
+ // verify view is in background
+ //
+ QCOMPARE( mVideoView->mVideoMpxWrapper->iForeground, 0 );
+
+ //
+ // clean up
+ //
+ delete windowActivate;
+ windowActivate = NULL;
+ delete windowDeactivate;
+ windowDeactivate = NULL;
+ cleanup();
+}
+
+void TestVideoPlaybackView::testClosePlaybackView()
+{
+ setup();
+
+ QVERIFY( ! mVideoView->mTimerForClosingView->isActive() );
+
+ mVideoView->closePlaybackView();
+
+ QVERIFY( mVideoView->mTimerForClosingView->isActive() );
+
+ cleanup();
+}
+
+void TestVideoPlaybackView::testMousePressEvent()
+{
+ setup();
+
+ //
+ // declare QEvent::GraphicsSceneMousePress
+ //
+ QGraphicsSceneMouseEvent* event = new QGraphicsSceneMouseEvent( QEvent::GraphicsSceneMousePress );
+
+ //
+ // set m_accept value to false
+ //
+ event->setAccepted( false );
+
+ //
+ // simulate QEvent::GraphicsSceneMousePress event
+ //
+ mVideoView->mousePressEvent( event );
+
+ //
+ // verify event has been accepted
+ //
+ QVERIFY( event->isAccepted() );
+
+ //
+ // clean up
+ //
+ delete event;
+ event = NULL;
+ cleanup();
+}
+
+void TestVideoPlaybackView::testMouseReleaseEvent()
+{
+ setup();
+
+ //
+ // declare QEvent::GraphicsSceneMouseRelease
+ //
+ QGraphicsSceneMouseEvent* event = new QGraphicsSceneMouseEvent( QEvent::GraphicsSceneMouseRelease );
+
+ //
+ // connect to tappedOnScreen() signal and record its emission
+ //
+ QSignalSpy spy( mVideoView, SIGNAL(tappedOnScreen()) );
+
+ //
+ // ensure signal has not been emitted yet
+ //
+ QCOMPARE(spy.count(), 0);
+
+ //
+ // simulate QEvent::GraphicsSceneMousePress event
+ //
+ mVideoView->mouseReleaseEvent( event );
+
+ //
+ // ensure signal has been emitted and its emission count is incremented
+ //
+ QCOMPARE(spy.count(), 1);
+
+ //
+ // clean up
+ //
+ delete event;
+ event = NULL;
+ spy.clear();
+ cleanup();
+}
+
+
+void TestVideoPlaybackView::testHandlePdlStateChange()
+{
+ setup();
+
+ QCOMPARE( mVideoView->mVideoMpxWrapper->iFileDetails->mClipName, QString("testClip.3gp") );
+
+ mVideoView->handlePdlStateChange( 0 );
+
+ QCOMPARE( mVideoView->mVideoMpxWrapper->iFileDetails->mClipName, QString("testClip.3gp") );
+
+ cleanup();
+}
+
+void TestVideoPlaybackView::testHandleStoppedStateNoPrevView()
+{
+ setup();
+
+ QVERIFY( ! mVideoView->mTimerForClosingView->isActive() );
+ mVideoView->handleStoppedState();
+
+ QVERIFY( mVideoView->mTimerForClosingView->isActive() );
+
+ cleanup();
+}
+
+
+void TestVideoPlaybackView::testHandleStoppedStatePrevView()
+{
+ setup();
+
+ mVideoView->handleStoppedState();
+
+ QVERIFY( mVideoView->mTimerForClosingView->isActive() );
+
+ cleanup();
+
+}
+
+void TestVideoPlaybackView::testHandleBackNoPrevView()
+{
+ setup();
+
+ QVERIFY( ! mVideoView->mTimerForClosingView->isActive() );
+ mVideoView->handleBack();
+
+ QVERIFY( mVideoView->mTimerForClosingView->isActive() );
+
+ cleanup();
+
+}
+
+void TestVideoPlaybackView::testHandleBackPrevView()
+{
+ setup();
+
+ mVideoView->handleBack();
+
+ QVERIFY( mVideoView->mTimerForClosingView->isActive() );
+
+ cleanup();
+}
+
+void TestVideoPlaybackView::testHandleSoftkeyback()
+{
+ setup();
+
+ mVideoView->handleSoftkeyBack();
+
+ QVERIFY( mVideoView->mTimerForClosingView->isActive() );
+
+ cleanup();
+}
+
+
+
+void TestVideoPlaybackView::testDoClosePlayer()
+{
+ // quits app - which can be problematic for the qvptestrunner app
+
+// setup();
+//
+// mVideoView->handleActivateView();
+//
+// mVideoView->doClosePlayer();
+//
+// cleanup();
+
+}
+
+void TestVideoPlaybackView::testHandleDeactivateView()
+{
+ setup();
+
+ mVideoView->handleDeactivateView();
+
+ QVERIFY( mVideoView->mVideoMpxWrapper == NULL );
+
+ cleanup();
+}
+
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/tsrc/testvideoplaybackview/stub/src/mpxvideoviewwrapper.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,248 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation of Video base playback view
+*
+*/
+
+// Version : %version: 4 %
+
+
+
+// Include Files
+
+#include "mpxvideoviewwrapper.h"
+#include "hbvideobaseplaybackview.h"
+#include "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::CreateGeneralPlaybackCommandL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::CreateGeneralPlaybackCommandL( int aCmd )
+{
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// 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/viewsrc/hbvideobaseplaybackview.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,413 @@
+/*
+* 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 base playback view
+*
+*/
+
+// Version : %version: da1mmcf#28 %
+
+
+
+// Include Files
+
+
+
+#include <qtimer>
+#include <qgraphicssceneevent>
+
+#include <hbmenu.h>
+#include <hbaction.h>
+#include <hbgesture.h>
+#include <hbinstance.h>
+#include <hbnotificationdialog.h>
+
+#include <textresolver.h>
+#include <mmf/common/mmferrors.h>
+#include <drmhelper.h>
+
+#include <mpxvideoplaybackdefs.h>
+#include <mpxplaybackcommanddefs.h>
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoviewwrapper.h"
+#include "mpxvideoplaybackuids.hrh"
+#include "hbvideobaseplaybackview.h"
+#include "mpxcommonvideoplaybackview.hrh"
+
+
+// Member Functions
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::HbVideoBasePlaybackView()
+// -------------------------------------------------------------------------------------------------
+//
+HbVideoBasePlaybackView::HbVideoBasePlaybackView()
+ : mVideoMpxWrapper( NULL )
+ , mTimerForClosingView( NULL )
+ , mActivated( false )
+{
+ MPX_ENTER_EXIT(_L("HbVideoBasePlaybackView::HbVideoBasePlaybackView()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::initializeVideoPlaybackView()
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::initializeVideoPlaybackView()
+{
+ MPX_ENTER_EXIT(_L("HbVideoBasePlaybackView::initializeVideoPlaybackView()"));
+
+ //
+ // Need to set to control full screen including status pane area
+ //
+ setContentFullScreen();
+
+ mTimerForClosingView = new QTimer();
+ mTimerForClosingView->setSingleShot( true );
+ mTimerForClosingView->setInterval( 10 );
+ connect( mTimerForClosingView, SIGNAL( timeout() ), this, SIGNAL( activatePreviousView() ) );
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::~HbVideoBasePlaybackView()
+// -------------------------------------------------------------------------------------------------
+//
+HbVideoBasePlaybackView::~HbVideoBasePlaybackView()
+{
+ MPX_DEBUG(_L("HbVideoBasePlaybackView::~HbVideoBasePlaybackView()"));
+
+ disconnect( mTimerForClosingView, SIGNAL( timeout() ), this, SIGNAL( activatePreviousView() ) );
+
+ if ( mTimerForClosingView )
+ {
+ if ( mTimerForClosingView->isActive() )
+ {
+ mTimerForClosingView->stop();
+ }
+
+ delete mTimerForClosingView;
+ mTimerForClosingView = NULL;
+ }
+
+ if ( mVideoMpxWrapper )
+ {
+ delete mVideoMpxWrapper;
+ mVideoMpxWrapper = NULL;
+ }
+
+ setParentItem( 0 );
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::handleActivateView()
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::handleActivateView()
+{
+ MPX_ENTER_EXIT(_L("HbVideoBasePlaybackView::handleActivateView()"));
+
+ menu()->close();
+
+ hideItems( Hb::AllItems );
+
+ //
+ // Landscape orientation
+ //
+ hbInstance->allMainWindows()[0]->setOrientation( Qt::Horizontal );
+
+ TRAP_IGNORE( mVideoMpxWrapper = CMPXVideoViewWrapper::NewL( this ) );
+
+ mActivated = true;
+
+ //
+ // Retrieve PDL information for container
+ //
+ retrievePdlInformation();
+
+ //
+ // Request the needed Media from the Playback Plugin
+ //
+ TRAP_IGNORE( mVideoMpxWrapper->RequestMediaL() );
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::handleDeactivateView()
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::handleDeactivateView()
+{
+ MPX_ENTER_EXIT(_L("HbVideoBasePlaybackView::handleDeactivateView()"));
+
+ mActivated = false;
+
+ //
+ // Close the playback plugin to release all references to previous clip
+ //
+ MPX_TRAPD( err, mVideoMpxWrapper->HandleCommandL( EMPXPbvCmdClose ) );
+
+ if ( mVideoMpxWrapper )
+ {
+ delete mVideoMpxWrapper;
+ mVideoMpxWrapper = NULL;
+ }
+
+ //
+ // go back to device orientation
+ //
+ //hbInstance->allMainWindows()[0]->unsetOrientation();
+
+ showItems( Hb::AllItems );
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::handleClosePlaybackView()
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::handleClosePlaybackView()
+{
+ MPX_DEBUG(
+ _L("HbVideoBasePlaybackView::handleClosePlaybackView()") );
+
+ if ( mVideoMpxWrapper->IsMultiItemPlaylist() )
+ {
+ TRAP_IGNORE( mVideoMpxWrapper->HandleCommandL( EMPXPbvCmdNextListItem ) );
+ }
+ else
+ {
+ closePlaybackView();
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::handlePluginError()
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::handlePluginError( int aError )
+{
+ MPX_DEBUG(
+ _L("HbVideoBasePlaybackView::handlePluginError() aError = %d"), aError );
+
+ switch ( aError )
+ {
+ case KErrCancel:
+ {
+ handleClosePlaybackView();
+ break;
+ }
+ case KErrMMDRMNotAuthorized:
+ case KErrCANoRights:
+ case KErrCANoPermission:
+ {
+ const QString qString = "License has expired or it is missing";
+ displayErrorMessage( qString );
+ handleClosePlaybackView();
+ break;
+ }
+ case KMPXVideoCallOngoingError:
+ {
+ const QString qString = "FMP cannot be used during video call";
+ displayInfoMessage( qString );
+ break;
+ }
+ case KMPXVideoTvOutPlaybackNotAllowed:
+ {
+ const QString qString = "Protected clip, can not be played through TV-Out";
+ displayInfoMessage( qString );
+ break;
+ }
+ case KMPXVideoTvOutPlaybackNotAllowedClose:
+ {
+ const QString qString = "Protected clip, can not be played through TV-Out";
+ displayInfoMessage( qString );
+ handleClosePlaybackView();
+ break;
+ }
+ default:
+ {
+ TRAP_IGNORE(
+
+ //
+ // TextResolver instance for error resolving.
+ //
+ CTextResolver* textresolver = CTextResolver::NewLC();
+
+ //
+ // Resolve the error text
+ //
+ TPtrC text;
+ text.Set( textresolver->ResolveErrorString( aError ) );
+
+ //
+ // convert to QString
+ //
+ const QString qString( (QChar*)text.Ptr(), text.Length() );
+ displayErrorMessage( qString );
+
+ CleanupStack::PopAndDestroy( textresolver );
+
+ handleClosePlaybackView();
+
+ );
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::displayInfoMessage
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::displayInfoMessage( const QString& qString )
+{
+ MPX_DEBUG(_L("HbVideoBasePlaybackView::displayInfoMessage()"));
+
+ HbNotificationDialog::launchDialog( qString );
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::displayErrorMessage
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::displayErrorMessage( const QString& qString )
+{
+ MPX_DEBUG(_L("HbVideoBasePlaybackView::displayErrorMessage()"));
+
+ HbNotificationDialog::launchDialog( qString );
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::doClosePlayer
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::doClosePlayer()
+{
+ MPX_DEBUG(_L("HbVideoBasePlaybackView::doClosePlayer()"));
+
+ handleDeactivateView();
+
+ qApp->quit();
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::issuePlayCommand
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::issuePlayCommand()
+{
+ MPX_ENTER_EXIT(_L("HbVideoBasePlaybackView::issuePlayCommand()"));
+ TRAPD(err, mVideoMpxWrapper->CreateGeneralPlaybackCommandL( EPbCmdPlay ));
+ MPX_DEBUG(_L("HbVideoBasePlaybackView::issuePlayCommand() error = %d"), err);
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::retrievePdlInformation
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::retrievePdlInformation()
+{
+ MPX_DEBUG(_L("HbVideoBasePlaybackView::retrievePdlInformation()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::handleBufferingState
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::handleBufferingState()
+{
+ MPX_DEBUG(_L("HbVideoBasePlaybackView::handleBufferingState()"));
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::closePlaybackView()
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::closePlaybackView()
+{
+ MPX_ENTER_EXIT(_L("HbVideoBasePlaybackView::closePlaybackView()"));
+
+ mTimerForClosingView->start( 0 );
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::event()
+// -------------------------------------------------------------------------------------------------
+//
+bool HbVideoBasePlaybackView::event( QEvent *event )
+{
+ bool consumed = false;
+
+ if ( event->type() == QEvent::WindowActivate && mActivated )
+ {
+ TRAP_IGNORE( mVideoMpxWrapper->IssueVideoAppForegroundCmdL( true ) );
+ }
+ else if ( event->type() == QEvent::WindowDeactivate && mActivated )
+ {
+ TRAP_IGNORE( mVideoMpxWrapper->IssueVideoAppForegroundCmdL( false ) );
+ }
+ else
+ {
+ consumed = QGraphicsWidget::event( event );
+ }
+
+ return consumed;
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::closePlaybackView()
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::paint( QPainter *painter,
+ const QStyleOptionGraphicsItem *option,
+ QWidget *widget )
+{
+ Q_UNUSED( widget );
+
+ painter->fillRect( option->exposedRect, Qt::black );
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::getWindow()
+// -------------------------------------------------------------------------------------------------
+//
+RWindow *HbVideoBasePlaybackView::getWindow()
+{
+ return static_cast<RWindow*>( hbInstance->allMainWindows()[0]->effectiveWinId()->DrawableWindow() );
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::mousePress
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::mousePressEvent( QGraphicsSceneMouseEvent *event )
+{
+ //
+ // Needed for gesture framework
+ //
+ event->accept();
+}
+
+// -------------------------------------------------------------------------------------------------
+// HbVideoBasePlaybackView::mouseReleaseEvent
+// -------------------------------------------------------------------------------------------------
+//
+void HbVideoBasePlaybackView::mouseReleaseEvent( QGraphicsSceneMouseEvent *event )
+{
+ MPX_ENTER_EXIT(_L("HbVideoBasePlaybackView::mouseReleaseEvent"));
+
+ Q_UNUSED( event );
+
+ emit tappedOnScreen();
+}
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/viewsrc/mpxvideoplaybackdisplayhandler.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,695 @@
+/*
+* 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: 17 %
+
+#include <sysutil.h>
+#include <s32file.h>
+#include <mpxcommand.h>
+#include <mpxcommandgeneraldefs.h>
+#include <mpxplaybackutility.h>
+#include <mpxvideoplaybackdefs.h>
+#include <alfcompositionutility.h>
+
+#include "mpxvideocontainer.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 )
+ , iTransitionEffectCnt( 0 )
+ , iViewWrapper( aViewWrapper )
+ , iScaleWidth( 100.0f )
+ , iScaleHeight( 100.0f )
+ , iHorizontalPosition( EHorizontalAlignCenter )
+ , iVerticalPosition( EVerticalAlignCenter )
+ , iRotation( EVideoRotationNone )
+ , iAutoScale( EAutoScaleBestFit )
+{
+}
+
+CMPXVideoPlaybackDisplayHandler::~CMPXVideoPlaybackDisplayHandler()
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::~CMPXVideoPlaybackDisplayHandler()"));
+
+ MPX_TRAPD( error, SaveAspectRatioL() );
+
+ if ( iResizingTimer )
+ {
+ iResizingTimer->Cancel();
+ delete iResizingTimer;
+ iResizingTimer = NULL;
+ }
+
+ iAspectRatioArray.Close();
+
+ if ( iVideoDisplay )
+ {
+ SurfaceRemoved();
+
+ delete iVideoDisplay;
+ iVideoDisplay = NULL;
+ }
+
+ if ( iVideoContainer )
+ {
+ delete iVideoContainer;
+ iVideoContainer = NULL;
+ }
+}
+
+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()
+{
+ iResizingTimer = CPeriodic::NewL( CActive::EPriorityStandard );
+ LoadAspectRatioL();
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::CreateDisplayWindowL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackDisplayHandler::CreateDisplayWindowL(
+ RWsSession& /*aWs*/,
+ CWsScreenDevice& aScreenDevice,
+ RWindow& aWin,
+ TRect aDisplayRect )
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::CreateDisplayWindowL()"));
+
+ //
+ // Workaround start for PREQ-2669
+ //
+ iVideoContainer = new ( ELeave ) CMPXVideoContainer();
+ iVideoContainer->ConstructL();
+ iVideoContainer->SetRect( aDisplayRect );
+
+ RWindowBase *videoWindow = iVideoContainer->DrawableWindow();
+ videoWindow->SetOrdinalPosition( -1 );
+ (&aWin)->SetOrdinalPosition( 0 );
+
+ MPX_DEBUG(_L("VideoWindow ordinal position is: %d"), videoWindow->OrdinalPosition());
+ MPX_DEBUG(_L("UiWindow ordinal position is: %d"), (&aWin)->OrdinalPosition());
+
+ TRAPD
+ ( status,
+ {
+ CAlfCompositionSource* me = CAlfCompositionSource::NewL( aWin );
+ me->EnableAlpha();
+ delete me;
+ me = NULL;
+ }
+ );
+
+ MPX_DEBUG(
+ _L("CMPXVideoPlaybackDisplayHandler::CreateDisplayWindowL() status : %d"), status);
+
+ //
+ // Workaround end
+ //
+
+ AddDisplayWindowL( aScreenDevice, *videoWindow, (RWindow*)videoWindow );
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::RemoveDisplayWindow()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackDisplayHandler::RemoveDisplayWindow()
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::RemoveDisplayWindow()"));
+
+ if ( iVideoDisplay )
+ {
+ SurfaceRemoved();
+ delete iVideoDisplay;
+ iVideoDisplay = NULL;
+ }
+
+ if ( iVideoContainer )
+ {
+ delete iVideoContainer;
+ iVideoContainer = NULL;
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::HandleVideoDisplayMessageL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackDisplayHandler::HandleVideoDisplayMessageL( CMPXMessage* aMessage )
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::HandleVideoDisplayMessage()"));
+
+ TMPXVideoDisplayCommand message =
+ ( *(aMessage->Value<TMPXVideoDisplayCommand>(KMPXMediaVideoDisplayCommand)) );
+
+ MPX_DEBUG(
+ _L("CMPXVideoPlaybackDisplayHandler::HandleVideoDisplayMessageL() message = %d"), message );
+
+ switch ( message )
+ {
+ case EPbMsgVideoSurfaceCreated:
+ {
+ SurfaceCreatedL( aMessage );
+ break;
+ }
+ case EPbMsgVideoSurfaceChanged:
+ {
+ SurfaceChangedL( aMessage );
+ break;
+ }
+ case EPbMsgVideoSurfaceRemoved:
+ {
+ SurfaceRemoved();
+ break;
+ }
+ }
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::SetAspectRatioL()
+// -------------------------------------------------------------------------------------------------
+//
+TInt CMPXVideoPlaybackDisplayHandler::SetAspectRatioL( TMPXVideoPlaybackCommand aCmd )
+{
+ MPX_DEBUG(_L("CMPXVideoPlaybackDisplayHandler::SetAspectRatioL()"));
+
+ TInt aspectRatio;
+
+ aspectRatio = SetNgaAspectRatioL( aCmd );
+
+ //
+ // Update the aspect ratio in the array
+ //
+ TInt count = iAspectRatioArray.Count();
+
+ if ( count > 0 && count > iCurrentIndexForAspectRatio )
+ {
+ iAspectRatioArray[iCurrentIndexForAspectRatio].scalingType = (TMMFScalingType)aspectRatio;
+ }
+
+ return aspectRatio;
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::SetDefaultAspectRatioL
+// -------------------------------------------------------------------------------------------------
+//
+TInt CMPXVideoPlaybackDisplayHandler::SetDefaultAspectRatioL(
+ QMPXVideoPlaybackViewFileDetails* aFileDetails,
+ TReal aDisplayAspectRatio )
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::SetDefaultAspectRatioL()"));
+
+ TInt newAspectRatio = EMMFNatural;
+
+ if ( aFileDetails->mVideoHeight > 0 && aFileDetails->mVideoWidth > 0 )
+ {
+ TMMFScalingType scalingType = EMMFNatural;
+
+ TReal32 videoAspectRatio = (TReal32)aFileDetails->mVideoWidth /
+ (TReal32)aFileDetails->mVideoHeight;
+
+ TInt cnt = iAspectRatioArray.Count();
+ TInt i = 0;
+
+ //
+ // check whether dat file has the information about (videoRatio + screenRatio)
+ //
+ for ( ; i < cnt ; i++ )
+ {
+ if ( iAspectRatioArray[i].videoRatio == videoAspectRatio &&
+ iAspectRatioArray[i].screenRatio == aDisplayAspectRatio &&
+ ( scalingType = iAspectRatioArray[i].scalingType ) > 0 )
+ {
+ break;
+ }
+ }
+
+ //
+ // if can't find out match aspect ratio in dat file,
+ // choose the scaling type through the rule
+ // videoAspectRatio - aDisplayAspectRatio > 0.1 ==> zoom
+ // videoAspectRatio - aDisplayAspectRatio < 0.1 ==> stretch
+ // videoAspectRatio = aDisplayAspectRatio ==> natural
+ //
+ if ( i == cnt )
+ {
+ if ( videoAspectRatio - aDisplayAspectRatio > 0.1 )
+ {
+ scalingType = EMMFZoom;
+ }
+ else if ( videoAspectRatio != aDisplayAspectRatio )
+ {
+ scalingType = EMMFStretch;
+ }
+
+ TMPXAspectRatio ratio;
+
+ ratio.videoRatio = videoAspectRatio;
+ ratio.screenRatio = aDisplayAspectRatio;
+ ratio.scalingType = scalingType;
+
+ iAspectRatioArray.Append( ratio );
+ }
+
+ iCurrentIndexForAspectRatio = i;
+
+ TMPXVideoPlaybackCommand aspectRatioCmd = EPbCmdNaturalAspectRatio;
+
+ if ( scalingType == EMMFZoom )
+ {
+ aspectRatioCmd = EPbCmdZoomAspectRatio;
+ }
+ else if ( scalingType == EMMFStretch )
+ {
+ aspectRatioCmd = EPbCmdStretchAspectRatio;
+ }
+
+ newAspectRatio = SetAspectRatioL( aspectRatioCmd );
+ }
+
+ return newAspectRatio;
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::SaveAspectRatioL
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackDisplayHandler::SaveAspectRatioL()
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::SaveAspectRatioL"));
+
+ RFs fs;
+ TInt err = fs.Connect();
+ CleanupClosePushL<RFs>( fs );
+
+ TBool canSave = EFalse;
+
+ TRAP_IGNORE( canSave = ! SysUtil::FFSSpaceBelowCriticalLevelL(
+ &fs, sizeof(TMPXAspectRatio) * iAspectRatioArray.Count()) );
+
+ if ( canSave )
+ {
+ // save list to disk
+ RFileWriteStream out;
+
+ TInt err( out.Replace( fs, KAspectRatioFile, EFileWrite ) );
+
+ if ( err == KErrPathNotFound )
+ {
+ fs.MkDirAll( KAspectRatioFile );
+ err = out.Create( fs, KAspectRatioFile, EFileWrite );
+ }
+
+ if ( ! err )
+ {
+ TInt cnt = iAspectRatioArray.Count();
+
+ MPX_TRAP( err,
+ {
+ for ( TInt i = 0 ; i < cnt ; i++ )
+ {
+ //Save (videoRatio + screenRatio + scalingType)
+ out.WriteReal32L( iAspectRatioArray[i].videoRatio );
+ out.WriteReal32L( iAspectRatioArray[i].screenRatio );
+ out.WriteInt8L( iAspectRatioArray[i].scalingType );
+ }
+ } );
+
+ out.Close();
+ }
+ }
+
+ CleanupStack::PopAndDestroy();
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::LoadAspectRatioL
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackDisplayHandler::LoadAspectRatioL()
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::LoadAspectRatioL()"));
+
+ RFs fs;
+ RFileReadStream in;
+
+ TInt err = fs.Connect();
+ CleanupClosePushL<RFs>( fs );
+
+ if ( ! err && in.Open( fs, KAspectRatioFile, EFileRead ) == KErrNone )
+ {
+ TMPXAspectRatio ratio;
+
+ MPX_TRAP( err,
+ {
+ for ( err = KErrNone ; err == KErrNone ; )
+ {
+ //
+ // Read (videoRatio + screenRatio + scalingType)
+ //
+ ratio.videoRatio = in.ReadReal32L();
+ ratio.screenRatio = in.ReadReal32L();
+ ratio.scalingType = (TMMFScalingType)in.ReadInt8L();
+
+ iAspectRatioArray.Append( ratio );
+ }
+ } );
+
+ in.Close();
+ }
+
+ CleanupStack::PopAndDestroy();
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::UpdateVideoRectL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackDisplayHandler::UpdateVideoRectL( TRect aClipRect, TBool transitionEffect )
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::UpdateVideoRectL()"));
+
+ if ( transitionEffect )
+ {
+ iTlXDiff = (TReal32)( iWindowRect.iTl.iX - aClipRect.iTl.iX ) / KTRANSITIONEFFECTCNT;
+ iTlYDiff = (TReal32)( iWindowRect.iTl.iY - aClipRect.iTl.iY ) / KTRANSITIONEFFECTCNT;
+ iBrXDiff = (TReal32)( iWindowRect.iBr.iX - aClipRect.iBr.iX ) / KTRANSITIONEFFECTCNT;
+ iBrYDiff = (TReal32)( iWindowRect.iBr.iY - aClipRect.iBr.iY ) / KTRANSITIONEFFECTCNT;
+
+ if ( iResizingTimer->IsActive() )
+ {
+ iResizingTimer->Cancel();
+ }
+
+ iResizingTimer->Start(
+ 0,
+ KVIDEORESIZINGREPEATRATE,
+ TCallBack( CMPXVideoPlaybackDisplayHandler::UpdateVideoRectTimeOutL, this ) );
+ }
+ else
+ {
+ SetVideoRectL( aClipRect );
+
+ iWindowRect = aClipRect;
+
+ iViewWrapper->UpdateVideoRectDone();
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::UpdateVideoRectTimeOutL()
+// -------------------------------------------------------------------------------------------------
+//
+TInt CMPXVideoPlaybackDisplayHandler::UpdateVideoRectTimeOutL( TAny* aPtr )
+{
+ MPX_DEBUG(_L("CMPXVideoPlaybackDisplayHandler::UpdateVideoRectTimeOutL()"));
+
+ static_cast<CMPXVideoPlaybackDisplayHandler*>(aPtr)->CalculateVideoRectL();
+
+ return KErrNone;
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::CalculateVideoRectL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackDisplayHandler::CalculateVideoRectL()
+{
+ iTransitionEffectCnt++;
+
+ TRect windowRect( (TInt)( (TReal32)iWindowRect.iTl.iX - iTlXDiff * (TReal32)iTransitionEffectCnt ),
+ (TInt)( (TReal32)iWindowRect.iTl.iY - iTlYDiff * (TReal32)iTransitionEffectCnt ),
+ (TInt)( (TReal32)iWindowRect.iBr.iX - iBrXDiff * (TReal32)iTransitionEffectCnt ),
+ (TInt)( (TReal32)iWindowRect.iBr.iY - iBrYDiff * (TReal32)iTransitionEffectCnt ) );
+
+ MPX_DEBUG(_L("CMPXVideoPlaybackDisplayHandler::CalculateVideoRectL() %d %d %d %d"),
+ windowRect.iTl.iX, windowRect.iTl.iY, windowRect.iBr.iX, windowRect.iBr.iY );
+
+ SetVideoRectL( windowRect );
+
+ if ( iTransitionEffectCnt >= KTRANSITIONEFFECTCNT )
+ {
+ iTransitionEffectCnt = 0;
+ iWindowRect = windowRect;
+
+ if ( iResizingTimer->IsActive() )
+ {
+ iResizingTimer->Cancel();
+ }
+
+ MPX_DEBUG(_L("CMPXVideoPlaybackDisplayHandler::CalculateVideoRectL() Done"));
+
+ iViewWrapper->UpdateVideoRectDone();
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::SetVideoRectL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackDisplayHandler::SetVideoRectL( TRect aRect )
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::SetVideoRectL()"));
+
+ if ( iVideoDisplay )
+ {
+ iVideoDisplay->SetVideoExtentL( *iWindowBase, aRect, TRect( iWindowBase->Size() ) );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::AddDisplayWindowL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackDisplayHandler::AddDisplayWindowL( CWsScreenDevice& aScreenDevice,
+ RWindowBase& aWindowBase,
+ RWindow* aWin )
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::AddDisplayWindowL()"));
+
+ iWindowBase = &aWindowBase;
+
+ TInt displayId = aScreenDevice.GetScreenNumber();
+
+ MPX_DEBUG(_L("CMPXVideoPlaybackDisplayHandler::AddDisplayWindowL() displayId %d"), displayId);
+
+ CMediaClientVideoDisplay* tempDisplay = iVideoDisplay;
+
+ iVideoDisplay = CMediaClientVideoDisplay::NewL( displayId );
+
+ delete tempDisplay;
+
+ TRect cropRect = TRect( aWin->Size() );
+
+ //
+ // If RWindow is still in potrait, rotate surface to play a video in landscape
+ //
+ if ( cropRect.Width() < cropRect.Height() )
+ {
+ iRotation = EVideoRotationClockwise270;
+ }
+
+ iWindowRect = cropRect;
+
+ MPX_DEBUG(_L("CMPXVideoPlaybackDisplayHandler::AddDisplayWindowL() cropRect (%d, %d), (%d, %d)"),
+ cropRect.iTl.iX, cropRect.iTl.iY, cropRect.iBr.iX, cropRect.iBr.iY);
+
+ MPX_TRAPD( dispError,
+ iVideoDisplay->AddDisplayWindowL( iWindowBase,
+ cropRect,
+ cropRect,
+ cropRect,
+ iScaleWidth,
+ iScaleHeight,
+ iRotation,
+ iAutoScale,
+ iHorizontalPosition,
+ iVerticalPosition,
+ aWin );
+ );
+
+ MPX_DEBUG(_L("CMPXVideoPlaybackDisplayHandler::AddDisplayWindowL() Display Added"));
+ //
+ // Check if surface was created before window was ready
+ //
+ if ( iSurfaceCached )
+ {
+ iVideoDisplay->SurfaceCreated( iSurfaceId, iCropRect, iAspectRatio, iCropRect );
+
+ iSurfaceCached = EFalse;
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::SurfaceCreatedL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackDisplayHandler::SurfaceCreatedL( CMPXMessage* aMessage )
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::SurfaceCreatedL()"));
+
+ TSurfaceId oldSurfaceId = iSurfaceId;
+
+ //
+ // Extract the surface parameters from the message
+ //
+ iSurfaceId = aMessage->ValueTObjectL<TSurfaceId>( KMPXMediaVideoDisplayTSurfaceId );
+ iCropRect = aMessage->ValueTObjectL<TRect>( KMPXMediaVideoDisplayCropRect );
+ iAspectRatio = aMessage->ValueTObjectL<TVideoAspectRatio>( KMPXMediaVideoDisplayAspectRatio );
+
+ if ( iVideoDisplay )
+ {
+ //
+ // Remove old surface if one exists
+ //
+ if ( ! oldSurfaceId.IsNull() )
+ {
+ iVideoDisplay->RemoveSurface();
+ }
+
+ //
+ // Add new surface
+ //
+ iVideoDisplay->SurfaceCreated( iSurfaceId, iCropRect, iAspectRatio, iCropRect );
+ }
+ else
+ {
+ //
+ // Video display has not been created yet, save surface information to create
+ // the surface when the display is created
+ //
+ iSurfaceCached = ETrue;
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::SurfaceChangedL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackDisplayHandler::SurfaceChangedL( CMPXMessage* aMessage )
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::SurfaceChangedL()"));
+
+ //
+ // Extract the surface parameters from the message
+ //
+ iSurfaceId = aMessage->ValueTObjectL<TSurfaceId>( KMPXMediaVideoDisplayTSurfaceId );
+ iCropRect = aMessage->ValueTObjectL<TRect>( KMPXMediaVideoDisplayCropRect );
+ iAspectRatio = aMessage->ValueTObjectL<TVideoAspectRatio>( KMPXMediaVideoDisplayAspectRatio );
+
+ if ( iVideoDisplay )
+ {
+ //
+ // Add new surface
+ //
+ iVideoDisplay->SurfaceParametersChanged( iSurfaceId, iCropRect, iAspectRatio );
+
+ iVideoDisplay->RedrawWindows( iCropRect );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::SurfaceRemoved()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoPlaybackDisplayHandler::SurfaceRemoved()
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::SurfaceRemoved()"));
+
+ if ( iVideoDisplay )
+ {
+ iVideoDisplay->RemoveSurface();
+ }
+
+ iSurfaceId = TSurfaceId::CreateNullId();
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoPlaybackDisplayHandler::SetNgaAspectRatioL()
+// -------------------------------------------------------------------------------------------------
+//
+TInt CMPXVideoPlaybackDisplayHandler::SetNgaAspectRatioL( TMPXVideoPlaybackCommand aCmd )
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoPlaybackDisplayHandler::SetNgaAspectRatioL()"));
+
+ TInt aspectRatio = EMMFNatural;
+
+ switch ( aCmd )
+ {
+ case EPbCmdNaturalAspectRatio:
+ {
+ iAutoScale = EAutoScaleBestFit;
+ aspectRatio = EMMFNatural;
+ break;
+ }
+ case EPbCmdZoomAspectRatio:
+ {
+ iAutoScale = EAutoScaleClip;
+ aspectRatio = EMMFZoom;
+ break;
+ }
+ case EPbCmdStretchAspectRatio:
+ {
+ iAutoScale = EAutoScaleStretch;
+ aspectRatio = EMMFStretch;
+ break;
+ }
+ }
+
+ if ( iVideoDisplay && ! iSurfaceId.IsNull() )
+ {
+ iVideoDisplay->SetAutoScaleL( iAutoScale,
+ iHorizontalPosition,
+ iVerticalPosition,
+ iCropRect );
+ }
+
+ return aspectRatio;
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/hbvideoplaybackview/viewsrc/mpxvideoplaybackviewfiledetails.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,78 @@
+/*
+* 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: class for MPX Video File Details (Qt)
+*
+*/
+
+// Version : %version: da1mmcf#9 %
+
+
+
+//
+// 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/viewsrc/mpxvideoviewwrapper.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,1452 @@
+/*
+* 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 base playback view
+*
+*/
+
+// Version : %version: da1mmcf#22 %
+
+
+
+// Include Files
+
+#include <w32std.h>
+#include <eikenv.h>
+
+#include <mpxplaybackcommanddefs.h>
+#include <mpxvideoplaybackdefs.h>
+#include <mpxcommandgeneraldefs.h>
+#include <mpxcommand.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxplaybackmessage.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxmediavideodefs.h>
+#include <mpxplaybackutility.h>
+#include <mmf/common/mmferrors.h>
+#include <mpxcollectionutility.h>
+#include <mpxcollectionplaylist.h>
+#include <mpxmediageneralextdefs.h>
+
+#include "mpxvideo_debug.h"
+#include "mpxvideoregion.h"
+#include "mpxvideoviewwrapper.h"
+#include "mpxvideoplaybackuids.hrh"
+#include "mpxhbvideocommondefs.h"
+#include "hbvideobaseplaybackview.h"
+#include "mpxvideoplaybackcontrol.hrh"
+#include "mpxvideoplaybackviewfiledetails.h"
+#include "mpxvideoplaybackdisplayhandler.h"
+#include "mpxcommonvideoplaybackview.hrh"
+#include "mpxvideoplaybackcontrolscontroller.h"
+#include "mpxvideoplaybackuserinputhandler.h"
+
+// Member Functions
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::CMPXVideoViewWrapper()
+// -------------------------------------------------------------------------------------------------
+//
+CMPXVideoViewWrapper::CMPXVideoViewWrapper( HbVideoBasePlaybackView* aView )
+ : iView( aView )
+ , iControlsController( NULL )
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::NewL()
+// -------------------------------------------------------------------------------------------------
+//
+CMPXVideoViewWrapper* CMPXVideoViewWrapper::NewL( HbVideoBasePlaybackView* aView )
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::NewL()"));
+
+ CMPXVideoViewWrapper* self = new (ELeave) CMPXVideoViewWrapper( aView );
+
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop();
+
+ return self;
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::ConstructL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::ConstructL()
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::ConstructL()"));
+
+ iPlaybackUtility =
+ MMPXPlaybackUtility::UtilityL( EMPXCategoryVideo, KPbModeDefault );
+ iPlaybackUtility->AddObserverL( *this );
+ iPlaybackUtility->SetPrimaryClientL();
+
+ //
+ // Create Active Object for closing player
+ //
+ iCloseAO = CIdle::NewL( CActive::EPriorityStandard );
+
+ iPlaylistView = EFalse;
+
+ // Get playlist information
+ MMPXSource* s = iPlaybackUtility->Source();
+
+ if ( s )
+ {
+ CMPXCollectionPlaylist* playlist = s->PlaylistL();
+ iPlaylistView = (playlist) ? ETrue : EFalse;
+ delete playlist;
+ }
+
+ //
+ // Create Video Playback Display Handler
+ //
+ iDisplayHandler = CMPXVideoPlaybackDisplayHandler::NewL( iPlaybackUtility, this );
+
+ //
+ // Create control's controller
+ //
+ CreateControlsL();
+
+ //
+ // Create user input handler
+ //
+ iUserInputHandler = CMPXVideoPlaybackUserInputHandler::NewL( this, iFileDetails->mTvOutConnected );
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::~CMPXVideoViewWrapper()
+// -------------------------------------------------------------------------------------------------
+//
+CMPXVideoViewWrapper::~CMPXVideoViewWrapper()
+{
+ MPX_DEBUG(_L("CMPXVideoViewWrapper::~CMPXVideoViewWrapper()"));
+
+ //
+ // Delete the display handler when the view is deactivated
+ //
+ if ( iDisplayHandler )
+ {
+ iDisplayHandler->RemoveDisplayWindow();
+ delete iDisplayHandler;
+ iDisplayHandler = NULL;
+ }
+
+ if ( iUserInputHandler )
+ {
+ delete iUserInputHandler;
+ iUserInputHandler = NULL;
+ }
+
+ if ( iControlsController )
+ {
+ delete iControlsController;
+ iControlsController = NULL;
+ }
+
+ if ( iCloseAO )
+ {
+ delete iCloseAO;
+ iCloseAO = NULL;
+ }
+
+ if ( iFileDetails )
+ {
+ delete iFileDetails;
+ iFileDetails = NULL;
+ }
+
+ if ( iPlaybackUtility )
+ {
+ TRAP_IGNORE( iPlaybackUtility->RemoveObserverL( *this ) );
+ iPlaybackUtility->Close();
+ iPlaybackUtility = NULL;
+ }
+
+ if ( iCollectionUtility )
+ {
+ iCollectionUtility->Close();
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::IsLive()
+// -------------------------------------------------------------------------------------------------
+//
+TBool CMPXVideoViewWrapper::IsLive()
+{
+ return (iFileDetails->mPlaybackMode == EMPXVideoLiveStreaming);
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::IsPlaylist()
+// -------------------------------------------------------------------------------------------------
+//
+TBool CMPXVideoViewWrapper::IsPlaylist()
+{
+ return iPlaylistView;
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::CreateGeneralPlaybackCommandL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::CreateGeneralPlaybackCommandL( TMPXPlaybackCommand aCmd )
+{
+ MPX_DEBUG(_L("CMPXVideoViewWrapper::CreateGeneralPlaybackCommandL(%d)"), aCmd );
+
+ CMPXCommand* cmd = CMPXCommand::NewL();
+ CleanupStack::PushL( cmd );
+
+ cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
+ cmd->SetTObjectValueL<TBool>( KMPXCommandPlaybackGeneralNoBuffer, ETrue );
+ cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXCommandIdPlaybackGeneral );
+ cmd->SetTObjectValueL<TInt>( KMPXCommandPlaybackGeneralType, aCmd );
+
+ iPlaybackUtility->CommandL( *cmd );
+
+ CleanupStack::PopAndDestroy( cmd );
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::HandleCommandL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::HandleCommandL( TInt aCommand )
+{
+ MPX_ENTER_EXIT(
+ _L("CMPXVideoViewWrapper::HandleCommandL()"),
+ _L("aCommand = %d"), aCommand );
+
+ switch ( aCommand )
+ {
+ case EMPXPbvCmdPlay:
+ {
+ IssuePlayCommandL();
+ break;
+ }
+ case EMPXPbvCmdPause:
+ {
+ MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdPause"));
+ CreateGeneralPlaybackCommandL( EPbCmdPause );
+ break;
+ }
+ case EMPXPbvCmdClose:
+ {
+ MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdClose"));
+
+ //
+ // The display window must be removed before closing the playback plugin
+ //
+ if ( iDisplayHandler )
+ {
+ //
+ // Remove the display window so the surface can be released
+ //
+ iDisplayHandler->RemoveDisplayWindow();
+ }
+
+ CreateGeneralPlaybackCommandL( EPbCmdClose );
+ break;
+ }
+ case EMPXPbvCmdSeekForward:
+ {
+ MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdSeekForward"));
+ CreateVideoSpecificCmdL( EPbCmdStartVideoSeekingForward );
+ break;
+ }
+ case EMPXPbvCmdSeekBackward:
+ {
+ MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdSeekBackward"));
+ CreateVideoSpecificCmdL( EPbCmdStartVideoSeekingBackward );
+ break;
+ }
+ case EMPXPbvCmdEndSeek:
+ {
+ MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdEndSeek"));
+ CreateVideoSpecificCmdL( EPbCmdStopVideoSeeking );
+ break;
+ }
+ case EMPXPbvCmdPlayPause:
+ {
+ MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdPause"));
+ iPlaybackUtility->CommandL( EPbCmdPlayPause );
+ break;
+ }
+ case EMPXPbvCmdStop:
+ {
+ MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdStop"));
+ CreateGeneralPlaybackCommandL( EPbCmdStop );
+ break;
+ }
+ case EMPXPbvCmdDecreaseVolume:
+ {
+ MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdDecreaseVolume"));
+ HandleVolumeCmdL( EPbCmdDecreaseVolume );
+ break;
+ }
+ case EMPXPbvCmdIncreaseVolume:
+ {
+ MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdIncreaseVolume"));
+ HandleVolumeCmdL( EPbCmdIncreaseVolume );
+ break;
+ }
+ case EMPXPbvCmdNaturalAspectRatio:
+ {
+ MPX_DEBUG(
+ _L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdNaturalAspectRatio"));
+ SetAspectRatioL( EPbCmdNaturalAspectRatio );
+ break;
+ }
+ case EMPXPbvCmdZoomAspectRatio:
+ {
+ MPX_DEBUG(
+ _L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdZoomAspectRatio"));
+ SetAspectRatioL( EPbCmdZoomAspectRatio );
+ break;
+ }
+ case EMPXPbvCmdStretchAspectRatio:
+ {
+ MPX_DEBUG(
+ _L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdStretchAspectRatio"));
+ SetAspectRatioL( EPbCmdStretchAspectRatio );
+ break;
+ }
+ case EMPXPbvCmdMute:
+ {
+ MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdMute"));
+ HandleVolumeCmdL( EPbCmdMuteVolume );
+ break;
+ }
+ case EMPXPbvCmdUnMute:
+ {
+ MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdUnMute"));
+ HandleVolumeCmdL( EPbCmdUnMuteVolume );
+ break;
+ }
+ case EMPXPbvCmdShortPressBackward:
+ {
+ MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL() EMPXPbvCmdShortPressBackward"));
+
+ HandleShortPressBackwardL();
+ break;
+ }
+ case EMPXPbvCmdResetControls:
+ {
+ CreateControlsL();
+ iView->retrievePdlInformation();
+ break;
+ }
+ case EMPXPbvCmdNextListItem:
+ {
+ if ( iPlaylistView && IsMultiItemPlaylist() )
+ {
+ iPlaybackUtility->CommandL( EPbCmdNext );
+ }
+ break;
+ }
+ case EMPXPbvCmdPreviousListItem:
+ {
+ if ( iPlaylistView && IsMultiItemPlaylist() )
+ {
+ //
+ // the command is being sent twice on purpose
+ // one EMPXPbvCmdPreviousListItem command only sets the position to 0
+ // the second cmd actually goes to the previous item in the list
+ //
+ iPlaybackUtility->CommandL( EPbCmdPrevious );
+ iPlaybackUtility->CommandL( EPbCmdPrevious );
+ }
+ break;
+ }
+ case EMPXPbvCmdEndOfClip:
+ {
+ CreateVideoSpecificCmdL( EPbCmdEndofClipReached );
+ break;
+ }
+ case EMPXPbvCmdCustomPause:
+ {
+ CreateVideoSpecificCmdL( EPbCmdCustomPause );
+ break;
+ }
+ case EMPXPbvCmdCustomPlay:
+ {
+ CreateVideoSpecificCmdL( EPbCmdCustomPlay );
+ break;
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// From MMPXPlaybackObserver
+// Handle playback message.
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError )
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::HandlePlaybackMessage()"),
+ _L("aError = %d"), aError );
+
+ if ( aError )
+ {
+ MPX_TRAPD( err, DoHandleErrorPlaybackMessageL( aError ) );
+ }
+ else if ( aMessage )
+ {
+ MPX_TRAPD( err, DoHandlePlaybackMessageL( aMessage ) );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// Request for the media object
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::RequestMediaL()
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::RequestMediaL()"));
+
+ if ( ! iMediaRequested && iPlaybackUtility->StateL() == EPbStateInitialised )
+ {
+ iMediaRequested = ETrue;
+
+ //
+ // Request the volume for the controls
+ //
+ iPlaybackUtility->PropertyL( *this, EPbPropertyVolume );
+
+ //
+ // Request the clip's meta data
+ //
+ MMPXSource* s = iPlaybackUtility->Source();
+
+ if ( s )
+ {
+ RArray<TMPXAttribute> attrs;
+ CleanupClosePushL(attrs);
+
+ //
+ // General Media Attributes
+ //
+ attrs.Append( KMPXMediaGeneralUri |
+ KMPXMediaGeneralDuration |
+ KMPXMediaGeneralTitle |
+ KMPXMediaGeneralMimeType );
+
+ //
+ // Video specific Attributes
+ //
+ attrs.Append( KMPXMediaVideoAll );
+
+ // Set the attribute to always route the media call to playback plugin
+ CMPXAttributeSpecs* specs = CMPXAttributeSpecs::NewL();
+ CleanupStack::PushL( specs );
+
+ specs->SetTObjectValueL<TBool>(KMPXMediaGeneralExtMediaRedirect, ETrue);
+
+ s->MediaL( attrs.Array(), *this, specs);
+
+ CleanupStack::PopAndDestroy( specs );
+ CleanupStack::PopAndDestroy( &attrs );
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::DoHandlePlaybackMessageL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::DoHandlePlaybackMessageL( CMPXMessage* aMessage )
+{
+ TMPXMessageId id( *(aMessage->Value<TMPXMessageId>(KMPXMessageGeneralId)) );
+
+ MPX_ENTER_EXIT(
+ _L("CMPXVideoViewWrapper::DoHandlePlaybackMessageL()"),
+ _L("id = 0x%08x"), id );
+
+ if ( KMPXMessageGeneral == id )
+ {
+ HandleGeneralPlaybackMessageL( aMessage );
+ }
+ else if ( KMPXMediaIdVideoPlayback == id )
+ {
+ HandleVideoPlaybackMessage( aMessage );
+ }
+ else if ( KMPXMediaIdVideoDisplaySyncMessage == id )
+ {
+ if ( iDisplayHandler )
+ {
+ iDisplayHandler->HandleVideoDisplayMessageL( aMessage );
+ }
+
+ //
+ // Signal Sync Message handling is complete
+ //
+ iPlaybackUtility->CommandL( EPbCmdSyncMsgComplete );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::HandleGeneralPlaybackMessageL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::HandleGeneralPlaybackMessageL( CMPXMessage* aMessage )
+{
+ TInt event( *aMessage->Value<TInt>( KMPXMessageGeneralEvent ) );
+ TInt type( *aMessage->Value<TInt>( KMPXMessageGeneralType ) );
+ TInt data( *aMessage->Value<TInt>( KMPXMessageGeneralData ) );
+
+ MPX_DEBUG(
+ _L("CMPXVideoViewWrapper::HandleGeneralPlaybackMessageL() event = %d type = %d value = %d"),
+ event, type, data );
+
+ switch ( event )
+ {
+ case TMPXPlaybackMessage::EStateChanged:
+ {
+ DoHandleStateChangeL( type );
+
+ break;
+ }
+ case TMPXPlaybackMessage::EPropertyChanged:
+ {
+ TMPXPlaybackProperty property(
+ static_cast<TMPXPlaybackProperty>( type ) );
+
+ HandlePropertyL( property, data, KErrNone );
+ break;
+ }
+ case TMPXPlaybackMessage::EDownloadPositionChanged:
+ {
+ if ( iControlsController )
+ {
+ iControlsController->handleEvent( EMPXControlCmdDownloadUpdated, data );
+ }
+
+ break;
+ }
+ case TMPXPlaybackMessage::EDownloadStateChanged:
+ {
+ break;
+ }
+ case TMPXPlaybackMessage::ECommandReceived:
+ {
+ break;
+ }
+ case TMPXPlaybackMessage::EReachedEndOfPlaylist:
+ {
+ iView->closePlaybackView();
+ break;
+ }
+ case TMPXPlaybackMessage::ESongChanged:
+ {
+ break;
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::HandleVideoPlaybackMessage()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::HandleVideoPlaybackMessage( CMPXMessage* aMessage )
+{
+ TMPXVideoPlaybackCommand message =
+ ( *(aMessage->Value<TMPXVideoPlaybackCommand>(KMPXMediaVideoPlaybackCommand)) );
+
+ MPX_DEBUG(
+ _L("CMPXVideoViewWrapper::HandleVideoPlaybackMessage() message = %d"), message );
+
+ switch ( message )
+ {
+ case EPbCmdPluginError:
+ {
+ TInt error( *aMessage->Value<TInt>( KMPXMediaVideoError ) );
+
+ iView->handlePluginError( error );
+ break;
+ }
+ case EPbCmdTvOutEvent:
+ {
+ TMPXVideoPlaybackControlCommandIds cmdId = EMPXControlCmdTvOutDisconnected;
+
+ TBool tvOutConnected( *aMessage->Value<TInt>( KMPXMediaVideoTvOutConnected ) );
+ TBool playbackAllowed = ETrue;
+
+ if ( tvOutConnected )
+ {
+ cmdId = EMPXControlCmdTvOutConnected;
+
+ playbackAllowed = *aMessage->Value<TInt>( KMPXMediaVideoTvOutPlayAllowed );
+ }
+
+ if ( iUserInputHandler )
+ {
+ TRAP_IGNORE(iUserInputHandler->HandleTVOutEventL( tvOutConnected ));
+ }
+
+ if ( iControlsController )
+ {
+ iControlsController->handleEvent( cmdId, playbackAllowed );
+ }
+ break;
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::HandlePluginError()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::HandlePluginError( int aError )
+{
+ MPX_DEBUG(
+ _L("CMPXVideoViewWrapper::HandlePluginError() aError = %d"), aError );
+
+ iView->handlePluginError( aError );
+}
+
+// -------------------------------------------------------------------------------------------------
+// Handle playback state changes
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::DoHandleStateChangeL( TInt aNewState )
+{
+ MPX_ENTER_EXIT(
+ _L("CMPXVideoViewWrapper::DoHandleStateChangeL()"),
+ _L("aNewState = %d"), aNewState );
+
+ if ( aNewState != iPlaybackState )
+ {
+ switch ( aNewState )
+ {
+ case EPbStateInitialising:
+ {
+ if ( iControlsController )
+ {
+ //
+ // If transitioning from Not Initialized to Initialising there is
+ // no need to update the playback information that was gathered
+ // when the container was created
+ //
+ if ( iPlaybackState != EPbStateNotInitialised )
+ {
+ iMediaRequested = EFalse;
+ HandleCommandL( EMPXPbvCmdResetControls );
+
+ if ( iFileDetails )
+ {
+ iFileDetails->clearFileDetails();
+ }
+ }
+ }
+ break;
+ }
+ case EPbStateBuffering:
+ {
+ HandleBufferingStateL();
+
+ break;
+ }
+ case EPbStatePluginSeeking:
+ {
+ // no-op
+ break;
+ }
+ case EPbStateStopped:
+ {
+ if ( iPlaylistView && iDisplayHandler )
+ {
+ iDisplayHandler->RemoveDisplayWindow();
+ }
+
+ if ( iFileDetails->mMultiItemPlaylist )
+ {
+ iView->handleStoppedState();
+ }
+ else
+ {
+ iView->closePlaybackView();
+ }
+
+ break;
+ }
+ case EPbStateInitialised:
+ {
+ RequestMediaL();
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+
+ iPlaybackState = (TMPXPlaybackState)aNewState;
+
+ if ( iControlsController )
+ {
+ iControlsController->handleEvent( EMPXControlCmdStateChanged, aNewState );
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::HandleBufferingStateL
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::HandleBufferingStateL()
+{
+ MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleBufferingStateL()"));
+
+}
+
+// -------------------------------------------------------------------------------------------------
+// Handle playback error message.
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::DoHandleErrorPlaybackMessageL( TInt aError )
+{
+ MPX_ENTER_EXIT( _L("CMPXVideoViewWrapper::DoHandleErrorPlaybackMessageL()"),
+ _L("aError = %d"), aError );
+
+ HandleCommandL( EMPXPbvCmdResetControls );
+ iView->handlePluginError(aError);
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::HandlePlaybackCommandComplete()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::HandlePlaybackCommandComplete( CMPXCommand* /*aCommandResult*/,
+ TInt /*aError*/ )
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::HandlePlaybackCommandComplete()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::ParseMetaDataL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::ParseMetaDataL( const CMPXMessage& aMedia )
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::ParseMetaDataL()"));
+
+ //
+ // Clip Name
+ //
+ if ( aMedia.IsSupported( KMPXMediaGeneralUri ) )
+ {
+ TPtrC uri( aMedia.ValueText( KMPXMediaGeneralUri ) );
+ const QString qClipname( (QChar*)uri.Ptr(), uri.Length() );
+ iFileDetails->mClipName = qClipname;
+ }
+
+ //
+ // Title
+ //
+ if ( aMedia.IsSupported( KMPXMediaGeneralTitle ) )
+ {
+ TPtrC title( aMedia.ValueText( KMPXMediaGeneralTitle ) );
+ const QString qTitle( (QChar*)title.Ptr(), title.Length() );
+ iFileDetails->mTitle = qTitle;
+ }
+
+ //
+ // Artist
+ //
+ if ( aMedia.IsSupported( KMPXMediaVideoArtist ) )
+ {
+ TPtrC artist( aMedia.ValueText( KMPXMediaVideoArtist ) );
+ const QString qArtist( (QChar*)artist.Ptr(), artist.Length() );
+ iFileDetails->mArtist = qArtist;
+ }
+
+ //
+ // Mime Type
+ //
+ if ( aMedia.IsSupported( KMPXMediaGeneralMimeType ) )
+ {
+ TPtrC mimeType( aMedia.ValueText( KMPXMediaGeneralMimeType ) );
+ const QString qMimeType( (QChar*)mimeType.Ptr(), mimeType.Length() );
+ iFileDetails->mMimeType = qMimeType;
+ }
+
+ //
+ // Duration
+ //
+ if ( aMedia.IsSupported( KMPXMediaGeneralDuration ) )
+ {
+ iFileDetails->mDuration = aMedia.ValueTObjectL<TInt>( KMPXMediaGeneralDuration );
+ }
+
+ //
+ // Audio Enabled
+ //
+ if ( aMedia.IsSupported( KMPXMediaVideoAudioEnabled ) )
+ {
+ iFileDetails->mAudioEnabled = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoAudioEnabled );
+ }
+
+ //
+ // Video Enabled
+ //
+ if ( aMedia.IsSupported( KMPXMediaVideoVideoEnabled ) )
+ {
+ iFileDetails->mVideoEnabled = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoVideoEnabled );
+ }
+
+ //
+ // Partial Playback
+ //
+ if ( aMedia.IsSupported( KMPXMediaVideoPartialPlayback ) )
+ {
+ iFileDetails->mPartialPlayback =
+ aMedia.ValueTObjectL<TInt>( KMPXMediaVideoPartialPlayback );
+ }
+
+ //
+ // Playback Mode
+ //
+ if ( aMedia.IsSupported( KMPXMediaVideoPlaybackMode ) )
+ {
+ iFileDetails->mPlaybackMode =
+ (TMPXVideoMode)aMedia.ValueTObjectL<TInt>( KMPXMediaVideoPlaybackMode );
+ }
+
+ //
+ // Seekable
+ //
+ if ( aMedia.IsSupported( KMPXMediaVideoSeekable ) )
+ {
+ iFileDetails->mSeekable = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoSeekable );
+ }
+
+ //
+ // Pausable
+ //
+ if ( aMedia.IsSupported( KMPXMediaVideoPausableStream ) )
+ {
+ iFileDetails->mPausableStream = aMedia.ValueTObjectL<TBool>( KMPXMediaVideoPausableStream );
+ }
+
+ //
+ // Video Height
+ //
+ if ( aMedia.IsSupported( KMPXMediaVideoHeight ) )
+ {
+ iFileDetails->mVideoHeight = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoHeight );
+ }
+
+ //
+ // Video Width
+ //
+ if ( aMedia.IsSupported( KMPXMediaVideoWidth ) )
+ {
+ iFileDetails->mVideoWidth = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoWidth );
+ }
+
+ //
+ // TV-Out Connected
+ //
+ if ( aMedia.IsSupported( KMPXMediaVideoTvOutConnected ) )
+ {
+ iFileDetails->mTvOutConnected = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoTvOutConnected );
+ }
+
+ //
+ // TV-Out Playback Allowed
+ //
+ if ( aMedia.IsSupported( KMPXMediaVideoTvOutPlayAllowed ) )
+ {
+ iFileDetails->mTvOutPlayAllowed =
+ aMedia.ValueTObjectL<TInt>( KMPXMediaVideoTvOutPlayAllowed );
+ }
+
+ //
+ // BitRate
+ //
+ if ( aMedia.IsSupported( KMPXMediaVideoBitRate ) )
+ {
+ iFileDetails->mBitRate = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoBitRate );
+ }
+
+ //
+ // Drm Protected
+ //
+ if ( aMedia.IsSupported( KMPXMediaVideoDrmProtected ) )
+ {
+ iFileDetails->mDrmProtected = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoDrmProtected );
+ }
+
+ //
+ // Description
+ //
+ if ( aMedia.IsSupported( KMPXMediaVideoDescription ) )
+ {
+ TPtrC description( aMedia.ValueText( KMPXMediaVideoDescription ) );
+ const QString qDescription( (QChar*)description.Ptr(), description.Length() );
+ iFileDetails->mDescription = qDescription;
+ }
+
+ //
+ // Location
+ //
+ if ( aMedia.IsSupported( KMPXMediaVideoLocation ) )
+ {
+ TPtrC location( aMedia.ValueText( KMPXMediaVideoLocation ) );
+ const QString qLocation( (QChar*)location.Ptr(), location.Length() );
+ iFileDetails->mLocation = qLocation;
+ }
+
+ //
+ // Copyright
+ //
+ if ( aMedia.IsSupported( KMPXMediaVideoCopyright ) )
+ {
+ TPtrC copyright( aMedia.ValueText( KMPXMediaVideoCopyright ) );
+ const QString qCopyright( (QChar*)copyright.Ptr(), copyright.Length() );
+ iFileDetails->mCopyright = qCopyright;
+ }
+
+ //
+ // Language
+ //
+ if ( aMedia.IsSupported( KMPXMediaVideoLanguage ) )
+ {
+ TPtrC language( aMedia.ValueText( KMPXMediaVideoLanguage ) );
+ const QString qLanguage( (QChar*)language.Ptr(), language.Length() );
+ iFileDetails->mLanguage = qLanguage;
+ }
+
+ //
+ // Keywords
+ //
+ if ( aMedia.IsSupported( KMPXMediaVideoKeywords ) )
+ {
+ TPtrC keywords( aMedia.ValueText( KMPXMediaVideoKeywords ) );
+ const QString qKeywords( (QChar*)keywords.Ptr(), keywords.Length() );
+ iFileDetails->mKeywords = qKeywords;
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// Handle media properties.
+// Notes: The client is responsible for delete the object of aProperties.
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::DoHandleMediaL( const CMPXMessage& aMedia, TInt aError )
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::DoHandleMediaL()"),
+ _L("aError = %d"), aError );
+
+ if ( aError == KErrNone )
+ {
+ if ( iFileDetails )
+ {
+ iFileDetails->clearFileDetails();
+ }
+ else
+ {
+ iFileDetails = new QMPXVideoPlaybackViewFileDetails();
+ }
+
+ //
+ // Read in the media data
+ //
+ ParseMetaDataL( aMedia );
+
+ //
+ // Create controls since file details are available
+ //
+ if ( iControlsController )
+ {
+ iControlsController->addFileDetails( iFileDetails );
+ }
+
+ if ( iFileDetails->mVideoEnabled )
+ {
+ RWindow *window = iView->getWindow();
+
+ TRect displayRect = TRect( window->Position().iX,
+ window->Position().iY,
+ window->Position().iX + window->Size().iWidth,
+ window->Position().iY + window->Size().iHeight );
+
+ TReal displayAspectRatio = (TReal32)displayRect.Width() / (TReal32)displayRect.Height();
+
+ TInt newAspectRatio =
+ iDisplayHandler->SetDefaultAspectRatioL( iFileDetails, displayAspectRatio );
+
+ //
+ // Setup the display window and issue play command
+ //
+ iDisplayHandler->CreateDisplayWindowL( CCoeEnv::Static()->WsSession(),
+ *(CCoeEnv::Static()->ScreenDevice()),
+ *window,
+ displayRect );
+
+ if ( iControlsController )
+ {
+ iControlsController->handleEvent( EMPXControlCmdSetAspectRatio, newAspectRatio );
+ }
+ }
+
+ CreateGeneralPlaybackCommandL( EPbCmdPlay );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// From MMPXPlaybackCallback
+// Handle media event.
+// Notes: The client is responsible for delete the object of aProperties.
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::HandleMediaL( const CMPXMedia& aMedia, TInt aError)
+{
+ MPX_ENTER_EXIT(_L( "CMPXVideoViewWrapper::HandleMediaL()" ));
+ if ( aMedia.IsSupported( KMPXMediaVideoError ) )
+ {
+ TInt error = aMedia.ValueTObjectL<TInt>( KMPXMediaVideoError );
+ // Reset the controls
+ HandleCommandL( EMPXPbvCmdResetControls );
+ // Set the iMediaRequested flag to false
+ iMediaRequested = EFalse;
+ // Reset the playback state to stopped
+ iPlaybackState = EPbStateStopped;
+ // Handle the plugin error
+ iView->handlePluginError( error );
+ }
+ else
+ {
+ DoHandleMediaL( aMedia, aError );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::SetPropertyL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::SetPropertyL( TMPXPlaybackProperty aProperty, TInt aValue )
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::SetPropertyL"),
+ _L("aProperty = %d, aValue = %d"), aProperty, aValue );
+
+ iPlaybackUtility->SetL( aProperty, aValue );
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::HandlePropertyL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::HandlePropertyL( TMPXPlaybackProperty aProperty,
+ TInt aValue,
+ TInt aError )
+{
+ MPX_DEBUG(_L("CMPXVideoViewWrapper::DoHandlePropertyL - Error(%d)"), aError );
+
+ if ( aError == KErrNone )
+ {
+ switch ( aProperty )
+ {
+ case EPbPropertyPosition:
+ {
+ MPX_DEBUG(_L("CMPXVideoViewWrapper::DoHandlePropertyL position(%d)"), aValue );
+
+ if ( iControlsController )
+ {
+ iControlsController->handleEvent( EMPXControlCmdSetPosition, aValue );
+ }
+
+ break;
+ }
+ case EPbPropertyDuration:
+ {
+ MPX_DEBUG(_L("CMPXVideoViewWrapper::DoHandlePropertyL duration(%d)"), aValue );
+
+ if ( iControlsController )
+ {
+ iControlsController->handleEvent( EMPXControlCmdSetDuration, aValue );
+ }
+
+ break;
+ }
+ case EPbPropertyMaxVolume:
+ {
+ MPX_DEBUG(_L("CMPXVideoViewWrapper::DoHandlePropertyL max volume(%d)"), aValue );
+
+ break;
+ }
+ case EPbPropertyVolume:
+ {
+ MPX_DEBUG(_L("CMPXVideoViewWrapper::DoHandlePropertyL volume(%d)"), aValue );
+
+ if ( iControlsController )
+ {
+ iControlsController->handleEvent( EMPXControlCmdSetVolume, aValue );
+ }
+
+ break;
+ }
+ case EPbPropertyMute:
+ {
+ MPX_DEBUG(_L("CMPXVideoViewWrapper::DoHandlePropertyL mute(%d)"), aValue );
+
+ if ( iControlsController && aValue )
+ {
+ iControlsController->handleEvent( EMPXControlCmdSetVolume, 0 );
+ }
+
+ break;
+ }
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::RetrieveFileNameAndModeL
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::RetrieveFileNameAndModeL( CMPXCommand* aCmd )
+{
+ //
+ // set attributes on the command
+ //
+ aCmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
+
+ aCmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXMediaIdVideoPlayback );
+
+ aCmd->SetTObjectValueL<TMPXVideoPlaybackCommand>( KMPXMediaVideoPlaybackCommand,
+ EPbCmdInitView );
+
+ iPlaybackUtility->CommandL( *aCmd );
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::ActivateClosePlayerActiveObject
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::ActivateClosePlayerActiveObject()
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::ActivateClosePlayerActiveObject()"));
+
+ if ( ! iCloseAO->IsActive() )
+ {
+ iCloseAO->Start( TCallBack( CMPXVideoViewWrapper::ClosePlayerL, this ) );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::ClosePlayerL
+// -------------------------------------------------------------------------------------------------
+//
+TInt CMPXVideoViewWrapper::ClosePlayerL( TAny* aPtr )
+{
+ MPX_DEBUG(_L("CMPXVideoViewWrapper::ClosePlayerL()"));
+
+ static_cast<CMPXVideoViewWrapper*>(aPtr)->DoClosePlayerL();
+ return KErrNone;
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::DoClosePlayerL
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::DoClosePlayerL()
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::DoClosePlayerL()"));
+
+ iView->doClosePlayer();
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::IssuePlayCommandL
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::IssuePlayCommandL()
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::IssuePlayCommandL()"));
+ CreateGeneralPlaybackCommandL( EPbCmdPlay );
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::RetrievePdlInformationL
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::RetrievePdlInformationL()
+{
+ MPX_DEBUG(_L("CMPXVideoViewWrapper::RetrievePdlInformationL()"));
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::CreateVideoSpecificCmdL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::CreateVideoSpecificCmdL( TMPXVideoPlaybackCommand aCmd )
+{
+ //
+ // create command to pass to playback plugin
+ //
+ CMPXCommand* cmd = CMPXCommand::NewL();
+ CleanupStack::PushL( cmd );
+
+ cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
+
+ cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXMediaIdVideoPlayback );
+
+ cmd->SetTObjectValueL<TMPXVideoPlaybackCommand>( KMPXMediaVideoPlaybackCommand, aCmd );
+
+ iPlaybackUtility->CommandL( *cmd );
+
+ CleanupStack::PopAndDestroy( cmd );
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::SetAspectRatioL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::SetAspectRatioL( TMPXVideoPlaybackCommand aCmd )
+{
+ MPX_DEBUG(_L("CMPXVideoViewWrapper::SetAspectRatioL()"));
+
+ TInt newAspectRatio = iDisplayHandler->SetAspectRatioL( aCmd );
+
+ if ( iControlsController )
+ {
+ iControlsController->handleEvent( EMPXControlCmdSetAspectRatio, newAspectRatio );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::IsAppInFrontL()
+// Returns true if app is foreground. Uses windowgroup id
+// -------------------------------------------------------------------------------------------------
+//
+TBool CMPXVideoViewWrapper::IsAppInFrontL()
+{
+ TBool ret = EFalse;
+ RWsSession wsSession;
+
+ User::LeaveIfError( wsSession.Connect() );
+
+ if( wsSession.Handle() )
+ {
+ CArrayFixFlat<TInt>* wgList =
+ new (ELeave) CArrayFixFlat<TInt>( wsSession.NumWindowGroups() );
+
+ // check if our window is front or not
+ if ( wsSession.WindowGroupList( 0, wgList ) == KErrNone )
+ {
+ ret = ( CEikonEnv::Static()->RootWin().Identifier() == wgList->At(0) );
+ }
+ else
+ {
+ ret = EFalse;
+ }
+
+ delete wgList;
+ }
+
+ wsSession.Close();
+
+ MPX_DEBUG(_L("CMPXVideoViewWrapper::IsAppInFrontL (%d)" ), ret);
+
+ return ret;
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::ClosePlaybackViewL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::ClosePlaybackViewL()
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::closePlaybackView()"));
+
+ iView->closePlaybackView();
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::HandleVolumeCmdL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::HandleVolumeCmdL( TMPXPlaybackCommand aCmd )
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::HandleVolumeCmdL()"));
+
+ //
+ // In case user try to change the volume via media key, rocker key or etc
+ // We need to show the controls though the volume level doesn't get changed
+ // For examples : - try to change the volume with a clip without audio track
+ // - try to reduce the volume with volume level 0
+ // - try to increase the volume with max volume level
+ //
+ iControlsController->handleEvent( EMPXControlCmdShowVolumeControls );
+
+ iPlaybackUtility->CommandL( aCmd );
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::HandleShortPressBackwardL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::HandleShortPressBackwardL()
+{
+ MPX_DEBUG(_L("CMPXVideoViewWrapper::HandleCommandL()"));
+
+ if( !iPlaylistView )
+ {
+ SetPropertyL( EPbPropertyPosition, 0 );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::IssueVideoAppForegroundCmd()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::IssueVideoAppForegroundCmdL( TBool aForeground )
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::HandleForegroundEventL()"),
+ _L("aForeground = %d"), aForeground );
+
+ TMPXVideoPlaybackCommand videoCmd = EPbCmdHandleBackground;
+
+ if ( aForeground )
+ {
+ videoCmd = EPbCmdHandleForeground;
+ }
+
+ //
+ // create command to pass to playback plugin
+ //
+ CMPXCommand* cmd = CMPXCommand::NewL();
+ CleanupStack::PushL( cmd );
+
+ cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
+ cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXMediaIdVideoPlayback );
+ cmd->SetTObjectValueL<TMPXVideoPlaybackCommand>( KMPXMediaVideoPlaybackCommand, videoCmd );
+ cmd->SetTObjectValueL<TBool>( KMPXMediaVideoAppForeground, IsAppInFrontL() );
+
+ iPlaybackUtility->CommandL( *cmd );
+ CleanupStack::PopAndDestroy( cmd );
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::CreateControlsL()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::CreateControlsL()
+{
+ MPX_ENTER_EXIT(_L("CMPXVideoViewWrapper::CreateControlsL()"));
+
+ //
+ // Query playback plugin for filename and mode
+ //
+ CMPXCommand* cmd = CMPXCommand::NewL();
+ CleanupStack::PushL( cmd );
+
+ RetrieveFileNameAndModeL( cmd );
+
+ //
+ // Create a temporary file details that is populated with the
+ // file name and playback mode. This will be delete when
+ // plugin initialization is complete
+ //
+ if ( iFileDetails )
+ {
+ delete iFileDetails;
+ iFileDetails = NULL;
+ }
+
+ iFileDetails = new QMPXVideoPlaybackViewFileDetails();
+
+ TPtrC fileName( cmd->ValueText( KMPXMediaVideoPlaybackFileName ) );
+ const QString qFilename( (QChar*)fileName.Ptr(), fileName.Length() );
+ iFileDetails->mClipName = qFilename;
+
+ iFileDetails->mPlaybackMode = (TMPXVideoMode) cmd->ValueTObjectL<TInt>( KMPXMediaVideoMode );
+
+ iFileDetails->mTvOutConnected = cmd->ValueTObjectL<TInt>( KMPXMediaVideoTvOutConnected );
+ iFileDetails->mTvOutPlayAllowed = cmd->ValueTObjectL<TInt>( KMPXMediaVideoTvOutPlayAllowed );
+
+ TPtrC mimeType( cmd->ValueText( KMPXMediaVideoRecognizedMimeType ) );
+ const QString qMimeType( (QChar*)mimeType.Ptr(), mimeType.Length() );
+ iFileDetails->mMimeType = qMimeType;
+
+ iFileDetails->mMultiItemPlaylist = IsMultiItemPlaylist();
+
+ CleanupStack::PopAndDestroy( cmd );
+
+ if ( iControlsController )
+ {
+ delete iControlsController;
+ iControlsController = NULL;
+ }
+
+ iControlsController = new QMPXVideoPlaybackControlsController( iView, this, iFileDetails );
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::IsMultiItemPlaylist()
+// -------------------------------------------------------------------------------------------------
+//
+TBool CMPXVideoViewWrapper::IsMultiItemPlaylist()
+{
+ TInt numItems = 1;
+ MMPXSource* s = iPlaybackUtility->Source();
+
+ if ( s )
+ {
+ CMPXCollectionPlaylist* playlist = NULL;
+
+ MPX_TRAPD( err, playlist = s->PlaylistL() );
+
+ if ( err == KErrNone && playlist )
+ {
+ numItems = playlist->Count();
+ delete playlist;
+ }
+ }
+
+ TBool retVal = ( numItems > 1 );
+
+ MPX_DEBUG(_L("CMPXVideoViewWrapper::IsMultiItemPlaylist(%d)"), retVal);
+
+ return retVal;
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::UpdateVideoRect()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::UpdateVideoRect(
+ TInt aX, TInt aY, TInt aWidth, TInt aHeight, TBool transitionEffect )
+{
+ MPX_DEBUG(_L("CMPXVideoViewWrapper::UpdateVideoRect()"));
+
+ TRect rect( TPoint( aX, aY ), TSize( aWidth, aHeight ) );
+ TRAP_IGNORE( iDisplayHandler->UpdateVideoRectL( rect, transitionEffect ) );
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMPXVideoViewWrapper::UpdateVideoRectDone()
+// -------------------------------------------------------------------------------------------------
+//
+void CMPXVideoViewWrapper::UpdateVideoRectDone()
+{
+ MPX_DEBUG(_L("CMPXVideoViewWrapper::UpdateVideoRectDone()"));
+
+ iControlsController->updateVideoRectDone();
+}
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayback/inc/hbvideobaseplaybackview.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,119 @@
+/*
+* 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: MPX Video base playback view
+*
+*/
+
+// Version : %version: da1mmcf#11 %
+
+
+
+// This file defines the API for .dll
+
+#ifndef __HBVIDEOBASEPLAYBACKVIEW_H__
+#define __HBVIDEOBASEPLAYBACKVIEW_H__
+
+// Include Files
+#include <hbview.h>
+
+// Constants
+
+// Forward Declarations
+class QTimer;
+class RWindow;
+class CMPXVideoViewWrapper;
+
+
+// Class Definitions
+
+class HbVideoBasePlaybackView : public HbView
+{
+ Q_OBJECT
+
+ public:
+ HbVideoBasePlaybackView();
+ virtual ~HbVideoBasePlaybackView();
+
+ signals:
+ void activatePreviousView();
+ void tappedOnScreen();
+
+ protected slots:
+ virtual void closePlaybackView();
+
+ public:
+
+ virtual void retrievePdlInformation();
+
+ virtual void handleActivateView();
+
+ virtual void handleDeactivateView();
+
+ virtual void handlePluginError( int aError );
+
+ /*
+ * Handle transition to the stopped state
+ */
+ virtual void handleStoppedState() = 0;
+
+ virtual void doClosePlayer();
+
+ //
+ // Function the derived classes must implement
+ //
+ virtual void handleSoftkeyBack() = 0;
+
+ /*
+ * Handle Download State Change
+ * @param aState new state of the download
+ */
+ virtual void handlePdlStateChange( int aState ) = 0;
+
+ virtual void handleBufferingState();
+
+ virtual void issuePlayCommand();
+
+ void initializeVideoPlaybackView();
+ void displayInfoMessage( const QString& qString );
+ void displayErrorMessage( const QString& qString );
+
+ virtual void handleClosePlaybackView();
+
+ bool event( QEvent *event );
+
+ void paint( QPainter *painter,
+ const QStyleOptionGraphicsItem *option,
+ QWidget *widget );
+
+ RWindow *getWindow();
+
+ protected:
+
+ void mousePressEvent( QGraphicsSceneMouseEvent *event );
+ void mouseReleaseEvent( QGraphicsSceneMouseEvent *event );
+
+ protected: // data
+ CMPXVideoViewWrapper *mVideoMpxWrapper;
+
+ QTimer *mTimerForClosingView;
+
+ bool mActivated;
+
+ public:
+ friend class CMPXVideoViewWrapper;
+};
+
+#endif // __HBVIDEOBASEPLAYBACKVIEW_H__
+
+// EOF
--- a/videoplayback/videohelix/inc/mpxvideodrmhelper.h Tue Feb 02 00:12:10 2010 +0200
+++ b/videoplayback/videohelix/inc/mpxvideodrmhelper.h Thu Apr 01 22:38:49 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 4 %
+// Version : %version: 5 %
#ifndef __MPXVIDEODRMHELPER_H__
#define __MPXVIDEODRMHELPER_H__
@@ -48,7 +48,7 @@
*/
static CMpxVideoDrmHelper* NewL();
- TBool IsProtected( RFile& aFile );
+ TBool IsProtectedL( RFile& aFile );
TInt GetDrmRightsStatus( RFile& aFile );
@@ -56,7 +56,7 @@
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
- TBool IsProtected64( RFile64& aFile );
+ TBool IsProtected64L( RFile64& aFile );
TInt GetDrmRightsStatus64( RFile64& aFile );
TBool IsTvOutAllowed64L( RFile64& aFile );
--- a/videoplayback/videohelix/inc/mpxvideofiledetails.h Tue Feb 02 00:12:10 2010 +0200
+++ b/videoplayback/videohelix/inc/mpxvideofiledetails.h Thu Apr 01 22:38:49 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 7 %
+// Version : %version: 8 %
@@ -58,6 +58,11 @@
HBufC* iTitle;
HBufC* iArtist;
HBufC* iMimeType;
+ HBufC* iDescription;
+ HBufC* iLocation;
+ HBufC* iCopyright;
+ HBufC* iLanguage;
+ HBufC* iKeywords;
TInt iResolutionWidth;
--- a/videoplayback/videohelix/src/mpxvideodlmgrif.cpp Tue Feb 02 00:12:10 2010 +0200
+++ b/videoplayback/videohelix/src/mpxvideodlmgrif.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 21 %
+// Version : %version: 23 %
#include <MMFROPCustomCommandConstants.h>
@@ -160,7 +160,6 @@
iCurrentDl->SetBoolAttribute( EDlAttrSilent, EFalse );
- //a temp hack until dl manager has a fix for this
TInt32 activeDownload( 0 );
iCurrentDl->GetIntAttribute( EDlAttrActiveDownload, activeDownload );
iCurrentDl->SetIntAttribute( EDlAttrActivePlayedDownload, activeDownload );
@@ -737,7 +736,7 @@
{
MPX_ENTER_EXIT(_L("CMPXVideoDlMgrIf::UpdateDownloadSizeL()"));
- if ( iController->iDrmHelper->IsProtected( iController->iFileHandle ) )
+ if ( iController->iDrmHelper->IsProtectedL( iController->iFileHandle ) )
{
MPX_DEBUG(_L("CMPXVideoDlMgrIf::UpdateDownloadSizeL() download is DRM protected"));
--- a/videoplayback/videohelix/src/mpxvideodrmhelper.cpp Tue Feb 02 00:12:10 2010 +0200
+++ b/videoplayback/videohelix/src/mpxvideodrmhelper.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 7 %
+// Version : %version: 8 %
#include <caf/data.h>
@@ -55,19 +55,19 @@
}
// ------------------------------------------------------------------------------------------------
-// CMpxVideoDrmHelper::IsProtected()
+// CMpxVideoDrmHelper::IsProtectedL()
// ------------------------------------------------------------------------------------------------
//
-TBool CMpxVideoDrmHelper::IsProtected( RFile& aFile )
+TBool CMpxVideoDrmHelper::IsProtectedL( RFile& aFile )
{
TBool drmProtected = EFalse;
if ( aFile.SubSessionHandle() )
{
- MPX_TRAPD( err, drmProtected = iDrmUtility->IsProtectedL( aFile ) );
+ drmProtected = iDrmUtility->IsProtectedL( aFile );
}
- MPX_DEBUG(_L("CMpxVideoDrmHelper::IsProtected(%d)"), drmProtected);
+ MPX_DEBUG(_L("CMpxVideoDrmHelper::IsProtectedL(%d)"), drmProtected);
return drmProtected;
}
@@ -81,8 +81,11 @@
MPX_ENTER_EXIT(_L("CMpxVideoDrmHelper::GetDrmRightsStatus()"));
TInt drmError = KErrNone;
+ TBool drmProtected = EFalse;
- if ( IsProtected( aFile ) )
+ MPX_TRAP( drmError, drmProtected = IsProtectedL(aFile ) );
+
+ if ( drmProtected && (drmError == KErrNone) )
{
ContentAccess::CData* data = NULL;
@@ -111,7 +114,7 @@
{
TBool tvOutAllowed = ETrue;
- if ( IsProtected( aFile ) )
+ if ( IsProtectedL( aFile ) )
{
ContentAccess::CContent* content = ContentAccess::CContent::NewLC( aFile );
@@ -145,19 +148,19 @@
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
// ------------------------------------------------------------------------------------------------
-// CMpxVideoDrmHelper::IsProtected64()
+// CMpxVideoDrmHelper::IsProtected64L()
// ------------------------------------------------------------------------------------------------
//
-TBool CMpxVideoDrmHelper::IsProtected64( RFile64& aFile )
+TBool CMpxVideoDrmHelper::IsProtected64L( RFile64& aFile )
{
TBool drmProtected = EFalse;
if ( aFile.SubSessionHandle() )
{
- MPX_TRAPD( err, drmProtected = iDrmUtility->IsProtectedL( aFile ) );
+ drmProtected = iDrmUtility->IsProtectedL( aFile );
}
- MPX_DEBUG(_L("CMpxVideoDrmHelper::IsProtected64(%d)"), drmProtected);
+ MPX_DEBUG(_L("CMpxVideoDrmHelper::IsProtected64L(%d)"), drmProtected);
return drmProtected;
}
@@ -171,8 +174,11 @@
MPX_ENTER_EXIT(_L("CMpxVideoDrmHelper::GetDrmRightsStatus64()"));
TInt drmError = KErrNone;
+ TBool drmProtected = EFalse;
- if ( IsProtected64( aFile ) )
+ MPX_TRAP( drmError, drmProtected = IsProtected64L( aFile ) );
+
+ if ( drmProtected && (drmError == KErrNone) )
{
ContentAccess::CData* data = NULL;
@@ -205,7 +211,7 @@
{
TBool tvOutAllowed = ETrue;
- if ( IsProtected64( aFile ) )
+ if ( IsProtected64L( aFile ) )
{
ContentAccess::CContent* content = ContentAccess::CContent::NewLC( aFile );
--- a/videoplayback/videohelix/src/mpxvideofiledetails.cpp Tue Feb 02 00:12:10 2010 +0200
+++ b/videoplayback/videohelix/src/mpxvideofiledetails.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 9 %
+// Version : %version: 10 %
@@ -83,6 +83,36 @@
iClipName = NULL;
}
+ if ( iDescription )
+ {
+ delete iDescription;
+ iDescription = NULL;
+ }
+
+ if ( iLocation )
+ {
+ delete iLocation;
+ iLocation = NULL;
+ }
+
+ if ( iCopyright )
+ {
+ delete iCopyright;
+ iCopyright = NULL;
+ }
+
+ if ( iLanguage )
+ {
+ delete iLanguage;
+ iLanguage = NULL;
+ }
+
+ if ( iKeywords )
+ {
+ delete iKeywords;
+ iKeywords = NULL;
+ }
+
iResolutionWidth = 0;
iResolutionHeight = 0;
iMaxVolume = 0;
--- a/videoplayback/videohelix/src/mpxvideoplaybackcontroller.cpp Tue Feb 02 00:12:10 2010 +0200
+++ b/videoplayback/videohelix/src/mpxvideoplaybackcontroller.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: ou1cpsw#41 %
+// Version : %version: 43 %
//
@@ -75,6 +75,12 @@
_LIT( KTrue, "1" );
_LIT( KFalse, "0" );
_LIT (KMPStreamingPauseSupported, "StreamingPauseSupported");
+_LIT( KDescription, "Description" );
+_LIT( KAbstract, "Abstract" );
+_LIT( KLocation, "Location" );
+_LIT( KRightCopy, "Copyright" );
+_LIT( KLanguage, "Language" );
+_LIT( KKeywords, "Keywords" );
// ============================ MEMBER FUNCTIONS ===================================================
@@ -1273,12 +1279,12 @@
//
if ( iFileHandle.SubSessionHandle() )
{
- iFileDetails->iDrmProtected = iDrmHelper->IsProtected( iFileHandle );
+ iFileDetails->iDrmProtected = iDrmHelper->IsProtectedL( iFileHandle );
}
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
else if ( iFileHandle64.SubSessionHandle() )
{
- iFileDetails->iDrmProtected = iDrmHelper->IsProtected64( iFileHandle64 );
+ iFileDetails->iDrmProtected = iDrmHelper->IsProtected64L( iFileHandle64 );
}
#endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
@@ -1364,7 +1370,13 @@
else if ( ( ! metaData->Name().CompareF( KArtist ) ) ||
( ! metaData->Name().CompareF( KAuthor ) ) )
{
- iFileDetails->iArtist = metaData->Value().AllocL();
+ //
+ // Do not overwrite the artist
+ //
+ if ( ! iFileDetails->iArtist )
+ {
+ iFileDetails->iArtist = metaData->Value().AllocL();
+ }
}
else if ( ! metaData->Name().CompareF( KFormat ) )
{
@@ -1384,7 +1396,34 @@
iFileDetails->iPausableStream = EFalse;
}
}
-
+ else if ( ( ! metaData->Name().CompareF( KDescription ) ) ||
+ ( ! metaData->Name().CompareF( KAbstract ) ) )
+ {
+ //
+ // Do not overwrite the description
+ //
+ if ( ! iFileDetails->iDescription )
+ {
+ iFileDetails->iDescription = metaData->Value().AllocL();
+ }
+ }
+ else if ( !metaData->Name().CompareF( KLocation ) )
+ {
+ iFileDetails->iLocation = metaData->Value().AllocL();
+ }
+ else if ( !metaData->Name().CompareF( KRightCopy ) )
+ {
+ iFileDetails->iCopyright = metaData->Value().AllocL();
+ }
+ else if ( !metaData->Name().CompareF( KLanguage ) )
+ {
+ iFileDetails->iLanguage = metaData->Value().AllocL();
+ }
+ else if ( !metaData->Name().CompareF( KKeywords ) )
+ {
+ iFileDetails->iKeywords = metaData->Value().AllocL();
+ }
+
CleanupStack::PopAndDestroy( metaData );
}
--- a/videoplayback/videohelix/src/mpxvideoplaybackstate.cpp Tue Feb 02 00:12:10 2010 +0200
+++ b/videoplayback/videohelix/src/mpxvideoplaybackstate.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 31 %
+// Version : %version: 33 %
//
@@ -526,6 +526,61 @@
TMPXAttribute( KMPXMediaVideoDrmProtected ),
iVideoPlaybackCtlr->iFileDetails->iDrmProtected );
}
+
+ //
+ // Description
+ //
+ if ( ( attrV & KMPXMediaVideoDescription.iAttributeId ) &&
+ ( iVideoPlaybackCtlr->iFileDetails->iDescription ) )
+ {
+ aMedia->SetTextValueL(
+ TMPXAttribute( KMPXMediaVideoDescription ),
+ *( iVideoPlaybackCtlr->iFileDetails->iDescription ) );
+ }
+
+ //
+ // Location
+ //
+ if ( ( attrV & KMPXMediaVideoLocation.iAttributeId ) &&
+ ( iVideoPlaybackCtlr->iFileDetails->iLocation ) )
+ {
+ aMedia->SetTextValueL(
+ TMPXAttribute( KMPXMediaVideoLocation ),
+ *( iVideoPlaybackCtlr->iFileDetails->iLocation ) );
+ }
+
+ //
+ // Copyright
+ //
+ if ( ( attrV & KMPXMediaVideoCopyright.iAttributeId ) &&
+ ( iVideoPlaybackCtlr->iFileDetails->iCopyright ) )
+ {
+ aMedia->SetTextValueL(
+ TMPXAttribute( KMPXMediaVideoCopyright ),
+ *( iVideoPlaybackCtlr->iFileDetails->iCopyright ) );
+ }
+
+ //
+ // Language
+ //
+ if ( ( attrV & KMPXMediaVideoLanguage.iAttributeId ) &&
+ ( iVideoPlaybackCtlr->iFileDetails->iLanguage ) )
+ {
+ aMedia->SetTextValueL(
+ TMPXAttribute( KMPXMediaVideoLanguage ),
+ *( iVideoPlaybackCtlr->iFileDetails->iLanguage ) );
+ }
+
+ //
+ // Keywords
+ //
+ if ( ( attrV & KMPXMediaVideoKeywords.iAttributeId ) &&
+ ( iVideoPlaybackCtlr->iFileDetails->iKeywords ) )
+ {
+ aMedia->SetTextValueL(
+ TMPXAttribute( KMPXMediaVideoKeywords ),
+ *( iVideoPlaybackCtlr->iFileDetails->iKeywords ) );
+ }
}
// ------------------------------------------------------------------------------------------------
@@ -669,7 +724,7 @@
// CMPXVideoPlaybackState::IssuePlayCommand()
// ------------------------------------------------------------------------------------------------
void CMPXVideoPlaybackState::IssuePlayCommand( TMPXVideoPlaybackState aState,
- MMPXPlaybackPluginObserver::TEvent aEvent,
+ MMPXPlaybackPluginObserver::TEvent aEvent,
TBool aSendEvent )
{
MPX_ENTER_EXIT(_L("CMPXVideoPlaybackState::CMPXVideoPlaybackState::IssuePlayCommand()"),
@@ -680,7 +735,7 @@
if ( err == KErrNone )
{
iVideoPlaybackCtlr->ChangeState( aState );
-
+
if ( aSendEvent )
{
iVideoPlaybackCtlr->iMPXPluginObs->HandlePluginEvent( aEvent, 0, KErrNone );
@@ -1130,7 +1185,7 @@
//
if ( pos != 0 )
{
- iVideoPlaybackCtlr->iPlayer->SetPositionL( pos );
+ iVideoPlaybackCtlr->iPlayer->SetPositionL( pos );
}
}
else
@@ -1506,6 +1561,10 @@
{
iVideoPlaybackCtlr->iState->HandlePlay();
}
+ else
+ {
+ iVideoPlaybackCtlr->iPlayer->RefreshFrameL();
+ }
}
// ------------------------------------------------------------------------------------------------
--- a/videoplayback/videohelix/src/mpxvideoplayerutility.cpp Tue Feb 02 00:12:10 2010 +0200
+++ b/videoplayback/videohelix/src/mpxvideoplayerutility.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -12,10 +12,10 @@
* Contributors:
*
* Description: This class is the interface between the playback plugin and RMMFController
- *
+*
*/
-// Version : %version: 13 %
+// Version : %version: 15 %
#include <AudioPreference.h>
@@ -66,8 +66,6 @@
MPX_ENTER_EXIT(_L("CMpxVideoPlayerUtility::~CMpxVideoPlayerUtility()"));
Close();
-
- delete iControllerEventMonitor;
}
void CMpxVideoPlayerUtility::Close()
@@ -226,9 +224,9 @@
TUint32 CMpxVideoPlayerUtility::FourCCCode() const
{
- TFourCC aFourCC( 0 );
+ TFourCC aFourCC( 0 );
iVideoControllerCustomCommands.GetAudioCodec( aFourCC );
-
+
return aFourCC.FourCC();
}
@@ -513,13 +511,6 @@
error = iVideoPlaySurfaceSupportCustomCommands.SurfaceRemoved( oldSurfaceId );
}
}
- else
- {
- if ( replaceSurface )
- {
- iVideoPlaySurfaceSupportCustomCommands.SurfaceRemoved( oldSurfaceId );
- }
- }
return error;
}
@@ -609,10 +600,10 @@
CMPXMessage* msg = CMPXMessage::NewL();
CleanupStack::PushL( msg );
- msg->SetTObjectValueL<TInt>( KMPXMessageGeneralId, KMPXMediaIdVideoDisplayMessage );
+ msg->SetTObjectValueL<TInt>( KMPXMessageGeneralId, KMPXMediaIdVideoDisplaySyncMessage );
msg->SetTObjectValueL<TInt>( KMPXMediaVideoDisplayCommand, aCmd );
- iVideoPlaybackController->iMPXPluginObs->HandlePlaybackMessage( msg, KErrNone );
+ iVideoPlaybackController->iMPXPluginObs->HandlePlaybackSyncMessage( *msg );
CleanupStack::PopAndDestroy( msg );
}
@@ -635,13 +626,13 @@
CMPXMessage* msg = CMPXMessage::NewL();
CleanupStack::PushL( msg );
- msg->SetTObjectValueL<TInt>( KMPXMessageGeneralId, KMPXMediaIdVideoDisplayMessage );
+ msg->SetTObjectValueL<TInt>( KMPXMessageGeneralId, KMPXMediaIdVideoDisplaySyncMessage );
msg->SetTObjectValueL<TInt>( KMPXMediaVideoDisplayCommand, aCmd );
msg->SetTObjectValueL<TSurfaceId>( KMPXMediaVideoDisplayTSurfaceId, aSurfaceId );
msg->SetTObjectValueL<TRect>( KMPXMediaVideoDisplayCropRect, aCropRect );
msg->SetTObjectValueL<TVideoAspectRatio>( KMPXMediaVideoDisplayAspectRatio, aAspectRatio );
- iVideoPlaybackController->iMPXPluginObs->HandlePlaybackMessage( msg, KErrNone );
+ iVideoPlaybackController->iMPXPluginObs->HandlePlaybackSyncMessage( *msg );
CleanupStack::PopAndDestroy( msg );
}
--- a/videoplayback/videohelix/tsrc/ut_videohelixtest/inc/mpxvideoplayerutility_stub.h Tue Feb 02 00:12:10 2010 +0200
+++ b/videoplayback/videohelix/tsrc/ut_videohelixtest/inc/mpxvideoplayerutility_stub.h Thu Apr 01 22:38:49 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 9 %
+// Version : %version: 10 %
#ifndef __MPXVIDEOPLAYERUTILITY__
@@ -157,6 +157,10 @@
HBufC8* iTitle;
HBufC8* iDescription;
HBufC8* iArtist;
+ HBufC8* iLocation;
+ HBufC8* iCopyright;
+ HBufC8* iLanguage;
+ HBufC8* iKeywords;
TSize iSize;
--- a/videoplayback/videohelix/tsrc/ut_videohelixtest/src/mpxvideodrmhelper_stub.cpp Tue Feb 02 00:12:10 2010 +0200
+++ b/videoplayback/videohelix/tsrc/ut_videohelixtest/src/mpxvideodrmhelper_stub.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 5 %
+// Version : %version: 6 %
#include "mpxvideodrmhelper.h"
@@ -46,10 +46,10 @@
}
// ------------------------------------------------------------------------------------------------
-// CMpxVideoDrmHelper::IsProtected()
+// CMpxVideoDrmHelper::IsProtectedL()
// ------------------------------------------------------------------------------------------------
//
-TBool CMpxVideoDrmHelper::IsProtected( RFile& aFile )
+TBool CMpxVideoDrmHelper::IsProtectedL( RFile& aFile )
{
TBool drmProtected = EFalse;
@@ -118,10 +118,10 @@
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
// ------------------------------------------------------------------------------------------------
-// CMpxVideoDrmHelper::IsProtected64()
+// CMpxVideoDrmHelper::IsProtected64L()
// ------------------------------------------------------------------------------------------------
//
-TBool CMpxVideoDrmHelper::IsProtected64( RFile64& aFile )
+TBool CMpxVideoDrmHelper::IsProtected64L( RFile64& aFile )
{
TBool drmProtected = EFalse;
--- a/videoplayback/videohelix/tsrc/ut_videohelixtest/src/mpxvideoplayerutility_stub.cpp Tue Feb 02 00:12:10 2010 +0200
+++ b/videoplayback/videohelix/tsrc/ut_videohelixtest/src/mpxvideoplayerutility_stub.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -15,7 +15,7 @@
*
*/
-// Version : %version: 11 %
+// Version : %version: 12 %
#include <audiopreference.h>
#include <mmf/server/mmffile.h>
@@ -657,11 +657,13 @@
iTitle = value.AllocL();
}
- else if ( ! aItem.Compare(_L8("Description")) )
+ else if ( ! aItem.Compare(_L8("Description")) ||
+ ! aItem.Compare(_L8("Abstract")) )
{
- delete iDescription;
-
- iDescription = value.AllocL();
+ if ( ! iDescription )
+ {
+ iDescription = value.AllocL();
+ }
}
else if ( ! aItem.Compare(_L8("Artist")) )
{
@@ -669,6 +671,30 @@
iArtist = value.AllocL();
}
+ else if ( ! aItem.Compare(_L8("Location")) )
+ {
+ delete iLocation;
+
+ iLocation = value.AllocL();
+ }
+ else if ( ! aItem.Compare(_L8("Copyright")) )
+ {
+ delete iCopyright;
+
+ iCopyright = value.AllocL();
+ }
+ else if ( ! aItem.Compare(_L8("Language")) )
+ {
+ delete iLanguage;
+
+ iLanguage = value.AllocL();
+ }
+ else if ( ! aItem.Compare(_L8("Keywords")) )
+ {
+ delete iKeywords;
+
+ iKeywords = value.AllocL();
+ }
HBufC* name = HBufC::NewL( aItem.Length() );
TPtr namePtr( name->Des() );
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayer.pro Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,26 @@
+#
+# 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: Project file for building Videoplayer components
+#
+#
+
+TEMPLATE = subdirs
+CONFIG += ordered
+symbian: {
+BLD_INF_RULES.prj_mmpfiles += $$LITERAL_HASH"include \"videoplayer_plat/group/bld.inf\""
+SUBDIRS += videoplayback
+SUBDIRS += videoplayerapp
+SUBDIRS += videocollection
+}
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/bwins/videoplayerengineu.def Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,46 @@
+EXPORTS
+ ?qt_metacall@QVideoPlayerEngine@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 1 NONAME ; int QVideoPlayerEngine::qt_metacall(enum QMetaObject::Call, int, void * *)
+ ?metaObject@QVideoPlayerEngine@@UBEPBUQMetaObject@@XZ @ 2 NONAME ; struct QMetaObject const * QVideoPlayerEngine::metaObject(void) const
+ ?tr@QVideoPlayerEngine@@SA?AVQString@@PBD0H@Z @ 3 NONAME ; class QString QVideoPlayerEngine::tr(char const *, char const *, int)
+ ?qt_metacast@VideoServices@@UAEPAXPBD@Z @ 4 NONAME ; void * VideoServices::qt_metacast(char const *)
+ ?trUtf8@VideoServices@@SA?AVQString@@PBD0@Z @ 5 NONAME ; class QString VideoServices::trUtf8(char const *, char const *)
+ ?itemSelected@VideoServices@@QAEXABVQString@@@Z @ 6 NONAME ; void VideoServices::itemSelected(class QString const &)
+ ?handleCommand@QVideoPlayerEngine@@QAEXH@Z @ 7 NONAME ; void QVideoPlayerEngine::handleCommand(int)
+ ??1VideoServices@@EAE@XZ @ 8 NONAME ; VideoServices::~VideoServices(void)
+ ?titleReady@VideoServices@@IAEXABVQString@@@Z @ 9 NONAME ; void VideoServices::titleReady(class QString const &)
+ ?staticMetaObject@QVideoPlayerEngine@@2UQMetaObject@@B @ 10 NONAME ; struct QMetaObject const QVideoPlayerEngine::staticMetaObject
+ ?activated@VideoServices@@IAEXH@Z @ 11 NONAME ; void VideoServices::activated(int)
+ ?metaObject@VideoServices@@UBEPBUQMetaObject@@XZ @ 12 NONAME ; struct QMetaObject const * VideoServices::metaObject(void) const
+ ?disconnectView@QVideoPlayerEngine@@AAEXXZ @ 13 NONAME ; void QVideoPlayerEngine::disconnectView(void)
+ ??_EVideoServices@@UAE@I@Z @ 14 NONAME ; VideoServices::~VideoServices(unsigned int)
+ ?setEngine@VideoServices@@AAEXPAVQVideoPlayerEngine@@@Z @ 15 NONAME ; void VideoServices::setEngine(class QVideoPlayerEngine *)
+ ?decreaseReferenceCount@VideoServices@@QAEXXZ @ 16 NONAME ; void VideoServices::decreaseReferenceCount(void)
+ ?getStaticMetaObject@VideoServices@@SAABUQMetaObject@@XZ @ 17 NONAME ; struct QMetaObject const & VideoServices::getStaticMetaObject(void)
+ ?setEmbedded@QVideoPlayerEngine@@QAEXXZ @ 18 NONAME ; void QVideoPlayerEngine::setEmbedded(void)
+ ?setCurrentService@VideoServices@@AAEXW4TVideoService@1@@Z @ 19 NONAME ; void VideoServices::setCurrentService(enum VideoServices::TVideoService)
+ ?trUtf8@QVideoPlayerEngine@@SA?AVQString@@PBD0H@Z @ 20 NONAME ; class QString QVideoPlayerEngine::trUtf8(char const *, char const *, int)
+ ??0VideoServices@@AAE@PAVQVideoPlayerEngine@@@Z @ 21 NONAME ; VideoServices::VideoServices(class QVideoPlayerEngine *)
+ ?tr@QVideoPlayerEngine@@SA?AVQString@@PBD0@Z @ 22 NONAME ; class QString QVideoPlayerEngine::tr(char const *, char const *)
+ ?getStaticMetaObject@QVideoPlayerEngine@@SAABUQMetaObject@@XZ @ 23 NONAME ; struct QMetaObject const & QVideoPlayerEngine::getStaticMetaObject(void)
+ ?trUtf8@VideoServices@@SA?AVQString@@PBD0H@Z @ 24 NONAME ; class QString VideoServices::trUtf8(char const *, char const *, int)
+ ?handleQuit@QVideoPlayerEngine@@AAEXXZ @ 25 NONAME ; void QVideoPlayerEngine::handleQuit(void)
+ ?staticMetaObject@VideoServices@@2UQMetaObject@@B @ 26 NONAME ; struct QMetaObject const VideoServices::staticMetaObject
+ ??1QVideoPlayerEngine@@UAE@XZ @ 27 NONAME ; QVideoPlayerEngine::~QVideoPlayerEngine(void)
+ ?tr@VideoServices@@SA?AVQString@@PBD0H@Z @ 28 NONAME ; class QString VideoServices::tr(char const *, char const *, int)
+ ?qt_metacast@QVideoPlayerEngine@@UAEPAXPBD@Z @ 29 NONAME ; void * QVideoPlayerEngine::qt_metacast(char const *)
+ ?activateView@QVideoPlayerEngine@@AAEXW4MpxHbVideoViewType@MpxHbVideoCommon@@@Z @ 30 NONAME ; void QVideoPlayerEngine::activateView(enum MpxHbVideoCommon::MpxHbVideoViewType)
+ ?playMedia@QVideoPlayerEngine@@QAEXVQString@@@Z @ 31 NONAME ; void QVideoPlayerEngine::playMedia(class QString)
+ ??0QVideoPlayerEngine@@QAE@_N@Z @ 32 NONAME ; QVideoPlayerEngine::QVideoPlayerEngine(bool)
+ ?contextTitle@VideoServices@@QBE?AVQString@@XZ @ 33 NONAME ; class QString VideoServices::contextTitle(void) const
+ ?initialize@QVideoPlayerEngine@@QAEXXZ @ 34 NONAME ; void QVideoPlayerEngine::initialize(void)
+ ?trUtf8@QVideoPlayerEngine@@SA?AVQString@@PBD0@Z @ 35 NONAME ; class QString QVideoPlayerEngine::trUtf8(char const *, char const *)
+ ?loadPlugin@QVideoPlayerEngine@@AAEXW4MpxHbVideoViewType@MpxHbVideoCommon@@@Z @ 36 NONAME ; void QVideoPlayerEngine::loadPlugin(enum MpxHbVideoCommon::MpxHbVideoViewType)
+ ?currentService@VideoServices@@QAE?AW4TVideoService@1@XZ @ 37 NONAME ; enum VideoServices::TVideoService VideoServices::currentService(void)
+ ?qt_metacall@VideoServices@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 38 NONAME ; int VideoServices::qt_metacall(enum QMetaObject::Call, int, void * *)
+ ?mInstance@VideoServices@@0PAV1@A @ 39 NONAME ; class VideoServices * VideoServices::mInstance
+ ?tr@VideoServices@@SA?AVQString@@PBD0@Z @ 40 NONAME ; class QString VideoServices::tr(char const *, char const *)
+ ?engine@VideoServices@@AAEPAVQVideoPlayerEngine@@XZ @ 41 NONAME ; class QVideoPlayerEngine * VideoServices::engine(void)
+ ?connectView@QVideoPlayerEngine@@AAEXXZ @ 42 NONAME ; void QVideoPlayerEngine::connectView(void)
+ ?instance@VideoServices@@SAPAV1@PAVQVideoPlayerEngine@@@Z @ 43 NONAME ; class VideoServices * VideoServices::instance(class QVideoPlayerEngine *)
+ ??_EQVideoPlayerEngine@@UAE@I@Z @ 44 NONAME ; QVideoPlayerEngine::~QVideoPlayerEngine(unsigned int)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/eabi/videoplayerengineu.def Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,46 @@
+EXPORTS
+ _ZN13VideoServices10titleReadyERK7QString @ 1 NONAME
+ _ZN13VideoServices11qt_metacallEN11QMetaObject4CallEiPPv @ 2 NONAME
+ _ZN13VideoServices11qt_metacastEPKc @ 3 NONAME
+ _ZN13VideoServices12itemSelectedERK7QString @ 4 NONAME
+ _ZN13VideoServices14currentServiceEv @ 5 NONAME
+ _ZN13VideoServices16staticMetaObjectE @ 6 NONAME DATA 16
+ _ZN13VideoServices17setCurrentServiceENS_13TVideoServiceE @ 7 NONAME
+ _ZN13VideoServices19getStaticMetaObjectEv @ 8 NONAME
+ _ZN13VideoServices22decreaseReferenceCountEv @ 9 NONAME
+ _ZN13VideoServices6engineEv @ 10 NONAME
+ _ZN13VideoServices8instanceEP18QVideoPlayerEngine @ 11 NONAME
+ _ZN13VideoServices9activatedEi @ 12 NONAME
+ _ZN13VideoServices9mInstanceE @ 13 NONAME DATA 4
+ _ZN13VideoServices9setEngineEP18QVideoPlayerEngine @ 14 NONAME
+ _ZN13VideoServicesC1EP18QVideoPlayerEngine @ 15 NONAME
+ _ZN13VideoServicesC2EP18QVideoPlayerEngine @ 16 NONAME
+ _ZN13VideoServicesD0Ev @ 17 NONAME
+ _ZN13VideoServicesD1Ev @ 18 NONAME
+ _ZN13VideoServicesD2Ev @ 19 NONAME
+ _ZN18QVideoPlayerEngine10handleQuitEv @ 20 NONAME
+ _ZN18QVideoPlayerEngine10initializeEv @ 21 NONAME
+ _ZN18QVideoPlayerEngine10loadPluginEN16MpxHbVideoCommon18MpxHbVideoViewTypeE @ 22 NONAME
+ _ZN18QVideoPlayerEngine11connectViewEv @ 23 NONAME
+ _ZN18QVideoPlayerEngine11qt_metacallEN11QMetaObject4CallEiPPv @ 24 NONAME
+ _ZN18QVideoPlayerEngine11qt_metacastEPKc @ 25 NONAME
+ _ZN18QVideoPlayerEngine11setEmbeddedEv @ 26 NONAME
+ _ZN18QVideoPlayerEngine12activateViewEN16MpxHbVideoCommon18MpxHbVideoViewTypeE @ 27 NONAME
+ _ZN18QVideoPlayerEngine13handleCommandEi @ 28 NONAME
+ _ZN18QVideoPlayerEngine14disconnectViewEv @ 29 NONAME
+ _ZN18QVideoPlayerEngine16staticMetaObjectE @ 30 NONAME DATA 16
+ _ZN18QVideoPlayerEngine19getStaticMetaObjectEv @ 31 NONAME
+ _ZN18QVideoPlayerEngine9playMediaE7QString @ 32 NONAME
+ _ZN18QVideoPlayerEngineC1Eb @ 33 NONAME
+ _ZN18QVideoPlayerEngineC2Eb @ 34 NONAME
+ _ZN18QVideoPlayerEngineD0Ev @ 35 NONAME
+ _ZN18QVideoPlayerEngineD1Ev @ 36 NONAME
+ _ZN18QVideoPlayerEngineD2Ev @ 37 NONAME
+ _ZNK13VideoServices10metaObjectEv @ 38 NONAME
+ _ZNK13VideoServices12contextTitleEv @ 39 NONAME
+ _ZNK18QVideoPlayerEngine10metaObjectEv @ 40 NONAME
+ _ZTI13VideoServices @ 41 NONAME
+ _ZTI18QVideoPlayerEngine @ 42 NONAME
+ _ZTV13VideoServices @ 43 NONAME
+ _ZTV18QVideoPlayerEngine @ 44 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/hbvideoplayer/hbvideoplayer.pro Thu Apr 01 22:38:49 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: Project file for building Videoplayer components
+#
+#
+# Version : %version: 15 %
+
+
+TARGET = videoplayer
+CONFIG += hb service
+TEMPLATE = app
+TRANSLATIONS += videos.ts
+
+symbian:
+{
+ TARGET.CAPABILITY = ALL -DRM -TCB
+ TARGET.EPOCHEAPSIZE = 0x20000 0x1600000
+ TARGET.UID3 = 0x200211FE
+
+ BLD_INF_RULES.prj_exports += "rom/hbvideoplayer.iby CORE_APP_LAYER_IBY_EXPORT_PATH(hbvideoplayer.iby)" \
+ "rom/hbvideoplayerresources.iby LANGUAGE_APP_LAYER_IBY_EXPORT_PATH(hbvideoplayerresources.iby)" \
+ "sis/videoplayer_stub.sis /epoc32/data/z/system/install/videoplayer_stub.sis"
+}
+
+# Service provider specific configuration.
+SERVICE.FILE = resources/service_conf.xml
+SERVICE.OPTIONS = embeddable
+# Service provider specific configuration ends
+
+INCLUDEPATH += .
+INCLUDEPATH += ../inc \
+ ../../inc \
+ /epoc32/include/mw/hb/hbtools
+
+LIBS += -lvideoplayerengine.dll \
+ -lxqservice.dll \
+ -lxqserviceutil.dll
+
+VPATH += src
+
+SOURCES += main.cpp
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/hbvideoplayer/resources/service_conf.xml Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<service>
+ <name>com.nokia.Videos</name>
+ <filepath>No path</filepath>
+ <description>Video services</description>
+ <interface>
+ <name>IVideoFetch</name>
+ <version>1.0</version>
+ <description>Interface to fetch video URI</description>
+ </interface>
+ <interface>
+ <name>IVideoView</name>
+ <version>1.0</version>
+ <description>Interface to play a video</description>
+ </interface>
+</service>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/hbvideoplayer/rom/hbvideoplayer.iby Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2006-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: hbvideoplayer.iby
+*
+*/
+
+
+#ifndef __HBVIDEOPLAYER_IBY__
+#define __HBVIDEOPLAYER_IBY__
+
+#include <bldvariant.hrh>
+#include <data_caging_paths_for_iby.hrh>
+
+S60_APP_EXE(videoplayer)
+data=DATAZ_/PRIVATE/10003A3F/import/APPS/videoplayer_reg.rsc private/10003a3f/import/apps/videoplayer_reg.rsc
+data=DATAZ_/APP_RESOURCE_DIR/videoplayer.rsc APP_RESOURCE_DIR/videoplayer.rsc
+data=DATAZ_\install\videoplayer_stub.sis system\install\videoplayer_stub.sis
+#endif // __HBVIDEOPLAYER_IBY__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/hbvideoplayer/rom/hbvideoplayerresources.iby Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2006-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: hbvideoplayerresources.iby
+*
+*/
+
+
+#ifndef __HBVIDEOPLAYERRESOURCES_IBY__
+#define __HBVIDEOPLAYERRESOURCES_IBY__
+
+#include <bldvariant.hrh>
+#include <data_caging_paths_for_iby.hrh>
+
+/*
+S60_APP_RESOURCE(videoplayer)
+*/
+#endif // __HBVIDEOPLAYERRESOURCES_IBY__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/hbvideoplayer/sis/create_videoplayer_udeb_sisx.bat Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,21 @@
+rem
+rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - initial contribution.
+rem
+rem Contributors:
+rem
+rem Description:
+rem
+
+REM Make qt videoplayer udeb sisx file (contains hb -libraries)
+
+call makesis videoplayer_udeb.pkg videoplayer_udeb.sis
+call signsis videoplayer_udeb.sis videoplayer_udeb.sisx Nokia_RnDCert_02.der Nokia_RnDCert_02.key
+call del videoplayer_udeb.sis
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/hbvideoplayer/sis/create_videoplayer_urel_sisx.bat Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,21 @@
+rem
+rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+rem All rights reserved.
+rem This component and the accompanying materials are made available
+rem under the terms of "Eclipse Public License v1.0"
+rem which accompanies this distribution, and is available
+rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
+rem
+rem Initial Contributors:
+rem Nokia Corporation - initial contribution.
+rem
+rem Contributors:
+rem
+rem Description:
+rem
+
+REM Make qt videoplayer urel sisx file (contains hb -libraries)
+
+call makesis videoplayer_urel.pkg videoplayer_urel.sis
+call signsis videoplayer_urel.sis videoplayer_urel.sisx Nokia_RnDCert_02.der Nokia_RnDCert_02.key
+call del videoplayer_urel.sis
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/hbvideoplayer/sis/videoplayer_stub.pkg Thu Apr 01 22:38:49 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:
+;
+
+; Language
+&EN
+
+; SIS header: name, uid, version
+# {"videoplayer"}, (0x200211FE), 1, 0, 0, TYPE=SA
+
+; Localised Vendor name
+%{"Nokia, Qt Software"}
+
+; Unique Vendor name
+:"Nokia, Qt Software"
+
+;
+; Collection Plugin
+;
+"" - "z:\sys\bin\vcxmyvideoscollectionplugin.dll"
+"" - "z:\resource\plugins\vcxmyvideoscollectionplugin.r*"
+"" - "z:\sys\bin\vcxconnectionutility.dll"
+"" - "z:\sys\bin\vcxconnutilpsworker.exe"
+
+;
+; Playback Plugin
+;
+"" - "z:\sys\bin\mpxvideohelixplayback.dll"
+"" - "z:\resource\plugins\mpxvideohelixplayback.r*"
+
+;
+; Video playback view
+;
+"" - "z:\sys\bin\hbvideoplaybackview.dll"
+"" - "z:\sys\bin\hbvideoplaybackviewplugin.dll"
+"" - "z:\resource\plugins\hbvideoplaybackviewplugin.r*"
+
+;
+; Collection view and wrapper
+;
+"" - "z:\sys\bin\videocollectionview.dll"
+"" - "z:\resource\plugins\videocollectionview.r*"
+"" - "z:\sys\bin\videocollectionwrapper.dll"
+"" - "z:\sys\bin\videofiledetailsview.dll"
+"" - "z:\resource\plugins\videofiledetailsview.r*"
+
+;
+; Executable and default resource files
+;
+"" - "z:\sys\bin\videoplayerengine.dll"
+"" - "z:\sys\bin\videoplayer.exe"
+"" - "z:\resource\apps\videoplayer.r*"
+"" - "z:\private\10003a3f\import\apps\videoplayer_reg.r*"
+
+
Binary file videoplayerapp/hbvideoplayer/sis/videoplayer_stub.sis has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/hbvideoplayer/sis/videoplayer_udeb.pkg Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,66 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description:
+;
+
+; Language
+&EN
+
+; SIS header: name, uid, version
+#{"videoplayer"},(0x200211FE),1,0,0,TYPE=SA, RU
+
+; Localised Vendor name
+%{"Nokia, Qt Software"}
+
+; Unique Vendor name
+:"Nokia, Qt Software"
+
+; Dependencies
+[0x101F7961],0,0,0,{"S60ProductID"}
+[0x102032BE],0,0,0,{"S60ProductID"}
+[0x102752AE],0,0,0,{"S60ProductID"}
+[0x1028315F],0,0,0,{"S60ProductID"}
+(0x2001E61C),4,6,0,{"QtLibs pre-release"}
+
+;
+; Collection Plugin
+;
+"/epoc32/release/armv5/udeb/vcxmyvideoscollectionplugin.dll" - "!:/sys/bin/vcxmyvideoscollectionplugin.dll"
+"/epoc32/data/z/resource/plugins/vcxmyvideoscollectionplugin.rsc" - "!:/resource/plugins/vcxmyvideoscollectionplugin.rsc"
+
+"/epoc32/release/armv5/udeb/vcxconnectionutility.dll" - "!:/sys/bin/vcxconnectionutility.dll"
+"/epoc32/release/armv5/udeb/vcxconnutilpsworker.exe" - "!:/sys/bin/vcxconnutilpsworker.exe"
+
+;
+; Playback Plugin
+;
+"/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"
+
+; 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/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"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/hbvideoplayer/sis/videoplayer_urel.pkg Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,66 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of "Eclipse Public License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.eclipse.org/legal/epl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description:
+;
+
+; Language
+&EN
+
+; SIS header: name, uid, version
+#{"videoplayer"},(0x200211FE),1,0,0,TYPE=SA, RU
+
+; Localised Vendor name
+%{"Nokia, Qt Software"}
+
+; Unique Vendor name
+:"Nokia, Qt Software"
+
+; Dependencies
+[0x101F7961],0,0,0,{"S60ProductID"}
+[0x102032BE],0,0,0,{"S60ProductID"}
+[0x102752AE],0,0,0,{"S60ProductID"}
+[0x1028315F],0,0,0,{"S60ProductID"}
+(0x2001E61C),4,6,0,{"QtLibs pre-release"}
+
+;
+; Collection Plugin
+;
+"/epoc32/release/armv5/urel/vcxmyvideoscollectionplugin.dll" - "!:/sys/bin/vcxmyvideoscollectionplugin.dll"
+"/epoc32/data/z/resource/plugins/vcxmyvideoscollectionplugin.rsc" - "!:/resource/plugins/vcxmyvideoscollectionplugin.rsc"
+
+"/epoc32/release/armv5/urel/vcxconnectionutility.dll" - "!:/sys/bin/vcxconnectionutility.dll"
+"/epoc32/release/armv5/urel/vcxconnutilpsworker.exe" - "!:/sys/bin/vcxconnutilpsworker.exe"
+
+;
+; Playback Plugin
+;
+"/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"
+
+; 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/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"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/hbvideoplayer/src/main.cpp Thu Apr 01 22:38:49 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: Implementation of main.cpp
+*
+*/
+
+// Version : %version: 8 %
+
+
+#include <QObject>
+#include <hbapplication.h>
+#include <hbmainwindow.h>
+#include <xqserviceutil.h>
+
+#include "videoplayerengine.h"
+
+int main(int argc, char *argv[])
+{
+ HbApplication app(argc, argv);
+
+ // has the application been launched via XQ Service Framework
+ bool isService = XQServiceUtil::isService();
+
+ if (!isService)
+ {
+ app.setApplicationName( QObject::tr("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/inc/videoplayerengine.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation of QVideoPlayerEngine
+*
+*/
+
+// Version : %version: ou1cpsw#9 %
+
+#ifndef VIDEOPLAYERENGINE_H
+#define VIDEOPLAYERENGINE_H
+
+#include <qobject.h>
+#include <mpxviewpluginqt.h>
+
+#include "mpxhbvideocommondefs.h"
+#include "videoplayerappexport.h"
+
+//FORWARD CLASS DECLARATION
+
+class MpxViewPlugin;
+class VideoServices;
+class QMpxVideoPlaybackWrapper;
+
+/**
+ * QVideoPlayerEngine
+ *
+ */
+class VIDEOPLAYERAPP_DLL_EXPORT QVideoPlayerEngine: public QObject
+{
+ Q_OBJECT
+
+ public:
+ /**
+ * Constructor
+ */
+ QVideoPlayerEngine(bool isService = false);
+
+ /**
+ * Destructor.
+ */
+ virtual ~QVideoPlayerEngine();
+
+ public:
+ void initialize();
+ void playMedia( QString filePath );
+ void setEmbedded();
+
+ public slots:
+ void handleCommand( int commandCode );
+
+ private slots:
+ void handleQuit();
+
+ private:
+ void activateView( MpxHbVideoCommon::MpxHbVideoViewType viewType );
+
+ void connectView();
+ void disconnectView();
+
+ void switchView();
+
+ void loadPlugin( MpxHbVideoCommon::MpxHbVideoViewType viewType );
+
+ private:
+ bool mIsService;
+ bool mEmbedded;
+
+ MpxViewPlugin* mCurrentViewPlugin;
+ MpxViewPlugin* mPlaybackViewPlugin;
+ MpxViewPlugin* mCollectionViewPlugin;
+ MpxViewPlugin* mFileDetailsViewPlugin;
+
+
+ QMpxVideoPlaybackWrapper *mPlaybackWrapper;
+
+ VideoServices* mVideoServices;
+
+};
+
+#endif // VIDEOPLAYERENGINE_H
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/videoplayerapp.pro Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,23 @@
+#
+# 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: Project file for building Videoplayer components
+#
+#
+# Version : %version: 4 %
+
+
+TEMPLATE = subdirs
+CONFIG += ordered
+SUBDIRS += videoplayerengine \
+ hbvideoplayer
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/videoplayerengine/inc/videoserviceplay.h Thu Apr 01 22:38:49 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: Declaration of VideoServicePlay
+*
+*/
+
+// Version : %version: 1 %
+
+#ifndef __VIDEOSERVICEPLAY_H__
+#define __VIDEOSERVICEPLAY_H__
+
+#include <xqserviceprovider.h>
+#include <QObject>
+
+// FORWARD DECLARATIONS
+class VideoServices;
+class QVideoPlayerEngine;
+
+class VideoServicePlay : public XQServiceProvider
+ {
+
+ Q_OBJECT
+
+ public:
+ VideoServicePlay( VideoServices* parent, QVideoPlayerEngine* engine );
+ virtual ~VideoServicePlay();
+
+ void setEngine( QVideoPlayerEngine* engine );
+
+ public slots:
+ void playMedia( QString filePath );
+ void playPDLMedia( QString filePath, int downloadID );
+ void closePlayer();
+
+ private:
+ QVideoPlayerEngine* mEngine;
+ VideoServices* mServiceApp;
+
+
+ };
+
+ #endif //__VIDEOSERVICEPLAY_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/videoplayerengine/inc/videoservices.h Thu Apr 01 22:38:49 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: VideoServices class definition
+*
+*/
+
+#ifndef __VIDEOSERVICES_H__
+#define __VIDEOSERVICES_H__
+
+#include <QStringList>
+#include "videoplayerappexport.h"
+
+//FORWARD CLASS DECLARATION
+class VideoServiceUriFetch;
+class VideoServicePlay;
+class QVideoPlayerEngine;
+
+class VIDEOPLAYERAPP_DLL_EXPORT VideoServices : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * 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 VideoServices *instance(QVideoPlayerEngine* engine = 0);
+
+ /**
+ * Decreases the reference count, when count reaches zero cleanup is done.
+ *
+ */
+ void decreaseReferenceCount();
+
+ /**
+ * Returns the context title set by service requestee
+ *
+ * @return QString the title
+ *
+ */
+ QString contextTitle() const;
+
+ /*
+ * Enum reflecting the services provided
+ */
+ enum TVideoService
+ {
+ ENoService,
+ EUriFetcher,
+ EPlayback
+ };
+
+ /**
+ * Returns service active status
+ *
+ * @return bool true if active, false if not active
+ *
+ */
+ VideoServices::TVideoService currentService();
+
+public slots:
+ void itemSelected(const QString& item);
+
+signals:
+ /*
+ * Emitted when service user has set the title
+ */
+ void titleReady(const QString& title);
+
+ /*
+ * Emitted to acticate requested plugin
+ */
+ void activated(int command);
+
+private:
+
+ /**
+ * Constructor
+ */
+ VideoServices();
+
+ /**
+ * Constructor
+ */
+ VideoServices(QVideoPlayerEngine* engine);
+
+ /**
+ * Destructor.
+ */
+ virtual ~VideoServices();
+
+ void setEngine(QVideoPlayerEngine* engine);
+
+ /**
+ * Sets the active service
+ *
+ * @param service
+ *
+ */
+ void setCurrentService(VideoServices::TVideoService service);
+
+ /**
+ * Returns the current engine
+ *
+ * @return engine
+ *
+ */
+ QVideoPlayerEngine* engine();
+
+ Q_DISABLE_COPY(VideoServices)
+
+private:
+
+ /**
+ * Reference count.
+ */
+ int mReferenceCount;
+
+ /**
+ * Singleton instance.
+ */
+ static VideoServices* mInstance;
+
+ /**
+ * VideoServiceUriFetch service instance.
+ */
+ VideoServiceUriFetch* mServiceUriFetch;
+
+ /**
+ * VideoServicePlay service instance.
+ */
+ VideoServicePlay* mServicePlay;
+
+ /**
+ * Pointer of QVideoPlayerEngine.
+ */
+ QVideoPlayerEngine* mEngine;
+
+ /*
+ * Current service
+ */
+ VideoServices::TVideoService mCurrentService;
+
+ friend class VideoServiceUriFetch;
+
+ friend class VideoServicePlay;
+ };
+
+#endif //__VIDEOSERVICES_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/videoplayerengine/inc/videoserviceurifetch.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,104 @@
+/*
+* 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: VideoServiceUriFetch class definition
+*
+*/
+
+#ifndef __VIDEOSERVICESURIFETCH_H__
+#define __VIDEOSERVICESURIFETCH_H__
+
+//INCLUDES
+#include <xqserviceprovider.h>
+#include <QStringList>
+
+// FORWARD DECLARATIONS
+class VideoServices;
+
+class VideoServiceUriFetch : public XQServiceProvider
+{
+
+ /**
+ * define to be able to use signals and slots
+ */
+ Q_OBJECT
+
+public:
+
+ /**
+ * contructor
+ */
+ VideoServiceUriFetch( VideoServices *parent = 0 );
+
+ /**
+ * destructor
+ */
+ ~VideoServiceUriFetch();
+
+ /**
+ * Returns service active status
+ *
+ * @return bool true if active, false if not active
+ *
+ */
+ bool isActive();
+
+ /**
+ * Completes the service
+ *
+ * @param fileList list of file URIs
+ *
+ */
+ void complete(QStringList filesList);
+
+ /**
+ * Returns the context title set by service requestee
+ *
+ * @return QString the title
+ *
+ */
+ QString contextTitle() const;
+
+public slots: // for QTHighway to notify provider about request
+ /*
+ * Client can use this method launch video URI fetching
+ *
+ * @param title title to be set
+ *
+ */
+ void fetch(const QString& title);
+
+public slots: // for provider to notify client
+ void fetchFailed( int errorCode );
+
+private:
+ void doComplete( QStringList filesList);
+
+private:
+ /*
+ * The request index
+ */
+ int mRequestIndex;
+
+ /*
+ * Pointer to owning VideoServices
+ */
+ VideoServices* mServiceApp;
+
+ /*
+ * The title requested by the service user
+ */
+ QString mTitle;
+};
+
+#endif //__VIDEOSERVICESURIFETCH_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/videoplayerengine/src/mpxvideoplayerappuiengine.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,1463 @@
+/*
+* 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 %
+
+
+
+#include <mpxcommand.h>
+#include <mpxcommandgeneraldefs.h>
+#include <mpxmessagegeneraldefs.h>
+#include <mpxplaybackmessage.h>
+#include <mpxplaybackutility.h>
+#include <mpxcollectionmessage.h>
+#include <mpxmediageneraldefs.h>
+#include <mpxcollectionmessagedefs.h>
+#include <vcxmyvideosdefs.h>
+#include <mpxcollectionpath.h>
+#include <videoplayeractivationmessage.h>
+#include <AiwGenericParam.h>
+#include <mpxcollectionuihelper.h>
+#include <mpxcollectionhelperfactory.h>
+#include <mpxcollectionplugin.hrh>
+#include <mpxmediageneralextdefs.h>
+
+#include <streaminglinkmodel.h>
+#include <ApSettingsHandlerUi.h>
+#include <aputils.h>
+#include <MPSettingsModel.h>
+#include <coeutils.h>
+#include <videoplaylistutility.h>
+#include <mpxvideoplaybackdefs.h>
+
+#include "mpxvideoplayerappuiengine.h"
+#include "mpxvideoplayerconstants.h"
+#include "mpxvideoembeddedpdlhandler.h"
+#include "mpxvideoplaybackwrapper.h"
+#include "mpxhbvideocommondefs.h"
+
+#include "mpxvideo_debug.h"
+
+// -------------------------------------------------------------------------------------------------
+// CMpxVideoPlayerAppUiEngine::CMpxVideoPlayerAppUiEngine
+// -------------------------------------------------------------------------------------------------
+//
+CMpxVideoPlayerAppUiEngine::CMpxVideoPlayerAppUiEngine( QMpxVideoPlaybackWrapper* aWrapper )
+ : iPlaybackUtility( NULL ),
+ iCollectionUtility( NULL ),
+ iExitAo( NULL ),
+ iRecognizer( NULL ),
+ iExtAccessPointId( KErrUnknown ),
+ iMultilinkPlaylist( EFalse ),
+ iSeekable( ETrue ),
+ iUpdateSeekInfo( EFalse ),
+ iPlaybackWrapper( aWrapper )
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMpxVideoPlayerAppUiEngine::NewL
+// -------------------------------------------------------------------------------------------------
+//
+CMpxVideoPlayerAppUiEngine* CMpxVideoPlayerAppUiEngine::NewL( QMpxVideoPlaybackWrapper* aWrapper )
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::NewL()"));
+
+ CMpxVideoPlayerAppUiEngine* self = new( ELeave) CMpxVideoPlayerAppUiEngine( aWrapper );
+
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMpxVideoPlayerAppUiEngine::ConstructL
+// -------------------------------------------------------------------------------------------------
+//
+void CMpxVideoPlayerAppUiEngine::ConstructL()
+{
+ iRecognizer = CMediaRecognizer::NewL();
+
+ //
+ // Create the Collection Utility
+ //
+
+ //
+ // Workaround. Embedded is not supported yet.
+ //
+ //if ( ! iAppUi->IsEmbedded() )
+ if ( ETrue )
+ {
+ TUid collectionMode( KUidMpxVideoPlayerApplication );
+
+ iCollectionUtility = MMPXCollectionUtility::NewL( this, collectionMode );
+ }
+
+ //
+ // Create Active Object for exiting the application
+ //
+ iExitAo = CIdle::NewL( CActive::EPriorityStandard );
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMpxVideoPlayerAppUiEngine::CreateCollectionUtilityMemberVariablesL
+// -------------------------------------------------------------------------------------------------
+//
+void CMpxVideoPlayerAppUiEngine::CreateCollectionUtilityMemberVariablesL()
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::CreateCollectionUtilityMemberVariablesL()"));
+
+ if ( ! iCollectionUtility )
+ {
+ // PLAYLIST default mode
+ iCollectionUtility = MMPXCollectionUtility::NewL( this );
+ }
+
+ if ( ! iCollectionUiHelper )
+ {
+ iCollectionUiHelper = CMPXCollectionHelperFactory::NewCollectionUiHelperL();
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMpxVideoPlayerAppUiEngine::CreatePlaybackUtilityMemberVariablesL
+// -------------------------------------------------------------------------------------------------
+//
+void CMpxVideoPlayerAppUiEngine::CreatePlaybackUtilityMemberVariablesL()
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::CreatePlaybackUtilityMemberVariablesL()"));
+
+ if ( ! iPlaybackUtility )
+ {
+ //
+ // Create VideoHelix playback plugin
+ //
+ iPlaybackUtility = MMPXPlaybackUtility::UtilityL( EMPXCategoryVideo, KPbModeNewPlayer );
+ MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager();
+ manager.SelectPlayerL( KVideoHelixPlaybackPluginUid );
+ iPlaybackUtility->AddObserverL( *this );
+ iPlaybackUtility->CommandL( EPbCmdSetAutoResume, EFalse );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMpxVideoPlayerAppUiEngine::CreateEmbeddedPdlPlaybackUtilityMemberVariablesL
+// -------------------------------------------------------------------------------------------------
+//
+void CMpxVideoPlayerAppUiEngine::CreateEmbeddedPdlPlaybackUtilityMemberVariablesL()
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::CreateEmbeddedPdlPlaybackUtilityMemberVariablesL()"));
+
+ if ( ! iPlaybackUtility )
+ {
+ iPlaybackUtility = MMPXPlaybackUtility::UtilityL( EMPXCategoryVideo, KPbModeNewPlayer );
+ MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager();
+ manager.SelectPlayerL( KVideoHelixPlaybackPluginUid );
+ iPlaybackUtility->AddObserverL( *this );
+ iPlaybackUtility->CommandL( EPbCmdSetAutoResume, EFalse );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMpxVideoPlayerAppUiEngine::~CMpxVideoPlayerAppUiEngine
+// -------------------------------------------------------------------------------------------------
+//
+CMpxVideoPlayerAppUiEngine::~CMpxVideoPlayerAppUiEngine()
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::~CMpxVideoPlayerAppUiEngine()"));
+
+ if ( iExitAo )
+ {
+ delete iExitAo;
+ iExitAo = NULL;
+ }
+
+ if ( iRecognizer )
+ {
+ delete iRecognizer;
+ iRecognizer = NULL;
+ }
+
+ if ( iPdlHandler )
+ {
+ delete iPdlHandler;
+ iPdlHandler = NULL;
+ }
+
+ if ( iCollectionUtility )
+ {
+ iCollectionUtility->Close();
+ }
+
+ if ( iCollectionUiHelper )
+ {
+ iCollectionUiHelper->Close();
+ }
+
+ if ( iPlaybackUtility )
+ {
+ TRAP_IGNORE( iPlaybackUtility->CommandL( EPbCmdClose ) );
+ TRAP_IGNORE( iPlaybackUtility->RemoveObserverL( *this ) );
+ iPlaybackUtility->Close();
+ }
+}
+
+// ---------------------------------------------------------------------------
+// From MMPXPlaybackObserver
+// Handle playback message.
+// ---------------------------------------------------------------------------
+//
+void CMpxVideoPlayerAppUiEngine::HandlePlaybackMessage( CMPXMessage* aMessage, TInt aError )
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::HandlePlaybackMessage()"));
+
+ if ( aError == KErrNone && aMessage )
+ {
+ TRAP_IGNORE( DoHandlePlaybackMessageL( *aMessage ) );
+ }
+}
+
+// ---------------------------------------------------------------------------
+// From MMPXViewActivationObserver.
+// Handle view activation.
+// ---------------------------------------------------------------------------
+//
+void CMpxVideoPlayerAppUiEngine::HandleViewActivation( const TUid& /*aCurrentViewType*/,
+ const TUid& /*aPreviousViewType*/ )
+{
+}
+
+// ---------------------------------------------------------------------------------------------------------------------
+// CMpxVideoPlayerAppUiEngine::HandleAiwGenericParamListL()
+// ---------------------------------------------------------------------------------------------------------------------
+//
+TInt CMpxVideoPlayerAppUiEngine::HandleAiwGenericParamListL( const CAiwGenericParamList* aParams )
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::HandleAiwGenericParamListL()"));
+
+ TInt retVal = KErrNone;
+
+ TInt index = 0;
+
+ //
+ // Check if there is a terminate message. If it exists, exit the application.
+ //
+ TInt32 terminateID = 0;
+
+ const TAiwGenericParam* paramTerminate =
+ aParams->FindFirst( index, EGenericParamTerminate, EVariantTypeTInt32 );
+
+ if ( paramTerminate )
+ {
+ paramTerminate->Value().Get( terminateID );
+ }
+
+ if ( terminateID )
+ {
+ MPX_DEBUG(_L("CMpxVideoPlayerAppUiEngine::HandleAiwGenericParamListL() Terminate message received"));
+
+ //
+ // Embedded app is being closed
+ //
+
+ //
+ // Workaround. Will handle it once AIW gets supported
+ //
+ //iAppUi->HandleCommandL( EEikCmdExit );
+
+ retVal = KErrCancel;
+ }
+ else
+ {
+ //
+ // Determine if these parameters are for PDL
+ //
+ index = 0;
+ TInt32 dlId = KErrNotFound;
+
+ const TAiwGenericParam* genParamDlId =
+ aParams->FindFirst( index, EGenericParamDownloadId, EVariantTypeTInt32 );
+
+ if ( genParamDlId )
+ {
+ genParamDlId->Value().Get( dlId );
+
+ index = 0;
+
+ const TAiwGenericParam* paramFileName =
+ aParams->FindFirst( index, EGenericParamFile, EVariantTypeDesC );
+
+ TPtrC fileName;
+
+ //
+ // Set the filename. The LWPlayerAppUi checks for the
+ // filename and exits if it doesn't exist
+ //
+ fileName.Set( paramFileName->Value().AsDes() );
+
+ if ( ! iPdlHandler )
+ {
+ iPdlHandler = CMpxVideoEmbeddedPdlHandler::NewL( this );
+ }
+
+ iPdlHandler->ConnectToEmbeddedDownloadL( dlId, fileName );
+ }
+ else
+ {
+ //
+ // Check Access Point
+ //
+ index = 0;
+
+ const TAiwGenericParam* genParamAccessPoint =
+ aParams->FindFirst( index, EGenericParamAccessPoint, EVariantTypeTInt32 );
+
+ if ( index >= 0 && genParamAccessPoint )
+ {
+ TInt32 apId = KErrUnknown;
+ genParamAccessPoint->Value().Get( apId );
+ iExtAccessPointId = apId;
+ }
+ }
+ }
+
+ return retVal;
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMpxVideoPlayerAppUiEngine::OpenFileL
+// -------------------------------------------------------------------------------------------------
+//
+void CMpxVideoPlayerAppUiEngine::OpenFileL( RFile& aFile, const CAiwGenericParamList* aParams )
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::OpenFileL(RFile)"));
+
+ TInt err = KErrNone;
+
+ if ( aParams )
+ {
+ err = HandleAiwGenericParamListL( aParams );
+ }
+
+ if ( KErrNone == err && ! iPdlHandler )
+ {
+ //
+ // Create member variables for embedded use cases that are not PDL
+ //
+ CreatePlaybackUtilityMemberVariablesL();
+
+ TFileName filename;
+ aFile.FullName(filename);
+
+ CMediaRecognizer::TMediaType mediaType = iRecognizer->IdentifyMediaTypeL( filename, aFile );
+
+ if ( mediaType == CMediaRecognizer::ELocalRamFile ||
+ mediaType == CMediaRecognizer::ELocalAsxFile )
+ {
+ HandleMultiLinksFileL( aFile, mediaType );
+ }
+ else if ( mediaType == CMediaRecognizer::ELocalSdpFile )
+ {
+ SetAccessPointL();
+ iPlaybackUtility->InitStreamingL( aFile, iAccessPointId );
+ }
+ else
+ {
+ iPlaybackUtility->InitL( aFile );
+ }
+ }
+
+ iRecognizer->FreeFilehandle();
+
+ aFile.Close();
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMpxVideoPlayerAppUiEngine::OpenFileL
+// -------------------------------------------------------------------------------------------------
+//
+void CMpxVideoPlayerAppUiEngine::OpenFileL( const TDesC& aFileName )
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::OpenFileL()"),
+ _L("aFileName = %S"), &aFileName);
+
+ //
+ // Create member variables for embedded use cases that are not PDL
+ //
+ CreatePlaybackUtilityMemberVariablesL();
+
+ CMediaRecognizer::TMediaType mediaType = iRecognizer->IdentifyMediaTypeL(aFileName);
+
+ if ( mediaType == CMediaRecognizer::ELocalVideoFile )
+ {
+ iPlaybackUtility->InitL( aFileName );
+ }
+ // check if aFileName is a path to a ram or asx file
+ // eg. c:\\data\\videos\\ramfile.ram
+ else if ( mediaType == CMediaRecognizer::ELocalRamFile ||
+ mediaType == CMediaRecognizer::ELocalAsxFile )
+ {
+ HandleMultiLinksFileL( aFileName, mediaType );
+ }
+ // check if this is a url eg. rtsp://someaddress/file.3gp
+ //
+ else if ( iRecognizer->IsValidStreamingPrefix(aFileName) )
+ {
+ HandleUrlDesL( aFileName );
+ }
+ else if ( mediaType == CMediaRecognizer::ELocalSdpFile )
+ {
+ SetAccessPointL();
+ iPlaybackUtility->InitStreamingL( aFileName,
+ (TDesC8*)(&KDATATYPEVIDEOHELIX),
+ iAccessPointId );
+ }
+ else
+ {
+ iPlaybackUtility->InitL( aFileName );
+ }
+
+ iRecognizer->FreeFilehandle();
+}
+
+// -------------------------------------------------------------------------------------------------
+// Open MPX media to player.
+// -------------------------------------------------------------------------------------------------
+//
+void CMpxVideoPlayerAppUiEngine::OpenMediaL( const CMPXMedia& aMedia )
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::OpenMediaL()"));
+
+ // Assume MPX medias are always local clips
+ CMPXCollectionPath* mediaPath = CMPXCollectionPath::NewL();
+ CleanupStack::PushL( mediaPath );
+
+ //
+ // Workaround. Need a file like vcxmyvideosuids.h
+ //
+ mediaPath->AppendL( 0x20016B97 );
+ mediaPath->AppendL( KVcxMvcCategoryIdAll );
+
+ mediaPath->AppendL( aMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+ mediaPath->SelectL( aMedia.ValueTObjectL<TMPXItemId>( KMPXMediaGeneralId ) );
+
+ CMPXCollectionPlaylist* playList = CMPXCollectionPlaylist::NewL( *mediaPath );
+ CleanupStack::PushL( playList );
+ playList->SetSingleItemPlaylist();
+ playList->SetToFirst();
+
+ CreatePlaybackUtilityMemberVariablesL();
+
+ iPlaybackUtility->InitL( *playList, ETrue );
+
+ CleanupStack::PopAndDestroy( playList );
+ CleanupStack::PopAndDestroy( mediaPath );
+}
+
+// -------------------------------------------------------------------------------------------------
+// Handle playback message.
+// -------------------------------------------------------------------------------------------------
+//
+void CMpxVideoPlayerAppUiEngine::DoHandlePlaybackMessageL( const CMPXMessage& aMessage )
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::DoHandlePlaybackMessageL()"));
+
+ TMPXMessageId id( *aMessage.Value<TMPXMessageId>( KMPXMessageGeneralId ) );
+
+ MPX_DEBUG(_L("CMpxVideoPlayerAppUiEngine::DoHandlePlaybackMessageL TMPXMessageId = 0x%08x"), id );
+
+ if ( KMPXMessageGeneral == id )
+ {
+ TInt event( *aMessage.Value<TInt>( KMPXMessageGeneralEvent ) );
+
+ MPX_DEBUG(_L("CMpxVideoPlayerAppUiEngine::DoHandlePlaybackMessageL() event = %d"), event);
+
+ switch ( event )
+ {
+ case TMPXPlaybackMessage::EPlayerChanged:
+ {
+ MPX_DEBUG(_L(" EPlayerChanged"));
+
+ if ( iUpdateSeekInfo )
+ {
+ // The plugin has been instantiated, update the media
+ UpdatePbPluginMediaL();
+ iUpdateSeekInfo = EFalse;
+ }
+
+ HandlePlaybackPlayerChangedL();
+ break;
+ }
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// Handle playback message for player changed.
+// Activate the view which support this player
+// -------------------------------------------------------------------------------------------------
+//
+void CMpxVideoPlayerAppUiEngine::HandlePlaybackPlayerChangedL()
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::HandlePlaybackPlayerChangedL()"));
+
+ MMPXPlayer* player = iPlaybackUtility->PlayerManager().CurrentPlayer();
+
+ TUid pluginUid( KNullUid );
+ RArray<TUid> array;
+
+ CleanupClosePushL( array );
+
+ if ( iPdlHandler )
+ {
+ array.AppendL( KVideoPdlPlaybackViewUid );
+ }
+ else
+ {
+ if ( player )
+ {
+ pluginUid = player->UidL();
+ array.AppendL( pluginUid );
+ }
+ }
+
+ ActivateVideoPlaybackView();
+
+ CleanupStack::PopAndDestroy( &array );
+}
+
+// -------------------------------------------------------------------------------------------------
+// Creates plugin resolver + creates & activates the video view
+// -------------------------------------------------------------------------------------------------
+//
+void CMpxVideoPlayerAppUiEngine::ActivateVideoPlaybackView()
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::ActivateVideoPlaybackView()"));
+
+ iPlaybackWrapper->openPlaybackView();
+}
+
+// -------------------------------------------------------------------------------------------------
+// Closed mpx components and readies to application takedown.
+// -------------------------------------------------------------------------------------------------
+//
+void CMpxVideoPlayerAppUiEngine::PrepareCloseMpxL()
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::PrepareCloseMpxL()"));
+
+ if ( iPlaybackUtility )
+ {
+ iPlaybackUtility->CommandL( EPbCmdClose );
+ MMPXPlayerManager& manager = iPlaybackUtility->PlayerManager();
+ TRAP_IGNORE( manager.ClearSelectPlayersL() );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// Sets AppUiEngine in stand alone "mode"
+// -------------------------------------------------------------------------------------------------
+//
+void CMpxVideoPlayerAppUiEngine::StartStandAloneL()
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::StartStandAloneL()"));
+
+ //
+ // Create the utilities for the stand alone player
+ //
+ CreatePlaybackUtilityMemberVariablesL();
+
+ // Fetch the video collection UID
+ RArray<TUid> uid;
+ CleanupClosePushL( uid );
+
+ uid.AppendL( TUid::Uid( KVcxMediaIdMyVideos ) );
+
+ iVideoCollectionId = iCollectionUtility->CollectionIDL( uid.Array() );
+
+ CleanupStack::PopAndDestroy( &uid );
+
+ //
+ // Workaround. Don't use mpx view utility yet
+ //
+ // iViewUtility->SetAsDefaultViewL( KUidMyVideosViewType );
+}
+
+// -------------------------------------------------------------------------------------------------
+// Handle collection message
+// -------------------------------------------------------------------------------------------------
+//
+void CMpxVideoPlayerAppUiEngine::DoHandleCollectionMessageL( CMPXMessage* aMessage )
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::DoHandleCollectionMessageL()"));
+
+ TMPXMessageId id = *(aMessage->Value<TMPXMessageId>( KMPXMessageGeneralId ));
+
+ MPX_DEBUG(_L("CMpxVideoPlayerAppUiEngine::DoHandleCollectionMessageL() TMPXMessageId = 0x%08x"), id );
+
+ if ( id == KMPXMessageGeneral )
+ {
+ TInt event( *( aMessage->Value<TInt> ( KMPXMessageGeneralEvent )) );
+ TInt type( *( aMessage->Value<TInt> ( KMPXMessageGeneralType )) );
+ TInt data( *( aMessage->Value<TInt> ( KMPXMessageGeneralData )) );
+
+ MPX_DEBUG(_L("CMpxVideoPlayerAppUiEngine::DoHandleCollectionMessageL event %d, type %d, data %d"), event, type, data );
+
+ if ( event == TMPXCollectionMessage::EPathChanged && type == EMcPathChangedByOpen )
+ {
+ if ( data == EMcItemOpened )
+ {
+ // An item was opened on the collection. Get the media attributes
+ // on the item so we can initiatiate playback
+ MPX_DEBUG(_L("CMpxVideoPlayerAppUiEngine::DoHandleCollectionMessageL: EMcItemOpened received. Can open video"));
+
+ CMPXCollectionPath* cPath = iCollectionUtility->Collection().PathL();
+
+ CleanupStack::PushL( cPath );
+
+ if ( cPath->Count() > 0 )
+ {
+ MPX_DEBUG(_L("CMpxVideoPlayerAppUiEngine::DoHandleCollectionMessageL: Call MediaL() on collection."));
+
+ RArray<TMPXAttribute> attribs;
+ CleanupClosePushL( attribs );
+
+ attribs.Append( KMPXMediaGeneralUri );
+ attribs.Append( KVcxMediaMyVideosDownloadId );
+ iCollectionUtility->Collection().MediaL( *cPath, attribs.Array() );
+
+ // Create the playlist
+ // Create proper playlist
+ // InitPlaybackEngineL( *cPath );
+
+ CleanupStack::PopAndDestroy( &attribs );
+ }
+
+ CleanupStack::PopAndDestroy( cPath );
+ }
+ else if ( data == EMcContainerOpened && iMultilinkPlaylist )
+ {
+ // start the playback for streaming playlists
+ // once the playlist is opened
+ iMultilinkPlaylist = EFalse;
+
+ // The playlist was opened, initiatiate playback
+ MPX_DEBUG(_L("CMpxVideoPlayerAppUiEngine::DoHandleCollectionMessageL: EMcContainerOpened received. initiatiate playback"));
+
+ CMPXCollectionPath* cPath = iCollectionUtility->Collection().PathL();
+ CleanupStack::PushL( cPath );
+
+ if ( cPath->Count() > 0 )
+ {
+ MPX_DEBUG(_L("CMpxVideoPlayerAppUiEngine::DoHandleCollectionMessageL: Call Playback utility with the playlist."));
+
+ CMPXCollectionPlaylist* playlist = CMPXCollectionPlaylist::NewL( *cPath );
+ CleanupStack::PushL( playlist );
+
+ // Set the AutoPlay mode to false
+ playlist->SetAutoPlay(EFalse);
+ // set pre init plugin to false
+ playlist->SetPreInitPlugin(EFalse);
+
+ iPlaybackUtility->InitL( *playlist, ETrue );
+ CleanupStack::PopAndDestroy( playlist );
+ }
+ CleanupStack::PopAndDestroy( cPath );
+ }
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// From MMPXCollectionObserver.
+// Handle media properties.
+// -------------------------------------------------------------------------------------------------
+//
+void CMpxVideoPlayerAppUiEngine::DoHandelCollectionMediaL( const CMPXMedia& aMedia )
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::DoHandelCollectionMediaL()"));
+
+ const TDesC& fileUri = aMedia.ValueText(KMPXMediaGeneralUri);
+
+ MPX_DEBUG(_L("Video URI: %S"), &fileUri );
+
+ if ( aMedia.IsSupported( KVcxMediaMyVideosDownloadId ) &&
+ aMedia.ValueTObjectL<TUint32>( KVcxMediaMyVideosDownloadId ) != 0 )
+ {
+ TUint32 dlId = aMedia.ValueTObjectL<TUint32>( KVcxMediaMyVideosDownloadId );
+
+ if ( ! iPdlHandler )
+ {
+ iPdlHandler = CMpxVideoEmbeddedPdlHandler::NewL( this );
+ }
+
+ iPdlHandler->ConnectToCollectionDownloadL( dlId, const_cast<TDesC&>( fileUri ) );
+ }
+ else
+ {
+ //OpenMediaL( aMedia ); // Initialize and initiate playback of a single video
+
+ TPtrC mediaFile( aMedia.ValueText( KMPXMediaGeneralUri ) );
+ CMediaRecognizer::TMediaType mediaType = iRecognizer->IdentifyMediaTypeL(mediaFile);
+
+ if ( mediaType == CMediaRecognizer::ELocalRamFile ||
+ mediaType == CMediaRecognizer::ELocalAsxFile )
+ {
+ CreatePlaybackUtilityMemberVariablesL();
+
+ HandleMultiLinksFileL( mediaFile, mediaType );
+ }
+ else
+ {
+ OpenMediaL( aMedia ); // Initialize and initiate playback of a single video
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// Steps back one level back in collection path. Will activate previous view if level exists
+// -------------------------------------------------------------------------------------------------
+//
+void CMpxVideoPlayerAppUiEngine::StepBackCollectionPathL()
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::StepBackCollectionPathL()"));
+
+ // Back the collection path one level...
+
+ CMPXCollectionPath* cPath = iCollectionUtility->Collection().PathL();
+ CleanupStack::PushL( cPath );
+
+ // Don't back up if there are no more levels or will panic
+ if ( cPath->Levels() > 1 )
+ {
+ cPath->Back();
+ iCollectionUtility->Collection().OpenL( *cPath );
+
+ //
+ // Workaround. Don't use mpx view utility yet
+ //
+ // iViewUtility->ActivatePreviousViewL();
+ }
+
+ CleanupStack::PopAndDestroy( cPath );
+}
+
+// -------------------------------------------------------------------------------------------------
+// Initialize the playback engine with a collection path
+// -------------------------------------------------------------------------------------------------
+//
+void CMpxVideoPlayerAppUiEngine::InitPlaybackEngineL( CMPXCollectionPath& aPath )
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::InitPlaybackEngineL()"));
+
+ // Create a playlist with the current collection path
+ CMPXCollectionPlaylist* playlist = CMPXCollectionPlaylist::NewL( aPath );
+ CleanupStack::PushL( playlist );
+
+ playlist->SetSingleItemPlaylist();
+ iPlaybackUtility->InitL( *playlist, ETrue );
+
+ CleanupStack::PopAndDestroy( playlist );
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMpxVideoPlayerAppUiEngine::HandleMultiLinksFileL
+// -------------------------------------------------------------------------------------------------
+//
+void CMpxVideoPlayerAppUiEngine::HandleMultiLinksFileL( const TDesC& aFileName,
+ CMediaRecognizer::TMediaType aMediaType )
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::HandleMultiLinksFileL()"),
+ _L("aFileName = %S, type = %d"), &aFileName, aMediaType );
+
+ TBool singleLink;
+ TBool localFile;
+
+ CVideoPlaylistUtility* playlistUtil = CVideoPlaylistUtility::NewL();
+ CleanupStack::PushL(playlistUtil);
+
+ playlistUtil->GetFileInfoL( aFileName, aMediaType, singleLink, localFile );
+
+ DoHandleMultiLinksFileL( playlistUtil, singleLink, localFile );
+
+ CleanupStack::PopAndDestroy( playlistUtil );
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMpxVideoPlayerAppUiEngine::HandleMultiLinksFileL
+// -------------------------------------------------------------------------------------------------
+//
+void CMpxVideoPlayerAppUiEngine::HandleMultiLinksFileL( RFile& aFile,
+ CMediaRecognizer::TMediaType aMediaType )
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::HandleMultiLinksFileL(RFile)"));
+
+ // playlist
+ TBool singleLink;
+ TBool localFile;
+
+ CVideoPlaylistUtility* playlistUtil = CVideoPlaylistUtility::NewL();
+ CleanupStack::PushL(playlistUtil);
+
+ playlistUtil->GetFileInfoL( aFile, aMediaType, singleLink, localFile );
+
+ DoHandleMultiLinksFileL( playlistUtil, singleLink, localFile );
+
+ CleanupStack::PopAndDestroy( playlistUtil );
+}
+
+
+void CMpxVideoPlayerAppUiEngine::DoHandleMultiLinksFileL( CVideoPlaylistUtility* aPlaylistUtil,
+ TBool aSingleLink,
+ TBool aLocalFile )
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::DoHandleMultiLinksFileL()"),
+ _L("aSingleLink = %d aLocalFile %d "), aSingleLink, aLocalFile);
+
+ if ( aSingleLink )
+ {
+ TPtrC link;
+ link.Set( aPlaylistUtil->GetLinkLC() );
+ iUpdateSeekInfo = ETrue;
+ iSeekable = aPlaylistUtil->IsSeekable();
+
+ if ( aLocalFile )
+ {
+ CMediaRecognizer::TMediaType mediaType = iRecognizer->IdentifyMediaTypeL( link );
+
+ if ( mediaType == CMediaRecognizer::EUnidentified )
+ {
+ User::Leave( KErrNotSupported );
+ }
+ else
+ {
+ iPlaybackUtility->InitL( link );
+ }
+ }
+ else
+ {
+ SetAccessPointL();
+ iPlaybackUtility->InitStreamingL( link,
+ (TDesC8*)(&KDATATYPEVIDEOHELIX),
+ iAccessPointId );
+ }
+ CleanupStack::PopAndDestroy(); // link
+ }
+ else
+ {
+ if ( ! aLocalFile )
+ {
+ SetAccessPointL();
+ }
+
+ CMPXMedia* playlist = aPlaylistUtil->GetPlayListL( iAccessPointId );
+ CleanupStack::PushL( playlist );
+
+ // Create FW utility member variables for playlist embedded use case
+ CreateCollectionUtilityMemberVariablesL();
+
+ // Set the flag to true
+ iMultilinkPlaylist = ETrue;
+
+ // load the in memory plugin
+ iCollectionUiHelper->OpenL( KUidMpxVideoPlayerApplication,
+ *playlist,
+ this,
+ EMPXCollectionPluginGallery );
+
+ CleanupStack::PopAndDestroy( playlist );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMpxVideoPlayerAppUiEngine::HandleUrlDesL
+// -------------------------------------------------------------------------------------------------
+//
+void CMpxVideoPlayerAppUiEngine::HandleUrlDesL( const TDesC& aUrl )
+{
+ 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
+// -------------------------------------------------------------------------------------------------
+//
+void CMpxVideoPlayerAppUiEngine::ProcessActivationMessageL( const TDesC8 &aMsg )
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::ProcessActivationMessageL()"));
+
+ if ( aMsg.Length() < KVideoPlayerActivationMessageMinLength )
+ {
+ User::Leave( KErrNotSupported );
+ }
+
+ TVideoPlayerActivationMessage msgHandler;
+ TPckg<TVideoPlayerActivationMessage> paramsPckg( msgHandler );
+ paramsPckg.Copy( aMsg );
+
+ /*if ( msgHandler.iMsgSender == TVideoPlayerActivationMessage::EMatrixMenu )
+ {
+ // Clear the view history, so app exits back to matrix.
+ iViewUtility->PushDefaultHistoryL();
+ }
+
+ if ( msgHandler.iMsgType == TVideoPlayerActivationMessage::EOpenInternetVideos )
+ {
+ iViewUtility->ActivateViewL( TUid::Uid( KMpxVideoPlayerVodViewPluginTypeId ) );
+ }
+ else if ( msgHandler.iMsgType == TVideoPlayerActivationMessage::EOpenVideoStorage )
+ {
+ iViewUtility->ActivateViewL( TUid::Uid( KUidMyVideosViewTypeId ) );
+ }
+ else*/ if ( msgHandler.iMsgType == TVideoPlayerActivationMessage::ELaunchVideoToPlayer )
+ {
+ // Launch video to player, it can be either local video or stream.
+
+ // If there's path and mpx id,
+ // clip can be played directly.
+ if ( msgHandler.iServiceId &&
+ msgHandler.iFullPath.Length() > 0 )
+ {
+ if ( iRecognizer->IdentifyMediaTypeL( msgHandler.iFullPath )
+ == CMediaRecognizer::ELocalVideoFile )
+ {
+ TMPXItemId id;
+ id.iId1 = msgHandler.iServiceId;
+ CMPXMedia* media = CMPXMedia::NewL();
+ CleanupStack::PushL( media );
+ media->SetTObjectValueL<TMPXItemId>( KMPXMediaGeneralId, id );
+ OpenMediaL( *media );
+ CleanupStack::PopAndDestroy( media );
+ }
+ else
+ {
+ // Most likely the clip has been deleted
+ User::Leave( KErrNotFound );
+ }
+ }
+ }
+ /*else
+ {
+ TBool vodUiRunning = ( iViewUtility->ActiveViewType() ==
+ TUid::Uid( KMpxVideoPlayerVodViewPluginTypeId ) );
+
+ if ( vodUiRunning )
+ {
+ // VOD is active, must use the utility to pass the message.
+ // Workaround for a test stopper, to be refactored.
+ CVcxViewMessageUtility::InstanceL()->SendCustomViewMessageL( TUid::Uid(0), aMsg );
+ }
+ else
+ {
+ // VOD is not running, activate with custom message.
+ HBufC* customMsg = HBufC::NewLC( paramsPckg.Length() );
+ customMsg->Des().Copy( paramsPckg );
+ iViewUtility->ActivateViewL( TUid::Uid( KMpxVideoPlayerVodViewPluginTypeId ), customMsg );
+ CleanupStack::PopAndDestroy( customMsg );
+
+ // Clear the view history, so playback returns where it was started
+ iViewUtility->PushDefaultHistoryL();
+ }
+ }
+ }
+ else if ( msgHandler.iMsgType == TVideoPlayerActivationMessage::ELaunchServiceById )
+ {
+ if ( iViewUtility->ActiveViewType() == TUid::Uid( KMpxVideoPlayerVodViewPluginTypeId ) )
+ {
+ // VOD is active, must use the utility to pass the message.
+ // Workaround for a test stopper, to be refactored.
+ CVcxViewMessageUtility::InstanceL()->SendCustomViewMessageL( TUid::Uid(0), aMsg );
+ }
+ else
+ {
+ // VOD is not running, activate with custom message.
+ HBufC* customMsg = HBufC::NewLC( paramsPckg.Length() );
+ customMsg->Des().Copy( paramsPckg );
+ iViewUtility->ActivateViewL( TUid::Uid( KMpxVideoPlayerVodViewPluginTypeId ), customMsg );
+ CleanupStack::PopAndDestroy( customMsg );
+ }
+ }*/
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMpxVideoPlayerAppUiEngine::HandleMessageL()
+// -------------------------------------------------------------------------------------------------
+//
+TBool CMpxVideoPlayerAppUiEngine::HandleMessageL( TUid aMessageUid,
+ const TDesC8& aMessageParameters )
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::HandleMessageL()"));
+
+ TBool msgHandled = EFalse;
+
+ switch ( aMessageUid.iUid )
+ {
+ // TVideoPlayerActivationMessage received.
+ case KVideoPlayerVodStartPlayer:
+ {
+ ProcessActivationMessageL( aMessageParameters );
+ msgHandled = ETrue;
+ break;
+ }
+ case KVideoPlayerStartPDlPlayer:
+ {
+ // Start the PDl
+ if ( iPdlHandler )
+ {
+ CBufFlat* paramBuf = CBufFlat::NewL( 1 );
+ CleanupStack::PushL( paramBuf );
+ paramBuf->InsertL( 0, aMessageParameters );
+ RBufReadStream readStream( *paramBuf );
+
+ CAiwGenericParamList* genParamList = CAiwGenericParamList::NewLC( readStream );
+
+ HandleAiwGenericParamListL( genParamList );
+
+ CleanupStack::PopAndDestroy( genParamList );
+ CleanupStack::PopAndDestroy( paramBuf );
+
+ msgHandled = ETrue;
+ }
+
+ break;
+ }
+ }
+
+ return msgHandled;
+}
+
+// -------------------------------------------------------------------------------------------------
+// Handle Custom messages from the collection
+// -------------------------------------------------------------------------------------------------
+//
+void CMpxVideoPlayerAppUiEngine::HandleCollectionMessage( CMPXMessage* aMessage, TInt aError )
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::HandleCollectionMessage()"));
+
+ if ( aError == KErrNone && aMessage )
+ {
+ TRAP_IGNORE( DoHandleCollectionMessageL( aMessage ) )
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// From MMPXCollectionObserver.
+// Handle media properties.
+// -------------------------------------------------------------------------------------------------
+//
+void CMpxVideoPlayerAppUiEngine::HandleCollectionMediaL( const CMPXMedia& aMedia, TInt aError )
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::HandleCollectionMediaL()"));
+
+ if ( aError == KErrNone )
+ {
+ DoHandelCollectionMediaL( aMedia );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// From MMPXCollectionObserver.
+// Handles the collection entries being opened.
+// -------------------------------------------------------------------------------------------------
+//
+void CMpxVideoPlayerAppUiEngine::HandleOpenL( const CMPXMedia& /* aEntries */,
+ TInt /* aIndex */,
+ TBool /* aComplete */,
+ TInt aError )
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::HandleOpenL(CMPXMedia)"));
+
+ if ( aError != KErrNone )
+ {
+ //
+ // Clip the collection path to root level and reopen
+ // This could happen after a USB refresh event where the
+ // item no longer exists
+ //
+ CMPXCollectionPath* path = iCollectionUtility->Collection().PathL();
+
+ CleanupStack::PushL( path );
+
+ while( path->Levels() > 1 )
+ {
+ path->Back();
+ }
+
+ iCollectionUtility->Collection().OpenL( *path );
+ CleanupStack::PopAndDestroy( path );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// From MMPXCollectionObserver.
+// Handles the item being opened.
+// -------------------------------------------------------------------------------------------------
+//
+void CMpxVideoPlayerAppUiEngine::HandleOpenL( const CMPXCollectionPlaylist& aPlaylist, TInt aError )
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::HandleOpenL(CMPXCollectionPlaylist)"));
+
+ if ( aError == KErrNone )
+ {
+ iPlaybackUtility->InitL( aPlaylist, EFalse );
+ }
+}
+
+
+
+// -------------------------------------------------------------------------------------------------
+// From MMPXCHelperEmbeddedOpenObserver
+// Handles OpenL from that occured in embedded mode
+// -------------------------------------------------------------------------------------------------
+//
+void CMpxVideoPlayerAppUiEngine::HandleEmbeddedOpenL( TInt aErr, TMPXGeneralCategory /*aCategory*/ )
+{
+ MPX_DEBUG(_L("CMPXVideoAppUi::HandleEmbeddedOpenL()"));
+
+ if ( aErr != KErrNone )
+ {
+
+ // Kill MPX
+ //RunAppShutter();
+ }
+ else // No error, set the launch mode
+ {
+ iPlaybackUtility->CommandL( EPbCmdDisableEffect );
+ }
+}
+
+
+void CMpxVideoPlayerAppUiEngine::HandleSoftKeyBackL()
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::HandleSoftKeyBackL()"));
+
+ //
+ // if we're in top level of our local view stack,
+ // back command exits the app. otherwise activate
+ // the previous view in our local view stack
+ //
+
+ //
+ // Workaround. Don't use mpx view utility yet
+ //
+ // if ( iViewUtility->ViewHistoryDepth() <= 1 )
+ if ( ETrue )
+ {
+ ActivateExitActiveObject();
+ }
+ else
+ {
+ StepBackCollectionPathL();
+ }
+}
+
+TBool CMpxVideoPlayerAppUiEngine::ProcessCommandParametersL( TApaCommand aCommand,
+ TFileName& aDocumentName,
+ const TDesC8& aTail )
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::ProcessCommandParametersL()"));
+
+ TBool retVal = EFalse;
+
+ //
+ // If command line has tail, this is probably a message from Matrix, Live TV
+ // reminder, Video Center soft notification, or other VC component.
+ //
+ if ( aTail.Length() > 0 )
+ {
+ ProcessActivationMessageL( aTail );
+ }
+ else
+ {
+ //
+ // If we are embedded or the command is to open a document
+ //
+
+ //
+ // Workaround. Embedded doesn't work yet
+ //
+ // if ( iAppUi->IsEmbedded() || aCommand != EApaCommandRun )
+ if ( aCommand != EApaCommandRun )
+ {
+ if ( iRecognizer->IsValidStreamingPrefix( aDocumentName ) )
+ {
+ retVal = ETrue;
+ }
+ else
+ {
+ retVal = ConeUtils::FileExists( aDocumentName );
+ }
+ }
+ else
+ {
+ StartStandAloneL();
+ }
+ }
+
+ return retVal;
+}
+
+void CMpxVideoPlayerAppUiEngine::ActivateExitActiveObject()
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::ActivateExitActiveObject()"));
+
+ if ( ! iExitAo->IsActive() )
+ {
+ iExitAo->Start( TCallBack( CMpxVideoPlayerAppUiEngine::ExitApplicationL, this ) );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMpxVideoPlayerAppUiEngine::ExitApplicationL
+// -------------------------------------------------------------------------------------------------
+//
+TInt CMpxVideoPlayerAppUiEngine::ExitApplicationL( TAny* aPtr )
+{
+ MPX_DEBUG(_L("CMpxVideoPlayerAppUiEngine::ExitApplicationL()"));
+
+ static_cast<CMpxVideoPlayerAppUiEngine*>(aPtr)->DoExitApplicationL();
+ return KErrNone;
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMpxVideoPlayerAppUiEngine::DoExitApplicationL
+// -------------------------------------------------------------------------------------------------
+//
+void CMpxVideoPlayerAppUiEngine::DoExitApplicationL()
+{
+ MPX_ENTER_EXIT(_L("CMpxVideoPlayerAppUiEngine::DoExitApplicationL()"));
+
+ /*iAppUi->HandleCommandL( EEikCmdExit );*/
+}
+
+// -------------------------------------------------------------------------------------------------
+// CMpxVideoPlayerAppUiEngine::UpdatePbPluginMedia()
+// -------------------------------------------------------------------------------------------------
+//
+void CMpxVideoPlayerAppUiEngine::UpdatePbPluginMediaL()
+{
+ MPX_DEBUG(_L("CMpxVideoPlayerAppUiEngine::UpdatePbPluginMediaL()iSeekable %d"), iSeekable);
+
+ CMPXCommand* cmd = CMPXCommand::NewL();
+ CleanupStack::PushL( cmd );
+
+ cmd->SetTObjectValueL<TBool>( KMPXCommandGeneralDoSync, ETrue );
+
+ cmd->SetTObjectValueL<TInt>( KMPXCommandGeneralId, KMPXMediaIdVideoPlayback );
+
+ cmd->SetTObjectValueL<TMPXVideoPlaybackCommand>( KMPXMediaVideoPlaybackCommand,
+ EPbCmdUpdateSeekable );
+
+ cmd->SetTObjectValueL<TBool>( KMPXMediaGeneralExtVideoSeekable, iSeekable );
+
+ iPlaybackUtility->CommandL( *cmd );
+
+ CleanupStack::PopAndDestroy( cmd );
+}
+
+// EOF
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/videoplayerengine/src/videoplayerengine.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,347 @@
+/*
+* 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 VideoPlayerEngine
+*
+*/
+
+// Version : %version: 20 %
+
+
+#include <qapplication>
+
+#include <hbinstance.h>
+#include <xqpluginloader.h>
+#include <xqplugininfo.h>
+#include <xqserviceutil.h>
+
+#include "videoplayerengine.h"
+#include "mpxvideoplaybackwrapper.h"
+#include "videoservices.h"
+
+// -------------------------------------------------------------------------------------------------
+// QVideoPlayerEngine()
+// -------------------------------------------------------------------------------------------------
+//
+QVideoPlayerEngine::QVideoPlayerEngine(bool isService)
+ : mIsService( isService )
+ , mEmbedded(false)
+ , mCurrentViewPlugin( 0 )
+ , mPlaybackViewPlugin( 0 )
+ , mCollectionViewPlugin( 0 )
+ , mFileDetailsViewPlugin( 0 )
+ , mPlaybackWrapper( 0 )
+ , mVideoServices(0)
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// ~QVideoPlayerEngine()
+// -------------------------------------------------------------------------------------------------
+//
+QVideoPlayerEngine::~QVideoPlayerEngine()
+{
+ if ( mVideoServices )
+ {
+ mVideoServices->decreaseReferenceCount();
+ mVideoServices = 0;
+ }
+
+ if ( mCollectionViewPlugin )
+ {
+ mCollectionViewPlugin->destroyView();
+ }
+
+ if ( mPlaybackViewPlugin )
+ {
+ mPlaybackViewPlugin->destroyView();
+ }
+
+ if ( mFileDetailsViewPlugin )
+ {
+ mFileDetailsViewPlugin->destroyView();
+ }
+
+ delete mPlaybackWrapper;
+
+ // disconnect all signals
+ disconnect();
+}
+
+// -------------------------------------------------------------------------------------------------
+// initialize()
+// -------------------------------------------------------------------------------------------------
+//
+void QVideoPlayerEngine::initialize()
+{
+ //
+ // Clean up QVideoPlayerEngine when qApp try to quit
+ //
+ connect( qApp, SIGNAL( aboutToQuit() ), this, SLOT( handleQuit() ) );
+
+ //
+ // Create playback wrapper
+ //
+ if ( !mPlaybackWrapper )
+ {
+ mPlaybackWrapper = new QMpxVideoPlaybackWrapper();
+ connect( mPlaybackWrapper,
+ SIGNAL( handlePlaybackView( int ) ),
+ this,
+ SLOT( handleCommand( int ) ) );
+ }
+
+ //
+ // Get VideoServices instance
+ //
+ if( mIsService && !mVideoServices )
+ {
+ mVideoServices = VideoServices::instance(this);
+ connect( mVideoServices, SIGNAL(activated(int)), this, SLOT(handleCommand(int)));
+ }
+
+ QList<XQPluginInfo> impls;
+ XQPluginLoader::listImplementations("org.nokia.mmdt.MpxViewPlugin/1.0", impls);
+
+ //
+ // Pre-load collectionview and playbackview plugins
+ //
+ loadPlugin( MpxHbVideoCommon::CollectionView );
+
+ if ( mCollectionViewPlugin )
+ {
+ mCollectionViewPlugin->createView();
+ }
+
+ loadPlugin( MpxHbVideoCommon::PlaybackView );
+
+ if ( mPlaybackViewPlugin )
+ {
+ mPlaybackViewPlugin->createView();
+ }
+
+ loadPlugin( MpxHbVideoCommon::VideoDetailsView );
+
+ if ( mFileDetailsViewPlugin )
+ {
+ mFileDetailsViewPlugin->createView();
+ }
+
+ //
+ // default view in the app is the collection view.
+ //
+ if(!mIsService)
+ {
+ activateView( MpxHbVideoCommon::CollectionView );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// handleCommand()
+// -------------------------------------------------------------------------------------------------
+//
+void QVideoPlayerEngine::handleCommand( int commandCode )
+{
+ switch ( commandCode )
+ {
+ case MpxHbVideoCommon::ActivateCollectionView:
+ {
+ if ( mCurrentViewPlugin != mCollectionViewPlugin )
+ {
+ activateView( MpxHbVideoCommon::CollectionView );
+ }
+ break;
+ }
+ case MpxHbVideoCommon::ActivatePlaybackView:
+ {
+ if ( mCurrentViewPlugin != mPlaybackViewPlugin )
+ {
+ activateView( MpxHbVideoCommon::PlaybackView );
+ }
+ break;
+ }
+ case MpxHbVideoCommon::ActivateVideoDetailsView:
+ {
+ if ( mCurrentViewPlugin != mFileDetailsViewPlugin )
+ {
+ activateView( MpxHbVideoCommon::VideoDetailsView );
+ }
+ break;
+ }
+ case MpxHbVideoCommon::LoadVideoDetailsView:
+ {
+ if ( mFileDetailsViewPlugin )
+ {
+ mFileDetailsViewPlugin->createView();
+ }
+ break;
+ }
+
+ default:
+ {
+ break;
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// activateView()
+// activate view based on view type.
+// -------------------------------------------------------------------------------------------------
+//
+void QVideoPlayerEngine::activateView( MpxHbVideoCommon::MpxHbVideoViewType viewType )
+{
+ disconnectView();
+
+ if ( mCurrentViewPlugin )
+ {
+ mCurrentViewPlugin->deactivateView();
+ hbInstance->allMainWindows().value(0)->removeView( mCurrentViewPlugin->getView() );
+ mCurrentViewPlugin = NULL;
+ }
+
+ if ( viewType == MpxHbVideoCommon::CollectionView && mCollectionViewPlugin )
+ {
+ if ( mIsService && (VideoServices::EPlayback == mVideoServices->currentService()) )
+ {
+ qApp->quit();
+ XQServiceUtil::toBackground(false);
+ return;
+ }
+ else
+ {
+ mCurrentViewPlugin = mCollectionViewPlugin;
+ }
+ }
+ else if ( viewType == MpxHbVideoCommon::PlaybackView && mPlaybackViewPlugin )
+ {
+ mCurrentViewPlugin = mPlaybackViewPlugin;
+ }
+ else if ( viewType == MpxHbVideoCommon::VideoDetailsView && mFileDetailsViewPlugin )
+ {
+ mCurrentViewPlugin = mFileDetailsViewPlugin;
+ }
+ else
+ {
+ // invalid plugin activation request, do nothing
+ return;
+ }
+
+ hbInstance->allMainWindows().value(0)->addView( mCurrentViewPlugin->getView() );
+ connectView();
+ mCurrentViewPlugin->activateView();
+}
+
+// -------------------------------------------------------------------------------------------------
+// loadPlugin()
+// -------------------------------------------------------------------------------------------------
+//
+void QVideoPlayerEngine::loadPlugin( MpxHbVideoCommon::MpxHbVideoViewType viewType )
+{
+ int viewTypeUid( 0 );
+
+ if ( viewType == MpxHbVideoCommon::CollectionView )
+ {
+ viewTypeUid = MpxHbVideoCommon::KMpxVideoPluginDllCollectionUid;
+ }
+ else if ( viewType == MpxHbVideoCommon::PlaybackView )
+ {
+ viewTypeUid = MpxHbVideoCommon::KMpxVideoPluginDllPlaybackUid;
+ }
+ else if( viewType == MpxHbVideoCommon::VideoDetailsView )
+ {
+ viewTypeUid = MpxHbVideoCommon::KMpxVideoPluginDllFileDetailsUid;
+ }
+
+ if ( viewTypeUid )
+ {
+ // activate the collection view
+ XQPluginLoader pluginLoader( viewTypeUid );
+ QObject* instance = pluginLoader.instance();
+
+ if ( instance )
+ {
+ if ( viewType == MpxHbVideoCommon::CollectionView )
+ {
+ mCollectionViewPlugin = qobject_cast<MpxViewPlugin*>( instance )->viewPlugin();
+ }
+ else if ( viewType == MpxHbVideoCommon::PlaybackView )
+ {
+ mPlaybackViewPlugin = qobject_cast<MpxViewPlugin*>( instance )->viewPlugin();
+ }
+ else if ( viewType == MpxHbVideoCommon::VideoDetailsView )
+ {
+ mFileDetailsViewPlugin = qobject_cast<MpxViewPlugin*>( instance )->viewPlugin();
+ }
+ }
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// connectView()
+// connect application to view by setting up the signals and slots.
+// -------------------------------------------------------------------------------------------------
+//
+void QVideoPlayerEngine::connectView()
+{
+ connect( mCurrentViewPlugin,
+ SIGNAL( command( int ) ),
+ this,
+ SLOT( handleCommand( int ) ) );
+}
+
+// -------------------------------------------------------------------------------------------------
+// disconnectView()
+// connect application to view by setting up the signals and slots.
+// -------------------------------------------------------------------------------------------------
+//
+void QVideoPlayerEngine::disconnectView()
+{
+ if ( mCurrentViewPlugin )
+ {
+ disconnect( mCurrentViewPlugin,
+ SIGNAL( command( int ) ),
+ this,
+ SLOT( handleCommand( int ) ) );
+ }
+}
+
+// -------------------------------------------------------------------------------------------------
+// handleQuit()
+// -------------------------------------------------------------------------------------------------
+//
+void QVideoPlayerEngine::handleQuit()
+{
+ delete this;
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// playMedia()
+// -------------------------------------------------------------------------------------------------
+//
+void QVideoPlayerEngine::playMedia( QString filePath )
+{
+ mPlaybackWrapper->playMedia( filePath );
+}
+
+// -------------------------------------------------------------------------------------------------
+// setEmbedded()
+// -------------------------------------------------------------------------------------------------
+//
+void QVideoPlayerEngine::setEmbedded()
+{
+ mEmbedded = true;
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/videoplayerengine/src/videoserviceplay.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,57 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation of VideoServicePlay
+*
+*/
+
+
+#include <videoservices.h>
+#include "videoserviceplay.h"
+#include "videoplayerengine.h"
+
+
+VideoServicePlay::VideoServicePlay( VideoServices* parent, QVideoPlayerEngine* engine )
+: XQServiceProvider(QLatin1String("com.nokia.Videos.IVideoView"), parent),
+ mEngine(engine),
+ mServiceApp(parent)
+{
+ publishAll();
+}
+
+VideoServicePlay::~VideoServicePlay()
+{
+}
+
+void VideoServicePlay::setEngine( QVideoPlayerEngine* engine )
+{
+ mEngine = engine;
+}
+
+void VideoServicePlay::playMedia( QString filePath )
+{
+ if(mEngine)
+ {
+ mServiceApp->setCurrentService(VideoServices::EPlayback);
+ mEngine->playMedia( filePath );
+ }
+}
+
+void VideoServicePlay::playPDLMedia( QString filePath, int downloadID )
+{
+}
+
+void VideoServicePlay::closePlayer()
+{
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/videoplayerengine/src/videoservices.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,140 @@
+/*
+* 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 VideoServices
+*
+*/
+
+#include <videoplayerengine.h>
+#include <videoservices.h>
+#include <videoserviceurifetch.h>
+#include <videoserviceplay.h>
+
+VideoServices *VideoServices::mInstance = 0;
+
+// -----------------------------------------------------------------------------
+// VideoServices::instance()
+// -----------------------------------------------------------------------------
+//
+VideoServices* VideoServices::instance(QVideoPlayerEngine* engine)
+{
+ if(!mInstance)
+ {
+ mInstance = new VideoServices(engine);
+ }
+ else if(engine && !mInstance->engine())
+ {
+ mInstance->setEngine(engine);
+ }
+ mInstance->mReferenceCount++;
+ return mInstance;
+}
+
+// -----------------------------------------------------------------------------
+// VideoServices::decreaseReferenceCount()
+// -----------------------------------------------------------------------------
+//
+void VideoServices::decreaseReferenceCount()
+{
+ if(mInstance)
+ {
+ if(--mInstance->mReferenceCount == 0)
+ {
+ delete mInstance;
+ mInstance = NULL;
+ }
+ }
+}
+
+// ----------------------------------------------------------------------------
+// setEngine()
+// ----------------------------------------------------------------------------
+//
+void VideoServices::setEngine(QVideoPlayerEngine* engine)
+{
+ if (mServicePlay)
+ {
+ mEngine = engine;
+ mServicePlay->setEngine(engine);
+ }
+}
+
+// ----------------------------------------------------------------------------
+// engine()
+// ----------------------------------------------------------------------------
+//
+QVideoPlayerEngine* VideoServices::engine()
+{
+ return mEngine;
+}
+
+// ----------------------------------------------------------------------------
+// VideoServices()
+// ----------------------------------------------------------------------------
+//
+VideoServices::VideoServices(QVideoPlayerEngine* engine) :
+mReferenceCount(0),
+mEngine(engine),
+mCurrentService(VideoServices::ENoService)
+{
+ mServiceUriFetch = new VideoServiceUriFetch(this);
+ mServicePlay = new VideoServicePlay(this, engine);
+}
+
+// ----------------------------------------------------------------------------
+// ~VideoServices()
+// ----------------------------------------------------------------------------
+//
+VideoServices::~VideoServices()
+{
+ delete mServiceUriFetch;
+ delete mServicePlay;
+}
+
+// ----------------------------------------------------------------------------
+// currentService()
+// ----------------------------------------------------------------------------
+//
+VideoServices::TVideoService VideoServices::currentService()
+{
+ return mCurrentService;
+}
+
+// ----------------------------------------------------------------------------
+// setCurrentService()
+// ----------------------------------------------------------------------------
+//
+void VideoServices::setCurrentService(VideoServices::TVideoService service)
+{
+ mCurrentService = service;
+}
+// ----------------------------------------------------------------------------
+// contextTitle()
+// ----------------------------------------------------------------------------
+//
+QString VideoServices::contextTitle() const
+{
+ return mServiceUriFetch->contextTitle();
+}
+
+// ----------------------------------------------------------------------------
+// itemSelected()
+// ----------------------------------------------------------------------------
+//
+void VideoServices::itemSelected(const QString& item)
+{
+ QStringList list;
+ list.append(item);
+ mServiceUriFetch->complete(list);
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/videoplayerengine/src/videoserviceurifetch.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,112 @@
+/*
+* 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 VideoServiceUriFetch
+*
+*/
+
+#include <hbapplication.h>
+#include <videoservices.h>
+#include <videoserviceurifetch.h>
+
+#include "mpxhbvideocommondefs.h"
+
+
+// ----------------------------------------------------------------------------
+// VideoServiceUriFetch()
+// ----------------------------------------------------------------------------
+//
+VideoServiceUriFetch::VideoServiceUriFetch(VideoServices* parent)
+: XQServiceProvider(QLatin1String("com.nokia.Videos.IVideoFetch"),parent),
+ mRequestIndex(0),
+ mServiceApp(parent)
+{
+ publishAll();
+}
+
+// ----------------------------------------------------------------------------
+// ~VideoServiceUriFetch()
+// ----------------------------------------------------------------------------
+//
+VideoServiceUriFetch::~VideoServiceUriFetch()
+{
+
+}
+
+// ----------------------------------------------------------------------------
+// fetchFailed()
+// ----------------------------------------------------------------------------
+//
+void VideoServiceUriFetch::fetchFailed( int errorCode )
+{
+ QStringList filesList;
+ filesList.insert(0, QString::number( errorCode ));//result
+ doComplete(filesList);
+}
+
+// ----------------------------------------------------------------------------
+// complete()
+// ----------------------------------------------------------------------------
+//
+void VideoServiceUriFetch::complete( QStringList filesList )
+{
+ doComplete(filesList);
+}
+
+// ----------------------------------------------------------------------------
+// doComplete()
+// ----------------------------------------------------------------------------
+//
+void VideoServiceUriFetch::doComplete( QStringList filesList)
+{
+ if ( isActive() )
+ {
+ connect(this, SIGNAL(returnValueDelivered()), qApp, SLOT(quit()));
+ completeRequest(mRequestIndex, filesList);
+ mRequestIndex = 0;
+ }
+}
+
+// ----------------------------------------------------------------------------
+// isActive()
+// ----------------------------------------------------------------------------
+//
+bool VideoServiceUriFetch::isActive()
+{
+ return (mRequestIndex > 0);
+}
+
+// ----------------------------------------------------------------------------
+// VideoServiceUriFetch()
+// ----------------------------------------------------------------------------
+//
+QString VideoServiceUriFetch::contextTitle() const
+{
+ return mTitle;
+}
+
+// ----------------------------------------------------------------------------
+// fetch()
+// ----------------------------------------------------------------------------
+//
+void VideoServiceUriFetch::fetch(const QString& title)
+{
+ mTitle = title;
+ emit mServiceApp->activated(MpxHbVideoCommon::ActivateCollectionView);
+ emit mServiceApp->titleReady(title);
+
+ mServiceApp->setCurrentService(VideoServices::EUriFetcher);
+
+ mRequestIndex = setCurrentRequestAsync();
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/inc/testvideoplayerengine.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,109 @@
+/*
+* 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: Videoplayerengine test class declaration.
+*
+*/
+
+// TODO: at the moment we are not able to get access to all private methods
+// to the class under test. We need to declare some own framework in order
+// to declare testclasses into friends of classes under test etc.
+//
+// missing test functions:
+// - how to setup construction to fail for testing purposes
+
+
+#ifndef __TESTVIDEOPLAYERENGINE_H__
+#define __TESTVIDEOPLAYERENGINE_H__
+
+
+// INCLUDES
+#include <QtTest/QtTest>
+
+class MpxViewPlugin;
+class QMpxVideoPlaybackWrapper;
+class QVideoPlayerEngine;
+class VideoServices;
+
+class TestVideoPlayerEngine : public QObject
+ {
+
+ Q_OBJECT
+
+public: // Constructor / destructor
+
+ /**
+ * Contructor.
+ *
+ */
+ TestVideoPlayerEngine();
+
+ /**
+ * Destructor.
+ *
+ */
+ virtual ~TestVideoPlayerEngine();
+
+private slots:
+
+ void init(bool isService = false);
+ void cleanup();
+
+ void testCreateDelete();
+ void testCreateDeleteService();
+
+ void testInitialize();
+ void testInitializeService();
+
+ void testMultipleInitialize();
+ void testMultipleInitializeService();
+
+ void testHandleCommandPreInit();
+ void testHandleCommandPostInit();
+ void testHandleCommandPreAndPostInit();
+
+ void testHandleCommandPluginFail();
+ void testHandleCommandPluginFail1();
+ void testHandleCommandPluginFail2();
+
+ void testPlayMedia();
+ void testSetEmbedded();
+
+ // called after last test case executed
+ void cleanupTestCase();
+
+signals:
+
+ void aboutToQuit();
+
+private:
+
+ QVideoPlayerEngine* mTestObject;
+
+ MpxViewPlugin* mCurrentViewPlugin;
+ MpxViewPlugin* mPlaybackViewPlugin;
+ MpxViewPlugin* mCollectionViewPlugin;
+ MpxViewPlugin* mFileDetailsViewPlugin;
+
+ VideoServices* mVideoServices;
+
+ QMpxVideoPlaybackWrapper *mPlaybackWrapper;
+
+};
+
+#endif // __TESTVIDEOPLAYERENGINE_H__
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/src/testvideoplayerengine.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,753 @@
+/*
+* 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: Videoplayerengine test class implementation.
+*
+*/
+
+// INCLUDES
+#include <QtTest/QtTest>
+#include <qdebug.h>
+#include "stub/inc/hbinstance.h"
+#include <hbwidget.h>
+#include <hbpushbutton.h>
+#include <hblabel.h>
+#include <hbaction.h>
+#include <hbapplication.h>
+#include <qabstractitemmodel.h>
+
+#include "mpxhbvideocommondefs.h"
+#include "testvideoplayerengine.h"
+#include "stub/inc/mpxviewpluginqt.h"
+#include "stub/inc/videoservices.h"
+#include "stub/inc/xqpluginloader.h"
+#include "../stub/inc/mpxvideoplaybackwrapper.h"
+#define private public
+#include "videoplayerengine.h"
+#undef private
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ HbApplication app(argc, argv);
+
+ TestVideoPlayerEngine tc;
+
+ char *pass[3];
+ pass[0] = argv[0];
+ pass[1] = "-o";
+ pass[2] = "c:\\data\\TestVideoPlayerEngine.txt";
+
+ return QTest::qExec(&tc, 3, pass);
+}
+
+
+TestVideoPlayerEngine::TestVideoPlayerEngine()
+ : mTestObject(0)
+ , mVideoServices(0)
+ , mCurrentViewPlugin(0)
+ , mPlaybackViewPlugin(0)
+ , mCollectionViewPlugin(0)
+ , mFileDetailsViewPlugin(0)
+{
+}
+
+TestVideoPlayerEngine::~TestVideoPlayerEngine()
+{
+ XQPluginLoader::cleanup();
+
+ delete mTestObject;
+ mTestObject = 0;
+}
+
+
+void TestVideoPlayerEngine::init(bool isService)
+{
+ XQPluginLoader::mFailToLoadPluginUid = -1;
+
+ mCurrentViewPlugin = 0;
+ mPlaybackViewPlugin = 0;
+ mCollectionViewPlugin = 0;
+ mFileDetailsViewPlugin = 0;
+ mVideoServices = 0;
+
+ mTestObject = new QVideoPlayerEngine(isService);
+}
+
+void TestVideoPlayerEngine::cleanup()
+{
+ mCurrentViewPlugin = 0;
+ mPlaybackViewPlugin = 0;
+ mCollectionViewPlugin = 0;
+ mFileDetailsViewPlugin = 0;
+ mVideoServices = 0;
+
+ delete mTestObject;
+ mTestObject = 0;
+}
+
+
+void TestVideoPlayerEngine::testCreateDelete()
+{
+ //Test object creation and deletion
+ init();
+
+ QVERIFY(mTestObject);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin == 0);
+ QVERIFY(mTestObject->mPlaybackViewPlugin == 0);
+ QVERIFY(mTestObject->mCollectionViewPlugin == 0);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin == 0);
+ QVERIFY(mTestObject->mPlaybackWrapper == 0);
+ QVERIFY(mTestObject->mVideoServices == 0);
+ QVERIFY(mTestObject->mIsService == false);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ cleanup();
+
+ QVERIFY(VideoServices::mReferenceCount == 0);
+}
+
+
+void TestVideoPlayerEngine::testCreateDeleteService()
+{
+ //Test object creation and deletion
+ init(true);
+
+ QVERIFY(mTestObject);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin == 0);
+ QVERIFY(mTestObject->mPlaybackViewPlugin == 0);
+ QVERIFY(mTestObject->mCollectionViewPlugin == 0);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin == 0);
+ QVERIFY(mTestObject->mPlaybackWrapper == 0);
+ QVERIFY(mTestObject->mVideoServices == 0);
+ QVERIFY(mTestObject->mIsService == true);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ cleanup();
+
+ QVERIFY(VideoServices::mReferenceCount == 0);
+}
+
+void TestVideoPlayerEngine::testInitialize()
+{
+ init();
+
+ QVERIFY(mTestObject);
+ QVERIFY(mTestObject->mCurrentViewPlugin == 0);
+ QVERIFY(mTestObject->mPlaybackViewPlugin == 0);
+ QVERIFY(mTestObject->mCollectionViewPlugin == 0);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin == 0);
+ QVERIFY(mTestObject->mPlaybackWrapper == 0);
+ QVERIFY(mTestObject->mVideoServices == 0);
+ QVERIFY(mTestObject->mIsService == false);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ mTestObject->initialize();
+
+ QVERIFY(mTestObject->mCurrentViewPlugin != 0);
+ QVERIFY(mTestObject->mPlaybackViewPlugin != 0);
+ QVERIFY(mTestObject->mCollectionViewPlugin != 0);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin != 0);
+ QVERIFY(mTestObject->mPlaybackWrapper != 0);
+ QVERIFY(mTestObject->mVideoServices == 0);
+ QVERIFY(mTestObject->mIsService == false);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ QVERIFY(mTestObject->mCollectionViewPlugin != mTestObject->mPlaybackViewPlugin);
+ QVERIFY(mTestObject->mCollectionViewPlugin != mTestObject->mFileDetailsViewPlugin);
+ QVERIFY(mTestObject->mPlaybackViewPlugin != mTestObject->mFileDetailsViewPlugin);
+
+ cleanup();
+
+ QVERIFY(VideoServices::mReferenceCount == 0);
+}
+
+void TestVideoPlayerEngine::testInitializeService()
+{
+ init(true);
+
+ QVERIFY(mTestObject);
+ QVERIFY(mTestObject->mCurrentViewPlugin == 0);
+ QVERIFY(mTestObject->mPlaybackViewPlugin == 0);
+ QVERIFY(mTestObject->mCollectionViewPlugin == 0);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin == 0);
+ QVERIFY(mTestObject->mPlaybackWrapper == 0);
+ QVERIFY(mTestObject->mVideoServices == 0);
+ QVERIFY(mTestObject->mIsService == true);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ mTestObject->initialize();
+
+ QVERIFY(mTestObject->mCurrentViewPlugin == 0);
+ QVERIFY(mTestObject->mPlaybackViewPlugin != 0);
+ QVERIFY(mTestObject->mCollectionViewPlugin != 0);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin != 0);
+ QVERIFY(mTestObject->mPlaybackWrapper != 0);
+ QVERIFY(mTestObject->mVideoServices != 0);
+ QVERIFY(mTestObject->mIsService == true);
+ QVERIFY(VideoServices::mReferenceCount == 1);
+
+ QVERIFY(mTestObject->mCollectionViewPlugin != mTestObject->mPlaybackViewPlugin);
+ QVERIFY(mTestObject->mCollectionViewPlugin != mTestObject->mFileDetailsViewPlugin);
+ QVERIFY(mTestObject->mPlaybackViewPlugin != mTestObject->mFileDetailsViewPlugin);
+
+ cleanup();
+
+ QVERIFY(VideoServices::mReferenceCount == 0);
+}
+
+void TestVideoPlayerEngine::testMultipleInitialize()
+{
+ init();
+
+ QVERIFY(mTestObject);
+ QVERIFY(mTestObject->mCurrentViewPlugin == 0);
+ QVERIFY(mTestObject->mPlaybackViewPlugin == 0);
+ QVERIFY(mTestObject->mCollectionViewPlugin == 0);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin == 0);
+ QVERIFY(mTestObject->mVideoServices == 0);
+ QVERIFY(mTestObject->mIsService == false);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ mTestObject->initialize();
+
+ QVERIFY(mTestObject->mCurrentViewPlugin != 0);
+ QVERIFY(mTestObject->mPlaybackViewPlugin != 0);
+ QVERIFY(mTestObject->mCollectionViewPlugin != 0);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin != 0);
+ QVERIFY(mTestObject->mVideoServices == 0);
+ QVERIFY(mTestObject->mIsService == false);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ mCurrentViewPlugin = mTestObject->mCurrentViewPlugin;
+ mPlaybackViewPlugin = mTestObject->mPlaybackViewPlugin;
+ mCollectionViewPlugin = mTestObject->mCollectionViewPlugin;
+ mFileDetailsViewPlugin = mTestObject->mFileDetailsViewPlugin;
+
+ mTestObject->initialize();
+
+ QVERIFY(mCurrentViewPlugin == mTestObject->mCurrentViewPlugin);
+ QVERIFY(mPlaybackViewPlugin == mTestObject->mPlaybackViewPlugin);
+ QVERIFY(mCollectionViewPlugin == mTestObject->mCollectionViewPlugin);
+ QVERIFY(mFileDetailsViewPlugin == mTestObject->mFileDetailsViewPlugin);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ cleanup();
+
+ QVERIFY(VideoServices::mReferenceCount == 0);
+}
+
+void TestVideoPlayerEngine::testMultipleInitializeService()
+{
+ init(true);
+
+ QVERIFY(mTestObject);
+ QVERIFY(mTestObject->mCurrentViewPlugin == 0);
+ QVERIFY(mTestObject->mPlaybackViewPlugin == 0);
+ QVERIFY(mTestObject->mCollectionViewPlugin == 0);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin == 0);
+ QVERIFY(mTestObject->mVideoServices == 0);
+ QVERIFY(mTestObject->mIsService == true);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ mTestObject->initialize();
+
+ QVERIFY(mTestObject->mCurrentViewPlugin == 0);
+ QVERIFY(mTestObject->mPlaybackViewPlugin != 0);
+ QVERIFY(mTestObject->mCollectionViewPlugin != 0);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin != 0);
+ QVERIFY(mTestObject->mVideoServices != 0);
+ QVERIFY(mTestObject->mIsService == true);
+ QVERIFY(VideoServices::mReferenceCount == 1);
+
+ mCurrentViewPlugin = mTestObject->mCurrentViewPlugin;
+ mPlaybackViewPlugin = mTestObject->mPlaybackViewPlugin;
+ mCollectionViewPlugin = mTestObject->mCollectionViewPlugin;
+ mFileDetailsViewPlugin = mTestObject->mFileDetailsViewPlugin;
+ mVideoServices = mTestObject->mVideoServices;
+
+ mTestObject->initialize();
+
+ QVERIFY(mCurrentViewPlugin == mTestObject->mCurrentViewPlugin);
+ QVERIFY(mPlaybackViewPlugin == mTestObject->mPlaybackViewPlugin);
+ QVERIFY(mCollectionViewPlugin == mTestObject->mCollectionViewPlugin);
+ QVERIFY(mFileDetailsViewPlugin == mTestObject->mFileDetailsViewPlugin);
+ QVERIFY(mVideoServices == mTestObject->mVideoServices);
+ QVERIFY(VideoServices::mReferenceCount == 1);
+
+ cleanup();
+
+ QVERIFY(VideoServices::mReferenceCount == 0);
+}
+
+
+void TestVideoPlayerEngine::testHandleCommandPreInit()
+{
+ init();
+
+ QVERIFY(mTestObject);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin == 0);
+ QVERIFY(mTestObject->mPlaybackViewPlugin == 0);
+ QVERIFY(mTestObject->mCollectionViewPlugin == 0);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin == 0);
+ QVERIFY(mTestObject->mIsService == false);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ mTestObject->handleCommand(MpxHbVideoCommon::ActivateCollectionView);
+ mTestObject->handleCommand(MpxHbVideoCommon::ActivatePlaybackView);
+ mTestObject->handleCommand(MpxHbVideoCommon::ActivateVideoDetailsView);
+
+ mTestObject->handleCommand(MpxHbVideoCommon::LoadVideoDetailsView);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin == mTestObject->mFileDetailsViewPlugin);
+ QVERIFY(mTestObject->mPlaybackViewPlugin == 0);
+ QVERIFY(mTestObject->mCollectionViewPlugin == 0);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin == 0);
+ QVERIFY(mTestObject->mIsService == false);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ cleanup();
+
+ QVERIFY(VideoServices::mReferenceCount == 0);
+}
+
+void TestVideoPlayerEngine::testHandleCommandPostInit()
+{
+ init();
+
+ QVERIFY(mTestObject);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin == 0);
+ QVERIFY(mTestObject->mPlaybackViewPlugin == 0);
+ QVERIFY(mTestObject->mCollectionViewPlugin == 0);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin == 0);
+ QVERIFY(mTestObject->mIsService == false);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ mTestObject->initialize();
+
+ QVERIFY(mTestObject->mCurrentViewPlugin != 0);
+ QVERIFY(mTestObject->mPlaybackViewPlugin != 0);
+ QVERIFY(mTestObject->mCollectionViewPlugin != 0);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin != 0);
+ QVERIFY(mTestObject->mIsService == false);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin == mTestObject->mCollectionViewPlugin);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin->activated());
+ QVERIFY(mTestObject->mPlaybackViewPlugin->activated() == false);
+ QVERIFY(mTestObject->mCollectionViewPlugin->activated());
+ QVERIFY(mTestObject->mFileDetailsViewPlugin->activated() == false);
+
+ mTestObject->handleCommand(MpxHbVideoCommon::ActivatePlaybackView);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin == mTestObject->mPlaybackViewPlugin);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin->activated());
+ QVERIFY(mTestObject->mPlaybackViewPlugin->activated());
+ QVERIFY(mTestObject->mCollectionViewPlugin->activated() == false);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin->activated() == false);
+ QVERIFY(mTestObject->mIsService == false);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ mTestObject->handleCommand(MpxHbVideoCommon::ActivateVideoDetailsView);
+
+ QVERIFY(mTestObject->mFileDetailsViewPlugin != 0);
+ QVERIFY(mTestObject->mCurrentViewPlugin == mTestObject->mFileDetailsViewPlugin);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin->activated());
+ QVERIFY(mTestObject->mPlaybackViewPlugin->activated() == false);
+ QVERIFY(mTestObject->mCollectionViewPlugin->activated() == false);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin->activated());
+ QVERIFY(mTestObject->mIsService == false);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ mTestObject->handleCommand(MpxHbVideoCommon::ActivateCollectionView);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin == mTestObject->mCollectionViewPlugin);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin->activated());
+ QVERIFY(mTestObject->mPlaybackViewPlugin->activated() == false);
+ QVERIFY(mTestObject->mCollectionViewPlugin->activated());
+ QVERIFY(mTestObject->mFileDetailsViewPlugin->activated() == false);
+ QVERIFY(mTestObject->mIsService == false);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ mTestObject->handleCommand(MpxHbVideoCommon::ActivateCollectionView-1111);
+
+ cleanup();
+
+ QVERIFY(VideoServices::mReferenceCount == 0);
+}
+
+void TestVideoPlayerEngine::testHandleCommandPreAndPostInit()
+{
+ init();
+
+ QVERIFY(mTestObject);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin == 0);
+ QVERIFY(mTestObject->mPlaybackViewPlugin == 0);
+ QVERIFY(mTestObject->mCollectionViewPlugin == 0);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin == 0);
+ QVERIFY(mTestObject->mIsService == false);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ mTestObject->handleCommand(MpxHbVideoCommon::ActivateCollectionView);
+ mTestObject->handleCommand(MpxHbVideoCommon::ActivatePlaybackView);
+ mTestObject->handleCommand(MpxHbVideoCommon::ActivateVideoDetailsView);
+
+ mTestObject->handleCommand(MpxHbVideoCommon::LoadVideoDetailsView);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin == mTestObject->mFileDetailsViewPlugin);
+ QVERIFY(mTestObject->mPlaybackViewPlugin == 0);
+ QVERIFY(mTestObject->mCollectionViewPlugin == 0);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin == 0);
+ QVERIFY(mTestObject->mIsService == false);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ mTestObject->initialize();
+
+ QVERIFY(mTestObject->mCurrentViewPlugin != 0);
+ QVERIFY(mTestObject->mPlaybackViewPlugin != 0);
+ QVERIFY(mTestObject->mCollectionViewPlugin != 0);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin != 0);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin == mTestObject->mCollectionViewPlugin);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin->activated());
+ QVERIFY(mTestObject->mPlaybackViewPlugin->activated() == false);
+ QVERIFY(mTestObject->mCollectionViewPlugin->activated());
+ QVERIFY(mTestObject->mFileDetailsViewPlugin->activated() == false);
+ QVERIFY(mTestObject->mIsService == false);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ mTestObject->handleCommand(MpxHbVideoCommon::ActivatePlaybackView);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin == mTestObject->mPlaybackViewPlugin);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin->activated());
+ QVERIFY(mTestObject->mPlaybackViewPlugin->activated());
+ QVERIFY(mTestObject->mCollectionViewPlugin->activated() == false);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin->activated() == false);
+ QVERIFY(mTestObject->mIsService == false);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ mTestObject->handleCommand(MpxHbVideoCommon::ActivateVideoDetailsView);
+
+ QVERIFY(mTestObject->mFileDetailsViewPlugin != 0);
+ QVERIFY(mTestObject->mCurrentViewPlugin == mTestObject->mFileDetailsViewPlugin);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin->activated());
+ QVERIFY(mTestObject->mPlaybackViewPlugin->activated() == false);
+ QVERIFY(mTestObject->mCollectionViewPlugin->activated() == false);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin->activated());
+ QVERIFY(mTestObject->mIsService == false);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ mTestObject->handleCommand(MpxHbVideoCommon::ActivateCollectionView);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin == mTestObject->mCollectionViewPlugin);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin->activated());
+ QVERIFY(mTestObject->mPlaybackViewPlugin->activated() == false);
+ QVERIFY(mTestObject->mCollectionViewPlugin->activated());
+ QVERIFY(mTestObject->mFileDetailsViewPlugin->activated() == false);
+ QVERIFY(mTestObject->mIsService == false);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ cleanup();
+
+ QVERIFY(VideoServices::mReferenceCount == 0);
+}
+
+void TestVideoPlayerEngine::testHandleCommandPluginFail()
+{
+ init();
+
+ QVERIFY(mTestObject);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin == 0);
+ QVERIFY(mTestObject->mPlaybackViewPlugin == 0);
+ QVERIFY(mTestObject->mCollectionViewPlugin == 0);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin == 0);
+ QVERIFY(mTestObject->mIsService == false);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ XQPluginLoader::mFailToLoadPluginUid = MpxHbVideoCommon::KMpxVideoPluginDllFileDetailsUid;
+
+ mTestObject->initialize();
+
+ QVERIFY(mTestObject->mCurrentViewPlugin != 0);
+ QVERIFY(mTestObject->mPlaybackViewPlugin != 0);
+ QVERIFY(mTestObject->mCollectionViewPlugin != 0);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin == 0);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin == mTestObject->mCollectionViewPlugin);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin->activated());
+ QVERIFY(mTestObject->mCollectionViewPlugin->activated());
+ QVERIFY(mTestObject->mPlaybackViewPlugin->activated() == false);
+ QVERIFY(mTestObject->mIsService == false);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ mTestObject->handleCommand(MpxHbVideoCommon::ActivatePlaybackView);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin == mTestObject->mPlaybackViewPlugin);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin->activated());
+ QVERIFY(mTestObject->mPlaybackViewPlugin->activated());
+ QVERIFY(mTestObject->mCollectionViewPlugin->activated() == false);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin != 0);
+ QVERIFY(mTestObject->mPlaybackViewPlugin != 0);
+ QVERIFY(mTestObject->mCollectionViewPlugin != 0);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin == 0);
+ QVERIFY(mTestObject->mIsService == false);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ mTestObject->handleCommand(MpxHbVideoCommon::ActivateVideoDetailsView);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin == 0);
+
+ QVERIFY(mTestObject->mCollectionViewPlugin->activated() == false);
+ QVERIFY(mTestObject->mPlaybackViewPlugin->activated() == false);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin == 0);
+ QVERIFY(mTestObject->mPlaybackViewPlugin != 0);
+ QVERIFY(mTestObject->mCollectionViewPlugin != 0);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin == 0);
+ QVERIFY(mTestObject->mIsService == false);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ mTestObject->handleCommand(MpxHbVideoCommon::ActivateCollectionView);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin == mTestObject->mCollectionViewPlugin);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin->activated());
+ QVERIFY(mTestObject->mCollectionViewPlugin->activated());
+ QVERIFY(mTestObject->mPlaybackViewPlugin->activated() == false);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin != 0);
+ QVERIFY(mTestObject->mPlaybackViewPlugin != 0);
+ QVERIFY(mTestObject->mCollectionViewPlugin != 0);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin == 0);
+ QVERIFY(mTestObject->mIsService == false);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ cleanup();
+
+ QVERIFY(VideoServices::mReferenceCount == 0);
+}
+
+void TestVideoPlayerEngine::testHandleCommandPluginFail1()
+{
+ init();
+
+ QVERIFY(mTestObject);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin == 0);
+ QVERIFY(mTestObject->mPlaybackViewPlugin == 0);
+ QVERIFY(mTestObject->mCollectionViewPlugin == 0);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin == 0);
+ QVERIFY(mTestObject->mIsService == false);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ XQPluginLoader::mFailToLoadPluginUid = MpxHbVideoCommon::KMpxVideoPluginDllCollectionUid;
+
+ mTestObject->initialize();
+
+ QVERIFY(mTestObject->mCurrentViewPlugin == 0);
+ QVERIFY(mTestObject->mPlaybackViewPlugin != 0);
+ QVERIFY(mTestObject->mCollectionViewPlugin == 0);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin != 0);
+ QVERIFY(mTestObject->mIsService == false);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ QVERIFY(mTestObject->mPlaybackViewPlugin->activated() == false);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin->activated() == false);
+
+ mTestObject->handleCommand(MpxHbVideoCommon::ActivatePlaybackView);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin == mTestObject->mPlaybackViewPlugin);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin->activated());
+ QVERIFY(mTestObject->mPlaybackViewPlugin->activated());
+ QVERIFY(mTestObject->mFileDetailsViewPlugin->activated() == false);
+ QVERIFY(mTestObject->mIsService == false);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin != 0);
+ QVERIFY(mTestObject->mPlaybackViewPlugin != 0);
+ QVERIFY(mTestObject->mCollectionViewPlugin == 0);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin != 0);
+
+ mTestObject->handleCommand(MpxHbVideoCommon::ActivateCollectionView);
+
+ QVERIFY(mTestObject->mPlaybackViewPlugin->activated() == false);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin->activated() == false);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin == 0);
+ QVERIFY(mTestObject->mPlaybackViewPlugin != 0);
+ QVERIFY(mTestObject->mCollectionViewPlugin == 0);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin != 0);
+ QVERIFY(mTestObject->mIsService == false);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ mTestObject->handleCommand(MpxHbVideoCommon::ActivateVideoDetailsView);
+
+ QVERIFY(mTestObject->mFileDetailsViewPlugin != 0);
+ QVERIFY(mTestObject->mCurrentViewPlugin == mTestObject->mFileDetailsViewPlugin);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin->activated());
+ QVERIFY(mTestObject->mPlaybackViewPlugin->activated() == false);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin->activated());
+
+ QVERIFY(mTestObject->mCurrentViewPlugin != 0);
+ QVERIFY(mTestObject->mPlaybackViewPlugin != 0);
+ QVERIFY(mTestObject->mCollectionViewPlugin == 0);
+ QVERIFY(mTestObject->mIsService == false);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ mTestObject->handleCommand(MpxHbVideoCommon::ActivateCollectionView);
+
+ QVERIFY(mTestObject->mPlaybackViewPlugin->activated() == false);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin->activated() == false);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin == 0);
+ QVERIFY(mTestObject->mPlaybackViewPlugin != 0);
+ QVERIFY(mTestObject->mCollectionViewPlugin == 0);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin != 0);
+ QVERIFY(mTestObject->mIsService == false);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ cleanup();
+
+ QVERIFY(VideoServices::mReferenceCount == 0);
+}
+
+void TestVideoPlayerEngine::testHandleCommandPluginFail2()
+{
+ init();
+
+ QVERIFY(mTestObject);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin == 0);
+ QVERIFY(mTestObject->mPlaybackViewPlugin == 0);
+ QVERIFY(mTestObject->mCollectionViewPlugin == 0);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin == 0);
+ QVERIFY(mTestObject->mIsService == false);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ XQPluginLoader::mFailToLoadPluginUid = MpxHbVideoCommon::KMpxVideoPluginDllPlaybackUid;
+
+ mTestObject->initialize();
+
+ QVERIFY(mTestObject->mCurrentViewPlugin != 0);
+ QVERIFY(mTestObject->mPlaybackViewPlugin == 0);
+ QVERIFY(mTestObject->mCollectionViewPlugin != 0);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin != 0);
+ QVERIFY(mTestObject->mIsService == false);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin == mTestObject->mCollectionViewPlugin);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin->activated());
+ QVERIFY(mTestObject->mCollectionViewPlugin->activated());
+ QVERIFY(mTestObject->mFileDetailsViewPlugin->activated() == false);
+
+ mTestObject->handleCommand(MpxHbVideoCommon::ActivatePlaybackView);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin == 0);
+
+ QVERIFY(mTestObject->mCollectionViewPlugin->activated() == false);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin->activated() == false);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin == 0);
+ QVERIFY(mTestObject->mPlaybackViewPlugin == 0);
+ QVERIFY(mTestObject->mCollectionViewPlugin != 0);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin != 0);
+ QVERIFY(mTestObject->mIsService == false);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ mTestObject->handleCommand(MpxHbVideoCommon::ActivateCollectionView);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin == mTestObject->mCollectionViewPlugin);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin->activated());
+ QVERIFY(mTestObject->mCollectionViewPlugin->activated());
+ QVERIFY(mTestObject->mFileDetailsViewPlugin->activated() == false);
+
+ QVERIFY(mTestObject->mCurrentViewPlugin != 0);
+ QVERIFY(mTestObject->mPlaybackViewPlugin == 0);
+ QVERIFY(mTestObject->mCollectionViewPlugin != 0);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin != 0);
+ QVERIFY(mTestObject->mIsService == false);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ mTestObject->handleCommand(MpxHbVideoCommon::ActivateVideoDetailsView);
+
+ QVERIFY(mTestObject->mFileDetailsViewPlugin != 0);
+ QVERIFY(mTestObject->mCurrentViewPlugin == mTestObject->mFileDetailsViewPlugin);
+
+ QVERIFY(mTestObject->mFileDetailsViewPlugin != 0);
+ QVERIFY(mTestObject->mCurrentViewPlugin->activated());
+ QVERIFY(mTestObject->mCollectionViewPlugin->activated() == false);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin->activated());
+
+ QVERIFY(mTestObject->mCurrentViewPlugin != 0);
+ QVERIFY(mTestObject->mPlaybackViewPlugin == 0);
+ QVERIFY(mTestObject->mCollectionViewPlugin != 0);
+ QVERIFY(mTestObject->mFileDetailsViewPlugin != 0);
+ QVERIFY(mTestObject->mIsService == false);
+ QVERIFY(VideoServices::mReferenceCount == 0);
+
+ cleanup();
+
+ QVERIFY(VideoServices::mReferenceCount == 0);
+}
+
+void TestVideoPlayerEngine::testPlayMedia()
+{
+ init();
+ mTestObject->playMedia( QString("c:\\data\\videos\\test.3gp"));
+ QVERIFY(mTestObject);
+ cleanup();
+}
+
+void TestVideoPlayerEngine::testSetEmbedded()
+{
+ init();
+ QVERIFY(mTestObject);
+ mTestObject->setEmbedded();
+ QVERIFY( mTestObject->mEmbedded == true );
+ cleanup();
+}
+
+void TestVideoPlayerEngine::cleanupTestCase()
+{
+ // all common cleanup here
+}
+
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/stub/inc/mpxvideoplaybackwrapper.h Thu Apr 01 22:38:49 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 implementation of QMpxVideoPlaybackWrapper
+*
+*/
+
+// Version : %version: da1mmcf#3 %
+
+
+
+#ifndef MPXVIDEOPLAYBACKWRAPPER_H_
+#define MPXVIDEOPLAYBACKWRAPPER_H_
+
+#include <qobject>
+#include <qstring>
+#include <qfile>
+
+#include <mpxhbvideocommondefs.h>
+
+class QMpxVideoPlaybackWrapper : public QObject
+{
+ Q_OBJECT
+
+ public:
+ QMpxVideoPlaybackWrapper();
+ virtual ~QMpxVideoPlaybackWrapper();
+ int playMedia( QString aFileName );
+
+ public:
+ void openPlaybackView() ;
+ static int GetInstanceCount();
+
+ signals:
+ void handlePlaybackView( int viewId );
+
+ private:
+ static void Increment();
+ static void Decrement();
+};
+
+#endif /* STUBMPXVIDEOPLAYBACKWRAPPER_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/stub/inc/videoserviceplay.h Thu Apr 01 22:38:49 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: Declaration of VideoServicePlay
+*
+*/
+
+// Version : %version: 1 %
+
+#ifndef VIDEOSERVICEPLAY_H
+#define VIDEOSERVICEPLAY_H
+
+#include <QObject>
+
+#include "videoplayerengine.h"
+
+// FORWARD DECLARATIONS
+class VideoServices;
+
+class VideoServicePlay : public QObject
+ {
+
+ Q_OBJECT
+
+ public:
+ VideoServicePlay( VideoServices* parent, QVideoPlayerEngine* engine );
+ virtual ~VideoServicePlay();
+
+ public slots:
+ void playMedia( QString filePath );
+
+ private:
+ QVideoPlayerEngine* mEngine;
+ VideoServices* mServiceApp;
+ };
+
+ #endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/stub/inc/videoservices.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,112 @@
+/*
+* 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: ?Description
+*
+*/
+
+#ifndef __VIDEOSERVICES_H__
+#define __VIDEOSERVICES_H__
+
+#include <QStringList>
+#include "videoserviceurifetch.h"
+
+//FORWARD CLASS DECLARATION
+class VideoServiceUriFetch;
+class VideoServicePlay;
+class QVideoPlayerEngine;
+
+class VideoServices : public QObject
+{
+ Q_OBJECT
+
+public:
+
+ /**
+ * 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 VideoServices *instance(QVideoPlayerEngine* engine = 0);
+
+ /**
+ * Decreases the reference count, when count reaches zero cleanup is done.
+ *
+ */
+ void decreaseReferenceCount();
+
+ enum TVideoService
+ {
+ ENoService,
+ EUriFetcher,
+ EPlayback
+ };
+
+ /**
+ * Returns service active status
+ *
+ * @return bool true if active, false if not active
+ *
+ */
+ VideoServices::TVideoService currentService();
+
+private:
+
+ /**
+ * Constructor
+ */
+ VideoServices();
+
+ /**
+ * Constructor
+ */
+ VideoServices(QVideoPlayerEngine* engine);
+
+ /**
+ * Destructor.
+ */
+ virtual ~VideoServices();
+
+ void setCurrentService(VideoServices::TVideoService service);
+
+ Q_DISABLE_COPY(VideoServices)
+
+private:
+
+ /**
+ * Singleton instance.
+ */
+ static VideoServices* mInstance;
+
+ VideoServiceUriFetch* mServiceUriFetch;
+
+ VideoServicePlay* mServicePlay;
+
+ VideoServices::TVideoService mCurrentService;
+
+ friend class VideoServiceUriFetch;
+
+ friend class VideoServicePlay;
+
+public:
+
+ /**
+ * Reference count.
+ */
+ static int mReferenceCount;
+
+};
+
+#endif //__VIDEOSERVICES_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/stub/inc/videoserviceurifetch.h Thu Apr 01 22:38:49 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: VideoServiceUriFetch class definition
+*
+*/
+
+#ifndef __VIDEOSERVICESURIFETCH_H__
+#define __VIDEOSERVICESURIFETCH_H__
+
+//INCLUDES
+#include <QStringList>
+
+// FORWARD DECLARATIONS
+class VideoServices;
+
+class VideoServiceUriFetch : public QObject
+{
+
+ /**
+ * define to be able to use signals and slots
+ */
+ Q_OBJECT
+
+public:
+
+ /**
+ * contructor
+ */
+ VideoServiceUriFetch( VideoServices *parent = 0 );
+
+ /**
+ * destructor
+ */
+ ~VideoServiceUriFetch();
+
+public slots: // for QTHighway to notify provider about request
+ /*
+ * Client can use this method launch video URI fetching
+ *
+ * @param title title to be set
+ *
+ */
+ void fetch(const QString& title);
+
+private:
+ VideoServices* mServiceApp;
+};
+
+#endif //__VIDEOSERVICESURIFETCH_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/stub/src/mpxvideoplaybackwrapper.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* 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-implementation of QMpxVideoPlaybackWrapper
+*
+*/
+
+// Version : %version: da1mmcf#3 %
+
+
+#include "mpxvideoplaybackwrapper.h"
+
+int mCount = 0;
+
+QMpxVideoPlaybackWrapper::QMpxVideoPlaybackWrapper()
+{
+ QMpxVideoPlaybackWrapper::Increment();
+}
+
+QMpxVideoPlaybackWrapper::~QMpxVideoPlaybackWrapper()
+{
+ QMpxVideoPlaybackWrapper::Decrement();
+}
+
+void QMpxVideoPlaybackWrapper::openPlaybackView()
+{
+ emit handlePlaybackView( MpxHbVideoCommon::ActivatePlaybackView );
+}
+
+void QMpxVideoPlaybackWrapper::Increment()
+{
+ ++mCount;
+}
+
+void QMpxVideoPlaybackWrapper::Decrement()
+{
+ if(mCount > 0)
+ {
+ --mCount;
+ }
+}
+
+int QMpxVideoPlaybackWrapper::GetInstanceCount()
+{
+ return mCount;
+}
+
+int QMpxVideoPlaybackWrapper::playMedia( QString aFileName )
+{
+ return 0;
+}
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/stub/src/videoserviceplay.cpp Thu Apr 01 22:38:49 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: Implementation of QVideoPlayerEngine
+*
+*/
+
+// Version : %version: 1 %
+
+
+#include <videoservices.h>
+#include "videoserviceplay.h"
+#include "videoplayerengine.h"
+
+
+VideoServicePlay::VideoServicePlay( VideoServices* parent, QVideoPlayerEngine* engine )
+{
+ mServiceApp = parent;
+}
+
+VideoServicePlay::~VideoServicePlay()
+{
+}
+
+void VideoServicePlay::playMedia( QString filePath )
+{
+ mServiceApp->setCurrentService(VideoServices::EPlayback);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/stub/src/videoservices.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,98 @@
+/*
+* 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: ?Description
+*
+*/
+
+#include <videoplayerengine.h>
+#include <videoservices.h>
+#include <videoserviceurifetch.h>
+#include <videoserviceplay.h>
+
+
+VideoServices *VideoServices::mInstance = 0;
+int VideoServices::mReferenceCount = 0;
+
+// -----------------------------------------------------------------------------
+// VideoServices::instance()
+// -----------------------------------------------------------------------------
+//
+VideoServices* VideoServices::instance(QVideoPlayerEngine* engine)
+{
+ if(!mInstance)
+ {
+ mInstance = new VideoServices(engine);
+ }
+ mInstance->mReferenceCount++;
+ return mInstance;
+}
+
+// -----------------------------------------------------------------------------
+// VideoServices::decreaseReferenceCount()
+// -----------------------------------------------------------------------------
+//
+void VideoServices::decreaseReferenceCount()
+{
+ if(mInstance)
+ {
+ if(--mInstance->mReferenceCount == 0)
+ {
+ delete mInstance;
+ mInstance = NULL;
+ }
+ }
+}
+
+
+// ----------------------------------------------------------------------------
+// VideoServices()
+// ----------------------------------------------------------------------------
+//
+VideoServices::VideoServices(QVideoPlayerEngine* engine) :
+mCurrentService(VideoServices::ENoService)
+{
+ mServiceUriFetch = new VideoServiceUriFetch(this);
+ mServicePlay = new VideoServicePlay(this, engine);
+}
+
+// ----------------------------------------------------------------------------
+// ~VideoServices()
+// ----------------------------------------------------------------------------
+//
+VideoServices::~VideoServices()
+{
+ delete mServiceUriFetch;
+ delete mServicePlay;
+}
+
+
+// ----------------------------------------------------------------------------
+// currentService()
+// ----------------------------------------------------------------------------
+//
+VideoServices::TVideoService VideoServices::currentService()
+{
+ return mCurrentService;
+}
+
+
+// ----------------------------------------------------------------------------
+// setCurrentService()
+// ----------------------------------------------------------------------------
+//
+void VideoServices::setCurrentService(VideoServices::TVideoService service)
+{
+ mCurrentService = service;
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/stub/src/videoserviceurifetch.cpp Thu Apr 01 22:38:49 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: ?Description
+*
+*/
+
+#include <videoservices.h>
+#include <videoserviceurifetch.h>
+
+
+// ----------------------------------------------------------------------------
+// VideoServiceUriFetch()
+// ----------------------------------------------------------------------------
+//
+VideoServiceUriFetch::VideoServiceUriFetch(VideoServices* parent)
+{
+ mServiceApp = parent;
+}
+
+// ----------------------------------------------------------------------------
+// ~VideoServiceUriFetch()
+// ----------------------------------------------------------------------------
+//
+VideoServiceUriFetch::~VideoServiceUriFetch()
+{
+
+}
+
+// ----------------------------------------------------------------------------
+// fetch()
+// ----------------------------------------------------------------------------
+//
+void VideoServiceUriFetch::fetch(const QString& title)
+{
+ mServiceApp->setCurrentService(VideoServices::EUriFetcher);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/videoplayerengine/tsrc/testvideoplayerengine/testvideoplayerengine.pro Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,66 @@
+#
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description: Project file for building Videoplayer components
+#
+#
+# Version : %version: 8 %
+
+
+TEMPLATE = app
+TARGET = testvideoplayerengine
+DEFINES += BUILD_VIDEOPLAYERAPP_DLL
+
+DEPENDPATH += . \
+ inc \
+ src
+
+INCLUDEPATH += . \
+ stub/inc \
+ /epoc32/include \
+ /epoc32/include/stdapis \
+ /epoc32/include/stdapis/sys \
+ ../../inc \
+ ../../../../inc
+
+CONFIG += qtestlib hb qt
+
+LIBS += -lestor.dll \
+ -lfbscli.dll \
+ -lbitgdi.dll \
+ -lgdi.dll \
+ -lxqserviceutil.dll
+
+
+# Input
+HEADERS += stub/inc/mpxvideoplaybackwrapper.h \
+ stub/inc/mpxviewpluginqt.h \
+ stub/inc/testviewplugin.h \
+ stub/inc/xqpluginloader.h \
+ stub/inc/xqplugininfo.h \
+ stub/inc/hbinstance.h \
+ inc/testvideoplayerengine.h \
+ stub/inc/videoservices.h \
+ stub/inc/videoserviceurifetch.h \
+ stub/inc/videoserviceplay.h \
+ ../../../../inc/videoplayerengine.h
+
+SOURCES += stub/src/mpxvideoplaybackwrapper.cpp \
+ stub/src/testviewplugin.cpp \
+ stub/src/xqpluginloader.cpp \
+ stub/src/hbinstance.cpp \
+ src/testvideoplayerengine.cpp \
+ stub/src/videoservices.cpp \
+ stub/src/videoserviceurifetch.cpp \
+ stub/src/videoserviceplay.cpp \
+ ../../src/videoplayerengine.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/videoplayerengine/tsrc/testvideoservices/inc/testvideoservices.h Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,102 @@
+/*
+* 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: Videoplayerengine test class declaration.
+*
+*/
+
+// TODO: at the moment we are not able to get access to all private methods
+// to the class under test. We need to declare some own framework in order
+// to declare testclasses into friends of classes under test etc.
+//
+// missing test functions:
+// - how to setup construction to fail for testing purposes
+
+
+#ifndef __TESTVIDEOSERVICES_H__
+#define __TESTVIDEOSERVICES_H__
+
+
+// INCLUDES
+#include <QtTest/QtTest>
+
+class VideoServices;
+class QVideoPlayerEngine;
+
+class TestVideoServices : public QObject
+ {
+
+ Q_OBJECT
+
+public: // Constructor / destructor
+
+ /**
+ * Contructor.
+ *
+ */
+ TestVideoServices();
+
+ /**
+ * Destructor.
+ *
+ */
+ virtual ~TestVideoServices();
+
+private slots:
+
+ void init();
+ void cleanup();
+
+ void testCreateDelete();
+
+ void testCreateDeleteEngine();
+
+ void testCurrentService();
+
+#if 0
+ void testInitialize();
+ void testInitializeService();
+
+ void testMultipleInitialize();
+ void testMultipleInitializeService();
+
+ void testHandleCommandPreInit();
+ void testHandleCommandPostInit();
+ void testHandleCommandPreAndPostInit();
+
+ void testHandleCommandPluginFail();
+ void testHandleCommandPluginFail1();
+ void testHandleCommandPluginFail2();
+
+ void testPlayMedia();
+ void testSetEmbedded();
+#endif
+ // called after last test case executed
+ void cleanupTestCase();
+
+signals:
+
+ void aboutToQuit();
+
+private:
+
+ VideoServices* mTestObject;
+ QVideoPlayerEngine* mEngine;
+};
+
+#endif // __TESTVIDEOSERVICES_H__
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/videoplayerengine/tsrc/testvideoservices/src/testvideoservices.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,152 @@
+/*
+* 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: Videoplayerengine test class implementation.
+*
+*/
+
+// INCLUDES
+#include <QtTest/QtTest>
+#include <qdebug.h>
+#include <hbapplication.h>
+
+#include "mpxhbvideocommondefs.h"
+#include "videoplayerengine.h"
+#include "testvideoservices.h"
+
+#define private public
+#include "videoservices.h"
+#include "videoserviceurifetch.h"
+#include "videoserviceplay.h"
+#undef private
+
+// ---------------------------------------------------------------------------
+// main
+// ---------------------------------------------------------------------------
+//
+int main(int argc, char *argv[])
+{
+ HbApplication app(argc, argv);
+
+ TestVideoServices tc;
+
+ char *pass[3];
+ pass[0] = argv[0];
+ pass[1] = "-o";
+ pass[2] = "c:\\data\\TestVideoServices.txt";
+
+ return QTest::qExec(&tc, 3, pass);
+}
+
+
+TestVideoServices::TestVideoServices()
+ : mTestObject(0),
+ mEngine(0)
+{
+}
+
+TestVideoServices::~TestVideoServices()
+{
+ delete mTestObject;
+ mTestObject = 0;
+}
+
+
+void TestVideoServices::init()
+{
+}
+
+void TestVideoServices::cleanup()
+{
+ delete mEngine;
+ mEngine = 0;
+
+ QCOMPARE(mTestObject->mReferenceCount, 1);
+ if(mTestObject)
+ {
+ mTestObject->decreaseReferenceCount();
+ }
+ mTestObject = 0;
+}
+
+void TestVideoServices::testCreateDelete()
+{
+ mTestObject = VideoServices::instance();
+
+ QVERIFY(mTestObject);
+ QVERIFY(mTestObject->mServicePlay);
+ QVERIFY(mTestObject->mServiceUriFetch);
+ QVERIFY(mTestObject->mEngine == 0);
+ QVERIFY(mTestObject->mCurrentService == VideoServices::ENoService);
+}
+
+void TestVideoServices::testCreateDeleteEngine()
+{
+ mEngine = new QVideoPlayerEngine();
+ mTestObject = VideoServices::instance(mEngine);
+
+ QVERIFY(mTestObject);
+ QVERIFY(mTestObject->mServicePlay);
+ QVERIFY(mTestObject->mServiceUriFetch);
+ QVERIFY(mTestObject->mEngine == mEngine);
+ QVERIFY(mTestObject->mCurrentService == VideoServices::ENoService);
+}
+
+
+void TestVideoServices::testCurrentService()
+{
+ mTestObject = VideoServices::instance();
+
+ QVERIFY(mTestObject);
+ QVERIFY(mTestObject->mServicePlay);
+ QVERIFY(mTestObject->mServiceUriFetch);
+ QVERIFY(mTestObject->mEngine == 0);
+ QVERIFY(mTestObject->mCurrentService == VideoServices::ENoService);
+
+ mTestObject->mServicePlay->playMedia(QString());
+ QVERIFY(mTestObject->mCurrentService == VideoServices::ENoService);
+
+ mTestObject->mServiceUriFetch->fetch(QString());
+ QVERIFY(mTestObject->mCurrentService == VideoServices::EUriFetcher);
+
+ mTestObject->mServicePlay->playMedia(QString());
+ QVERIFY(mTestObject->mCurrentService == VideoServices::EUriFetcher);
+
+ cleanup();
+
+ mEngine = new QVideoPlayerEngine();
+ mTestObject = VideoServices::instance(mEngine);
+
+ QVERIFY(mTestObject);
+ QVERIFY(mTestObject->mServicePlay);
+ QVERIFY(mTestObject->mServiceUriFetch);
+ QVERIFY(mTestObject->mEngine == mEngine);
+ QVERIFY(mTestObject->mCurrentService == VideoServices::ENoService);
+
+ mTestObject->mServiceUriFetch->fetch(QString());
+ QVERIFY(mTestObject->mCurrentService == VideoServices::EUriFetcher);
+
+ mTestObject->mServicePlay->playMedia(QString());
+ QVERIFY(mTestObject->mCurrentService == VideoServices::EPlayback);
+}
+
+void TestVideoServices::cleanupTestCase()
+{
+ // all common cleanup here
+}
+
+
+// End of file
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/videoplayerengine/tsrc/testvideoservices/stub/inc/videoplayerengine.h Thu Apr 01 22:38:49 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: Implementation of QVideoPlayerEngine
+*
+*/
+
+// Version : %version: 1 %
+
+#ifndef VIDEOPLAYERENGINE_H
+#define VIDEOPLAYERENGINE_H
+
+#include <qobject.h>
+
+//FORWARD CLASS DECLARATION
+
+/**
+ * QVideoPlayerEngine
+ *
+ */
+class QVideoPlayerEngine: public QObject
+{
+ Q_OBJECT
+
+ public:
+ /**
+ * Constructor
+ */
+ QVideoPlayerEngine(bool isService = false);
+
+ /**
+ * Destructor.
+ */
+ virtual ~QVideoPlayerEngine();
+
+ public:
+ void initialize();
+ void playMedia( QString filePath );
+ void setEmbedded();
+
+ public slots:
+ void handleCommand( int commandCode );
+
+ private slots:
+ void handleQuit();
+
+ private:
+ bool mIsService;
+ bool mEmbedded;
+};
+
+#endif // VIDEOPLAYERENGINE_H
+
+// EOF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/videoplayerengine/tsrc/testvideoservices/stub/src/videoplayerengine.cpp Thu Apr 01 22:38:49 2010 +0300
@@ -0,0 +1,93 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: Implementation of VideoPlayerEngine
+*
+*/
+
+// Version : %version: 1 %
+
+
+#include <qapplication>
+
+#include <hbinstance.h>
+#include <xqpluginloader.h>
+#include <xqplugininfo.h>
+#include <xqserviceutil.h>
+
+#include "videoplayerengine.h"
+#include "mpxvideoplaybackwrapper.h"
+
+// -------------------------------------------------------------------------------------------------
+// QVideoPlayerEngine()
+// -------------------------------------------------------------------------------------------------
+//
+QVideoPlayerEngine::QVideoPlayerEngine(bool isService)
+ : mIsService( isService )
+ , mEmbedded(false)
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// ~QVideoPlayerEngine()
+// -------------------------------------------------------------------------------------------------
+//
+QVideoPlayerEngine::~QVideoPlayerEngine()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// initialize()
+// -------------------------------------------------------------------------------------------------
+//
+void QVideoPlayerEngine::initialize()
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// handleCommand()
+// -------------------------------------------------------------------------------------------------
+//
+void QVideoPlayerEngine::handleCommand( int commandCode )
+{
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// handleQuit()
+// -------------------------------------------------------------------------------------------------
+//
+void QVideoPlayerEngine::handleQuit()
+{
+ delete this;
+}
+
+
+// -------------------------------------------------------------------------------------------------
+// playMedia()
+// -------------------------------------------------------------------------------------------------
+//
+void QVideoPlayerEngine::playMedia( QString filePath )
+{
+}
+
+// -------------------------------------------------------------------------------------------------
+// setEmbedded()
+// -------------------------------------------------------------------------------------------------
+//
+void QVideoPlayerEngine::setEmbedded()
+{
+ mEmbedded = true;
+}
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/videoplayerengine/tsrc/testvideoservices/testvideoservices.pro Thu Apr 01 22:38:49 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: Project file for building Videoplayer components
+#
+
+
+TEMPLATE = app
+TARGET =
+DEFINES += BUILD_VIDEOPLAYERAPP_DLL
+
+DEPENDPATH += . \
+ inc \
+ src
+
+INCLUDEPATH += . \
+ stub/inc \
+ ../../../inc \
+ ../../../../inc \
+ /epoc32/include \
+ /epoc32/include/stdapis \
+ /epoc32/include/stdapis/sys \
+
+
+CONFIG += qtestlib hb qt
+
+LIBS += -lestor.dll \
+ -lfbscli.dll \
+ -lbitgdi.dll \
+ -lgdi.dll \
+ -lxqservice.dll
+
+
+# Input
+HEADERS += stub/inc/videoplayerengine.h \
+ inc/testvideoservices.h \
+ ../../inc/videoservices.h \
+ ../../inc/videoserviceurifetch.h \
+ ../../inc/videoserviceplay.h \
+ ../../../inc/videoplayerappexport.h
+
+SOURCES += stub/src/videoplayerengine.cpp \
+ #stub/src/xqserviceprovider.cpp \
+ src/testvideoservices.cpp \
+ ../../src/videoservices.cpp \
+ ../../src/videoserviceurifetch.cpp \
+ ../../src/videoserviceplay.cpp
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/videoplayerapp/videoplayerengine/videoplayerengine.pro Thu Apr 01 22:38:49 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: Project file for building Videoplayer components
+#
+#
+# Version : %version: 19 %
+
+
+TEMPLATE = lib
+TARGET = videoplayerengine
+CONFIG += hb qt dll
+DEFINES += BUILD_VIDEOPLAYERAPP_DLL
+
+symbian:
+{
+ TARGET.CAPABILITY = ALL -DRM -TCB
+ TARGET.EPOCALLOWDLLDATA = 1
+ TARGET.UID3 = 0x20024337
+ TARGET.EPOCHEAPSIZE = 0x20000 0x1600000
+ INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE \
+ $$APP_LAYER_SYSTEMINCLUDE SYSTEMINCLUDE
+ BLD_INF_RULES.prj_exports += "rom/videoplayerengine.iby CORE_APP_LAYER_IBY_EXPORT_PATH(videoplayerengine.iby)"
+}
+
+INCLUDEPATH += ../../inc \
+ ../inc
+
+LIBS += -lmpxviewframeworkqt.dll \
+ -lxqplugins.dll \
+ -lmpxplaybackutility.dll \
+ -lmpxcollectionutility.dll \
+ -lmpxcollectionhelper.dll \
+ -lmpxcommon.dll \
+ -lestor.dll \
+ -lfbscli.dll \
+ -lapengine.dll \
+ -lapsettingshandlerui.dll \
+ -lmpsettengine.dll \
+ -lplaybackhelper.dll \
+ -lvideoplaylistutility.dll \
+ -lcommdb.dll \
+ -lservicehandler.dll \
+ -lxqservice.dll \
+ -lxqserviceutil.dll \
+ -lflogger.dll
+
+DEPENDPATH += ../inc inc
+VPATH += src
+
+HEADERS += videoplayerengine.h \
+ mpxvideoplaybackwrapper.h \
+ mpxvideoplayerappuiengine.h \
+ mpxvideoembeddedpdlhandler.h \
+ videoservices.h \
+ videoserviceplay.h \
+ videoserviceurifetch.h
+
+SOURCES += videoplayerengine.cpp \
+ mpxvideoplaybackwrapper.cpp \
+ mpxvideoplayerappuiengine.cpp \
+ mpxvideoembeddedpdlhandler.cpp \
+ videoservices.cpp \
+ videoserviceplay.cpp \
+ videoserviceurifetch.cpp
+